You are not logged in.
Pages: 1
So I have been trying to figure out how to write a plugin for a while for some specific CMS content I wish to add. It's pretty basic, so I thought I would start by using the CharacterMap plugin as a template for mine. This seemed great and fairly easy to understand. However, no matter what I have tried, I can't seem to get Xinha to load. In IE, it throws an error (although IE errors are useless):
Line: 11
Char: 1
Error: 'CharacterMap' is undefined
Code: 0
URL:
However, Firefox throws no such error, but it isn't loading Xinha...it just shows the textarea.
So, now I am curious...In none of the plugin's files is the string 'CharacterMap' mentioned, I have updated the language files, etc. Why can't I get this thing to load? Is there a Plugin Developer's HOW-TO on making plugins? Any help would be great!
Last edited by riftdesign (2005-03-30 23:31:52)
rift design studio
[url]http://www.riftdesign.com[/url]
Offline
Ok, I guess I missed a double-checked file that had CharacterMap mentioned, that has been taken care of, but IE still throws an error of "'RDSPlaceholders' is undefinded". RDSPlaceholders is the name of my plugin. Why would it be undefined?
rift design studio
[url]http://www.riftdesign.com[/url]
Offline
I think there is a real lake of dev documentation...
We should start a thread to define such documentation and also to formalize interface between Xinha and plugins (and backend also..). I asked to create a dev forum few days ago (divide Generall into subprojects) where we should discuss about that but it s seems that we are very few on this point of view..
I'm not english mother speaking (as you can read...) so I am not he best to manage it, but if I can help...
Offline
I think there is a real lake of dev documentation...
We should start a thread to define such documentation and also to formalize interface between Xinha and plugins (and backend also..). I asked to create a dev forum few days ago (divide Generall into subprojects) where we should discuss about that but it s seems that we are very few on this point of view..
I'm not english mother speaking (as you can read...) so I am not he best to manage it, but if I can help...
Offline
Well, I still have been unable to make this work correctly. For some reason, what I have below does not work for registering the plugin. The textarea remains just a textarea and xinha is not loaded.
This is the javascript in my form:
<script type="text/javascript">
_editor_url = "/admin/js/xinha/";
_editor_lang = "en";
</script>
<script type="text/javascript" src="/admin/js/xinha/htmlarea.js"></script>
<script type="text/javascript" src="/admin/js/xinha/lang/en.js"></script>
<script type="text/javascript">
xinha_editors = null;
xinha_init = null;
xinha_config = null;
xinha_plugins = null;
xinha_init = xinha_init ? xinha_init : function()
{
xinha_plugins = xinha_plugins ? xinha_plugins :
[
'CharacterMap',
'ContextMenu',
'FullScreen',
'SpellChecker',
'RDS_Macros',
'Linker',
'ImageManager',
'TableOperations'
];
// THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING :)
if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return;
xinha_editors = xinha_editors ? xinha_editors :
[
'Body'
];
xinha_config = xinha_config ? xinha_config : new HTMLArea.Config();
xinha_config.pageStyleSheets = ['/c/nobody.css'];
xinha_config.toolbar =
[
["popupeditor","separator"],
["undo","redo"], (HTMLArea.is_gecko ? [] : ["cut","copy","paste"]),["separator"],
["formatblock","separator","bold","italic","underline","strikethrough","separator"],
["subscript","superscript","separator"],
["forecolor","hilitecolor"],
["linebreak","justifyleft","justifycenter","justifyright","justifyfull","separator"],
["insertorderedlist","insertunorderedlist","outdent","indent","separator"],
["createlink","insertimage","inserttable","toggleborders","inserthorizontalrule","separator"],
["killword","removeformat","separator","htmlmode","about"]
];
xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
HTMLArea.startEditors(xinha_editors);
}
window.onload = xinha_init;
</script>
</head>
<body onload="xinha_init()">
This is the script of the plugin:
function RDS_Macros(editor) {
this.editor = editor;
var cfg = editor.config;
var toolbar = cfg.toolbar;
var self = this;
var i18n = RDS_Macros.I18N;
cfg.registerButton({
id : "insertrdsmacros",
tooltip : i18n["RDS_MacrosTooltip"],
image : editor.imgURL("ed_rds_macros.gif", "RDS_Macros"),
textMode : false,
action : function(editor) {
self.buttonPress(editor);
}
})
var a, i, j, found = false;
for (i = 0; !found && i < toolbar.length; ++i) {
a = toolbar[i];
for (j = 0; j < a.length; ++j) {
if (a[j] == "inserthorizontalrule") {
found = true;
break;
}
}
}
if (found)
a.splice(j, 0, "insertrdsmacros");
else{
toolbar[1].splice(0, 0, "separator");
toolbar[1].splice(0, 0, "insertrdsmacros");
}
};
RDS_Macros._pluginInfo = {
name : "RDSPlaceholders",
version : "1.0",
developer : "Rift Design Studio (RDS)",
developer_url : "http://www.riftdesign.com/",
c_owner : "Rift Design Studio",
sponsor : "Rift Design Studio",
sponsor_url : "http://www.riftdesign.com/",
license : "htmlArea"
};
RDS_Macros.prototype.buttonPress = function(editor) {
editor._popupDialog( "plugin://RDS_Macros/select_macro", function( entity )
{
if ( !entity )
{
//user must have pressed Cancel
return false;
}
editor.insertHTML( entity );
}, null);
}
Here's the language javascript:
RDS_Macros.I18N = {
"RDS_MacrosTooltip" : "Insert RDS Macro",
"Insert RDS Macro" : "Insert RDS Macro",
"Cancel" : "Cancel"
};
Any ideas out there?
rift design studio
[url]http://www.riftdesign.com[/url]
Offline
Thanks to NoXi and adamp on #xinha, we got it figured out...
When making plugins, your plugin name must be like the following
PATH: /xinha/plugins/PluginName
.js FILE: /xinha/plugins/PluginName/plugin-name.js (where there is a dash before each capitalized letter in the plugin folder)
That was a pain to figure out.
rift design studio
[url]http://www.riftdesign.com[/url]
Offline
Pages: 1