В приложении vue.js с использованием редактора quill - как предусмотрено модулем vue-quill-editor. Я хочу усовершенствовать редактор с помощью возможности выбора таблиц, используя модуль "лучше-таблицы", предоставляемый модулем npm "quill-better-table".
Когда я пытаюсь вставить таблицу в редактор, я получаюсообщение об ошибке
quill.js:148 Uncaught Error: [Parchment] Unable to create table blot
at new ParchmentError (quill.js:148)
at Object.create (quill.js:178)
at TableCellLine.ShadowBlot.wrap (quill.js:5875)
at TableCellLine.FormatBlot.wrap (quill.js:3683)
at TableCellLine.optimize (quill-better-table.js:1360)
at optimize (quill.js:7258)
at LinkedList.forEach (quill.js:7121)
at ScrollBlot.optimize (quill.js:7288)
at Scroll.optimize (quill.js:4379)
at ScrollBlot.update (quill.js:7331)
Более конкретно, я получаю это сообщение об ошибке в цикле, пока не произойдет сбой браузера.
Я только показываю соответствующие части (надеюсь) кода:
main.ts:
import VueQuillEdtitor, { Quill } from 'vue-quill-editor';
import quillBetterTable from 'quill-better-table';
(window as any).Quill = Quill;
Quill.register("modules/better-table", quillBetterTable);
Vue.use(VueQuillEdtitor);
HtmlEditor.vue:
<quill-editor v-model="content"
ref="editor"
:options="editorOption"
@blur="onEditorBlur($event)"
@focus="onEditorFocus($event)"
@ready="onEditorReady($event)">
</quill-editor>
....
import { Quill } from 'vue-quill-editor';
....
data() {
return {
editorOption: {
debug: "debug",
theme: "snow",
modules: {
toolbar : false,
"better-table": true
}
}
};
},
computed: {
editor(): Quill {
return (this.$refs.editor as any).quill
}
},
....
methods: {
insertTable() {
const tableModule = this.editor.getModule('better-table');
tableModule.insertTable(3, 3);
},
Я бы ожидал, что вызывающий метод insertTable вставит таблицу в редактор, но вместо этого я получаюисключения в цикле.