Hi.
I have a plugin that uses the richcombo plugin. My plugin populates richcombo with some items. After the editor has loaded, a user may click on one of the links in the richcombo and get a dialog where he can select which items he wants to see in the richcombo. After closing this dialog, I want to refresh that list with clientside code. Is this possible?
The important code is:
As you can see, buildList is incomplete (I always add items to the list, no removal is done).
However, whenever I add to the list after init has been run, I get a javascript error the next time I try to open the richcombo stating that
"n.getById(p) is null" in firefox and "SCRIPT5007: Unable to get value of the property 'removeClass': object is null or undefined" in chrome and IE9
Is this not possible to do at all? Can I work around this by deleting the old richcombo completely and creating a new one?
Thanks for any help!
ElChe
I have a plugin that uses the richcombo plugin. My plugin populates richcombo with some items. After the editor has loaded, a user may click on one of the links in the richcombo and get a dialog where he can select which items he wants to see in the richcombo. After closing this dialog, I want to refresh that list with clientside code. Is this possible?
The important code is:
editor.ui.addRichCombo('MyPlugin', { label: "Insert", className: 'myClassname', showAll: function () { buildList(this, config.MyPlugin); }, panel: { css: [config.contentsCss, CKEDITOR.getUrl(editor.skinPath + 'editor.css')], multiSelect: false, voiceLabel: lang.panelVoiceLabel }, init: function () { var rebuildList = CKEDITOR.tools.bind(buildList, this); rebuildList(); // Initial call // I bind buildList function so that that function has access to "this" later $(editor).bind('rebuildList', rebuildList); }, onClick: function (id) { openIFrame(id, this); } }); var buildList = function () { for (var i in myItems) { var item =myItems[i]; var html = "<img src='" + item.iconSrc + "' class='' style='border: 0 none; margin-right: 4px;vertical-align:middle;' />" + item.text; this.add(item.id, html, item.text); } }; var triggerBuildList = new function(editor){ $(editor).trigger('rebuildList'); };
As you can see, buildList is incomplete (I always add items to the list, no removal is done).
However, whenever I add to the list after init has been run, I get a javascript error the next time I try to open the richcombo stating that
"n.getById(p) is null" in firefox and "SCRIPT5007: Unable to get value of the property 'removeClass': object is null or undefined" in chrome and IE9
Is this not possible to do at all? Can I work around this by deleting the old richcombo completely and creating a new one?
Thanks for any help!
ElChe
Re: Richcombo - change the contents after init
I found out myself this morning. The answer is described here:
http://stackoverflow.com/questions/7762 ... 98#8397198
Re: Richcombo - change the contents after init
1. It needs to be possible to modify the list after init
2. A remove method (the opposite of add which already exists)
Unless I´ve misunderstood this plugin completely, I think you can pick up some of my code in the answer above to understand what I´m going for and how to add this enhancement.
ElChe
Re: Richcombo - change the contents after init
Thanks for your suggestions. Could you, however, submit them (along with the code) at our Development site? The issue can then be analyzed and discussed among our developers and if accepted, will make it to CKEditor core. Thanks!
Documentation Manager, CKSource
See CKEditor 5 docs, CKEditor 4 docs, CKEditor 3 docs, CKFinder 3 docs, CKFinder 2 docs for help.
Visit the new CKEditor SDK for samples showcasing editor features to try out and download!
Re: Richcombo - change the contents after init
Thanks Anna.
I have submitted the suggestion here: http://dev.ckeditor.com/ticket/8574
Im unsure which component I should set, so feel free to change from general. It´s basically on the plugin richcombo.
ElChe