ckeditor5 已彻底弃用全局 `ckeditor` 对象,其配置方式与旧版 ckeditor4 截然不同;需通过 `htmlsupport` 插件等新机制实现 html 元素、属性、样式等白名单控制。
CKEditor5 是一个完全重写的现代富文本编辑器,不兼容 CKEditor4 的 API。你遇到的 Uncaught ReferenceError: CKEDITOR is not defined 错误,根本原因在于:CKEDITOR.replace() 是 CKEditor4 的初始化方法,而你引入的是 CKEditor5 的 CDN(/ckeditor5/38.1.1/classic/ckeditor.js),其全局对象是 ClassicEditor,而非 CKEDITOR——后者在 CKEditor5 中已被完全移除。
CKEditor5 采用插件化架构,若需支持自定义 HTML(如
htmlSupport: {
allow: [
{ name: 'style' }, // 仅允许