CKEditor 5 代码密钥特性
提供源编辑格式,使用 代码 5。 。 。 .
此软件包是由 ckeditor5-包装-生成器 软件包.
目录
开发软件包
欲了解CKEditor 5框架,请访问 CKEditor5 文档。 。 。 .
可用的脚本
Npm脚本是工程中提供命令的方便方式. 定义载于 package.json 并与其他为该项目捐款的人分享。 它确保开发人员使用相同的命令,并有相同的选项(lags).
所有脚本都可以通过运行执行 npm run <script>。带有匹配名称的预和邮局命令也将为这些命令运行.
以下脚本可在包中找到.
start
启动一个 HTTP 服务器,其活重装机制允许预览和测试包中可用的插件.
服务器启动后,默认浏览器会打开开发者样本. 这可以通过通过 --no-open 选项.
您也可以通过指定 --language [LANG] 选项。 默认为 'en'。 。 。 .
实例:
# 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– 打印额外的网页包装日志.
实例:
# Execute tests.
npm run test
# Generate code coverage report after each change in the sources.
npm run test -- --coverage --test
lint
运行 ESLint,用于分析代码(全部) *.js 要快速查找问题.
实例:
# Execute eslint.
npm run lint
stylelint
类似于 lint 任务,样式lint分析 CSS 代码(*.css 文档中 theme/ 目录)在包中.
实例:
# Execute stylelint.
npm run stylelint
dll:build
创建一个 DLL 兼容的软件包构建, 可以使用此软件装入编辑器 DLL 构建。 。 。 .
实例:
# 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 构建。 。 。 .
实例:
# 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文档。 应该加上这些内容.
实例:
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 命令.
实例:
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 命令.
实例:
npm run translations:upload -- --transifex [API URL]
许可证
根据下列规定获得许可证: GNU 通用公共许可证版本 2 或稍后版本。 。 。 .