I am using WYSIWYG editor CKeditor in one of my websites and to be more user-friendly, I Once the editor is used, I'd like to automatically load specific templates. For good integration with the rest of the website (which is designed with the content displayed in two columns), this template is implemented by the client, so I want to simplify their work.
Now, I am using the following code which I found on the CcDitor forum:
CKEDITOR.replace ("newscontent", {customConfig: "/ ckeditor / Config / news .js ", but: {instanceReady: function (ev) {this.execCommand ('template');}},});
This is almost good because it allows to open the template selection page, and therefore the user can choose the template directly before editing (he has only one option).
But I would like to apply (only) the template without asking the user to select it in the template selection page.
So I'm wondering if a function exists like "execCommand" to implement the template editor? I think that when I click on a template in the template selection page, then this action is executed, but I did not find it in the documentation.
Thank you for your help.
This works for me.
CKEDITOR.replace ("newsContent", {customConfig: "/ckeditor/config/news.js", at: {instanceReady: function (ev) {insert = CKEDITOR.getTemplates ('your_required_template_name '); This.setData (insert.templates [0] .html);}}}});
Comments
Post a Comment