[kupu-dev] kupu error when I try to insert some custom code
Jordi Martinez
jordim at guellconsulting.com
Wed Oct 22 12:31:37 CEST 2008
Hi!
I create a kupu tool with this code:
function FoneticaTool() {
this.initialize = function(editor) {
this.editor = editor;
this.editor.logMessage(_('Fonetica tool initialized'));
};
this.createFonetica = function(texte) {
var sel = this.editor.getSelection();
var tnode = this.editor.getInnerDocument().createTextNode(texte);
sel.replaceWithNode(tnode, true);
this.editor.logMessage(_('Fonetica inserted'));
this.editor.updateState();
this.editor.focusDocument();
return tnode;
};
}
FoneticaTool.prototype = new KupuTool;
I add all the needed stuff in their places and all works ok except the
createFonetica function
The error line is
sel.replaceWithNode(tnode, true);
and the error is
uncaught exception: [Exception... "Component returned failure code:
0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsISelection.getRangeAt]"
nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame ::
http://192.168.1.38:8110/esadir/kupuhelpers.js :: anonymous :: line
443" data: no]
Line 0
If I try to see the texte content (with an alert, for instance) the
content is ok
Anyone has any clue with this problem?
To Guido: I copy this code from a mail sended by you trying to help me
Thanks!
More information about the kupu-dev
mailing list