External Javascript causing editor problems
Posted: Sat 14. Mar 2015, 18:36
I'll describe what I'm trying to do, before getting into what's going wrong. Running CMSimple 4.4.5.
I want to embed small fragments of music notation on my web pages. I want to be able to update and edit these regularly, so I'd prefer to not create and upload images, so I found a Javascript library that does exactly what I need:
http://moinejf.free.fr/js/index.html
This works perfectly with simple HTML pages - simply call the library and include code that describes the music - something like this:
However, when I add the library into the template I ran into a few problems. Firstly, when I edit the HTML the editor starts messing around with the code, so the above gets saved as this:
The library can't cope with this, so it ignores it. I can get round it using <pre> tags and including an HTML comment to get a new line (the X:0 must be on a newline):
This works, and I can live with this.
However...when I update the HTML with the above, and save it in the editor, the above HTML gets saved. I load the resulting page in a seperate browser and it works perfectly. However, the CMSimple editor loads the page HTML and tries to execute the js. Something goes wrong and some dummy/error text is written, and so I no longer have access to the code I originally wrote.
This is the resulting output, for what it is worth:
http://callingthetune.co.uk/?Resources_ ... 29___Right
http://callingthetune.co.uk/?Resources_ ... 29___Wrong
Is it possible to dissuade the editor from trying to run the library somehow?
For what it's worth, I do not need a WYSIWYG editor and would be quite happy with a textbox to just edit the HTML. I see it is possible to disable the tinymce plugin - is this safe to do or will it simply cause me more problems?
Let me know if there's other information I can add to this.
I want to embed small fragments of music notation on my web pages. I want to be able to update and edit these regularly, so I'd prefer to not create and upload images, so I found a Javascript library that does exactly what I need:
http://moinejf.free.fr/js/index.html
This works perfectly with simple HTML pages - simply call the library and include code that describes the music - something like this:
Code: Select all
X:0
T:Hello Scale!
K:C
CD EF GA Bc
Code: Select all
X:0 T:Hello Scale! K:C CD EF GA Bc
Code: Select all
<pre><!-- empty comment to force newline -->
X:0
T:Hello Scale!
K:C
CD EF GA Bc
</pre>
However...when I update the HTML with the above, and save it in the editor, the above HTML gets saved. I load the resulting page in a seperate browser and it works perfectly. However, the CMSimple editor loads the page HTML and tries to execute the js. Something goes wrong and some dummy/error text is written, and so I no longer have access to the code I originally wrote.
This is the resulting output, for what it is worth:
http://callingthetune.co.uk/?Resources_ ... 29___Right
http://callingthetune.co.uk/?Resources_ ... 29___Wrong
Is it possible to dissuade the editor from trying to run the library somehow?
For what it's worth, I do not need a WYSIWYG editor and would be quite happy with a textbox to just edit the HTML. I see it is possible to disable the tinymce plugin - is this safe to do or will it simply cause me more problems?
Let me know if there's other information I can add to this.