问题
I have a jQuery implementation of CKEditor. We frequently add HTML markup to the 'title' attribute of an A tag using the dialog. However when we do this, it converts the HTML code so that it is parsed as text. We need the code to stay in the exact form that it was entered in, instead of it placing 'data-cke-saved' everywhere, and converting the <> to < and >.
I have tried turning entities off in the config, but it doesn't seem to work.
Can anyone help?
Thanks.
回答1:
SRC: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.protectedSource
List of regular expressions to be executed on input HTML, indicating HTML source code that when matched, must not be available in the WYSIWYG mode for editing.
config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP codeDefault Value: [] (empty array)config.protectedSource.push( /<%[\s\S]*?%>/g ); // ASP code
config.protectedSource.push( /(]+>[\s|\S]*?</asp:[^>]+>)|(]+/>)/gi ); // ASP.Net code
来源:https://stackoverflow.com/questions/6177667/preventing-ckeditor-from-adding-data-cke-saved-and-converting-lt