# @cdubz/ckeditor5-source-editing-codemirror 中文文档

规范地址：https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/

版本：35\.1\.0
npm 元数据更新时间：2022-09-12T03:43:29.926Z
中文译文更新时间：2026-11-09T06:47:04.647Z
软件包许可：GPL-2\.0-or-later

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

原始 npm 页面：https://www.npmjs.com/package/%40cdubz/ckeditor5-source-editing-codemirror
原文对照：https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/?lang=original
项目主页：https://github.com/cdubz/ckeditor5-source-editing-codemirror#readme
源码仓库：https://github.com/cdubz/ckeditor5-source-editing-codemirror

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

- 包体积（解压后）：35.5 kB，9 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- Node.js 要求：\>=14\.0\.0
- 运行依赖：1 个
- 首次发布：2022-09-12T03:18:05.659Z
- 最新版本发布：2022-09-12T03:43:29.841Z
- 近 30 天下载量：20801（2026-10-10 至 2026-11-08，npm 官方下载统计）
- 已发布版本数：2（近 12 个月 0 个）

## 中文简介

CodeMiror 5 语法在 CKEditor 5 源编辑模式中突出显示.

## 安装

```sh
npm install @cdubz/ckeditor5-source-editing-codemirror
```

也可以使用：`pnpm add @cdubz/ckeditor5-source-editing-codemirror`、`yarn add @cdubz/ckeditor5-source-editing-codemirror`、`bun add @cdubz/ckeditor5-source-editing-codemirror`

## README

# CKEditor 5 代码密钥特性

