Layout Module 1.x and Script Tags

Topics: General
Feb 27, 2015 at 2:48 PM
Yesterday I cloned the 1.x branch and played a little bit with the layout module and I got to a strange situation.
I added an HTML Element in the layout and placed following html in this element (as html)
<script type="syntaxhighlighter">// <![CDATA[
// ]]></script>
When I tried to save I got this js - error:
Uncaught SyntaxError: Unexpected token ILLEGAL
in Update:114.

Does Layouts not support script at the moment?
Feb 28, 2015 at 9:13 PM
Good catch - that's a bug and has something to do with not encoding the "runtime" HTML being generated from the dialog that the editor needs. We'll fix.
Feb 28, 2015 at 9:48 PM
I was able to reproduce, identify the cause and provide a fix. Please test and let me know if it works for you. Thanks
Marked as answer by benschi11 on 3/2/2015 at 7:11 AM
Mar 1, 2015 at 4:25 PM
Edited Mar 1, 2015 at 5:08 PM
It works now for me, but I get a really strange preview in the admin panel.


Link to the picture:

Edit: Deleted
Edit2: Ok, it is not working - after saving the Page ContentItem and reopen it the html appears like the picture above.
Mar 1, 2015 at 5:30 PM
Your browser is probably caching a script that has been updated to properly decode the HTML. Please clear the brower's cache and let me know.
Marked as answer by benschi11 on 3/2/2015 at 7:11 AM
Mar 2, 2015 at 2:11 PM
You was right. Everything is working fine now - Thanks!
Mar 7, 2015 at 4:16 PM
This fix seems to have broken using the html editor if you use a symbol such as % in the content. It will save the html fine, but when you next edit the layout you get a js error.

I have taken a look and the problem seems to be be where decodeURIComponent is used when loading the content (line 31 in Content.js). I have changed this back to just
This seems to work fine and I have tested the above use case and I don't seem to get any errors for it.
Mar 7, 2015 at 6:49 PM
@j3ffb, you're totally right, see
@sfmskywalker, see also
This for last drawbacks about AngularJs minification...