How can I create dropdown and fill with data from custom table in WYSIWYG ckeditor?

Vitaliy Ch. asked on July 2, 2014 11:44

Hi. I need to create custom dropdown lists with template keys which I can paste to text. The keys should be taken from custom tables in database. How can I do that?

Recent Answers


Vitaliy Ch. answered on July 2, 2014 21:57

Can anybody help me? I read how to add buttons here: http://devnet.kentico.com/questions/custom-buttons-on-ckeditor But there there doesn't wrote anything about getting data and fill with it ckeditor control. As I understand I need to create my custom control and implement my logic there? How can I do that? Do I need to inherit my custom class from cms.ckeditor control? Can anybody give me some example, please?

0 votesVote for this answer Mark as a Correct answer

lucas han answered on July 6, 2014 05:40

Hi Vitaliy,

I think you are going to a wrong direction. The CKEditor is in javascript and if you need more information, you can go to the sample custom plugin of ckeditor, and actually there is a custom dropdown list plugin that may fit your requirement.What you need to do is to create a web service that allow the data needed to be retrieved by javascript. in the plugin.js file replace the following code:

//  array of strings to choose from that'll be inserted into the editor
var strings = [];
strings.push(['@@FAQ::displayList()@@', 'FAQs', 'FAQs']);
strings.push(['@@Glossary::displayList()@@', 'Glossary', 'Glossary']);
strings.push(['@@CareerCourse::displayList()@@', 'Career Courses', 'Career Courses']);
strings.push(['@@CareerProfile::displayList()@@', 'Career Profiles', 'Career Profiles']);

with your web service datasource

0 votesVote for this answer Mark as a Correct answer

Vitaliy Ch. answered on July 6, 2014 23:27 (last edited on July 6, 2014 23:27)

Thank you Lucas for the answer. I'm did it in another way. I cloned HtmlAreaControl and made there some logic with "CMSHtmlEditor editor" which I wanted. Something like that: editor.Config[variable_name] = "some variable". After that in plugin script I used config variables.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.