[![npm version](https://badge.fury.io/js/@cdubz%2Fckeditor5-source-editing-codemirror.svg)](https://www.npmjs.com/package/@cdubz/ckeditor5-source-editing-codemirror)

提供源编辑格式,使用 [代码 5](https://codemirror.net/5/)。 。 。 .

此软件包是由 [ckeditor5-包装-生成器](https://www.npmjs.com/package/ckeditor5-package-generator) 软件包.

## 目录

-   [开发软件包](https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/#readme-developing-the-package)
-   [可用的脚本](https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/#readme-available-scripts)
    -   [`start`](https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/#readme-start)
    -   [`test`](https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/#readme-test)
    -   [`lint`](https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/#readme-lint)
    -   [`stylelint`](https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/#readme-stylelint)
    -   [`dll:build`](https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/#readme-dllbuild)
    -   [`dll:serve`](https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/#readme-dllserve)
    -   [`translations:collect`](https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/#readme-translationscollect)
    -   [`translations:download`](https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/#readme-translationsdownload)
    -   [`translations:upload`](https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/#readme-translationsupload)
-   [许可证](https://npmcn.com/package/%40cdubz/ckeditor5-source-editing-codemirror/#readme-license)

## 开发软件包

欲了解CKEditor 5框架,请访问 [CKEditor5 文档](https://ckeditor.com/docs/ckeditor5/latest/framework/index.html)。 。 。 .

## 可用的脚本

Npm脚本是工程中提供命令的方便方式. 定义载于 `package.json` 并与其他为该项目捐款的人分享。 它确保开发人员使用相同的命令,并有相同的选项(lags).

所有脚本都可以通过运行执行 `npm run <script>`。带有匹配名称的预和邮局命令也将为这些命令运行.

以下脚本可在包中找到.

### `start`

启动一个 HTTP 服务器,其活重装机制允许预览和测试包中可用的插件.

服务器启动后,默认浏览器会打开开发者样本. 这可以通过通过 `--no-open` 选项.

您也可以通过指定 `--language [LANG]` 选项。 默认为 `'en'`。 。 。 .

实例:

```bash
# Starts the server and open the browser.
npm run start

# Disable auto-opening the browser.
npm run start -- --no-open

# Create the editor with the interface in German.
npm run start -- --language=de
```

### `test`

允许对套件执行单位测试,在 `tests/` 目录。 命令接受以下修改: 1

-   `--coverage` - 要创建代码覆盖报告,
-   `--watch` - 观察源文件(执行测试后命令不会结束),
-   `--source-map` - 生成来源图,
-   `--verbose` – 打印额外的网页包装日志.

实例:

```bash
# Execute tests.
npm run test

# Generate code coverage report after each change in the sources.
npm run test -- --coverage --test
```

### `lint`

运行 ESLint,用于分析代码(全部) `*.js` 要快速查找问题.

实例:

```bash
# Execute eslint.
npm run lint
```

### `stylelint`

类似于 `lint` 任务,样式lint分析 CSS 代码(`*.css` 文档中 `theme/` 目录)在包中.

实例:

```bash
# Execute stylelint.
npm run stylelint
```

### `dll:build`

创建一个 DLL 兼容的软件包构建, 可以使用此软件装入编辑器 [DLL 构建](https://ckeditor.com/docs/ckeditor5/latest/builds/guides/development/dll-builds.html)。 。 。 .

实例:

```bash
# Build the DLL file that is ready to publish.
npm run dll:build

# Build the DLL file and listen to changes in its sources.
npm run dll:build -- --watch
```

### `dll:serve`

创建一个简单的 HTTP 服务器( 没有活重装机制), 可以验证软件包的 DLL 构建是否兼容 CKEditor 5 [DLL 构建](https://ckeditor.com/docs/ckeditor5/latest/builds/guides/development/dll-builds.html)。 。 。 .

实例:

```bash
# Starts the HTTP server and opens the browser.
npm run dll:serve
```

### `translations:collect`

收集翻译信件( `t()` 函数)和上下文文件,然后验证所提供的值是否不影响 `@ckeditor/ckeditor5-core` 软件包.

如果满足以下条件之一,任务可能以出错而结束:

-   发现 `Unused context` 错误 - 在 `lang/contexts.json` 文件不用于源文件。 应取出.
-   发现 `Context is duplicated for the id` 出错 – 有些条目是重复的. 考虑把它们从 `lang/contexts.json` 文件,或重写它们.
-   发现 `Context for the message id is missing` 错误 - 源文件中指定的条目不描述于 `lang/contexts.json` 文档。 应该加上这些内容.

实例:

```bash
npm run translations:collect
```

### `translations:download`

从 Transifex 服务器下载翻译 。 根据项目中用户的活动,它创建用于构建编辑器的翻译文件.

任务需要将 URL 传递给 Transifex API 。 通常,它符合以下格式: `https://www.transifex.com/api/2/project/[PROJECT_SLUG]`。 。 。 .

为了避免通过 `--transifex` 选项每次调用命令时,都可以将其存储在 `package.json`,旁边 `ckeditor5-package-tools translations:download` 命令.

实例:

```bash
npm run translations:download -- --transifex [API URL]
```

### `translations:upload`

将翻译信件上传到 Transifex 服务器上。 它允许用户使用Transifex平台创建其他语言的翻译.

任务需要将 URL 传递给 Transifex API 。 通常,它符合以下格式: `https://www.transifex.com/api/2/project/[PROJECT_SLUG]`。 。 。 .

为了避免通过 `--transifex` 选项每次调用命令时,都可以将其存储在 `package.json`,旁边 `ckeditor5-package-tools translations:upload` 命令.

实例:

```bash
npm run translations:upload -- --transifex [API URL]
```

## 许可证

根据下列规定获得许可证: [GNU 通用公共许可证版本 2 或稍后版本](http://www.gnu.org/licenses/gpl.html)。 。 。 .

## 常见问题

### @cdubz/ckeditor5-source-editing-codemirror 是什么？

CodeMiror 5 语法在 CKEditor 5 源编辑模式中突出显示\.

### 如何安装 @cdubz/ckeditor5-source-editing-codemirror？

在项目目录运行 npm install @cdubz/ckeditor5-source-editing-codemirror，或使用 pnpm add / yarn add / bun add。

### @cdubz/ckeditor5-source-editing-codemirror 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/cdubz\_\_ckeditor5-source-editing-codemirror 是否存在。

### @cdubz/ckeditor5-source-editing-codemirror 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @cdubz/ckeditor5-source-editing-codemirror 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=14\.0\.0。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @cdubz/ckeditor5-source-editing-codemirror 可以商用吗？

@cdubz/ckeditor5-source-editing-codemirror 使用 GPL-2\.0-or-later 许可。强 Copyleft：分发包含该代码的软件时，整个作品需以兼容的 GPL 许可开源。仅在内部使用、不对外分发时不触发此义务。以上为概括，不构成法律意见，请以许可原文为准。

### @cdubz/ckeditor5-source-editing-codemirror 的下载量有多少？

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

### @cdubz/ckeditor5-source-editing-codemirror 还在维护吗？

最新版本 35\.1\.0 发布于 2022/09/12（4 年前）；至今共发布 2 个版本，其中过去 12 个月发布了 0 个；首次发布于 2022/09/12。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

