我使用了ckeditor 5在线构建器,下载了一个压缩文件。我将其解压缩并创建了一个html文件来包含编辑器,如下所示:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>College Connect</title>
<script src="ckeditor5/build/ckeditor.js"></script>
</head>
<body>
<div id="editor"></div>
<script>
ClassicEditor
.create(document.querySelector('#editor'))
.then(editor => {
console.log(editor);
})
.catch(error => {
console.error(error);
});
</script>
</body>
</html>
但是,当我使用来自here的完整版时,它工作得很好。
在使用在线构建器之前有什么需要做的吗?
发布于 2020-07-11 17:38:21
以这种方式设置工具栏对我来说很有效。
let editor;
ClassicEditor.create(document.querySelector('#id-textarea'), {
toolbar: [
'heading',
'bold',
'italic',
'underline',
'fontFamily',
'fontSize',
'fontColor',
'undo',
'redo',
'alignment',
'indent',
'list',
'horizontalLine',
'paragraph',
'removeFormat',
'specialCharacters',
'wordCount',
],
})
.then((newEditor) => {
editor = newEditor;
})
.catch((error) => {
console.error(error);
});https://stackoverflow.com/questions/62063616
复制相似问题