@yltrcc/vditor 0.2.0 → 0.3.0
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.css +2 -2
- package/dist/index.js +366 -70
- package/dist/index.min.js +1 -1
- package/dist/method.js +56 -56
- package/dist/method.min.js +1 -1
- package/dist/ts/util/imageResize.d.ts +1 -0
- package/dist/ts/wysiwyg/renderDomByMd.d.ts +11 -0
- package/package.json +1 -1
- package/src/assets/less/_wysiwyg.less +314 -314
- package/src/index.ts +3 -0
- package/src/ts/markdown/getMarkdown.ts +107 -60
- package/src/ts/markdown/setLute.ts +26 -26
- package/src/ts/util/fixBrowserBehavior.ts +1570 -1570
- package/src/ts/util/imageResize.ts +166 -0
- package/src/ts/wysiwyg/highlightToolbarWYSIWYG.ts +1163 -1163
- package/src/ts/wysiwyg/index.ts +31 -0
- package/src/ts/wysiwyg/input.ts +13 -9
- package/src/ts/wysiwyg/renderDomByMd.ts +109 -1
|
@@ -1,314 +1,314 @@
|
|
|
1
|
-
.vditor-wysiwyg {
|
|
2
|
-
box-sizing: border-box;
|
|
3
|
-
flex: 1;
|
|
4
|
-
position: relative;
|
|
5
|
-
width: 100%;
|
|
6
|
-
min-width: 1px;
|
|
7
|
-
|
|
8
|
-
pre.vditor-reset {
|
|
9
|
-
background-color: var(--panel-background-color);
|
|
10
|
-
margin: 0;
|
|
11
|
-
white-space: pre-wrap;
|
|
12
|
-
height: 100%;
|
|
13
|
-
box-sizing: border-box;
|
|
14
|
-
|
|
15
|
-
&[contenteditable="false"] {
|
|
16
|
-
opacity: 0.3;
|
|
17
|
-
cursor: not-allowed;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&:empty::before {
|
|
21
|
-
content: attr(placeholder);
|
|
22
|
-
color: var(--second-color);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&:focus {
|
|
26
|
-
outline: none;
|
|
27
|
-
background-color: var(--textarea-background-color);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&:after {
|
|
31
|
-
content: "";
|
|
32
|
-
height: var(--editor-bottom);
|
|
33
|
-
display: block;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
blockquote:empty::before,
|
|
38
|
-
pre > code:empty::before,
|
|
39
|
-
p:empty::before,
|
|
40
|
-
h1:empty::after,
|
|
41
|
-
h2:empty::after,
|
|
42
|
-
h3:empty::after,
|
|
43
|
-
h4:empty::after,
|
|
44
|
-
h5:empty::after,
|
|
45
|
-
h6:empty::after {
|
|
46
|
-
content: ' ';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
code[data-marker="`"] {
|
|
50
|
-
padding-left: 0 !important;
|
|
51
|
-
padding-right: 0 !important;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
&__block {
|
|
55
|
-
position: relative;
|
|
56
|
-
|
|
57
|
-
// 编辑区域 - 默认隐藏,但保持预览区域的样式
|
|
58
|
-
pre:first-child {
|
|
59
|
-
display: none; // 默认隐藏编辑区域
|
|
60
|
-
position: relative;
|
|
61
|
-
margin: 0;
|
|
62
|
-
padding: 1em;
|
|
63
|
-
background-color: rgba(0, 0, 0, 0.03);
|
|
64
|
-
border-radius: 4px;
|
|
65
|
-
overflow-x: auto;
|
|
66
|
-
cursor: text;
|
|
67
|
-
white-space: initial;
|
|
68
|
-
min-height: 27px;
|
|
69
|
-
background-size: 20px 20px;
|
|
70
|
-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8AgMAAABHkjHhAAAACVBMVEWAgIBaWlo+Pj7rTFvWAAAAA3RSTlMHCAw+VhR4AAAA+klEQVQoz4WSMW7EQAhFPxKWNh2FCx+HkaZI6RRb5DYbyVfIJXLKDCFoMbaTKSw/8ZnPAPjaH2xgZcUNUDADD7D9LtDBCLZ45fbkvo/30K8yeI64pPwl6znd/3n/Oe93P3ho9qeh72btTFzqkz0rsJle8Zr81OLEwZ1dv/713uWqvu2pl+k0fy7MWtj9r/tN5q/02z89qa/L4Dc2LvM93kezPfXlME/O86EbY/V9GB9ePX8G1/6W+/9h1dq/HGfTfzT3j/xNo7522Bfnqe5jO/fvhVthlfk434v3iO9zG/UOphyPeinPl1J8Gtaa7xPTa/Dk+RIs4deMvwGvcGsmsCvJ0AAAAABJRU5ErkJggg==);
|
|
71
|
-
|
|
72
|
-
code {
|
|
73
|
-
margin: 0;
|
|
74
|
-
font-family: var(--code-font-family);
|
|
75
|
-
font-size: var(--code-font-size);
|
|
76
|
-
line-height: var(--code-line-height);
|
|
77
|
-
padding: 0;
|
|
78
|
-
background-color: transparent !important;
|
|
79
|
-
border-radius: 0;
|
|
80
|
-
display: inline;
|
|
81
|
-
overflow: visible;
|
|
82
|
-
white-space: pre;
|
|
83
|
-
word-break: initial;
|
|
84
|
-
word-wrap: normal;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// 编辑状态下的语言标签
|
|
88
|
-
&::before {
|
|
89
|
-
content: attr(data-language);
|
|
90
|
-
position: absolute;
|
|
91
|
-
top: 0;
|
|
92
|
-
right: 0;
|
|
93
|
-
padding: 2px 8px;
|
|
94
|
-
font-size: 12px;
|
|
95
|
-
color: var(--second-color);
|
|
96
|
-
background-color: var(--panel-background-color);
|
|
97
|
-
border-radius: 0 4px 0 4px;
|
|
98
|
-
z-index: 1;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// 编辑状态下也有 hover 效果,保持一致
|
|
102
|
-
&:hover {
|
|
103
|
-
box-shadow: 0 0 0 2px var(--blurColor);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// 编辑状态下去掉 outline,保持美观
|
|
107
|
-
&:focus {
|
|
108
|
-
outline: none;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
pre:last-child {
|
|
113
|
-
margin-bottom: 1em;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// 当处于编辑状态时显示编辑区域,隐藏预览区域
|
|
117
|
-
&--editing {
|
|
118
|
-
pre:first-child {
|
|
119
|
-
display: block;
|
|
120
|
-
margin: 0;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.vditor-wysiwyg__preview {
|
|
124
|
-
display: none;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
&__preview {
|
|
130
|
-
cursor: pointer;
|
|
131
|
-
white-space: initial;
|
|
132
|
-
min-height: 27px;
|
|
133
|
-
display: block; // 默认显示预览区域
|
|
134
|
-
|
|
135
|
-
// 代码块预览样式优化
|
|
136
|
-
pre {
|
|
137
|
-
margin: 0;
|
|
138
|
-
padding: 1em;
|
|
139
|
-
background-color: var(--code-background-color);
|
|
140
|
-
border-radius: 4px;
|
|
141
|
-
overflow-x: auto;
|
|
142
|
-
|
|
143
|
-
code {
|
|
144
|
-
font-family: var(--code-font-family);
|
|
145
|
-
font-size: var(--code-font-size);
|
|
146
|
-
line-height: var(--code-line-height);
|
|
147
|
-
background-color: transparent !important;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// 语言标签
|
|
152
|
-
&::before {
|
|
153
|
-
content: attr(data-language);
|
|
154
|
-
position: absolute;
|
|
155
|
-
top: 0;
|
|
156
|
-
right: 0;
|
|
157
|
-
padding: 2px 8px;
|
|
158
|
-
font-size: 12px;
|
|
159
|
-
color: var(--second-color);
|
|
160
|
-
background-color: var(--panel-background-color);
|
|
161
|
-
border-radius: 0 4px 0 4px;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
&:hover {
|
|
165
|
-
box-shadow: 0 0 0 2px var(--blurColor);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
& > .vditor-reset > h1:before,
|
|
170
|
-
& > .vditor-reset > h2:before,
|
|
171
|
-
& > .vditor-reset > h3:before,
|
|
172
|
-
& > .vditor-reset > h4:before,
|
|
173
|
-
& > .vditor-reset > h5:before,
|
|
174
|
-
& > .vditor-reset > h6:before,
|
|
175
|
-
div.vditor-wysiwyg__block:before,
|
|
176
|
-
div[data-type="link-ref-defs-block"]:before,
|
|
177
|
-
div[data-type="footnotes-block"]:before,
|
|
178
|
-
.vditor-toc:before {
|
|
179
|
-
float: left;
|
|
180
|
-
padding-right: 4px;
|
|
181
|
-
margin-left: -29px;
|
|
182
|
-
content: 'H1';
|
|
183
|
-
font-size: 0.85rem;
|
|
184
|
-
font-weight: normal;
|
|
185
|
-
color: var(--second-color);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
& > .vditor-reset > h2:before {
|
|
189
|
-
content: 'H2';
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
& > .vditor-reset > h3:before {
|
|
193
|
-
content: 'H3';
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
& > .vditor-reset > h4:before {
|
|
197
|
-
content: 'H4';
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
& > .vditor-reset > h5:before {
|
|
201
|
-
content: 'H5';
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
& > .vditor-reset > h6:before {
|
|
205
|
-
content: 'H6';
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
div[data-type="link-ref-defs-block"]:before {
|
|
209
|
-
content: '"A"';
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
div[data-type="footnotes-block"]:before {
|
|
213
|
-
content: '^F';
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
div.vditor-wysiwyg__block:before {
|
|
217
|
-
content: "</>";
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
div.vditor-wysiwyg__block[data-type="yaml-front-matter"]:before {
|
|
221
|
-
content: "F";
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
div.vditor-wysiwyg__block[data-type="math-block"]:before {
|
|
225
|
-
content: "$$";
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
.vditor-toc:before {
|
|
229
|
-
content: "ToC";
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
hr {
|
|
233
|
-
display: inline-block;
|
|
234
|
-
margin: 12px 0;
|
|
235
|
-
width: 100%;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
details {
|
|
239
|
-
white-space: initial;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
a {
|
|
243
|
-
cursor: pointer;
|
|
244
|
-
color: @blurColor;
|
|
245
|
-
text-decoration: none;
|
|
246
|
-
background-color: rgba(66, 133, 244, 0.1);
|
|
247
|
-
padding: 2px 4px;
|
|
248
|
-
border-radius: 3px;
|
|
249
|
-
transition: background-color 0.2s ease;
|
|
250
|
-
|
|
251
|
-
&:hover {
|
|
252
|
-
background-color: rgba(66, 133, 244, 0.2);
|
|
253
|
-
text-decoration: underline;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
&:visited {
|
|
257
|
-
color: darken(@blurColor, 10%);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
img {
|
|
262
|
-
cursor: pointer;
|
|
263
|
-
border: 2px solid transparent;
|
|
264
|
-
border-radius: 4px;
|
|
265
|
-
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
|
266
|
-
|
|
267
|
-
&:hover {
|
|
268
|
-
border-color: @blurColor;
|
|
269
|
-
box-shadow: 0 0 8px rgba(66, 133, 244, 0.3);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
span[data-type="backslash"] > span {
|
|
274
|
-
display: none;
|
|
275
|
-
color: var(--second-color);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
span[data-type="link-ref"],
|
|
279
|
-
sup[data-type="footnotes-ref"] {
|
|
280
|
-
color: @blurColor;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
span[data-type="toc-h"] {
|
|
284
|
-
color: @blurColor;
|
|
285
|
-
text-decoration: underline;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
div[data-type="footnotes-block"] {
|
|
289
|
-
border-top: 2px solid var(--heading-border-color);
|
|
290
|
-
padding-top: 24px;
|
|
291
|
-
margin-top: 24px;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
div[data-type="link-ref-defs-block"] {
|
|
295
|
-
color: var(--blockquote-color);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
@media screen and (max-width: @max-width) {
|
|
300
|
-
.vditor-wysiwyg {
|
|
301
|
-
h1:before,
|
|
302
|
-
h2:before,
|
|
303
|
-
h3:before,
|
|
304
|
-
h4:before,
|
|
305
|
-
h5:before,
|
|
306
|
-
h6:before,
|
|
307
|
-
div.vditor-wysiwyg__block:before,
|
|
308
|
-
div[data-type="link-ref-defs-block"]:before,
|
|
309
|
-
div[data-type="footnotes-block"]:before,
|
|
310
|
-
.vditor-toc:before {
|
|
311
|
-
content: none;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
1
|
+
.vditor-wysiwyg {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
flex: 1;
|
|
4
|
+
position: relative;
|
|
5
|
+
width: 100%;
|
|
6
|
+
min-width: 1px;
|
|
7
|
+
|
|
8
|
+
pre.vditor-reset {
|
|
9
|
+
background-color: var(--panel-background-color);
|
|
10
|
+
margin: 0;
|
|
11
|
+
white-space: pre-wrap;
|
|
12
|
+
height: 100%;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
|
|
15
|
+
&[contenteditable="false"] {
|
|
16
|
+
opacity: 0.3;
|
|
17
|
+
cursor: not-allowed;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&:empty::before {
|
|
21
|
+
content: attr(placeholder);
|
|
22
|
+
color: var(--second-color);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:focus {
|
|
26
|
+
outline: none;
|
|
27
|
+
background-color: var(--textarea-background-color);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:after {
|
|
31
|
+
content: "";
|
|
32
|
+
height: var(--editor-bottom);
|
|
33
|
+
display: block;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
blockquote:empty::before,
|
|
38
|
+
pre > code:empty::before,
|
|
39
|
+
p:empty::before,
|
|
40
|
+
h1:empty::after,
|
|
41
|
+
h2:empty::after,
|
|
42
|
+
h3:empty::after,
|
|
43
|
+
h4:empty::after,
|
|
44
|
+
h5:empty::after,
|
|
45
|
+
h6:empty::after {
|
|
46
|
+
content: ' ';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
code[data-marker="`"] {
|
|
50
|
+
padding-left: 0 !important;
|
|
51
|
+
padding-right: 0 !important;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&__block {
|
|
55
|
+
position: relative;
|
|
56
|
+
|
|
57
|
+
// 编辑区域 - 默认隐藏,但保持预览区域的样式
|
|
58
|
+
pre:first-child {
|
|
59
|
+
display: none; // 默认隐藏编辑区域
|
|
60
|
+
position: relative;
|
|
61
|
+
margin: 0;
|
|
62
|
+
padding: 1em;
|
|
63
|
+
background-color: rgba(0, 0, 0, 0.03);
|
|
64
|
+
border-radius: 4px;
|
|
65
|
+
overflow-x: auto;
|
|
66
|
+
cursor: text;
|
|
67
|
+
white-space: initial;
|
|
68
|
+
min-height: 27px;
|
|
69
|
+
background-size: 20px 20px;
|
|
70
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8AgMAAABHkjHhAAAACVBMVEWAgIBaWlo+Pj7rTFvWAAAAA3RSTlMHCAw+VhR4AAAA+klEQVQoz4WSMW7EQAhFPxKWNh2FCx+HkaZI6RRb5DYbyVfIJXLKDCFoMbaTKSw/8ZnPAPjaH2xgZcUNUDADD7D9LtDBCLZ45fbkvo/30K8yeI64pPwl6znd/3n/Oe93P3ho9qeh72btTFzqkz0rsJle8Zr81OLEwZ1dv/713uWqvu2pl+k0fy7MWtj9r/tN5q/02z89qa/L4Dc2LvM93kezPfXlME/O86EbY/V9GB9ePX8G1/6W+/9h1dq/HGfTfzT3j/xNo7522Bfnqe5jO/fvhVthlfk434v3iO9zG/UOphyPeinPl1J8Gtaa7xPTa/Dk+RIs4deMvwGvcGsmsCvJ0AAAAABJRU5ErkJggg==);
|
|
71
|
+
|
|
72
|
+
code {
|
|
73
|
+
margin: 0;
|
|
74
|
+
font-family: var(--code-font-family);
|
|
75
|
+
font-size: var(--code-font-size);
|
|
76
|
+
line-height: var(--code-line-height);
|
|
77
|
+
padding: 0;
|
|
78
|
+
background-color: transparent !important;
|
|
79
|
+
border-radius: 0;
|
|
80
|
+
display: inline;
|
|
81
|
+
overflow: visible;
|
|
82
|
+
white-space: pre;
|
|
83
|
+
word-break: initial;
|
|
84
|
+
word-wrap: normal;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// 编辑状态下的语言标签
|
|
88
|
+
&::before {
|
|
89
|
+
content: attr(data-language);
|
|
90
|
+
position: absolute;
|
|
91
|
+
top: 0;
|
|
92
|
+
right: 0;
|
|
93
|
+
padding: 2px 8px;
|
|
94
|
+
font-size: 12px;
|
|
95
|
+
color: var(--second-color);
|
|
96
|
+
background-color: var(--panel-background-color);
|
|
97
|
+
border-radius: 0 4px 0 4px;
|
|
98
|
+
z-index: 1;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// 编辑状态下也有 hover 效果,保持一致
|
|
102
|
+
&:hover {
|
|
103
|
+
box-shadow: 0 0 0 2px var(--blurColor);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// 编辑状态下去掉 outline,保持美观
|
|
107
|
+
&:focus {
|
|
108
|
+
outline: none;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
pre:last-child {
|
|
113
|
+
margin-bottom: 1em;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 当处于编辑状态时显示编辑区域,隐藏预览区域
|
|
117
|
+
&--editing {
|
|
118
|
+
pre:first-child {
|
|
119
|
+
display: block;
|
|
120
|
+
margin: 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.vditor-wysiwyg__preview {
|
|
124
|
+
display: none;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&__preview {
|
|
130
|
+
cursor: pointer;
|
|
131
|
+
white-space: initial;
|
|
132
|
+
min-height: 27px;
|
|
133
|
+
display: block; // 默认显示预览区域
|
|
134
|
+
|
|
135
|
+
// 代码块预览样式优化
|
|
136
|
+
pre {
|
|
137
|
+
margin: 0;
|
|
138
|
+
padding: 1em;
|
|
139
|
+
background-color: var(--code-background-color);
|
|
140
|
+
border-radius: 4px;
|
|
141
|
+
overflow-x: auto;
|
|
142
|
+
|
|
143
|
+
code {
|
|
144
|
+
font-family: var(--code-font-family);
|
|
145
|
+
font-size: var(--code-font-size);
|
|
146
|
+
line-height: var(--code-line-height);
|
|
147
|
+
background-color: transparent !important;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// 语言标签
|
|
152
|
+
&::before {
|
|
153
|
+
content: attr(data-language);
|
|
154
|
+
position: absolute;
|
|
155
|
+
top: 0;
|
|
156
|
+
right: 0;
|
|
157
|
+
padding: 2px 8px;
|
|
158
|
+
font-size: 12px;
|
|
159
|
+
color: var(--second-color);
|
|
160
|
+
background-color: var(--panel-background-color);
|
|
161
|
+
border-radius: 0 4px 0 4px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&:hover {
|
|
165
|
+
box-shadow: 0 0 0 2px var(--blurColor);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
& > .vditor-reset > h1:before,
|
|
170
|
+
& > .vditor-reset > h2:before,
|
|
171
|
+
& > .vditor-reset > h3:before,
|
|
172
|
+
& > .vditor-reset > h4:before,
|
|
173
|
+
& > .vditor-reset > h5:before,
|
|
174
|
+
& > .vditor-reset > h6:before,
|
|
175
|
+
div.vditor-wysiwyg__block:before,
|
|
176
|
+
div[data-type="link-ref-defs-block"]:before,
|
|
177
|
+
div[data-type="footnotes-block"]:before,
|
|
178
|
+
.vditor-toc:before {
|
|
179
|
+
float: left;
|
|
180
|
+
padding-right: 4px;
|
|
181
|
+
margin-left: -29px;
|
|
182
|
+
content: 'H1';
|
|
183
|
+
font-size: 0.85rem;
|
|
184
|
+
font-weight: normal;
|
|
185
|
+
color: var(--second-color);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
& > .vditor-reset > h2:before {
|
|
189
|
+
content: 'H2';
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
& > .vditor-reset > h3:before {
|
|
193
|
+
content: 'H3';
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
& > .vditor-reset > h4:before {
|
|
197
|
+
content: 'H4';
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
& > .vditor-reset > h5:before {
|
|
201
|
+
content: 'H5';
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
& > .vditor-reset > h6:before {
|
|
205
|
+
content: 'H6';
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
div[data-type="link-ref-defs-block"]:before {
|
|
209
|
+
content: '"A"';
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
div[data-type="footnotes-block"]:before {
|
|
213
|
+
content: '^F';
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
div.vditor-wysiwyg__block:before {
|
|
217
|
+
content: "</>";
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
div.vditor-wysiwyg__block[data-type="yaml-front-matter"]:before {
|
|
221
|
+
content: "F";
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
div.vditor-wysiwyg__block[data-type="math-block"]:before {
|
|
225
|
+
content: "$$";
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.vditor-toc:before {
|
|
229
|
+
content: "ToC";
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
hr {
|
|
233
|
+
display: inline-block;
|
|
234
|
+
margin: 12px 0;
|
|
235
|
+
width: 100%;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
details {
|
|
239
|
+
white-space: initial;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
a {
|
|
243
|
+
cursor: pointer;
|
|
244
|
+
color: @blurColor;
|
|
245
|
+
text-decoration: none;
|
|
246
|
+
background-color: rgba(66, 133, 244, 0.1);
|
|
247
|
+
padding: 2px 4px;
|
|
248
|
+
border-radius: 3px;
|
|
249
|
+
transition: background-color 0.2s ease;
|
|
250
|
+
|
|
251
|
+
&:hover {
|
|
252
|
+
background-color: rgba(66, 133, 244, 0.2);
|
|
253
|
+
text-decoration: underline;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
&:visited {
|
|
257
|
+
color: darken(@blurColor, 10%);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
img {
|
|
262
|
+
cursor: pointer;
|
|
263
|
+
border: 2px solid transparent;
|
|
264
|
+
border-radius: 4px;
|
|
265
|
+
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
|
266
|
+
|
|
267
|
+
&:hover {
|
|
268
|
+
border-color: @blurColor;
|
|
269
|
+
box-shadow: 0 0 8px rgba(66, 133, 244, 0.3);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
span[data-type="backslash"] > span {
|
|
274
|
+
display: none;
|
|
275
|
+
color: var(--second-color);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
span[data-type="link-ref"],
|
|
279
|
+
sup[data-type="footnotes-ref"] {
|
|
280
|
+
color: @blurColor;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
span[data-type="toc-h"] {
|
|
284
|
+
color: @blurColor;
|
|
285
|
+
text-decoration: underline;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
div[data-type="footnotes-block"] {
|
|
289
|
+
border-top: 2px solid var(--heading-border-color);
|
|
290
|
+
padding-top: 24px;
|
|
291
|
+
margin-top: 24px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
div[data-type="link-ref-defs-block"] {
|
|
295
|
+
color: var(--blockquote-color);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
@media screen and (max-width: @max-width) {
|
|
300
|
+
.vditor-wysiwyg {
|
|
301
|
+
h1:before,
|
|
302
|
+
h2:before,
|
|
303
|
+
h3:before,
|
|
304
|
+
h4:before,
|
|
305
|
+
h5:before,
|
|
306
|
+
h6:before,
|
|
307
|
+
div.vditor-wysiwyg__block:before,
|
|
308
|
+
div[data-type="link-ref-defs-block"]:before,
|
|
309
|
+
div[data-type="footnotes-block"]:before,
|
|
310
|
+
.vditor-toc:before {
|
|
311
|
+
content: none;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -37,6 +37,7 @@ import {input} from "./ts/wysiwyg/input";
|
|
|
37
37
|
import {renderDomByMd} from "./ts/wysiwyg/renderDomByMd";
|
|
38
38
|
import {execAfterRender, insertEmptyBlock} from "./ts/util/fixBrowserBehavior";
|
|
39
39
|
import {accessLocalStorage} from "./ts/util/compatibility";
|
|
40
|
+
import {initImageResize} from "./ts/util/imageResize";
|
|
40
41
|
|
|
41
42
|
class Vditor extends VditorMethod {
|
|
42
43
|
public readonly version: string;
|
|
@@ -552,6 +553,8 @@ class Vditor extends VditorMethod {
|
|
|
552
553
|
|
|
553
554
|
initUI(this.vditor);
|
|
554
555
|
|
|
556
|
+
initImageResize(this.vditor);
|
|
557
|
+
|
|
555
558
|
if (mergedOptions.after) {
|
|
556
559
|
mergedOptions.after();
|
|
557
560
|
}
|