Luis Dalmolin Luis Dalmolin - 1 year ago 60
Javascript Question

Checkbox not rendering when editing

I have CKEditor 4 configured in my website, and just added a plugin (forms) that let me add checkboxes in my editor. I add the checkbox, save and the result is saved to my database.

But, when I'm editing my resource, when CKEditor appears, all the content show's but the checkbox didn't appear.

My HTML saved is this:

<p><input type="checkbox"> Testing</p>

My CKEditor config is:

var ck = CKEDITOR.replace(elm[0], {
forcePasteAsPlainText: true,

toolbar: [
{ name: 'basicstyles', items : ['Bold', 'Italic', 'Strike'] },
{ name: 'links', items : ['Link', 'Unlink'] },
{ name: 'paragraph', items : ['NumberedList', 'BulletedList', 'Checkbox'] }

ck.config.extraPlugins = 'forms';

Can somebody help me?

Answer Source

Just for the record, the solution for this problem was to allow other content types in CKEditor configuration.

ck.config.extraAllowedContent = 'input[type]';

This line make the editor accept input tags with the type attribute.