@cdubz/ckeditor5-source-editing-codemirror

中文文档
35.1.0发布于 2022/09/12GPL-2.0-or-laterCommonJS近 30 天下载 2.1万

CodeMirror 5 syntax highlighting in CKEditor 5 source editing mode.

原始使用文档
文档目录13 节
  1. Table of contents
  2. Developing the package
  3. Available scripts
  4. start
  5. test
  6. lint
  7. stylelint
  8. dll:build
  9. dll:serve
  10. translations:collect
  11. translations:download
  12. translations:upload
  13. License

CKEditor 5 CodeMirror feature

npm version

Provides source editing formatting using CodeMirror 5.

This package was created by the ckeditor5-package-generator package.

Table of contents

Developing the package

To read about the CKEditor 5 framework, visit the CKEditor5 documentation.

Available scripts

Npm scripts are a convenient way to provide commands in a project. They are defined in the package.json file and shared with other people contributing to the project. It ensures that developers use the same command with the same options (flags).

All the scripts can be executed by running npm run <script>. Pre and post commands with matching names will be run for those as well.

The following scripts are available in the package.

start

Starts a HTTP server with the live-reload mechanism that allows previewing and testing plugins available in the package.

When the server has been started, the default browser will open the developer sample. This can be disabled by passing the --no-open option to that command.

You can also define the language that will translate the created editor by specifying the --language [LANG] option. It defaults to 'en'.

Examples:

# 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

Allows executing unit tests for the package, specified in the tests/ directory. The command accepts the following modifiers:

  • --coverage – to create the code coverage report,
  • --watch – to observe the source files (the command does not end after executing tests),
  • --source-map – to generate source maps of sources,
  • --verbose – to print additional webpack logs.

Examples:

# Execute tests.
npm run test

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

lint

Runs ESLint, which analyzes the code (all *.js files) to quickly find problems.

Examples:

# Execute eslint.
npm run lint

stylelint

Similar to the lint task, stylelint analyzes the CSS code (*.css files in the theme/ directory) in the package.

Examples:

# Execute stylelint.
npm run stylelint

dll:build

Creates a DLL-compatible package build which can be loaded into an editor using DLL builds.

Examples:

# 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

Creates a simple HTTP server (without the live-reload mechanism) that allows verifying whether the DLL build of the package is compatible with the CKEditor 5 DLL builds.

Examples:

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

translations:collect

Collects translation messages (arguments of the t() function) and context files, then validates whether the provided values do not interfere with the values specified in the @ckeditor/ckeditor5-core package.

The task may end with an error if one of the following conditions is met:

  • Found the Unused context error – entries specified in the lang/contexts.json file are not used in source files. They should be removed.
  • Found the Context is duplicated for the id error – some of the entries are duplicated. Consider removing them from the lang/contexts.json file, or rewrite them.
  • Found the Context for the message id is missing error – entries specified in source files are not described in the lang/contexts.json file. They should be added.

Examples:

npm run translations:collect

translations:download

Download translations from the Transifex server. Depending on users' activity in the project, it creates translations files used for building the editor.

The task requires passing the URL to Transifex API. Usually, it matches the following format: https://www.transifex.com/api/2/project/[PROJECT_SLUG].

To avoid passing the --transifex option every time when calls the command, you can store it in package.json, next to the ckeditor5-package-tools translations:download command.

Examples:

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

translations:upload

Uploads translation messages onto the Transifex server. It allows for the creation of translations into other languages by users using the Transifex platform.

The task requires passing the URL to the Transifex API. Usually, it matches the following format: https://www.transifex.com/api/2/project/[PROJECT_SLUG].

To avoid passing the --transifex option every time when you call the command, you can store it in package.json, next to the ckeditor5-package-tools translations:upload command.

Examples:

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

License

Licensed under the terms of GNU General Public License Version 2 or later.

版本与发布记录

@cdubz/ckeditor5-source-editing-codemirror 共发布 2 个版本,首次发布于 2022/09/12;过去 12 个月发布了 0 个版本。

版本发布日期距今
35.1.0latest2022/09/124 年前
0.9.02022/09/124 年前

关于 @cdubz/ckeditor5-source-editing-codemirror 的常见问题

@cdubz/ckeditor5-source-editing-codemirror 是什么?

CodeMirror 5 syntax highlighting in CKEditor 5 source editing mode.

如何安装 @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 和提交记录判断。