Reputation: 157
Hello im working on some project and Im using CKEditor as content editor and to not lose website loading speed im initializing ckeditor only on textarea focus, but I have one problem, I made quotation function and I wanna it to initialize ckeditor if it's not already and then insert my desired quote.
For now code looks like this
var app = {
initializeEditor: function() {
CKEDITOR.replace('editor');
return CKEDITOR.instances;
},
initializeEditorOnFocus: function() {
// There goes code for focus
},
quote: function() {
// Note here it's getting ckeditor object
var ck = this.initializeEditor();
// There is more code with quotation
// Insert quote in editor
ck.editor.insertHtml(quotation);
}
};
When im clicking my desired quote to be inserted in editor it doesn't insert quote but only initialize ckeditor, any ideas how can I make this working?
Example how I need it to work: Press quote button -> initialize editor if its not already -> insert quote in editor
*Note: This isn't full code this is just example how I did it.
Upvotes: 0
Views: 1396