|
|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
{{ options }}
|
|
|
|
|
<!-- {{ options }}-->
|
|
|
|
|
<umo-editor v-bind="options" ref="editorRef" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
@ -122,10 +122,10 @@ const createContractTable = () => {
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
const options = ref({
|
|
|
|
|
document: {
|
|
|
|
|
title: '',
|
|
|
|
|
content: {
|
|
|
|
|
type: 'doc',
|
|
|
|
|
templates: [
|
|
|
|
|
{
|
|
|
|
|
title: '合同',
|
|
|
|
|
description: '合同',
|
|
|
|
|
content: [
|
|
|
|
|
{
|
|
|
|
|
type: 'heading',
|
|
|
|
|
@ -253,6 +253,13 @@ const options = ref({
|
|
|
|
|
content: [{ type: 'text', text: `\t日期:\t\t\t\t\t\t\t日期:` }]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
document: {
|
|
|
|
|
title: '',
|
|
|
|
|
content: {
|
|
|
|
|
type: 'doc',
|
|
|
|
|
content: []
|
|
|
|
|
},
|
|
|
|
|
placeholder: {
|
|
|
|
|
en_US: 'Please enter the document content...',
|
|
|
|
|
@ -276,23 +283,22 @@ const options = ref({
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onSave: async (e) => {
|
|
|
|
|
const editor = editorRef.value;
|
|
|
|
|
const html = editor.getHTML();
|
|
|
|
|
console.log(html);
|
|
|
|
|
console.log(e);
|
|
|
|
|
// const editor = editorRef.value;
|
|
|
|
|
// const html = editor.getHTML();
|
|
|
|
|
// console.log(html);
|
|
|
|
|
// const doc = new Document({
|
|
|
|
|
// sections: [{ children: parseHTML(editor.getHTML()) }]
|
|
|
|
|
// });
|
|
|
|
|
// await download(doc);
|
|
|
|
|
},
|
|
|
|
|
onChanged: async (e) => {
|
|
|
|
|
const editor = editorRef.value;
|
|
|
|
|
const json = editor.getJSON();
|
|
|
|
|
console.log(json);
|
|
|
|
|
console.log(json.content.find((v) => v.type === 'table' && v.attrs?.id === 'contractTable'));
|
|
|
|
|
|
|
|
|
|
// const editor = editorRef.value;
|
|
|
|
|
// const json = editor.getJSON();
|
|
|
|
|
// console.log(json);
|
|
|
|
|
// console.log(json.content.find((v) => v.type === 'table' && v.attrs?.id === 'contractTable'));
|
|
|
|
|
// json
|
|
|
|
|
editor.setContent(json, { emitUpdate: false });
|
|
|
|
|
|
|
|
|
|
// editor.setContent(json, { emitUpdate: false });
|
|
|
|
|
// const doc = new Document({
|
|
|
|
|
// sections: [{ children: prseHTML(editor.getHTML()) }]
|
|
|
|
|
// });
|
|
|
|
|
|