frontend-services/craft-soft-hyphen
Composer 安装命令:
composer require frontend-services/craft-soft-hyphen
包简介
Adds a soft hyphen (­) and non breaking space ( ) button to CKEditor in Craft CMS
README 文档
README
Adds soft hyphen (­) and non-breaking space ( ) insert buttons to CKEditor fields, Plain Text fields, and the entry Title field in Craft CMS.
- Soft hyphens are invisible characters that hint the browser where it can break a word across lines. When the break happens, a hyphen is shown. Useful for long words in narrow columns or responsive layouts.
- Non-breaking spaces prevent line breaks between two words. Useful for keeping units together (e.g. "100 km") or after short prepositions.
Requirements
- Craft CMS 4.0+
- CKEditor plugin 4.0+ (for CKEditor support)
Installation
composer require frontend-services/craft-soft-hyphen php craft plugin/install soft-hyphen
CKEditor fields
The plugin automatically injects itself into every CKEditor instance. No config pasting required.
To give editors a clickable toolbar button:
- Go to Settings → CKEditor and open your config
- Drag Soft Hyphen and/or Non-Breaking Space into your toolbar
- Save
In the editor both characters are shown as visible markers so editors can see and manage them. On the frontend the markers are automatically replaced with real ­ and characters. No frontend JavaScript or template changes needed.
Plain Text fields
Each Plain Text field can independently have the insert buttons enabled.
- Go to Settings → Fields and open a Plain Text field
- Toggle Soft Hyphen / NBSP buttons on
- Save the field
Two small buttons will appear next to the input in the entry editor, inserting the characters at the cursor position.
Title field
To show the insert buttons next to the title field on all entries:
- Go to Settings → Soft Hyphen
- Toggle Title field buttons on
- Save
How visible proxy characters work
Because ­ and are invisible in plain <input> and <textarea> fields, the plugin displays them as visible stand-ins while editing:
| Stored in database | Shown in the CP editor |
|---|---|
soft hyphen \u00AD |
middle dot · |
non-breaking space \u00A0 |
open box ␣ |
These proxy characters are only used for display — they are never saved to the database. When an entry is saved, the plugin automatically converts them back to the real ­ and characters server-side before the value is persisted.
Uninstalling
Uninstalling the plugin is safe. Before the plugin is removed it automatically cleans up its own field settings from the database, so Craft can load all Plain Text fields normally afterwards. No content is lost — any soft hyphens or non-breaking spaces already saved in your entries remain exactly as stored.
frontend-services/craft-soft-hyphen 适用场景与选型建议
frontend-services/craft-soft-hyphen 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 2, 最近一次更新时间为 2026 年 03 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 frontend-services/craft-soft-hyphen 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 frontend-services/craft-soft-hyphen 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2026-03-03