@ebl-vue/editor-render 2.31.25
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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.mjs +129 -0
- package/dist/index.mjs.map +1 -0
- package/dist/style.css +1 -0
- package/dist/styles/alert.css +151 -0
- package/dist/styles/block-alignment.css +9 -0
- package/dist/styles/code.css +214 -0
- package/dist/styles/color.css +27 -0
- package/dist/styles/delimiter.css +14 -0
- package/dist/styles/header.css +20 -0
- package/dist/styles/image.css +156 -0
- package/dist/styles/indent.css +86 -0
- package/dist/styles/index.css +68 -0
- package/dist/styles/inline-code.css +11 -0
- package/dist/styles/list.css +202 -0
- package/dist/styles/marker.css +4 -0
- package/dist/styles/outline.css +52 -0
- package/dist/styles/paragraph.css +23 -0
- package/dist/styles/quote.css +26 -0
- package/dist/styles/table.css +388 -0
- package/dist/styles/underline.css +3 -0
- package/package.json +54 -0
- package/src/EditorRender.vue +43 -0
- package/src/components/List.vue +40 -0
- package/src/components/alert.vue +21 -0
- package/src/components/code.vue +114 -0
- package/src/components/delimiter.vue +19 -0
- package/src/components/h1.vue +19 -0
- package/src/components/h2.vue +19 -0
- package/src/components/h3.vue +19 -0
- package/src/components/h4.vue +19 -0
- package/src/components/h5.vue +19 -0
- package/src/components/h6.vue +19 -0
- package/src/components/image.vue +31 -0
- package/src/components/index.ts +54 -0
- package/src/components/paragraph.vue +19 -0
- package/src/components/quote.vue +21 -0
- package/src/components/table.vue +46 -0
- package/src/constants/index.ts +1 -0
- package/src/i18n/zh-cn.ts +158 -0
- package/src/icons/index.ts +93 -0
- package/src/index.ts +12 -0
- package/src/installer.ts +21 -0
- package/src/styles/alert.css +151 -0
- package/src/styles/block-alignment.css +9 -0
- package/src/styles/code.css +214 -0
- package/src/styles/color.css +27 -0
- package/src/styles/delimiter.css +14 -0
- package/src/styles/header.css +20 -0
- package/src/styles/image.css +156 -0
- package/src/styles/indent.css +86 -0
- package/src/styles/index.css +68 -0
- package/src/styles/inline-code.css +11 -0
- package/src/styles/list.css +202 -0
- package/src/styles/marker.css +4 -0
- package/src/styles/outline.css +52 -0
- package/src/styles/paragraph.css +23 -0
- package/src/styles/quote.css +26 -0
- package/src/styles/table.css +388 -0
- package/src/styles/underline.css +3 -0
- package/src/types.ts +5 -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 +19 -0
- package/vite.config.ts +80 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
.tc-wrap {
|
|
2
|
+
--color-background: #f9f9fb;
|
|
3
|
+
--color-text-secondary: #7b7e89;
|
|
4
|
+
--color-border: #e8e8eb;
|
|
5
|
+
--cell-size: 34px;
|
|
6
|
+
--toolbox-icon-size: 18px;
|
|
7
|
+
--toolbox-padding: 6px;
|
|
8
|
+
--toolbox-aiming-field-size: calc(var(--toolbox-icon-size) + var(--toolbox-padding)*2);
|
|
9
|
+
--col-width: 100px 100px 100px;
|
|
10
|
+
position: relative;
|
|
11
|
+
height: 100%;
|
|
12
|
+
/* width: 100%; */
|
|
13
|
+
margin-top: var(--toolbox-icon-size);
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
display: inline-grid;
|
|
16
|
+
|
|
17
|
+
z-index: 0
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.tc-wrap--readonly {
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.tc-wrap svg {
|
|
25
|
+
vertical-align: top
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@media print {
|
|
29
|
+
.tc-wrap {
|
|
30
|
+
border-left-color: var(--color-border);
|
|
31
|
+
border-left-style: solid;
|
|
32
|
+
border-left-width: 1px;
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@media print {
|
|
38
|
+
.tc-wrap .tc-row:after {
|
|
39
|
+
display: none
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.tc-table {
|
|
44
|
+
position: relative;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
display: grid;
|
|
48
|
+
font-size: 14px;
|
|
49
|
+
border-top: 1px solid var(--color-border);
|
|
50
|
+
border-left: 1px solid var(--color-border);
|
|
51
|
+
line-height: 1.4;
|
|
52
|
+
overflow-x: auto;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.tc-table:after {
|
|
56
|
+
width: calc(var(--cell-size));
|
|
57
|
+
height: 100%;
|
|
58
|
+
left: calc(var(--cell-size)*-1);
|
|
59
|
+
top: 0
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.tc-table:after,
|
|
63
|
+
.tc-table:before {
|
|
64
|
+
position: absolute;
|
|
65
|
+
content: ""
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.tc-table:before {
|
|
69
|
+
width: 100%;
|
|
70
|
+
height: var(--toolbox-aiming-field-size);
|
|
71
|
+
top: calc(var(--toolbox-aiming-field-size)*-1);
|
|
72
|
+
left: 0
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.tc-table--heading .tc-row:first-child {
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
border-bottom: 2px solid var(--color-border);
|
|
78
|
+
position: sticky;
|
|
79
|
+
top: 0;
|
|
80
|
+
z-index: 2;
|
|
81
|
+
background: var(--color-background)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.tc-table--heading .tc-row:first-child [contenteditable]:empty:before {
|
|
85
|
+
content: attr(heading);
|
|
86
|
+
color: var(--color-text-secondary)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.tc-table--heading .tc-row:first-child:after {
|
|
90
|
+
bottom: -2px;
|
|
91
|
+
border-bottom: 2px solid var(--color-border)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.tc-add-column,
|
|
95
|
+
.tc-add-row {
|
|
96
|
+
display: flex;
|
|
97
|
+
color: var(--color-text-secondary)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@media print {
|
|
101
|
+
.tc-add {
|
|
102
|
+
display: none
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.tc-add-column {
|
|
107
|
+
display: grid;
|
|
108
|
+
border-top: 1px solid var(--color-border);
|
|
109
|
+
|
|
110
|
+
grid-auto-rows: var(--cell-size);
|
|
111
|
+
place-items: center
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.tc-add-column svg {
|
|
115
|
+
padding: 5px;
|
|
116
|
+
position: sticky;
|
|
117
|
+
top: 0;
|
|
118
|
+
background-color: var(--color-background)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.tc-add-column--disabled {
|
|
122
|
+
visibility: hidden
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@media print {
|
|
126
|
+
.tc-add-column {
|
|
127
|
+
display: none
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.tc-add-row {
|
|
132
|
+
height: var(--cell-size);
|
|
133
|
+
align-items: center;
|
|
134
|
+
padding-left: 4px;
|
|
135
|
+
position: relative
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.tc-add-row--disabled {
|
|
139
|
+
display: none
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.tc-add-row:before {
|
|
143
|
+
content: "";
|
|
144
|
+
position: absolute;
|
|
145
|
+
right: calc(var(--cell-size)*-1);
|
|
146
|
+
width: var(--cell-size);
|
|
147
|
+
height: 100%
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@media print {
|
|
151
|
+
.tc-add-row {
|
|
152
|
+
display: none
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.tc-add-column,
|
|
157
|
+
.tc-add-row {
|
|
158
|
+
transition: 0s;
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
will-change: background-color
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.tc-add-column:hover,
|
|
164
|
+
.tc-add-row:hover {
|
|
165
|
+
transition: background-color .1s ease;
|
|
166
|
+
background-color: var(--color-background)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.tc-add-row {
|
|
170
|
+
margin-top: 1px
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.tc-add-row:hover:before {
|
|
174
|
+
transition: .1s;
|
|
175
|
+
background-color: var(--color-background)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.tc-row {
|
|
179
|
+
display: grid;
|
|
180
|
+
/* grid-template-columns: repeat(auto-fit, minmax(50px, 1fr)); */
|
|
181
|
+
/* grid-template-columns: 100px 100px 100px; */
|
|
182
|
+
grid-template-columns:var(--col-width);
|
|
183
|
+
position: relative;
|
|
184
|
+
border-bottom: 1px solid var(--color-border)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* .tc-row:after {
|
|
188
|
+
content: "";
|
|
189
|
+
pointer-events: none;
|
|
190
|
+
position: absolute;
|
|
191
|
+
width: var(--cell-size);
|
|
192
|
+
height: 100%;
|
|
193
|
+
bottom: -1px;
|
|
194
|
+
right: calc(var(--cell-size)*-1);
|
|
195
|
+
border-bottom: 1px solid var(--color-border)
|
|
196
|
+
} */
|
|
197
|
+
|
|
198
|
+
.tc-row--selected {
|
|
199
|
+
background: var(--color-background)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.tc-row--selected:after {
|
|
203
|
+
background: var(--color-background)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.tc-cell {
|
|
207
|
+
border-right: 1px solid var(--color-border);
|
|
208
|
+
padding: 6px 12px;
|
|
209
|
+
overflow: hidden;
|
|
210
|
+
outline: none;
|
|
211
|
+
line-break: normal
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.tc-cell--selected {
|
|
215
|
+
background: var(--color-background)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.tc-wrap--readonly .tc-row:after {
|
|
219
|
+
display: none
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.tc-toolbox {
|
|
223
|
+
--toolbox-padding: 6px;
|
|
224
|
+
--popover-margin: 30px;
|
|
225
|
+
--toggler-click-zone-size: 30px;
|
|
226
|
+
--toggler-dots-color: #7b7e89;
|
|
227
|
+
--toggler-dots-color-hovered: #1d202b;
|
|
228
|
+
position: absolute;
|
|
229
|
+
cursor: pointer;
|
|
230
|
+
z-index: 1;
|
|
231
|
+
opacity: 0;
|
|
232
|
+
transition: opacity .1s;
|
|
233
|
+
will-change: left, opacity
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.tc-toolbox--column {
|
|
237
|
+
top: calc(var(--toggler-click-zone-size)*-1);
|
|
238
|
+
transform: translate(calc(var(--toggler-click-zone-size)*-1/2));
|
|
239
|
+
will-change: left, opacity
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.tc-toolbox--row {
|
|
243
|
+
left: calc(var(--popover-margin)*-1);
|
|
244
|
+
transform: translateY(calc(var(--toggler-click-zone-size)*-1/2));
|
|
245
|
+
margin-top: -1px;
|
|
246
|
+
will-change: top, opacity
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.tc-toolbox--showed {
|
|
250
|
+
opacity: 1
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.tc-toolbox .tc-popover {
|
|
254
|
+
position: absolute;
|
|
255
|
+
top: 0;
|
|
256
|
+
left: var(--popover-margin)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.tc-toolbox__toggler {
|
|
260
|
+
display: flex;
|
|
261
|
+
align-items: center;
|
|
262
|
+
justify-content: center;
|
|
263
|
+
width: var(--toggler-click-zone-size);
|
|
264
|
+
height: var(--toggler-click-zone-size);
|
|
265
|
+
color: var(--toggler-dots-color);
|
|
266
|
+
opacity: 0;
|
|
267
|
+
transition: opacity .15s ease;
|
|
268
|
+
will-change: opacity
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.tc-toolbox__toggler:hover {
|
|
272
|
+
color: var(--toggler-dots-color-hovered)
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.tc-toolbox__toggler svg {
|
|
276
|
+
fill: currentColor
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.tc-wrap:hover .tc-toolbox__toggler {
|
|
280
|
+
opacity: 1
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.tc-settings .cdx-settings-button {
|
|
284
|
+
width: 50%;
|
|
285
|
+
margin: 0
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.tc-popover {
|
|
289
|
+
--color-border: #eaeaea;
|
|
290
|
+
--color-background: #fff;
|
|
291
|
+
--color-background-hover: rgba(232, 232, 235, .49);
|
|
292
|
+
--color-background-confirm: #e24a4a;
|
|
293
|
+
--color-background-confirm-hover: #d54040;
|
|
294
|
+
--color-text-confirm: #fff;
|
|
295
|
+
background: var(--color-background);
|
|
296
|
+
border: 1px solid var(--color-border);
|
|
297
|
+
box-shadow: 0 3px 15px -3px #0d142121;
|
|
298
|
+
border-radius: 6px;
|
|
299
|
+
padding: 6px;
|
|
300
|
+
display: none;
|
|
301
|
+
will-change: opacity, transform
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.tc-popover--opened {
|
|
305
|
+
display: flex;
|
|
306
|
+
animation: menuShowing .1s cubic-bezier(.215, .61, .355, 1) forwards
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.tc-popover__item {
|
|
310
|
+
display: flex;
|
|
311
|
+
align-items: center;
|
|
312
|
+
padding: 2px 14px 2px 2px;
|
|
313
|
+
border-radius: 5px;
|
|
314
|
+
cursor: pointer;
|
|
315
|
+
white-space: nowrap;
|
|
316
|
+
-webkit-user-select: none;
|
|
317
|
+
-moz-user-select: none;
|
|
318
|
+
user-select: none
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.tc-popover__item:hover {
|
|
322
|
+
background: var(--color-background-hover)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.tc-popover__item:not(:last-of-type) {
|
|
326
|
+
margin-bottom: 2px
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.tc-popover__item-icon {
|
|
330
|
+
display: inline-flex;
|
|
331
|
+
width: 26px;
|
|
332
|
+
height: 26px;
|
|
333
|
+
align-items: center;
|
|
334
|
+
justify-content: center;
|
|
335
|
+
background: var(--color-background);
|
|
336
|
+
border-radius: 5px;
|
|
337
|
+
border: 1px solid var(--color-border);
|
|
338
|
+
margin-right: 8px
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.tc-popover__item-label {
|
|
342
|
+
line-height: 22px;
|
|
343
|
+
font-size: 14px;
|
|
344
|
+
font-weight: 500
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.tc-popover__item--confirm {
|
|
348
|
+
background: var(--color-background-confirm);
|
|
349
|
+
color: var(--color-text-confirm)
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.tc-popover__item--confirm:hover {
|
|
353
|
+
background-color: var(--color-background-confirm-hover)
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.tc-popover__item--confirm .tc-popover__item-icon {
|
|
357
|
+
background: var(--color-background-confirm);
|
|
358
|
+
border-color: #0000001a
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.tc-popover__item--confirm .tc-popover__item-icon svg {
|
|
362
|
+
transition: transform .2s ease-in;
|
|
363
|
+
transform: rotate(90deg) scale(1.2)
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.tc-popover__item--hidden {
|
|
367
|
+
display: none
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
@keyframes menuShowing {
|
|
371
|
+
0% {
|
|
372
|
+
opacity: 0;
|
|
373
|
+
transform: translateY(-8px) scale(.9)
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
70% {
|
|
377
|
+
opacity: 1;
|
|
378
|
+
transform: translateY(2px)
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
to {
|
|
382
|
+
transform: translateY(0)
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.cell-resizable {
|
|
387
|
+
cursor: col-resize;
|
|
388
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ebl-vue/editor-render",
|
|
3
|
+
"version": "2.31.25",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"author": "lrj525@sina.com",
|
|
6
|
+
"description": "用于渲染editor-full编辑器内容",
|
|
7
|
+
"homepage": "",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"./styles/*": "./dist/styles/*"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"dev": "rimraf dist && vite build --watch",
|
|
18
|
+
"build": "rimraf dist && vite build"
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/index.mjs",
|
|
21
|
+
"module": "./dist/indexs.mjs",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"typesVersions": {
|
|
24
|
+
"*": {
|
|
25
|
+
".": [
|
|
26
|
+
"./dist/index.d.ts",
|
|
27
|
+
"./types/index.d.ts"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"style": "dist/style.css",
|
|
35
|
+
"sideEffects": [
|
|
36
|
+
"dist/*",
|
|
37
|
+
"dist/styles/*.css"
|
|
38
|
+
],
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"vue": "^3.4.0"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "ssh://git@git.jianguodata.com:9082/lirujin/ebl-vue.git"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"shiki": "^3.21.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
51
|
+
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
52
|
+
"vite-plugin-static-copy": "^3.1.4"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ebl-editor-render">
|
|
3
|
+
<template v-for="block in data.blocks">
|
|
4
|
+
<div class="ce-block" :data-id="block.id">
|
|
5
|
+
<div :class="`ce-tune-alignment--${block.tunes.blockAlignment.alignment}`">
|
|
6
|
+
<div :style="`padding-left: ${block.tunes.indent.indentLevel*48}px;`">
|
|
7
|
+
<component :is="'ebl'+block.type" :block="block"></component>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
<div class="ebl-outline" >
|
|
13
|
+
<div style="height: 5000px">
|
|
14
|
+
dd
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
<script lang="ts" setup>
|
|
20
|
+
import "./styles/index.css"
|
|
21
|
+
|
|
22
|
+
interface Props {
|
|
23
|
+
data: any,
|
|
24
|
+
locale: any
|
|
25
|
+
}
|
|
26
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
27
|
+
data: ()=>({
|
|
28
|
+
blocks: []
|
|
29
|
+
}),
|
|
30
|
+
locale: {},
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
defineOptions({
|
|
36
|
+
name: 'EblEditorRender',
|
|
37
|
+
inheritAttrs: false
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
</script>
|
|
41
|
+
<style scoped>
|
|
42
|
+
|
|
43
|
+
</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul v-if="block.data.style==='unordered'" class="cdx-list cdx-list-unordered">
|
|
3
|
+
<li class="cdx-list__item" v-for="(item, index) in block.data.items" :key="index">
|
|
4
|
+
<div class="cdx-list__item-content" v-html="item.content"></div>
|
|
5
|
+
</li>
|
|
6
|
+
</ul>
|
|
7
|
+
<ol v-if="block.data.style==='ordered'" class="cdx-list cdx-list-ordered" :style="`--list-counter-type: ${block.data.meta.counterType};`">
|
|
8
|
+
<li class="cdx-list__item" v-for="(item, index) in block.data.items" :key="index">
|
|
9
|
+
<div class="cdx-list__item-content" v-html="item.content"></div>
|
|
10
|
+
</li>
|
|
11
|
+
</ol>
|
|
12
|
+
<ul v-if="block.data.style==='checklist'" class="cdx-list cdx-list-checklist">
|
|
13
|
+
<li class="cdx-list__item" v-for="(item, index) in block.data.items" :key="index">
|
|
14
|
+
<div class="cdx-list__checkbox cdx-list__checkbox-check--disabled" :class="{'cdx-list__checkbox--checked':item.meta.checked}">
|
|
15
|
+
<span class="cdx-list__checkbox-check"><svg xmlns="http://www.w3.org/2000/svg"
|
|
16
|
+
width="24" height="24" fill="none" viewBox="0 0 24 24">
|
|
17
|
+
<path stroke="currentColor" stroke-linecap="round" stroke-width="2"
|
|
18
|
+
d="M7 12L10.4884 15.8372C10.5677 15.9245 10.705 15.9245 10.7844 15.8372L17 9"></path>
|
|
19
|
+
</svg></span>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="cdx-list__item-content" v-html="item.content"></div>
|
|
22
|
+
</li>
|
|
23
|
+
</ul>
|
|
24
|
+
</template>
|
|
25
|
+
<script lang="ts" setup>
|
|
26
|
+
import type { IBlock } from '../types';
|
|
27
|
+
defineOptions({
|
|
28
|
+
name: 'eblList',
|
|
29
|
+
inheritAttrs: false
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const block = defineModel<IBlock>("block", {
|
|
33
|
+
default: {
|
|
34
|
+
id: "",
|
|
35
|
+
type: "",
|
|
36
|
+
data: {}
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="`cdx-alert cdx-alert-${block.data.type} cdx-alert-align-${block.data.align}`" >
|
|
3
|
+
<div class="cdx-alert__message" v-html="block.data.message"></div>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script lang="ts" setup>
|
|
7
|
+
import type { IBlock } from '../types';
|
|
8
|
+
defineOptions({
|
|
9
|
+
name: 'eblalert',
|
|
10
|
+
inheritAttrs: false
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const block = defineModel<IBlock>("block", {
|
|
14
|
+
default: {
|
|
15
|
+
id: "",
|
|
16
|
+
type: "",
|
|
17
|
+
data: {}
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
</script>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="`cdx-block ce-editorjs-x-shiki`" :style="`${shikiContent?.preStyle}`">
|
|
3
|
+
<div class="ce-editorjs-x-shiki__selector">
|
|
4
|
+
<div class="ce-editorjs-x-shiki__lang">{{block.data.lang}}</div>
|
|
5
|
+
<div class="ce-editorjs-x-shiki__copy" ref="copyRef">
|
|
6
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"
|
|
7
|
+
viewBox="0 0 24 24">
|
|
8
|
+
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
9
|
+
d="M17.25 8.5H10.25C9.2835 8.5 8.5 9.2835 8.5 10.25V17.25C8.5 18.2165 9.2835 19 10.25 19H17.25C18.2165 19 19 18.2165 19 17.25V10.25C19 9.2835 18.2165 8.5 17.25 8.5Z">
|
|
10
|
+
</path>
|
|
11
|
+
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
12
|
+
d="M15.5 8.5V6.75C15.5 6.28587 15.3156 5.84075 14.9874 5.51256C14.6592 5.18437 14.2141 5 13.75 5H6.75C6.28587 5 5.84075 5.18437 5.51256 5.51256C5.18437 5.84075 5 6.28587 5 6.75V13.75C5 14.2141 5.18437 14.6592 5.51256 14.9874C5.84075 15.3156 6.28587 15.5 6.75 15.5H8.5">
|
|
13
|
+
</path>
|
|
14
|
+
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
15
|
+
d="M12 12L15.5 12"></path>
|
|
16
|
+
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
17
|
+
d="M12 15.5L15.5 15.5"></path>
|
|
18
|
+
</svg>
|
|
19
|
+
<div class="ce-editorjs-x-shiki__copy_tip">已复制</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div ref="codeRef" class="ce-editorjs-x-shiki__code" :style="`height:${block.data.resizeSize}px`">
|
|
23
|
+
<span v-html="shikiContent?.html"></span>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="ce-editorjs-x-shiki__code__dragHandler" @mousedown="dragStartHandler"></div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
<script lang="ts" setup>
|
|
29
|
+
import { ref } from 'vue';
|
|
30
|
+
import type { IBlock } from '../types';
|
|
31
|
+
import { codeToHtml } from 'shiki'
|
|
32
|
+
import { asyncComputed } from '@vueuse/core'
|
|
33
|
+
|
|
34
|
+
defineOptions({
|
|
35
|
+
name: 'eblcode',
|
|
36
|
+
inheritAttrs: false
|
|
37
|
+
})
|
|
38
|
+
const codeRef = ref<HTMLElement | null>(null);
|
|
39
|
+
const block = defineModel<IBlock>("block", {
|
|
40
|
+
default: {
|
|
41
|
+
id: "",
|
|
42
|
+
type: "",
|
|
43
|
+
data: {}
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const shikiContent = asyncComputed(async () => {
|
|
48
|
+
let preStyle = ''
|
|
49
|
+
const html = await codeToHtml(block.value.data.code, {
|
|
50
|
+
lang: block.value.data.lang,
|
|
51
|
+
theme: block.value.data.theme || "github-dark-dimmed",
|
|
52
|
+
|
|
53
|
+
transformers: [
|
|
54
|
+
{
|
|
55
|
+
preprocess(code) {
|
|
56
|
+
// if (code.endsWith('\n'))
|
|
57
|
+
return `${code}\n`
|
|
58
|
+
},
|
|
59
|
+
pre(node) {
|
|
60
|
+
this.addClassToHast(node, 'ce-editorjs-x-shiki__span')
|
|
61
|
+
preStyle = node.properties?.style as string || ''
|
|
62
|
+
},
|
|
63
|
+
line(node, line) {
|
|
64
|
+
node.properties = node.properties || {};
|
|
65
|
+
node.properties['data-line'] = line;
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
html,
|
|
75
|
+
preStyle
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
function dragStartHandler(e: MouseEvent) {
|
|
81
|
+
if(!codeRef.value) return;
|
|
82
|
+
resize(codeRef.value, e);
|
|
83
|
+
}
|
|
84
|
+
function resize(codeElement: HTMLElement, event: MouseEvent) {
|
|
85
|
+
let startY = event.clientY;
|
|
86
|
+
let startHeight = parseInt(window.getComputedStyle(codeElement).height, 10);
|
|
87
|
+
const mouseMoveHandler = (e: MouseEvent) => {
|
|
88
|
+
const dY = e.clientY - startY;
|
|
89
|
+
let newHeight = startHeight + dY;
|
|
90
|
+
if (newHeight < 100) {
|
|
91
|
+
newHeight = 100;
|
|
92
|
+
}
|
|
93
|
+
codeElement.style.height = newHeight + 'px';
|
|
94
|
+
};
|
|
95
|
+
const mouseUpHandler = () => {
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
document.removeEventListener('mousemove', mouseMoveHandler);
|
|
99
|
+
document.removeEventListener('mouseup', mouseUpHandler);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
document.addEventListener('mousemove', mouseMoveHandler);
|
|
103
|
+
document.addEventListener('mouseup', mouseUpHandler);
|
|
104
|
+
}
|
|
105
|
+
</script>
|
|
106
|
+
<style scoped>
|
|
107
|
+
.ce-editorjs-x-shiki__code {
|
|
108
|
+
overflow: auto;
|
|
109
|
+
}
|
|
110
|
+
.ce-editorjs-x-shiki__selector{
|
|
111
|
+
padding: 0 8px;
|
|
112
|
+
align-items: center;
|
|
113
|
+
}
|
|
114
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ce-delimiter cdx-block"><div class="ce-delimiter__line__wrapper"><div class="ce-delimiter__line"></div></div></div>
|
|
3
|
+
</template>
|
|
4
|
+
<script lang="ts" setup>
|
|
5
|
+
import type { IBlock } from '../types';
|
|
6
|
+
defineOptions({
|
|
7
|
+
name: 'ebldelimiter',
|
|
8
|
+
inheritAttrs: false
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
// const block = defineModel<IBlock>("block", {
|
|
12
|
+
// default: {
|
|
13
|
+
// id: "",
|
|
14
|
+
// type: "",
|
|
15
|
+
// data: {}
|
|
16
|
+
// },
|
|
17
|
+
// });
|
|
18
|
+
|
|
19
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<h1 class="ce-header" v-html="block.data.text"></h1>
|
|
3
|
+
</template>
|
|
4
|
+
<script lang="ts" setup>
|
|
5
|
+
import type { IBlock } from '../types';
|
|
6
|
+
defineOptions({
|
|
7
|
+
name: 'eblh1',
|
|
8
|
+
inheritAttrs: false
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
const block = defineModel<IBlock>("block", {
|
|
12
|
+
default: {
|
|
13
|
+
id: "",
|
|
14
|
+
type: "",
|
|
15
|
+
data: {}
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
</script>
|