Last modified: 2009-11-02 10:05:52 UTC
Created attachment 6744 [details] patch To add a new dialog to the toolbar, one needs to do something like this: ... var mydialog = { modules: { mydialog: { titleMsg: 'mydialog-title', id: 'mydialog-id', init: mydialoginit, html: mydialoghtml, dialog: { width:400, buttons: { ... } } } } } $j('#wpTextbox1').wikiEditor('addDialog', mydialog); ... However, this doesn't seem to work (nor do other slight variations) and gives a JS error (in Firefox) like: Error: configuration is undefined Source File: http://wiki.com/w/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js?7 Line: 53 The attached patch should fix this.
Have you tested that this patch doesn't break the toolbar itself? Also, the change suggests that the following JS would work: var mydialog = { // modules: { // remove this line mydialog: { titleMsg: 'mydialog-title', id: 'mydialog-id', init: mydialoginit, html: mydialoghtml, dialog: { width:400, buttons: { ... } } } // } // remove this line } $j('#wpTextbox1').wikiEditor('addDialog', mydialog);
That change gives the same error as before. The problem is that the current addDialog function is creating something like this: finalobject = { 'modules': { userSuppliedObject } } So when the create function iterates over that, it adds the 'modules' object to the dialogs list. Technically this works: var mydialog = { // modules: { // remove this line // mydialog: { titleMsg: 'mydialog-title', id: 'mydialog-id', init: mydialoginit, html: mydialoghtml, dialog: { width:400, buttons: { ... } } // } // } // remove this line $j('#wpTextbox1').wikiEditor('addDialog', mydialog); But it only allows you to create one dialog called 'modules.' The change doesn't seem to have any effect on the rest of the toolbar, though my test wasn't exhaustive.
Fixed in r58423. Note that this revision also changed the calling convention for open/closeDialog from openDialog( { 'dialog': 'myDialogID' } ); to openDialog( 'myDialogID' );