0
votes

I need to edit an ascx file's content with CKEditor. The content of ascx is mostly pure html code. It also has a custom tags in it (I use a custom framework and its own custom tags, ie: )

CKEditor erases those custom tags automatically (since they are not valid HTML codes).

How can I add/define framework's custom tags into CKEditor so it would not erase them.

PS: those custom tags don't need to be rendered in HTML view as long as they stay in the source code.

2

2 Answers

0
votes

You need to modify CKEDITOR.dtd object so editor will know this tag and correctly parse HTML and process DOM. See ckeditor how to allow for .insertHtml("<customTag myAttr='value'"></customTag>")

0
votes

CKEditor's protectedSource feature solved my problem. the custom tag sits in regular html code and CKEditor ignores it which is exactly what I want. I will be using CKEditor for text modification only.

//example custom tag: <inc:module src="module_name" runat="server" />

// protect <inc:* /></*
config.protectedSource.push(/<([\S]+)[^>]*inc:*>.*<\/\1>/g);
// protect <inc:* />
config.protectedSource.push(/<[^>]+inc:[^>\/]*\/>/g);