从CDN加载时如何将源代码编辑插件添加到CKEditor v5?

问题描述 投票:0回答:1

我想使用 CKEditor v5 并从 CDN 加载它。我也想使用源码编辑插件

我想知道是否可以使用

  1. https://www.jsdelivr.com/package/npm/@ckeditor/ckeditor5-source-editing
  2. CKEditor 5 DLL 构建

对于1.我尝试创建jsFiddle。但这不起作用。

<script src=" https://cdn.jsdelivr.net/npm/@ckeditor/[email protected]/src/index.min.js "></script>
<script src=" https://cdn.jsdelivr.net/npm/@ckeditor/[email protected]/src/index.min.js "></script>
// llink href=" https://cdn.jsdelivr.net/npm/@ckeditor/[email protected]/theme/sourceediting.min.css " rel="stylesheet">

<div id="editor">text</div>

<script>
  ClassicEditor
    .create(document.querySelector('#text-editor'), {
      plugins: [SourceEditing, /* ... */ ],
      toolbar: ['sourceEditing', /* ... */ ]
    })
    .then(editor => {
      console.log(editor);
    })
    .catch(error => {
      console.error(error);
    });

</script>

对于2.文档说

In order to run the editor, you need to load the necessary files (base DLL + editor creator + features). These files expose their content in the CKEditor5 global, using the following format:
但是我找不到源编辑插件的正确路径,所以我可以将它用作dll

你能帮我设置一下,以便可以从 CDN 加载源代码编辑插件吗?

javascript webpack ckeditor5
1个回答
0
投票

您可以按如下方式使用dll:

Script: https://unpkg.com/@ckeditor/[email protected]/build/source-editing.js
plugins: CKEditor5.sourceEditing.SourceEditing
toolbars: sourceEditing

我在这里做了一个演示: https://jsfiddle.net/haison8x/5g9b0t1a/

© www.soinside.com 2019 - 2024. All rights reserved.