@activewrite/ckeditor5-build-classic 中文文档教程
Sourcing
https://github.com/ckeditor/ckeditor5-build-classic 的 ActiveWrite 分支。
定期地,这可以从 CKEditor master 同步以获取修复。
Context
如果编辑器版本不受控制,会发生很多不好的事情。
要使用某些 CKEditor 功能(服务器端存储,其他),您必须拥有 使用唯一的版本标签注册到您的 CKE 环境中的编辑器包。 CKE 在后台使用该编辑器构建来加载和保存文档。
当您从应用程序打开文档时,您必须传入编辑器包 ID 才能使用 在编辑器实例中。 如果编辑器尚未注册,那就是一个错误。
[] 如果您使用 bundle 1 创建一个文档然后重新打开它会发生什么 使用捆绑包 2 的文档? 用的是哪一个? CKE 是否有错误信息?
以后我们可能需要相同的编辑器捆绑包版本来查看旧文档。 因此,我们还必须保留实际使用的任何捆绑包的版本历史记录。
Building
做任何你需要改变的插件,菜单配置等等。
本地构建:npm run preversion
。 这将执行构建并生成一个 git 提交标记为“内部”。 手动修改 package.json 中的版本,运行 npm run build
创建一个缩小的编辑器包并测试编辑器构建 在本地机器上(AW 中基于路径的纱线安装或使用“发布”步骤 下面 / 推送到 npm 进行包裹递送)。 任何版本都是强制性的 出于任何原因离开您的机器的构建,包括刚刚注册 通过 CKEditor 管理 API,即使没有用于任何文档。
预版本和构建步骤都运行哈希协议以确定 唯一但不太可变的包 ID。 如果相关的哈希将改变 几个文件更改的部分(包括 package.json、package-lock.json、 webpack.config.js、编辑器源 ckeditor.js 和哈希实用程序文件 本身 get-sha1sum.sh)。 散列忽略了 package.json 部分的变化 不影响编译,如版本号或包名。 这意味着 在您修改版本号之前和之后,哈希值不会改变。
更改这些文件的内容时要小心。 实际的,有意义的 变化很好。 不影响操作的注释和空格更改 将无缘无故地更改哈希。 这会导致不必要的复杂性。
发布:确保上面的 npm run build
步骤已经完成并且你 修改了 package.json 中的版本号,并完成了本地提交和 也推到远程。 通过 npm publish 推送到公共 npm。 --访问公共
然后查看 https://www.npmjs.com/package/@activewrite/ckeditor5-build-classic。 现在这需要是一个公共的 npm 存储库,以使 Netlify 构建变得简单。
上传:要使用 CKEditor 服务器端存储,我们的自定义编辑器需要 作为一个包上传到他们的服务器(并且相同的包版本必须 然后在我们的站点中使用——必须协调每个实例的时间)。 使用 “aw-ckeditor5-apicontrol”项目中的实用函数可以做到这一点。 看 该 repo 有关如何上传带有版本的编辑器包的示例。
License
发扬原有的 CKEditor 许可证。
根据 GNU 通用公共许可证版本 2 或更高版本 的条款获得许可。 有关许可证的完整详细信息,请查看 LICENSE.md
文件或 https://ckeditor。 com/legal/ckeditor-oss-license.
@@todo 添加 npms:-engine,-ui
@@todo 讨论包括提交在内的整体工作流程
Sourcing
ActiveWrite fork of https://github.com/ckeditor/ckeditor5-build-classic.
Periodically, this can be synched from the CKEditor master to pick up fixes.
Context
MANY BAD THINGS HAPPEN IF THE EDITOR VERSION ISN'T CONTROLLED.
To use some CKEditor features (server-side storage, others) you must have an editor bundle registered into your CKE environment with a unique version tag. CKE uses that editor build in the background to load and save the document.
When you open a doc from the app, you must pass in the editor bundle ID to use in the editor instance. If the editor hasn't been registered, that's an error.
[] what happens if you create a doc with bundle 1 then later re-open the same doc using bundle 2? Which one is used? Is there an error message from CKE?
WE MAY NEED THE SAME EDITOR BUNDLE VERSION LATER to look at older docs. So we also have to keep a version history of any bundles actually used.
Building
Do whatever you need to change the plugins, menu config and so on.
Local build: npm run preversion
. This will perform a build and make a git commit flagged as "internal". Manually bump the version in package.json, run npm run build
to create a minified editor bundle and test the editor build on the local machine (path-based yarn install in AW or use "publishing" step below / push to npm for package delivery). Version bump is mandatory for any build that leaves your machine for any reason including just being registered via the CKEditor management API, even if not used for any documents.
Both the preversion and the build step run a hashing protocol to determine a unique but not too-changeable bundle ID. The hash will changes if a relevant section of several files changes (including package.json, package-lock.json, webpack.config.js, the editor source ckeditor.js, and the hash utility file itself get-sha1sum.sh). The hash ignores change in the parts of package.json that don't affect a compile, like version number or package name. This means the hash will not change before and after you bump the version number.
BE CAREFUL ABOUT CHANGING THE CONTENTS OF THOSE FILE. Actual, meaningful changes are fine. Comment and whitespace changes that don't affect operation will change the hash for no good reason. That causes unnecessary complexity.
Publishing: make sure the npm run build
step completed above and that you bumped the version number in package.json, and have done a local commit and also push to remote. Push to public npm via npm publish . --access public
then see https://www.npmjs.com/package/@activewrite/ckeditor5-build-classic. This needs to be a public npm repo for now to make Netlify builds simple.
Uploading: to use CKEditor server-side storage, our custom editor needs to be uploaded as a bundle to their servers (and the same bundle version must then be used in our site -- must coordinate timing per instance). Use the utility functions in the "aw-ckeditor5-apicontrol" project to do that. See that repo for examples of how to upload the editor bundle with version.
License
Carrying forward the original CKEditor license.
Licensed under the terms of GNU General Public License Version 2 or later. For full details about the license, please check the LICENSE.md
file or https://ckeditor.com/legal/ckeditor-oss-license.
@@todo add npms: -engine, -ui
@@todo discuss overall workflow incl commits