@ebl-vue/editor-full 2.31.21 → 2.31.23
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 +29 -0
- package/dist/index.mjs +77 -77
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/Editor/EditorRender.vue +11 -13
- package/src/index.ts +3 -2
- package/src/plugins/outline/index.css +4 -0
- package/src/plugins/outline/index.ts +10 -3
- package/src/style.css +20 -22
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="ebl-editor" id="holder"></div>
|
|
2
|
+
<div class="ebl-editor readonly" id="holder"></div>
|
|
3
3
|
</template>
|
|
4
4
|
<script lang="ts" setup>
|
|
5
5
|
|
|
@@ -9,13 +9,13 @@ import EditorJS from '@ebl-vue/editorjs';
|
|
|
9
9
|
|
|
10
10
|
import { onMounted, onUnmounted, watch, inject } from 'vue';
|
|
11
11
|
import { toRaw } from 'vue';
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* 插件
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
import { H1, H2, H3, H4, H5, H6 } from '../../plugins/header';
|
|
20
20
|
import BlockAlignment from '../../plugins/block-alignment';
|
|
21
21
|
import Paragraph from '../../plugins/paragraph';
|
|
@@ -36,7 +36,7 @@ import ImageTool from "../../plugins/imageTool";
|
|
|
36
36
|
import { ImageToolTune } from "../../plugins/imageResizeCrop";
|
|
37
37
|
import Outline from '../../plugins/outline';
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
defineOptions({
|
|
41
41
|
name: 'EblEditorRender',
|
|
42
42
|
inheritAttrs: false
|
|
@@ -47,21 +47,19 @@ let emits = defineEmits(["onReady", "onChange"]);
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
interface Props {
|
|
50
|
-
placeholder: string,
|
|
51
50
|
data: OutputData,
|
|
52
51
|
locale: any,
|
|
53
|
-
userStore: any,
|
|
54
52
|
showOutline?: boolean,
|
|
53
|
+
scrollWrap:string
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
const props = withDefaults(defineProps<Props>(), {
|
|
58
|
-
|
|
59
|
-
placeholder: "Enter something",
|
|
60
57
|
data: ()=>({
|
|
61
58
|
blocks: []
|
|
62
59
|
}),
|
|
63
60
|
locale: {},
|
|
64
|
-
showOutline:false
|
|
61
|
+
showOutline: false,
|
|
62
|
+
scrollWrap:''
|
|
65
63
|
});
|
|
66
64
|
let editorData=toRaw(props.data);
|
|
67
65
|
let editorIsReady = false;
|
|
@@ -163,10 +161,10 @@ onMounted(() => {
|
|
|
163
161
|
tunes: tunes.concat(['imageResize']),
|
|
164
162
|
config: {
|
|
165
163
|
types: ".png,.jpeg,.jpg,.gif,.webp",
|
|
166
|
-
|
|
164
|
+
|
|
167
165
|
endpoints: {
|
|
168
|
-
byFile:
|
|
169
|
-
|
|
166
|
+
byFile: '',
|
|
167
|
+
|
|
170
168
|
},
|
|
171
169
|
features: {
|
|
172
170
|
caption: false,
|
|
@@ -204,7 +202,7 @@ onMounted(() => {
|
|
|
204
202
|
}
|
|
205
203
|
//文档大纲
|
|
206
204
|
if(props.showOutline){
|
|
207
|
-
outline = new Outline("holder",editor!);
|
|
205
|
+
outline = new Outline("holder",props.scrollWrap,editor!);
|
|
208
206
|
outline.render(editorData);
|
|
209
207
|
}
|
|
210
208
|
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ 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
|
|
7
|
+
import { EblEditor,EblEditorRender } from './components';
|
|
8
8
|
|
|
9
9
|
const installer = createInstaller(Components);
|
|
10
10
|
export const install = installer.install;
|
|
@@ -17,5 +17,6 @@ export {
|
|
|
17
17
|
};
|
|
18
18
|
export type * from "./types";
|
|
19
19
|
export {
|
|
20
|
-
|
|
20
|
+
EblEditor,
|
|
21
|
+
EblEditorRender
|
|
21
22
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
.ebl-outline{
|
|
2
|
+
position:fixed;
|
|
3
|
+
top:0;
|
|
4
|
+
right:0;
|
|
2
5
|
padding: 15px 12px;
|
|
3
6
|
width:280px;
|
|
4
7
|
|
|
@@ -7,6 +10,7 @@
|
|
|
7
10
|
color: #606266;
|
|
8
11
|
font-size: 14px;
|
|
9
12
|
padding-bottom: 50px;
|
|
13
|
+
height: calc(100vh - var(--header-height));
|
|
10
14
|
}
|
|
11
15
|
.ebl-outline:hover{
|
|
12
16
|
overflow: auto;
|
|
@@ -8,14 +8,15 @@ import { OutputData } from '@ebl-vue/editorjs';
|
|
|
8
8
|
export default class Outline{
|
|
9
9
|
private editor: EditorJS;
|
|
10
10
|
private holder: HTMLElement;
|
|
11
|
+
private scrollWrap: HTMLElement;
|
|
11
12
|
/**
|
|
12
13
|
* 初始化插件
|
|
13
14
|
* @param {EditorJS} editor - 编辑器实例
|
|
14
15
|
*/
|
|
15
|
-
constructor(holderId: string,editor: EditorJS) {
|
|
16
|
+
constructor(holderId: string,scrollWrap:string,editor: EditorJS) {
|
|
16
17
|
this.editor = editor;
|
|
17
18
|
this.holder = document.getElementById(holderId) as HTMLElement;
|
|
18
|
-
|
|
19
|
+
this.scrollWrap = (document.getElementById(scrollWrap) ||document.getElementsByTagName(scrollWrap)[0] || document.querySelector(scrollWrap)) as HTMLElement;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
public render(data: OutputData) {
|
|
@@ -50,7 +51,13 @@ export default class Outline{
|
|
|
50
51
|
const block = document.querySelector<HTMLElement>('.codex-editor .ce-block[data-id="' + blockData.id + '"]');
|
|
51
52
|
if (block) {
|
|
52
53
|
const top = block.offsetTop;
|
|
53
|
-
|
|
54
|
+
|
|
55
|
+
if (!this.scrollWrap) {
|
|
56
|
+
document.querySelector<HTMLElement>('.codex-editor')?.scrollTo(0, top);
|
|
57
|
+
} else {
|
|
58
|
+
window.scrollTo(0,top)
|
|
59
|
+
//this.scrollWrap.scrollTo(0, top);
|
|
60
|
+
}
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
});
|
package/src/style.css
CHANGED
|
@@ -18,33 +18,31 @@
|
|
|
18
18
|
|
|
19
19
|
}
|
|
20
20
|
.ebl-editor.outline{
|
|
21
|
-
|
|
22
|
-
flex-direction: row;
|
|
21
|
+
padding-right: 280px;
|
|
23
22
|
}
|
|
24
23
|
.ebl-editor.outline .codex-editor{flex:1;}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
border-right: 1px solid var(--color-border);
|
|
28
|
-
overflow: auto;
|
|
29
|
-
}
|
|
24
|
+
|
|
25
|
+
|
|
30
26
|
@media(max-width:1240px){
|
|
31
27
|
.ebl-outline{
|
|
32
28
|
display: none;
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
.ebl-editor.outline{
|
|
32
|
+
padding-right: 0;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
@media(min-width:1240px){
|
|
36
|
+
.ebl-editor.readonly .ce-block__content{
|
|
37
|
+
max-width: 100%;
|
|
38
|
+
padding-left: 100px;
|
|
39
|
+
padding-right: 100px;
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
37
43
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
max-width: 700px;
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
.ce-toolbar__content {
|
|
44
|
-
max-width: 700px;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
} */
|
|
44
|
+
|
|
45
|
+
|
|
48
46
|
|
|
49
47
|
.ce-toolbar,.ce-inline-toolbar{
|
|
50
48
|
z-index: 1000;
|
|
@@ -93,8 +91,8 @@
|
|
|
93
91
|
|
|
94
92
|
/* 滚动条整体部分 */
|
|
95
93
|
.ebl-editor ::-webkit-scrollbar {
|
|
96
|
-
width:
|
|
97
|
-
height:
|
|
94
|
+
width: 6px; /* 滚动条的宽度 */
|
|
95
|
+
height: 6px; /* 滚动条的高度 */
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
/* 滚动条轨道 */
|
|
@@ -107,7 +105,7 @@
|
|
|
107
105
|
.ebl-editor ::-webkit-scrollbar-thumb {
|
|
108
106
|
background: #C0C0C0; /* 滑块颜色 */
|
|
109
107
|
border-radius: 10px; /* 滑块圆角 */
|
|
110
|
-
border:
|
|
108
|
+
border: 1px solid #fff; /* 滑块边框 */
|
|
111
109
|
}
|
|
112
110
|
|
|
113
111
|
/* 滑块悬停时 */
|