我在用CKEDITOR5。我的代码如下所示
当我用
plugins: [SourceEditing, Markdown],我得到以下JS错误。
未定义ReferenceError: SourceEditing未定义
这是一个.NET。我下载并使用了CKEDITOR5文件(不是通过NPM安装的)
我需要导入什么Javascript才能使用SourceEditing?
在这方面,任何帮助都是非常感谢的。
<script src="~/lib/ckeditor5-build-classic/ckeditor.js"></script>
<script>
var myEditor;
ClassicEditor
.create(document.querySelector('#txtaEditor'), {
plugins: [SourceEditing, Markdown],
toolbar: ['heading', '|',
'fontfamily', 'fontsize', '|',
'alignment', '|',
'fontColor', 'fontBackgroundColor', '|',
'bold', 'italic', 'strikethrough', 'underline', 'subscript', 'superscript', '|',
'link', '|',
'outdent', 'indent', '|',
'bulletedList', 'numberedList', 'todoList', '|',
'code', 'codeBlock', '|',
'insertTable', '|',
'uploadImage', 'blockQuote', '|',
'undo', 'redo', 'editor'], shouldNotGroupWhenFull: true
})
.then(editor => {
myEditor = editor;
})
.catch(error => {
console.error(error);
});
</script>发布于 2022-01-24 08:36:27
下面的gif图像中的效果应该是您想要的。

经过调查,我发现安装插件通常使用nodejs或在线编译。因此,目前不应该使用cshtml文件中的plugins: [SourceEditing, Markdown],添加插件。
建议对非nodejs项目使用在线编译,然后下载并替换js和css文件路径。上述效果就是以这种方式实现的。我的项目结构的图片张贴在下面。

https://stackoverflow.com/questions/70800349
复制相似问题