Jump to content

CKEditor to Keep Single Quotes


bsmither

Recommended Posts

This is a summary of a support request posted in the GitHub.

Q. Is there a way I can make the content editor ONLY offer source editing? At present it drives me loopy. I really don't want single quotes to be converted to #&39; every time!

A. You can indeed.

https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-startupMode

To do this, edit the file /includes/ckeditor/ckeditor.js

Add:

config.startupMode = 'source';

Switching to WYSIWYG (non-Source) mode will allow CKEditor to replace certain characters with their entities - if within a "text node" - as that is 'best practice'. That is, quotes to delineate attribute values in tags are not disturbed.

But, if you really want to have real single quotes in text left undisturbed when viewing in non-Source mode, add this to config.js:

config.entities_additional = ''; // defaults to '#39'

Note:
Additionally, CKEditor creates for itself an iframe, to display its editing window, and loads additional javascript files, including config.js, while in that iframe. I have had enormous difficulty forcing Firefox to reload page resources, instead of using its cache, that were called from within that iframe. I hope you have better luck.

Q. As long as you never click the button to open the non-source editor, it seems to be OK

The #39 is simply wrong. " or &lsqou; or &ldqou; etc are correct. #39 is not. You may as well use '.

It's not just that: it also messes with other parts of the html. I'd much prefer to just have a simple text editor

A. The #39 numerical code style is the necessary syntax for CKEditor's config.js file. The name of the entity (apos) is also acceptable. See:

https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-entities_additional

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...