@mdaemon/html-editor 1.0.9 → 1.0.11
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 +5 -0
- package/dist/index.js +15 -0
- package/dist/index.mjs +15 -0
- package/dist/styles.css +87 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -499,6 +499,11 @@ export declare class Toolbar {
|
|
|
499
499
|
private createFontSizeDropdown;
|
|
500
500
|
private createLineHeightDropdown;
|
|
501
501
|
private createTemplateDropdown;
|
|
502
|
+
/**
|
|
503
|
+
* Position a fixed-position menu below its trigger button.
|
|
504
|
+
* Uses getBoundingClientRect so the menu escapes any overflow:hidden ancestor.
|
|
505
|
+
*/
|
|
506
|
+
private positionMenu;
|
|
502
507
|
private createDropdown;
|
|
503
508
|
private createColorPicker;
|
|
504
509
|
private bindEvents;
|
package/dist/index.js
CHANGED
|
@@ -43141,6 +43141,15 @@ class Toolbar {
|
|
|
43141
43141
|
}
|
|
43142
43142
|
});
|
|
43143
43143
|
}
|
|
43144
|
+
/**
|
|
43145
|
+
* Position a fixed-position menu below its trigger button.
|
|
43146
|
+
* Uses getBoundingClientRect so the menu escapes any overflow:hidden ancestor.
|
|
43147
|
+
*/
|
|
43148
|
+
positionMenu(button, menu) {
|
|
43149
|
+
const rect = button.getBoundingClientRect();
|
|
43150
|
+
menu.style.top = `${rect.bottom}px`;
|
|
43151
|
+
menu.style.left = `${rect.left}px`;
|
|
43152
|
+
}
|
|
43144
43153
|
createDropdown(name, label, options, onSelect, getCurrentValue) {
|
|
43145
43154
|
const wrapper = document.createElement("div");
|
|
43146
43155
|
wrapper.className = "md-toolbar-dropdown";
|
|
@@ -43191,6 +43200,9 @@ class Toolbar {
|
|
|
43191
43200
|
const isOpen = menu.style.display !== "none";
|
|
43192
43201
|
menu.style.display = isOpen ? "none" : "block";
|
|
43193
43202
|
wrapper.classList.toggle("md-toolbar-dropdown-open", !isOpen);
|
|
43203
|
+
if (!isOpen) {
|
|
43204
|
+
this.positionMenu(button, menu);
|
|
43205
|
+
}
|
|
43194
43206
|
if (!isOpen && getCurrentValue) {
|
|
43195
43207
|
const currentVal = getCurrentValue();
|
|
43196
43208
|
menu.querySelectorAll(".md-toolbar-dropdown-item").forEach((item) => {
|
|
@@ -43269,6 +43281,9 @@ class Toolbar {
|
|
|
43269
43281
|
const isOpen = menu.style.display !== "none";
|
|
43270
43282
|
menu.style.display = isOpen ? "none" : "block";
|
|
43271
43283
|
wrapper.classList.toggle("md-toolbar-colorpicker-open", !isOpen);
|
|
43284
|
+
if (!isOpen) {
|
|
43285
|
+
this.positionMenu(button, menu);
|
|
43286
|
+
}
|
|
43272
43287
|
});
|
|
43273
43288
|
wrapper.appendChild(button);
|
|
43274
43289
|
wrapper.appendChild(menu);
|
package/dist/index.mjs
CHANGED
|
@@ -43139,6 +43139,15 @@ class Toolbar {
|
|
|
43139
43139
|
}
|
|
43140
43140
|
});
|
|
43141
43141
|
}
|
|
43142
|
+
/**
|
|
43143
|
+
* Position a fixed-position menu below its trigger button.
|
|
43144
|
+
* Uses getBoundingClientRect so the menu escapes any overflow:hidden ancestor.
|
|
43145
|
+
*/
|
|
43146
|
+
positionMenu(button, menu) {
|
|
43147
|
+
const rect = button.getBoundingClientRect();
|
|
43148
|
+
menu.style.top = `${rect.bottom}px`;
|
|
43149
|
+
menu.style.left = `${rect.left}px`;
|
|
43150
|
+
}
|
|
43142
43151
|
createDropdown(name, label, options, onSelect, getCurrentValue) {
|
|
43143
43152
|
const wrapper = document.createElement("div");
|
|
43144
43153
|
wrapper.className = "md-toolbar-dropdown";
|
|
@@ -43189,6 +43198,9 @@ class Toolbar {
|
|
|
43189
43198
|
const isOpen = menu.style.display !== "none";
|
|
43190
43199
|
menu.style.display = isOpen ? "none" : "block";
|
|
43191
43200
|
wrapper.classList.toggle("md-toolbar-dropdown-open", !isOpen);
|
|
43201
|
+
if (!isOpen) {
|
|
43202
|
+
this.positionMenu(button, menu);
|
|
43203
|
+
}
|
|
43192
43204
|
if (!isOpen && getCurrentValue) {
|
|
43193
43205
|
const currentVal = getCurrentValue();
|
|
43194
43206
|
menu.querySelectorAll(".md-toolbar-dropdown-item").forEach((item) => {
|
|
@@ -43267,6 +43279,9 @@ class Toolbar {
|
|
|
43267
43279
|
const isOpen = menu.style.display !== "none";
|
|
43268
43280
|
menu.style.display = isOpen ? "none" : "block";
|
|
43269
43281
|
wrapper.classList.toggle("md-toolbar-colorpicker-open", !isOpen);
|
|
43282
|
+
if (!isOpen) {
|
|
43283
|
+
this.positionMenu(button, menu);
|
|
43284
|
+
}
|
|
43270
43285
|
});
|
|
43271
43286
|
wrapper.appendChild(button);
|
|
43272
43287
|
wrapper.appendChild(menu);
|
package/dist/styles.css
CHANGED
|
@@ -13,6 +13,25 @@
|
|
|
13
13
|
position: relative;
|
|
14
14
|
overflow: hidden;
|
|
15
15
|
}
|
|
16
|
+
.md-editor *,
|
|
17
|
+
.md-editor *::before,
|
|
18
|
+
.md-editor *::after {
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
.md-editor button {
|
|
22
|
+
appearance: none;
|
|
23
|
+
font: inherit;
|
|
24
|
+
color: inherit;
|
|
25
|
+
background: transparent;
|
|
26
|
+
border: none;
|
|
27
|
+
padding: 0;
|
|
28
|
+
margin: 0;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
}
|
|
31
|
+
.md-editor input, .md-editor select, .md-editor textarea {
|
|
32
|
+
font: inherit;
|
|
33
|
+
color: inherit;
|
|
34
|
+
}
|
|
16
35
|
.md-editor.md-editor-fullscreen {
|
|
17
36
|
position: fixed;
|
|
18
37
|
top: 0;
|
|
@@ -161,9 +180,7 @@
|
|
|
161
180
|
}
|
|
162
181
|
|
|
163
182
|
.md-toolbar-dropdown-menu {
|
|
164
|
-
position:
|
|
165
|
-
top: 100%;
|
|
166
|
-
left: 0;
|
|
183
|
+
position: fixed;
|
|
167
184
|
min-width: 150px;
|
|
168
185
|
max-height: 300px;
|
|
169
186
|
overflow-y: auto;
|
|
@@ -174,8 +191,10 @@
|
|
|
174
191
|
z-index: 1000;
|
|
175
192
|
}
|
|
176
193
|
|
|
177
|
-
.md-toolbar-dropdown-item {
|
|
194
|
+
.md-editor .md-toolbar-dropdown-item {
|
|
178
195
|
display: block;
|
|
196
|
+
margin-top: 2px;
|
|
197
|
+
margin-bottom: 2px;
|
|
179
198
|
width: 100%;
|
|
180
199
|
padding: 8px 12px;
|
|
181
200
|
border: none;
|
|
@@ -185,10 +204,10 @@
|
|
|
185
204
|
font-size: 13px;
|
|
186
205
|
color: #222;
|
|
187
206
|
}
|
|
188
|
-
.md-toolbar-dropdown-item:hover {
|
|
207
|
+
.md-editor .md-toolbar-dropdown-item:hover {
|
|
189
208
|
background: #f0f0f0;
|
|
190
209
|
}
|
|
191
|
-
.md-toolbar-dropdown-item.md-toolbar-dropdown-item-selected {
|
|
210
|
+
.md-editor .md-toolbar-dropdown-item.md-toolbar-dropdown-item-selected {
|
|
192
211
|
background: #2271b2;
|
|
193
212
|
color: #fff;
|
|
194
213
|
}
|
|
@@ -226,15 +245,14 @@
|
|
|
226
245
|
}
|
|
227
246
|
|
|
228
247
|
.md-toolbar-colorpicker-menu {
|
|
229
|
-
position:
|
|
230
|
-
top: 100%;
|
|
231
|
-
left: 0;
|
|
248
|
+
position: fixed;
|
|
232
249
|
padding: 8px;
|
|
233
250
|
background: #fff;
|
|
234
251
|
border: 1px solid #ccc;
|
|
235
252
|
border-radius: 3px;
|
|
236
253
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
237
|
-
z-index:
|
|
254
|
+
z-index: 1000;
|
|
255
|
+
padding: 6px;
|
|
238
256
|
}
|
|
239
257
|
|
|
240
258
|
.md-toolbar-colorpicker-grid {
|
|
@@ -306,16 +324,74 @@
|
|
|
306
324
|
margin: 0 0 0.5em;
|
|
307
325
|
font-weight: bold;
|
|
308
326
|
}
|
|
327
|
+
.md-editor-body h1 {
|
|
328
|
+
font-size: 2em;
|
|
329
|
+
}
|
|
330
|
+
.md-editor-body h2 {
|
|
331
|
+
font-size: 1.5em;
|
|
332
|
+
}
|
|
333
|
+
.md-editor-body h3 {
|
|
334
|
+
font-size: 1.17em;
|
|
335
|
+
}
|
|
336
|
+
.md-editor-body h4 {
|
|
337
|
+
font-size: 1em;
|
|
338
|
+
}
|
|
339
|
+
.md-editor-body h5 {
|
|
340
|
+
font-size: 0.83em;
|
|
341
|
+
}
|
|
342
|
+
.md-editor-body h6 {
|
|
343
|
+
font-size: 0.67em;
|
|
344
|
+
}
|
|
309
345
|
.md-editor-body ul, .md-editor-body ol {
|
|
310
346
|
margin: 0 0 1em;
|
|
311
347
|
padding-left: 2em;
|
|
312
348
|
}
|
|
349
|
+
.md-editor-body ul {
|
|
350
|
+
list-style-type: disc;
|
|
351
|
+
}
|
|
352
|
+
.md-editor-body ol {
|
|
353
|
+
list-style-type: decimal;
|
|
354
|
+
}
|
|
355
|
+
.md-editor-body ul ul {
|
|
356
|
+
list-style-type: circle;
|
|
357
|
+
}
|
|
358
|
+
.md-editor-body ul ul ul {
|
|
359
|
+
list-style-type: square;
|
|
360
|
+
}
|
|
361
|
+
.md-editor-body ol ol {
|
|
362
|
+
list-style-type: lower-alpha;
|
|
363
|
+
}
|
|
364
|
+
.md-editor-body ol ol ol {
|
|
365
|
+
list-style-type: lower-roman;
|
|
366
|
+
}
|
|
313
367
|
.md-editor-body blockquote {
|
|
314
368
|
margin: 0 0 1em;
|
|
315
369
|
padding-left: 1em;
|
|
316
370
|
border-left: 3px solid #ccc;
|
|
317
371
|
color: #666;
|
|
318
372
|
}
|
|
373
|
+
.md-editor-body hr {
|
|
374
|
+
border: none;
|
|
375
|
+
border-top: 1px solid #ccc;
|
|
376
|
+
margin: 1em 0;
|
|
377
|
+
}
|
|
378
|
+
.md-editor-body b, .md-editor-body strong {
|
|
379
|
+
font-weight: bold;
|
|
380
|
+
}
|
|
381
|
+
.md-editor-body i, .md-editor-body em {
|
|
382
|
+
font-style: italic;
|
|
383
|
+
}
|
|
384
|
+
.md-editor-body small {
|
|
385
|
+
font-size: 80%;
|
|
386
|
+
}
|
|
387
|
+
.md-editor-body sub {
|
|
388
|
+
vertical-align: sub;
|
|
389
|
+
font-size: smaller;
|
|
390
|
+
}
|
|
391
|
+
.md-editor-body sup {
|
|
392
|
+
vertical-align: super;
|
|
393
|
+
font-size: smaller;
|
|
394
|
+
}
|
|
319
395
|
.md-editor-body pre {
|
|
320
396
|
background: #f5f5f5;
|
|
321
397
|
padding: 12px;
|
|
@@ -338,6 +414,7 @@
|
|
|
338
414
|
.md-editor-body img {
|
|
339
415
|
max-width: 100%;
|
|
340
416
|
height: auto;
|
|
417
|
+
display: inline-block;
|
|
341
418
|
}
|
|
342
419
|
.md-editor-body table {
|
|
343
420
|
border-collapse: collapse;
|