我想编辑通过CKEditor提交的文本区域中的数据。我在前端使用Pug,通常使用textarea(name='intro' id='editor' value=method.intro)
将值输入表单
这不适用于我通过CKEditor提交的数据。如何获取并编辑这些数据?
这是我的编辑表单的样子:
form(action='/add' method='POST' class='methodcard' enctype='multipart/form-data')
label(for="name") Method Name
input(type='text' name='name' value=method.name)
label(for='category') Category
label(for="intro") Intro
textarea(name='intro' id='editor' value=method.intro)
label(for="difficulty") Difficulty
input(type='text' name='difficulty' value=method.difficulty)
label(for="implementation") Implementation
input(type='text' name='implementation' value=method.implementation)
label(for="costs") Costs
input(type='text' name='costs' value=method.costs)
input(type="submit" value="Save method" class="button")
script.
ClassicEditor
.create( document.querySelector( '#editor' ), {
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote' ],
} )
.catch( error => {
console.log( error );
} );
myEditor.getData();
textarea(name ='intro'id ='editor'value = method.intro)是我要在CKEditor中显示值的地方