Note that there are some explanatory texts on larger screens.

plurals
  1. POPreserving SCRIPT tags (and more) in CKEditor
    text
    copied!<p>Is it possible to create a block of code within the CKEditor that will not be touched by the editor itself, and will be maintained in its intended-state until explicitly changed by the user? I've been attempting to input javascript variables (bound in script tags) and a flash movie following, but CKEditor continues to rewrite my pasted code/markup, and in doing so breaking my code.</p> <p>I'm working with the following setup:</p> <pre><code>&lt;script type="text/javascript"&gt; var editor = CKEDITOR.replace("content", { height : "500px", width : "680px", resize_maxWidth : "680px", resize_minWidth : "680px", toolbar : [ ['Source','-','Save','Preview'], ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','Anchor'], ['Image','Table','HorizontalRule','SpecialChar'] ] }); CKFinder.SetupCKEditor( editor, "&lt;?php print url::base(); ?&gt;assets/ckfinder" ); &lt;/script&gt; </code></pre> <p>I suppose the most ideal solution would be to preserve the contents of any tag that contains <code>class="preserve"</code> enabling much more than the limited exclusives.</p> <p><strong>Update</strong>: I'm thinking the solution to this problem is in <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.protectedSource" rel="nofollow noreferrer"><code>CKEDITOR.config.protectedSource()</code></a>, but my regular-expression experience is proving to be too juvenile to handle this issue. How would I go about exempting all tags that contain the 'preserved' class from being touched by CKEditor?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload