@ebl-vue/editor-full 1.1.1 → 1.1.3
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.mjs +247 -242
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/Editor/Editor.vue +36 -19
- package/src/index.ts +8 -2
- package/types/index.d.ts +5 -1
- package/types/plugins/index.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ebl-editor" id="holder">
|
|
3
|
-
<div class="ce-block__content ebl-editor-title-wrap">
|
|
3
|
+
<!-- <div class="ce-block__content ebl-editor-title-wrap">
|
|
4
4
|
<input type="text" v-model="title" placeholder="请输入标题" class="ebl-editor-title-input"></input>
|
|
5
|
-
</div>
|
|
6
|
-
<div class="ce-block__content ebl-editor-time-wrap">
|
|
5
|
+
</div> -->
|
|
6
|
+
<!-- <div class="ce-block__content ebl-editor-time-wrap">
|
|
7
7
|
<span class="ebl-editor-time">最后修改时间:{{ lastUpdateTime }}</span>
|
|
8
|
-
</div>
|
|
9
|
-
<button @click="
|
|
8
|
+
</div> -->
|
|
9
|
+
<!-- <button @click="validate">保存</button> -->
|
|
10
10
|
|
|
11
11
|
</div>
|
|
12
12
|
</template>
|
|
@@ -58,8 +58,6 @@ let emits = defineEmits(["onReady", "onChange"]);
|
|
|
58
58
|
interface Props {
|
|
59
59
|
readOnly: boolean,
|
|
60
60
|
placeholder: string,
|
|
61
|
-
title: string,
|
|
62
|
-
lastUpdateTime: string,
|
|
63
61
|
data: OutputData,
|
|
64
62
|
locale: any,
|
|
65
63
|
userStore:any
|
|
@@ -68,8 +66,6 @@ interface Props {
|
|
|
68
66
|
const props = withDefaults(defineProps<Props>(), {
|
|
69
67
|
readOnly: false,
|
|
70
68
|
placeholder: "Enter something",
|
|
71
|
-
title: "",
|
|
72
|
-
lastUpdateTime: "",
|
|
73
69
|
data: ()=>({
|
|
74
70
|
blocks: []
|
|
75
71
|
}),
|
|
@@ -77,7 +73,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
77
73
|
});
|
|
78
74
|
|
|
79
75
|
|
|
80
|
-
|
|
76
|
+
|
|
81
77
|
let editor: EditorJS | null = null;
|
|
82
78
|
const tunes = ['indent', 'blockAlignment'];
|
|
83
79
|
onMounted(() => {
|
|
@@ -228,17 +224,38 @@ onUnmounted(() => {
|
|
|
228
224
|
}
|
|
229
225
|
});
|
|
230
226
|
|
|
227
|
+
/**
|
|
228
|
+
* 验证是否为空 */
|
|
229
|
+
function validate() {
|
|
230
|
+
return new Promise((resolve, reject) => {
|
|
231
|
+
if (editor !== null) {
|
|
232
|
+
editor.save().then((outputData: OutputData) => {
|
|
233
|
+
if (outputData.blocks.length > 0) {
|
|
234
|
+
return resolve(true);
|
|
231
235
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
236
|
+
}
|
|
237
|
+
return resolve(false);
|
|
238
|
+
});
|
|
239
|
+
} else {
|
|
240
|
+
return resolve(false);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function getData() {
|
|
245
|
+
return new Promise((resolve, reject) => {
|
|
246
|
+
if (editor !== null) {
|
|
247
|
+
editor.save().then((outputData: OutputData) => {
|
|
248
|
+
return resolve(outputData);
|
|
249
|
+
});
|
|
250
|
+
} else {
|
|
251
|
+
return resolve(null);
|
|
252
|
+
}
|
|
253
|
+
});
|
|
241
254
|
}
|
|
242
255
|
|
|
256
|
+
defineExpose({
|
|
257
|
+
validate,
|
|
258
|
+
getData,
|
|
259
|
+
});
|
|
243
260
|
</script>
|
|
244
261
|
<style scoped></style>
|
package/src/index.ts
CHANGED
|
@@ -4,9 +4,15 @@ import './style.css'
|
|
|
4
4
|
import { createInstaller } from './installer'
|
|
5
5
|
import Components from './components';
|
|
6
6
|
import zhCn from './i18n/zh-cn';
|
|
7
|
+
import type { OutputData } from '@ebl-vue/editorjs';
|
|
8
|
+
import Editor from './components/Editor/Editor.vue';
|
|
7
9
|
const installer = createInstaller(Components)
|
|
8
10
|
export const install = installer.install
|
|
9
11
|
export const version = installer.version
|
|
10
12
|
export default installer;
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
zhCn,
|
|
16
|
+
Editor as EblEditor
|
|
17
|
+
};
|
|
18
|
+
export type { OutputData };
|
package/types/index.d.ts
CHANGED
|
@@ -4,11 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import type { INSTALLED_KEY } from '@/constants'
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
declare module 'vue' {
|
|
8
9
|
export interface App {
|
|
9
10
|
[INSTALLED_KEY]?: boolean
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
export interface GlobalComponents {
|
|
13
|
+
EblEditor: typeof import('@ebl-vue/editor-full')['EblEditor'],
|
|
14
|
+
|
|
15
|
+
}
|
|
12
16
|
};
|
|
13
17
|
|
|
14
18
|
|
package/types/plugins/index.d.ts
DELETED
|
File without changes
|