OpenESignForms / vaadin-ckeditor

Vaadin component wrapper around CKEditor
4 stars 11 forks source link

addExtraConfig seems to result in a Javascript error #55

Closed FollowSteph closed 8 years ago

FollowSteph commented 8 years ago

I'm trying to add the config values (where config is CKEditorConfig):

config.addExtraConfig("config.entities", "false");
config.addExtraConfig("config.basicEntities", "false");

but this results in a Javascript error. I wish I could provide more details but I have no idea why it's not working and why there is a Javascript error, just that if you do this it will fail.

In case you're wondering the reason I want to edit these values is: http://stackoverflow.com/questions/12700383/ckeditor-is-escaping-html-elements

OpenESignForms commented 8 years ago

Not positive as I've not looked at those attributes, but are you sure the config element is called 'config.entities' and not just 'entities' as we already set the ckeditor config object? Same for 'basicEntities'. Not sure what you really want, but the the editor returns valid HTML -- which means entities should be used. It doesn't mess with < & > and " when they are part of tag attributes, etc., but when not used for a tag, they HTML will not be valid if unescaped.

FollowSteph commented 8 years ago

You are absolutely correct, removing the config portion resolved the issue. That being said I'm stilling dealing other issues. I know it's not related to the add-on but maybe you can help, maybe not. What I'm trying to do is then take the output and run it through FreeMaker. The problem I'm running into is that FreeMaker only accepts strict html (xml in fact) and special encodings like &nbsp will cause it to fail. By adding these configs it's almost all there except that I'm still finding   between the period of a sentence and the first letter of the next sentence. Otherwise it's perfect. If you have any ideas please let me know.

Also I'm not sure what you mean by: " It doesn't mess with < & > and " when they are part of tag attributes, etc., but when not used for a tag, they HTML will not be valid if unescaped." Do you mean if someone uses < and it's not escaped, as in using > and < then it's not valid html? I write "<" in html that should display "<", even if it's not escaped. I just ran a test in Chrome and it displayed correctly. I understand it's better to escape but FreeMaker doesn't use the encodings...

In any case yes your solution definitely works. I can't believe I never thought of removing the config portion. Thank you for that suggestion, it's very much appreciated!!

OpenESignForms commented 8 years ago

We don't have any experience with FreeMaker, but why is   not accepted as that's standard HTML and the correct way to put a non-blocking space in. Of course, if you are missing the trailing ';' then you have a syntax error that was not introduced by ckeditor as ckeditor should only return valid HTML.

We mean that your HTML can contain both standard < > " and escaped ones depending on what is needed to be valid HTML. ckeditor will return HTML like below:

<p class="center" style="font-size: 24pt;">Some &quot;Quoted &nbsp; Text&quot; with &lt;TAGS&gt; like this needing to be escaped because they are not being used as HTML tags.</p> So it would be invalid HTML if you instead wanted those < > " tags to not use HTML entities:

<p class="center" style="font-size: 24pt;">Some "Quoted Text" with <TAGS> like this needing to be escaped because they are not being used as HTML tags.</p>

FollowSteph commented 8 years ago

Very good point. I think I have some further investigating to do. Thank you very much for all your help, it's really appreciated.