我想使用 CKEditor v5 并从 CDN 加载它。我也想使用源码编辑插件
我想知道是否可以使用
对于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 加载源代码编辑插件吗?
您可以按如下方式使用dll:
Script: https://unpkg.com/@ckeditor/[email protected]/build/source-editing.js
plugins: CKEditor5.sourceEditing.SourceEditing
toolbars: sourceEditing
我在这里做了一个演示: https://jsfiddle.net/haison8x/5g9b0t1a/