@ebl-vue/editor-full 2.31.25 → 2.31.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -28
- package/dist/index.mjs +549 -728
- package/package.json +3 -3
- package/types/index.d.ts +5 -1
- package/.postcssrc.yml +0 -33
- package/dist/index.mjs.map +0 -1
- package/postcss.config.js +0 -15
- package/src/components/Editor/Editor.vue +0 -293
- package/src/components/Editor/EditorRender.vue +0 -274
- package/src/components/index.ts +0 -29
- package/src/constants/index.ts +0 -1
- package/src/i18n/zh-cn.ts +0 -158
- package/src/icons/index.ts +0 -93
- package/src/index.ts +0 -22
- package/src/installer.ts +0 -21
- package/src/plugins/alert/index.css +0 -150
- package/src/plugins/alert/index.ts +0 -456
- package/src/plugins/block-alignment/index.css +0 -9
- package/src/plugins/block-alignment/index.ts +0 -117
- package/src/plugins/block-alignment/readme.md +0 -1
- package/src/plugins/code/LICENSE +0 -21
- package/src/plugins/code/index.css +0 -214
- package/src/plugins/code/index.ts +0 -621
- package/src/plugins/code/utils/string.ts +0 -34
- package/src/plugins/color-picker/index.ts +0 -130
- package/src/plugins/color-picker/styles.css +0 -27
- package/src/plugins/delimiter/index.css +0 -14
- package/src/plugins/delimiter/index.ts +0 -121
- package/src/plugins/drag-drop/index.css +0 -19
- package/src/plugins/drag-drop/index.ts +0 -151
- package/src/plugins/drag-drop/readme.md +0 -1
- package/src/plugins/header/H1.ts +0 -404
- package/src/plugins/header/H2.ts +0 -403
- package/src/plugins/header/H3.ts +0 -404
- package/src/plugins/header/H4.ts +0 -404
- package/src/plugins/header/H5.ts +0 -403
- package/src/plugins/header/H6.ts +0 -404
- package/src/plugins/header/index.css +0 -20
- package/src/plugins/header/index.ts +0 -15
- package/src/plugins/header/types.d.ts +0 -46
- package/src/plugins/imageResizeCrop/ImageTune.ts +0 -916
- package/src/plugins/imageResizeCrop/index.css +0 -230
- package/src/plugins/imageResizeCrop/index.ts +0 -5
- package/src/plugins/imageResizeCrop/types.d.ts +0 -23
- package/src/plugins/imageTool/index.css +0 -156
- package/src/plugins/imageTool/index.ts +0 -538
- package/src/plugins/imageTool/types/codexteam__ajax.d.ts +0 -89
- package/src/plugins/imageTool/types/types.ts +0 -236
- package/src/plugins/imageTool/ui.ts +0 -313
- package/src/plugins/imageTool/uploader.ts +0 -272
- package/src/plugins/imageTool/utils/dom.ts +0 -24
- package/src/plugins/imageTool/utils/index.ts +0 -73
- package/src/plugins/imageTool/utils/isPromise.ts +0 -10
- package/src/plugins/indent/index.css +0 -86
- package/src/plugins/indent/index.ts +0 -695
- package/src/plugins/inline-code/index.css +0 -11
- package/src/plugins/inline-code/index.ts +0 -202
- package/src/plugins/list/ListRenderer/ChecklistRenderer.ts +0 -208
- package/src/plugins/list/ListRenderer/ListRenderer.ts +0 -73
- package/src/plugins/list/ListRenderer/OrderedListRenderer.ts +0 -123
- package/src/plugins/list/ListRenderer/UnorderedListRenderer.ts +0 -123
- package/src/plugins/list/ListRenderer/index.ts +0 -6
- package/src/plugins/list/ListTabulator/index.ts +0 -1179
- package/src/plugins/list/index.ts +0 -480
- package/src/plugins/list/styles/CssPrefix.ts +0 -4
- package/src/plugins/list/styles/input.css +0 -36
- package/src/plugins/list/styles/list.css +0 -165
- package/src/plugins/list/types/Elements.ts +0 -14
- package/src/plugins/list/types/ItemMeta.ts +0 -40
- package/src/plugins/list/types/ListParams.ts +0 -102
- package/src/plugins/list/types/ListRenderer.ts +0 -6
- package/src/plugins/list/types/OlCounterType.ts +0 -63
- package/src/plugins/list/types/index.ts +0 -14
- package/src/plugins/list/utils/focusItem.ts +0 -18
- package/src/plugins/list/utils/getChildItems.ts +0 -40
- package/src/plugins/list/utils/getItemChildWrapper.ts +0 -10
- package/src/plugins/list/utils/getItemContentElement.ts +0 -10
- package/src/plugins/list/utils/getSiblings.ts +0 -52
- package/src/plugins/list/utils/isLastItem.ts +0 -9
- package/src/plugins/list/utils/itemHasSublist.ts +0 -10
- package/src/plugins/list/utils/normalizeData.ts +0 -83
- package/src/plugins/list/utils/removeChildWrapperIfEmpty.ts +0 -31
- package/src/plugins/list/utils/renderToolboxInput.ts +0 -105
- package/src/plugins/list/utils/stripNumbers.ts +0 -7
- package/src/plugins/list/utils/type-guards.ts +0 -8
- package/src/plugins/marker/index.css +0 -4
- package/src/plugins/marker/index.ts +0 -199
- package/src/plugins/outline/index.css +0 -52
- package/src/plugins/outline/index.ts +0 -63
- package/src/plugins/paragraph/index.css +0 -23
- package/src/plugins/paragraph/index.ts +0 -381
- package/src/plugins/paragraph/types/icons.d.ts +0 -4
- package/src/plugins/paragraph/utils/makeFragment.ts +0 -17
- package/src/plugins/quote/index.css +0 -26
- package/src/plugins/quote/index.ts +0 -203
- package/src/plugins/table/index.ts +0 -4
- package/src/plugins/table/plugin.ts +0 -254
- package/src/plugins/table/style.css +0 -388
- package/src/plugins/table/table.ts +0 -1195
- package/src/plugins/table/toolbox.ts +0 -166
- package/src/plugins/table/utils/dom.ts +0 -130
- package/src/plugins/table/utils/popover.ts +0 -185
- package/src/plugins/table/utils/throttled.ts +0 -22
- package/src/plugins/underline/index.css +0 -3
- package/src/plugins/underline/index.ts +0 -214
- package/src/plugins/undo/index.ts +0 -524
- package/src/plugins/undo/observer.ts +0 -101
- package/src/style.css +0 -114
- package/src/types.ts +0 -3
- package/src/utils/AxiosService.ts +0 -87
- package/src/utils/index.ts +0 -15
- package/src/utils/install.ts +0 -19
- package/tsconfig.json +0 -37
- package/vite.config.ts +0 -81
package/postcss.config.js
DELETED
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ebl-editor" id="holder"></div>
|
|
3
|
-
</template>
|
|
4
|
-
<script lang="ts" setup>
|
|
5
|
-
|
|
6
|
-
import EditorJS from '@ebl-vue/editorjs';
|
|
7
|
-
// import EditorJS from '../../../../editorjs/src/codex';
|
|
8
|
-
// window.VERSION="2.31.0"; //如果是用源码模式时,需要设置全局变量
|
|
9
|
-
|
|
10
|
-
import { onMounted, onUnmounted, watch, inject } from 'vue';
|
|
11
|
-
import { toRaw } from 'vue';
|
|
12
|
-
import { IEblEditorSettings } from '../../types';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 插件
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import DragDrop from '../../plugins/drag-drop';
|
|
19
|
-
import { H1, H2, H3, H4, H5, H6 } from '../../plugins/header';
|
|
20
|
-
import BlockAlignment from '../../plugins/block-alignment';
|
|
21
|
-
import Paragraph from '../../plugins/paragraph';
|
|
22
|
-
import Code from '../../plugins/code';
|
|
23
|
-
import type { OutputData } from '@ebl-vue/editorjs';
|
|
24
|
-
import Quote from "../../plugins/quote/";
|
|
25
|
-
import Delimiter from '../../plugins/delimiter';
|
|
26
|
-
import List from '../../plugins/list';
|
|
27
|
-
import Undo from '../../plugins/undo';
|
|
28
|
-
import Alert from '../../plugins/alert';
|
|
29
|
-
import IndentTune from '../../plugins/indent';
|
|
30
|
-
import Marker from "../../plugins/marker";
|
|
31
|
-
import { ColorPickerWithoutSanitize } from "../../plugins/color-picker";
|
|
32
|
-
import Underline from "../../plugins/underline";
|
|
33
|
-
import InlineCode from "../../plugins/inline-code";
|
|
34
|
-
import Table from '../../plugins/table';
|
|
35
|
-
import ImageTool from "../../plugins/imageTool";
|
|
36
|
-
import { ImageToolTune } from "../../plugins/imageResizeCrop";
|
|
37
|
-
import Outline from '../../plugins/outline';
|
|
38
|
-
|
|
39
|
-
const EblEditorSettings: IEblEditorSettings | undefined = inject("EblEditorSettings");
|
|
40
|
-
defineOptions({
|
|
41
|
-
name: 'EblEditor',
|
|
42
|
-
inheritAttrs: false
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
let emits = defineEmits(["onReady", "onChange"]);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
interface Props {
|
|
50
|
-
readOnly: boolean,
|
|
51
|
-
placeholder: string,
|
|
52
|
-
data: OutputData,
|
|
53
|
-
locale: any,
|
|
54
|
-
userStore: any,
|
|
55
|
-
showOutline?: boolean,
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
59
|
-
readOnly: false,
|
|
60
|
-
placeholder: "Enter something",
|
|
61
|
-
data: ()=>({
|
|
62
|
-
blocks: []
|
|
63
|
-
}),
|
|
64
|
-
locale: {},
|
|
65
|
-
showOutline:false
|
|
66
|
-
});
|
|
67
|
-
let editorData=toRaw(props.data);
|
|
68
|
-
let editorIsReady = false;
|
|
69
|
-
|
|
70
|
-
let editor: EditorJS | null = null;
|
|
71
|
-
let undo: Undo | null = null;
|
|
72
|
-
let outline: Outline | null = null;
|
|
73
|
-
const tunes = ['indent', 'blockAlignment'];
|
|
74
|
-
onMounted(() => {
|
|
75
|
-
|
|
76
|
-
editor = new EditorJS({
|
|
77
|
-
minHeight: 300,
|
|
78
|
-
holder: 'holder',
|
|
79
|
-
autofocus: true,
|
|
80
|
-
defaultBlock: 'paragraph',
|
|
81
|
-
placeholder: props.placeholder,
|
|
82
|
-
tunes: tunes,
|
|
83
|
-
tools: {
|
|
84
|
-
inlineCode: InlineCode,
|
|
85
|
-
underline: Underline,
|
|
86
|
-
Color: {
|
|
87
|
-
class: ColorPickerWithoutSanitize
|
|
88
|
-
},
|
|
89
|
-
marker: {
|
|
90
|
-
class: Marker
|
|
91
|
-
},
|
|
92
|
-
indent: {
|
|
93
|
-
class: IndentTune,
|
|
94
|
-
},
|
|
95
|
-
alert: {
|
|
96
|
-
class: Alert,
|
|
97
|
-
inlineToolbar: true
|
|
98
|
-
},
|
|
99
|
-
List: {
|
|
100
|
-
class: List,
|
|
101
|
-
inlineToolbar: true,
|
|
102
|
-
config: {
|
|
103
|
-
defaultStyle: 'checklist',
|
|
104
|
-
|
|
105
|
-
maxLevel: 4,
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
h1: {
|
|
109
|
-
class: H1,
|
|
110
|
-
inlineToolbar: true
|
|
111
|
-
},
|
|
112
|
-
h2: {
|
|
113
|
-
class: H2,
|
|
114
|
-
inlineToolbar: true,
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
h3: {
|
|
118
|
-
class: H3,
|
|
119
|
-
inlineToolbar: true
|
|
120
|
-
},
|
|
121
|
-
h4: {
|
|
122
|
-
class: H4,
|
|
123
|
-
inlineToolbar: true
|
|
124
|
-
},
|
|
125
|
-
h5: {
|
|
126
|
-
class: H5,
|
|
127
|
-
inlineToolbar: true
|
|
128
|
-
},
|
|
129
|
-
h6: {
|
|
130
|
-
class: H6,
|
|
131
|
-
inlineToolbar: true
|
|
132
|
-
},
|
|
133
|
-
paragraph: {
|
|
134
|
-
class: Paragraph,
|
|
135
|
-
inlineToolbar: true
|
|
136
|
-
},
|
|
137
|
-
blockAlignment: {
|
|
138
|
-
class: BlockAlignment,
|
|
139
|
-
inlineToolbar: true
|
|
140
|
-
},
|
|
141
|
-
code: {
|
|
142
|
-
class: Code,
|
|
143
|
-
config: {
|
|
144
|
-
lang: "javascript",
|
|
145
|
-
theme: "github-dark-dimmed"//"catppuccin-latte"
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
quote: {
|
|
149
|
-
class: Quote,
|
|
150
|
-
inlineToolbar: true
|
|
151
|
-
},
|
|
152
|
-
delimiter: Delimiter,
|
|
153
|
-
table: {
|
|
154
|
-
class: Table,
|
|
155
|
-
inlineToolbar: true,
|
|
156
|
-
config: {
|
|
157
|
-
rows: 2,
|
|
158
|
-
cols: 3,
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
image: {
|
|
162
|
-
class: ImageTool,
|
|
163
|
-
inlineToolbar: true,
|
|
164
|
-
tunes: tunes.concat(['imageResize']),
|
|
165
|
-
config: {
|
|
166
|
-
types: ".png,.jpeg,.jpg,.gif,.webp",
|
|
167
|
-
userStore: props.userStore,
|
|
168
|
-
endpoints: {
|
|
169
|
-
byFile: EblEditorSettings?.fileUploadEndpoint,
|
|
170
|
-
//byUrl: EblEditorSettings?.urlUploadEndpoint
|
|
171
|
-
},
|
|
172
|
-
features: {
|
|
173
|
-
caption: false,
|
|
174
|
-
stretch: false,
|
|
175
|
-
border: false,
|
|
176
|
-
background: false,
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
imageResize: {
|
|
183
|
-
class: ImageToolTune,
|
|
184
|
-
config: {
|
|
185
|
-
resize: true,
|
|
186
|
-
crop: false
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
data: editorData,
|
|
195
|
-
readOnly: props.readOnly,
|
|
196
|
-
i18n: props.locale,
|
|
197
|
-
onChange: (api, event) => {
|
|
198
|
-
emits("onChange", api, event);
|
|
199
|
-
},
|
|
200
|
-
onReady: () => {
|
|
201
|
-
editorIsReady = true;
|
|
202
|
-
new DragDrop("holder", props.readOnly, editor!, '1px solid #999');
|
|
203
|
-
const undoConfig = {
|
|
204
|
-
debounceTimer: 200,
|
|
205
|
-
maxLength: 100
|
|
206
|
-
}
|
|
207
|
-
undo = new Undo({
|
|
208
|
-
editor: editor!,
|
|
209
|
-
config: undoConfig,
|
|
210
|
-
onUpdate: () => {
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
editorData = toRaw(props.data);
|
|
214
|
-
undo.initialize(editorData);
|
|
215
|
-
|
|
216
|
-
if (props.data && props.data.blocks && props.data.blocks.length > 0) {
|
|
217
|
-
editor!.render(editorData);
|
|
218
|
-
}
|
|
219
|
-
//文档大纲
|
|
220
|
-
if(props.showOutline){
|
|
221
|
-
outline = new Outline("holder",editor!);
|
|
222
|
-
outline.render(editorData);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
emits("onReady");
|
|
226
|
-
},
|
|
227
|
-
|
|
228
|
-
})
|
|
229
|
-
});
|
|
230
|
-
onUnmounted(() => {
|
|
231
|
-
if (editor !== null) {
|
|
232
|
-
editor.destroy();
|
|
233
|
-
editor = null;
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
watch(() => props.data, (newVal, oldVal) => {
|
|
238
|
-
editorData = toRaw(newVal);
|
|
239
|
-
if (editor != null && editorIsReady) {
|
|
240
|
-
editor.render(editorData).then(() => {
|
|
241
|
-
if (outline != null && props.showOutline) {
|
|
242
|
-
outline.render(editorData);
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
if (undo != null) {
|
|
247
|
-
undo.clear();
|
|
248
|
-
undo.initialize(editorData);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
},{
|
|
253
|
-
deep:true
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* 验证是否为空 */
|
|
259
|
-
function validate() {
|
|
260
|
-
return new Promise((resolve, reject) => {
|
|
261
|
-
if (editor !== null) {
|
|
262
|
-
editor.save().then((outputData: OutputData) => {
|
|
263
|
-
if (outputData.blocks.length > 0) {
|
|
264
|
-
return resolve(true);
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
return resolve(false);
|
|
268
|
-
});
|
|
269
|
-
} else {
|
|
270
|
-
return resolve(false);
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
function getData() {
|
|
275
|
-
return new Promise((resolve, reject) => {
|
|
276
|
-
if (editor !== null) {
|
|
277
|
-
editor.save().then((outputData: OutputData) => {
|
|
278
|
-
return resolve(outputData);
|
|
279
|
-
});
|
|
280
|
-
} else {
|
|
281
|
-
return resolve(null);
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
defineExpose({
|
|
287
|
-
validate,
|
|
288
|
-
getData,
|
|
289
|
-
});
|
|
290
|
-
</script>
|
|
291
|
-
<style scoped>
|
|
292
|
-
|
|
293
|
-
</style>
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ebl-editor readonly" id="holder"></div>
|
|
3
|
-
</template>
|
|
4
|
-
<script lang="ts" setup>
|
|
5
|
-
|
|
6
|
-
import EditorJS from '@ebl-vue/editorjs';
|
|
7
|
-
// import EditorJS from '../../../../editorjs/src/codex';
|
|
8
|
-
// window.VERSION="2.31.0"; //如果是用源码模式时,需要设置全局变量
|
|
9
|
-
|
|
10
|
-
import { onMounted, onUnmounted, watch, inject } from 'vue';
|
|
11
|
-
import { toRaw } from 'vue';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 插件
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import { H1, H2, H3, H4, H5, H6 } from '../../plugins/header';
|
|
20
|
-
import BlockAlignment from '../../plugins/block-alignment';
|
|
21
|
-
import Paragraph from '../../plugins/paragraph';
|
|
22
|
-
import Code from '../../plugins/code';
|
|
23
|
-
import type { OutputData } from '@ebl-vue/editorjs';
|
|
24
|
-
import Quote from "../../plugins/quote";
|
|
25
|
-
import Delimiter from '../../plugins/delimiter';
|
|
26
|
-
import List from '../../plugins/list';
|
|
27
|
-
import Undo from '../../plugins/undo';
|
|
28
|
-
import Alert from '../../plugins/alert';
|
|
29
|
-
import IndentTune from '../../plugins/indent';
|
|
30
|
-
import Marker from "../../plugins/marker";
|
|
31
|
-
import { ColorPickerWithoutSanitize } from "../../plugins/color-picker";
|
|
32
|
-
import Underline from "../../plugins/underline";
|
|
33
|
-
import InlineCode from "../../plugins/inline-code";
|
|
34
|
-
import Table from '../../plugins/table';
|
|
35
|
-
import ImageTool from "../../plugins/imageTool";
|
|
36
|
-
import { ImageToolTune } from "../../plugins/imageResizeCrop";
|
|
37
|
-
import Outline from '../../plugins/outline';
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
defineOptions({
|
|
41
|
-
name: 'EblEditorRender',
|
|
42
|
-
inheritAttrs: false
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
let emits = defineEmits(["onReady", "onChange"]);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
interface Props {
|
|
50
|
-
data: OutputData,
|
|
51
|
-
locale: any,
|
|
52
|
-
showOutline?: boolean,
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
57
|
-
data: ()=>({
|
|
58
|
-
blocks: []
|
|
59
|
-
}),
|
|
60
|
-
locale: {},
|
|
61
|
-
showOutline: false,
|
|
62
|
-
|
|
63
|
-
});
|
|
64
|
-
let editorData=toRaw(props.data);
|
|
65
|
-
let editorIsReady = false;
|
|
66
|
-
|
|
67
|
-
let editor: EditorJS | null = null;
|
|
68
|
-
let undo: Undo | null = null;
|
|
69
|
-
let outline: Outline | null = null;
|
|
70
|
-
const tunes = ['indent', 'blockAlignment'];
|
|
71
|
-
onMounted(() => {
|
|
72
|
-
|
|
73
|
-
editor = new EditorJS({
|
|
74
|
-
minHeight: 50,
|
|
75
|
-
holder: 'holder',
|
|
76
|
-
autofocus: true,
|
|
77
|
-
defaultBlock: 'paragraph',
|
|
78
|
-
placeholder: props.placeholder,
|
|
79
|
-
tunes: tunes,
|
|
80
|
-
tools: {
|
|
81
|
-
inlineCode: InlineCode,
|
|
82
|
-
underline: Underline,
|
|
83
|
-
Color: {
|
|
84
|
-
class: ColorPickerWithoutSanitize
|
|
85
|
-
},
|
|
86
|
-
marker: {
|
|
87
|
-
class: Marker
|
|
88
|
-
},
|
|
89
|
-
indent: {
|
|
90
|
-
class: IndentTune,
|
|
91
|
-
},
|
|
92
|
-
alert: {
|
|
93
|
-
class: Alert,
|
|
94
|
-
inlineToolbar: true
|
|
95
|
-
},
|
|
96
|
-
List: {
|
|
97
|
-
class: List,
|
|
98
|
-
inlineToolbar: true,
|
|
99
|
-
config: {
|
|
100
|
-
defaultStyle: 'checklist',
|
|
101
|
-
|
|
102
|
-
maxLevel: 4,
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
h1: {
|
|
106
|
-
class: H1,
|
|
107
|
-
inlineToolbar: true
|
|
108
|
-
},
|
|
109
|
-
h2: {
|
|
110
|
-
class: H2,
|
|
111
|
-
inlineToolbar: true,
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
h3: {
|
|
115
|
-
class: H3,
|
|
116
|
-
inlineToolbar: true
|
|
117
|
-
},
|
|
118
|
-
h4: {
|
|
119
|
-
class: H4,
|
|
120
|
-
inlineToolbar: true
|
|
121
|
-
},
|
|
122
|
-
h5: {
|
|
123
|
-
class: H5,
|
|
124
|
-
inlineToolbar: true
|
|
125
|
-
},
|
|
126
|
-
h6: {
|
|
127
|
-
class: H6,
|
|
128
|
-
inlineToolbar: true
|
|
129
|
-
},
|
|
130
|
-
paragraph: {
|
|
131
|
-
class: Paragraph,
|
|
132
|
-
inlineToolbar: true
|
|
133
|
-
},
|
|
134
|
-
blockAlignment: {
|
|
135
|
-
class: BlockAlignment,
|
|
136
|
-
inlineToolbar: true
|
|
137
|
-
},
|
|
138
|
-
code: {
|
|
139
|
-
class: Code,
|
|
140
|
-
config: {
|
|
141
|
-
lang: "javascript",
|
|
142
|
-
theme: "github-dark-dimmed"//"catppuccin-latte"
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
quote: {
|
|
146
|
-
class: Quote,
|
|
147
|
-
inlineToolbar: true
|
|
148
|
-
},
|
|
149
|
-
delimiter: Delimiter,
|
|
150
|
-
table: {
|
|
151
|
-
class: Table,
|
|
152
|
-
inlineToolbar: true,
|
|
153
|
-
config: {
|
|
154
|
-
rows: 2,
|
|
155
|
-
cols: 3,
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
image: {
|
|
159
|
-
class: ImageTool,
|
|
160
|
-
inlineToolbar: true,
|
|
161
|
-
tunes: tunes.concat(['imageResize']),
|
|
162
|
-
config: {
|
|
163
|
-
types: ".png,.jpeg,.jpg,.gif,.webp",
|
|
164
|
-
|
|
165
|
-
endpoints: {
|
|
166
|
-
byFile: '',
|
|
167
|
-
|
|
168
|
-
},
|
|
169
|
-
features: {
|
|
170
|
-
caption: false,
|
|
171
|
-
stretch: false,
|
|
172
|
-
border: false,
|
|
173
|
-
background: false,
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
imageResize: {
|
|
180
|
-
class: ImageToolTune,
|
|
181
|
-
config: {
|
|
182
|
-
resize: true,
|
|
183
|
-
crop: false
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
data: editorData,
|
|
192
|
-
readOnly: true,
|
|
193
|
-
i18n: props.locale,
|
|
194
|
-
onChange: (api, event) => {
|
|
195
|
-
emits("onChange", api, event);
|
|
196
|
-
},
|
|
197
|
-
onReady: () => {
|
|
198
|
-
editorIsReady = true;
|
|
199
|
-
editorData = toRaw(props.data);
|
|
200
|
-
if (props.data && props.data.blocks && props.data.blocks.length > 0) {
|
|
201
|
-
editor!.render(editorData);
|
|
202
|
-
}
|
|
203
|
-
//文档大纲
|
|
204
|
-
if(props.showOutline){
|
|
205
|
-
outline = new Outline("holder",editor!);
|
|
206
|
-
outline.render(editorData);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
emits("onReady");
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
})
|
|
213
|
-
});
|
|
214
|
-
onUnmounted(() => {
|
|
215
|
-
if (editor !== null) {
|
|
216
|
-
editor.destroy();
|
|
217
|
-
editor = null;
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
watch(() => props.data, (newVal, oldVal) => {
|
|
222
|
-
editorData = toRaw(newVal);
|
|
223
|
-
if (editor != null && editorIsReady) {
|
|
224
|
-
editor.render(editorData).then(() => {
|
|
225
|
-
if (outline != null && props.showOutline) {
|
|
226
|
-
outline.render(editorData);
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
},{
|
|
234
|
-
deep:true
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* 验证是否为空 */
|
|
240
|
-
function validate() {
|
|
241
|
-
return new Promise((resolve, reject) => {
|
|
242
|
-
if (editor !== null) {
|
|
243
|
-
editor.save().then((outputData: OutputData) => {
|
|
244
|
-
if (outputData.blocks.length > 0) {
|
|
245
|
-
return resolve(true);
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
return resolve(false);
|
|
249
|
-
});
|
|
250
|
-
} else {
|
|
251
|
-
return resolve(false);
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
function getData() {
|
|
256
|
-
return new Promise((resolve, reject) => {
|
|
257
|
-
if (editor !== null) {
|
|
258
|
-
editor.save().then((outputData: OutputData) => {
|
|
259
|
-
return resolve(outputData);
|
|
260
|
-
});
|
|
261
|
-
} else {
|
|
262
|
-
return resolve(null);
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
defineExpose({
|
|
268
|
-
validate,
|
|
269
|
-
getData,
|
|
270
|
-
});
|
|
271
|
-
</script>
|
|
272
|
-
<style scoped>
|
|
273
|
-
|
|
274
|
-
</style>
|
package/src/components/index.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Plugin } from "vue";
|
|
3
|
-
import { withInstall } from "../utils/install"
|
|
4
|
-
import type { SFCWithInstall } from 'types'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import Editor from "./Editor/Editor.vue"
|
|
8
|
-
import EditorRender from "./Editor/EditorRender.vue"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const items = [
|
|
13
|
-
Editor,
|
|
14
|
-
EditorRender
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
let PluginList: Plugin[] = [];
|
|
18
|
-
for (let key in items) {
|
|
19
|
-
const ele = items[key];
|
|
20
|
-
const EblEle: SFCWithInstall<typeof ele> = withInstall(ele);
|
|
21
|
-
|
|
22
|
-
PluginList.push(EblEle);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default PluginList;
|
|
26
|
-
export {
|
|
27
|
-
Editor as EblEditor,
|
|
28
|
-
EditorRender as EblEditorRender
|
|
29
|
-
};
|
package/src/constants/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const INSTALLED_KEY = Symbol('INSTALLED_KEY')
|