When using CKEditor within a CMS, the ability to prevent line breaks at hyphens becomes crucial, especially when dealing with long articles. To address this issue, there are two effective solutions.
Unicode Non-Breaking Hyphen (U 2011)
In HTML, you can utilize the Unicode NON-BREAKING HYPHEN (U 2011), represented by the HTML entities:
By using this special symbol, you can prevent line breaks at the specified hyphen.
CKEditor Configuration
Additionally, CKEditor provides an option to disable hyphenation altogether. Follow these steps:
config.disableNativeSpellChecker = false;
config.allowedContent = false; // Restricts everything
By setting config.allowedContent to false, CKEditor will prevent all line breaks and hyphenation.
Reference:
For further information on the use of Unicode hyphens, refer to the Wikipedia article: http://en.wikipedia.org/wiki/Hyphen#In_computing
The above is the detailed content of How to Prevent Line Breaks at Hyphens in CKEditor Across All Browsers?. For more information, please follow other related articles on the PHP Chinese website!