Home > Web Front-end > CSS Tutorial > How to Prevent Line Breaks at Hyphens in CKEditor Across All Browsers?

How to Prevent Line Breaks at Hyphens in CKEditor Across All Browsers?

Linda Hamilton
Release: 2024-11-13 02:29:01
Original
217 people have browsed it

How to Prevent Line Breaks at Hyphens in CKEditor Across All Browsers?

Preventing Line Breaks at Hyphens Across All Browsers

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:

  • ‑ (hexadecimal)
  • ‑ (decimal)

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:

  1. Open the CKEditor configuration file (typically named config.js).
  2. Locate the following line:
config.disableNativeSpellChecker = false;
Copy after login
  1. Add this line above the previous one:
config.allowedContent = false; // Restricts everything
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template