@ebl-vue/editor-full 1.0.8
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/.postcssrc.yml +33 -0
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +2565 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +55 -0
- package/postcss.config.js +15 -0
- package/src/components/Editor/Editor.vue +209 -0
- package/src/components/index.ts +27 -0
- package/src/constants/index.ts +1 -0
- package/src/i18n/zh-cn.ts +151 -0
- package/src/icons/index.ts +78 -0
- package/src/index.ts +11 -0
- package/src/installer.ts +22 -0
- package/src/plugins/alert/index.css +150 -0
- package/src/plugins/alert/index.ts +463 -0
- package/src/plugins/block-alignment/index.css +9 -0
- package/src/plugins/block-alignment/index.ts +116 -0
- package/src/plugins/block-alignment/readme.md +1 -0
- package/src/plugins/code/LICENSE +21 -0
- package/src/plugins/code/index.css +120 -0
- package/src/plugins/code/index.ts +530 -0
- package/src/plugins/code/utils/string.ts +34 -0
- package/src/plugins/color-picker/index.ts +138 -0
- package/src/plugins/color-picker/styles.css +27 -0
- package/src/plugins/delimiter/index.css +14 -0
- package/src/plugins/delimiter/index.ts +122 -0
- package/src/plugins/drag-drop/index.css +19 -0
- package/src/plugins/drag-drop/index.ts +151 -0
- package/src/plugins/drag-drop/readme.md +1 -0
- package/src/plugins/header/H1.ts +405 -0
- package/src/plugins/header/H2.ts +403 -0
- package/src/plugins/header/H3.ts +404 -0
- package/src/plugins/header/H4.ts +405 -0
- package/src/plugins/header/H5.ts +405 -0
- package/src/plugins/header/H6.ts +406 -0
- package/src/plugins/header/index.css +20 -0
- package/src/plugins/header/index.ts +15 -0
- package/src/plugins/header/types.d.ts +46 -0
- package/src/plugins/indent/index.css +86 -0
- package/src/plugins/indent/index.ts +697 -0
- package/src/plugins/inline-code/index.css +11 -0
- package/src/plugins/inline-code/index.ts +205 -0
- package/src/plugins/list/ListRenderer/ChecklistRenderer.ts +211 -0
- package/src/plugins/list/ListRenderer/ListRenderer.ts +73 -0
- package/src/plugins/list/ListRenderer/OrderedListRenderer.ts +123 -0
- package/src/plugins/list/ListRenderer/UnorderedListRenderer.ts +123 -0
- package/src/plugins/list/ListRenderer/index.ts +6 -0
- package/src/plugins/list/ListTabulator/index.ts +1179 -0
- package/src/plugins/list/index.ts +502 -0
- package/src/plugins/list/styles/CssPrefix.ts +4 -0
- package/src/plugins/list/styles/icons/index.ts +10 -0
- package/src/plugins/list/styles/input.css +36 -0
- package/src/plugins/list/styles/list.css +165 -0
- package/src/plugins/list/types/Elements.ts +14 -0
- package/src/plugins/list/types/ItemMeta.ts +40 -0
- package/src/plugins/list/types/ListParams.ts +102 -0
- package/src/plugins/list/types/ListRenderer.ts +6 -0
- package/src/plugins/list/types/OlCounterType.ts +63 -0
- package/src/plugins/list/types/index.ts +14 -0
- package/src/plugins/list/utils/focusItem.ts +18 -0
- package/src/plugins/list/utils/getChildItems.ts +40 -0
- package/src/plugins/list/utils/getItemChildWrapper.ts +10 -0
- package/src/plugins/list/utils/getItemContentElement.ts +10 -0
- package/src/plugins/list/utils/getSiblings.ts +52 -0
- package/src/plugins/list/utils/isLastItem.ts +9 -0
- package/src/plugins/list/utils/itemHasSublist.ts +10 -0
- package/src/plugins/list/utils/normalizeData.ts +84 -0
- package/src/plugins/list/utils/removeChildWrapperIfEmpty.ts +31 -0
- package/src/plugins/list/utils/renderToolboxInput.ts +105 -0
- package/src/plugins/list/utils/stripNumbers.ts +7 -0
- package/src/plugins/list/utils/type-guards.ts +8 -0
- package/src/plugins/list.md +15 -0
- package/src/plugins/marker/index.css +4 -0
- package/src/plugins/marker/index.ts +187 -0
- package/src/plugins/paragraph/index.css +23 -0
- package/src/plugins/paragraph/index.ts +380 -0
- package/src/plugins/paragraph/types/icons.d.ts +4 -0
- package/src/plugins/paragraph/utils/makeFragment.ts +17 -0
- package/src/plugins/quote/index.css +26 -0
- package/src/plugins/quote/index.ts +206 -0
- package/src/plugins/table/index.ts +4 -0
- package/src/plugins/table/plugin.ts +254 -0
- package/src/plugins/table/style.css +388 -0
- package/src/plugins/table/table.ts +1192 -0
- package/src/plugins/table/toolbox.ts +165 -0
- package/src/plugins/table/utils/dom.ts +128 -0
- package/src/plugins/table/utils/popover.ts +172 -0
- package/src/plugins/table/utils/throttled.ts +22 -0
- package/src/plugins/underline/index.css +3 -0
- package/src/plugins/underline/index.ts +216 -0
- package/src/plugins/undo/index.ts +509 -0
- package/src/plugins/undo/observer.ts +101 -0
- package/src/style.css +89 -0
- package/src/utils/index.ts +15 -0
- package/src/utils/install.ts +19 -0
- package/tsconfig.json +37 -0
- package/types/index.d.ts +13 -0
- package/types/plugins/index.d.ts +0 -0
- package/vite.config.ts +79 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import "./index.css"
|
|
2
|
+
import type { API, BlockTune, ToolConfig } from "@ebl-vue/editorjs/types";
|
|
3
|
+
|
|
4
|
+
interface ConstructorArgs {
|
|
5
|
+
data: AlignmentData;
|
|
6
|
+
config?: ToolConfig;
|
|
7
|
+
api: API;
|
|
8
|
+
block?: any;
|
|
9
|
+
}
|
|
10
|
+
export interface AlignmentData {
|
|
11
|
+
text?: string;
|
|
12
|
+
alignment: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default class BlockAlignment implements BlockTune{
|
|
16
|
+
private settings: ToolConfig;
|
|
17
|
+
private block: any;
|
|
18
|
+
private api: API;
|
|
19
|
+
private data: AlignmentData;
|
|
20
|
+
private alignmentSettings: any[];
|
|
21
|
+
private _CSS: any;
|
|
22
|
+
private wrapper: HTMLElement | undefined;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
static get DEFAULT_ALIGNMENT() {
|
|
26
|
+
return 'left';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static get isTune() {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
getAlignment() {
|
|
34
|
+
if (!!this.settings?.blocks && this.settings.blocks.hasOwnProperty(this.block.name)) {
|
|
35
|
+
return this.settings.blocks[this.block.name]
|
|
36
|
+
}
|
|
37
|
+
if (!!this.settings?.default) {
|
|
38
|
+
return this.settings.default
|
|
39
|
+
}
|
|
40
|
+
return BlockAlignment.DEFAULT_ALIGNMENT
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
constructor({ api, data, config, block }: ConstructorArgs) {
|
|
44
|
+
this.api = api;
|
|
45
|
+
this.block = block;
|
|
46
|
+
|
|
47
|
+
this.settings = config;
|
|
48
|
+
this.data = data || { alignment: this.getAlignment() }
|
|
49
|
+
this.alignmentSettings = [
|
|
50
|
+
{
|
|
51
|
+
name: 'left',
|
|
52
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17 7L5 7"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17 17H5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M13 12L5 12"/></svg>`
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'center',
|
|
56
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 7L6 7"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 17H6"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 12L8 12"/></svg>`
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'right',
|
|
60
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 7L7 7"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 17H7"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 12L11 12"/></svg>`
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
this._CSS = {
|
|
64
|
+
alignment: {
|
|
65
|
+
left: 'ce-tune-alignment--left',
|
|
66
|
+
center: 'ce-tune-alignment--center',
|
|
67
|
+
right: 'ce-tune-alignment--right',
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
wrap(blockContent: HTMLElement) {
|
|
74
|
+
this.wrapper = document.createElement("div");
|
|
75
|
+
this.wrapper!.classList.toggle(this._CSS.alignment[this.data.alignment])
|
|
76
|
+
this.wrapper!.append(blockContent)
|
|
77
|
+
return this.wrapper
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
render() {
|
|
82
|
+
const wrapper = document.createElement("div");
|
|
83
|
+
this.alignmentSettings.map(align => {
|
|
84
|
+
const button = document.createElement('button');
|
|
85
|
+
button.classList.add(this.api.styles.settingsButton);
|
|
86
|
+
button.innerHTML = align.icon;
|
|
87
|
+
button.type = 'button';
|
|
88
|
+
|
|
89
|
+
button.classList.toggle(this.api.styles.settingsButtonActive, align.name === this.data.alignment);
|
|
90
|
+
const buttonTooltip = this.api.i18n.t(align.name + " align");
|
|
91
|
+
this.api.tooltip.onHover(button, buttonTooltip, {
|
|
92
|
+
placement: 'top',
|
|
93
|
+
});
|
|
94
|
+
wrapper.appendChild(button);
|
|
95
|
+
return button
|
|
96
|
+
}).forEach((element, index, elements) => {
|
|
97
|
+
element.addEventListener('click', () => {
|
|
98
|
+
this.data = {
|
|
99
|
+
alignment: this.alignmentSettings[index].name
|
|
100
|
+
}
|
|
101
|
+
elements.forEach((el, i) => {
|
|
102
|
+
const { name } = this.alignmentSettings[i];
|
|
103
|
+
el.classList.toggle(this.api.styles.settingsButtonActive, name === this.data.alignment);
|
|
104
|
+
this.wrapper!.classList.toggle(this._CSS.alignment[name], name === this.data.alignment)
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
return wrapper;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
save() {
|
|
113
|
+
return this.data;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# 通用的对齐插件
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 CodeX
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
.ce-editorjs-x-shiki {
|
|
2
|
+
border-radius: 10px;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
margin: 10px 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.ce-editorjs-x-shiki__code {
|
|
9
|
+
position: relative;
|
|
10
|
+
float: left;
|
|
11
|
+
min-width: 100%;
|
|
12
|
+
overflow-x: auto;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ce-editorjs-x-shiki__selector {
|
|
16
|
+
display: flex;
|
|
17
|
+
gap: .25rem;
|
|
18
|
+
/* align-items: center; */
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
z-index: 12;
|
|
21
|
+
border-bottom-style: solid;
|
|
22
|
+
border-color: #9ca3af0d;
|
|
23
|
+
padding: .5rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ce-editorjs-x-shiki__selector-language
|
|
27
|
+
, .ce-editorjs-x-shiki__selector-theme {
|
|
28
|
+
font-size: 13px;
|
|
29
|
+
font-family: inherit;
|
|
30
|
+
}
|
|
31
|
+
.ce-editorjs-x-shiki__selector-language{
|
|
32
|
+
width: 90px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ce-editorjs-x-shiki__selector select {
|
|
36
|
+
border: none;
|
|
37
|
+
outline: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ce-editorjs-x-shiki__span {
|
|
41
|
+
position: relative;
|
|
42
|
+
z-index: 0;
|
|
43
|
+
padding: 20px;
|
|
44
|
+
margin: 0;
|
|
45
|
+
white-space: pre;
|
|
46
|
+
font-size: 13px;
|
|
47
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ce-editorjs-x-shiki__textarea {
|
|
51
|
+
white-space: pre;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
background-color: transparent;
|
|
54
|
+
position: absolute;
|
|
55
|
+
padding: 20px;
|
|
56
|
+
inset: 0 0 0 0;
|
|
57
|
+
color: transparent;
|
|
58
|
+
z-index: 0;
|
|
59
|
+
font-size: 13px;
|
|
60
|
+
caret-color: #999;
|
|
61
|
+
resize: none;
|
|
62
|
+
border: none;
|
|
63
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ce-editorjs-x-shiki__lang {
|
|
67
|
+
/* position: absolute;
|
|
68
|
+
line-height: 14px;
|
|
69
|
+
font-size: 10px;
|
|
70
|
+
color: #999;
|
|
71
|
+
background-color: #dcdfe6;
|
|
72
|
+
padding: 6px;
|
|
73
|
+
padding-left: 10px;
|
|
74
|
+
padding-right: 10px;
|
|
75
|
+
top: 0;
|
|
76
|
+
right: 0;
|
|
77
|
+
border-bottom-left-radius: 6px;
|
|
78
|
+
border-top-right-radius: 6px; */
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
.ce-editorjs-x-shiki__copy{
|
|
83
|
+
width:24px;
|
|
84
|
+
height:24px;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
position: relative;
|
|
87
|
+
margin-right: 0px;
|
|
88
|
+
}
|
|
89
|
+
.ce-editorjs-x-shiki__copy_tip{
|
|
90
|
+
font-size: 12px;
|
|
91
|
+
/* width: 50px; */
|
|
92
|
+
width: 60px;
|
|
93
|
+
margin-left: -20px; /* Center the tooltip */
|
|
94
|
+
background-color: #0c0c0c;
|
|
95
|
+
color: #ececec;
|
|
96
|
+
text-align: center;
|
|
97
|
+
border-radius: 6px;
|
|
98
|
+
padding: 5px 10px;
|
|
99
|
+
position: absolute;
|
|
100
|
+
z-index: 1;
|
|
101
|
+
top: 125%; /* Position the tooltip below the button */
|
|
102
|
+
transition: opacity 0.3s;
|
|
103
|
+
visibility: hidden;
|
|
104
|
+
opacity: 0;
|
|
105
|
+
}
|
|
106
|
+
.ce-editorjs-x-shiki__copy_tip::after {
|
|
107
|
+
content: "";
|
|
108
|
+
position: absolute;
|
|
109
|
+
bottom: 100%; /* Bottom of the tooltip */
|
|
110
|
+
left: 50%;
|
|
111
|
+
margin-left: -5px;
|
|
112
|
+
border-width: 5px;
|
|
113
|
+
border-style: solid;
|
|
114
|
+
border-color: transparent transparent #0c0c0c transparent;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.ce-editorjs-x-shiki__copy_tip.visible {
|
|
118
|
+
visibility: visible;
|
|
119
|
+
opacity: 1;
|
|
120
|
+
}
|