@ebl-vue/editor-full 1.1.7 → 2.31.9
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 +6 -3
- package/dist/index.mjs +90 -81
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/Editor/Editor.vue +5 -3
- package/src/index.ts +5 -2
- package/src/installer.ts +4 -6
- package/src/plugins/code/index.css +3 -3
- package/src/plugins/imageResizeCrop/ImageTune.ts +34 -18
- package/src/plugins/imageResizeCrop/index.css +11 -16
- package/src/plugins/imageTool/index.css +9 -3
- package/src/plugins/table/style.css +1 -1
- package/src/plugins/table/utils/dom.ts +3 -2
- package/src/style.css +1 -33
- package/src/types.ts +3 -0
- package/types/index.d.ts +4 -8
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ import EditorJS from '@ebl-vue/editorjs';
|
|
|
18
18
|
|
|
19
19
|
import { onMounted, onUnmounted, ref, inject } from 'vue';
|
|
20
20
|
import { toRaw } from 'vue';
|
|
21
|
-
import { IEblEditorSettings } from '
|
|
21
|
+
import { IEblEditorSettings } from '../../types';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* 插件
|
|
@@ -144,7 +144,7 @@ onMounted(() => {
|
|
|
144
144
|
class: Code,
|
|
145
145
|
config: {
|
|
146
146
|
lang: "javascript",
|
|
147
|
-
theme: "catppuccin-latte"
|
|
147
|
+
theme: "github-dark-dimmed"//"catppuccin-latte"
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
150
|
quote: {
|
|
@@ -258,4 +258,6 @@ defineExpose({
|
|
|
258
258
|
getData,
|
|
259
259
|
});
|
|
260
260
|
</script>
|
|
261
|
-
<style scoped
|
|
261
|
+
<style scoped>
|
|
262
|
+
|
|
263
|
+
</style>
|
package/src/index.ts
CHANGED
package/src/installer.ts
CHANGED
|
@@ -2,17 +2,15 @@ import type { App, Plugin } from 'vue'
|
|
|
2
2
|
import { version } from '../package.json'
|
|
3
3
|
|
|
4
4
|
import { INSTALLED_KEY } from "./constants";
|
|
5
|
-
import { IEblEditorSettings } from
|
|
5
|
+
import type { IEblEditorSettings } from "./types";
|
|
6
6
|
|
|
7
7
|
export const createInstaller = (components: Plugin[] = []) => {
|
|
8
|
-
const install = (app: App,config
|
|
8
|
+
const install = (app: App, config: IEblEditorSettings) => {
|
|
9
9
|
if (app[INSTALLED_KEY]) return
|
|
10
10
|
|
|
11
11
|
app[INSTALLED_KEY] = true
|
|
12
|
-
components.forEach((c) => app.use(c))
|
|
13
|
-
|
|
14
|
-
app.provide("EblEditorSettings",config);
|
|
15
|
-
}
|
|
12
|
+
components.forEach((c) => app.use(c))
|
|
13
|
+
app.provide("EblEditorSettings", config);
|
|
16
14
|
|
|
17
15
|
}
|
|
18
16
|
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
|
|
15
15
|
.ce-editorjs-x-shiki__selector {
|
|
16
16
|
display: flex;
|
|
17
|
-
gap:
|
|
18
|
-
/* align-items: center; */
|
|
17
|
+
gap:15px;
|
|
19
18
|
justify-content: space-between;
|
|
20
19
|
z-index: 12;
|
|
21
20
|
border-bottom-style: solid;
|
|
22
21
|
border-color: #9ca3af0d;
|
|
23
|
-
|
|
22
|
+
border-bottom-width: 1px;
|
|
23
|
+
padding: 8px;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.ce-editorjs-x-shiki__selector-language
|
|
@@ -61,18 +61,7 @@ export default class ImageToolTune implements BlockTune {
|
|
|
61
61
|
|
|
62
62
|
constructor({ api, data, config, block }: ImageToolTuneConstructor) {
|
|
63
63
|
this.settings = [
|
|
64
|
-
|
|
65
|
-
// name: 'resize',
|
|
66
|
-
// icon: '<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M29 30l1 90h36V66h26V30H29zm99 0v36h72V30h-72zm108 0v36h72V30h-72zm108 0v36h72V30h-72zm102 0v78h36V30h-36zm-206 80v36h100.543l-118 118H30v218h218V289.457l118-118V272h36V110H240zm206 34v72h36v-72h-36zM30 156v72h36v-72H30zm416 96v72h36v-72h-36zm0 108v72h36v-72h-36zm-166 86v36h72v-36h-72zm108 0v36h72v-36h-72z"></path></svg>',
|
|
67
|
-
// label: '',
|
|
68
|
-
// group: 'size',
|
|
69
|
-
// },
|
|
70
|
-
// {
|
|
71
|
-
// name: 'crop',
|
|
72
|
-
// icon: '<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M21 15h2v2h-2v-2zm0-4h2v2h-2v-2zm2 8h-2v2c1 0 2-1 2-2zM13 3h2v2h-2V3zm8 4h2v2h-2V7zm0-4v2h2c0-1-1-2-2-2zM1 7h2v2H1V7zm16-4h2v2h-2V3zm0 16h2v2h-2v-2zM3 3C2 3 1 4 1 5h2V3zm6 0h2v2H9V3zM5 3h2v2H5V3zm-4 8v8c0 1.1.9 2 2 2h12V11H1zm2 8l2.5-3.21 1.79 2.15 2.5-3.22L13 19H3z"></path></svg>',
|
|
73
|
-
// label: '',
|
|
74
|
-
// group: 'size',
|
|
75
|
-
// },
|
|
64
|
+
|
|
76
65
|
];
|
|
77
66
|
|
|
78
67
|
this.api = api;
|
|
@@ -596,7 +585,7 @@ export default class ImageToolTune implements BlockTune {
|
|
|
596
585
|
resizerTopRight.addEventListener('mousedown', e => {
|
|
597
586
|
this.resizeClick(
|
|
598
587
|
blockContent.getElementsByClassName('cdx-block')[0] as HTMLElement,
|
|
599
|
-
|
|
588
|
+
"right",
|
|
600
589
|
e,
|
|
601
590
|
);
|
|
602
591
|
});
|
|
@@ -606,13 +595,35 @@ export default class ImageToolTune implements BlockTune {
|
|
|
606
595
|
resizerBottomRight.addEventListener('mousedown', e => {
|
|
607
596
|
this.resizeClick(
|
|
608
597
|
blockContent.getElementsByClassName('cdx-block')[0] as HTMLElement,
|
|
609
|
-
|
|
598
|
+
"right",
|
|
610
599
|
e,
|
|
611
600
|
);
|
|
612
601
|
});
|
|
613
602
|
|
|
603
|
+
const resizerTopLeft = document.createElement('div');
|
|
604
|
+
resizerTopLeft.classList.add('resizer', 'top-left');
|
|
605
|
+
resizerTopLeft.addEventListener('mousedown', e => {
|
|
606
|
+
this.resizeClick(
|
|
607
|
+
blockContent.getElementsByClassName('cdx-block')[0] as HTMLElement,
|
|
608
|
+
"left",
|
|
609
|
+
e,
|
|
610
|
+
);
|
|
611
|
+
});
|
|
612
|
+
const resizerBottomLeft = document.createElement('div');
|
|
613
|
+
resizerBottomLeft.classList.add('resizer', 'bottom-left');
|
|
614
|
+
resizerBottomLeft.addEventListener('mousedown', e => {
|
|
615
|
+
this.resizeClick(
|
|
616
|
+
blockContent.getElementsByClassName('cdx-block')[0] as HTMLElement,
|
|
617
|
+
"left",
|
|
618
|
+
e,
|
|
619
|
+
);
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
|
|
614
623
|
resizers.appendChild(resizerTopRight);
|
|
615
624
|
resizers.appendChild(resizerBottomRight);
|
|
625
|
+
resizers.appendChild(resizerTopLeft);
|
|
626
|
+
resizers.appendChild(resizerBottomLeft);
|
|
616
627
|
resizable.appendChild(resizers);
|
|
617
628
|
blockContent.getElementsByClassName('cdx-block')[0].appendChild(resizable);
|
|
618
629
|
}
|
|
@@ -629,16 +640,21 @@ export default class ImageToolTune implements BlockTune {
|
|
|
629
640
|
* @public
|
|
630
641
|
* @return {void}
|
|
631
642
|
* */
|
|
632
|
-
resizeClick(blockContent: HTMLElement,
|
|
643
|
+
resizeClick(blockContent: HTMLElement, handleDirection: String, e: MouseEvent): void {
|
|
633
644
|
const maxWidth =
|
|
634
|
-
document.getElementsByClassName('
|
|
635
|
-
|
|
645
|
+
document.getElementsByClassName('ce-block__content')[0].clientWidth;
|
|
636
646
|
let startX = 0;
|
|
637
647
|
let startWidth = 0;
|
|
638
648
|
|
|
639
649
|
const mouseMoveHandler = (e: MouseEvent) => {
|
|
640
650
|
const dx = e.clientX - startX;
|
|
641
|
-
|
|
651
|
+
let newWidth = startWidth;
|
|
652
|
+
if (handleDirection === "right") {
|
|
653
|
+
newWidth += dx;
|
|
654
|
+
}
|
|
655
|
+
if (handleDirection === "left") {
|
|
656
|
+
newWidth -= dx;
|
|
657
|
+
}
|
|
642
658
|
|
|
643
659
|
if (newWidth > 50 && newWidth < maxWidth) {
|
|
644
660
|
(
|
|
@@ -117,8 +117,8 @@
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
.cdx-image-tool-tune--resize .cdx-block .resizable .resizers .resizer {
|
|
120
|
-
width:
|
|
121
|
-
height:
|
|
120
|
+
width: 8px;
|
|
121
|
+
height: 8px;
|
|
122
122
|
border-radius: 50%;
|
|
123
123
|
background: var(--primary-content);
|
|
124
124
|
border: 3px solid var(--primary);
|
|
@@ -126,8 +126,8 @@
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
.cdx-image-tool-tune--resize .cdx-block .resizable .resizers .resizer.top-left {
|
|
129
|
-
left: -
|
|
130
|
-
top:
|
|
129
|
+
left: -8px;
|
|
130
|
+
top: 2px;
|
|
131
131
|
cursor: nwse-resize;
|
|
132
132
|
/*resizer cursor*/
|
|
133
133
|
}
|
|
@@ -137,8 +137,8 @@
|
|
|
137
137
|
.resizable
|
|
138
138
|
.resizers
|
|
139
139
|
.resizer.top-right {
|
|
140
|
-
right: -
|
|
141
|
-
top:
|
|
140
|
+
right: -8px;
|
|
141
|
+
top: 1px;
|
|
142
142
|
cursor: nesw-resize;
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -147,8 +147,8 @@
|
|
|
147
147
|
.resizable
|
|
148
148
|
.resizers
|
|
149
149
|
.resizer.bottom-left {
|
|
150
|
-
left: -
|
|
151
|
-
bottom:
|
|
150
|
+
left: -9px;
|
|
151
|
+
bottom: 10px;
|
|
152
152
|
cursor: nesw-resize;
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -157,8 +157,8 @@
|
|
|
157
157
|
.resizable
|
|
158
158
|
.resizers
|
|
159
159
|
.resizer.bottom-right {
|
|
160
|
-
right: -
|
|
161
|
-
bottom:
|
|
160
|
+
right: -9px;
|
|
161
|
+
bottom: 10px;
|
|
162
162
|
cursor: nwse-resize;
|
|
163
163
|
}
|
|
164
164
|
|
|
@@ -211,12 +211,7 @@
|
|
|
211
211
|
max-height: unset !important;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
|
|
215
|
-
margin: 0.8em 0;
|
|
216
|
-
}
|
|
217
|
-
.ce-toolbar {
|
|
218
|
-
z-index: 3;
|
|
219
|
-
}
|
|
214
|
+
|
|
220
215
|
|
|
221
216
|
.image-tool__caption {
|
|
222
217
|
background-color: white;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
.image-tool {
|
|
2
2
|
--bg-color: #cdd1e0;
|
|
3
3
|
--front-color: #388ae5;
|
|
4
|
-
--border-color: #e8e8eb
|
|
4
|
+
--border-color: #e8e8eb;
|
|
5
|
+
display: inline-block;
|
|
6
|
+
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
|
|
@@ -9,13 +11,17 @@
|
|
|
9
11
|
border-radius: 3px;
|
|
10
12
|
overflow: hidden;
|
|
11
13
|
margin-bottom: 10px;
|
|
12
|
-
padding-bottom: 0
|
|
14
|
+
padding-bottom: 0;
|
|
15
|
+
user-select:none;
|
|
16
|
+
pointer-events:none;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
.image-tool__image-picture {
|
|
16
20
|
max-width: 100%;
|
|
17
21
|
vertical-align: bottom;
|
|
18
|
-
display: inline-block
|
|
22
|
+
display: inline-block;
|
|
23
|
+
user-select:none;
|
|
24
|
+
pointer-events:none;
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
.image-tool__image-preloader {
|
|
@@ -24,8 +24,9 @@ export function make(
|
|
|
24
24
|
continue;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
el[attrName] = attributes[attrName];
|
|
28
|
+
//不能用
|
|
29
|
+
//el.setAttribute(attrName, attributes[attrName]);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
return el;
|
package/src/style.css
CHANGED
|
@@ -7,39 +7,7 @@
|
|
|
7
7
|
font-weight: 400;
|
|
8
8
|
background-color: #fff;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
min-height: 55px;
|
|
12
|
-
}
|
|
13
|
-
.ebl-editor-title-wrap{
|
|
14
|
-
min-height: 55px;
|
|
15
|
-
margin: 0 auto;
|
|
16
|
-
}
|
|
17
|
-
.ebl-editor-title-input{
|
|
18
|
-
min-height: 55px;
|
|
19
|
-
width: 100%;
|
|
20
|
-
font-weight: 600;
|
|
21
|
-
border: none;
|
|
22
|
-
background-color: transparent;
|
|
23
|
-
font-size:34px;
|
|
24
|
-
}
|
|
25
|
-
.ebl-editor-title-input:focus{
|
|
26
|
-
outline: none;
|
|
27
|
-
}
|
|
28
|
-
.ebl-editor-title-input:active{
|
|
29
|
-
outline: none;
|
|
30
|
-
}
|
|
31
|
-
.ebl-editor-time-wrap{
|
|
32
|
-
white-space: nowrap;
|
|
33
|
-
font-size: 14px;
|
|
34
|
-
font-weight: 400;
|
|
35
|
-
line-height: 22px;
|
|
36
|
-
padding-top :12px ;
|
|
37
|
-
padding-bottom: 8px;
|
|
38
|
-
color: #646a73;
|
|
39
|
-
}
|
|
40
|
-
.ce-block__content{
|
|
41
|
-
max-width: 650px;
|
|
42
|
-
}
|
|
10
|
+
|
|
43
11
|
@media (min-width: 1050px) {
|
|
44
12
|
.ce-block__content {
|
|
45
13
|
max-width: 700px;
|
package/src/types.ts
ADDED
package/types/index.d.ts
CHANGED
|
@@ -9,15 +9,11 @@ declare module 'vue' {
|
|
|
9
9
|
export interface App {
|
|
10
10
|
[INSTALLED_KEY]?: boolean
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
export interface GlobalComponents {
|
|
13
|
+
EblEditor: typeof import('@ebl-vue/editor-full')['EblEditor'],
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
}
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
export
|
|
20
|
-
fileUploadEndpoint: string;
|
|
21
|
-
urlUploadEndpoint: string;
|
|
22
|
-
userStore: any;
|
|
23
|
-
}
|
|
19
|
+
export {}
|