I want to create a button that insert some defined text (for example "Hello World") in the textarea.
The button is displayed correctly, but it doesn't work!
Here is my code:
ckeditor/plugins/_helloworld/plugin.js
CKEDITOR.plugins.add('_helloworld',
{
init: function (editor) {
editor.pluginName = '_helloworld';
editor.ui.addButton('_helloworld'',
{
label: 'write Hello World'',
command: '_helloworld'',
icon: this.path + 'plugin.gif'
});
editor.addCommand('_helloworld',
{
exec: function (editor) {
editor.write(' Hello World ');
}
});
}
});
I can't understand what's wrong... any ideas?
Thank you!
The button is displayed correctly, but it doesn't work!
Here is my code:
ckeditor/plugins/_helloworld/plugin.js
CKEDITOR.plugins.add('_helloworld',
{
init: function (editor) {
editor.pluginName = '_helloworld';
editor.ui.addButton('_helloworld'',
{
label: 'write Hello World'',
command: '_helloworld'',
icon: this.path + 'plugin.gif'
});
editor.addCommand('_helloworld',
{
exec: function (editor) {
editor.write(' Hello World ');
}
});
}
});
I can't understand what's wrong... any ideas?
Thank you!
Re: add "Hello world" button
See this example of a working plugin that does almost the same thing: http://docs.cksource.com/CKEditor_3.x/T ... amp_Plugin and is using the insertHtml method.
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: add "Hello world" button
Replacing the "editor.write()" with "editor.insertHtml()" it works perfectly!
THANK YOU!