Is there any way to tell the editor to just leave all code as it is entered and don't attempt to convert into valid html entities?
Basically the issue is - we have various pages of validated html (ie.
&
instead of &,
£
instead of £)
This is all fine but we also have various affiliate links on the page which need to keep their original format. For example http://www.test.co.uk?id=test&test=test&testing=testing
I have been playing about with:
config.entities = false;
config.entities_latin = false;
config.ForceSimpleAmpersand = true;
This seems to actually have a negative effect and turn properly formated
£
into £ but still to convert the ampersands.
Basically when we put code into the editor, we want it to remain exactly as we have entered it whether that be properly formatted or not properly formatted
Re: Conversion of special characters
Documentation Manager, CKSource
See CKEditor 5 docs, CKEditor 4 docs, CKEditor 3 docs, CKFinder 3 docs, CKFinder 2 docs for help.
Visit the new CKEditor SDK for samples showcasing editor features to try out and download!
Re: Conversion of special characters
Basically I'm just wondering if there is any way to get the editor to leave all source code alone and not to modify it any way.
Re: Conversion of special characters
Re: Conversion of special characters
Usually you don't need to change the entities configuration and instead just set forceSimpleAmpersand = true
If you are talking about & in the contents, then those must be encoded or "bad things will happen"
Re: Conversion of special characters
Sadly, the standard response to my question (which has been posed by many others) seems to be "don't do that, it's not valid HTML." Unfortunately, there are cases where special characters must not be encoded. We are interacting with a web app that uses tokens wrapped in 3 ampersands, e.g. &&&sometoken&&&. These tokens are replaced by valid html -- except that CKEditor breaks things by replacing the above example with &&&sometoken&&&
TinyMCE happily lets us disable the automatic replacement of ampersands. We're simply trying to figure out how to get CKEditor to do the same. I my 25 years of experience with software, I've never seen a case where software that thinks it knows better than the user has worked out well. Remember the Airbus that crashed because the fly-by-wire software decided that "bad things will happen" if the pilot decided to not land?
Re: Conversion of special characters
Re: Conversion of special characters
If you want to use always & instead of & then you just have to do a replace() on the returned data. It's even safer in your case, data.replace("&&&", "&&&"), that's safe and you won't have problems. You don't require any special API, configuration or anything.
In general terms, the browser might be the one encoding &, or you can get unexpected dataloss if the user types > in design view and instead of it being saved as > it's saved as > (etc...) I know that in general people isn't interested in reading previous explanations about why some thing work the way they do, and it's funnier to blame just on CKEditor instead of putting an extra line of code in your part
Re: Conversion of special characters
As a side note, I did discover if I set the following values in the configuration, the ampersands are left alone:
basicEntities : false,
entities : false,
forceSimpleAmpersand : true,
All three must be set this way for this to work Not sure what, if any, side effects there might be...
Re: Conversion of special characters
Actually, if your are using CKeditor for mailforms "bad things will happen" if the & is encoded, since special characters won't be decoded.