@ckeditor/strapi-plugin-ckeditor

中文文档
1.1.2发布于 2026/02/16MIT近 30 天下载 1.4万

CKEditor 5 - Strapi 的官方整合

中文使用文档
文档目录6 节
  1. * 特性
  2. * 安装
  3. 捐款
  4. 建立环境
  5. 与 Strapi 版本兼容
  6. 许可证发放

CKEditor 5 - Strapi 的官方整合

CKEditor 5 used inside Strapi. Article form consisting of a title, excerpt text, and content

[大
从1.0版本开始,CKEditor 5自定义字段插件与Strapi 5相兼容,不能被Strapi 4.4+使用. 我们决定维持两个"斯特拉皮"版本的集成,以确保您在迁移到"斯特拉皮5"之前仍然可以使用我们的自定义域. 下面是 兼容表 显示要与您的 Strapi 版本一起使用的插件版本 .

此软件包为 Strapi 5 提供了一个自定义字段, 允许您在短时间内使用和配置 CKEditor .

自Strapi 4.4+起支持自定义字段,并提供强大的API来创建高度自定义字段.

这是官方插件, 由 CKE编辑团队 👋

* 特性

  • 没有代码字段定制 : 请自定义每个字段的具体使用方案 — — 让它成为简短的注释、博客文章或文档.
  • 预定义编辑器预设 : 一组预定义的编辑器预设(CKEditor 5插件集及其配置)从中选择.
  • 自定义最大长度验证 : 类似Twitter的长度验证有视觉指标,基于文本中的字符数,而不是HTML字符串.
  • 暗模式支持 : 因为你喜欢.
  • 媒体库集成 : 直接从 Strapi 的媒体库插入图像 .
  • 很快会有更多的特色: 上传适配器集成,更多颗粒编辑器工具栏和插件配置,以及更多.

* 安装

[大
在安装前,请确保您拥有 有效的 CKEditor 5 许可密钥启动 a 免费试验 以即时访问许可证密钥。 你也可以提到我们的 许可密钥和激活指南 学习更多.

在您的 Strapi 应用程序中, 添加软件包 :

与 npm数字 :

npm install @ckeditor/strapi-plugin-ckeditor

与 yarn数字 :

yarn add @ckeditor/strapi-plugin-ckeditor

然后,添加内容安全政策配置,允许从 CKEditor 5 装入 https://cdn.ckeditor.com (中文(简体) ) 源代码和发送编辑器使用信息到 https://proxy-event.c克editor.com (中文(简体) ),将规则添加到 config/middlewares.ts 在您的 Strapi 工程根中:

export default [
  // ...
  {
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          'script-src': ['https://cdn.ckeditor.com'],
          'connect-src': ['https://proxy-event.ckeditor.com']
        },
      },
    },
  },
  // ...

最后运行建筑:

npm run build

或:

yarn build

捐款

本节涵盖如果您想要为此软件包做出贡献, 如何配置您的环境 .

建立环境

为了开始对插件进行修改,您首先需要在插件寄存器上方安装 Strapi 基础设施 .

npx create-strapi-app --quickstart strapi
cd strapi

默认 Strapi 不创建插件文件夹, 因此我们需要创建它 .

mkdir -p src/plugins

现在我们应该复制这个寄存器 这样我们就可以继续工作了.

git clone [email protected]:ckeditor/strapi-plugin-ckeditor.git src/plugins/strapi-plugin-ckeditor

里面再加一个 ./package.json 因此,我们不需要使用 yarn 内插件本身.

"workspaces": ["./src/plugins/strapi-plugin-ckeditor"]

安装依赖性 :

yarn install

现在我们需要注册插件,以便皮带可以使用. 为了做到这一点,我们需要 创建( 如果尚未创建) ./config/plugins.js 文件并添加条目.

module.exports = ({ env }) => ({
  ckeditor: {
    enabled: true,
    resolve: "./src/plugins/strapi-plugin-ckeditor"
  },
});

重建工程并启动服务器 :

yarn build
yarn develop

与 Strapi 版本兼容

从1.0版本开始,CKEditor 5自定义字段插件与Strapi 5相兼容,不能被Strapi 4.4+使用. 我们决定维持两个斯特拉皮版本的集成,以确保您仍然能够在迁移到斯特拉皮5之前使用我们的自定义域. 下面可以找到显示该插件版本应该与您的 Strapi 版本一起使用的兼容表 .

插件版本 Strapi 版本
1.x.x (中文(简体) ) ≥ 5.0.0
0.x.x (中文(简体) ) ≥ 4.4

许可证发放

插件"CKEditor 5 - Strapi的官方整合"根据MIT获得许可. 请注意: CKEditor 5本身根据 GPL v2+ 获得许可 或一个 商业执照。 。 。 .

版本与发布记录

@ckeditor/strapi-plugin-ckeditor 共发布 22 个版本,首次发布于 2022/09/28;过去 12 个月发布了 2 个版本。

版本发布日期距今
1.1.2latest2026/02/168 个月前
0.2.22026/02/168 个月前
1.1.12025/03/171.6 年前
0.2.12025/03/171.6 年前
1.1.02024/12/021.9 年前
0.2.02024/12/021.9 年前

关于 @ckeditor/strapi-plugin-ckeditor 的常见问题

@ckeditor/strapi-plugin-ckeditor 是什么?

CKEditor 5 - Strapi 的官方整合

如何安装 @ckeditor/strapi-plugin-ckeditor?

在项目目录运行 npm install @ckeditor/strapi-plugin-ckeditor,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@strapi/strapi(^5.0.0 || ^5.0.0-beta || ^5.0.0-alpha || ^5.0.0-rc)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ckeditor/strapi-plugin-ckeditor 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/ckeditor__strapi-plugin-ckeditor 是否存在。

@ckeditor/strapi-plugin-ckeditor 可以商用吗?

@ckeditor/strapi-plugin-ckeditor 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ckeditor/strapi-plugin-ckeditor 的下载量有多少?

根据 npm 官方下载统计,@ckeditor/strapi-plugin-ckeditor 在 2026/10/10 – 2026/11/08 这 30 天内被下载 13,531 次,日均约 451 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ckeditor/strapi-plugin-ckeditor 还在维护吗?

最新版本 1.1.2 发布于 2026/02/16(8 个月前);至今共发布 22 个版本,其中过去 12 个月发布了 2 个;首次发布于 2022/09/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。