# @ckeditor/strapi-plugin-ckeditor 中文文档

规范地址：https://npmcn.com/package/%40ckeditor/strapi-plugin-ckeditor/

版本：1\.1\.2
npm 元数据更新时间：2026-02-16T14:01:10.014Z
中文译文更新时间：2026-11-09T23:19:35.483Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40ckeditor/strapi-plugin-ckeditor
原文对照：https://npmcn.com/package/%40ckeditor/strapi-plugin-ckeditor/?lang=original
项目主页：https://market.strapi.io/plugins/@ckeditor-strapi-plugin-ckeditor
源码仓库：https://github.com/ckeditor/strapi-plugin-ckeditor

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：42.3 kB，24 个文件
- TypeScript 类型：未声明
- 运行依赖：1 个
- peer 依赖：@strapi/strapi ^5\.0\.0 \|\| ^5\.0\.0-beta \|\| ^5\.0\.0-alpha \|\| ^5\.0\.0-rc
- 首次发布：2022-09-28T11:49:08.517Z
- 最新版本发布：2026-02-16T14:01:09.884Z
- 近 30 天下载量：13531（2026-10-10 至 2026-11-08，npm 官方下载统计）
- 已发布版本数：22（近 12 个月 2 个）

## 中文简介

CKEditor 5 - Strapi 的官方整合

## 安装

```sh
npm install @ckeditor/strapi-plugin-ckeditor
```

也可以使用：`pnpm add @ckeditor/strapi-plugin-ckeditor`、`yarn add @ckeditor/strapi-plugin-ckeditor`、`bun add @ckeditor/strapi-plugin-ckeditor`

## README

# CKEditor 5 - Strapi 的官方整合

![CKEditor 5 used inside Strapi. Article form consisting of a title, excerpt text, and content](https://user-images.githubusercontent.com/156149/192792402-4bb1e040-6f8c-49be-af90-fd35fd3a4c66.png)

> \[大  
> 从1.0版本开始,CKEditor 5自定义字段插件与Strapi 5相兼容,不能被Strapi 4.4+使用. 我们决定维持两个"斯特拉皮"版本的集成,以确保您在迁移到"斯特拉皮5"之前仍然可以使用我们的自定义域. 下面是 [兼容表](https://npmcn.com/package/%40ckeditor/strapi-plugin-ckeditor/#readme-compatibility) 显示要与您的 Strapi 版本一起使用的插件版本 .

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

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

这是官方插件, 由 [CKE编辑团队](https://ckeditor.com/) 👋

## \* 特性

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

## \* 安装

> \[大  
> 在安装前,请确保您拥有 **有效的 CKEditor 5 许可密钥**启动 a [免费试验](https://portal.ckeditor.com/checkout?plan=free) 以即时访问许可证密钥。 你也可以提到我们的 [许可密钥和激活指南](https://ckeditor.com/docs/ckeditor5/latest/getting-started/licensing/license-key-and-activation.html) 学习更多.

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

与 `npm`数字 :

```bash
npm install @ckeditor/strapi-plugin-ckeditor
```

与 `yarn`数字 :

```bash
yarn add @ckeditor/strapi-plugin-ckeditor
```

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

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

最后运行建筑:

```bash
npm run build
```

或:

```bash
yarn build
```

## 捐款

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

### 建立环境

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

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

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

```
mkdir -p src/plugins
```

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

```
git clone git@github.com: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+ 获得许可](https://ckeditor.com/legal/ckeditor-oss-license/?utm_campaign=strapi-integration&utm_source=ck-github&utm_medium=referral) 或一个 [商业执照](https://ckeditor.com/pricing/?utm_campaign=strapi-integration&utm_source=ck-github&utm_medium=referral)。 。 。 .

## 常见问题

### @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 和提交记录判断。

