[kupu-dev] Charmap: uncaught exception
Jordi Martinez
jordim at guellconsulting.com
Wed Aug 27 18:01:56 CEST 2008
Jordi Martinez escribió:
> Hi!
> If you remember, the last week I ask for how to create a kupu drawer
>
> Today I make this:
>
> at kupuploneinit.js I add this:
>
> var foneticatool = new FoneticaTool(kupu);
> kupu.registerTool('foneticatool', foneticatool);
>
> var foneticabutton = new KupuButton(prefix + 'button.kupu-fonetica',
> opendrawer('foneticadrawer'));
> kupu.registerTool('foneticabutton', foneticabutton);
>
> var foneticadrawer = new FoneticaDrawer(prefix +
> 'div.kupu-foneticadrawer', foneticatool);
> drawertool.registerDrawer(prefix + 'foneticadrawer', foneticadrawer , kupu);
>
> at kupu_wysiwyg_support this:
>
> <div id="kupu-foneticadrawer" class="kupu-drawer kupu-foneticadrawer">
> <h1 i18n:translate="foneticadrawer_title">Símbols
> fonètics</h1>
> <div tal:define="caracters python: [601, 603, 825, 248, 654, 952,
> 643, 658, 778, 626, 967]" tal:repeat="caracter caracters">
> <button type="button" tal:attributes="name
> string:Caracter${caracter}; onclick string:javascript:
> this.form['texte'].value = this.form['texte'].value + '&#${caracter};;'"
> tal:content="structure string:&#${caracter};" />
> </div>
> <div class="kupu-dialogbuttons">
> <input type="text" name="texte" />
> <button class="kupu-dialog-button" type="button"
> onclick="drawertool.current_drawer.save()" i18n:translate="">Ok</button>
> <button class="kupu-dialog-button" type="button"
> onclick="drawertool.closeDrawer()" i18n:translate="">Close</button>
> </div>
> </div>
>
> at kupubasetools.js this:
>
> function FoneticaTool() {
> this.initialize = function(editor) {
> this.editor = editor
> this.editor.logMessage(_('Fonetica tool initialized'));
> };
>
> this.createFonetica = function() {
> var fonetica = this.editor.getInnerDocument().createElement('span');
> var text = this.editor.getInnerDocument().createTextNode('Holas');
> fonetica.appendChild(text);
> fonetica.className = 'transcripcioFonetica';
> fonetica = this.editor.insertNodeAtSelection(fonetica, 1);
> this.editor.logMessage(_('Fonetica inserted'));
> this.editor.updateState();
> return fonetica;
> };
> }
>
> and at kupudrawers.js this:
>
> function FoneticaDrawer(elementid, tool) {
> this.element = getFromSelector(elementid);
> this.tool = tool;
> this.save = function() {
> this.tool.createFonetica();
> this.drawertool.closeDrawer();
> }
> };
>
> FoneticaDrawer.prototype = new Drawer;
>
> With this code all is ok except that when I push the ok button this
> exception is raised:
>
> 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]
>
> Could someone point me where is the error, please?
>
> Thanks a lot!!!!
>
> _______________________________________________
> kupu-dev mailing list
> kupu-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/kupu-dev
>
>
I make more test and this is my conclusions:
With firefox the same, the reported error
With IE7 if I select some text it works ok but if I don't select
anything it puts the code at first place in the current node
But with a very similar creation code (in fact I copy the image tool
code) the image tool works ok
Could the kupu maintainer helps me or point me to a good solution?
I'm using Zope 2.7.8 final, Plone 2.0.5 and kupu 1.3.9
Thanks
More information about the kupu-dev
mailing list