[Logo] Forums for GrailsFlow, Weceem, XSLfast
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
CKeditor and lowercase tags  XML
Forum Index » Weceem Forum
Author Message
KaLu10



Joined: 04/06/2010 14:20:23
Messages: 9
Offline

Hi everyone,

I think one of the problem of CKEditor is all the transformations (cleanup) it does to the code inside it.
Awhile ago I believe I saw a question on CKeditor support by marcpalmer asking how to prevent this behaviour.

Since I'm using CKeditor plugin for Grais and I don't want, for example, <g:uploadForm> transforming to <g:uploadform> or other GSP tags what I've done was add two lines on ckeditorconfig.js (config file loaded by the plugin):

config.protectedSource.push( /<g:[.\s\S]*>[.\s\S]*<\/g:[.\s\S]*>/gi ); // Grails Tags
config.protectedSource.push( /<wcm:[.\s\S]*>[.\s\S]*<\/wcm:[.\s\S]*>/gi ); // Weceem Tags
config.protectedSource.push( /<g:[.\s\S]*\/>/gi ); // Grails Tags (Self-closing)
config.protectedSource.push( /<wcm:[.\s\S]*\/>/gi ); // Weceem Tags (Self-closing)

CKEditor documentation about protectedSource: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.protectedSource

For now it solved my problems but I don't know if the regex should be enhanced or modified.

Regards,
KaLu10

EDIT: Forgot to put the regex for the self-closing tags

This message was edited 1 time. Last update was at 12/08/2010 11:18:46

marcpalmer



Joined: 04/06/2009 13:36:35
Messages: 286
Location: UK
Offline

Hi,

Thanks for submitting this tip for us. It's very handy. We're about to upgrade to CKEditor now that the grails plugin supports the open file manager, and we'll look at adding this workaround. However we'll need to make it support any namespace, so we'll have to tweak the regexes.

Thanks again!

[Updated: added this info to the JIRA issue - http://jira.jcatalog.com/browse/WCM-511]

Marc

This message was edited 1 time. Last update was at 23/08/2010 13:38:46


- -
Twitter: wangjammer5
Blog: http://www.anyware.co.uk
Grails plugins: http://www.grailsrocks.com
[WWW]
KaLu10



Joined: 04/06/2010 14:20:23
Messages: 9
Offline

Hi Marc,

Sure, I've put only thoose two, but you can use:

config.protectedSource.push( /<[\s]+:[.\s]+>[.]*<\/[\s]+:[.\s]+>/gi ); // Tags with namespace
config.protectedSource.push( /<[\s]+:[.\s]+\/>/gi ); // Tags with namespace (Self-closing)

Mods:
Switched from "*" to "+" to have at least one char
"/s/S" to "/s" since gi is case INsensitive
Having [./s/S] is redudant. Just need the "." (any char)

Regards,
KaLu10

This message was edited 2 times. Last update was at 24/08/2010 16:45:18

 
Forum Index » Weceem Forum
Go to:   
Powered by JForum 2.1.8 © JForum Team