-
1. Re: Editor: detailed configuration with JSON
juangon Aug 25, 2011 7:56 AM (in response to lfryc)Hi Lukás,
Can be EL expressions be inside f:facet? (for example: requestContextPath for config.contentsCss). In that case, seems ok for this possibility.
Also, can those properties be with quotes? (i.e.: config.font_names property).
Thanks!
-
2. Re: Editor: detailed configuration with JSON
lfryc Aug 25, 2011 12:49 PM (in response to juangon)Hi Juan, yes, EL could be surely evaluable in the config facet.
Actually we have discussed with Brian on irc.freenode.net#richfaces, he suggested to allow definition in plain JavaScript instead of JSON.
Initial thoughts on using JSON were avoiding JavaScript which have to be evaluated using eval() on the client side and thus gives space for script injection. JSON is more strict here, since it allows only primitive types and it is validated during parsing using $.parseJSON().
However Brian argued that this is responsibility for developer to check the contents when interpolated config facet,
and I'm adding that CKEditor have some options which takes functions as value and it would not be possible with JSON.
That's why I have decided to reimplement to plain JavaScript configuration.
-
3. Re: Editor: detailed configuration with JSON
lfryc Aug 25, 2011 3:22 PM (in response to lfryc)Configuration of editor will be possible by simply passing JavaScript with EL expr. interpolated:
<rich:editor id="editor" value="#{editor.value}"> <f:facet name="config"> skin: "#{editor.skin}", toolbar: "MyToolbar", toolbar_MyToolbar: [ { name: 'document', items : [ 'NewPage','Preview' ] }, { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] }, { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','Scayt' ] }, { name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak' ,'Iframe' ] }, '/', { name: 'styles', items : [ 'Styles','Format' ] }, { name: 'basicstyles', items : [ 'Bold','Italic','Strike','-','RemoveFormat' ] }, { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote' ] }, { name: 'links', items : [ 'Link','Unlink','Anchor' ] }, { name: 'tools', items : [ 'Maximize' ] } ] </f:facet> </rich:editor>
-
4. Re: Editor: detailed configuration with JSON
juangon Aug 26, 2011 6:16 AM (in response to lfryc)Wow, seems pretty good.
Thanks!