fable-editor 1.0.2 → 1.2.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/README.md +55 -6
- package/dist/angular/README.md +55 -6
- package/dist/angular/angular/fable-editor.component.d.ts +4 -1
- package/dist/angular/core/config.d.ts +15 -0
- package/dist/angular/core/editor.d.ts +107 -0
- package/dist/angular/core/i18n.d.ts +49 -0
- package/dist/angular/core/types.d.ts +21 -0
- package/dist/angular/esm2022/angular/fable-editor.component.mjs +14 -2
- package/dist/angular/esm2022/core/config.mjs +215 -24
- package/dist/angular/esm2022/core/editor.mjs +1255 -74
- package/dist/angular/esm2022/core/i18n.mjs +101 -3
- package/dist/angular/esm2022/core/icons.mjs +12 -2
- package/dist/angular/esm2022/core/types.mjs +1 -1
- package/dist/angular/fesm2022/fable-editor.mjs +1591 -99
- package/dist/angular/fesm2022/fable-editor.mjs.map +1 -1
- package/dist/core/config.d.ts +15 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/editor.css +452 -57
- package/dist/core/editor.d.ts +107 -0
- package/dist/core/editor.d.ts.map +1 -1
- package/dist/core/i18n.d.ts +49 -0
- package/dist/core/i18n.d.ts.map +1 -1
- package/dist/core/icons.d.ts.map +1 -1
- package/dist/core/index.cjs +4 -4
- package/dist/core/index.mjs +2580 -703
- package/dist/core/types.d.ts +21 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/react/FableEditor.d.ts.map +1 -1
- package/dist/react/index.cjs +13 -13
- package/dist/react/index.mjs +2982 -1136
- package/package.json +1 -1
- package/style.css +452 -57
package/dist/core/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const K = {
|
|
2
2
|
en: {
|
|
3
3
|
dir: "ltr",
|
|
4
4
|
file: "File",
|
|
@@ -38,9 +38,14 @@ const j = {
|
|
|
38
38
|
rowabove: "Insert row before",
|
|
39
39
|
rowbelow: "Insert row after",
|
|
40
40
|
delrow: "Delete row",
|
|
41
|
+
moverowup: "Move row up",
|
|
42
|
+
moverowdown: "Move row down",
|
|
41
43
|
colbefore: "Insert column before",
|
|
42
44
|
colafter: "Insert column after",
|
|
43
45
|
delcol: "Delete column",
|
|
46
|
+
movecolleft: "Move column left",
|
|
47
|
+
movecolright: "Move column right",
|
|
48
|
+
cellbg: "Cell background",
|
|
44
49
|
deltable: "Delete table",
|
|
45
50
|
ltr: "Left to right",
|
|
46
51
|
rtl: "Right to left",
|
|
@@ -87,6 +92,9 @@ const j = {
|
|
|
87
92
|
tblcellpadding: "Cell padding",
|
|
88
93
|
tblborder: "Border width",
|
|
89
94
|
tblalign: "Alignment",
|
|
95
|
+
tblalignleft: "Align table left",
|
|
96
|
+
tblaligncenter: "Center table",
|
|
97
|
+
tblalignright: "Align table right",
|
|
90
98
|
alignnone: "None",
|
|
91
99
|
quote: "Blockquote",
|
|
92
100
|
link: "Link…",
|
|
@@ -95,6 +103,7 @@ const j = {
|
|
|
95
103
|
unlink: "Remove link",
|
|
96
104
|
lineheight: "Line height",
|
|
97
105
|
wordspacing: "Word spacing",
|
|
106
|
+
letterspacing: "Letter spacing",
|
|
98
107
|
changecase: "Change case",
|
|
99
108
|
lowercase: "Lowercase",
|
|
100
109
|
uppercase: "Uppercase",
|
|
@@ -139,7 +148,47 @@ const j = {
|
|
|
139
148
|
tplimgright: "Image right, text left",
|
|
140
149
|
tplimgtop: "Image top, text below",
|
|
141
150
|
tplimgcenter: "Text top, image center",
|
|
142
|
-
deltemplate: "Delete template"
|
|
151
|
+
deltemplate: "Delete template",
|
|
152
|
+
video: "Video",
|
|
153
|
+
quickvideo: "Insert video",
|
|
154
|
+
deletevideo: "Delete video",
|
|
155
|
+
uploadvideo: "Upload from computer",
|
|
156
|
+
videolink: "Insert from URL",
|
|
157
|
+
videourlph: "Paste video URL…",
|
|
158
|
+
insertvideo: "Insert",
|
|
159
|
+
dropvideo: "Drop video here",
|
|
160
|
+
videodlgttl: "Insert/edit video",
|
|
161
|
+
vidgeneral: "General",
|
|
162
|
+
vidembed: "Embed",
|
|
163
|
+
vidadvanced: "Advanced",
|
|
164
|
+
vidsource: "Source",
|
|
165
|
+
vidembedhint: "Paste your embed code below:",
|
|
166
|
+
vidaltsource: "Alternative source URL",
|
|
167
|
+
vidposter: "Media poster (Image URL)",
|
|
168
|
+
emoji: "Emojis…",
|
|
169
|
+
code: "Inline code",
|
|
170
|
+
codesample: "Code sample…",
|
|
171
|
+
codedlgttl: "Insert/edit code sample",
|
|
172
|
+
codelang: "Language",
|
|
173
|
+
editcode: "Edit code sample",
|
|
174
|
+
deletecode: "Delete code sample",
|
|
175
|
+
copycode: "Copy code",
|
|
176
|
+
chcat_currency: "Currency",
|
|
177
|
+
chcat_text: "Text & punctuation",
|
|
178
|
+
chcat_math: "Mathematical",
|
|
179
|
+
chcat_arrows: "Arrows",
|
|
180
|
+
chcat_symbols: "Symbols",
|
|
181
|
+
chcat_latin: "Extended Latin",
|
|
182
|
+
chcat_arabic: "Arabic",
|
|
183
|
+
emcat_smileys: "Smileys & emotion",
|
|
184
|
+
emcat_people: "People & body",
|
|
185
|
+
emcat_animals: "Animals & nature",
|
|
186
|
+
emcat_food: "Food & drink",
|
|
187
|
+
emcat_travel: "Travel & places",
|
|
188
|
+
emcat_activities: "Activities",
|
|
189
|
+
emcat_objects: "Objects",
|
|
190
|
+
emcat_symbols: "Symbols",
|
|
191
|
+
emcat_flags: "Flags"
|
|
143
192
|
},
|
|
144
193
|
ar: {
|
|
145
194
|
dir: "rtl",
|
|
@@ -180,9 +229,14 @@ const j = {
|
|
|
180
229
|
rowabove: "إدراج صف قبل",
|
|
181
230
|
rowbelow: "إدراج صف بعد",
|
|
182
231
|
delrow: "حذف الصف",
|
|
232
|
+
moverowup: "نقل الصف لأعلى",
|
|
233
|
+
moverowdown: "نقل الصف لأسفل",
|
|
183
234
|
colbefore: "إدراج عمود قبل",
|
|
184
235
|
colafter: "إدراج عمود بعد",
|
|
185
236
|
delcol: "حذف العمود",
|
|
237
|
+
movecolleft: "نقل العمود لليسار",
|
|
238
|
+
movecolright: "نقل العمود لليمين",
|
|
239
|
+
cellbg: "خلفية الخلية",
|
|
186
240
|
deltable: "حذف الجدول",
|
|
187
241
|
ltr: "من اليسار إلى اليمين",
|
|
188
242
|
rtl: "من اليمين إلى اليسار",
|
|
@@ -229,6 +283,9 @@ const j = {
|
|
|
229
283
|
tblcellpadding: "حشو الخلايا",
|
|
230
284
|
tblborder: "عرض الحدود",
|
|
231
285
|
tblalign: "المحاذاة",
|
|
286
|
+
tblalignleft: "محاذاة الجدول لليسار",
|
|
287
|
+
tblaligncenter: "توسيط الجدول",
|
|
288
|
+
tblalignright: "محاذاة الجدول لليمين",
|
|
232
289
|
alignnone: "بدون",
|
|
233
290
|
quote: "اقتباس",
|
|
234
291
|
link: "رابط…",
|
|
@@ -237,6 +294,7 @@ const j = {
|
|
|
237
294
|
unlink: "إزالة الرابط",
|
|
238
295
|
lineheight: "تباعد الأسطر",
|
|
239
296
|
wordspacing: "تباعد الكلمات",
|
|
297
|
+
letterspacing: "تباعد الأحرف",
|
|
240
298
|
changecase: "تغيير حالة الأحرف",
|
|
241
299
|
lowercase: "أحرف صغيرة",
|
|
242
300
|
uppercase: "أحرف كبيرة",
|
|
@@ -281,13 +339,53 @@ const j = {
|
|
|
281
339
|
tplimgright: "صورة يمين، نص يسار",
|
|
282
340
|
tplimgtop: "صورة أعلى، نص أسفل",
|
|
283
341
|
tplimgcenter: "نص أعلى، صورة وسط",
|
|
284
|
-
deltemplate: "حذف القالب"
|
|
342
|
+
deltemplate: "حذف القالب",
|
|
343
|
+
video: "فيديو",
|
|
344
|
+
quickvideo: "إدراج فيديو",
|
|
345
|
+
deletevideo: "حذف الفيديو",
|
|
346
|
+
uploadvideo: "رفع من الجهاز",
|
|
347
|
+
videolink: "إدراج من رابط",
|
|
348
|
+
videourlph: "الصق رابط الفيديو…",
|
|
349
|
+
insertvideo: "إدراج",
|
|
350
|
+
dropvideo: "أسقط الفيديو هنا",
|
|
351
|
+
videodlgttl: "إدراج/تعديل فيديو",
|
|
352
|
+
vidgeneral: "عام",
|
|
353
|
+
vidembed: "تضمين",
|
|
354
|
+
vidadvanced: "متقدم",
|
|
355
|
+
vidsource: "المصدر",
|
|
356
|
+
vidembedhint: "الصق كود التضمين أدناه:",
|
|
357
|
+
vidaltsource: "رابط مصدر بديل",
|
|
358
|
+
vidposter: "صورة الغلاف (رابط الصورة)",
|
|
359
|
+
emoji: "رموز تعبيرية…",
|
|
360
|
+
code: "كود مضمّن",
|
|
361
|
+
codesample: "عينة كود…",
|
|
362
|
+
codedlgttl: "إدراج/تعديل عينة كود",
|
|
363
|
+
codelang: "اللغة",
|
|
364
|
+
editcode: "تعديل عينة الكود",
|
|
365
|
+
deletecode: "حذف عينة الكود",
|
|
366
|
+
copycode: "نسخ الكود",
|
|
367
|
+
chcat_currency: "عملات",
|
|
368
|
+
chcat_text: "نص وعلامات ترقيم",
|
|
369
|
+
chcat_math: "رموز رياضية",
|
|
370
|
+
chcat_arrows: "أسهم",
|
|
371
|
+
chcat_symbols: "رموز",
|
|
372
|
+
chcat_latin: "لاتينية موسعة",
|
|
373
|
+
chcat_arabic: "عربية",
|
|
374
|
+
emcat_smileys: "وجوه ومشاعر",
|
|
375
|
+
emcat_people: "أشخاص وإيماءات",
|
|
376
|
+
emcat_animals: "حيوانات وطبيعة",
|
|
377
|
+
emcat_food: "طعام وشراب",
|
|
378
|
+
emcat_travel: "سفر وأماكن",
|
|
379
|
+
emcat_activities: "أنشطة",
|
|
380
|
+
emcat_objects: "أشياء",
|
|
381
|
+
emcat_symbols: "رموز",
|
|
382
|
+
emcat_flags: "أعلام"
|
|
285
383
|
}
|
|
286
384
|
};
|
|
287
|
-
function
|
|
288
|
-
return
|
|
385
|
+
function R(p) {
|
|
386
|
+
return K[p];
|
|
289
387
|
}
|
|
290
|
-
const
|
|
388
|
+
const J = "undo redo | preview print | importword revhistory | fontfamily fontsize | fontsizeincrease fontsizedecrease | bold italic underline strikethrough | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent | link blockquote code changecase lineheight wordspacing letterspacing | removeformat | blocks | ltr rtl | quickimage quickvideo quicktable codesample template charmap emoji | fullscreen sourcecode", tt = "file edit view insert format tools table help", et = [
|
|
291
389
|
["Andale Mono", "andale mono,times"],
|
|
292
390
|
["Arial", "arial,helvetica,sans-serif"],
|
|
293
391
|
["Arial Black", "arial black,avant garde"],
|
|
@@ -307,7 +405,24 @@ const X = "undo redo | preview print | importword revhistory | fontfamily fontsi
|
|
|
307
405
|
["Verdana", "verdana,geneva"],
|
|
308
406
|
["Webdings", "webdings"],
|
|
309
407
|
["Wingdings", "wingdings,zapf dingbats"]
|
|
310
|
-
],
|
|
408
|
+
], it = ["8px", "9px", "10px", "11px", "12px", "14px", "16px", "18px", "20px", "24px", "28px", "32px", "36px", "48px", "72px", "96px"], st = 1, lt = 100, ot = ["1", "1.15", "1.4", "1.5", "1.75", "2", "2.5", "3"], nt = ["1px", "2px", "4px", "6px", "8px", "12px"], rt = ["0.5px", "1px", "1.5px", "2px", "3px", "4px"], _ = [
|
|
409
|
+
["plain", "Plain text"],
|
|
410
|
+
["html", "HTML/XML"],
|
|
411
|
+
["css", "CSS"],
|
|
412
|
+
["javascript", "JavaScript"],
|
|
413
|
+
["typescript", "TypeScript"],
|
|
414
|
+
["json", "JSON"],
|
|
415
|
+
["python", "Python"],
|
|
416
|
+
["java", "Java"],
|
|
417
|
+
["csharp", "C#"],
|
|
418
|
+
["cpp", "C/C++"],
|
|
419
|
+
["php", "PHP"],
|
|
420
|
+
["ruby", "Ruby"],
|
|
421
|
+
["go", "Go"],
|
|
422
|
+
["rust", "Rust"],
|
|
423
|
+
["sql", "SQL"],
|
|
424
|
+
["bash", "Bash/Shell"]
|
|
425
|
+
], V = [
|
|
311
426
|
["p", "para"],
|
|
312
427
|
["h1", "heading1"],
|
|
313
428
|
["h2", "heading2"],
|
|
@@ -316,30 +431,1098 @@ const X = "undo redo | preview print | importword revhistory | fontfamily fontsi
|
|
|
316
431
|
["h5", "heading5"],
|
|
317
432
|
["h6", "heading6"],
|
|
318
433
|
["pre", "pre"]
|
|
319
|
-
],
|
|
320
|
-
"#
|
|
321
|
-
"#
|
|
322
|
-
"#
|
|
323
|
-
"#
|
|
324
|
-
"#C2E0F4",
|
|
325
|
-
"#2DC26B",
|
|
326
|
-
"#F1C40F",
|
|
327
|
-
"#E03E2D",
|
|
328
|
-
"#B96AD9",
|
|
329
|
-
"#3598DB",
|
|
330
|
-
"#169179",
|
|
331
|
-
"#E67E23",
|
|
332
|
-
"#BA372A",
|
|
333
|
-
"#843FA1",
|
|
334
|
-
"#236FA1",
|
|
335
|
-
"#ECF0F1",
|
|
336
|
-
"#CED4D9",
|
|
337
|
-
"#95A5A6",
|
|
338
|
-
"#7E8C8D",
|
|
339
|
-
"#34495E",
|
|
434
|
+
], at = ["#F76707", "#4263EB", "#CC5DE8"], ct = [
|
|
435
|
+
"#FFFFFF",
|
|
436
|
+
"#F4F4F4",
|
|
437
|
+
"#E8EAED",
|
|
438
|
+
"#DADCE0",
|
|
340
439
|
"#000000",
|
|
341
|
-
"#
|
|
342
|
-
|
|
440
|
+
"#F28B82",
|
|
441
|
+
"#FBBC04",
|
|
442
|
+
"#FFF475",
|
|
443
|
+
"#CCFF90",
|
|
444
|
+
"#A7FFEB",
|
|
445
|
+
"#CBF0F8",
|
|
446
|
+
"#AECBFA",
|
|
447
|
+
"#D7AEFB",
|
|
448
|
+
"#FDCFE8",
|
|
449
|
+
"#E6C9A8",
|
|
450
|
+
"#EA4335",
|
|
451
|
+
"#FB8C00",
|
|
452
|
+
"#FDD835",
|
|
453
|
+
"#34A853",
|
|
454
|
+
"#00ACC1",
|
|
455
|
+
"#4285F4",
|
|
456
|
+
"#5E35B1",
|
|
457
|
+
"#8E24AA",
|
|
458
|
+
"#C2185B",
|
|
459
|
+
"#6D4C41"
|
|
460
|
+
], ht = [
|
|
461
|
+
{
|
|
462
|
+
key: "chcat_currency",
|
|
463
|
+
chars: [
|
|
464
|
+
"€",
|
|
465
|
+
"£",
|
|
466
|
+
"¥",
|
|
467
|
+
"¢",
|
|
468
|
+
"$",
|
|
469
|
+
"₹",
|
|
470
|
+
"₽",
|
|
471
|
+
"₩",
|
|
472
|
+
"₺",
|
|
473
|
+
"₴",
|
|
474
|
+
"₦",
|
|
475
|
+
"฿",
|
|
476
|
+
"₫",
|
|
477
|
+
"₪",
|
|
478
|
+
"﷼",
|
|
479
|
+
"¤",
|
|
480
|
+
"₡",
|
|
481
|
+
"₱",
|
|
482
|
+
"₲",
|
|
483
|
+
"₵",
|
|
484
|
+
"₭",
|
|
485
|
+
"₮",
|
|
486
|
+
"₸",
|
|
487
|
+
"₼",
|
|
488
|
+
"₾",
|
|
489
|
+
"₿"
|
|
490
|
+
]
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
key: "chcat_text",
|
|
494
|
+
chars: [
|
|
495
|
+
"§",
|
|
496
|
+
"¶",
|
|
497
|
+
"†",
|
|
498
|
+
"‡",
|
|
499
|
+
"•",
|
|
500
|
+
"…",
|
|
501
|
+
"′",
|
|
502
|
+
"″",
|
|
503
|
+
"‰",
|
|
504
|
+
"‱",
|
|
505
|
+
"–",
|
|
506
|
+
"—",
|
|
507
|
+
"―",
|
|
508
|
+
"¡",
|
|
509
|
+
"¿",
|
|
510
|
+
"·",
|
|
511
|
+
"‹",
|
|
512
|
+
"›",
|
|
513
|
+
"«",
|
|
514
|
+
"»",
|
|
515
|
+
"“",
|
|
516
|
+
"”",
|
|
517
|
+
"‘",
|
|
518
|
+
"’",
|
|
519
|
+
"„",
|
|
520
|
+
"‚",
|
|
521
|
+
"¦",
|
|
522
|
+
"ª",
|
|
523
|
+
"º",
|
|
524
|
+
"‽",
|
|
525
|
+
"※",
|
|
526
|
+
"❝",
|
|
527
|
+
"❞",
|
|
528
|
+
"❮",
|
|
529
|
+
"❯"
|
|
530
|
+
]
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
key: "chcat_math",
|
|
534
|
+
chars: [
|
|
535
|
+
"°",
|
|
536
|
+
"±",
|
|
537
|
+
"×",
|
|
538
|
+
"÷",
|
|
539
|
+
"≈",
|
|
540
|
+
"≠",
|
|
541
|
+
"≤",
|
|
542
|
+
"≥",
|
|
543
|
+
"∞",
|
|
544
|
+
"µ",
|
|
545
|
+
"√",
|
|
546
|
+
"∑",
|
|
547
|
+
"∫",
|
|
548
|
+
"∂",
|
|
549
|
+
"∆",
|
|
550
|
+
"∏",
|
|
551
|
+
"π",
|
|
552
|
+
"Ω",
|
|
553
|
+
"α",
|
|
554
|
+
"β",
|
|
555
|
+
"γ",
|
|
556
|
+
"δ",
|
|
557
|
+
"ε",
|
|
558
|
+
"θ",
|
|
559
|
+
"λ",
|
|
560
|
+
"σ",
|
|
561
|
+
"φ",
|
|
562
|
+
"ψ",
|
|
563
|
+
"ω",
|
|
564
|
+
"∈",
|
|
565
|
+
"∉",
|
|
566
|
+
"∪",
|
|
567
|
+
"∩",
|
|
568
|
+
"⊂",
|
|
569
|
+
"⊃",
|
|
570
|
+
"⊆",
|
|
571
|
+
"⊇",
|
|
572
|
+
"∀",
|
|
573
|
+
"∃",
|
|
574
|
+
"∅",
|
|
575
|
+
"∝",
|
|
576
|
+
"∴",
|
|
577
|
+
"∵",
|
|
578
|
+
"¬",
|
|
579
|
+
"∧",
|
|
580
|
+
"∨",
|
|
581
|
+
"½",
|
|
582
|
+
"⅓",
|
|
583
|
+
"¼",
|
|
584
|
+
"¾",
|
|
585
|
+
"⅔",
|
|
586
|
+
"⅛",
|
|
587
|
+
"⅜",
|
|
588
|
+
"⅝",
|
|
589
|
+
"⅞",
|
|
590
|
+
"¹",
|
|
591
|
+
"²",
|
|
592
|
+
"³",
|
|
593
|
+
"⁴",
|
|
594
|
+
"⁵",
|
|
595
|
+
"⁶",
|
|
596
|
+
"⁷",
|
|
597
|
+
"⁸",
|
|
598
|
+
"⁹",
|
|
599
|
+
"⁰",
|
|
600
|
+
"₁",
|
|
601
|
+
"₂",
|
|
602
|
+
"₃",
|
|
603
|
+
"₄",
|
|
604
|
+
"₅",
|
|
605
|
+
"₆",
|
|
606
|
+
"₇",
|
|
607
|
+
"₈",
|
|
608
|
+
"₉",
|
|
609
|
+
"₀"
|
|
610
|
+
]
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
key: "chcat_arrows",
|
|
614
|
+
chars: [
|
|
615
|
+
"←",
|
|
616
|
+
"→",
|
|
617
|
+
"↑",
|
|
618
|
+
"↓",
|
|
619
|
+
"↔",
|
|
620
|
+
"↕",
|
|
621
|
+
"⇐",
|
|
622
|
+
"⇒",
|
|
623
|
+
"⇑",
|
|
624
|
+
"⇓",
|
|
625
|
+
"⇔",
|
|
626
|
+
"↖",
|
|
627
|
+
"↗",
|
|
628
|
+
"↘",
|
|
629
|
+
"↙",
|
|
630
|
+
"↩",
|
|
631
|
+
"↪",
|
|
632
|
+
"↺",
|
|
633
|
+
"↻",
|
|
634
|
+
"⤴",
|
|
635
|
+
"⤵",
|
|
636
|
+
"➜",
|
|
637
|
+
"➝",
|
|
638
|
+
"➞",
|
|
639
|
+
"➟",
|
|
640
|
+
"⇦",
|
|
641
|
+
"⇨",
|
|
642
|
+
"⇧",
|
|
643
|
+
"⇩"
|
|
644
|
+
]
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
key: "chcat_symbols",
|
|
648
|
+
chars: [
|
|
649
|
+
"©",
|
|
650
|
+
"®",
|
|
651
|
+
"™",
|
|
652
|
+
"℠",
|
|
653
|
+
"№",
|
|
654
|
+
"℮",
|
|
655
|
+
"✓",
|
|
656
|
+
"✔",
|
|
657
|
+
"✗",
|
|
658
|
+
"✘",
|
|
659
|
+
"★",
|
|
660
|
+
"☆",
|
|
661
|
+
"✦",
|
|
662
|
+
"✪",
|
|
663
|
+
"♠",
|
|
664
|
+
"♣",
|
|
665
|
+
"♥",
|
|
666
|
+
"♦",
|
|
667
|
+
"♪",
|
|
668
|
+
"♫",
|
|
669
|
+
"♬",
|
|
670
|
+
"☀",
|
|
671
|
+
"☁",
|
|
672
|
+
"☂",
|
|
673
|
+
"☃",
|
|
674
|
+
"☾",
|
|
675
|
+
"☹",
|
|
676
|
+
"☺",
|
|
677
|
+
"☻",
|
|
678
|
+
"✉",
|
|
679
|
+
"✂",
|
|
680
|
+
"✎",
|
|
681
|
+
"✏",
|
|
682
|
+
"☎",
|
|
683
|
+
"☏",
|
|
684
|
+
"⌛",
|
|
685
|
+
"⌚",
|
|
686
|
+
"☞",
|
|
687
|
+
"☜",
|
|
688
|
+
"☝",
|
|
689
|
+
"☟"
|
|
690
|
+
]
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
key: "chcat_latin",
|
|
694
|
+
chars: [
|
|
695
|
+
"À",
|
|
696
|
+
"Á",
|
|
697
|
+
"Â",
|
|
698
|
+
"Ã",
|
|
699
|
+
"Ä",
|
|
700
|
+
"Å",
|
|
701
|
+
"Æ",
|
|
702
|
+
"Ç",
|
|
703
|
+
"È",
|
|
704
|
+
"É",
|
|
705
|
+
"Ê",
|
|
706
|
+
"Ë",
|
|
707
|
+
"Ì",
|
|
708
|
+
"Í",
|
|
709
|
+
"Î",
|
|
710
|
+
"Ï",
|
|
711
|
+
"Ð",
|
|
712
|
+
"Ñ",
|
|
713
|
+
"Ò",
|
|
714
|
+
"Ó",
|
|
715
|
+
"Ô",
|
|
716
|
+
"Õ",
|
|
717
|
+
"Ö",
|
|
718
|
+
"Ø",
|
|
719
|
+
"Ù",
|
|
720
|
+
"Ú",
|
|
721
|
+
"Û",
|
|
722
|
+
"Ü",
|
|
723
|
+
"Ý",
|
|
724
|
+
"Þ",
|
|
725
|
+
"ß",
|
|
726
|
+
"à",
|
|
727
|
+
"á",
|
|
728
|
+
"â",
|
|
729
|
+
"ã",
|
|
730
|
+
"ä",
|
|
731
|
+
"å",
|
|
732
|
+
"æ",
|
|
733
|
+
"ç",
|
|
734
|
+
"è",
|
|
735
|
+
"é",
|
|
736
|
+
"ê",
|
|
737
|
+
"ë",
|
|
738
|
+
"ì",
|
|
739
|
+
"í",
|
|
740
|
+
"î",
|
|
741
|
+
"ï",
|
|
742
|
+
"ð",
|
|
743
|
+
"ñ",
|
|
744
|
+
"ò",
|
|
745
|
+
"ó",
|
|
746
|
+
"ô",
|
|
747
|
+
"õ",
|
|
748
|
+
"ö",
|
|
749
|
+
"ø",
|
|
750
|
+
"ù",
|
|
751
|
+
"ú",
|
|
752
|
+
"û",
|
|
753
|
+
"ü",
|
|
754
|
+
"ý",
|
|
755
|
+
"þ",
|
|
756
|
+
"ÿ",
|
|
757
|
+
"Œ",
|
|
758
|
+
"œ",
|
|
759
|
+
"Š",
|
|
760
|
+
"š",
|
|
761
|
+
"Ž",
|
|
762
|
+
"ž",
|
|
763
|
+
"Ł",
|
|
764
|
+
"ł"
|
|
765
|
+
]
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
key: "chcat_arabic",
|
|
769
|
+
chars: [
|
|
770
|
+
"؟",
|
|
771
|
+
"،",
|
|
772
|
+
"؛",
|
|
773
|
+
"٪",
|
|
774
|
+
"٭",
|
|
775
|
+
"ـ",
|
|
776
|
+
"٠",
|
|
777
|
+
"١",
|
|
778
|
+
"٢",
|
|
779
|
+
"٣",
|
|
780
|
+
"٤",
|
|
781
|
+
"٥",
|
|
782
|
+
"٦",
|
|
783
|
+
"٧",
|
|
784
|
+
"٨",
|
|
785
|
+
"٩",
|
|
786
|
+
"﴾",
|
|
787
|
+
"﴿",
|
|
788
|
+
"۞",
|
|
789
|
+
"؎",
|
|
790
|
+
"ء",
|
|
791
|
+
"آ",
|
|
792
|
+
"أ",
|
|
793
|
+
"ؤ",
|
|
794
|
+
"إ",
|
|
795
|
+
"ئ",
|
|
796
|
+
"ى",
|
|
797
|
+
"ة"
|
|
798
|
+
]
|
|
799
|
+
}
|
|
800
|
+
], dt = [
|
|
801
|
+
{
|
|
802
|
+
key: "emcat_smileys",
|
|
803
|
+
chars: [
|
|
804
|
+
"😀",
|
|
805
|
+
"😃",
|
|
806
|
+
"😄",
|
|
807
|
+
"😁",
|
|
808
|
+
"😆",
|
|
809
|
+
"😅",
|
|
810
|
+
"😂",
|
|
811
|
+
"🤣",
|
|
812
|
+
"😊",
|
|
813
|
+
"😇",
|
|
814
|
+
"🙂",
|
|
815
|
+
"🙃",
|
|
816
|
+
"😉",
|
|
817
|
+
"😌",
|
|
818
|
+
"😍",
|
|
819
|
+
"🥰",
|
|
820
|
+
"😘",
|
|
821
|
+
"😋",
|
|
822
|
+
"😛",
|
|
823
|
+
"😜",
|
|
824
|
+
"🤪",
|
|
825
|
+
"🤨",
|
|
826
|
+
"🧐",
|
|
827
|
+
"🤓",
|
|
828
|
+
"😎",
|
|
829
|
+
"🥳",
|
|
830
|
+
"😏",
|
|
831
|
+
"😒",
|
|
832
|
+
"😞",
|
|
833
|
+
"😔",
|
|
834
|
+
"😟",
|
|
835
|
+
"😕",
|
|
836
|
+
"🙁",
|
|
837
|
+
"😣",
|
|
838
|
+
"😫",
|
|
839
|
+
"😩",
|
|
840
|
+
"🥺",
|
|
841
|
+
"😢",
|
|
842
|
+
"😭",
|
|
843
|
+
"😤",
|
|
844
|
+
"😠",
|
|
845
|
+
"😡",
|
|
846
|
+
"🤯",
|
|
847
|
+
"😳",
|
|
848
|
+
"🥵",
|
|
849
|
+
"🥶",
|
|
850
|
+
"😱",
|
|
851
|
+
"😨",
|
|
852
|
+
"😥",
|
|
853
|
+
"🤗",
|
|
854
|
+
"🤔",
|
|
855
|
+
"🤭",
|
|
856
|
+
"🤫",
|
|
857
|
+
"😐",
|
|
858
|
+
"😑",
|
|
859
|
+
"😬",
|
|
860
|
+
"🙄",
|
|
861
|
+
"😯",
|
|
862
|
+
"😴",
|
|
863
|
+
"😪",
|
|
864
|
+
"😷",
|
|
865
|
+
"🤒",
|
|
866
|
+
"🤕",
|
|
867
|
+
"🤢",
|
|
868
|
+
"🤧",
|
|
869
|
+
"😈",
|
|
870
|
+
"💀",
|
|
871
|
+
"👻",
|
|
872
|
+
"👽",
|
|
873
|
+
"🤖",
|
|
874
|
+
"💩",
|
|
875
|
+
"😺",
|
|
876
|
+
"😸",
|
|
877
|
+
"😹",
|
|
878
|
+
"😻",
|
|
879
|
+
"🙀"
|
|
880
|
+
]
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
key: "emcat_people",
|
|
884
|
+
chars: [
|
|
885
|
+
"👋",
|
|
886
|
+
"🤚",
|
|
887
|
+
"✋",
|
|
888
|
+
"🖖",
|
|
889
|
+
"👌",
|
|
890
|
+
"🤏",
|
|
891
|
+
"✌",
|
|
892
|
+
"🤞",
|
|
893
|
+
"🤟",
|
|
894
|
+
"🤘",
|
|
895
|
+
"🤙",
|
|
896
|
+
"👈",
|
|
897
|
+
"👉",
|
|
898
|
+
"👆",
|
|
899
|
+
"👇",
|
|
900
|
+
"☝",
|
|
901
|
+
"👍",
|
|
902
|
+
"👎",
|
|
903
|
+
"✊",
|
|
904
|
+
"👊",
|
|
905
|
+
"👏",
|
|
906
|
+
"🙌",
|
|
907
|
+
"👐",
|
|
908
|
+
"🤲",
|
|
909
|
+
"🤝",
|
|
910
|
+
"🙏",
|
|
911
|
+
"💪",
|
|
912
|
+
"✍",
|
|
913
|
+
"💅",
|
|
914
|
+
"🤳",
|
|
915
|
+
"👂",
|
|
916
|
+
"👃",
|
|
917
|
+
"👀",
|
|
918
|
+
"👁",
|
|
919
|
+
"🧠",
|
|
920
|
+
"👶",
|
|
921
|
+
"🧒",
|
|
922
|
+
"👦",
|
|
923
|
+
"👧",
|
|
924
|
+
"🧑",
|
|
925
|
+
"👨",
|
|
926
|
+
"👩",
|
|
927
|
+
"🧓",
|
|
928
|
+
"👴",
|
|
929
|
+
"👵",
|
|
930
|
+
"👮",
|
|
931
|
+
"👷",
|
|
932
|
+
"💂",
|
|
933
|
+
"🕵",
|
|
934
|
+
"👸",
|
|
935
|
+
"🤴",
|
|
936
|
+
"👰",
|
|
937
|
+
"🤵",
|
|
938
|
+
"🤰",
|
|
939
|
+
"👼",
|
|
940
|
+
"🎅",
|
|
941
|
+
"🦸",
|
|
942
|
+
"🦹",
|
|
943
|
+
"🧙",
|
|
944
|
+
"🧚",
|
|
945
|
+
"🧛",
|
|
946
|
+
"🧟",
|
|
947
|
+
"💃",
|
|
948
|
+
"🕺",
|
|
949
|
+
"🚶",
|
|
950
|
+
"🏃",
|
|
951
|
+
"🧘"
|
|
952
|
+
]
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
key: "emcat_animals",
|
|
956
|
+
chars: [
|
|
957
|
+
"🐶",
|
|
958
|
+
"🐱",
|
|
959
|
+
"🐭",
|
|
960
|
+
"🐹",
|
|
961
|
+
"🐰",
|
|
962
|
+
"🦊",
|
|
963
|
+
"🐻",
|
|
964
|
+
"🐼",
|
|
965
|
+
"🐨",
|
|
966
|
+
"🐯",
|
|
967
|
+
"🦁",
|
|
968
|
+
"🐮",
|
|
969
|
+
"🐷",
|
|
970
|
+
"🐸",
|
|
971
|
+
"🐵",
|
|
972
|
+
"🐔",
|
|
973
|
+
"🐧",
|
|
974
|
+
"🐦",
|
|
975
|
+
"🐤",
|
|
976
|
+
"🦆",
|
|
977
|
+
"🦅",
|
|
978
|
+
"🦉",
|
|
979
|
+
"🐺",
|
|
980
|
+
"🐗",
|
|
981
|
+
"🐴",
|
|
982
|
+
"🦄",
|
|
983
|
+
"🐝",
|
|
984
|
+
"🐛",
|
|
985
|
+
"🦋",
|
|
986
|
+
"🐌",
|
|
987
|
+
"🐞",
|
|
988
|
+
"🐢",
|
|
989
|
+
"🐍",
|
|
990
|
+
"🦎",
|
|
991
|
+
"🦖",
|
|
992
|
+
"🐙",
|
|
993
|
+
"🦑",
|
|
994
|
+
"🦀",
|
|
995
|
+
"🐠",
|
|
996
|
+
"🐟",
|
|
997
|
+
"🐬",
|
|
998
|
+
"🐳",
|
|
999
|
+
"🦈",
|
|
1000
|
+
"🐊",
|
|
1001
|
+
"🐅",
|
|
1002
|
+
"🦓",
|
|
1003
|
+
"🦍",
|
|
1004
|
+
"🐘",
|
|
1005
|
+
"🦏",
|
|
1006
|
+
"🐪",
|
|
1007
|
+
"🦒",
|
|
1008
|
+
"🦘",
|
|
1009
|
+
"🐄",
|
|
1010
|
+
"🐎",
|
|
1011
|
+
"🐖",
|
|
1012
|
+
"🐑",
|
|
1013
|
+
"🐐",
|
|
1014
|
+
"🦌",
|
|
1015
|
+
"🐕",
|
|
1016
|
+
"🐈",
|
|
1017
|
+
"🐓",
|
|
1018
|
+
"🦃",
|
|
1019
|
+
"🦚",
|
|
1020
|
+
"🦜",
|
|
1021
|
+
"🦢",
|
|
1022
|
+
"🕊",
|
|
1023
|
+
"🐇",
|
|
1024
|
+
"🦔",
|
|
1025
|
+
"🌵",
|
|
1026
|
+
"🌲",
|
|
1027
|
+
"🌴",
|
|
1028
|
+
"🌱",
|
|
1029
|
+
"🌿",
|
|
1030
|
+
"☘",
|
|
1031
|
+
"🍀",
|
|
1032
|
+
"🍁",
|
|
1033
|
+
"🌸",
|
|
1034
|
+
"🌺",
|
|
1035
|
+
"🌻",
|
|
1036
|
+
"🌹",
|
|
1037
|
+
"🌷",
|
|
1038
|
+
"💐"
|
|
1039
|
+
]
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
key: "emcat_food",
|
|
1043
|
+
chars: [
|
|
1044
|
+
"🍏",
|
|
1045
|
+
"🍎",
|
|
1046
|
+
"🍐",
|
|
1047
|
+
"🍊",
|
|
1048
|
+
"🍋",
|
|
1049
|
+
"🍌",
|
|
1050
|
+
"🍉",
|
|
1051
|
+
"🍇",
|
|
1052
|
+
"🍓",
|
|
1053
|
+
"🍈",
|
|
1054
|
+
"🍒",
|
|
1055
|
+
"🍑",
|
|
1056
|
+
"🥭",
|
|
1057
|
+
"🍍",
|
|
1058
|
+
"🥥",
|
|
1059
|
+
"🥝",
|
|
1060
|
+
"🍅",
|
|
1061
|
+
"🍆",
|
|
1062
|
+
"🥑",
|
|
1063
|
+
"🥦",
|
|
1064
|
+
"🥒",
|
|
1065
|
+
"🌶",
|
|
1066
|
+
"🌽",
|
|
1067
|
+
"🥕",
|
|
1068
|
+
"🥔",
|
|
1069
|
+
"🥐",
|
|
1070
|
+
"🍞",
|
|
1071
|
+
"🥖",
|
|
1072
|
+
"🥨",
|
|
1073
|
+
"🧀",
|
|
1074
|
+
"🥚",
|
|
1075
|
+
"🍳",
|
|
1076
|
+
"🥞",
|
|
1077
|
+
"🥓",
|
|
1078
|
+
"🥩",
|
|
1079
|
+
"🍗",
|
|
1080
|
+
"🍖",
|
|
1081
|
+
"🌭",
|
|
1082
|
+
"🍔",
|
|
1083
|
+
"🍟",
|
|
1084
|
+
"🍕",
|
|
1085
|
+
"🥪",
|
|
1086
|
+
"🌮",
|
|
1087
|
+
"🌯",
|
|
1088
|
+
"🥗",
|
|
1089
|
+
"🍝",
|
|
1090
|
+
"🍜",
|
|
1091
|
+
"🍲",
|
|
1092
|
+
"🍛",
|
|
1093
|
+
"🍣",
|
|
1094
|
+
"🍱",
|
|
1095
|
+
"🥟",
|
|
1096
|
+
"🍤",
|
|
1097
|
+
"🍚",
|
|
1098
|
+
"🍧",
|
|
1099
|
+
"🍨",
|
|
1100
|
+
"🍦",
|
|
1101
|
+
"🥧",
|
|
1102
|
+
"🧁",
|
|
1103
|
+
"🍰",
|
|
1104
|
+
"🎂",
|
|
1105
|
+
"🍮",
|
|
1106
|
+
"🍭",
|
|
1107
|
+
"🍬",
|
|
1108
|
+
"🍫",
|
|
1109
|
+
"🍿",
|
|
1110
|
+
"🍩",
|
|
1111
|
+
"🍪",
|
|
1112
|
+
"🥜",
|
|
1113
|
+
"🍯",
|
|
1114
|
+
"🥛",
|
|
1115
|
+
"☕",
|
|
1116
|
+
"🍵",
|
|
1117
|
+
"🥤",
|
|
1118
|
+
"🍺",
|
|
1119
|
+
"🥂",
|
|
1120
|
+
"🍷",
|
|
1121
|
+
"🍸",
|
|
1122
|
+
"🍹"
|
|
1123
|
+
]
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
key: "emcat_travel",
|
|
1127
|
+
chars: [
|
|
1128
|
+
"🚗",
|
|
1129
|
+
"🚕",
|
|
1130
|
+
"🚙",
|
|
1131
|
+
"🚌",
|
|
1132
|
+
"🏎",
|
|
1133
|
+
"🚓",
|
|
1134
|
+
"🚑",
|
|
1135
|
+
"🚒",
|
|
1136
|
+
"🚚",
|
|
1137
|
+
"🚜",
|
|
1138
|
+
"🛵",
|
|
1139
|
+
"🏍",
|
|
1140
|
+
"🚲",
|
|
1141
|
+
"🛴",
|
|
1142
|
+
"🚔",
|
|
1143
|
+
"🚃",
|
|
1144
|
+
"🚄",
|
|
1145
|
+
"🚅",
|
|
1146
|
+
"🚂",
|
|
1147
|
+
"🚆",
|
|
1148
|
+
"🚇",
|
|
1149
|
+
"🚉",
|
|
1150
|
+
"✈",
|
|
1151
|
+
"🛫",
|
|
1152
|
+
"🛬",
|
|
1153
|
+
"💺",
|
|
1154
|
+
"🚁",
|
|
1155
|
+
"🚀",
|
|
1156
|
+
"🛸",
|
|
1157
|
+
"🚢",
|
|
1158
|
+
"⛵",
|
|
1159
|
+
"🚤",
|
|
1160
|
+
"⚓",
|
|
1161
|
+
"⛽",
|
|
1162
|
+
"🚧",
|
|
1163
|
+
"🗺",
|
|
1164
|
+
"🗿",
|
|
1165
|
+
"🗽",
|
|
1166
|
+
"🗼",
|
|
1167
|
+
"🏰",
|
|
1168
|
+
"🏯",
|
|
1169
|
+
"🎡",
|
|
1170
|
+
"🎢",
|
|
1171
|
+
"🎠",
|
|
1172
|
+
"⛲",
|
|
1173
|
+
"🏖",
|
|
1174
|
+
"🏝",
|
|
1175
|
+
"🌋",
|
|
1176
|
+
"⛰",
|
|
1177
|
+
"🏔",
|
|
1178
|
+
"🗻",
|
|
1179
|
+
"🏕",
|
|
1180
|
+
"⛺",
|
|
1181
|
+
"🏠",
|
|
1182
|
+
"🏡",
|
|
1183
|
+
"🏢",
|
|
1184
|
+
"🏬",
|
|
1185
|
+
"🏥",
|
|
1186
|
+
"🏦",
|
|
1187
|
+
"🏨",
|
|
1188
|
+
"🏪",
|
|
1189
|
+
"🏫",
|
|
1190
|
+
"💒",
|
|
1191
|
+
"⛪",
|
|
1192
|
+
"🕌",
|
|
1193
|
+
"🕍",
|
|
1194
|
+
"🕋",
|
|
1195
|
+
"⛩",
|
|
1196
|
+
"🌅",
|
|
1197
|
+
"🌄",
|
|
1198
|
+
"🌇",
|
|
1199
|
+
"🌆",
|
|
1200
|
+
"🌃",
|
|
1201
|
+
"🌉",
|
|
1202
|
+
"🌌",
|
|
1203
|
+
"🌠"
|
|
1204
|
+
]
|
|
1205
|
+
},
|
|
1206
|
+
{
|
|
1207
|
+
key: "emcat_activities",
|
|
1208
|
+
chars: [
|
|
1209
|
+
"⚽",
|
|
1210
|
+
"🏀",
|
|
1211
|
+
"🏈",
|
|
1212
|
+
"⚾",
|
|
1213
|
+
"🎾",
|
|
1214
|
+
"🏐",
|
|
1215
|
+
"🏉",
|
|
1216
|
+
"🎱",
|
|
1217
|
+
"🏓",
|
|
1218
|
+
"🏸",
|
|
1219
|
+
"🏒",
|
|
1220
|
+
"🏑",
|
|
1221
|
+
"🏏",
|
|
1222
|
+
"⛳",
|
|
1223
|
+
"🏹",
|
|
1224
|
+
"🎣",
|
|
1225
|
+
"🥊",
|
|
1226
|
+
"🥋",
|
|
1227
|
+
"⛸",
|
|
1228
|
+
"🎿",
|
|
1229
|
+
"⛷",
|
|
1230
|
+
"🏂",
|
|
1231
|
+
"🏋",
|
|
1232
|
+
"🤸",
|
|
1233
|
+
"⛹",
|
|
1234
|
+
"🤺",
|
|
1235
|
+
"🏇",
|
|
1236
|
+
"🧗",
|
|
1237
|
+
"🏄",
|
|
1238
|
+
"🏊",
|
|
1239
|
+
"🚣",
|
|
1240
|
+
"🚵",
|
|
1241
|
+
"🚴",
|
|
1242
|
+
"🏆",
|
|
1243
|
+
"🥇",
|
|
1244
|
+
"🥈",
|
|
1245
|
+
"🥉",
|
|
1246
|
+
"🏅",
|
|
1247
|
+
"🎖",
|
|
1248
|
+
"🎫",
|
|
1249
|
+
"🎪",
|
|
1250
|
+
"🤹",
|
|
1251
|
+
"🎭",
|
|
1252
|
+
"🎨",
|
|
1253
|
+
"🎬",
|
|
1254
|
+
"🎤",
|
|
1255
|
+
"🎧",
|
|
1256
|
+
"🎼",
|
|
1257
|
+
"🎹",
|
|
1258
|
+
"🥁",
|
|
1259
|
+
"🎷",
|
|
1260
|
+
"🎺",
|
|
1261
|
+
"🎸",
|
|
1262
|
+
"🎻",
|
|
1263
|
+
"🎲",
|
|
1264
|
+
"🎯",
|
|
1265
|
+
"🎳",
|
|
1266
|
+
"🎮",
|
|
1267
|
+
"🎰",
|
|
1268
|
+
"🧩"
|
|
1269
|
+
]
|
|
1270
|
+
},
|
|
1271
|
+
{
|
|
1272
|
+
key: "emcat_objects",
|
|
1273
|
+
chars: [
|
|
1274
|
+
"⌚",
|
|
1275
|
+
"📱",
|
|
1276
|
+
"💻",
|
|
1277
|
+
"⌨",
|
|
1278
|
+
"🖥",
|
|
1279
|
+
"🖨",
|
|
1280
|
+
"🖱",
|
|
1281
|
+
"🕹",
|
|
1282
|
+
"💽",
|
|
1283
|
+
"💾",
|
|
1284
|
+
"💿",
|
|
1285
|
+
"📀",
|
|
1286
|
+
"📷",
|
|
1287
|
+
"📸",
|
|
1288
|
+
"📹",
|
|
1289
|
+
"🎥",
|
|
1290
|
+
"📞",
|
|
1291
|
+
"☎",
|
|
1292
|
+
"📺",
|
|
1293
|
+
"📻",
|
|
1294
|
+
"🎙",
|
|
1295
|
+
"⏱",
|
|
1296
|
+
"⏰",
|
|
1297
|
+
"⌛",
|
|
1298
|
+
"⏳",
|
|
1299
|
+
"📡",
|
|
1300
|
+
"🔋",
|
|
1301
|
+
"🔌",
|
|
1302
|
+
"💡",
|
|
1303
|
+
"🔦",
|
|
1304
|
+
"🕯",
|
|
1305
|
+
"💸",
|
|
1306
|
+
"💵",
|
|
1307
|
+
"💰",
|
|
1308
|
+
"💳",
|
|
1309
|
+
"💎",
|
|
1310
|
+
"⚖",
|
|
1311
|
+
"🔧",
|
|
1312
|
+
"🔨",
|
|
1313
|
+
"⚒",
|
|
1314
|
+
"🛠",
|
|
1315
|
+
"⛏",
|
|
1316
|
+
"🔩",
|
|
1317
|
+
"⚙",
|
|
1318
|
+
"🧲",
|
|
1319
|
+
"🔫",
|
|
1320
|
+
"💣",
|
|
1321
|
+
"🔪",
|
|
1322
|
+
"🛡",
|
|
1323
|
+
"🔮",
|
|
1324
|
+
"🧿",
|
|
1325
|
+
"🔭",
|
|
1326
|
+
"🔬",
|
|
1327
|
+
"💊",
|
|
1328
|
+
"💉",
|
|
1329
|
+
"🌡",
|
|
1330
|
+
"🧬",
|
|
1331
|
+
"🧪",
|
|
1332
|
+
"🧹",
|
|
1333
|
+
"🧺",
|
|
1334
|
+
"🛁",
|
|
1335
|
+
"🔑",
|
|
1336
|
+
"🗝",
|
|
1337
|
+
"🚪",
|
|
1338
|
+
"🛋",
|
|
1339
|
+
"🛏",
|
|
1340
|
+
"🧸",
|
|
1341
|
+
"🖼",
|
|
1342
|
+
"🛍",
|
|
1343
|
+
"🛒",
|
|
1344
|
+
"🎁",
|
|
1345
|
+
"🎈",
|
|
1346
|
+
"🎀",
|
|
1347
|
+
"🎊",
|
|
1348
|
+
"🎉",
|
|
1349
|
+
"✉",
|
|
1350
|
+
"📩",
|
|
1351
|
+
"📦",
|
|
1352
|
+
"📜",
|
|
1353
|
+
"📄",
|
|
1354
|
+
"📊",
|
|
1355
|
+
"📈",
|
|
1356
|
+
"📉",
|
|
1357
|
+
"📅",
|
|
1358
|
+
"📋",
|
|
1359
|
+
"📁",
|
|
1360
|
+
"📰",
|
|
1361
|
+
"📓",
|
|
1362
|
+
"📚",
|
|
1363
|
+
"📖",
|
|
1364
|
+
"🔖",
|
|
1365
|
+
"🔗",
|
|
1366
|
+
"📎",
|
|
1367
|
+
"📐",
|
|
1368
|
+
"📏",
|
|
1369
|
+
"📌",
|
|
1370
|
+
"📍",
|
|
1371
|
+
"✂",
|
|
1372
|
+
"🖊",
|
|
1373
|
+
"✒",
|
|
1374
|
+
"🖌",
|
|
1375
|
+
"🖍",
|
|
1376
|
+
"📝",
|
|
1377
|
+
"✏",
|
|
1378
|
+
"🔍",
|
|
1379
|
+
"🔒",
|
|
1380
|
+
"🔓"
|
|
1381
|
+
]
|
|
1382
|
+
},
|
|
1383
|
+
{
|
|
1384
|
+
key: "emcat_symbols",
|
|
1385
|
+
chars: [
|
|
1386
|
+
"❤",
|
|
1387
|
+
"🧡",
|
|
1388
|
+
"💛",
|
|
1389
|
+
"💚",
|
|
1390
|
+
"💙",
|
|
1391
|
+
"💜",
|
|
1392
|
+
"🖤",
|
|
1393
|
+
"💔",
|
|
1394
|
+
"❣",
|
|
1395
|
+
"💕",
|
|
1396
|
+
"💞",
|
|
1397
|
+
"💓",
|
|
1398
|
+
"💗",
|
|
1399
|
+
"💖",
|
|
1400
|
+
"💘",
|
|
1401
|
+
"💝",
|
|
1402
|
+
"☮",
|
|
1403
|
+
"✝",
|
|
1404
|
+
"☪",
|
|
1405
|
+
"🕉",
|
|
1406
|
+
"☸",
|
|
1407
|
+
"✡",
|
|
1408
|
+
"☯",
|
|
1409
|
+
"♈",
|
|
1410
|
+
"♉",
|
|
1411
|
+
"♊",
|
|
1412
|
+
"♋",
|
|
1413
|
+
"♌",
|
|
1414
|
+
"♍",
|
|
1415
|
+
"♎",
|
|
1416
|
+
"♏",
|
|
1417
|
+
"♐",
|
|
1418
|
+
"♑",
|
|
1419
|
+
"♒",
|
|
1420
|
+
"♓",
|
|
1421
|
+
"⚛",
|
|
1422
|
+
"❌",
|
|
1423
|
+
"⭕",
|
|
1424
|
+
"🛑",
|
|
1425
|
+
"⛔",
|
|
1426
|
+
"🚫",
|
|
1427
|
+
"💯",
|
|
1428
|
+
"💢",
|
|
1429
|
+
"⚠",
|
|
1430
|
+
"🚸",
|
|
1431
|
+
"🔱",
|
|
1432
|
+
"⚜",
|
|
1433
|
+
"🔰",
|
|
1434
|
+
"♻",
|
|
1435
|
+
"✅",
|
|
1436
|
+
"❇",
|
|
1437
|
+
"✳",
|
|
1438
|
+
"❎",
|
|
1439
|
+
"🌐",
|
|
1440
|
+
"💠",
|
|
1441
|
+
"🌀",
|
|
1442
|
+
"💤",
|
|
1443
|
+
"🏧",
|
|
1444
|
+
"♿",
|
|
1445
|
+
"🚭",
|
|
1446
|
+
"❗",
|
|
1447
|
+
"❕",
|
|
1448
|
+
"❓",
|
|
1449
|
+
"❔",
|
|
1450
|
+
"‼",
|
|
1451
|
+
"⁉",
|
|
1452
|
+
"💲",
|
|
1453
|
+
"🔅",
|
|
1454
|
+
"🔆",
|
|
1455
|
+
"〽",
|
|
1456
|
+
"ℹ",
|
|
1457
|
+
"🆗",
|
|
1458
|
+
"🆕",
|
|
1459
|
+
"🆓",
|
|
1460
|
+
"🆒",
|
|
1461
|
+
"🆙",
|
|
1462
|
+
"🈯",
|
|
1463
|
+
"🈚"
|
|
1464
|
+
]
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
key: "emcat_flags",
|
|
1468
|
+
chars: [
|
|
1469
|
+
"🏁",
|
|
1470
|
+
"🚩",
|
|
1471
|
+
"🎌",
|
|
1472
|
+
"🏴",
|
|
1473
|
+
"🏳",
|
|
1474
|
+
"🇦🇪",
|
|
1475
|
+
"🇸🇦",
|
|
1476
|
+
"🇶🇦",
|
|
1477
|
+
"🇰🇼",
|
|
1478
|
+
"🇧🇭",
|
|
1479
|
+
"🇴🇲",
|
|
1480
|
+
"🇪🇬",
|
|
1481
|
+
"🇯🇴",
|
|
1482
|
+
"🇱🇧",
|
|
1483
|
+
"🇮🇳",
|
|
1484
|
+
"🇵🇰",
|
|
1485
|
+
"🇺🇸",
|
|
1486
|
+
"🇬🇧",
|
|
1487
|
+
"🇨🇦",
|
|
1488
|
+
"🇦🇺",
|
|
1489
|
+
"🇫🇷",
|
|
1490
|
+
"🇩🇪",
|
|
1491
|
+
"🇮🇹",
|
|
1492
|
+
"🇪🇸",
|
|
1493
|
+
"🇵🇹",
|
|
1494
|
+
"🇳🇱",
|
|
1495
|
+
"🇧🇪",
|
|
1496
|
+
"🇨🇭",
|
|
1497
|
+
"🇸🇪",
|
|
1498
|
+
"🇳🇴",
|
|
1499
|
+
"🇩🇰",
|
|
1500
|
+
"🇫🇮",
|
|
1501
|
+
"🇮🇪",
|
|
1502
|
+
"🇬🇷",
|
|
1503
|
+
"🇹🇷",
|
|
1504
|
+
"🇷🇺",
|
|
1505
|
+
"🇺🇦",
|
|
1506
|
+
"🇵🇱",
|
|
1507
|
+
"🇯🇵",
|
|
1508
|
+
"🇰🇷",
|
|
1509
|
+
"🇨🇳",
|
|
1510
|
+
"🇸🇬",
|
|
1511
|
+
"🇲🇾",
|
|
1512
|
+
"🇮🇩",
|
|
1513
|
+
"🇹🇭",
|
|
1514
|
+
"🇵🇭",
|
|
1515
|
+
"🇻🇳",
|
|
1516
|
+
"🇧🇷",
|
|
1517
|
+
"🇦🇷",
|
|
1518
|
+
"🇲🇽",
|
|
1519
|
+
"🇿🇦",
|
|
1520
|
+
"🇳🇬",
|
|
1521
|
+
"🇰🇪",
|
|
1522
|
+
"🇲🇦"
|
|
1523
|
+
]
|
|
1524
|
+
}
|
|
1525
|
+
], Bt = [
|
|
343
1526
|
"©",
|
|
344
1527
|
"®",
|
|
345
1528
|
"™",
|
|
@@ -388,228 +1571,244 @@ const X = "undo redo | preview print | importword revhistory | fontfamily fontsi
|
|
|
388
1571
|
"ـ",
|
|
389
1572
|
"٠",
|
|
390
1573
|
"١"
|
|
391
|
-
],
|
|
1574
|
+
], y = (p, t) => `<svg viewBox="${t || "0 0 24 24"}">${p}</svg>`, f = (p) => y(`<path class="f" d="${p}"/>`, "0 -960 960 960"), q = (p, t = 7.5) => y(
|
|
392
1575
|
'<path d="M10 6h10M10 12h10M10 18h10"/>' + p.map(
|
|
393
1576
|
(e, i) => `<text x="2.5" y="${8.4 + i * 6}" font-size="${t}" stroke="none" fill="#222f3e" font-family="Arial">${e}</text>`
|
|
394
1577
|
).join("")
|
|
395
|
-
),
|
|
396
|
-
bold:
|
|
1578
|
+
), c = {
|
|
1579
|
+
bold: f(
|
|
397
1580
|
"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"
|
|
398
1581
|
),
|
|
399
|
-
italic:
|
|
400
|
-
underline:
|
|
1582
|
+
italic: f("M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"),
|
|
1583
|
+
underline: f(
|
|
401
1584
|
"M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"
|
|
402
1585
|
),
|
|
403
|
-
strikethrough:
|
|
1586
|
+
strikethrough: f(
|
|
404
1587
|
"M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"
|
|
405
1588
|
),
|
|
406
|
-
undo:
|
|
407
|
-
redo:
|
|
408
|
-
ltr:
|
|
1589
|
+
undo: f("M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"),
|
|
1590
|
+
redo: f("M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"),
|
|
1591
|
+
ltr: f(
|
|
409
1592
|
"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"
|
|
410
1593
|
),
|
|
411
|
-
rtl:
|
|
1594
|
+
rtl: f(
|
|
412
1595
|
"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"
|
|
413
1596
|
),
|
|
414
|
-
alignleft:
|
|
1597
|
+
alignleft: f(
|
|
415
1598
|
"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"
|
|
416
1599
|
),
|
|
417
|
-
aligncenter:
|
|
1600
|
+
aligncenter: f(
|
|
418
1601
|
"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"
|
|
419
1602
|
),
|
|
420
|
-
alignright:
|
|
1603
|
+
alignright: f(
|
|
421
1604
|
"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"
|
|
422
1605
|
),
|
|
423
|
-
alignjustify:
|
|
1606
|
+
alignjustify: f(
|
|
424
1607
|
"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"
|
|
425
1608
|
),
|
|
426
|
-
fullscreen:
|
|
1609
|
+
fullscreen: f(
|
|
427
1610
|
"M120-120v-200h80v120h120v80H120Zm520 0v-80h120v-120h80v200H640ZM120-640v-200h200v80H200v120h-80Zm640 0v-120H640v-80h200v200h-80Z"
|
|
428
1611
|
),
|
|
429
|
-
clearformatic:
|
|
1612
|
+
clearformatic: f(
|
|
430
1613
|
"m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"
|
|
431
1614
|
),
|
|
432
|
-
numlist:
|
|
1615
|
+
numlist: f(
|
|
433
1616
|
"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"
|
|
434
1617
|
),
|
|
435
|
-
bullist:
|
|
1618
|
+
bullist: f(
|
|
436
1619
|
"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"
|
|
437
1620
|
),
|
|
438
|
-
chev:
|
|
439
|
-
backcolor:
|
|
1621
|
+
chev: y('<path d="M2 3.5 6 7.5 10 3.5"/>', "0 0 12 11"),
|
|
1622
|
+
backcolor: f(
|
|
440
1623
|
"M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"
|
|
441
1624
|
),
|
|
442
|
-
outdent:
|
|
1625
|
+
outdent: f(
|
|
443
1626
|
"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"
|
|
444
1627
|
),
|
|
445
|
-
indent:
|
|
1628
|
+
indent: f(
|
|
446
1629
|
"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"
|
|
447
1630
|
),
|
|
448
|
-
more:
|
|
1631
|
+
more: y(
|
|
449
1632
|
'<circle class="f" cx="5" cy="12" r="1.7"/><circle class="f" cx="12" cy="12" r="1.7"/><circle class="f" cx="19" cy="12" r="1.7"/>'
|
|
450
1633
|
),
|
|
451
|
-
image:
|
|
1634
|
+
image: f(
|
|
452
1635
|
"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"
|
|
453
1636
|
),
|
|
454
|
-
uploadic:
|
|
1637
|
+
uploadic: f(
|
|
455
1638
|
"M440-200v-326L336-422l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-80q-33 0-56.5-23.5T160-160v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-80H240Z"
|
|
456
1639
|
),
|
|
457
|
-
tableic:
|
|
1640
|
+
tableic: f(
|
|
458
1641
|
"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"
|
|
459
1642
|
),
|
|
460
|
-
hric:
|
|
461
|
-
charic:
|
|
1643
|
+
hric: y('<path d="M4 12h16"/>'),
|
|
1644
|
+
charic: f(
|
|
462
1645
|
"M120-120v-120h200q-84-45-132-125t-48-175q0-142 99-241t241-99q142 0 241 99t99 241q0 95-48 175T640-240h200v120H520v-204q78-14 129-75t51-141q0-92-64-156t-156-64q-92 0-156 64t-64 156q0 80 51 141t129 75v204H120Z"
|
|
463
1646
|
),
|
|
464
|
-
dateic:
|
|
1647
|
+
dateic: y(
|
|
465
1648
|
'<rect x="4" y="6" width="16" height="14" rx="1.5"/><path d="M4 10h16M8 4v4M16 4v4"/>'
|
|
466
1649
|
),
|
|
467
|
-
pbic:
|
|
1650
|
+
pbic: f(
|
|
468
1651
|
"M240-80q-33 0-56.5-23.5T160-160v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-80H240Zm-80-440v-280q0-33 23.5-56.5T240-880h320l240 240v120h-80v-80H520v-200H240v280h-80Zm200 160v-80h240v80H360Zm320 0v-80h240v80H680Zm-640 0v-80h240v80H40Zm440-160Zm0 240Z"
|
|
469
1652
|
),
|
|
470
|
-
nbspic:
|
|
471
|
-
srcic:
|
|
1653
|
+
nbspic: y('<path d="M6 12v4h12v-4"/>'),
|
|
1654
|
+
srcic: f(
|
|
472
1655
|
"M240-280 40-480l200-200 56 56-143 144 143 144-56 56Zm178 132-76-24 200-640 76 24-200 640Zm302-132-56-56 143-144-143-144 56-56 200 200-200 200Z"
|
|
473
1656
|
),
|
|
474
|
-
prevw:
|
|
1657
|
+
prevw: f(
|
|
475
1658
|
"M607.5-372.5Q660-425 660-500t-52.5-127.5Q555-680 480-680t-127.5 52.5Q300-575 300-500t52.5 127.5Q405-320 480-320t127.5-52.5Zm-204-51Q372-455 372-500t31.5-76.5Q435-608 480-608t76.5 31.5Q588-545 588-500t-31.5 76.5Q525-392 480-392t-76.5-31.5ZM214-281.5Q94-363 40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200q-146 0-266-81.5ZM480-500Zm207.5 160.5Q782-399 832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280q113 0 207.5-59.5Z"
|
|
476
1659
|
),
|
|
477
|
-
printic:
|
|
1660
|
+
printic: f(
|
|
478
1661
|
"M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"
|
|
479
1662
|
),
|
|
480
|
-
cutic:
|
|
1663
|
+
cutic: f(
|
|
481
1664
|
"M760-120 480-400l-94 94q8 15 11 32t3 34q0 66-47 113T240-80q-66 0-113-47T80-240q0-66 47-113t113-47q17 0 34 3t32 11l94-94-94-94q-15 8-32 11t-34 3q-66 0-113-47T80-720q0-66 47-113t113-47q66 0 113 47t47 113q0 17-3 34t-11 32l494 494v40H760ZM600-520l-80-80 240-240h120v40L600-520ZM296.5-663.5Q320-687 320-720t-23.5-56.5Q273-800 240-800t-56.5 23.5Q160-753 160-720t23.5 56.5Q207-640 240-640t56.5-23.5ZM494-466q6-6 6-14t-6-14q-6-6-14-6t-14 6q-6 6-6 14t6 14q6 6 14 6t14-6ZM296.5-183.5Q320-207 320-240t-23.5-56.5Q273-320 240-320t-56.5 23.5Q160-273 160-240t23.5 56.5Q207-160 240-160t56.5-23.5Z"
|
|
482
1665
|
),
|
|
483
|
-
copyic:
|
|
1666
|
+
copyic: f(
|
|
484
1667
|
"M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"
|
|
485
1668
|
),
|
|
486
|
-
pasteic:
|
|
1669
|
+
pasteic: f(
|
|
487
1670
|
"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h167q11-35 43-57.5t70-22.5q40 0 71.5 22.5T594-840h166q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm308.5-571.5Q520-783 520-800t-11.5-28.5Q497-840 480-840t-28.5 11.5Q440-817 440-800t11.5 28.5Q463-760 480-760t28.5-11.5Z"
|
|
488
1671
|
),
|
|
489
|
-
selall:
|
|
1672
|
+
selall: f(
|
|
490
1673
|
"M280-280v-400h400v400H280Zm80-80h240v-240H360v240ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T200-840v80Zm80 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80q0 33-23.5 56.5T760-120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80q33 0 56.5 23.5T840-760h-80Z"
|
|
491
1674
|
),
|
|
492
|
-
superscriptic:
|
|
1675
|
+
superscriptic: f(
|
|
493
1676
|
"M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"
|
|
494
1677
|
),
|
|
495
|
-
subscriptic:
|
|
1678
|
+
subscriptic: f(
|
|
496
1679
|
"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"
|
|
497
1680
|
),
|
|
498
|
-
newic:
|
|
499
|
-
helpic:
|
|
1681
|
+
newic: y('<path d="M6 3h8l5 5v13H6z"/><path d="M14 3v5h5"/>'),
|
|
1682
|
+
helpic: y(
|
|
500
1683
|
'<circle cx="12" cy="12" r="8.5"/><path d="M9.6 9.6a2.5 2.5 0 1 1 3.4 2.6c-.8.3-1 .9-1 1.8"/><circle class="f" cx="12" cy="16.6" r="1.1"/>'
|
|
501
1684
|
),
|
|
502
|
-
wcic:
|
|
503
|
-
rowbefore:
|
|
1685
|
+
wcic: y('<path d="M4 6h16M4 10h16M4 14h9"/><path d="M15 17.5l2 2 3.6-4"/>'),
|
|
1686
|
+
rowbefore: f(
|
|
504
1687
|
"M200-160h560v-240H200v240Zm640 80H120v-720h160v80h-80v240h560v-240h-80v-80h160v720ZM480-480Zm0 80v-80 80Zm0 0Zm-40-240v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z"
|
|
505
1688
|
),
|
|
506
|
-
rowafter:
|
|
1689
|
+
rowafter: f(
|
|
507
1690
|
"M200-560h560v-240H200v240Zm-80 400v-720h720v720H680v-80h80v-240H200v240h80v80H120Zm360-320Zm0-80v80-80Zm0 0ZM440-80v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z"
|
|
508
1691
|
),
|
|
509
|
-
rowdelete:
|
|
1692
|
+
rowdelete: f(
|
|
510
1693
|
"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200ZM200-200h560v-560H200ZM200-400v-160h560v160H200ZM330-580l250 250 50-50-250-250ZM330-380l250-250 50 50-250 250Z"
|
|
511
1694
|
),
|
|
512
|
-
colbefore:
|
|
1695
|
+
colbefore: f(
|
|
513
1696
|
"M800-200v-560H560v560h240Zm-640 80v-160h80v80h240v-560H240v80h-80v-160h720v720H160Zm320-360Zm80 0h-80 80Zm0 0ZM160-360v-80H80v-80h80v-80h80v80h80v80h-80v80h-80Z"
|
|
514
1697
|
),
|
|
515
|
-
colafter:
|
|
1698
|
+
colafter: f(
|
|
516
1699
|
"M160-760v560h240v-560H160ZM80-120v-720h720v160h-80v-80H480v560h240v-80h80v160H80Zm400-360Zm-80 0h80-80Zm0 0Zm320 120v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80Z"
|
|
517
1700
|
),
|
|
518
|
-
coldelete:
|
|
1701
|
+
coldelete: f(
|
|
519
1702
|
"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200ZM200-200h560v-560H200ZM400-200v-560h160v560H400ZM330-580l250 250 50-50-250-250ZM330-380l250-250 50 50-250 250Z"
|
|
520
1703
|
),
|
|
521
|
-
tabledelete:
|
|
1704
|
+
tabledelete: y(
|
|
522
1705
|
'<rect x="4" y="5" width="16" height="14" rx="1.5"/><path d="M4 10h16M4 14.5h16M9.5 5v14M14.5 5v14"/><path d="M6.5 6.5l11 11M17.5 6.5l-11 11" stroke-width="2.1"/>'
|
|
523
1706
|
),
|
|
524
|
-
quote:
|
|
1707
|
+
quote: f(
|
|
525
1708
|
"m228-240 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T458-480L320-240h-92Zm360 0 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T818-480L680-240h-92ZM362.5-517.5Q380-535 380-560t-17.5-42.5Q345-620 320-620t-42.5 17.5Q260-585 260-560t17.5 42.5Q295-500 320-500t42.5-17.5Zm360 0Q740-535 740-560t-17.5-42.5Q705-620 680-620t-42.5 17.5Q620-585 620-560t17.5 42.5Q655-500 680-500t42.5-17.5ZM680-560Zm-360 0Z"
|
|
526
1709
|
),
|
|
527
|
-
link:
|
|
1710
|
+
link: f(
|
|
528
1711
|
"M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"
|
|
529
1712
|
),
|
|
530
|
-
unlink:
|
|
1713
|
+
unlink: y(
|
|
531
1714
|
'<path d="M13.5 6.5l1.7-1.7a4 4 0 0 1 5.6 5.6L19 12.2"/><path d="M10.5 17.5l-1.7 1.7a4 4 0 0 1-5.6-5.6L5 11.8"/><path d="M4 4l16 16"/>'
|
|
532
1715
|
),
|
|
533
|
-
lineheight:
|
|
1716
|
+
lineheight: f(
|
|
534
1717
|
"M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"
|
|
535
1718
|
),
|
|
536
|
-
wordspacing:
|
|
1719
|
+
wordspacing: f(
|
|
537
1720
|
"M320-80 160-240l160-160 57 56-64 64h334l-63-64 56-56 160 160L640-80l-57-56 64-64H313l63 64-56 56ZM200-480v-400h80v400h-80Zm240 0v-400h80v400h-80Zm240 0v-400h80v400h-80Z"
|
|
538
1721
|
),
|
|
539
|
-
caseic:
|
|
1722
|
+
caseic: f(
|
|
540
1723
|
"m131-252 165-440h79l165 440h-76l-39-112H247l-40 112h-76Zm139-176h131l-64-182h-4l-63 182Zm395 186q-51 0-81-27.5T554-342q0-44 34.5-72.5T677-443q23 0 45 4t38 11v-12q0-29-20.5-47T685-505q-23 0-42 9.5T610-468l-47-35q24-29 54.5-43t68.5-14q69 0 103 32.5t34 97.5v178h-63v-37h-4q-14 23-38 35t-53 12Zm12-54q35 0 59.5-24t24.5-56q-14-8-33.5-12.5T689-393q-32 0-50 14t-18 37q0 20 16 33t40 13Z"
|
|
541
1724
|
),
|
|
542
|
-
uppercaseic:
|
|
1725
|
+
uppercaseic: f(
|
|
543
1726
|
"M660-240v-248l-64 64-56-56 160-160 160 160-56 56-64-64v248h-80Zm-540 0 165-440h79l165 440h-76l-39-113H236l-40 113h-76Zm139-177h131l-65-182h-4l-62 182Z"
|
|
544
1727
|
),
|
|
545
|
-
lowercaseic:
|
|
1728
|
+
lowercaseic: f(
|
|
546
1729
|
"M300-240q-51 0-81-27.5T189-340q0-44 34.5-72.5T312-441q23 0 45 4t38 11v-12q0-29-20.5-47T320-503q-23 0-42 9.5T245-466l-47-35q24-29 54.5-43t68.5-14q69 0 103 32.5t34 97.5v178h-63v-37h-4q-14 23-38 35t-53 12Zm12-54q35 0 59.5-24t24.5-56q-14-8-33.5-12.5T324-391q-32 0-50 14t-18 37q0 20 16 33t40 13Zm388 54L540-400l56-56 64 64v-248h80v248l64-64 56 56-160 160Z"
|
|
547
1730
|
),
|
|
548
|
-
capitalizeic:
|
|
1731
|
+
capitalizeic: f(
|
|
549
1732
|
"M344-250v-366H224v-64h308v64H412v366h-68Zm344 10q-44 0-69-25.5T594-336v-162h-54v-58h54v-87h66v87h74v58h-74v148q0 23 10.5 36t28.5 13q9 0 18.5-3.5T736-314v65q-10 5-22 7t-26 2Z"
|
|
550
1733
|
),
|
|
551
|
-
plus:
|
|
552
|
-
minus:
|
|
553
|
-
fontsizeup:
|
|
1734
|
+
plus: y('<path d="M12 5.5v13M5.5 12h13"/>'),
|
|
1735
|
+
minus: y('<path d="M5.5 12h13"/>'),
|
|
1736
|
+
fontsizeup: f(
|
|
554
1737
|
"m40-200 210-560h100l210 560h-96l-51-143H187l-51 143H40Zm176-224h168l-82-232h-4l-82 232Zm504 104v-120H600v-80h120v-120h80v120h120v80H800v120h-80Z"
|
|
555
1738
|
),
|
|
556
|
-
fontsizedown:
|
|
1739
|
+
fontsizedown: f(
|
|
557
1740
|
"m40-200 210-560h100l210 560h-96l-51-143H187l-51 143H40Zm176-224h168l-82-232h-4l-82 232Zm384-16v-80h320v80H600Z"
|
|
558
1741
|
),
|
|
559
|
-
historyic:
|
|
1742
|
+
historyic: f(
|
|
560
1743
|
"M480-120q-138 0-240.5-91.5T122-440h82q14 104 92.5 172T480-200q117 0 198.5-81.5T760-480q0-117-81.5-198.5T480-760q-69 0-129 32t-101 88h110v80H120v-240h80v94q51-64 124.5-99T480-840q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-480q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-120Zm112-192L440-464v-216h80v184l128 128-56 56Z"
|
|
561
1744
|
),
|
|
562
|
-
wordic:
|
|
1745
|
+
wordic: y(
|
|
563
1746
|
'<path d="M6 3h8l5 5v13H6z"/><path d="M14 3v5h5"/><text x="8" y="17" font-size="8.5" stroke="none" fill="#222f3e" font-family="Arial" font-weight="bold">W</text>'
|
|
564
1747
|
),
|
|
565
|
-
draftic:
|
|
1748
|
+
draftic: f(
|
|
566
1749
|
"M480-160q-134 0-227-93t-93-227q0-134 93-227t227-93q69 0 132 28.5T720-690v-110h80v280H520v-80h168q-32-56-87.5-88T480-720q-100 0-170 70t-70 170q0 100 70 170t170 70q77 0 139-44t87-116h84q-28 106-114 173t-196 67Z"
|
|
567
1750
|
),
|
|
568
|
-
trash:
|
|
1751
|
+
trash: y(
|
|
569
1752
|
'<path d="M5 7h14M10 7V5h4v2M7.5 7l1 13h7l1-13"/>'
|
|
570
1753
|
),
|
|
571
|
-
templateic:
|
|
1754
|
+
templateic: y(
|
|
572
1755
|
'<rect x="4" y="4" width="16" height="16" rx="1.5"/><rect x="6.5" y="6.5" width="5" height="5" rx=".5"/><path d="M14 7.5h3.5M14 10h3.5M6.5 14h11M6.5 17h11"/>'
|
|
573
1756
|
),
|
|
574
|
-
tplleft:
|
|
1757
|
+
tplleft: y(
|
|
575
1758
|
'<rect x="3" y="5" width="8" height="8" rx=".8"/><path d="M13.5 6.5H21M13.5 9.5H21M13.5 12.5H21M3 15.5h18M3 18.5h18"/>'
|
|
576
1759
|
),
|
|
577
|
-
tplright:
|
|
1760
|
+
tplright: y(
|
|
578
1761
|
'<rect x="13" y="5" width="8" height="8" rx=".8"/><path d="M3 6.5h7.5M3 9.5h7.5M3 12.5h7.5M3 15.5h18M3 18.5h18"/>'
|
|
579
1762
|
),
|
|
580
|
-
tpltop:
|
|
1763
|
+
tpltop: y(
|
|
581
1764
|
'<rect x="5" y="3" width="14" height="9" rx=".8"/><path d="M3 15h18M3 18h18M3 21h12"/>'
|
|
582
1765
|
),
|
|
583
|
-
tplcenter:
|
|
1766
|
+
tplcenter: y(
|
|
584
1767
|
'<path d="M3 4h18M3 7h18M3 10h12"/><rect x="5" y="12.5" width="14" height="9" rx=".8"/>'
|
|
585
1768
|
),
|
|
586
|
-
rotateleft:
|
|
1769
|
+
rotateleft: y(
|
|
587
1770
|
'<polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/>'
|
|
588
1771
|
),
|
|
589
|
-
rotateright:
|
|
1772
|
+
rotateright: y(
|
|
590
1773
|
'<polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>'
|
|
591
1774
|
),
|
|
592
|
-
fliphorizontal:
|
|
1775
|
+
fliphorizontal: y(
|
|
593
1776
|
'<path d="M12 3v18"/><path d="M7 8l-4 4 4 4"/><path d="M17 8l4 4-4 4"/>'
|
|
594
1777
|
),
|
|
595
|
-
flipvertical:
|
|
1778
|
+
flipvertical: y(
|
|
596
1779
|
'<path d="M3 12h18"/><path d="M8 7l4-4 4 4"/><path d="M8 17l4 4 4-4"/>'
|
|
597
1780
|
),
|
|
598
|
-
check:
|
|
599
|
-
palette:
|
|
1781
|
+
check: y('<path d="M5 12.5 9.5 17 19 7"/>'),
|
|
1782
|
+
palette: y(
|
|
600
1783
|
'<path d="M12 3a9 9 0 1 0 0 18h1.2a2 2 0 0 0 2-2 2 2 0 0 1 2-2H18a3 3 0 0 0 3-3c0-6.1-4.5-11-9-11z"/><circle class="f" cx="7.8" cy="10.2" r="1.3"/><circle class="f" cx="11.6" cy="7.3" r="1.3"/><circle class="f" cx="15.8" cy="9.6" r="1.3"/><circle class="f" cx="9" cy="14.8" r="1.3"/>'
|
|
601
1784
|
),
|
|
602
|
-
ul_circle:
|
|
1785
|
+
ul_circle: f(
|
|
603
1786
|
"M280-600v-80h560v80H280Zm0 160v-80h560v80H280Zm0 160v-80h560v80H280ZM160-600q-17 0-28.5-11.5T120-640q0-17 11.5-28.5T160-680q17 0 28.5 11.5T200-640q0 17-11.5 28.5T160-600Zm0 160q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520q17 0 28.5 11.5T200-480q0 17-11.5 28.5T160-440Zm0 160q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360q17 0 28.5 11.5T200-320q0 17-11.5 28.5T160-280Z"
|
|
604
1787
|
),
|
|
605
|
-
ul_square:
|
|
1788
|
+
ul_square: f(
|
|
606
1789
|
"M80-160v-160h160v160H80Zm240 0v-160h560v160H320ZM80-400v-160h160v160H80Zm240 0v-160h560v160H320ZM80-640v-160h160v160H80Zm240 0v-160h560v160H320Z"
|
|
607
1790
|
),
|
|
608
|
-
ol_alpha:
|
|
609
|
-
ol_roman:
|
|
610
|
-
ol_alphau:
|
|
611
|
-
ol_romanu:
|
|
612
|
-
|
|
1791
|
+
ol_alpha: q(["a", "b", "c"]),
|
|
1792
|
+
ol_roman: q(["i", "ii", "iii"], 6.5),
|
|
1793
|
+
ol_alphau: q(["A", "B", "C"]),
|
|
1794
|
+
ol_romanu: q(["I", "II", "III"], 6.5),
|
|
1795
|
+
video: y('<rect x="3" y="6" width="13" height="12" rx="1.5"/><path d="M16 10l5-3v10l-5-3z"/>'),
|
|
1796
|
+
editic: y('<path d="M4 20l1-4.5L15.5 5 19 8.5 8.5 19 4 20z"/><path d="M13.5 6.5l4 4"/>'),
|
|
1797
|
+
letterspacing: y(
|
|
1798
|
+
'<text x="2.5" y="13" font-size="12" stroke="none" fill="#222f3e" font-family="Arial" font-weight="bold">A</text><text x="13" y="13" font-size="12" stroke="none" fill="#222f3e" font-family="Arial" font-weight="bold">B</text><path d="M7 18.5h10"/><path class="f" d="M7.5 18.5 4.5 16.6v3.8z"/><path class="f" d="M16.5 18.5l3-1.9v3.8z"/>'
|
|
1799
|
+
),
|
|
1800
|
+
emojiic: y(
|
|
1801
|
+
'<circle cx="12" cy="12" r="8.5"/><path d="M8.6 14.3a4.6 4.6 0 0 0 6.8 0"/><path d="M9.2 9.6v.7M14.8 9.6v.7"/>'
|
|
1802
|
+
),
|
|
1803
|
+
inlinecodeic: y('<path d="M8.5 8 4.5 12l4 4M15.5 8l4 4-4 4"/><path d="M13 6l-2 12"/>'),
|
|
1804
|
+
moverowup: y('<rect x="4" y="15.5" width="16" height="5" rx="1"/><path d="M12 12.5V4M8.5 7.5 12 4l3.5 3.5"/>'),
|
|
1805
|
+
moverowdown: y('<rect x="4" y="3.5" width="16" height="5" rx="1"/><path d="M12 11.5V20M8.5 16.5 12 20l3.5-3.5"/>'),
|
|
1806
|
+
movecolleft: y('<rect x="15.5" y="4" width="5" height="16" rx="1"/><path d="M12.5 12H4M7.5 8.5 4 12l3.5 3.5"/>'),
|
|
1807
|
+
movecolright: y('<rect x="3.5" y="4" width="5" height="16" rx="1"/><path d="M11.5 12H20M16.5 8.5 20 12l-3.5 3.5"/>'),
|
|
1808
|
+
codesampleic: y(
|
|
1809
|
+
'<rect x="3.5" y="4" width="17" height="16" rx="2"/><path d="M3.5 8.5h17"/><path d="M9.5 12 7 14.25l2.5 2.25M14.5 12l2.5 2.25-2.5 2.25"/>'
|
|
1810
|
+
)
|
|
1811
|
+
}, Nt = (p) => `<span class="txt">${p}</span>`, pt = /* @__PURE__ */ new Set([
|
|
613
1812
|
"p",
|
|
614
1813
|
"div",
|
|
615
1814
|
"span",
|
|
@@ -651,7 +1850,7 @@ const X = "undo redo | preview print | importword revhistory | fontfamily fontsi
|
|
|
651
1850
|
"figure",
|
|
652
1851
|
"figcaption",
|
|
653
1852
|
"mark"
|
|
654
|
-
]),
|
|
1853
|
+
]), mt = /* @__PURE__ */ new Set([
|
|
655
1854
|
"text-align",
|
|
656
1855
|
"direction",
|
|
657
1856
|
"unicode-bidi",
|
|
@@ -707,7 +1906,7 @@ const X = "undo redo | preview print | importword revhistory | fontfamily fontsi
|
|
|
707
1906
|
"box-sizing",
|
|
708
1907
|
"list-style-type",
|
|
709
1908
|
"white-space"
|
|
710
|
-
]),
|
|
1909
|
+
]), W = {
|
|
711
1910
|
"*": ["dir", "lang", "colspan", "rowspan"],
|
|
712
1911
|
a: ["href", "target", "rel", "title"],
|
|
713
1912
|
img: ["src", "alt", "width", "height", "title"],
|
|
@@ -716,20 +1915,20 @@ const X = "undo redo | preview print | importword revhistory | fontfamily fontsi
|
|
|
716
1915
|
th: ["width", "valign"],
|
|
717
1916
|
table: ["width", "cellpadding", "cellspacing"]
|
|
718
1917
|
};
|
|
719
|
-
function
|
|
1918
|
+
function D(p) {
|
|
720
1919
|
const t = {}, e = p.getAttribute && p.getAttribute("style");
|
|
721
1920
|
return e && e.split(";").forEach((i) => {
|
|
722
1921
|
const s = i.indexOf(":");
|
|
723
1922
|
s < 1 || (t[i.slice(0, s).trim().toLowerCase()] = i.slice(s + 1).trim());
|
|
724
1923
|
}), t;
|
|
725
1924
|
}
|
|
726
|
-
function
|
|
1925
|
+
function ut(p) {
|
|
727
1926
|
return p.replace(/<!--\[if !supportLists\]-->([\s\S]*?)<!--\[endif\]-->/gi, "$1").replace(/<!--\[if !supportLists\]>([\s\S]*?)<!\[endif\]-->/gi, "$1").replace(/<!\[if !supportLists\]>([\s\S]*?)<!\[endif\]>/gi, "$1").replace(/<!--\[if [\s\S]*?<!\[endif\]-->/gi, "").replace(/<!--[\s\S]*?-->/g, "").replace(/<(script|style|xml|title)[\s\S]*?<\/\1>/gi, "").replace(/<\/?(meta|link)[^>]*>/gi, "").replace(/<\?xml[\s\S]*?\?>/gi, "").replace(/<\/?(o|v|w|m|st1):[^>]*>/gi, "");
|
|
728
1927
|
}
|
|
729
|
-
function
|
|
1928
|
+
function gt(p) {
|
|
730
1929
|
return /^[0-9]+[\.\)،]/.test(p) ? { ordered: !0 } : /^[٠-٩۰-۹]+/.test(p) ? { ordered: !0, style: "arabic-indic" } : /^[ivxlc]{2,}[\.\)]/.test(p) ? { ordered: !0, style: "lower-roman" } : /^[IVXLC]{2,}[\.\)]/.test(p) ? { ordered: !0, style: "upper-roman" } : /^[a-z][\.\)]/.test(p) ? { ordered: !0, style: "lower-alpha" } : /^[A-Z][\.\)]/.test(p) ? { ordered: !0, style: "upper-alpha" } : /^[ء-ي][\.\)،-]/.test(p) ? { ordered: !0, style: "arabic-indic" } : { ordered: !1 };
|
|
731
1930
|
}
|
|
732
|
-
function
|
|
1931
|
+
function ft(p) {
|
|
733
1932
|
const t = (s) => {
|
|
734
1933
|
const l = (s.getAttribute("style") || "") + " " + (s.className || "");
|
|
735
1934
|
return /mso-list\s*:(?!\s*ignore)/i.test(l) || /MsoListParagraph/i.test(l);
|
|
@@ -743,38 +1942,38 @@ function rt(p) {
|
|
|
743
1942
|
const l = s.previousElementSibling;
|
|
744
1943
|
i && l && i[i.length - 1] === l ? i.push(s) : (i = [s], e.push(i));
|
|
745
1944
|
}), e.forEach((s) => {
|
|
746
|
-
const l = [],
|
|
747
|
-
s.forEach((
|
|
748
|
-
var
|
|
749
|
-
const
|
|
750
|
-
(
|
|
751
|
-
), d = h ? ((
|
|
752
|
-
for (h && h.remove(); l.length && l[l.length - 1].level >
|
|
753
|
-
if (!l.length || l[l.length - 1].level <
|
|
754
|
-
const
|
|
755
|
-
if (m && g && (
|
|
756
|
-
const
|
|
757
|
-
(
|
|
1945
|
+
const l = [], o = s[0];
|
|
1946
|
+
s.forEach((n) => {
|
|
1947
|
+
var x, C, M;
|
|
1948
|
+
const a = +(((x = (n.getAttribute("style") || "").match(/level(\d+)/i)) == null ? void 0 : x[1]) || 1), h = Array.from(n.querySelectorAll("span")).find(
|
|
1949
|
+
(w) => /mso-list\s*:\s*ignore/i.test(w.getAttribute("style") || "")
|
|
1950
|
+
), d = h ? ((C = h.textContent) == null ? void 0 : C.trim()) || "" : (((M = n.textContent) == null ? void 0 : M.trim().match(/^\S{1,4}/)) || [""])[0], { ordered: m, style: g } = gt(d);
|
|
1951
|
+
for (h && h.remove(); l.length && l[l.length - 1].level > a; ) l.pop();
|
|
1952
|
+
if (!l.length || l[l.length - 1].level < a) {
|
|
1953
|
+
const w = p.createElement(m ? "ol" : "ul");
|
|
1954
|
+
if (m && g && (w.style.listStyleType = g), l.length) {
|
|
1955
|
+
const k = l[l.length - 1].list;
|
|
1956
|
+
(k.lastElementChild || k).appendChild(w);
|
|
758
1957
|
} else
|
|
759
|
-
|
|
760
|
-
l.push({ list:
|
|
1958
|
+
o.parentNode.insertBefore(w, o);
|
|
1959
|
+
l.push({ list: w, level: a });
|
|
761
1960
|
}
|
|
762
|
-
const
|
|
763
|
-
for (
|
|
764
|
-
l[l.length - 1].list.appendChild(
|
|
1961
|
+
const u = p.createElement("li"), v = D(n), b = ["text-align", "direction", "unicode-bidi", "color", "font-size", "font-family", "background-color"].filter((w) => v[w]).map((w) => w + ":" + v[w]).join(";");
|
|
1962
|
+
for (b && u.setAttribute("style", b), n.getAttribute("dir") && u.setAttribute("dir", n.getAttribute("dir")); n.firstChild; ) u.appendChild(n.firstChild);
|
|
1963
|
+
l[l.length - 1].list.appendChild(u), n.remove();
|
|
765
1964
|
});
|
|
766
1965
|
});
|
|
767
1966
|
}
|
|
768
|
-
function
|
|
1967
|
+
function vt(p) {
|
|
769
1968
|
p.querySelectorAll('b[id^="docs-internal-guid"]').forEach((t) => {
|
|
770
1969
|
for (; t.firstChild; ) t.parentNode.insertBefore(t.firstChild, t);
|
|
771
1970
|
t.remove();
|
|
772
1971
|
});
|
|
773
1972
|
}
|
|
774
|
-
function
|
|
1973
|
+
function bt(p) {
|
|
775
1974
|
p.querySelectorAll("table").forEach((t) => {
|
|
776
1975
|
const e = t;
|
|
777
|
-
|
|
1976
|
+
D(e)["border-collapse"] || (e.style.borderCollapse = "collapse");
|
|
778
1977
|
}), p.querySelectorAll("[align]").forEach((t) => {
|
|
779
1978
|
const e = t, i = e.getAttribute("align").toLowerCase();
|
|
780
1979
|
e.tagName.toLowerCase() === "table" ? i === "center" ? (e.style.marginLeft = e.style.marginLeft || "auto", e.style.marginRight = e.style.marginRight || "auto") : i === "right" ? e.style.marginLeft = e.style.marginLeft || "auto" : i === "left" && (e.style.marginRight = e.style.marginRight || "auto") : ["left", "right", "center", "justify"].includes(i) && (e.style.textAlign = e.style.textAlign || i, Array.from(e.children).forEach((s) => {
|
|
@@ -790,7 +1989,7 @@ function ct(p) {
|
|
|
790
1989
|
e.style.backgroundColor = e.style.backgroundColor || e.getAttribute("bgcolor"), e.removeAttribute("bgcolor");
|
|
791
1990
|
});
|
|
792
1991
|
}
|
|
793
|
-
function
|
|
1992
|
+
function N(p, t) {
|
|
794
1993
|
Array.from(p.childNodes).forEach((e) => {
|
|
795
1994
|
if (e.nodeType === Node.COMMENT_NODE) {
|
|
796
1995
|
e.remove();
|
|
@@ -798,12 +1997,12 @@ function q(p, t) {
|
|
|
798
1997
|
}
|
|
799
1998
|
if (e.nodeType !== Node.ELEMENT_NODE) return;
|
|
800
1999
|
const i = e, s = i.tagName.toLowerCase();
|
|
801
|
-
if (!
|
|
2000
|
+
if (!pt.has(s)) {
|
|
802
2001
|
if (s === "font") {
|
|
803
2002
|
const r = t.createElement("span");
|
|
804
2003
|
i.getAttribute("style") && r.setAttribute("style", i.getAttribute("style")), i.getAttribute("color") && (r.style.color = i.getAttribute("color")), i.getAttribute("face") && (r.style.fontFamily = i.getAttribute("face"));
|
|
805
|
-
const
|
|
806
|
-
if (
|
|
2004
|
+
const a = i.getAttribute("size");
|
|
2005
|
+
if (a && !r.style.fontSize) {
|
|
807
2006
|
const h = {
|
|
808
2007
|
1: "8pt",
|
|
809
2008
|
2: "10pt",
|
|
@@ -813,20 +2012,20 @@ function q(p, t) {
|
|
|
813
2012
|
6: "24pt",
|
|
814
2013
|
7: "36pt"
|
|
815
2014
|
};
|
|
816
|
-
h[
|
|
2015
|
+
h[a] && (r.style.fontSize = h[a]);
|
|
817
2016
|
}
|
|
818
2017
|
for (; i.firstChild; ) r.appendChild(i.firstChild);
|
|
819
|
-
i.replaceWith(r),
|
|
2018
|
+
i.replaceWith(r), N(r, t);
|
|
820
2019
|
return;
|
|
821
2020
|
}
|
|
822
|
-
for (
|
|
2021
|
+
for (N(i, t); i.firstChild; ) i.parentNode.insertBefore(i.firstChild, i);
|
|
823
2022
|
i.remove();
|
|
824
2023
|
return;
|
|
825
2024
|
}
|
|
826
|
-
const l = /* @__PURE__ */ new Set([...
|
|
2025
|
+
const l = /* @__PURE__ */ new Set([...W["*"] || [], ...W[s] || []]);
|
|
827
2026
|
if (Array.from(i.attributes).forEach((r) => {
|
|
828
|
-
const
|
|
829
|
-
|
|
2027
|
+
const a = r.name.toLowerCase();
|
|
2028
|
+
a !== "style" && !l.has(a) && i.removeAttribute(r.name);
|
|
830
2029
|
}), s === "a") {
|
|
831
2030
|
const r = i.getAttribute("href") || "";
|
|
832
2031
|
/^(https?:|mailto:|tel:|#)/i.test(r) || i.removeAttribute("href");
|
|
@@ -834,39 +2033,39 @@ function q(p, t) {
|
|
|
834
2033
|
if (s === "img") {
|
|
835
2034
|
const r = i.getAttribute("src") || "";
|
|
836
2035
|
if (!/^(https?:|data:image\/|blob:)/i.test(r)) {
|
|
837
|
-
const
|
|
838
|
-
|
|
2036
|
+
const a = t.createElement("span");
|
|
2037
|
+
a.textContent = "[local image — paste it separately]", a.setAttribute("style", "color:#a33;font-style:italic;font-size:12px"), i.replaceWith(a);
|
|
839
2038
|
return;
|
|
840
2039
|
}
|
|
841
2040
|
}
|
|
842
|
-
const
|
|
843
|
-
for (const [r,
|
|
844
|
-
|
|
845
|
-
if (
|
|
2041
|
+
const o = D(i), n = [];
|
|
2042
|
+
for (const [r, a] of Object.entries(o))
|
|
2043
|
+
mt.has(r) && (/expression|javascript|url\s*\(\s*['"]?\s*file:/i.test(a) || r === "font-weight" && /^(400|normal)$/i.test(a) || r === "font-style" && /^normal$/i.test(a) || r === "text-decoration" && /^none$/i.test(a) || n.push(r + ":" + a));
|
|
2044
|
+
if (n.length ? i.setAttribute("style", n.join(";")) : i.removeAttribute("style"), i.removeAttribute("class"), N(i, t), s === "span" && !i.attributes.length) {
|
|
846
2045
|
for (; i.firstChild; ) i.parentNode.insertBefore(i.firstChild, i);
|
|
847
2046
|
i.remove();
|
|
848
2047
|
}
|
|
849
2048
|
});
|
|
850
2049
|
}
|
|
851
|
-
function
|
|
2050
|
+
function yt(p) {
|
|
852
2051
|
const t = [], e = /<style[^>]*>([\s\S]*?)<\/style>/gi;
|
|
853
2052
|
let i;
|
|
854
2053
|
for (; i = e.exec(p); ) {
|
|
855
2054
|
let s = i[1].replace(/<!--|-->/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
856
2055
|
s = s.replace(/@media[^{]*\{(?:[^{}]*\{[^{}]*\})*[^{}]*\}/gi, ""), s = s.replace(/@[\w-]+[^{]*\{[^{}]*\}/g, "");
|
|
857
2056
|
let l;
|
|
858
|
-
const
|
|
859
|
-
for (; l =
|
|
860
|
-
const
|
|
861
|
-
const
|
|
862
|
-
return
|
|
2057
|
+
const o = /([^{}]+)\{([^}]*)\}/g;
|
|
2058
|
+
for (; l = o.exec(s); ) {
|
|
2059
|
+
const n = l[2].split(";").map((r) => {
|
|
2060
|
+
const a = r.indexOf(":");
|
|
2061
|
+
return a < 1 ? null : [r.slice(0, a).trim().toLowerCase(), r.slice(a + 1).trim()];
|
|
863
2062
|
}).filter((r) => !!r && !!r[1]);
|
|
864
|
-
|
|
2063
|
+
n.length && l[1].split(",").map((r) => r.trim()).filter((r) => r && !r.startsWith("@")).forEach((r) => t.push({ sel: r, decls: n }));
|
|
865
2064
|
}
|
|
866
2065
|
}
|
|
867
2066
|
return t;
|
|
868
2067
|
}
|
|
869
|
-
function
|
|
2068
|
+
function xt(p, t) {
|
|
870
2069
|
if (!t.length) return;
|
|
871
2070
|
const e = /* @__PURE__ */ new Map();
|
|
872
2071
|
t.forEach(({ sel: i, decls: s }) => {
|
|
@@ -876,88 +2075,88 @@ function dt(p, t) {
|
|
|
876
2075
|
} catch {
|
|
877
2076
|
return;
|
|
878
2077
|
}
|
|
879
|
-
l.forEach((
|
|
880
|
-
let
|
|
881
|
-
|
|
882
|
-
|
|
2078
|
+
l.forEach((o) => {
|
|
2079
|
+
let n = e.get(o);
|
|
2080
|
+
n || (n = {}, e.set(o, n)), s.forEach(([r, a]) => {
|
|
2081
|
+
n[r] = a;
|
|
883
2082
|
});
|
|
884
2083
|
});
|
|
885
2084
|
}), e.forEach((i, s) => {
|
|
886
|
-
const l =
|
|
2085
|
+
const l = D(s), o = s.hasAttribute("dir"), n = s.hasAttribute("align"), r = Object.entries(i).filter(([d]) => !(d in l || (d === "direction" || d === "unicode-bidi") && o || d === "text-align" && (n || o) || (d === "background" || d === "background-color") && s.hasAttribute("bgcolor")));
|
|
887
2086
|
if (!r.length) return;
|
|
888
|
-
const
|
|
889
|
-
s.setAttribute("style", h ?
|
|
2087
|
+
const a = r.map(([d, m]) => d + ":" + m).join(";"), h = s.getAttribute("style");
|
|
2088
|
+
s.setAttribute("style", h ? a + ";" + h : a);
|
|
890
2089
|
});
|
|
891
2090
|
}
|
|
892
|
-
function
|
|
2091
|
+
function Y(p) {
|
|
893
2092
|
return p.replace(/[ﭐ-﷿ﹰ-ﻼ]+/g, (t) => t.normalize("NFKC"));
|
|
894
2093
|
}
|
|
895
|
-
function
|
|
2094
|
+
function Ct(p) {
|
|
896
2095
|
const t = p.createTreeWalker(p.body, NodeFilter.SHOW_TEXT, null);
|
|
897
2096
|
let e;
|
|
898
2097
|
for (; e = t.nextNode(); )
|
|
899
|
-
/[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue =
|
|
2098
|
+
/[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue = Y(e.nodeValue || ""));
|
|
900
2099
|
}
|
|
901
|
-
function
|
|
902
|
-
const e =
|
|
903
|
-
|
|
2100
|
+
function wt(p, t = "ltr") {
|
|
2101
|
+
const e = yt(p), i = new DOMParser().parseFromString(ut(p), "text/html");
|
|
2102
|
+
xt(i, e), /class="?Mso|mso-|urn:schemas-microsoft-com/i.test(i.body.innerHTML) && ft(i), vt(i), bt(i), N(i.body, i), Ct(i);
|
|
904
2103
|
const s = (l) => {
|
|
905
|
-
var
|
|
906
|
-
return l && l.tagName === "P" && !((
|
|
2104
|
+
var o;
|
|
2105
|
+
return l && l.tagName === "P" && !((o = l.textContent) != null && o.trim()) && !l.querySelector("img,table");
|
|
907
2106
|
};
|
|
908
2107
|
for (; s(i.body.firstElementChild); ) i.body.firstElementChild.remove();
|
|
909
2108
|
for (; s(i.body.lastElementChild); ) i.body.lastElementChild.remove();
|
|
910
2109
|
return i.body.innerHTML.trim();
|
|
911
2110
|
}
|
|
912
|
-
function
|
|
913
|
-
const t =
|
|
2111
|
+
function Tt(p) {
|
|
2112
|
+
const t = Y(p).replace(/\r/g, ""), e = (i) => i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
914
2113
|
return /\n/.test(t) ? t.split(/\n{2,}/).map((i) => `<p dir="auto">${e(i).replace(/\n/g, "<br>") || "<br>"}</p>`).join("") : e(t);
|
|
915
2114
|
}
|
|
916
|
-
function
|
|
2115
|
+
function Mt(p) {
|
|
917
2116
|
const t = new DataView(p), e = /* @__PURE__ */ new Map();
|
|
918
2117
|
let i = -1;
|
|
919
|
-
for (let
|
|
920
|
-
if (t.getUint32(
|
|
921
|
-
i =
|
|
2118
|
+
for (let n = p.byteLength - 22; n >= Math.max(0, p.byteLength - 22 - 65535); n--)
|
|
2119
|
+
if (t.getUint32(n, !0) === 101010256) {
|
|
2120
|
+
i = n;
|
|
922
2121
|
break;
|
|
923
2122
|
}
|
|
924
2123
|
if (i < 0) throw new Error("EOCD not found");
|
|
925
2124
|
const s = t.getUint16(i + 10, !0);
|
|
926
2125
|
let l = t.getUint32(i + 16, !0);
|
|
927
|
-
const
|
|
928
|
-
for (let
|
|
929
|
-
const r = t.getUint16(l + 10, !0),
|
|
930
|
-
e.set(
|
|
2126
|
+
const o = new TextDecoder();
|
|
2127
|
+
for (let n = 0; n < s && t.getUint32(l, !0) === 33639248; n++) {
|
|
2128
|
+
const r = t.getUint16(l + 10, !0), a = t.getUint32(l + 20, !0), h = t.getUint16(l + 28, !0), d = t.getUint16(l + 30, !0), m = t.getUint16(l + 32, !0), g = t.getUint32(l + 42, !0), u = o.decode(new Uint8Array(p, l + 46, h));
|
|
2129
|
+
e.set(u, { name: u, method: r, compSize: a, localOffset: g }), l += 46 + h + d + m;
|
|
931
2130
|
}
|
|
932
2131
|
return e;
|
|
933
2132
|
}
|
|
934
|
-
async function
|
|
2133
|
+
async function U(p, t) {
|
|
935
2134
|
const e = new DataView(p, t.localOffset);
|
|
936
2135
|
if (e.getUint32(0, !0) !== 67324752) throw new Error("Bad local header");
|
|
937
|
-
const i = e.getUint16(26, !0), s = e.getUint16(28, !0), l = t.localOffset + 30 + i + s,
|
|
938
|
-
if (t.method === 0) return
|
|
2136
|
+
const i = e.getUint16(26, !0), s = e.getUint16(28, !0), l = t.localOffset + 30 + i + s, o = new Uint8Array(p.slice(l, l + t.compSize));
|
|
2137
|
+
if (t.method === 0) return o;
|
|
939
2138
|
if (t.method !== 8) throw new Error("Unsupported compression method " + t.method);
|
|
940
|
-
const
|
|
941
|
-
return new Uint8Array(await new Response(
|
|
2139
|
+
const n = new Blob([o]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
|
|
2140
|
+
return new Uint8Array(await new Response(n).arrayBuffer());
|
|
942
2141
|
}
|
|
943
|
-
const
|
|
2142
|
+
const j = (p) => p.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), P = (p, t) => Array.from(p.children).filter((e) => e.localName === t), S = (p, ...t) => {
|
|
944
2143
|
let e = p;
|
|
945
2144
|
for (const i of t) {
|
|
946
2145
|
if (!e) return null;
|
|
947
2146
|
e = Array.from(e.children).find((s) => s.localName === i) || null;
|
|
948
2147
|
}
|
|
949
2148
|
return e;
|
|
950
|
-
},
|
|
2149
|
+
}, T = (p, t = "val") => {
|
|
951
2150
|
if (!p) return "";
|
|
952
2151
|
for (const e of Array.from(p.attributes))
|
|
953
2152
|
if (e.localName === t) return e.value;
|
|
954
2153
|
return "";
|
|
955
|
-
},
|
|
956
|
-
const e = p ?
|
|
2154
|
+
}, Z = (p, t) => {
|
|
2155
|
+
const e = p ? S(p, t) : null;
|
|
957
2156
|
if (!e) return !1;
|
|
958
|
-
const i =
|
|
2157
|
+
const i = T(e);
|
|
959
2158
|
return i !== "false" && i !== "0";
|
|
960
|
-
},
|
|
2159
|
+
}, X = {
|
|
961
2160
|
yellow: "#FFFF00",
|
|
962
2161
|
green: "#00FF00",
|
|
963
2162
|
cyan: "#00FFFF",
|
|
@@ -974,7 +2173,7 @@ const F = (p) => p.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "&
|
|
|
974
2173
|
lightGray: "#D3D3D3",
|
|
975
2174
|
black: "#000000",
|
|
976
2175
|
white: "#FFFFFF"
|
|
977
|
-
},
|
|
2176
|
+
}, St = {
|
|
978
2177
|
png: "image/png",
|
|
979
2178
|
jpg: "image/jpeg",
|
|
980
2179
|
jpeg: "image/jpeg",
|
|
@@ -982,13 +2181,13 @@ const F = (p) => p.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "&
|
|
|
982
2181
|
bmp: "image/bmp",
|
|
983
2182
|
webp: "image/webp"
|
|
984
2183
|
};
|
|
985
|
-
function
|
|
2184
|
+
function Et(p) {
|
|
986
2185
|
let t = "";
|
|
987
2186
|
for (let e = 0; e < p.length; e += 32768)
|
|
988
2187
|
t += String.fromCharCode(...p.subarray(e, e + 32768));
|
|
989
2188
|
return btoa(t);
|
|
990
2189
|
}
|
|
991
|
-
class
|
|
2190
|
+
class Lt {
|
|
992
2191
|
constructor(t, e, i) {
|
|
993
2192
|
this.rels = t, this.images = e, this.numFmt = i;
|
|
994
2193
|
}
|
|
@@ -999,12 +2198,12 @@ class bt {
|
|
|
999
2198
|
};
|
|
1000
2199
|
for (const l of Array.from(t.children))
|
|
1001
2200
|
if (l.localName === "p") {
|
|
1002
|
-
const
|
|
1003
|
-
if (
|
|
1004
|
-
const
|
|
1005
|
-
for (; i.length >
|
|
1006
|
-
for (i.length ===
|
|
1007
|
-
e += `<${
|
|
2201
|
+
const o = this.paraList(l);
|
|
2202
|
+
if (o) {
|
|
2203
|
+
const n = o.ilvl + 1;
|
|
2204
|
+
for (; i.length > n; ) e += `</${i.pop()}>`;
|
|
2205
|
+
for (i.length === n && i[n - 1] !== o.type && (e += `</${i.pop()}>`); i.length < n; )
|
|
2206
|
+
e += `<${o.type}>`, i.push(o.type);
|
|
1008
2207
|
e += `<li>${this.runsOf(l) || "<br>"}</li>`;
|
|
1009
2208
|
continue;
|
|
1010
2209
|
}
|
|
@@ -1013,145 +2212,178 @@ class bt {
|
|
|
1013
2212
|
return s(0), e || "<p><br></p>";
|
|
1014
2213
|
}
|
|
1015
2214
|
paraList(t) {
|
|
1016
|
-
const e =
|
|
2215
|
+
const e = S(t, "pPr", "numPr");
|
|
1017
2216
|
if (!e) return null;
|
|
1018
|
-
const i =
|
|
2217
|
+
const i = T(S(e, "numId"));
|
|
1019
2218
|
if (!i || i === "0") return null;
|
|
1020
|
-
const s = parseInt(
|
|
2219
|
+
const s = parseInt(T(S(e, "ilvl")) || "0", 10) || 0;
|
|
1021
2220
|
return { type: this.numFmt.get(i) || "ul", ilvl: Math.min(s, 8) };
|
|
1022
2221
|
}
|
|
1023
2222
|
convertPara(t) {
|
|
1024
|
-
const e =
|
|
2223
|
+
const e = S(t, "pPr"), i = T(S(t, "pPr", "pStyle"));
|
|
1025
2224
|
let s = "p";
|
|
1026
2225
|
const l = /^Heading([1-6])$/i.exec(i);
|
|
1027
2226
|
l ? s = "h" + l[1] : /^Title$/i.test(i) && (s = "h1");
|
|
1028
|
-
const
|
|
1029
|
-
|
|
1030
|
-
const r = this.runsOf(t),
|
|
1031
|
-
return `<${s}${
|
|
2227
|
+
const o = [], n = T(S(t, "pPr", "jc"));
|
|
2228
|
+
n === "center" ? o.push("text-align:center") : n === "right" || n === "end" ? o.push("text-align:right") : (n === "both" || n === "distribute") && o.push("text-align:justify"), e && S(e, "bidi") && o.push("direction:rtl");
|
|
2229
|
+
const r = this.runsOf(t), a = o.length ? ` style="${o.join(";")}"` : "";
|
|
2230
|
+
return `<${s}${a}>${r || "<br>"}</${s}>`;
|
|
1032
2231
|
}
|
|
1033
2232
|
runsOf(t) {
|
|
1034
2233
|
let e = "";
|
|
1035
2234
|
for (const i of Array.from(t.children))
|
|
1036
2235
|
if (i.localName === "r") e += this.convertRun(i);
|
|
1037
2236
|
else if (i.localName === "hyperlink") {
|
|
1038
|
-
let s = this.rels.get(
|
|
1039
|
-
const l =
|
|
2237
|
+
let s = this.rels.get(T(i, "id")) || "";
|
|
2238
|
+
const l = T(i, "anchor");
|
|
1040
2239
|
!s && l && (s = "#" + l);
|
|
1041
|
-
const
|
|
1042
|
-
e += s ? `<a href="${
|
|
2240
|
+
const o = this.runsOf(i);
|
|
2241
|
+
e += s ? `<a href="${j(s)}">${o}</a>` : o;
|
|
1043
2242
|
} else (i.localName === "smartTag" || i.localName === "ins") && (e += this.runsOf(i));
|
|
1044
2243
|
return e;
|
|
1045
2244
|
}
|
|
1046
2245
|
convertRun(t) {
|
|
1047
|
-
const e =
|
|
2246
|
+
const e = S(t, "rPr");
|
|
1048
2247
|
let i = "";
|
|
1049
2248
|
for (const d of Array.from(t.children))
|
|
1050
|
-
d.localName === "t" ? i +=
|
|
2249
|
+
d.localName === "t" ? i += j(d.textContent || "") : d.localName === "br" || d.localName === "cr" ? i += "<br>" : d.localName === "tab" ? i += " " : (d.localName === "drawing" || d.localName === "pict" || d.localName === "object") && (i += this.convertImage(d));
|
|
1051
2250
|
if (!i) return "";
|
|
1052
|
-
const s = [], l =
|
|
2251
|
+
const s = [], l = T(e ? S(e, "color") : null);
|
|
1053
2252
|
l && l !== "auto" && s.push("color:#" + l);
|
|
1054
|
-
const
|
|
1055
|
-
|
|
1056
|
-
const
|
|
1057
|
-
|
|
1058
|
-
const r = e ?
|
|
1059
|
-
|
|
1060
|
-
const h =
|
|
2253
|
+
const o = T(e ? S(e, "highlight") : null);
|
|
2254
|
+
o && X[o] && s.push("background-color:" + X[o]);
|
|
2255
|
+
const n = parseFloat(T(e ? S(e, "sz") : null));
|
|
2256
|
+
n && s.push("font-size:" + Math.round(n / 2 * (4 / 3)) + "px");
|
|
2257
|
+
const r = e ? S(e, "rFonts") : null, a = T(r, "ascii") || T(r, "cs");
|
|
2258
|
+
a && s.push(`font-family:'${a}'`), s.length && (i = `<span style="${s.join(";")}">${i}</span>`), Z(e, "b") && (i = `<strong>${i}</strong>`), Z(e, "i") && (i = `<em>${i}</em>`), Z(e, "u") && T(S(e, "u")) !== "none" && (i = `<u>${i}</u>`), Z(e, "strike") && (i = `<s>${i}</s>`);
|
|
2259
|
+
const h = T(e ? S(e, "vertAlign") : null);
|
|
1061
2260
|
return h === "superscript" ? i = `<sup>${i}</sup>` : h === "subscript" && (i = `<sub>${i}</sub>`), i;
|
|
1062
2261
|
}
|
|
1063
2262
|
convertImage(t) {
|
|
1064
2263
|
let e = "", i = 0;
|
|
1065
|
-
const s = (
|
|
1066
|
-
if (
|
|
1067
|
-
const r = parseFloat(
|
|
2264
|
+
const s = (n) => {
|
|
2265
|
+
if (n.localName === "blip" && (e = e || T(n, "embed") || T(n, "link")), n.localName === "imagedata" && (e = e || T(n, "id")), n.localName === "extent") {
|
|
2266
|
+
const r = parseFloat(n.getAttribute("cx") || "0");
|
|
1068
2267
|
r && (i = Math.round(r / 9525));
|
|
1069
2268
|
}
|
|
1070
|
-
for (const r of Array.from(
|
|
2269
|
+
for (const r of Array.from(n.children)) s(r);
|
|
1071
2270
|
};
|
|
1072
2271
|
if (s(t), !e) return "";
|
|
1073
2272
|
const l = this.images.get(e);
|
|
1074
2273
|
if (!l) return "";
|
|
1075
|
-
const
|
|
1076
|
-
return `<img src="${l}" alt=""${
|
|
2274
|
+
const o = i ? ` width="${i}"` : "";
|
|
2275
|
+
return `<img src="${l}" alt=""${o}>`;
|
|
1077
2276
|
}
|
|
1078
2277
|
convertTable(t) {
|
|
1079
2278
|
let e = '<table style="border-collapse:collapse;width:100%"><tbody>';
|
|
1080
|
-
for (const i of
|
|
2279
|
+
for (const i of P(t, "tr")) {
|
|
1081
2280
|
e += "<tr>";
|
|
1082
|
-
for (const s of
|
|
1083
|
-
const l = parseInt(
|
|
1084
|
-
let
|
|
2281
|
+
for (const s of P(i, "tc")) {
|
|
2282
|
+
const l = parseInt(T(S(s, "tcPr", "gridSpan")) || "1", 10) || 1, o = l > 1 ? ` colspan="${l}"` : "";
|
|
2283
|
+
let n = "";
|
|
1085
2284
|
for (const r of Array.from(s.children))
|
|
1086
|
-
r.localName === "p" ?
|
|
1087
|
-
e += `<td style="border:1px solid #b9c2cc"${
|
|
2285
|
+
r.localName === "p" ? n += this.convertPara(r) : r.localName === "tbl" && (n += this.convertTable(r));
|
|
2286
|
+
e += `<td style="border:1px solid #b9c2cc"${o}>${n || "<br>"}</td>`;
|
|
1088
2287
|
}
|
|
1089
2288
|
e += "</tr>";
|
|
1090
2289
|
}
|
|
1091
2290
|
return e + "</tbody></table>";
|
|
1092
2291
|
}
|
|
1093
2292
|
}
|
|
1094
|
-
async function
|
|
1095
|
-
const t = p instanceof ArrayBuffer ? p : await p.arrayBuffer(), e =
|
|
1096
|
-
const v = e.get(
|
|
1097
|
-
return v ? new DOMParser().parseFromString(i.decode(await
|
|
1098
|
-
}, l = await s("word/document.xml"),
|
|
1099
|
-
let
|
|
1100
|
-
if (
|
|
1101
|
-
for (const
|
|
1102
|
-
if (
|
|
1103
|
-
|
|
2293
|
+
async function Ht(p) {
|
|
2294
|
+
const t = p instanceof ArrayBuffer ? p : await p.arrayBuffer(), e = Mt(t), i = new TextDecoder(), s = async (u) => {
|
|
2295
|
+
const v = e.get(u);
|
|
2296
|
+
return v ? new DOMParser().parseFromString(i.decode(await U(t, v)), "application/xml") : null;
|
|
2297
|
+
}, l = await s("word/document.xml"), o = l == null ? void 0 : l.getElementsByTagName("*");
|
|
2298
|
+
let n = null;
|
|
2299
|
+
if (o) {
|
|
2300
|
+
for (const u of Array.from(o))
|
|
2301
|
+
if (u.localName === "body") {
|
|
2302
|
+
n = u;
|
|
1104
2303
|
break;
|
|
1105
2304
|
}
|
|
1106
2305
|
}
|
|
1107
|
-
if (!
|
|
1108
|
-
const r = /* @__PURE__ */ new Map(),
|
|
2306
|
+
if (!n) throw new Error("word/document.xml missing or invalid");
|
|
2307
|
+
const r = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), h = await s("word/_rels/document.xml.rels");
|
|
1109
2308
|
if (h)
|
|
1110
|
-
for (const
|
|
1111
|
-
if (
|
|
1112
|
-
const v =
|
|
1113
|
-
/hyperlink/i.test(
|
|
2309
|
+
for (const u of Array.from(h.getElementsByTagName("*"))) {
|
|
2310
|
+
if (u.localName !== "Relationship") continue;
|
|
2311
|
+
const v = u.getAttribute("Id") || "", b = u.getAttribute("Target") || "", x = u.getAttribute("Type") || "";
|
|
2312
|
+
/hyperlink/i.test(x) ? r.set(v, b) : /image/i.test(x) && a.set(v, b);
|
|
1114
2313
|
}
|
|
1115
2314
|
const d = /* @__PURE__ */ new Map();
|
|
1116
|
-
for (const [
|
|
1117
|
-
const
|
|
1118
|
-
if (!
|
|
1119
|
-
const
|
|
2315
|
+
for (const [u, v] of a) {
|
|
2316
|
+
const b = v.startsWith("/") ? v.slice(1) : "word/" + v.replace(/^\.\//, ""), x = e.get(b);
|
|
2317
|
+
if (!x) continue;
|
|
2318
|
+
const C = (b.split(".").pop() || "").toLowerCase(), M = St[C];
|
|
1120
2319
|
if (M)
|
|
1121
2320
|
try {
|
|
1122
|
-
d.set(
|
|
2321
|
+
d.set(u, `data:${M};base64,${Et(await U(t, x))}`);
|
|
1123
2322
|
} catch {
|
|
1124
2323
|
}
|
|
1125
2324
|
}
|
|
1126
2325
|
const m = /* @__PURE__ */ new Map(), g = await s("word/numbering.xml");
|
|
1127
2326
|
if (g) {
|
|
1128
|
-
const
|
|
1129
|
-
for (const
|
|
1130
|
-
if (
|
|
1131
|
-
const
|
|
1132
|
-
|
|
2327
|
+
const u = /* @__PURE__ */ new Map(), v = Array.from(g.getElementsByTagName("*"));
|
|
2328
|
+
for (const b of v) {
|
|
2329
|
+
if (b.localName !== "abstractNum") continue;
|
|
2330
|
+
const x = T(b, "abstractNumId"), C = P(b, "lvl").find((w) => T(w, "ilvl") === "0") || P(b, "lvl")[0], M = C ? T(S(C, "numFmt")) : "";
|
|
2331
|
+
u.set(x, M === "bullet" ? "ul" : "ol");
|
|
1133
2332
|
}
|
|
1134
|
-
for (const
|
|
1135
|
-
if (
|
|
1136
|
-
const
|
|
1137
|
-
m.set(
|
|
2333
|
+
for (const b of v) {
|
|
2334
|
+
if (b.localName !== "num") continue;
|
|
2335
|
+
const x = T(b, "numId"), C = T(S(b, "abstractNumId"));
|
|
2336
|
+
m.set(x, u.get(C) || "ul");
|
|
1138
2337
|
}
|
|
1139
2338
|
}
|
|
1140
|
-
return new
|
|
2339
|
+
return new Lt(r, d, m).convertBody(n);
|
|
1141
2340
|
}
|
|
1142
|
-
const
|
|
2341
|
+
const kt = ["nw", "ne", "sw", "se"], F = ["img-left", "img-right", "img-top", "img-center"], O = {
|
|
1143
2342
|
"img-left": "tplimgleft",
|
|
1144
2343
|
"img-right": "tplimgright",
|
|
1145
2344
|
"img-top": "tplimgtop",
|
|
1146
2345
|
"img-center": "tplimgcenter"
|
|
1147
|
-
},
|
|
1148
|
-
"img-left":
|
|
1149
|
-
"img-right":
|
|
1150
|
-
"img-top":
|
|
1151
|
-
"img-center":
|
|
1152
|
-
},
|
|
2346
|
+
}, At = {
|
|
2347
|
+
"img-left": c.tplleft,
|
|
2348
|
+
"img-right": c.tplright,
|
|
2349
|
+
"img-top": c.tpltop,
|
|
2350
|
+
"img-center": c.tplcenter
|
|
2351
|
+
}, It = ".tox,.pop,.tblctx,.imgctx,.selctx,.dlg";
|
|
2352
|
+
let E = null, A = null, $ = 0, Q = !1;
|
|
2353
|
+
function B() {
|
|
2354
|
+
clearTimeout($), A = null, E && E.classList.remove("show");
|
|
2355
|
+
}
|
|
2356
|
+
function qt(p) {
|
|
2357
|
+
const t = p.dataset.tip;
|
|
2358
|
+
if (!t) return;
|
|
2359
|
+
A = p, clearTimeout($);
|
|
2360
|
+
const e = E && E.classList.contains("show") ? 60 : 350;
|
|
2361
|
+
$ = window.setTimeout(() => {
|
|
2362
|
+
if (A !== p || !document.contains(p)) return;
|
|
2363
|
+
E || (E = document.createElement("div"), E.className = "etip", document.body.appendChild(E)), E.textContent = t, E.classList.add("show");
|
|
2364
|
+
const i = p.getBoundingClientRect(), s = E.offsetWidth, l = E.offsetHeight;
|
|
2365
|
+
let o = i.left + i.width / 2 - s / 2;
|
|
2366
|
+
o = Math.max(6, Math.min(o, innerWidth - s - 6));
|
|
2367
|
+
let n = i.bottom + 7;
|
|
2368
|
+
n + l > innerHeight - 6 && (n = i.top - l - 7), E.style.left = o + "px", E.style.top = n + "px";
|
|
2369
|
+
}, e);
|
|
2370
|
+
}
|
|
2371
|
+
function Zt() {
|
|
2372
|
+
Q || (Q = !0, document.addEventListener("mouseover", (p) => {
|
|
2373
|
+
const t = p.target, e = t.closest ? t.closest("[title],[data-tip]") : null;
|
|
2374
|
+
if (!e || !e.closest(It) || e.closest(".earea")) {
|
|
2375
|
+
e !== A && B();
|
|
2376
|
+
return;
|
|
2377
|
+
}
|
|
2378
|
+
const i = e.getAttribute("title");
|
|
2379
|
+
i && (e.dataset.tip = i, e.removeAttribute("title"), e.getAttribute("aria-label") || e.setAttribute("aria-label", i)), e !== A && qt(e);
|
|
2380
|
+
}), document.addEventListener("mouseout", (p) => {
|
|
2381
|
+
A && !A.contains(p.relatedTarget) && B();
|
|
2382
|
+
}), document.addEventListener("mousedown", B, !0), addEventListener("scroll", B, !0));
|
|
2383
|
+
}
|
|
2384
|
+
const I = class I {
|
|
1153
2385
|
constructor(t) {
|
|
1154
|
-
this.lang = "en", this.contentClass = "fable-content-" +
|
|
2386
|
+
this.lang = "en", this.contentClass = "fable-content-" + I.instanceCounter++, this.contentStyleEl = null, this.savedRange = null, this.foreColor = "#000000", this.backColor = "#FACC15", this.openPop = null, this.openSubEl = null, this.popAnchor = null, this.dlgOvl = null, this.tblActive = null, this.tblCorner = null, this.tblColBars = [], this.tblCtx = null, this.tblCellMark = null, this.tblOpMark = null, this.tblOpMarkKind = null, this.imgActive = null, this.imgHandles = [], this.imgCtx = null, this.imgHideTimer = null, this.phActive = null, this.phCtx = null, this.phUploadTarget = null, this.vidActive = null, this.vidCtx = null, this.vidHideTimer = null, this.vphActive = null, this.vphCtx = null, this.vphUploadTarget = null, this.selCtx = null, this.tbrMore = null, this.tbrExpanded = !1, this.codeActive = null, this.codeCtx = null, this.tplActive = null, this.tplCtx = null, this.revisions = [], this.revTimer = null, this.draftTimer = null, this.draftStorageKey = "", this.listeners = [], this.isDestroyed = !1, this.options = {
|
|
1155
2387
|
target: t.target,
|
|
1156
2388
|
language: t.language || "en",
|
|
1157
2389
|
height: t.height ?? 302,
|
|
@@ -1165,19 +2397,20 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1165
2397
|
statusbar: t.statusbar ?? !0,
|
|
1166
2398
|
readonly: t.readonly ?? !1,
|
|
1167
2399
|
draftKey: t.draftKey ?? (typeof location < "u" ? location.pathname : "default"),
|
|
1168
|
-
fontFamilyFormats: t.fontFamilyFormats ??
|
|
1169
|
-
imageFileTypes: t.imageFileTypes ?? ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/bmp", "image/webp"]
|
|
1170
|
-
|
|
2400
|
+
fontFamilyFormats: t.fontFamilyFormats ?? et,
|
|
2401
|
+
imageFileTypes: t.imageFileTypes ?? ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/bmp", "image/webp"],
|
|
2402
|
+
videoFileTypes: t.videoFileTypes ?? ["video/mp4", "video/webm", "video/ogg"]
|
|
2403
|
+
}, this.imageUploadHandler = t.imageUploadHandler, this.onImageUploadError = t.onImageUploadError, this.videoUploadHandler = t.videoUploadHandler, this.onVideoUploadError = t.onVideoUploadError, this.contentStyle = t.contentStyle, this.applyTheme(t), this.lang = this.options.language, this.draftStorageKey = "tmclone-draft:" + this.options.draftKey, this.initDOM(), this.bindEvents(), this.initUI(), this.recordRevision(), this.options.onReady(this);
|
|
1171
2404
|
}
|
|
1172
2405
|
t(t) {
|
|
1173
|
-
const e =
|
|
2406
|
+
const e = R(this.lang)[t];
|
|
1174
2407
|
return typeof e == "string" ? e : e.join(",");
|
|
1175
2408
|
}
|
|
1176
2409
|
tArr(t) {
|
|
1177
|
-
return
|
|
2410
|
+
return R(this.lang)[t];
|
|
1178
2411
|
}
|
|
1179
2412
|
dir() {
|
|
1180
|
-
return
|
|
2413
|
+
return R(this.lang).dir;
|
|
1181
2414
|
}
|
|
1182
2415
|
/* ---------------------------------------------------------- DOM setup */
|
|
1183
2416
|
initDOM() {
|
|
@@ -1190,7 +2423,14 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1190
2423
|
</span>
|
|
1191
2424
|
`, this.sbHelp = this.statusbar.querySelector(".mid"), this.sbWords = this.statusbar.querySelector(".words");
|
|
1192
2425
|
const e = this.statusbar.querySelector(".grip");
|
|
1193
|
-
this.bindGrip(e), this.shell.appendChild(this.menubar), this.shell.appendChild(this.toolbar), this.shell.appendChild(this.ed), this.shell.appendChild(this.statusbar), this.contentStyle && (this.contentStyleEl = document.createElement("style"), this.contentStyleEl.textContent = this.scopeContentStyle(this.contentStyle), this.shell.appendChild(this.contentStyleEl)), t.appendChild(this.shell), this.options.statusbar || (this.statusbar.style.display = "none"), this.imgInput = document.createElement("input"), this.imgInput.type = "file", this.imgInput.accept = this.options.imageFileTypes.join(","), this.imgInput.style.display = "none", t.appendChild(this.imgInput), this.docInput = document.createElement("input"), this.docInput.type = "file", this.docInput.accept = ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", this.docInput.style.display = "none", t.appendChild(this.docInput);
|
|
2426
|
+
this.bindGrip(e), this.shell.appendChild(this.menubar), this.shell.appendChild(this.toolbar), this.shell.appendChild(this.ed), this.shell.appendChild(this.statusbar), this.contentStyle && (this.contentStyleEl = document.createElement("style"), this.contentStyleEl.textContent = this.scopeContentStyle(this.contentStyle), this.shell.appendChild(this.contentStyleEl)), t.appendChild(this.shell), Zt(), this.options.statusbar || (this.statusbar.style.display = "none"), this.imgInput = document.createElement("input"), this.imgInput.type = "file", this.imgInput.accept = this.options.imageFileTypes.join(","), this.imgInput.style.display = "none", t.appendChild(this.imgInput), this.vidInput = document.createElement("input"), this.vidInput.type = "file", this.vidInput.accept = this.options.videoFileTypes.join(","), this.vidInput.style.display = "none", t.appendChild(this.vidInput), this.docInput = document.createElement("input"), this.docInput.type = "file", this.docInput.accept = ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", this.docInput.style.display = "none", t.appendChild(this.docInput);
|
|
2427
|
+
}
|
|
2428
|
+
/** Theme options land as CSS variables on the document root rather than the editor
|
|
2429
|
+
* shell, because dialogs, popups and floating context toolbars are appended to
|
|
2430
|
+
* document.body and would not inherit variables scoped to the shell. */
|
|
2431
|
+
applyTheme(t) {
|
|
2432
|
+
const e = document.documentElement;
|
|
2433
|
+
t.primaryColor && e.style.setProperty("--fable-primary", t.primaryColor), t.toolbarGroupBackground && e.style.setProperty("--fable-tgrp-bg", t.toolbarGroupBackground), t.uiFontFamily && e.style.setProperty("--fable-ui-font", t.uiFontFamily);
|
|
1194
2434
|
}
|
|
1195
2435
|
/** Rewrites the literal word `body` in a user-supplied `contentStyle` string to a
|
|
1196
2436
|
* selector scoped to this instance's content div. Everything else passes through
|
|
@@ -1203,18 +2443,18 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1203
2443
|
let e = 0, i = 0;
|
|
1204
2444
|
const s = (l) => {
|
|
1205
2445
|
e = l.clientY, i = this.ed.offsetHeight, l.preventDefault();
|
|
1206
|
-
const
|
|
2446
|
+
const o = (r) => {
|
|
1207
2447
|
this.ed.style.height = Math.max(120, i + r.clientY - e) + "px";
|
|
1208
|
-
},
|
|
1209
|
-
window.removeEventListener("mousemove",
|
|
2448
|
+
}, n = () => {
|
|
2449
|
+
window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", n);
|
|
1210
2450
|
};
|
|
1211
|
-
window.addEventListener("mousemove",
|
|
2451
|
+
window.addEventListener("mousemove", o), window.addEventListener("mouseup", n);
|
|
1212
2452
|
};
|
|
1213
2453
|
t.addEventListener("mousedown", s), this.listeners.push(() => t.removeEventListener("mousedown", s));
|
|
1214
2454
|
}
|
|
1215
2455
|
/* ---------------------------------------------------------- event binding */
|
|
1216
2456
|
bindEvents() {
|
|
1217
|
-
this.onDoc("mousedown", (t) => {
|
|
2457
|
+
if (this.onDoc("mousedown", (t) => {
|
|
1218
2458
|
this.openPop && !this.openPop.contains(t.target) && !this.popAnchor.contains(t.target) && !(this.openSubEl && this.openSubEl.contains(t.target)) && this.closePop();
|
|
1219
2459
|
}), this.onDoc("keydown", (t) => {
|
|
1220
2460
|
t.key === "Escape" && (this.closePop(), this.closeDlg());
|
|
@@ -1222,48 +2462,65 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1222
2462
|
const t = window.getSelection();
|
|
1223
2463
|
t && this.ed.contains(t.anchorNode) ? (this.saveSel(), this.refreshState(), this.updateSelToolbar(t), this.positionCellMarker()) : this.clearSelToolbar();
|
|
1224
2464
|
}), this.on(this.ed, "input", () => {
|
|
1225
|
-
this.refreshState(), this.onChange(), this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx();
|
|
2465
|
+
this.refreshState(), this.onChange(), this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx(), this.positionVphCtx(), this.positionVidCtx(), this.positionCodeCtx();
|
|
1226
2466
|
}), this.on(this.ed, "keydown", (t) => {
|
|
1227
|
-
t.altKey && t.key === "0" && (t.preventDefault(), this.helpDlg()), (t.key === "Delete" || t.key === "Backspace") && this.phActive && (t.preventDefault(), this.removeImgPlaceholder());
|
|
2467
|
+
t.altKey && t.key === "0" && (t.preventDefault(), this.helpDlg()), (t.key === "Delete" || t.key === "Backspace") && this.phActive && (t.preventDefault(), this.removeImgPlaceholder()), (t.key === "Delete" || t.key === "Backspace") && this.vphActive && (t.preventDefault(), this.removeVphPlaceholder()), t.key === "`" && !t.ctrlKey && !t.metaKey && !t.altKey && this.tryCodeTyping(t);
|
|
1228
2468
|
}), this.on(this.ed, "paste", (t) => this.handlePaste(t)), this.on(this.ed, "drop", (t) => {
|
|
1229
|
-
var
|
|
2469
|
+
var l, o, n, r;
|
|
1230
2470
|
t.preventDefault();
|
|
1231
|
-
const e =
|
|
1232
|
-
if (
|
|
1233
|
-
|
|
1234
|
-
|
|
2471
|
+
const e = t.target, i = (l = e.closest) == null ? void 0 : l.call(e, ".img-ph:not(.vid-ph)");
|
|
2472
|
+
if (i && this.ed.contains(i) && !this.options.readonly) {
|
|
2473
|
+
const a = Array.from(((o = t.dataTransfer) == null ? void 0 : o.files) || []).find((h) => h.type.startsWith("image/"));
|
|
2474
|
+
a && this.readImageFileInto(a, i);
|
|
2475
|
+
return;
|
|
2476
|
+
}
|
|
2477
|
+
const s = (n = e.closest) == null ? void 0 : n.call(e, ".vid-ph");
|
|
2478
|
+
if (s && this.ed.contains(s) && !this.options.readonly) {
|
|
2479
|
+
const a = Array.from(((r = t.dataTransfer) == null ? void 0 : r.files) || []).find((h) => h.type.startsWith("video/"));
|
|
2480
|
+
a && this.readVideoFileInto(a, s);
|
|
2481
|
+
}
|
|
1235
2482
|
}), this.on(this.ed, "dragover", (t) => t.preventDefault()), this.on(this.ed, "mousedown", (t) => {
|
|
1236
|
-
var
|
|
1237
|
-
const e = t.target, i = (
|
|
2483
|
+
var h, d, m, g, u, v, b;
|
|
2484
|
+
const e = t.target, i = (h = e.closest) == null ? void 0 : h.call(e, "table");
|
|
1238
2485
|
i && this.ed.contains(i) ? this.selectTableForResize(i) : this.clearTableHandles();
|
|
1239
|
-
const s = (
|
|
2486
|
+
const s = (d = e.closest) == null ? void 0 : d.call(e, ".img-ph:not(.vid-ph)");
|
|
1240
2487
|
s && this.ed.contains(s) && !this.options.readonly ? (t.preventDefault(), this.ed.focus(), this.selectImgPlaceholder(s)) : this.clearImgPlaceholderSel();
|
|
1241
|
-
const l = (
|
|
1242
|
-
l && this.ed.contains(l) && !this.options.readonly ? this.
|
|
1243
|
-
const
|
|
1244
|
-
|
|
2488
|
+
const l = (m = e.closest) == null ? void 0 : m.call(e, ".vid-ph");
|
|
2489
|
+
l && this.ed.contains(l) && !this.options.readonly ? (t.preventDefault(), this.ed.focus(), this.selectVphPlaceholder(l)) : this.clearVphPlaceholderSel();
|
|
2490
|
+
const o = (g = e.closest) == null ? void 0 : g.call(e, ".tpl");
|
|
2491
|
+
o && this.ed.contains(o) && !this.options.readonly ? this.selectTemplate(o) : this.clearTplSel();
|
|
2492
|
+
const n = (u = e.closest) == null ? void 0 : u.call(e, "pre.code-block");
|
|
2493
|
+
n && this.ed.contains(n) && !this.options.readonly ? (t.preventDefault(), this.selectCodeEl(n)) : this.clearCodeSel();
|
|
2494
|
+
const r = (v = e.closest) == null ? void 0 : v.call(e, "img");
|
|
2495
|
+
r && this.ed.contains(r) && !this.options.readonly ? (t.preventDefault(), this.selectImage(r)) : this.clearImageHandles();
|
|
2496
|
+
const a = (b = e.closest) == null ? void 0 : b.call(e, "video, .video-embed");
|
|
2497
|
+
a && this.ed.contains(a) && !this.options.readonly ? (t.preventDefault(), this.selectVideo(a)) : this.clearVidHandles();
|
|
1245
2498
|
}), this.on(this.ed, "mouseover", (t) => {
|
|
1246
2499
|
var i, s;
|
|
1247
2500
|
if (this.options.readonly) return;
|
|
1248
2501
|
const e = (s = (i = t.target).closest) == null ? void 0 : s.call(i, "img");
|
|
1249
2502
|
e && this.ed.contains(e) && (this.cancelImgHide(), this.selectImage(e));
|
|
1250
2503
|
}), this.on(this.ed, "mouseout", (t) => {
|
|
1251
|
-
var s, l,
|
|
2504
|
+
var s, l, o, n;
|
|
1252
2505
|
const e = (l = (s = t.target).closest) == null ? void 0 : l.call(s, "img");
|
|
1253
2506
|
if (!e) return;
|
|
1254
2507
|
const i = t.relatedTarget;
|
|
1255
|
-
i && ((
|
|
2508
|
+
i && ((o = this.imgCtx) != null && o.contains(i) || this.imgHandles.some((r) => r.contains(i)) || ((n = i.closest) == null ? void 0 : n.call(i, "img")) === e) || this.scheduleImgHide();
|
|
1256
2509
|
}), this.on(this.ed, "scroll", () => {
|
|
1257
|
-
this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx();
|
|
2510
|
+
this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx(), this.positionVphCtx(), this.positionVidCtx(), this.positionCodeCtx();
|
|
1258
2511
|
}), this.onWin(
|
|
1259
2512
|
"scroll",
|
|
1260
2513
|
() => {
|
|
1261
|
-
this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx(), this.repositionSelToolbar();
|
|
2514
|
+
this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx(), this.positionVphCtx(), this.positionVidCtx(), this.positionCodeCtx(), this.repositionSelToolbar();
|
|
1262
2515
|
},
|
|
1263
2516
|
!0
|
|
1264
2517
|
), this.onWin("resize", () => {
|
|
1265
|
-
this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx(), this.repositionSelToolbar();
|
|
1266
|
-
}),
|
|
2518
|
+
this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx(), this.positionVphCtx(), this.positionVidCtx(), this.positionCodeCtx(), this.repositionSelToolbar(), this.updateToolbarOverflow();
|
|
2519
|
+
}), typeof ResizeObserver < "u") {
|
|
2520
|
+
const t = new ResizeObserver(() => this.updateToolbarOverflow());
|
|
2521
|
+
t.observe(this.shell), this.listeners.push(() => t.disconnect());
|
|
2522
|
+
}
|
|
2523
|
+
this.on(this.imgInput, "change", () => {
|
|
1267
2524
|
var s;
|
|
1268
2525
|
const t = (s = this.imgInput.files) == null ? void 0 : s[0];
|
|
1269
2526
|
if (!t) return;
|
|
@@ -1280,12 +2537,29 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1280
2537
|
`<img src="${i.result}" title="${t.name.replace(/"/g, "")}" alt="">`
|
|
1281
2538
|
), this.onChange();
|
|
1282
2539
|
}, i.readAsDataURL(t);
|
|
2540
|
+
}), this.on(this.vidInput, "change", () => {
|
|
2541
|
+
var s;
|
|
2542
|
+
const t = (s = this.vidInput.files) == null ? void 0 : s[0];
|
|
2543
|
+
if (!t) return;
|
|
2544
|
+
const e = this.vphUploadTarget;
|
|
2545
|
+
if (this.vphUploadTarget = null, e && this.ed.contains(e)) {
|
|
2546
|
+
this.readVideoFileInto(t, e);
|
|
2547
|
+
return;
|
|
2548
|
+
}
|
|
2549
|
+
const i = new FileReader();
|
|
2550
|
+
i.onload = () => {
|
|
2551
|
+
this.restoreSel(), document.execCommand(
|
|
2552
|
+
"insertHTML",
|
|
2553
|
+
!1,
|
|
2554
|
+
`<video controls src="${i.result}" title="${t.name.replace(/"/g, "")}"></video>`
|
|
2555
|
+
), this.onChange();
|
|
2556
|
+
}, i.readAsDataURL(t);
|
|
1283
2557
|
}), this.on(this.docInput, "change", () => {
|
|
1284
2558
|
var e;
|
|
1285
2559
|
const t = (e = this.docInput.files) == null ? void 0 : e[0];
|
|
1286
2560
|
t && this.importWordFile(t).catch(() => alert(this.t("importfail")));
|
|
1287
2561
|
}), this.onDoc("mousedown", (t) => {
|
|
1288
|
-
this.ed.contains(t.target) || t.target === this.tblCorner || this.tblColBars.includes(t.target) || this.tblCtx && this.tblCtx.contains(t.target) || this.imgHandles.includes(t.target) || this.imgCtx && this.imgCtx.contains(t.target) || this.phCtx && this.phCtx.contains(t.target) || this.tplCtx && this.tplCtx.contains(t.target) || this.selCtx && this.selCtx.contains(t.target) || this.openPop && this.openPop.contains(t.target) || this.openSubEl && this.openSubEl.contains(t.target) || (this.clearTableHandles(), this.clearImageHandles(), this.clearImgPlaceholderSel(), this.clearTplSel(), this.clearSelToolbar());
|
|
2562
|
+
this.ed.contains(t.target) || t.target === this.tblCorner || this.tblColBars.includes(t.target) || this.tblCtx && this.tblCtx.contains(t.target) || this.imgHandles.includes(t.target) || this.imgCtx && this.imgCtx.contains(t.target) || this.phCtx && this.phCtx.contains(t.target) || this.tplCtx && this.tplCtx.contains(t.target) || this.selCtx && this.selCtx.contains(t.target) || this.vphCtx && this.vphCtx.contains(t.target) || this.vidCtx && this.vidCtx.contains(t.target) || this.codeCtx && this.codeCtx.contains(t.target) || this.openPop && this.openPop.contains(t.target) || this.openSubEl && this.openSubEl.contains(t.target) || (this.clearTableHandles(), this.clearImageHandles(), this.clearImgPlaceholderSel(), this.clearTplSel(), this.clearVphPlaceholderSel(), this.clearVidHandles(), this.clearCodeSel(), this.clearSelToolbar());
|
|
1289
2563
|
});
|
|
1290
2564
|
}
|
|
1291
2565
|
on(t, e, i) {
|
|
@@ -1302,7 +2576,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1302
2576
|
return this.ed.innerHTML;
|
|
1303
2577
|
}
|
|
1304
2578
|
setContent(t) {
|
|
1305
|
-
this.ed.innerHTML = t || "<p><br></p>", this.refreshState(), this.clearTableHandles(), this.clearImageHandles(), this.clearImgPlaceholderSel(), this.clearTplSel(), this.clearSelToolbar(), this.onChange();
|
|
2579
|
+
this.ed.innerHTML = t || "<p><br></p>", this.refreshState(), this.clearTableHandles(), this.clearImageHandles(), this.clearImgPlaceholderSel(), this.clearTplSel(), this.clearVphPlaceholderSel(), this.clearVidHandles(), this.clearCodeSel(), this.clearSelToolbar(), this.onChange();
|
|
1306
2580
|
}
|
|
1307
2581
|
insertContent(t) {
|
|
1308
2582
|
this.restoreSel(), document.execCommand("insertHTML", !1, t), this.saveSel(), this.refreshState(), this.onChange();
|
|
@@ -1314,7 +2588,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1314
2588
|
this.ed.focus();
|
|
1315
2589
|
}
|
|
1316
2590
|
async importWordFile(t) {
|
|
1317
|
-
const e = await
|
|
2591
|
+
const e = await Ht(t);
|
|
1318
2592
|
this.recordRevision(), this.setContent(e), this.recordRevision();
|
|
1319
2593
|
}
|
|
1320
2594
|
restoreDraft() {
|
|
@@ -1335,7 +2609,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1335
2609
|
return this.revisions.slice();
|
|
1336
2610
|
}
|
|
1337
2611
|
destroy() {
|
|
1338
|
-
this.isDestroyed || (this.isDestroyed = !0, this.revTimer != null && window.clearTimeout(this.revTimer), this.draftTimer != null && window.clearTimeout(this.draftTimer), this.closePop(), this.closeDlg(), this.clearTableHandles(), this.clearImageHandles(), this.clearImgPlaceholderSel(), this.clearTplSel(), this.clearSelToolbar(), this.listeners.forEach((t) => t()), this.listeners = [], this.shell && this.shell.parentNode && this.shell.parentNode.removeChild(this.shell), this.imgInput && this.imgInput.parentNode && this.imgInput.parentNode.removeChild(this.imgInput), this.docInput && this.docInput.parentNode && this.docInput.parentNode.removeChild(this.docInput), this.contentStyleEl = null);
|
|
2612
|
+
this.isDestroyed || (this.isDestroyed = !0, this.revTimer != null && window.clearTimeout(this.revTimer), this.draftTimer != null && window.clearTimeout(this.draftTimer), this.closePop(), this.closeDlg(), this.clearTableHandles(), this.clearImageHandles(), this.clearImgPlaceholderSel(), this.clearTplSel(), this.clearVphPlaceholderSel(), this.clearVidHandles(), this.clearCodeSel(), this.clearSelToolbar(), this.listeners.forEach((t) => t()), this.listeners = [], this.shell && this.shell.parentNode && this.shell.parentNode.removeChild(this.shell), this.imgInput && this.imgInput.parentNode && this.imgInput.parentNode.removeChild(this.imgInput), this.vidInput && this.vidInput.parentNode && this.vidInput.parentNode.removeChild(this.vidInput), this.docInput && this.docInput.parentNode && this.docInput.parentNode.removeChild(this.docInput), this.contentStyleEl = null);
|
|
1339
2613
|
}
|
|
1340
2614
|
/* ---------------------------------------------------------- selection */
|
|
1341
2615
|
saveSel() {
|
|
@@ -1410,16 +2684,16 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1410
2684
|
s.className = "revprev";
|
|
1411
2685
|
const l = document.createElement("button");
|
|
1412
2686
|
l.type = "button", l.className = "revrestore", l.textContent = this.t("restore");
|
|
1413
|
-
let
|
|
1414
|
-
const
|
|
2687
|
+
let o = this.revisions.length - 1;
|
|
2688
|
+
const n = new Intl.DateTimeFormat(this.lang === "ar" ? "ar-AE" : "en-GB", {
|
|
1415
2689
|
year: "numeric",
|
|
1416
2690
|
month: "short",
|
|
1417
2691
|
day: "numeric",
|
|
1418
2692
|
hour: "2-digit",
|
|
1419
2693
|
minute: "2-digit",
|
|
1420
2694
|
second: "2-digit"
|
|
1421
|
-
}), r = {},
|
|
1422
|
-
|
|
2695
|
+
}), r = {}, a = (h) => {
|
|
2696
|
+
o = h, this.revisions.forEach((d, m) => {
|
|
1423
2697
|
var g;
|
|
1424
2698
|
return (g = r[m]) == null ? void 0 : g.classList.toggle("on", m === h);
|
|
1425
2699
|
}), s.innerHTML = this.revisions[h].html, l.disabled = h === this.revisions.length - 1;
|
|
@@ -1427,13 +2701,13 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1427
2701
|
for (let h = this.revisions.length - 1; h >= 0; h--) {
|
|
1428
2702
|
const d = this.revisions[h], m = document.createElement("button");
|
|
1429
2703
|
m.type = "button";
|
|
1430
|
-
const g = (new DOMParser().parseFromString(d.html, "text/html").body.textContent || "").trim(),
|
|
1431
|
-
m.innerHTML = `<span>${v ? this.t("currentver") :
|
|
2704
|
+
const g = (new DOMParser().parseFromString(d.html, "text/html").body.textContent || "").trim(), u = g ? g.split(/\s+/).length : 0, v = h === this.revisions.length - 1;
|
|
2705
|
+
m.innerHTML = `<span>${v ? this.t("currentver") : n.format(new Date(d.time))}</span><span class="wc">${u} ${this.t("words")}</span>`, m.addEventListener("click", () => a(h)), r[h] = m, i.appendChild(m);
|
|
1432
2706
|
}
|
|
1433
2707
|
i.append(l), l.addEventListener("click", () => {
|
|
1434
|
-
const h = this.revisions[
|
|
2708
|
+
const h = this.revisions[o];
|
|
1435
2709
|
h && (this.recordRevision(), this.setContent(h.html), this.recordRevision(), this.closeDlg());
|
|
1436
|
-
}), e.append(i, s), t.appendChild(e),
|
|
2710
|
+
}), e.append(i, s), t.appendChild(e), a(o);
|
|
1437
2711
|
});
|
|
1438
2712
|
}
|
|
1439
2713
|
/* ---------------------------------------------------------- popups / menus */
|
|
@@ -1452,25 +2726,25 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1452
2726
|
r.target.tagName !== "INPUT" && r.preventDefault();
|
|
1453
2727
|
}), document.body.appendChild(i);
|
|
1454
2728
|
const s = e.getBoundingClientRect();
|
|
1455
|
-
let
|
|
1456
|
-
|
|
1457
|
-
let
|
|
1458
|
-
|
|
2729
|
+
let o = this.dir() === "rtl" ? s.left - i.offsetWidth + 2 : s.right - 2;
|
|
2730
|
+
o = Math.max(8, Math.min(o + scrollX, scrollX + innerWidth - i.offsetWidth - 8));
|
|
2731
|
+
let n = s.top + scrollY - 6;
|
|
2732
|
+
n = Math.max(8 + scrollY, Math.min(n, scrollY + innerHeight - i.offsetHeight - 8)), i.style.left = o + "px", i.style.top = n + "px", this.openSubEl = i;
|
|
1459
2733
|
}
|
|
1460
|
-
popup(t, e) {
|
|
2734
|
+
popup(t, e, i) {
|
|
1461
2735
|
if (this.openPop && this.popAnchor === t) {
|
|
1462
2736
|
this.closePop();
|
|
1463
2737
|
return;
|
|
1464
2738
|
}
|
|
1465
2739
|
this.closePop();
|
|
1466
|
-
const
|
|
1467
|
-
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1470
|
-
let n = this.dir() === "rtl" ?
|
|
1471
|
-
n = Math.max(8, Math.min(n + scrollX, scrollX + innerWidth -
|
|
1472
|
-
|
|
1473
|
-
}), this.openPop =
|
|
2740
|
+
const s = document.createElement("div");
|
|
2741
|
+
s.className = "pop" + (i ? " " + i : ""), s.dir = this.dir(), e(s), document.body.appendChild(s);
|
|
2742
|
+
const l = t.getBoundingClientRect();
|
|
2743
|
+
s.style.minWidth = Math.max(160, Math.round(l.width)) + "px", s.style.top = l.bottom + scrollY + 2 + "px";
|
|
2744
|
+
let n = this.dir() === "rtl" ? l.right - s.offsetWidth : l.left;
|
|
2745
|
+
n = Math.max(8, Math.min(n + scrollX, scrollX + innerWidth - s.offsetWidth - 8)), s.style.left = n + "px", s.addEventListener("mousedown", (r) => {
|
|
2746
|
+
r.target.tagName !== "INPUT" && r.preventDefault();
|
|
2747
|
+
}), this.openPop = s, this.popAnchor = t, t.classList.add("open");
|
|
1474
2748
|
}
|
|
1475
2749
|
menuItems(t, e) {
|
|
1476
2750
|
e.forEach((i) => {
|
|
@@ -1479,44 +2753,44 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1479
2753
|
return;
|
|
1480
2754
|
}
|
|
1481
2755
|
const s = !!(i.sub || i.subBuild), l = document.createElement("button");
|
|
1482
|
-
l.className = "mi" + (i.on ? " on" : ""), l.innerHTML = `<span class="ic">${i.icon || ""}</span><span class="prev" ${i.previewStyle ? `style="${i.previewStyle}"` : ""}>${i.label}</span>${i.shortcut ? `<span class="sc">${i.shortcut}</span>` : ""}${s ? `<span class="subarrow">${
|
|
2756
|
+
l.className = "mi" + (i.on ? " on" : ""), l.innerHTML = `<span class="ic">${i.icon || ""}</span><span class="prev" ${i.previewStyle ? `style="${i.previewStyle}"` : ""}>${i.label}</span>${i.shortcut ? `<span class="sc">${i.shortcut}</span>` : ""}${s ? `<span class="subarrow">${c.chev}</span>` : ""}`, l.addEventListener("click", () => {
|
|
1483
2757
|
i.action && (this.closePop(), i.action());
|
|
1484
2758
|
}), l.addEventListener("mouseenter", () => {
|
|
1485
|
-
var
|
|
1486
|
-
s ? this.openSubFor(i, l) : this.openSubEl && t !== this.openSubEl && this.closeSub(), (
|
|
2759
|
+
var o;
|
|
2760
|
+
s ? this.openSubFor(i, l) : this.openSubEl && t !== this.openSubEl && this.closeSub(), (o = i.hover) == null || o.call(i, !0);
|
|
1487
2761
|
}), l.addEventListener("mouseleave", () => {
|
|
1488
|
-
var
|
|
1489
|
-
return (
|
|
2762
|
+
var o;
|
|
2763
|
+
return (o = i.hover) == null ? void 0 : o.call(i, !1);
|
|
1490
2764
|
}), t.appendChild(l);
|
|
1491
2765
|
});
|
|
1492
2766
|
}
|
|
1493
2767
|
/* ---------------------------------------------------------- toolbar builders */
|
|
1494
2768
|
tbtn(t, e, i, s) {
|
|
1495
2769
|
const l = document.createElement("button");
|
|
1496
|
-
return l.className = "tbtn", l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (
|
|
2770
|
+
return l.className = "tbtn", l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (o) => o.preventDefault()), l.addEventListener("click", i), l;
|
|
1497
2771
|
}
|
|
1498
2772
|
/** Font-size increase / decrease step button. */
|
|
1499
2773
|
stepBtn(t) {
|
|
1500
|
-
const e = t > 0 ? "+" : "−", i = t > 0 ?
|
|
2774
|
+
const e = t > 0 ? "+" : "−", i = t > 0 ? c.fontsizeup : c.fontsizedown, s = this.tbtn(i, this.t("fontsize") + " " + e, () => this.stepFontSize(t));
|
|
1501
2775
|
return s.addEventListener("mousedown", () => this.saveSel()), s;
|
|
1502
2776
|
}
|
|
1503
2777
|
/** Toolbar icon button that opens a popup menu anchored to itself. */
|
|
1504
2778
|
menuTbtn(t, e, i, s) {
|
|
1505
2779
|
const l = this.tbtn(t, e, () => i(l), s);
|
|
1506
|
-
return l.classList.add("hasmenu"), l.insertAdjacentHTML("beforeend",
|
|
2780
|
+
return l.classList.add("hasmenu"), l.insertAdjacentHTML("beforeend", c.chev), l.addEventListener("mousedown", () => this.saveSel()), l;
|
|
1507
2781
|
}
|
|
1508
2782
|
/** Quick text-color chips plus a "more" chip that opens the full palette. */
|
|
1509
2783
|
colorChips() {
|
|
1510
2784
|
const t = (s) => {
|
|
1511
2785
|
const l = document.createElement("button");
|
|
1512
|
-
return l.type = "button", l.className = "cchip", l.title = s, l.addEventListener("mousedown", (
|
|
1513
|
-
|
|
2786
|
+
return l.type = "button", l.className = "cchip", l.title = s, l.addEventListener("mousedown", (o) => {
|
|
2787
|
+
o.preventDefault(), this.saveSel();
|
|
1514
2788
|
}), l;
|
|
1515
|
-
}, e =
|
|
2789
|
+
}, e = at.map((s) => {
|
|
1516
2790
|
const l = t(this.t("forecolor"));
|
|
1517
2791
|
return l.style.background = s, l.addEventListener("click", () => this.applyColor("fore", s)), l;
|
|
1518
2792
|
}), i = t(this.t("forecolor"));
|
|
1519
|
-
return i.classList.add("more"), i.dataset.cb = "fore", i.innerHTML =
|
|
2793
|
+
return i.classList.add("more"), i.dataset.cb = "fore", i.innerHTML = c.chev, i.addEventListener("click", () => this.colorMenu(i, "fore")), [...e, i];
|
|
1520
2794
|
}
|
|
1521
2795
|
group(...t) {
|
|
1522
2796
|
const e = document.createElement("div");
|
|
@@ -1526,73 +2800,82 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1526
2800
|
}
|
|
1527
2801
|
tsel(t, e, i, s) {
|
|
1528
2802
|
const l = document.createElement("button");
|
|
1529
|
-
return l.className = "tsel " + t, l.type = "button", l.dataset.id = e, l.innerHTML = `<span class="lbl empty">${i || ""}</span>${
|
|
1530
|
-
|
|
2803
|
+
return l.className = "tsel " + t, l.type = "button", l.dataset.id = e, l.innerHTML = `<span class="lbl empty">${i || ""}</span>${c.chev}`, l.addEventListener("mousedown", (o) => {
|
|
2804
|
+
o.preventDefault(), this.saveSel();
|
|
1531
2805
|
}), l.addEventListener("click", () => s(l)), l;
|
|
1532
2806
|
}
|
|
1533
2807
|
setListStyle(t, e) {
|
|
1534
|
-
var l,
|
|
2808
|
+
var l, o;
|
|
1535
2809
|
this.restoreSel();
|
|
1536
2810
|
const i = window.getSelection();
|
|
1537
2811
|
if (!i) return;
|
|
1538
2812
|
let s = (l = this.closestBlock(i.anchorNode)) == null ? void 0 : l.closest(t);
|
|
1539
|
-
s || (this.exec(t === "ol" ? "insertOrderedList" : "insertUnorderedList"), s = (
|
|
2813
|
+
s || (this.exec(t === "ol" ? "insertOrderedList" : "insertUnorderedList"), s = (o = this.closestBlock(i.anchorNode)) == null ? void 0 : o.closest(t)), s && (s.style.listStyleType = e), this.saveSel(), this.onChange();
|
|
1540
2814
|
}
|
|
1541
2815
|
listMenu(t, e) {
|
|
1542
|
-
var
|
|
2816
|
+
var a;
|
|
1543
2817
|
const i = e === "ol" ? "insertOrderedList" : "insertUnorderedList", s = e === "ol" ? [
|
|
1544
|
-
["lower-alpha",
|
|
1545
|
-
["lower-roman",
|
|
1546
|
-
["upper-alpha",
|
|
1547
|
-
["upper-roman",
|
|
2818
|
+
["lower-alpha", c.ol_alpha],
|
|
2819
|
+
["lower-roman", c.ol_roman],
|
|
2820
|
+
["upper-alpha", c.ol_alphau],
|
|
2821
|
+
["upper-roman", c.ol_romanu]
|
|
1548
2822
|
] : [
|
|
1549
|
-
["circle",
|
|
1550
|
-
["square",
|
|
1551
|
-
], l = this.tArr(e === "ol" ? "liststyles_ol" : "liststyles_ul").slice(1),
|
|
2823
|
+
["circle", c.ul_circle],
|
|
2824
|
+
["square", c.ul_square]
|
|
2825
|
+
], l = this.tArr(e === "ol" ? "liststyles_ol" : "liststyles_ul").slice(1), o = window.getSelection(), n = o ? (a = this.closestBlock(o.anchorNode)) == null ? void 0 : a.closest(e) : null, r = n ? n.style.listStyleType : "";
|
|
1552
2826
|
this.popup(t, (h) => {
|
|
1553
2827
|
this.menuItems(h, [
|
|
1554
2828
|
{
|
|
1555
2829
|
label: this.t(e === "ol" ? "numlist" : "bullist"),
|
|
1556
|
-
icon: e === "ol" ?
|
|
2830
|
+
icon: e === "ol" ? c.numlist : c.bullist,
|
|
1557
2831
|
on: document.queryCommandState(i),
|
|
1558
2832
|
action: () => this.exec(i)
|
|
1559
2833
|
}
|
|
1560
2834
|
]), h.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
|
|
1561
2835
|
const d = document.createElement("div");
|
|
1562
|
-
d.className = "mi-grid", s.forEach(([m, g],
|
|
2836
|
+
d.className = "mi-grid", s.forEach(([m, g], u) => {
|
|
1563
2837
|
const v = document.createElement("button");
|
|
1564
|
-
v.className = "mi" + (r === m ? " on" : ""), v.innerHTML = `<span class="ic">${g}</span><span class="prev">${l[
|
|
2838
|
+
v.className = "mi" + (r === m ? " on" : ""), v.innerHTML = `<span class="ic">${g}</span><span class="prev">${l[u]}</span>`, v.addEventListener("click", () => {
|
|
1565
2839
|
this.closePop(), this.setListStyle(e, m);
|
|
1566
2840
|
}), d.appendChild(v);
|
|
1567
2841
|
}), h.appendChild(d);
|
|
1568
2842
|
});
|
|
1569
2843
|
}
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
});
|
|
1589
|
-
const c = document.createElement("label");
|
|
1590
|
-
c.className = "cswatch cwheel", c.title = this.t("customcolor"), c.innerHTML = a.palette;
|
|
1591
|
-
const h = document.createElement("input");
|
|
1592
|
-
h.type = "color", h.value = /^#[0-9a-f]{6}$/i.test(o) ? o : "#000000", h.addEventListener("change", () => {
|
|
1593
|
-
this.closePop(), this.applyColor(e, h.value);
|
|
1594
|
-
}), c.appendChild(h), l.append(n, r, c), i.appendChild(l);
|
|
2844
|
+
/** Shared color-picker popup body — swatch grid plus the current-color /
|
|
2845
|
+
* no-color / custom-picker footer — so the fore/back toolbar menus and the
|
|
2846
|
+
* table cell-background menu all show the identical popup. */
|
|
2847
|
+
buildPaletteInto(t, e, i) {
|
|
2848
|
+
const s = document.createElement("div");
|
|
2849
|
+
s.className = "cpal", ct.forEach((d) => {
|
|
2850
|
+
const m = document.createElement("button");
|
|
2851
|
+
m.type = "button", m.style.background = d, m.title = d, m.addEventListener("click", () => {
|
|
2852
|
+
this.closePop(), i(d);
|
|
2853
|
+
}), s.appendChild(m);
|
|
2854
|
+
}), t.appendChild(s), t.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
|
|
2855
|
+
const l = document.createElement("div");
|
|
2856
|
+
l.className = "cfoot";
|
|
2857
|
+
const o = /^#[0-9a-f]{6}$/i.test(e) ? e : "#000000", n = document.createElement("div");
|
|
2858
|
+
n.className = "cswatch cur", n.title = this.t("currentcolor"), n.style.background = o, n.innerHTML = c.check;
|
|
2859
|
+
const r = document.createElement("button");
|
|
2860
|
+
r.type = "button", r.className = "cswatch nocolor", r.title = this.t("removecolor"), r.addEventListener("click", () => {
|
|
2861
|
+
this.closePop(), i(null);
|
|
1595
2862
|
});
|
|
2863
|
+
const a = document.createElement("label");
|
|
2864
|
+
a.className = "cswatch cwheel", a.title = this.t("customcolor"), a.innerHTML = c.palette;
|
|
2865
|
+
const h = document.createElement("input");
|
|
2866
|
+
h.type = "color", h.value = o, h.addEventListener("change", () => {
|
|
2867
|
+
this.closePop(), i(h.value);
|
|
2868
|
+
}), a.appendChild(h), l.append(n, r, a), t.appendChild(l);
|
|
2869
|
+
}
|
|
2870
|
+
colorMenu(t, e) {
|
|
2871
|
+
this.popup(
|
|
2872
|
+
t,
|
|
2873
|
+
(i) => {
|
|
2874
|
+
const s = e === "fore" ? this.foreColor : this.backColor;
|
|
2875
|
+
this.buildPaletteInto(i, s, (l) => this.applyColor(e, l));
|
|
2876
|
+
},
|
|
2877
|
+
e === "fore" ? "pop-forecolor" : "pop-backcolor"
|
|
2878
|
+
);
|
|
1596
2879
|
}
|
|
1597
2880
|
applyColor(t, e) {
|
|
1598
2881
|
t === "fore" ? (this.foreColor = e || "#000000", this.exec("foreColor", e || "#000000")) : (this.backColor = e || "transparent", this.exec("hiliteColor", e || "transparent")), this.syncColorSwatches(this.toolbar), this.selCtx && this.syncColorSwatches(this.selCtx);
|
|
@@ -1617,7 +2900,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1617
2900
|
this.popup(t, (e) => {
|
|
1618
2901
|
this.menuItems(
|
|
1619
2902
|
e,
|
|
1620
|
-
|
|
2903
|
+
it.map((i) => ({
|
|
1621
2904
|
label: i,
|
|
1622
2905
|
on: this.currentSize() === i,
|
|
1623
2906
|
action: () => this.applyFontSize(i)
|
|
@@ -1632,19 +2915,19 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1632
2915
|
const t = window.getSelection();
|
|
1633
2916
|
if (!t) return;
|
|
1634
2917
|
if (!t.rangeCount) {
|
|
1635
|
-
const
|
|
1636
|
-
|
|
2918
|
+
const o = document.createRange();
|
|
2919
|
+
o.selectNodeContents(this.ed), o.collapse(!0), t.addRange(o);
|
|
1637
2920
|
}
|
|
1638
2921
|
if (!t.isCollapsed) return;
|
|
1639
2922
|
const e = t.getRangeAt(0), i = e.startContainer;
|
|
1640
2923
|
if (i.nodeType === 3) {
|
|
1641
|
-
const
|
|
1642
|
-
let
|
|
1643
|
-
for (;
|
|
1644
|
-
for (; r <
|
|
1645
|
-
if (r >
|
|
1646
|
-
const
|
|
1647
|
-
|
|
2924
|
+
const o = i.data;
|
|
2925
|
+
let n = e.startOffset, r = e.startOffset;
|
|
2926
|
+
for (; n > 0 && /\S/.test(o[n - 1]); ) n--;
|
|
2927
|
+
for (; r < o.length && /\S/.test(o[r]); ) r++;
|
|
2928
|
+
if (r > n) {
|
|
2929
|
+
const a = document.createRange();
|
|
2930
|
+
a.setStart(i, n), a.setEnd(i, r), t.removeAllRanges(), t.addRange(a), this.savedRange = a.cloneRange();
|
|
1648
2931
|
return;
|
|
1649
2932
|
}
|
|
1650
2933
|
}
|
|
@@ -1669,7 +2952,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1669
2952
|
this.saveSel(), this.refreshState(), this.onChange();
|
|
1670
2953
|
}
|
|
1671
2954
|
stepFontSize(t) {
|
|
1672
|
-
const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(
|
|
2955
|
+
const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(lt, Math.max(st, e + t));
|
|
1673
2956
|
i !== e && this.applyFontSize(i + "px");
|
|
1674
2957
|
}
|
|
1675
2958
|
/* ------------------------------------------------ case / spacing / link */
|
|
@@ -1678,28 +2961,30 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1678
2961
|
const e = window.getSelection();
|
|
1679
2962
|
if (!e || !e.rangeCount || e.isCollapsed) return;
|
|
1680
2963
|
const i = e.getRangeAt(0), s = document.createTreeWalker(this.ed, NodeFilter.SHOW_TEXT), l = [];
|
|
1681
|
-
let
|
|
1682
|
-
for (;
|
|
1683
|
-
l.forEach((
|
|
1684
|
-
const r =
|
|
1685
|
-
if (
|
|
1686
|
-
const h =
|
|
2964
|
+
let o;
|
|
2965
|
+
for (; o = s.nextNode(); ) i.intersectsNode(o) && l.push(o);
|
|
2966
|
+
l.forEach((n) => {
|
|
2967
|
+
const r = n === i.startContainer ? i.startOffset : 0, a = n === i.endContainer ? i.endOffset : n.data.length;
|
|
2968
|
+
if (a <= r) return;
|
|
2969
|
+
const h = n.data.slice(r, a);
|
|
1687
2970
|
let d = h;
|
|
1688
|
-
t === "lower" ? d = h.toLowerCase() : t === "upper" ? d = h.toUpperCase() : d = h.replace(/(^|\s)(\S)/g, (m, g,
|
|
2971
|
+
t === "lower" ? d = h.toLowerCase() : t === "upper" ? d = h.toUpperCase() : d = h.replace(/(^|\s)(\S)/g, (m, g, u) => g + u.toUpperCase()), n.replaceData(r, a - r, d);
|
|
1689
2972
|
}), this.saveSel(), this.refreshState(), this.onChange();
|
|
1690
2973
|
}
|
|
1691
2974
|
caseMenu(t) {
|
|
1692
2975
|
this.popup(t, (e) => {
|
|
1693
2976
|
this.menuItems(e, [
|
|
1694
|
-
{ label: this.t("lowercase"), icon:
|
|
1695
|
-
{ label: this.t("uppercase"), icon:
|
|
1696
|
-
{ label: this.t("capitalize"), icon:
|
|
2977
|
+
{ label: this.t("lowercase"), icon: c.lowercaseic, action: () => this.transformCase("lower") },
|
|
2978
|
+
{ label: this.t("uppercase"), icon: c.uppercaseic, action: () => this.transformCase("upper") },
|
|
2979
|
+
{ label: this.t("capitalize"), icon: c.capitalizeic, action: () => this.transformCase("capitalize") }
|
|
1697
2980
|
]);
|
|
1698
2981
|
});
|
|
1699
2982
|
}
|
|
1700
2983
|
applyBlockStyle(t, e) {
|
|
1701
|
-
this.restoreSel()
|
|
1702
|
-
|
|
2984
|
+
this.restoreSel();
|
|
2985
|
+
const i = this.selectedBlocks(), s = t === "lineHeight" ? "line-height" : t === "wordSpacing" ? "word-spacing" : "letter-spacing";
|
|
2986
|
+
i.forEach((l) => {
|
|
2987
|
+
e ? l.style[t] = e : l.style.removeProperty(s);
|
|
1703
2988
|
}), this.saveSel(), this.onChange();
|
|
1704
2989
|
}
|
|
1705
2990
|
currentBlockStyle(t) {
|
|
@@ -1711,7 +2996,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1711
2996
|
this.popup(t, (i) => {
|
|
1712
2997
|
this.menuItems(i, [
|
|
1713
2998
|
{ label: this.t("normal"), on: !e, action: () => this.applyBlockStyle("lineHeight", "") },
|
|
1714
|
-
...
|
|
2999
|
+
...ot.map((s) => ({
|
|
1715
3000
|
label: s,
|
|
1716
3001
|
on: e === s,
|
|
1717
3002
|
action: () => this.applyBlockStyle("lineHeight", s)
|
|
@@ -1724,7 +3009,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1724
3009
|
this.popup(t, (i) => {
|
|
1725
3010
|
this.menuItems(i, [
|
|
1726
3011
|
{ label: this.t("normal"), on: !e, action: () => this.applyBlockStyle("wordSpacing", "") },
|
|
1727
|
-
...
|
|
3012
|
+
...nt.map((s) => ({
|
|
1728
3013
|
label: s,
|
|
1729
3014
|
on: e === s,
|
|
1730
3015
|
action: () => this.applyBlockStyle("wordSpacing", s)
|
|
@@ -1732,6 +3017,19 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1732
3017
|
]);
|
|
1733
3018
|
});
|
|
1734
3019
|
}
|
|
3020
|
+
letterSpacingMenu(t) {
|
|
3021
|
+
const e = this.currentBlockStyle("letterSpacing");
|
|
3022
|
+
this.popup(t, (i) => {
|
|
3023
|
+
this.menuItems(i, [
|
|
3024
|
+
{ label: this.t("normal"), on: !e, action: () => this.applyBlockStyle("letterSpacing", "") },
|
|
3025
|
+
...rt.map((s) => ({
|
|
3026
|
+
label: s,
|
|
3027
|
+
on: e === s,
|
|
3028
|
+
action: () => this.applyBlockStyle("letterSpacing", s)
|
|
3029
|
+
}))
|
|
3030
|
+
]);
|
|
3031
|
+
});
|
|
3032
|
+
}
|
|
1735
3033
|
closestAnchor() {
|
|
1736
3034
|
const t = window.getSelection();
|
|
1737
3035
|
let e = t && this.ed.contains(t.anchorNode) ? t.anchorNode : null;
|
|
@@ -1776,8 +3074,8 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1776
3074
|
(s) => {
|
|
1777
3075
|
const l = document.createElement("div");
|
|
1778
3076
|
l.style.cssText = "display:flex;align-items:center;gap:10px;margin:10px 0;min-width:360px";
|
|
1779
|
-
const
|
|
1780
|
-
|
|
3077
|
+
const o = document.createElement("span");
|
|
3078
|
+
o.style.cssText = "width:60px;color:#556;flex:none", o.textContent = this.t("linkurl"), e = document.createElement("input"), e.type = "url", e.placeholder = "https://", e.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", e.value = (t == null ? void 0 : t.getAttribute("href")) || "", l.append(o, e), s.appendChild(l), setTimeout(() => e.focus(), 0);
|
|
1781
3079
|
},
|
|
1782
3080
|
i
|
|
1783
3081
|
);
|
|
@@ -1786,7 +3084,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1786
3084
|
this.popup(t, (e) => {
|
|
1787
3085
|
this.menuItems(
|
|
1788
3086
|
e,
|
|
1789
|
-
|
|
3087
|
+
V.map(([i, s]) => ({
|
|
1790
3088
|
label: this.blockLabel(i),
|
|
1791
3089
|
previewStyle: i.startsWith("h") ? `font-weight:700;font-size:${22 - 2 * +i[1]}px` : i === "pre" ? "font-family:monospace" : "",
|
|
1792
3090
|
on: this.currentBlock() === i,
|
|
@@ -1809,15 +3107,15 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1809
3107
|
s.className = "tgrid";
|
|
1810
3108
|
const l = document.createElement("div");
|
|
1811
3109
|
l.className = "tgridlbl", l.textContent = "1 × 1";
|
|
1812
|
-
const
|
|
1813
|
-
for (let
|
|
3110
|
+
const o = [];
|
|
3111
|
+
for (let n = 0; n < 8; n++)
|
|
1814
3112
|
for (let r = 0; r < 10; r++) {
|
|
1815
|
-
const
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
}),
|
|
1819
|
-
this.closePop(), this.insertTable(
|
|
1820
|
-
}),
|
|
3113
|
+
const a = document.createElement("span");
|
|
3114
|
+
a.dataset.r = String(n), a.dataset.c = String(r), a.addEventListener("mouseenter", () => {
|
|
3115
|
+
o.forEach((h) => h.classList.toggle("hot", +h.dataset.r <= n && +h.dataset.c <= r)), l.textContent = r + 1 + " × " + (n + 1);
|
|
3116
|
+
}), a.addEventListener("click", () => {
|
|
3117
|
+
this.closePop(), this.insertTable(n + 1, r + 1), e == null || e();
|
|
3118
|
+
}), o.push(a), s.appendChild(a);
|
|
1821
3119
|
}
|
|
1822
3120
|
i.append(s, l), t.appendChild(i);
|
|
1823
3121
|
}
|
|
@@ -1848,68 +3146,93 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1848
3146
|
* behavior changes, just named lookup. Only `forecolor` yields multiple elements
|
|
1849
3147
|
* (the quick color chips); everything else yields one. */
|
|
1850
3148
|
buildToolbarRegistry() {
|
|
1851
|
-
const t = this.tbtn(
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
fontsize: () => this.tsel("w-size", "sizesel", "", (e) => this.sizeMenu(e)),
|
|
3149
|
+
const t = this.tbtn(c.tableic, this.t("quicktable"), () => this.tableGrid(t)), e = {
|
|
3150
|
+
undo: () => this.tbtn(c.undo, this.t("undo"), () => this.exec("undo")),
|
|
3151
|
+
redo: () => this.tbtn(c.redo, this.t("redo"), () => this.exec("redo")),
|
|
3152
|
+
preview: () => this.tbtn(c.prevw, this.t("preview"), () => this.previewDlg()),
|
|
3153
|
+
print: () => this.tbtn(c.printic, this.t("print"), () => this.printDoc()),
|
|
3154
|
+
importword: () => this.tbtn(c.wordic, this.t("importword"), () => this.pickWordDoc()),
|
|
3155
|
+
revhistory: () => this.tbtn(c.historyic, this.t("revhistory"), () => this.revisionDlg()),
|
|
3156
|
+
fontfamily: () => this.tsel("w-font", "fontsel", "", (i) => this.fontMenu(i)),
|
|
3157
|
+
fontsize: () => this.tsel("w-size", "sizesel", "", (i) => this.sizeMenu(i)),
|
|
1861
3158
|
fontsizeincrease: () => this.stepBtn(1),
|
|
1862
3159
|
fontsizedecrease: () => this.stepBtn(-1),
|
|
1863
|
-
bold: () => this.tbtn(
|
|
1864
|
-
italic: () => this.tbtn(
|
|
1865
|
-
underline: () => this.tbtn(
|
|
1866
|
-
strikethrough: () => this.tbtn(
|
|
3160
|
+
bold: () => this.tbtn(c.bold, this.t("bold"), () => this.exec("bold"), "bold"),
|
|
3161
|
+
italic: () => this.tbtn(c.italic, this.t("italic"), () => this.exec("italic"), "italic"),
|
|
3162
|
+
underline: () => this.tbtn(c.underline, this.t("underline"), () => this.exec("underline"), "underline"),
|
|
3163
|
+
strikethrough: () => this.tbtn(c.strikethrough, this.t("strikethrough"), () => this.exec("strikeThrough"), "strikeThrough"),
|
|
1867
3164
|
forecolor: () => this.colorChips(),
|
|
1868
3165
|
backcolor: () => this.menuTbtn(
|
|
1869
|
-
|
|
3166
|
+
c.backcolor + '<span class="colorbar" data-cb="back"></span>',
|
|
1870
3167
|
this.t("backcolor"),
|
|
1871
|
-
(
|
|
3168
|
+
(i) => this.colorMenu(i, "back")
|
|
1872
3169
|
),
|
|
1873
|
-
alignleft: () => this.tbtn(
|
|
1874
|
-
aligncenter: () => this.tbtn(
|
|
1875
|
-
alignright: () => this.tbtn(
|
|
1876
|
-
alignjustify: () => this.tbtn(
|
|
1877
|
-
bullist: () => this.menuTbtn(
|
|
1878
|
-
numlist: () => this.menuTbtn(
|
|
1879
|
-
outdent: () => this.tbtn(
|
|
1880
|
-
indent: () => this.tbtn(
|
|
1881
|
-
link: () => this.tbtn(
|
|
1882
|
-
blockquote: () => this.tbtn(
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
3170
|
+
alignleft: () => this.tbtn(c.alignleft, this.t("alignleft"), () => this.exec("justifyLeft"), "justifyLeft"),
|
|
3171
|
+
aligncenter: () => this.tbtn(c.aligncenter, this.t("aligncenter"), () => this.exec("justifyCenter"), "justifyCenter"),
|
|
3172
|
+
alignright: () => this.tbtn(c.alignright, this.t("alignright"), () => this.exec("justifyRight"), "justifyRight"),
|
|
3173
|
+
alignjustify: () => this.tbtn(c.alignjustify, this.t("alignjustify"), () => this.exec("justifyFull"), "justifyFull"),
|
|
3174
|
+
bullist: () => this.menuTbtn(c.bullist, this.t("bullist"), (i) => this.listMenu(i, "ul"), "insertUnorderedList"),
|
|
3175
|
+
numlist: () => this.menuTbtn(c.numlist, this.t("numlist"), (i) => this.listMenu(i, "ol"), "insertOrderedList"),
|
|
3176
|
+
outdent: () => this.tbtn(c.outdent, this.t("outdent"), () => this.exec("outdent")),
|
|
3177
|
+
indent: () => this.tbtn(c.indent, this.t("indent"), () => this.exec("indent")),
|
|
3178
|
+
link: () => this.tbtn(c.link, this.t("linkttl"), () => this.linkDlg()),
|
|
3179
|
+
blockquote: () => this.tbtn(c.quote, this.t("quote"), () => this.toggleBlock("blockquote"), "blockquote"),
|
|
3180
|
+
code: () => this.tbtn(c.inlinecodeic, this.t("code"), () => this.toggleInlineCode(), "code"),
|
|
3181
|
+
codesample: () => this.tbtn(c.codesampleic, this.t("codesample"), () => this.codeDlg()),
|
|
3182
|
+
changecase: () => this.menuTbtn(c.caseic, this.t("changecase"), (i) => this.caseMenu(i)),
|
|
3183
|
+
lineheight: () => this.menuTbtn(c.lineheight, this.t("lineheight"), (i) => this.lineHeightMenu(i)),
|
|
3184
|
+
wordspacing: () => this.menuTbtn(c.wordspacing, this.t("wordspacing"), (i) => this.wordSpacingMenu(i)),
|
|
3185
|
+
letterspacing: () => this.menuTbtn(c.letterspacing, this.t("letterspacing"), (i) => this.letterSpacingMenu(i)),
|
|
3186
|
+
removeformat: () => this.tbtn(c.clearformatic, this.t("removeformat"), () => this.exec("removeFormat")),
|
|
3187
|
+
blocks: () => this.tsel("w-block", "blocksel", this.t("para"), (i) => this.blocksMenu(i)),
|
|
3188
|
+
ltr: () => this.tbtn(c.ltr, this.t("ltr"), () => this.setDir("ltr"), "ltr"),
|
|
3189
|
+
rtl: () => this.tbtn(c.rtl, this.t("rtl"), () => this.setDir("rtl"), "rtl"),
|
|
3190
|
+
quickimage: () => this.tbtn(c.image, this.t("quickimage"), () => this.insertImagePlaceholder()),
|
|
3191
|
+
quickvideo: () => this.tbtn(c.video, this.t("quickvideo"), () => this.videoDlg()),
|
|
1891
3192
|
quicktable: () => t,
|
|
1892
|
-
template: () => this.menuTbtn(
|
|
1893
|
-
charmap: () => this.tbtn(
|
|
1894
|
-
|
|
1895
|
-
|
|
3193
|
+
template: () => this.menuTbtn(c.templateic, this.t("template"), (i) => this.templateMenu(i)),
|
|
3194
|
+
charmap: () => this.tbtn(c.charic, this.t("charmap"), () => this.charMap()),
|
|
3195
|
+
emoji: () => this.tbtn(c.emojiic, this.t("emoji"), () => this.emojiMap()),
|
|
3196
|
+
fullscreen: () => this.tbtn(c.fullscreen, this.t("fullscreen"), () => this.toggleFullscreen(), "fullscreen"),
|
|
3197
|
+
sourcecode: () => this.tbtn(c.srcic, this.t("sourcecode"), () => this.sourceDlg())
|
|
1896
3198
|
};
|
|
3199
|
+
return e.styles = e.blocks, e.image = e.quickimage, e.media = e.quickvideo, e.table = e.quicktable, e;
|
|
1897
3200
|
}
|
|
1898
3201
|
buildToolbar() {
|
|
1899
3202
|
this.toolbar.innerHTML = "";
|
|
1900
|
-
const t = this.options.toolbar === !0 ?
|
|
3203
|
+
const t = this.options.toolbar === !0 ? J : this.options.toolbar, e = this.buildToolbarRegistry();
|
|
1901
3204
|
this.parseToolbarString(t).forEach((i) => {
|
|
1902
3205
|
const s = [];
|
|
1903
3206
|
i.forEach((l) => {
|
|
1904
|
-
const
|
|
1905
|
-
if (!
|
|
3207
|
+
const o = e[l];
|
|
3208
|
+
if (!o) {
|
|
1906
3209
|
console.warn(`FableEditor: unknown toolbar item "${l}"`);
|
|
1907
3210
|
return;
|
|
1908
3211
|
}
|
|
1909
|
-
const
|
|
1910
|
-
Array.isArray(
|
|
3212
|
+
const n = o();
|
|
3213
|
+
Array.isArray(n) ? s.push(...n) : s.push(n);
|
|
1911
3214
|
}), s.length && this.toolbar.appendChild(this.group(...s));
|
|
1912
|
-
}), this.
|
|
3215
|
+
}), this.tbrMore = this.tbtn(c.more, this.t("more"), () => {
|
|
3216
|
+
this.tbrExpanded = !this.tbrExpanded, this.updateToolbarOverflow();
|
|
3217
|
+
}), this.tbrMore.classList.add("tbr-more"), this.toolbar.appendChild(this.tbrMore), this.syncColorSwatches(this.toolbar), this.updateToolbarOverflow();
|
|
3218
|
+
}
|
|
3219
|
+
/** Responsive one-line toolbar: on mobile/tablet widths (or a narrow host
|
|
3220
|
+
* container) a toolbar that can't fit on a single row collapses to one
|
|
3221
|
+
* clipped row plus a trailing "…" button that expands/collapses the full
|
|
3222
|
+
* set. Driven by the editor's own width, so it also applies to narrow
|
|
3223
|
+
* panels on desktop. */
|
|
3224
|
+
updateToolbarOverflow() {
|
|
3225
|
+
const t = this.toolbar;
|
|
3226
|
+
if (!this.tbrMore) return;
|
|
3227
|
+
t.classList.add("tbr-measure");
|
|
3228
|
+
const e = t.scrollWidth > t.clientWidth + 1;
|
|
3229
|
+
t.classList.remove("tbr-measure");
|
|
3230
|
+
const i = this.shell.offsetWidth < I.TBR_COLLAPSE_MAX;
|
|
3231
|
+
if (!e || !i) {
|
|
3232
|
+
this.tbrExpanded = !1, t.classList.remove("collapsible", "expanded"), this.tbrMore.classList.remove("on");
|
|
3233
|
+
return;
|
|
3234
|
+
}
|
|
3235
|
+
t.classList.add("collapsible"), t.classList.toggle("expanded", this.tbrExpanded), this.tbrMore.classList.toggle("on", this.tbrExpanded);
|
|
1913
3236
|
}
|
|
1914
3237
|
/* ---------------------------------------------------------- menubar */
|
|
1915
3238
|
mItem(t, e, i, s) {
|
|
@@ -1919,103 +3242,116 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
1919
3242
|
this.menubar.innerHTML = "";
|
|
1920
3243
|
const t = {
|
|
1921
3244
|
file: [
|
|
1922
|
-
this.mItem("newdoc",
|
|
3245
|
+
this.mItem("newdoc", c.newic, () => {
|
|
1923
3246
|
this.recordRevision(), this.ed.innerHTML = "<p><br></p>", this.onChange();
|
|
1924
3247
|
}),
|
|
1925
3248
|
"|",
|
|
1926
|
-
this.mItem("importword",
|
|
1927
|
-
this.mItem("restoredraft",
|
|
3249
|
+
this.mItem("importword", c.wordic, () => this.pickWordDoc()),
|
|
3250
|
+
this.mItem("restoredraft", c.draftic, () => {
|
|
1928
3251
|
this.restoreDraft() || alert(this.t("draftempty"));
|
|
1929
3252
|
}),
|
|
1930
|
-
this.mItem("revhistory",
|
|
3253
|
+
this.mItem("revhistory", c.historyic, () => this.revisionDlg()),
|
|
1931
3254
|
"|",
|
|
1932
|
-
this.mItem("preview",
|
|
1933
|
-
this.mItem("print",
|
|
3255
|
+
this.mItem("preview", c.prevw, () => this.previewDlg()),
|
|
3256
|
+
this.mItem("print", c.printic, () => this.printDoc(), "Ctrl+P")
|
|
1934
3257
|
],
|
|
1935
3258
|
edit: [
|
|
1936
|
-
this.mItem("undo",
|
|
1937
|
-
this.mItem("redo",
|
|
3259
|
+
this.mItem("undo", c.undo, () => this.exec("undo"), "Ctrl+Z"),
|
|
3260
|
+
this.mItem("redo", c.redo, () => this.exec("redo"), "Ctrl+Y"),
|
|
1938
3261
|
"|",
|
|
1939
|
-
this.mItem("cut",
|
|
1940
|
-
this.mItem("copy",
|
|
1941
|
-
this.mItem("paste",
|
|
3262
|
+
this.mItem("cut", c.cutic, () => this.exec("cut"), "Ctrl+X"),
|
|
3263
|
+
this.mItem("copy", c.copyic, () => this.exec("copy"), "Ctrl+C"),
|
|
3264
|
+
this.mItem("paste", c.pasteic, () => alert(this.t("pastehint")), "Ctrl+V"),
|
|
1942
3265
|
"|",
|
|
1943
|
-
this.mItem("selectall",
|
|
3266
|
+
this.mItem("selectall", c.selall, () => this.exec("selectAll"), "Ctrl+A")
|
|
1944
3267
|
],
|
|
1945
3268
|
view: [
|
|
1946
|
-
this.mItem("fullscreen",
|
|
1947
|
-
this.mItem("preview",
|
|
1948
|
-
this.mItem("sourcecode",
|
|
3269
|
+
this.mItem("fullscreen", c.fullscreen, () => this.toggleFullscreen()),
|
|
3270
|
+
this.mItem("preview", c.prevw, () => this.previewDlg()),
|
|
3271
|
+
this.mItem("sourcecode", c.srcic, () => this.sourceDlg())
|
|
1949
3272
|
],
|
|
1950
3273
|
insert: [
|
|
1951
|
-
this.mItem("link",
|
|
1952
|
-
this.mItem("image",
|
|
1953
|
-
|
|
1954
|
-
{ label: this.t("
|
|
1955
|
-
this.mItem("
|
|
3274
|
+
this.mItem("link", c.link, () => this.linkDlg()),
|
|
3275
|
+
this.mItem("image", c.image, () => this.insertImagePlaceholder()),
|
|
3276
|
+
this.mItem("video", c.video, () => this.videoDlg()),
|
|
3277
|
+
{ label: this.t("inserttable"), icon: c.tableic, action: () => this.tableGrid(this.menubar.querySelector('[data-menu-key="table"]') || this.menubar) },
|
|
3278
|
+
this.mItem("codesample", c.codesampleic, () => this.codeDlg()),
|
|
3279
|
+
{ label: this.t("template"), icon: c.templateic, subBuild: (s) => this.buildTemplatePickInto(s) },
|
|
3280
|
+
this.mItem("hr", c.hric, () => this.exec("insertHorizontalRule")),
|
|
1956
3281
|
"|",
|
|
1957
|
-
this.mItem("charmap",
|
|
3282
|
+
this.mItem("charmap", c.charic, () => this.charMap()),
|
|
3283
|
+
this.mItem("emoji", c.emojiic, () => this.emojiMap()),
|
|
1958
3284
|
this.mItem(
|
|
1959
3285
|
"datetime",
|
|
1960
|
-
|
|
3286
|
+
c.dateic,
|
|
1961
3287
|
() => this.exec("insertText", (/* @__PURE__ */ new Date()).toLocaleString(this.lang === "ar" ? "ar-AE" : "en-GB"))
|
|
1962
3288
|
),
|
|
1963
3289
|
"|",
|
|
1964
3290
|
{
|
|
1965
3291
|
label: this.t("pagebreak"),
|
|
1966
|
-
icon:
|
|
3292
|
+
icon: c.pbic,
|
|
1967
3293
|
action: () => {
|
|
1968
3294
|
this.restoreSel(), document.execCommand("insertHTML", !1, '<hr class="pagebreak"><p><br></p>'), this.onChange();
|
|
1969
3295
|
}
|
|
1970
3296
|
},
|
|
1971
|
-
this.mItem("nbsp",
|
|
3297
|
+
this.mItem("nbsp", c.nbspic, () => this.exec("insertText", " "))
|
|
1972
3298
|
],
|
|
1973
3299
|
format: [
|
|
1974
|
-
this.mItem("bold",
|
|
1975
|
-
this.mItem("italic",
|
|
1976
|
-
this.mItem("underline",
|
|
1977
|
-
this.mItem("strikethrough",
|
|
1978
|
-
this.mItem("superscript",
|
|
1979
|
-
this.mItem("subscript",
|
|
3300
|
+
this.mItem("bold", c.bold, () => this.exec("bold"), "Ctrl+B"),
|
|
3301
|
+
this.mItem("italic", c.italic, () => this.exec("italic"), "Ctrl+I"),
|
|
3302
|
+
this.mItem("underline", c.underline, () => this.exec("underline"), "Ctrl+U"),
|
|
3303
|
+
this.mItem("strikethrough", c.strikethrough, () => this.exec("strikeThrough")),
|
|
3304
|
+
this.mItem("superscript", c.superscriptic, () => this.exec("superscript")),
|
|
3305
|
+
this.mItem("subscript", c.subscriptic, () => this.exec("subscript")),
|
|
3306
|
+
this.mItem("code", c.inlinecodeic, () => this.toggleInlineCode()),
|
|
1980
3307
|
"|",
|
|
1981
|
-
this.mItem("lowercase",
|
|
1982
|
-
this.mItem("uppercase",
|
|
1983
|
-
this.mItem("capitalize",
|
|
3308
|
+
this.mItem("lowercase", c.lowercaseic, () => this.transformCase("lower")),
|
|
3309
|
+
this.mItem("uppercase", c.uppercaseic, () => this.transformCase("upper")),
|
|
3310
|
+
this.mItem("capitalize", c.capitalizeic, () => this.transformCase("capitalize")),
|
|
1984
3311
|
"|",
|
|
1985
|
-
this.mItem("clearformat",
|
|
3312
|
+
this.mItem("clearformat", c.clearformatic, () => this.exec("removeFormat"))
|
|
1986
3313
|
],
|
|
1987
|
-
tools: [this.mItem("sourcecode",
|
|
3314
|
+
tools: [this.mItem("sourcecode", c.srcic, () => this.sourceDlg()), this.mItem("wordcount", c.wcic, () => this.wordCountDlg())],
|
|
1988
3315
|
table: [
|
|
1989
|
-
{ label: this.t("inserttable"), icon:
|
|
3316
|
+
{ label: this.t("inserttable"), icon: c.tableic, subBuild: (s) => this.buildTableGridInto(s) },
|
|
1990
3317
|
"|",
|
|
1991
3318
|
{
|
|
1992
3319
|
label: this.t("cell"),
|
|
1993
|
-
sub: [
|
|
3320
|
+
sub: [
|
|
3321
|
+
{ label: this.t("cellprops"), icon: c.tableic, action: () => this.cellPropsDlg() },
|
|
3322
|
+
{ label: this.t("cellbg"), icon: c.palette, subBuild: (s) => this.buildCellFillInto(s) }
|
|
3323
|
+
]
|
|
1994
3324
|
},
|
|
1995
3325
|
{
|
|
1996
3326
|
label: this.t("row"),
|
|
1997
3327
|
sub: [
|
|
1998
|
-
{ label: this.t("rowabove"), icon:
|
|
1999
|
-
{ label: this.t("rowbelow"), icon:
|
|
2000
|
-
{ label: this.t("delrow"), icon:
|
|
3328
|
+
{ label: this.t("rowabove"), icon: c.rowbefore, action: () => this.tableOp("rowabove"), hover: (s) => this.setOpTarget(s ? "row" : null) },
|
|
3329
|
+
{ label: this.t("rowbelow"), icon: c.rowafter, action: () => this.tableOp("rowbelow"), hover: (s) => this.setOpTarget(s ? "row" : null) },
|
|
3330
|
+
{ label: this.t("delrow"), icon: c.rowdelete, action: () => this.tableOp("delrow"), hover: (s) => this.setOpTarget(s ? "row" : null) },
|
|
3331
|
+
"|",
|
|
3332
|
+
{ label: this.t("moverowup"), icon: c.moverowup, action: () => this.tableMove("rowup"), hover: (s) => this.setOpTarget(s ? "row" : null) },
|
|
3333
|
+
{ label: this.t("moverowdown"), icon: c.moverowdown, action: () => this.tableMove("rowdown"), hover: (s) => this.setOpTarget(s ? "row" : null) },
|
|
2001
3334
|
"|",
|
|
2002
|
-
{ label: this.t("rowprops"), icon:
|
|
3335
|
+
{ label: this.t("rowprops"), icon: c.tableic, action: () => this.rowPropsDlg(), hover: (s) => this.setOpTarget(s ? "row" : null) }
|
|
2003
3336
|
]
|
|
2004
3337
|
},
|
|
2005
3338
|
{
|
|
2006
3339
|
label: this.t("column"),
|
|
2007
3340
|
sub: [
|
|
2008
|
-
{ label: this.t("colbefore"), icon:
|
|
2009
|
-
{ label: this.t("colafter"), icon:
|
|
2010
|
-
{ label: this.t("delcol"), icon:
|
|
3341
|
+
{ label: this.t("colbefore"), icon: c.colbefore, action: () => this.tableOp("colbefore"), hover: (s) => this.setOpTarget(s ? "col" : null) },
|
|
3342
|
+
{ label: this.t("colafter"), icon: c.colafter, action: () => this.tableOp("colafter"), hover: (s) => this.setOpTarget(s ? "col" : null) },
|
|
3343
|
+
{ label: this.t("delcol"), icon: c.coldelete, action: () => this.tableOp("delcol"), hover: (s) => this.setOpTarget(s ? "col" : null) },
|
|
2011
3344
|
"|",
|
|
2012
|
-
{ label: this.t("
|
|
3345
|
+
{ label: this.t("movecolleft"), icon: c.movecolleft, action: () => this.tableMove("colleft"), hover: (s) => this.setOpTarget(s ? "col" : null) },
|
|
3346
|
+
{ label: this.t("movecolright"), icon: c.movecolright, action: () => this.tableMove("colright"), hover: (s) => this.setOpTarget(s ? "col" : null) },
|
|
3347
|
+
"|",
|
|
3348
|
+
{ label: this.t("colprops"), icon: c.tableic, action: () => this.colPropsDlg(), hover: (s) => this.setOpTarget(s ? "col" : null) }
|
|
2013
3349
|
]
|
|
2014
3350
|
},
|
|
2015
3351
|
"|",
|
|
2016
3352
|
{
|
|
2017
3353
|
label: this.t("tablepropsttl"),
|
|
2018
|
-
icon:
|
|
3354
|
+
icon: c.tableic,
|
|
2019
3355
|
action: () => {
|
|
2020
3356
|
const s = this.currentCell();
|
|
2021
3357
|
if (!s) {
|
|
@@ -2025,10 +3361,10 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2025
3361
|
this.tblActive = s.closest("table"), this.tablePropsDlg();
|
|
2026
3362
|
}
|
|
2027
3363
|
},
|
|
2028
|
-
{ label: this.t("deltable"), icon:
|
|
3364
|
+
{ label: this.t("deltable"), icon: c.trash, action: () => this.tableOp("deltable") }
|
|
2029
3365
|
],
|
|
2030
|
-
help: [this.mItem("helpttl",
|
|
2031
|
-
}, e = this.options.menubar === !0 ?
|
|
3366
|
+
help: [this.mItem("helpttl", c.helpic, () => this.helpDlg(), "Alt+0")]
|
|
3367
|
+
}, e = this.options.menubar === !0 ? tt : this.options.menubar, i = /* @__PURE__ */ new Set();
|
|
2032
3368
|
e.split(/\s+/).filter(Boolean).forEach((s) => {
|
|
2033
3369
|
if (i.has(s)) return;
|
|
2034
3370
|
if (i.add(s), !t[s]) {
|
|
@@ -2036,38 +3372,93 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2036
3372
|
return;
|
|
2037
3373
|
}
|
|
2038
3374
|
const l = document.createElement("button");
|
|
2039
|
-
l.type = "button", l.textContent = this.t(s), l.dataset.menuKey = s, l.addEventListener("mousedown", (
|
|
2040
|
-
|
|
2041
|
-
}), l.addEventListener("click", () => this.popup(l, (
|
|
3375
|
+
l.type = "button", l.textContent = this.t(s), l.dataset.menuKey = s, l.addEventListener("mousedown", (o) => {
|
|
3376
|
+
o.preventDefault(), this.saveSel();
|
|
3377
|
+
}), l.addEventListener("click", () => this.popup(l, (o) => this.menuItems(o, t[s]))), this.menubar.appendChild(l);
|
|
2042
3378
|
});
|
|
2043
3379
|
}
|
|
2044
3380
|
/* ---------------------------------------------------------- table ops */
|
|
2045
3381
|
tableOp(t) {
|
|
2046
|
-
var r,
|
|
3382
|
+
var r, a, h;
|
|
2047
3383
|
this.restoreSel();
|
|
2048
3384
|
const e = window.getSelection();
|
|
2049
3385
|
if (!e) return;
|
|
2050
|
-
const i = ((r = this.closestBlock(e.anchorNode)) == null ? void 0 : r.closest("td,th")) || (e.anchorNode && e.anchorNode.nodeType === 1 ? (h = (
|
|
3386
|
+
const i = ((r = this.closestBlock(e.anchorNode)) == null ? void 0 : r.closest("td,th")) || (e.anchorNode && e.anchorNode.nodeType === 1 ? (h = (a = e.anchorNode).closest) == null ? void 0 : h.call(a, "td,th") : null);
|
|
2051
3387
|
if (!i) return;
|
|
2052
|
-
const s = i.parentElement, l = i.closest("table"),
|
|
3388
|
+
const s = i.parentElement, l = i.closest("table"), o = Array.from(s.children).indexOf(i), n = () => {
|
|
2053
3389
|
const d = s.cloneNode(!1);
|
|
2054
3390
|
return Array.from(s.children).forEach((m) => {
|
|
2055
|
-
const g = document.createElement("td"),
|
|
2056
|
-
|
|
3391
|
+
const g = document.createElement("td"), u = m.getAttribute("style");
|
|
3392
|
+
u && g.setAttribute("style", u), g.style.removeProperty("background-color"), g.innerHTML = "<br>", d.appendChild(g);
|
|
2057
3393
|
}), d;
|
|
2058
3394
|
};
|
|
2059
|
-
if (t === "rowabove" && s.before(
|
|
3395
|
+
if (t === "rowabove" && s.before(n()), t === "rowbelow" && s.after(n()), t === "delrow") {
|
|
2060
3396
|
const d = s.parentElement;
|
|
2061
3397
|
s.remove(), d.querySelector("tr") || l.remove();
|
|
2062
3398
|
}
|
|
2063
3399
|
(t === "colbefore" || t === "colafter") && l.querySelectorAll("tr").forEach((d) => {
|
|
2064
|
-
const m = d.children[Math.min(
|
|
2065
|
-
|
|
3400
|
+
const m = d.children[Math.min(o, d.children.length - 1)], g = document.createElement("td"), u = m.getAttribute("style");
|
|
3401
|
+
u && g.setAttribute("style", u), g.style.removeProperty("width"), g.style.removeProperty("background-color"), g.innerHTML = "<br>", t === "colbefore" ? m.before(g) : m.after(g);
|
|
2066
3402
|
}), t === "delcol" && (l.querySelectorAll("tr").forEach((d) => {
|
|
2067
3403
|
var m;
|
|
2068
|
-
return (m = d.children[
|
|
3404
|
+
return (m = d.children[o]) == null ? void 0 : m.remove();
|
|
2069
3405
|
}), l.querySelector("td,th") || l.remove()), t === "deltable" && l.remove(), this.onChange(), this.positionTableHandles();
|
|
2070
3406
|
}
|
|
3407
|
+
/** Reorders the current row/column: 'rowup'/'rowdown' swap the caret's row with
|
|
3408
|
+
* its neighbour, 'colleft'/'colright' move the caret's column one position in
|
|
3409
|
+
* DOM order across every row. The caret travels with the moved cell. */
|
|
3410
|
+
tableMove(t) {
|
|
3411
|
+
this.restoreSel();
|
|
3412
|
+
const e = this.currentCell();
|
|
3413
|
+
if (!e) return;
|
|
3414
|
+
const i = e.parentElement, s = e.closest("table"), l = Array.from(i.children).indexOf(e);
|
|
3415
|
+
if (t === "rowup") {
|
|
3416
|
+
const r = i.previousElementSibling;
|
|
3417
|
+
r && r.before(i);
|
|
3418
|
+
}
|
|
3419
|
+
if (t === "rowdown") {
|
|
3420
|
+
const r = i.nextElementSibling;
|
|
3421
|
+
r && r.after(i);
|
|
3422
|
+
}
|
|
3423
|
+
t === "colleft" && l > 0 && s.querySelectorAll("tr").forEach((r) => {
|
|
3424
|
+
const a = r.children[l], h = r.children[l - 1];
|
|
3425
|
+
a && h && h.before(a);
|
|
3426
|
+
}), t === "colright" && s.querySelectorAll("tr").forEach((r) => {
|
|
3427
|
+
const a = r.children[l], h = r.children[l + 1];
|
|
3428
|
+
a && h && h.after(a);
|
|
3429
|
+
});
|
|
3430
|
+
const o = document.createRange();
|
|
3431
|
+
o.selectNodeContents(e), o.collapse(!0);
|
|
3432
|
+
const n = window.getSelection();
|
|
3433
|
+
n && (n.removeAllRanges(), n.addRange(o)), this.saveSel(), this.onChange(), this.positionTableHandles(), this.positionCellMarker();
|
|
3434
|
+
}
|
|
3435
|
+
/** Align the whole table via auto margins — same semantics as the align
|
|
3436
|
+
* field in the table-properties dialog. */
|
|
3437
|
+
alignTable(t) {
|
|
3438
|
+
const e = this.tblActive;
|
|
3439
|
+
e && (e.style.marginLeft = t === "left" ? "0" : "auto", e.style.marginRight = t === "right" ? "0" : "auto", this.onChange(), this.positionTableHandles());
|
|
3440
|
+
}
|
|
3441
|
+
/** Color grid applying a background to the caret's cell — the direct way to
|
|
3442
|
+
* build header rows (the toolbar's backcolor highlights text, not cells). */
|
|
3443
|
+
buildCellFillInto(t) {
|
|
3444
|
+
const e = (s) => {
|
|
3445
|
+
const l = this.currentCell();
|
|
3446
|
+
if (!l) {
|
|
3447
|
+
alert(this.t("nocell"));
|
|
3448
|
+
return;
|
|
3449
|
+
}
|
|
3450
|
+
this.setOrClear(l, "background-color", s || ""), this.onChange();
|
|
3451
|
+
}, i = this.currentCell();
|
|
3452
|
+
this.buildPaletteInto(t, this.cssToHex(i ? i.style.backgroundColor : ""), e);
|
|
3453
|
+
}
|
|
3454
|
+
/** style.backgroundColor reads back as rgb(...) — normalise to #rrggbb for the picker. */
|
|
3455
|
+
cssToHex(t) {
|
|
3456
|
+
const e = t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
|
3457
|
+
return e ? "#" + e.slice(1, 4).map((i) => (+i).toString(16).padStart(2, "0")).join("") : t;
|
|
3458
|
+
}
|
|
3459
|
+
cellFillMenu(t) {
|
|
3460
|
+
this.popup(t, (e) => this.buildCellFillInto(e), "pop-cellbg");
|
|
3461
|
+
}
|
|
2071
3462
|
applyTableProps(t, e) {
|
|
2072
3463
|
e.width ? t.style.width = /^\d+$/.test(e.width) ? e.width + "px" : e.width : t.style.removeProperty("width");
|
|
2073
3464
|
const i = Array.from(t.querySelectorAll("td,th"));
|
|
@@ -2076,26 +3467,26 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2076
3467
|
tablePropsDlg() {
|
|
2077
3468
|
const t = this.tblActive;
|
|
2078
3469
|
if (!t) return;
|
|
2079
|
-
let e, i, s, l,
|
|
2080
|
-
const
|
|
3470
|
+
let e, i, s, l, o;
|
|
3471
|
+
const n = "display:flex;align-items:center;gap:10px;margin:10px 0", r = "width:120px;color:#556;flex:none", a = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", h = t.querySelector("td,th"), d = t.style.width || "", m = h && h.style.padding ? parseFloat(h.style.padding) : "", g = t.style.borderSpacing ? parseFloat(t.style.borderSpacing) : "", u = t.style.borderWidth ? parseFloat(t.style.borderWidth) : "", v = t.style.marginLeft, b = t.style.marginRight, x = v === "auto" && b === "auto" ? "center" : v === "auto" ? "right" : b === "auto" && v === "0" ? "left" : "";
|
|
2081
3472
|
this.dialog(
|
|
2082
3473
|
this.t("tablepropsttl"),
|
|
2083
|
-
(
|
|
2084
|
-
const M = (
|
|
2085
|
-
const
|
|
2086
|
-
|
|
2087
|
-
const
|
|
2088
|
-
|
|
3474
|
+
(C) => {
|
|
3475
|
+
const M = (w, k) => {
|
|
3476
|
+
const L = document.createElement("div");
|
|
3477
|
+
L.style.cssText = n;
|
|
3478
|
+
const H = document.createElement("span");
|
|
3479
|
+
H.style.cssText = r, H.textContent = this.t(w), L.append(H, k), C.appendChild(L);
|
|
2089
3480
|
};
|
|
2090
|
-
e = document.createElement("input"), e.type = "text", e.style.cssText =
|
|
3481
|
+
e = document.createElement("input"), e.type = "text", e.style.cssText = a, e.placeholder = "e.g. 600px or 100%", e.value = d, M("tblwidth", e), i = document.createElement("input"), i.type = "number", i.min = "0", i.style.cssText = a, i.value = String(m), M("tblcellpadding", i), s = document.createElement("input"), s.type = "number", s.min = "0", s.style.cssText = a, s.value = String(g), M("tblcellspacing", s), l = document.createElement("input"), l.type = "number", l.min = "0", l.style.cssText = a, l.value = String(u), M("tblborder", l), o = document.createElement("select"), o.style.cssText = a, [
|
|
2091
3482
|
["", "alignnone"],
|
|
2092
3483
|
["left", "alignleft"],
|
|
2093
3484
|
["center", "aligncenter"],
|
|
2094
3485
|
["right", "alignright"]
|
|
2095
|
-
].forEach(([
|
|
2096
|
-
const
|
|
2097
|
-
|
|
2098
|
-
}), M("tblalign",
|
|
3486
|
+
].forEach(([w, k]) => {
|
|
3487
|
+
const L = document.createElement("option");
|
|
3488
|
+
L.value = w, L.textContent = this.t(k), w === x && (L.selected = !0), o.appendChild(L);
|
|
3489
|
+
}), M("tblalign", o);
|
|
2099
3490
|
},
|
|
2100
3491
|
[
|
|
2101
3492
|
{ label: this.t("cancel"), action: () => this.closeDlg() },
|
|
@@ -2108,7 +3499,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2108
3499
|
cellpadding: i.value.trim(),
|
|
2109
3500
|
cellspacing: s.value.trim(),
|
|
2110
3501
|
border: l.value.trim(),
|
|
2111
|
-
align:
|
|
3502
|
+
align: o.value
|
|
2112
3503
|
}), this.closeDlg(), this.onChange(), this.positionTableHandles();
|
|
2113
3504
|
}
|
|
2114
3505
|
}
|
|
@@ -2147,8 +3538,8 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2147
3538
|
formSelect(t, e) {
|
|
2148
3539
|
const i = document.createElement("select");
|
|
2149
3540
|
return i.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit;background:#fff", t.forEach(([s, l]) => {
|
|
2150
|
-
const
|
|
2151
|
-
|
|
3541
|
+
const o = document.createElement("option");
|
|
3542
|
+
o.value = s, o.textContent = l, s === e && (o.selected = !0), i.appendChild(o);
|
|
2152
3543
|
}), i;
|
|
2153
3544
|
}
|
|
2154
3545
|
formBg(t) {
|
|
@@ -2158,8 +3549,8 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2158
3549
|
s.type = "color", s.value = i || "#ffffff", s.style.cssText = "width:36px;height:29px;border:1px solid #cfd6df;border-radius:4px;padding:1px;background:none;cursor:pointer";
|
|
2159
3550
|
const l = document.createElement("label");
|
|
2160
3551
|
l.style.cssText = "display:flex;align-items:center;gap:6px;cursor:pointer;color:#556";
|
|
2161
|
-
const
|
|
2162
|
-
return
|
|
3552
|
+
const o = document.createElement("input");
|
|
3553
|
+
return o.type = "checkbox", o.checked = !!i, l.append(o, document.createTextNode(this.t("fill"))), s.addEventListener("input", () => o.checked = !0), e.append(s, l), { wrap: e, color: s, fill: o };
|
|
2163
3554
|
}
|
|
2164
3555
|
setOrClear(t, e, i) {
|
|
2165
3556
|
i ? t.style.setProperty(e, /^(width|height)$/.test(e) && /^\d+$/.test(i) ? i + "px" : i) : t.style.removeProperty(e);
|
|
@@ -2170,11 +3561,11 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2170
3561
|
alert(this.t("nocell"));
|
|
2171
3562
|
return;
|
|
2172
3563
|
}
|
|
2173
|
-
let e, i, s, l,
|
|
3564
|
+
let e, i, s, l, o;
|
|
2174
3565
|
this.dialog(
|
|
2175
3566
|
this.t("cellprops").replace("…", ""),
|
|
2176
|
-
(
|
|
2177
|
-
e = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(
|
|
3567
|
+
(n) => {
|
|
3568
|
+
e = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(n, this.t("tblwidth"), e), i = this.formInput(t.style.height, "e.g. 40px"), this.formRow(n, this.t("tblheight"), i), s = this.formSelect(
|
|
2178
3569
|
[
|
|
2179
3570
|
["", this.t("alignnone")],
|
|
2180
3571
|
["left", this.t("alignleft")],
|
|
@@ -2182,7 +3573,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2182
3573
|
["right", this.t("alignright")]
|
|
2183
3574
|
],
|
|
2184
3575
|
t.style.textAlign || ""
|
|
2185
|
-
), this.formRow(
|
|
3576
|
+
), this.formRow(n, this.t("tblalign"), s), l = this.formSelect(
|
|
2186
3577
|
[
|
|
2187
3578
|
["", this.t("alignnone")],
|
|
2188
3579
|
["top", this.t("valigntop")],
|
|
@@ -2190,7 +3581,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2190
3581
|
["bottom", this.t("valignbottom")]
|
|
2191
3582
|
],
|
|
2192
3583
|
t.style.verticalAlign || ""
|
|
2193
|
-
), this.formRow(
|
|
3584
|
+
), this.formRow(n, this.t("valign"), l), o = this.formBg(t.style.backgroundColor || ""), this.formRow(n, this.t("backcolor"), o.wrap);
|
|
2194
3585
|
},
|
|
2195
3586
|
[
|
|
2196
3587
|
{ label: this.t("cancel"), action: () => this.closeDlg() },
|
|
@@ -2198,7 +3589,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2198
3589
|
label: this.t("save"),
|
|
2199
3590
|
primary: !0,
|
|
2200
3591
|
action: () => {
|
|
2201
|
-
this.setOrClear(t, "width", e.value.trim()), this.setOrClear(t, "height", i.value.trim()), this.setOrClear(t, "text-align", s.value), this.setOrClear(t, "vertical-align", l.value), this.setOrClear(t, "background-color",
|
|
3592
|
+
this.setOrClear(t, "width", e.value.trim()), this.setOrClear(t, "height", i.value.trim()), this.setOrClear(t, "text-align", s.value), this.setOrClear(t, "vertical-align", l.value), this.setOrClear(t, "background-color", o.fill.checked ? o.color.value : ""), this.closeDlg(), this.onChange(), this.positionTableHandles();
|
|
2202
3593
|
}
|
|
2203
3594
|
}
|
|
2204
3595
|
]
|
|
@@ -2236,11 +3627,11 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2236
3627
|
return;
|
|
2237
3628
|
}
|
|
2238
3629
|
const e = t.parentElement, i = t.closest("table"), s = Array.from(e.children).indexOf(t), l = Array.from(i.rows).map((r) => r.cells[s]).filter(Boolean);
|
|
2239
|
-
let
|
|
3630
|
+
let o, n;
|
|
2240
3631
|
this.dialog(
|
|
2241
3632
|
this.t("colprops").replace("…", ""),
|
|
2242
3633
|
(r) => {
|
|
2243
|
-
|
|
3634
|
+
o = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(r, this.t("tblwidth"), o), n = this.formBg(t.style.backgroundColor || ""), this.formRow(r, this.t("backcolor"), n.wrap);
|
|
2244
3635
|
},
|
|
2245
3636
|
[
|
|
2246
3637
|
{ label: this.t("cancel"), action: () => this.closeDlg() },
|
|
@@ -2249,7 +3640,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2249
3640
|
primary: !0,
|
|
2250
3641
|
action: () => {
|
|
2251
3642
|
l.forEach((r) => {
|
|
2252
|
-
this.setOrClear(r, "width",
|
|
3643
|
+
this.setOrClear(r, "width", o.value.trim()), this.setOrClear(r, "background-color", n.fill.checked ? n.color.value : "");
|
|
2253
3644
|
}), this.closeDlg(), this.onChange(), this.positionTableHandles();
|
|
2254
3645
|
}
|
|
2255
3646
|
}
|
|
@@ -2265,8 +3656,8 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2265
3656
|
const s = document.createElement("div");
|
|
2266
3657
|
s.className = "dlg", s.dir = this.dir(), s.innerHTML = `<header><span>${t}</span><button type="button">×</button></header>
|
|
2267
3658
|
<div class="body"></div><footer></footer>`, s.querySelector("header button").onclick = () => this.closeDlg(), e(s.querySelector(".body")), (i || [{ label: this.t("close"), primary: !0, action: () => this.closeDlg() }]).forEach((l) => {
|
|
2268
|
-
const
|
|
2269
|
-
|
|
3659
|
+
const o = document.createElement("button");
|
|
3660
|
+
o.type = "button", o.textContent = l.label, l.primary && (o.className = "pri"), o.onclick = l.action, s.querySelector("footer").appendChild(o);
|
|
2270
3661
|
}), this.dlgOvl.appendChild(s), this.dlgOvl.addEventListener("mousedown", (l) => {
|
|
2271
3662
|
l.target === this.dlgOvl && this.closeDlg();
|
|
2272
3663
|
}), document.body.appendChild(this.dlgOvl);
|
|
@@ -2320,19 +3711,37 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2320
3711
|
e.style.cssText = "width:640px;max-width:78vw;max-height:52vh;overflow:auto;border:1px solid #e3e3e3;border-radius:6px;padding:14px;font-family:Helvetica,Arial,sans-serif;font-size:14px", e.innerHTML = this.ed.innerHTML, t.appendChild(e);
|
|
2321
3712
|
});
|
|
2322
3713
|
}
|
|
3714
|
+
/** Two-pane picker shared by the special-character map and the emoji map:
|
|
3715
|
+
* fixed category tabs on the left, the active category's glyphs on the right. */
|
|
3716
|
+
glyphPickerDlg(t, e, i) {
|
|
3717
|
+
this.saveSel(), this.dialog(t, (s) => {
|
|
3718
|
+
const l = document.createElement("div");
|
|
3719
|
+
l.className = "chmap";
|
|
3720
|
+
const o = document.createElement("div");
|
|
3721
|
+
o.className = "chtabs";
|
|
3722
|
+
const n = document.createElement("div");
|
|
3723
|
+
n.className = "chpanel";
|
|
3724
|
+
const r = document.createElement("div");
|
|
3725
|
+
r.className = "chgrid" + (i ? " emgrid" : ""), n.appendChild(r);
|
|
3726
|
+
const a = (h) => {
|
|
3727
|
+
o.querySelectorAll("button").forEach((d, m) => d.classList.toggle("on", m === h)), r.innerHTML = "", e[h].chars.forEach((d) => {
|
|
3728
|
+
const m = document.createElement("button");
|
|
3729
|
+
m.type = "button", m.textContent = d, m.onclick = () => {
|
|
3730
|
+
this.closeDlg(), this.exec("insertText", d);
|
|
3731
|
+
}, r.appendChild(m);
|
|
3732
|
+
}), n.scrollTop = 0;
|
|
3733
|
+
};
|
|
3734
|
+
e.forEach((h, d) => {
|
|
3735
|
+
const m = document.createElement("button");
|
|
3736
|
+
m.type = "button", m.textContent = this.t(h.key), m.addEventListener("click", () => a(d)), o.appendChild(m);
|
|
3737
|
+
}), l.append(o, n), s.appendChild(l), a(0);
|
|
3738
|
+
});
|
|
3739
|
+
}
|
|
2323
3740
|
charMap() {
|
|
2324
|
-
this.
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
e.className = "chgrid", it.forEach((i) => {
|
|
2329
|
-
const s = document.createElement("button");
|
|
2330
|
-
s.textContent = i, s.onclick = () => {
|
|
2331
|
-
this.closeDlg(), this.exec("insertText", i);
|
|
2332
|
-
}, e.appendChild(s);
|
|
2333
|
-
}), t.appendChild(e);
|
|
2334
|
-
}
|
|
2335
|
-
);
|
|
3741
|
+
this.glyphPickerDlg(this.t("charmap").replace("…", ""), ht, !1);
|
|
3742
|
+
}
|
|
3743
|
+
emojiMap() {
|
|
3744
|
+
this.glyphPickerDlg(this.t("emoji").replace("…", ""), dt, !0);
|
|
2336
3745
|
}
|
|
2337
3746
|
printDoc() {
|
|
2338
3747
|
const t = window.open("", "_blank");
|
|
@@ -2345,7 +3754,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2345
3754
|
}
|
|
2346
3755
|
/* ---------------------------------------------- image upload placeholder */
|
|
2347
3756
|
imgPhHTML(t) {
|
|
2348
|
-
return `<div class="img-ph"${t ? ` id="${t}"` : ""} contenteditable="false">${
|
|
3757
|
+
return `<div class="img-ph"${t ? ` id="${t}"` : ""} contenteditable="false">${c.image}<span>${this.t("dropimage")}</span></div>`;
|
|
2349
3758
|
}
|
|
2350
3759
|
insertImagePlaceholder() {
|
|
2351
3760
|
this.restoreSel();
|
|
@@ -2366,15 +3775,24 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2366
3775
|
this.phActive !== t && (this.clearImgPlaceholderSel(), this.phActive = t, t.classList.add("active"), this.phCtx = document.createElement("div"), this.phCtx.className = "imgctx img-ph-ctx", this.phCtx.dir = this.dir(), document.body.appendChild(this.phCtx), this.renderPhCtxButtons());
|
|
2367
3776
|
}
|
|
2368
3777
|
renderPhCtxButtons() {
|
|
3778
|
+
var e;
|
|
2369
3779
|
const t = this.phCtx;
|
|
2370
3780
|
t && (t.innerHTML = "", t.append(
|
|
2371
|
-
this.ctxBtn(
|
|
3781
|
+
this.ctxBtn(c.uploadic, this.t("uploadimg"), () => {
|
|
2372
3782
|
this.phUploadTarget = this.phActive, this.pickImage();
|
|
2373
3783
|
}),
|
|
2374
|
-
this.ctxBtn(
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
3784
|
+
this.ctxBtn(c.link, this.t("imagelink"), () => this.renderPhCtxUrlInput())
|
|
3785
|
+
), (e = this.phActive) != null && e.closest(".tpl-media") && t.append(this.ctxBtn(c.video, this.t("quickvideo"), () => this.swapPlaceholderKind("video"))), t.append(this.ctxSep(), this.ctxBtn(c.trash, this.t("deleteimg"), () => this.removeImgPlaceholder())), this.positionImgPhCtx());
|
|
3786
|
+
}
|
|
3787
|
+
/** Swaps a template slot's placeholder between image and video kinds, so the
|
|
3788
|
+
* same media slot can be filled with either. */
|
|
3789
|
+
swapPlaceholderKind(t) {
|
|
3790
|
+
const e = t === "video" ? this.phActive : this.vphActive;
|
|
3791
|
+
if (!e) return;
|
|
3792
|
+
const i = document.createElement("div");
|
|
3793
|
+
i.innerHTML = t === "video" ? this.vidPhHTML() : this.imgPhHTML();
|
|
3794
|
+
const s = i.firstElementChild;
|
|
3795
|
+
t === "video" ? this.clearImgPlaceholderSel() : this.clearVphPlaceholderSel(), e.replaceWith(s), t === "video" ? this.selectVphPlaceholder(s) : this.selectImgPlaceholder(s), this.onChange();
|
|
2378
3796
|
}
|
|
2379
3797
|
renderPhCtxUrlInput() {
|
|
2380
3798
|
const t = this.phCtx;
|
|
@@ -2385,17 +3803,17 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2385
3803
|
const i = document.createElement("button");
|
|
2386
3804
|
i.type = "button", i.className = "txtbtn", i.textContent = this.t("insertimg");
|
|
2387
3805
|
const s = () => {
|
|
2388
|
-
const l = e.value.trim(),
|
|
2389
|
-
if (!
|
|
3806
|
+
const l = e.value.trim(), o = this.phActive;
|
|
3807
|
+
if (!o) return;
|
|
2390
3808
|
if (!/^(https?:|data:image\/|blob:)/i.test(l)) {
|
|
2391
3809
|
e.classList.add("err"), e.focus();
|
|
2392
3810
|
return;
|
|
2393
3811
|
}
|
|
2394
3812
|
i.disabled = !0, e.disabled = !0;
|
|
2395
|
-
const
|
|
2396
|
-
|
|
3813
|
+
const n = new Image();
|
|
3814
|
+
n.onload = () => this.replacePlaceholderWithImage(o, l, ""), n.onerror = () => {
|
|
2397
3815
|
i.disabled = !1, e.disabled = !1, e.classList.add("err"), e.focus();
|
|
2398
|
-
},
|
|
3816
|
+
}, n.src = l;
|
|
2399
3817
|
};
|
|
2400
3818
|
i.addEventListener("click", s), e.addEventListener("input", () => e.classList.remove("err")), e.addEventListener("keydown", (l) => {
|
|
2401
3819
|
l.key === "Enter" ? (l.preventDefault(), s()) : l.key === "Escape" && (l.stopPropagation(), this.renderPhCtxButtons());
|
|
@@ -2421,8 +3839,8 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2421
3839
|
s && (s.textContent = this.t("uploading")), this.imageUploadHandler(t).then((l) => {
|
|
2422
3840
|
this.ed.contains(e) && this.replacePlaceholderWithImage(e, l, i);
|
|
2423
3841
|
}).catch((l) => {
|
|
2424
|
-
var
|
|
2425
|
-
this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (
|
|
3842
|
+
var o;
|
|
3843
|
+
this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (o = this.onImageUploadError) == null || o.call(this, l, t));
|
|
2426
3844
|
});
|
|
2427
3845
|
}
|
|
2428
3846
|
replacePlaceholderWithImage(t, e, i) {
|
|
@@ -2441,6 +3859,446 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2441
3859
|
let l = t.bottom + scrollY + 8;
|
|
2442
3860
|
t.bottom + 8 + i > innerHeight - 4 && (l = Math.max(this.ctxMinTop(), t.top + scrollY - i - 8)), this.phCtx.style.left = s + "px", this.phCtx.style.top = l + "px";
|
|
2443
3861
|
}
|
|
3862
|
+
/* ---------------------------------------------------------- video upload placeholder */
|
|
3863
|
+
pickVideo() {
|
|
3864
|
+
this.vidInput.value = "", this.vidInput.click();
|
|
3865
|
+
}
|
|
3866
|
+
vidPhHTML(t) {
|
|
3867
|
+
return `<div class="img-ph vid-ph"${t ? ` id="${t}"` : ""} contenteditable="false">${c.video}<span>${this.t("dropvideo")}</span></div>`;
|
|
3868
|
+
}
|
|
3869
|
+
insertVideoPlaceholder() {
|
|
3870
|
+
this.restoreSel();
|
|
3871
|
+
const t = "vid-ph-" + Date.now().toString(36) + Math.random().toString(36).slice(2, 6);
|
|
3872
|
+
document.execCommand("insertHTML", !1, this.vidPhHTML(t));
|
|
3873
|
+
const e = this.ed.querySelector("#" + t);
|
|
3874
|
+
e && (e.removeAttribute("id"), this.selectVphPlaceholder(e)), this.onChange();
|
|
3875
|
+
}
|
|
3876
|
+
clearVphPlaceholderSel() {
|
|
3877
|
+
var t, e;
|
|
3878
|
+
(t = this.vphCtx) == null || t.remove(), this.vphCtx = null, (e = this.vphActive) == null || e.classList.remove("active"), this.vphActive = null;
|
|
3879
|
+
}
|
|
3880
|
+
removeVphPlaceholder() {
|
|
3881
|
+
const t = this.vphActive;
|
|
3882
|
+
t && (this.clearVphPlaceholderSel(), (t.closest(".tpl-media") || t).remove(), this.refreshState(), this.onChange());
|
|
3883
|
+
}
|
|
3884
|
+
selectVphPlaceholder(t) {
|
|
3885
|
+
this.vphActive !== t && (this.clearVphPlaceholderSel(), this.vphActive = t, t.classList.add("active"), this.vphCtx = document.createElement("div"), this.vphCtx.className = "imgctx img-ph-ctx", this.vphCtx.dir = this.dir(), document.body.appendChild(this.vphCtx), this.renderVphCtxButtons());
|
|
3886
|
+
}
|
|
3887
|
+
renderVphCtxButtons() {
|
|
3888
|
+
var e;
|
|
3889
|
+
const t = this.vphCtx;
|
|
3890
|
+
t && (t.innerHTML = "", t.append(
|
|
3891
|
+
this.ctxBtn(c.uploadic, this.t("uploadvideo"), () => {
|
|
3892
|
+
this.vphUploadTarget = this.vphActive, this.pickVideo();
|
|
3893
|
+
}),
|
|
3894
|
+
this.ctxBtn(c.link, this.t("videolink"), () => this.renderVphCtxUrlInput())
|
|
3895
|
+
), (e = this.vphActive) != null && e.closest(".tpl-media") && t.append(this.ctxBtn(c.image, this.t("quickimage"), () => this.swapPlaceholderKind("image"))), t.append(this.ctxSep(), this.ctxBtn(c.trash, this.t("deletevideo"), () => this.removeVphPlaceholder())), this.positionVphCtx());
|
|
3896
|
+
}
|
|
3897
|
+
renderVphCtxUrlInput() {
|
|
3898
|
+
const t = this.vphCtx;
|
|
3899
|
+
if (!t) return;
|
|
3900
|
+
t.innerHTML = "";
|
|
3901
|
+
const e = document.createElement("input");
|
|
3902
|
+
e.type = "url", e.className = "urlinp", e.placeholder = this.t("videourlph");
|
|
3903
|
+
const i = document.createElement("button");
|
|
3904
|
+
i.type = "button", i.className = "txtbtn", i.textContent = this.t("insertvideo");
|
|
3905
|
+
const s = () => {
|
|
3906
|
+
const l = e.value.trim(), o = this.vphActive;
|
|
3907
|
+
if (!o) return;
|
|
3908
|
+
if (!/^(https?:|data:video\/|blob:)/i.test(l)) {
|
|
3909
|
+
e.classList.add("err"), e.focus();
|
|
3910
|
+
return;
|
|
3911
|
+
}
|
|
3912
|
+
const n = this.videoEmbedUrl(l);
|
|
3913
|
+
if (n) {
|
|
3914
|
+
this.replacePlaceholderWithEmbed(o, n);
|
|
3915
|
+
return;
|
|
3916
|
+
}
|
|
3917
|
+
i.disabled = !0, e.disabled = !0;
|
|
3918
|
+
const r = document.createElement("video");
|
|
3919
|
+
r.preload = "metadata", r.onloadedmetadata = () => this.replacePlaceholderWithVideo(o, l, ""), r.onerror = () => {
|
|
3920
|
+
i.disabled = !1, e.disabled = !1, e.classList.add("err"), e.focus();
|
|
3921
|
+
}, r.src = l;
|
|
3922
|
+
};
|
|
3923
|
+
i.addEventListener("click", s), e.addEventListener("input", () => e.classList.remove("err")), e.addEventListener("keydown", (l) => {
|
|
3924
|
+
l.key === "Enter" ? (l.preventDefault(), s()) : l.key === "Escape" && (l.stopPropagation(), this.renderVphCtxButtons());
|
|
3925
|
+
}), t.append(e, i), this.positionVphCtx(), e.focus();
|
|
3926
|
+
}
|
|
3927
|
+
readVideoFileInto(t, e) {
|
|
3928
|
+
if (e.classList.contains("uploading")) return;
|
|
3929
|
+
if (this.videoUploadHandler) {
|
|
3930
|
+
this.uploadVideoFile(t, e);
|
|
3931
|
+
return;
|
|
3932
|
+
}
|
|
3933
|
+
const i = new FileReader();
|
|
3934
|
+
i.onload = () => {
|
|
3935
|
+
this.ed.contains(e) && this.replacePlaceholderWithVideo(e, i.result, t.name.replace(/"/g, ""));
|
|
3936
|
+
}, i.readAsDataURL(t);
|
|
3937
|
+
}
|
|
3938
|
+
/** Runs the host-supplied videoUploadHandler instead of inlining base64,
|
|
3939
|
+
* so apps can route the file to S3 / Azure Blob / their own server. */
|
|
3940
|
+
uploadVideoFile(t, e) {
|
|
3941
|
+
const i = t.name.replace(/"/g, "");
|
|
3942
|
+
e.classList.remove("upload-error"), e.classList.add("uploading");
|
|
3943
|
+
const s = e.querySelector("span");
|
|
3944
|
+
s && (s.textContent = this.t("uploading")), this.videoUploadHandler(t).then((l) => {
|
|
3945
|
+
this.ed.contains(e) && this.replacePlaceholderWithVideo(e, l, i);
|
|
3946
|
+
}).catch((l) => {
|
|
3947
|
+
var o;
|
|
3948
|
+
this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (o = this.onVideoUploadError) == null || o.call(this, l, t));
|
|
3949
|
+
});
|
|
3950
|
+
}
|
|
3951
|
+
replacePlaceholderWithVideo(t, e, i) {
|
|
3952
|
+
const s = document.createElement("video");
|
|
3953
|
+
s.controls = !0, s.src = e, i && (s.title = i), t.replaceWith(s), this.vphActive === t && this.clearVphPlaceholderSel(), this.refreshState(), this.onChange();
|
|
3954
|
+
}
|
|
3955
|
+
/** Swaps a video placeholder for a hosted player iframe (YouTube & co.). */
|
|
3956
|
+
replacePlaceholderWithEmbed(t, e) {
|
|
3957
|
+
const i = document.createElement("div");
|
|
3958
|
+
i.innerHTML = this.videoEmbedHTML(e), t.replaceWith(i.firstElementChild), this.vphActive === t && this.clearVphPlaceholderSel(), this.refreshState(), this.onChange();
|
|
3959
|
+
}
|
|
3960
|
+
positionVphCtx() {
|
|
3961
|
+
if (this.vphActive && !document.body.contains(this.vphActive)) {
|
|
3962
|
+
this.clearVphPlaceholderSel();
|
|
3963
|
+
return;
|
|
3964
|
+
}
|
|
3965
|
+
if (!this.vphActive || !this.vphCtx) return;
|
|
3966
|
+
const t = this.vphActive.getBoundingClientRect(), e = this.vphCtx.offsetWidth, i = this.vphCtx.offsetHeight;
|
|
3967
|
+
let s = t.left + scrollX + (t.width - e) / 2;
|
|
3968
|
+
s = Math.max(8 + scrollX, Math.min(s, scrollX + innerWidth - e - 8));
|
|
3969
|
+
let l = t.bottom + scrollY + 8;
|
|
3970
|
+
t.bottom + 8 + i > innerHeight - 4 && (l = Math.max(this.ctxMinTop(), t.top + scrollY - i - 8)), this.vphCtx.style.left = s + "px", this.vphCtx.style.top = l + "px";
|
|
3971
|
+
}
|
|
3972
|
+
/* ---------------------------------------------------------- video toolbar (post-insert) */
|
|
3973
|
+
cancelVidHide() {
|
|
3974
|
+
this.vidHideTimer != null && (window.clearTimeout(this.vidHideTimer), this.vidHideTimer = null);
|
|
3975
|
+
}
|
|
3976
|
+
clearVidHandles() {
|
|
3977
|
+
var t, e;
|
|
3978
|
+
this.cancelVidHide(), (t = this.vidCtx) == null || t.remove(), this.vidCtx = null, (e = this.vidActive) == null || e.classList.remove("vid-selected"), this.vidActive = null;
|
|
3979
|
+
}
|
|
3980
|
+
selectVideo(t) {
|
|
3981
|
+
this.vidActive !== t && (this.clearVidHandles(), this.vidActive = t, t.classList.add("vid-selected"), this.vidCtx = this.buildVideoCtxToolbar(t), this.positionVidCtx());
|
|
3982
|
+
}
|
|
3983
|
+
buildVideoCtxToolbar(t) {
|
|
3984
|
+
const e = document.createElement("div");
|
|
3985
|
+
e.className = "imgctx", e.dir = this.dir();
|
|
3986
|
+
const i = () => {
|
|
3987
|
+
var h;
|
|
3988
|
+
const a = this.buildVideoCtxToolbar(t);
|
|
3989
|
+
(h = this.vidCtx) == null || h.replaceWith(a), this.vidCtx = a, this.positionVidCtx();
|
|
3990
|
+
}, s = (a) => {
|
|
3991
|
+
this.setVideoAlign(t, a), i();
|
|
3992
|
+
}, l = t.style.float === "left", o = t.style.float === "right", n = !l && !o && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (a, h, d, m) => {
|
|
3993
|
+
const g = this.ctxBtn(a, h, m);
|
|
3994
|
+
return g.classList.toggle("on", d), g;
|
|
3995
|
+
};
|
|
3996
|
+
return e.append(
|
|
3997
|
+
r(c.alignleft, this.t("alignleft"), l, () => s("left")),
|
|
3998
|
+
r(c.aligncenter, this.t("aligncenter"), n, () => s("center")),
|
|
3999
|
+
r(c.alignright, this.t("alignright"), o, () => s("right")),
|
|
4000
|
+
this.ctxSep(),
|
|
4001
|
+
r(c.trash, this.t("deletevideo"), !1, () => {
|
|
4002
|
+
t.remove(), this.clearVidHandles(), this.onChange();
|
|
4003
|
+
})
|
|
4004
|
+
), e.addEventListener("mousedown", (a) => a.preventDefault()), e.addEventListener("mouseenter", () => this.cancelVidHide()), e.addEventListener("mouseleave", () => {
|
|
4005
|
+
this.cancelVidHide(), this.vidHideTimer = window.setTimeout(() => this.clearVidHandles(), 250);
|
|
4006
|
+
}), document.body.appendChild(e), e;
|
|
4007
|
+
}
|
|
4008
|
+
setVideoAlign(t, e) {
|
|
4009
|
+
t.style.float = "", t.style.display = "", t.style.marginLeft = "", t.style.marginRight = "", t.style.marginBottom = "", e === "left" ? (t.style.float = "left", t.style.marginInlineEnd = "1em", t.style.marginBottom = "0.5em") : e === "right" ? (t.style.float = "right", t.style.marginInlineStart = "1em", t.style.marginBottom = "0.5em") : (t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto"), this.onChange();
|
|
4010
|
+
}
|
|
4011
|
+
positionVidCtx() {
|
|
4012
|
+
if (!this.vidActive || !document.body.contains(this.vidActive)) {
|
|
4013
|
+
this.clearVidHandles();
|
|
4014
|
+
return;
|
|
4015
|
+
}
|
|
4016
|
+
const t = this.vidActive.getBoundingClientRect();
|
|
4017
|
+
if (!this.vidCtx) return;
|
|
4018
|
+
const e = this.vidCtx.offsetWidth, i = this.vidCtx.offsetHeight;
|
|
4019
|
+
let s = t.left + scrollX + (t.width - e) / 2;
|
|
4020
|
+
s = Math.max(8 + scrollX, Math.min(s, scrollX + innerWidth - e - 8));
|
|
4021
|
+
let l = t.top + scrollY - i - 8;
|
|
4022
|
+
l < this.ctxMinTop() && (l = t.bottom + scrollY + 8), this.vidCtx.style.left = s + "px", this.vidCtx.style.top = l + "px";
|
|
4023
|
+
}
|
|
4024
|
+
/* ---------------------------------------------------------- video dialog / embeds */
|
|
4025
|
+
/** Maps a page URL from a known video host to its iframe player URL. Returns
|
|
4026
|
+
* null for anything else (e.g. direct .mp4 file URLs). */
|
|
4027
|
+
videoEmbedUrl(t) {
|
|
4028
|
+
let e = t.match(/^https?:\/\/(?:www\.|m\.)?youtube\.com\/watch\?(?:[^\s#]*[?&])?v=([\w-]{5,})/i);
|
|
4029
|
+
return e || (e = t.match(/^https?:\/\/(?:www\.)?(?:youtu\.be|youtube\.com\/(?:embed|shorts|live))\/([\w-]{5,})/i)), e ? "https://www.youtube.com/embed/" + e[1] : (e = t.match(/^https?:\/\/(?:www\.)?vimeo\.com\/(\d+)/i), e ? "https://player.vimeo.com/video/" + e[1] : (e = t.match(/^https?:\/\/(?:www\.)?dailymotion\.com\/video\/(\w+)/i), e ? "https://www.dailymotion.com/embed/video/" + e[1] : null));
|
|
4030
|
+
}
|
|
4031
|
+
videoEmbedHTML(t, e = 560, i = 314) {
|
|
4032
|
+
return `<span class="video-embed" contenteditable="false"><iframe src="${t}" width="${e}" height="${i}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></span>`;
|
|
4033
|
+
}
|
|
4034
|
+
/** Insert/edit-video dialog with General (source/width/height), Embed (embed
|
|
4035
|
+
* code) and Advanced (alternative source, poster image) tabs. Hosted page
|
|
4036
|
+
* URLs (YouTube & co.) become iframe players; anything else becomes a
|
|
4037
|
+
* <video> tag. The General tab also offers the same upload path as before
|
|
4038
|
+
* (videoUploadHandler when configured, else inline base64). */
|
|
4039
|
+
videoDlg() {
|
|
4040
|
+
this.saveSel();
|
|
4041
|
+
let t, e, i, s, l, o;
|
|
4042
|
+
const n = (a, h) => {
|
|
4043
|
+
const d = document.createElement("div");
|
|
4044
|
+
d.className = "dfield";
|
|
4045
|
+
const m = document.createElement("label");
|
|
4046
|
+
return m.textContent = this.t(a), d.append(m, h), d;
|
|
4047
|
+
}, r = () => {
|
|
4048
|
+
const a = document.createElement("input");
|
|
4049
|
+
return a.type = "url", a;
|
|
4050
|
+
};
|
|
4051
|
+
this.dialog(
|
|
4052
|
+
this.t("videodlgttl"),
|
|
4053
|
+
(a) => {
|
|
4054
|
+
const h = document.createElement("div");
|
|
4055
|
+
h.className = "dtabs";
|
|
4056
|
+
const d = [], m = (v, b) => {
|
|
4057
|
+
const x = document.createElement("button");
|
|
4058
|
+
x.type = "button", x.textContent = this.t(v);
|
|
4059
|
+
const C = document.createElement("div");
|
|
4060
|
+
C.className = "dtabpanel", b(C);
|
|
4061
|
+
const M = d.length;
|
|
4062
|
+
d.push(C), x.addEventListener("click", () => g(M)), h.appendChild(x);
|
|
4063
|
+
}, g = (v) => {
|
|
4064
|
+
h.querySelectorAll("button").forEach((b, x) => b.classList.toggle("on", x === v)), d.forEach((b, x) => b.style.display = x === v ? "" : "none");
|
|
4065
|
+
};
|
|
4066
|
+
m("vidgeneral", (v) => {
|
|
4067
|
+
t = r(), t.placeholder = this.t("videourlph");
|
|
4068
|
+
const b = document.createElement("div");
|
|
4069
|
+
b.className = "drow";
|
|
4070
|
+
const x = document.createElement("button");
|
|
4071
|
+
x.type = "button", x.className = "txtbtn", x.textContent = this.t("uploadvideo");
|
|
4072
|
+
const C = document.createElement("input");
|
|
4073
|
+
C.type = "file", C.accept = this.options.videoFileTypes.join(","), C.style.display = "none", x.addEventListener("click", () => {
|
|
4074
|
+
C.value = "", C.click();
|
|
4075
|
+
}), C.addEventListener("change", () => {
|
|
4076
|
+
var L;
|
|
4077
|
+
const w = (L = C.files) == null ? void 0 : L[0];
|
|
4078
|
+
if (!w) return;
|
|
4079
|
+
x.disabled = !0, x.textContent = this.t("uploading");
|
|
4080
|
+
const k = (H) => {
|
|
4081
|
+
t.value = H, x.disabled = !1, x.textContent = this.t("uploadvideo");
|
|
4082
|
+
};
|
|
4083
|
+
if (this.videoUploadHandler)
|
|
4084
|
+
this.videoUploadHandler(w).then(k).catch((H) => {
|
|
4085
|
+
var z;
|
|
4086
|
+
x.disabled = !1, x.textContent = this.t("uploadfailed"), (z = this.onVideoUploadError) == null || z.call(this, H, w);
|
|
4087
|
+
});
|
|
4088
|
+
else {
|
|
4089
|
+
const H = new FileReader();
|
|
4090
|
+
H.onload = () => k(H.result), H.readAsDataURL(w);
|
|
4091
|
+
}
|
|
4092
|
+
}), b.append(t, x, C), t.style.flex = "1", v.appendChild(n("vidsource", b));
|
|
4093
|
+
const M = document.createElement("div");
|
|
4094
|
+
M.className = "drow", e = document.createElement("input"), e.type = "number", e.value = "560", i = document.createElement("input"), i.type = "number", i.value = "314", M.append(n("tblwidth", e), n("tblheight", i)), v.appendChild(M);
|
|
4095
|
+
}), m("vidembed", (v) => {
|
|
4096
|
+
const b = document.createElement("p");
|
|
4097
|
+
b.textContent = this.t("vidembedhint"), b.style.cssText = "margin:0 0 8px;color:#556;font-size:13.5px", s = document.createElement("textarea"), s.style.cssText = "width:100%;box-sizing:border-box;height:160px", v.append(b, s);
|
|
4098
|
+
}), m("vidadvanced", (v) => {
|
|
4099
|
+
l = r(), o = r(), v.append(n("vidaltsource", l), n("vidposter", o));
|
|
4100
|
+
});
|
|
4101
|
+
const u = document.createElement("div");
|
|
4102
|
+
u.className = "dtabbody", d.forEach((v) => u.appendChild(v)), a.append(h, u), g(0), setTimeout(() => t.focus(), 0);
|
|
4103
|
+
},
|
|
4104
|
+
[
|
|
4105
|
+
{ label: this.t("cancel"), action: () => this.closeDlg() },
|
|
4106
|
+
{
|
|
4107
|
+
label: this.t("save"),
|
|
4108
|
+
primary: !0,
|
|
4109
|
+
action: () => {
|
|
4110
|
+
const a = s.value.trim(), h = t.value.trim(), d = parseInt(e.value, 10) || 560, m = parseInt(i.value, 10) || 314;
|
|
4111
|
+
if (this.closeDlg(), !a && !h) return;
|
|
4112
|
+
if (this.restoreSel(), a) {
|
|
4113
|
+
document.execCommand("insertHTML", !1, `<span class="video-embed" contenteditable="false">${a}</span>`), this.onChange();
|
|
4114
|
+
return;
|
|
4115
|
+
}
|
|
4116
|
+
const g = this.videoEmbedUrl(h);
|
|
4117
|
+
if (g)
|
|
4118
|
+
document.execCommand("insertHTML", !1, this.videoEmbedHTML(g, d, m));
|
|
4119
|
+
else {
|
|
4120
|
+
const u = l.value.trim(), v = o.value.trim();
|
|
4121
|
+
document.execCommand(
|
|
4122
|
+
"insertHTML",
|
|
4123
|
+
!1,
|
|
4124
|
+
`<video controls width="${d}" height="${m}"${v ? ` poster="${this.escapeAttr(v)}"` : ""}><source src="${this.escapeAttr(h)}">${u ? `<source src="${this.escapeAttr(u)}">` : ""}</video>`
|
|
4125
|
+
);
|
|
4126
|
+
}
|
|
4127
|
+
this.onChange();
|
|
4128
|
+
}
|
|
4129
|
+
}
|
|
4130
|
+
]
|
|
4131
|
+
);
|
|
4132
|
+
}
|
|
4133
|
+
escapeAttr(t) {
|
|
4134
|
+
return t.replace(/&/g, "&").replace(/"/g, """);
|
|
4135
|
+
}
|
|
4136
|
+
escHtml(t) {
|
|
4137
|
+
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
4138
|
+
}
|
|
4139
|
+
/* ---------------------------------------------------------- inline code & code samples */
|
|
4140
|
+
/** The inline <code> run the caret sits in, if any (code blocks don't count). */
|
|
4141
|
+
closestInlineCode() {
|
|
4142
|
+
const t = window.getSelection(), e = t && this.ed.contains(t.anchorNode) ? t.anchorNode : null;
|
|
4143
|
+
if (!e) return null;
|
|
4144
|
+
const i = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement, s = i == null ? void 0 : i.closest("code");
|
|
4145
|
+
return s && this.ed.contains(s) && !s.closest("pre") ? s : null;
|
|
4146
|
+
}
|
|
4147
|
+
/** Wraps the selection in an inline <code> run, or unwraps the run the caret is
|
|
4148
|
+
* in. Selections spanning multiple blocks are left alone (a <code> can't wrap
|
|
4149
|
+
* across paragraphs without producing invalid markup). */
|
|
4150
|
+
toggleInlineCode() {
|
|
4151
|
+
this.restoreSel();
|
|
4152
|
+
const t = window.getSelection();
|
|
4153
|
+
if (!t || !t.rangeCount) return;
|
|
4154
|
+
const e = this.closestInlineCode();
|
|
4155
|
+
if (e) {
|
|
4156
|
+
const i = e.firstChild, s = e.lastChild;
|
|
4157
|
+
for (; e.firstChild; ) e.parentNode.insertBefore(e.firstChild, e);
|
|
4158
|
+
if (e.remove(), i && s) {
|
|
4159
|
+
const l = document.createRange();
|
|
4160
|
+
l.setStartBefore(i), l.setEndAfter(s), t.removeAllRanges(), t.addRange(l);
|
|
4161
|
+
}
|
|
4162
|
+
} else {
|
|
4163
|
+
const i = t.getRangeAt(0);
|
|
4164
|
+
if (i.collapsed || this.closestBlock(i.startContainer) !== this.closestBlock(i.endContainer)) return;
|
|
4165
|
+
const s = document.createElement("code");
|
|
4166
|
+
s.appendChild(i.extractContents()), i.insertNode(s);
|
|
4167
|
+
const l = document.createRange();
|
|
4168
|
+
l.selectNodeContents(s), t.removeAllRanges(), t.addRange(l);
|
|
4169
|
+
}
|
|
4170
|
+
this.saveSel(), this.refreshState(), this.onChange();
|
|
4171
|
+
}
|
|
4172
|
+
/** Typing `snippet` converts to an inline <code> run the moment the closing
|
|
4173
|
+
* backtick is typed, so code can be marked up without reaching for the toolbar. */
|
|
4174
|
+
tryCodeTyping(t) {
|
|
4175
|
+
var h;
|
|
4176
|
+
const e = window.getSelection();
|
|
4177
|
+
if (!e || !e.isCollapsed || !e.anchorNode) return;
|
|
4178
|
+
const i = e.anchorNode;
|
|
4179
|
+
if (i.nodeType !== Node.TEXT_NODE || !this.ed.contains(i) || (h = i.parentElement) != null && h.closest("code, pre")) return;
|
|
4180
|
+
const l = (i.textContent || "").slice(0, e.anchorOffset).match(/(?:^|[^`])`([^`]+)$/);
|
|
4181
|
+
if (!l) return;
|
|
4182
|
+
const o = l[1];
|
|
4183
|
+
if (/^\s|\s$/.test(o)) return;
|
|
4184
|
+
t.preventDefault();
|
|
4185
|
+
const n = document.createRange();
|
|
4186
|
+
n.setStart(i, e.anchorOffset - o.length - 1), n.setEnd(i, e.anchorOffset), n.deleteContents();
|
|
4187
|
+
const r = document.createElement("code");
|
|
4188
|
+
r.textContent = o, n.insertNode(r);
|
|
4189
|
+
const a = document.createRange();
|
|
4190
|
+
a.setStartAfter(r), a.collapse(!0), e.removeAllRanges(), e.addRange(a), this.saveSel(), this.onChange();
|
|
4191
|
+
}
|
|
4192
|
+
/** Custom dropdown for dialog fields (a native <select> popup can't be styled):
|
|
4193
|
+
* a field-styled button showing the current choice that opens a floating,
|
|
4194
|
+
* scrollable option list. Read the current choice via `.value()`. */
|
|
4195
|
+
dlgSelect(t, e) {
|
|
4196
|
+
var r;
|
|
4197
|
+
let i = e;
|
|
4198
|
+
const s = document.createElement("div");
|
|
4199
|
+
s.className = "dsel";
|
|
4200
|
+
const l = document.createElement("button");
|
|
4201
|
+
l.type = "button", l.className = "dsel-btn";
|
|
4202
|
+
const o = document.createElement("span");
|
|
4203
|
+
o.className = "lbl", o.textContent = ((r = t.find(([a]) => a === e)) == null ? void 0 : r[1]) || "", l.append(o), l.insertAdjacentHTML("beforeend", c.chev);
|
|
4204
|
+
const n = document.createElement("div");
|
|
4205
|
+
return n.className = "dsel-list", t.forEach(([a, h]) => {
|
|
4206
|
+
const d = document.createElement("button");
|
|
4207
|
+
d.type = "button", d.textContent = h, d.classList.toggle("on", a === i), d.addEventListener("click", () => {
|
|
4208
|
+
i = a, o.textContent = h, n.querySelectorAll("button").forEach((m) => m.classList.toggle("on", m === d)), s.classList.remove("open"), l.focus();
|
|
4209
|
+
}), n.appendChild(d);
|
|
4210
|
+
}), l.addEventListener("click", () => {
|
|
4211
|
+
var a;
|
|
4212
|
+
s.classList.toggle("open"), s.classList.contains("open") && ((a = n.querySelector(".on")) == null || a.scrollIntoView({ block: "nearest" }));
|
|
4213
|
+
}), s.addEventListener("focusout", (a) => {
|
|
4214
|
+
s.contains(a.relatedTarget) || s.classList.remove("open");
|
|
4215
|
+
}), s.addEventListener("keydown", (a) => {
|
|
4216
|
+
a.key === "Escape" && s.classList.contains("open") && (a.stopPropagation(), s.classList.remove("open"), l.focus());
|
|
4217
|
+
}), s.append(l, n), { el: s, value: () => i };
|
|
4218
|
+
}
|
|
4219
|
+
/** Insert/edit-code-sample dialog: language dropdown + monospace textarea to
|
|
4220
|
+
* paste or type code into. Inserts a non-editable <pre class="code-block">
|
|
4221
|
+
* whose header shows the language; click the block to edit / copy / delete. */
|
|
4222
|
+
codeDlg(t) {
|
|
4223
|
+
this.saveSel();
|
|
4224
|
+
let e, i;
|
|
4225
|
+
this.dialog(
|
|
4226
|
+
this.t("codedlgttl"),
|
|
4227
|
+
(s) => {
|
|
4228
|
+
var n;
|
|
4229
|
+
const l = document.createElement("div");
|
|
4230
|
+
l.className = "dfield";
|
|
4231
|
+
const o = document.createElement("label");
|
|
4232
|
+
o.textContent = this.t("codelang"), e = this.dlgSelect(_, (t == null ? void 0 : t.dataset.lang) || "plain"), l.append(o, e.el), i = document.createElement("textarea"), i.className = "code-input", i.spellcheck = !1, i.value = ((n = t == null ? void 0 : t.querySelector("code")) == null ? void 0 : n.textContent) || "", i.placeholder = "const answer = 42;", s.append(l, i), setTimeout(() => i.focus(), 0);
|
|
4233
|
+
},
|
|
4234
|
+
[
|
|
4235
|
+
{ label: this.t("cancel"), action: () => this.closeDlg() },
|
|
4236
|
+
{
|
|
4237
|
+
label: this.t("save"),
|
|
4238
|
+
primary: !0,
|
|
4239
|
+
action: () => {
|
|
4240
|
+
var n;
|
|
4241
|
+
const s = i.value.replace(/\s+$/, ""), l = e.value(), o = ((n = _.find(([r]) => r === l)) == null ? void 0 : n[1]) || l;
|
|
4242
|
+
if (this.closeDlg(), !!s.trim()) {
|
|
4243
|
+
if (t) {
|
|
4244
|
+
t.dataset.lang = l, t.setAttribute("data-lang-label", o);
|
|
4245
|
+
const r = t.querySelector("code") || t;
|
|
4246
|
+
r.textContent = s, this.clearCodeSel(), this.onChange();
|
|
4247
|
+
return;
|
|
4248
|
+
}
|
|
4249
|
+
this.restoreSel(), document.execCommand(
|
|
4250
|
+
"insertHTML",
|
|
4251
|
+
!1,
|
|
4252
|
+
`<pre class="code-block" contenteditable="false" data-lang="${l}" data-lang-label="${this.escapeAttr(o)}"><code>${this.escHtml(s)}</code></pre><p><br></p>`
|
|
4253
|
+
), this.onChange();
|
|
4254
|
+
}
|
|
4255
|
+
}
|
|
4256
|
+
}
|
|
4257
|
+
]
|
|
4258
|
+
);
|
|
4259
|
+
}
|
|
4260
|
+
clearCodeSel() {
|
|
4261
|
+
var t, e;
|
|
4262
|
+
(t = this.codeCtx) == null || t.remove(), this.codeCtx = null, (e = this.codeActive) == null || e.classList.remove("code-selected"), this.codeActive = null;
|
|
4263
|
+
}
|
|
4264
|
+
selectCodeEl(t) {
|
|
4265
|
+
this.codeActive !== t && (this.clearCodeSel(), this.codeActive = t, t.classList.add("code-selected"), this.codeCtx = this.buildCodeCtxToolbar(t), this.positionCodeCtx());
|
|
4266
|
+
}
|
|
4267
|
+
buildCodeCtxToolbar(t) {
|
|
4268
|
+
const e = document.createElement("div");
|
|
4269
|
+
return e.className = "imgctx", e.dir = this.dir(), e.append(
|
|
4270
|
+
this.ctxBtn(c.editic, this.t("editcode"), () => this.codeDlg(t)),
|
|
4271
|
+
this.ctxBtn(c.copyic, this.t("copycode"), () => this.copyCodeBlock(t)),
|
|
4272
|
+
this.ctxSep(),
|
|
4273
|
+
this.ctxBtn(c.trash, this.t("deletecode"), () => {
|
|
4274
|
+
t.remove(), this.clearCodeSel(), this.onChange();
|
|
4275
|
+
})
|
|
4276
|
+
), e.addEventListener("mousedown", (i) => i.preventDefault()), document.body.appendChild(e), e;
|
|
4277
|
+
}
|
|
4278
|
+
copyCodeBlock(t) {
|
|
4279
|
+
var s, l;
|
|
4280
|
+
const e = ((s = t.querySelector("code")) == null ? void 0 : s.textContent) ?? t.textContent ?? "";
|
|
4281
|
+
if ((l = navigator.clipboard) != null && l.writeText) {
|
|
4282
|
+
navigator.clipboard.writeText(e).catch(() => {
|
|
4283
|
+
});
|
|
4284
|
+
return;
|
|
4285
|
+
}
|
|
4286
|
+
const i = document.createElement("textarea");
|
|
4287
|
+
i.value = e, document.body.appendChild(i), i.select(), document.execCommand("copy"), i.remove();
|
|
4288
|
+
}
|
|
4289
|
+
positionCodeCtx() {
|
|
4290
|
+
if (!this.codeActive || !document.body.contains(this.codeActive)) {
|
|
4291
|
+
this.clearCodeSel();
|
|
4292
|
+
return;
|
|
4293
|
+
}
|
|
4294
|
+
const t = this.codeActive.getBoundingClientRect();
|
|
4295
|
+
if (!this.codeCtx) return;
|
|
4296
|
+
const e = this.codeCtx.offsetWidth, i = this.codeCtx.offsetHeight;
|
|
4297
|
+
let s = t.left + scrollX + (t.width - e) / 2;
|
|
4298
|
+
s = Math.max(8 + scrollX, Math.min(s, scrollX + innerWidth - e - 8));
|
|
4299
|
+
let l = t.top + scrollY - i - 8;
|
|
4300
|
+
l < this.ctxMinTop() && (l = t.bottom + scrollY + 8), this.codeCtx.style.left = s + "px", this.codeCtx.style.top = l + "px";
|
|
4301
|
+
}
|
|
2444
4302
|
/* ---------------------------------------------------------- templates */
|
|
2445
4303
|
templateMenu(t) {
|
|
2446
4304
|
this.popup(t, (e) => this.buildTemplatePickInto(e));
|
|
@@ -2448,14 +4306,14 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2448
4306
|
/** Miniature div-based mockup of a layout, mirroring what the block looks
|
|
2449
4307
|
like in the editor: grey box = image slot, bars = heading/paragraph. */
|
|
2450
4308
|
tplPreviewHTML(t) {
|
|
2451
|
-
const e = '<span class="pv-img"></span>', i = '<span class="pv-h"></span>', s = (r) => `<span class="pv-l" style="width:${r}%"></span>`, l = (r) => `<span class="pv-col">${r}</span>`,
|
|
2452
|
-
return t === "img-left" ? `<span class="pv">${
|
|
4309
|
+
const e = '<span class="pv-img"></span>', i = '<span class="pv-h"></span>', s = (r) => `<span class="pv-l" style="width:${r}%"></span>`, l = (r) => `<span class="pv-col">${r}</span>`, o = (r) => `<span class="pv-row">${r}</span>`, n = l(i + s(100) + s(88));
|
|
4310
|
+
return t === "img-left" ? `<span class="pv">${o(e + n)}${s(100)}${s(72)}</span>` : t === "img-right" ? `<span class="pv">${o(n + e)}${s(100)}${s(72)}</span>` : t === "img-top" ? `<span class="pv pv-c">${e}${i}${s(100)}${s(72)}</span>` : `<span class="pv pv-c">${i}${s(100)}${s(72)}${e}</span>`;
|
|
2453
4311
|
}
|
|
2454
4312
|
buildTemplatePickInto(t, e) {
|
|
2455
4313
|
const i = document.createElement("div");
|
|
2456
|
-
i.className = "tplpick",
|
|
4314
|
+
i.className = "tplpick", F.forEach((s) => {
|
|
2457
4315
|
const l = document.createElement("button");
|
|
2458
|
-
l.type = "button", l.className = "tpltile", l.title = this.t(
|
|
4316
|
+
l.type = "button", l.className = "tpltile", l.title = this.t(O[s]), l.innerHTML = this.tplPreviewHTML(s) + `<span class="tpllbl">${this.t(O[s])}</span>`, l.addEventListener("click", () => {
|
|
2459
4317
|
this.closePop(), this.insertTemplate(s), e == null || e();
|
|
2460
4318
|
}), i.appendChild(l);
|
|
2461
4319
|
}), t.appendChild(i);
|
|
@@ -2474,15 +4332,15 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2474
4332
|
}
|
|
2475
4333
|
renderTplCtxButtons() {
|
|
2476
4334
|
const t = this.tplCtx, e = this.tplActive;
|
|
2477
|
-
!t || !e || (t.innerHTML = "",
|
|
2478
|
-
const s = this.ctxBtn(
|
|
4335
|
+
!t || !e || (t.innerHTML = "", F.forEach((i) => {
|
|
4336
|
+
const s = this.ctxBtn(At[i], this.t(O[i]), () => this.setTplLayout(i));
|
|
2479
4337
|
s.classList.toggle("on", e.classList.contains("tpl-" + i)), t.appendChild(s);
|
|
2480
|
-
}), t.append(this.ctxSep(), this.ctxBtn(
|
|
4338
|
+
}), t.append(this.ctxSep(), this.ctxBtn(c.trash, this.t("deltemplate"), () => this.removeTemplate())), this.positionTplCtx());
|
|
2481
4339
|
}
|
|
2482
4340
|
setTplLayout(t) {
|
|
2483
4341
|
const e = this.tplActive;
|
|
2484
4342
|
if (!e) return;
|
|
2485
|
-
|
|
4343
|
+
F.forEach((l) => e.classList.remove("tpl-" + l)), e.classList.add("tpl-" + t);
|
|
2486
4344
|
const i = e.querySelector(":scope > .tpl-media"), s = e.querySelector(":scope > .tpl-text");
|
|
2487
4345
|
i && s && (t === "img-center" ? e.appendChild(i) : e.insertBefore(i, s)), this.renderTplCtxButtons(), this.positionImgPhCtx(), this.positionImageHandles(), this.onChange();
|
|
2488
4346
|
}
|
|
@@ -2514,7 +4372,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2514
4372
|
/* ---------------------------------------------------------- table resize */
|
|
2515
4373
|
clearTableHandles() {
|
|
2516
4374
|
var t, e, i, s, l;
|
|
2517
|
-
(t = this.tblCorner) == null || t.remove(), this.tblCorner = null, this.tblColBars.forEach((
|
|
4375
|
+
(t = this.tblCorner) == null || t.remove(), this.tblCorner = null, this.tblColBars.forEach((o) => o.remove()), this.tblColBars = [], (e = this.tblCtx) == null || e.remove(), this.tblCtx = null, (i = this.tblCellMark) == null || i.remove(), this.tblCellMark = null, (s = this.tblOpMark) == null || s.remove(), this.tblOpMark = null, this.tblOpMarkKind = null, (l = this.tblActive) == null || l.classList.remove("tbl-selected"), this.tblActive = null;
|
|
2518
4376
|
}
|
|
2519
4377
|
/** Blue outline around the cell that holds the caret, so it is clear
|
|
2520
4378
|
which cell / row / column the table operations will target. */
|
|
@@ -2541,8 +4399,8 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2541
4399
|
return;
|
|
2542
4400
|
}
|
|
2543
4401
|
this.tblOpMark || (this.tblOpMark = document.createElement("div"), this.tblOpMark.className = "tbl-opmark", document.body.appendChild(this.tblOpMark));
|
|
2544
|
-
const i = this.tblActive.getBoundingClientRect(), s = e.getBoundingClientRect(), l = e.parentElement.getBoundingClientRect(),
|
|
2545
|
-
this.tblOpMark.style.left =
|
|
4402
|
+
const i = this.tblActive.getBoundingClientRect(), s = e.getBoundingClientRect(), l = e.parentElement.getBoundingClientRect(), o = t === "row" ? l.left : s.left, n = t === "row" ? l.top : i.top, r = t === "row" ? l.width : s.width, a = t === "row" ? l.height : i.height;
|
|
4403
|
+
this.tblOpMark.style.left = o + scrollX + "px", this.tblOpMark.style.top = n + scrollY + "px", this.tblOpMark.style.width = r + "px", this.tblOpMark.style.height = a + "px";
|
|
2546
4404
|
}
|
|
2547
4405
|
/** Lowest allowed top for floating context toolbars — keeps them from
|
|
2548
4406
|
covering the editor menubar/toolbar when the target sits on the first line. */
|
|
@@ -2551,7 +4409,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2551
4409
|
}
|
|
2552
4410
|
ctxBtn(t, e, i, s) {
|
|
2553
4411
|
const l = document.createElement("button");
|
|
2554
|
-
return l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (
|
|
4412
|
+
return l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (o) => o.preventDefault()), l.addEventListener("click", i), l;
|
|
2555
4413
|
}
|
|
2556
4414
|
ctxSep() {
|
|
2557
4415
|
const t = document.createElement("div");
|
|
@@ -2560,18 +4418,27 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2560
4418
|
buildTableCtxToolbar() {
|
|
2561
4419
|
const t = document.createElement("div");
|
|
2562
4420
|
t.className = "tblctx", t.dir = this.dir();
|
|
2563
|
-
const e = (
|
|
4421
|
+
const e = (s, l) => (s.addEventListener("mouseenter", () => this.setOpTarget(l)), s.addEventListener("mouseleave", () => this.setOpTarget(null)), s), i = this.ctxBtn(c.palette, this.t("cellbg"), () => this.cellFillMenu(i));
|
|
2564
4422
|
return t.append(
|
|
2565
|
-
e(this.ctxBtn(
|
|
2566
|
-
e(this.ctxBtn(
|
|
2567
|
-
e(this.ctxBtn(
|
|
4423
|
+
e(this.ctxBtn(c.rowbefore, this.t("rowabove"), () => this.tableOp("rowabove")), "row"),
|
|
4424
|
+
e(this.ctxBtn(c.rowafter, this.t("rowbelow"), () => this.tableOp("rowbelow")), "row"),
|
|
4425
|
+
e(this.ctxBtn(c.moverowup, this.t("moverowup"), () => this.tableMove("rowup")), "row"),
|
|
4426
|
+
e(this.ctxBtn(c.moverowdown, this.t("moverowdown"), () => this.tableMove("rowdown")), "row"),
|
|
4427
|
+
e(this.ctxBtn(c.rowdelete, this.t("delrow"), () => this.tableOp("delrow")), "row"),
|
|
2568
4428
|
this.ctxSep(),
|
|
2569
|
-
e(this.ctxBtn(
|
|
2570
|
-
e(this.ctxBtn(
|
|
2571
|
-
e(this.ctxBtn(
|
|
4429
|
+
e(this.ctxBtn(c.colbefore, this.t("colbefore"), () => this.tableOp("colbefore")), "col"),
|
|
4430
|
+
e(this.ctxBtn(c.colafter, this.t("colafter"), () => this.tableOp("colafter")), "col"),
|
|
4431
|
+
e(this.ctxBtn(c.movecolleft, this.t("movecolleft"), () => this.tableMove("colleft")), "col"),
|
|
4432
|
+
e(this.ctxBtn(c.movecolright, this.t("movecolright"), () => this.tableMove("colright")), "col"),
|
|
4433
|
+
e(this.ctxBtn(c.coldelete, this.t("delcol"), () => this.tableOp("delcol")), "col"),
|
|
2572
4434
|
this.ctxSep(),
|
|
2573
|
-
this.ctxBtn(
|
|
2574
|
-
this.ctxBtn(
|
|
4435
|
+
this.ctxBtn(c.alignleft, this.t("tblalignleft"), () => this.alignTable("left")),
|
|
4436
|
+
this.ctxBtn(c.aligncenter, this.t("tblaligncenter"), () => this.alignTable("center")),
|
|
4437
|
+
this.ctxBtn(c.alignright, this.t("tblalignright"), () => this.alignTable("right")),
|
|
4438
|
+
this.ctxSep(),
|
|
4439
|
+
i,
|
|
4440
|
+
this.ctxBtn(c.trash, this.t("deltable"), () => this.tableOp("deltable")),
|
|
4441
|
+
this.ctxBtn(c.tableic, this.t("tablepropsttl"), () => this.tablePropsDlg())
|
|
2575
4442
|
), document.body.appendChild(t), t;
|
|
2576
4443
|
}
|
|
2577
4444
|
positionTableHandles() {
|
|
@@ -2579,20 +4446,20 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2579
4446
|
this.clearTableHandles();
|
|
2580
4447
|
return;
|
|
2581
4448
|
}
|
|
2582
|
-
const t = this.ed.getAttribute("dir") === "rtl", e = this.tblActive.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX,
|
|
2583
|
-
if (this.tblCorner && (this.tblCorner.style.top =
|
|
2584
|
-
const r = this.tblCtx.offsetWidth,
|
|
4449
|
+
const t = this.ed.getAttribute("dir") === "rtl", e = this.tblActive.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, o = e.bottom + scrollY;
|
|
4450
|
+
if (this.tblCorner && (this.tblCorner.style.top = o - 5 + "px", this.tblCorner.style.left = (t ? s - 5 : l - 5) + "px", this.tblCorner.style.cursor = t ? "nesw-resize" : "nwse-resize"), this.tblCtx) {
|
|
4451
|
+
const r = this.tblCtx.offsetWidth, a = this.tblCtx.offsetHeight;
|
|
2585
4452
|
let h = s + (l - s) / 2 - r / 2;
|
|
2586
4453
|
h = Math.max(8 + scrollX, Math.min(h, scrollX + innerWidth - r - 8));
|
|
2587
|
-
let d = i -
|
|
2588
|
-
d < this.ctxMinTop() && (d =
|
|
4454
|
+
let d = i - a - 8;
|
|
4455
|
+
d < this.ctxMinTop() && (d = o + 8), this.tblCtx.style.left = h + "px", this.tblCtx.style.top = d + "px";
|
|
2589
4456
|
}
|
|
2590
4457
|
this.tblColBars.forEach((r) => r.remove()), this.tblColBars = [];
|
|
2591
|
-
const
|
|
2592
|
-
if (
|
|
2593
|
-
for (let r = 0; r <
|
|
2594
|
-
const
|
|
2595
|
-
d.className = "tbl-colbar", d.style.top = i + "px", d.style.left = h + "px", d.style.height =
|
|
4458
|
+
const n = this.tblActive.rows[0];
|
|
4459
|
+
if (n)
|
|
4460
|
+
for (let r = 0; r < n.cells.length - 1; r++) {
|
|
4461
|
+
const a = n.cells[r].getBoundingClientRect(), h = (t ? a.left : a.right) + scrollX, d = document.createElement("div");
|
|
4462
|
+
d.className = "tbl-colbar", d.style.top = i + "px", d.style.left = h + "px", d.style.height = o - i + "px", document.body.appendChild(d), d.addEventListener("mousedown", (m) => this.startColBarDrag(m, r)), this.tblColBars.push(d);
|
|
2596
4463
|
}
|
|
2597
4464
|
this.positionCellMarker(), this.positionOpMark();
|
|
2598
4465
|
}
|
|
@@ -2610,27 +4477,27 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2610
4477
|
const e = this.tblActive;
|
|
2611
4478
|
if (!e) return;
|
|
2612
4479
|
const i = this.ed.getAttribute("dir") === "rtl", s = t.clientX, l = e.getBoundingClientRect().width;
|
|
2613
|
-
e.style.tableLayout = e.style.tableLayout || "fixed", this.withNoTextSelect((
|
|
2614
|
-
const
|
|
2615
|
-
const h = i ? -(
|
|
4480
|
+
e.style.tableLayout = e.style.tableLayout || "fixed", this.withNoTextSelect((o) => {
|
|
4481
|
+
const n = (a) => {
|
|
4482
|
+
const h = i ? -(a.clientX - s) : a.clientX - s;
|
|
2616
4483
|
e.style.width = Math.max(60, Math.round(l + h)) + "px", this.positionTableHandles();
|
|
2617
4484
|
}, r = () => {
|
|
2618
|
-
window.removeEventListener("mousemove",
|
|
4485
|
+
window.removeEventListener("mousemove", n), window.removeEventListener("mouseup", r), o(), this.onChange();
|
|
2619
4486
|
};
|
|
2620
|
-
window.addEventListener("mousemove",
|
|
4487
|
+
window.addEventListener("mousemove", n), window.addEventListener("mouseup", r);
|
|
2621
4488
|
});
|
|
2622
4489
|
}
|
|
2623
4490
|
startColBarDrag(t, e) {
|
|
2624
4491
|
t.preventDefault(), t.stopPropagation();
|
|
2625
4492
|
const i = this.tblActive;
|
|
2626
4493
|
if (!i) return;
|
|
2627
|
-
const s = this.ed.getAttribute("dir") === "rtl", l = Array.from(i.rows),
|
|
2628
|
-
if (!
|
|
2629
|
-
const r = t.clientX,
|
|
4494
|
+
const s = this.ed.getAttribute("dir") === "rtl", l = Array.from(i.rows), o = l.map((d) => d.cells[e]).filter(Boolean), n = l.map((d) => d.cells[e + 1]).filter(Boolean);
|
|
4495
|
+
if (!o.length || !n.length) return;
|
|
4496
|
+
const r = t.clientX, a = o[0].getBoundingClientRect().width, h = n[0].getBoundingClientRect().width;
|
|
2630
4497
|
i.style.tableLayout = "fixed", this.withNoTextSelect((d) => {
|
|
2631
|
-
const m = (
|
|
2632
|
-
const v = (s ? -1 : 1) * (
|
|
2633
|
-
|
|
4498
|
+
const m = (u) => {
|
|
4499
|
+
const v = (s ? -1 : 1) * (u.clientX - r);
|
|
4500
|
+
o.forEach((b) => b.style.width = Math.max(24, Math.round(a + v)) + "px"), n.forEach((b) => b.style.width = Math.max(24, Math.round(h - v)) + "px"), this.positionTableHandles();
|
|
2634
4501
|
}, g = () => {
|
|
2635
4502
|
window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", g), d(), this.onChange();
|
|
2636
4503
|
};
|
|
@@ -2649,7 +4516,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2649
4516
|
this.cancelImgHide(), this.imgHandles.forEach((i) => i.remove()), this.imgHandles = [], (t = this.imgCtx) == null || t.remove(), this.imgCtx = null, (e = this.imgActive) == null || e.classList.remove("img-selected"), this.imgActive = null;
|
|
2650
4517
|
}
|
|
2651
4518
|
selectImage(t) {
|
|
2652
|
-
this.imgActive !== t && (this.clearImageHandles(), this.imgActive = t, t.classList.add("img-selected"), this.imgHandles =
|
|
4519
|
+
this.imgActive !== t && (this.clearImageHandles(), this.imgActive = t, t.classList.add("img-selected"), this.imgHandles = kt.map((e) => {
|
|
2653
4520
|
const i = document.createElement("div");
|
|
2654
4521
|
return i.className = "img-handle img-handle-" + e, i.dataset.corner = e, i.addEventListener("mousedown", (s) => this.startImageResizeDrag(s, e)), i.addEventListener("mouseenter", () => this.cancelImgHide()), i.addEventListener("mouseleave", () => this.scheduleImgHide()), document.body.appendChild(i), i;
|
|
2655
4522
|
}), this.imgCtx = this.buildImageCtxToolbar(t), this.positionImageHandles());
|
|
@@ -2659,38 +4526,38 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2659
4526
|
e.className = "imgctx", e.dir = this.dir();
|
|
2660
4527
|
const i = () => {
|
|
2661
4528
|
var h;
|
|
2662
|
-
const
|
|
2663
|
-
(h = this.imgCtx) == null || h.replaceWith(
|
|
2664
|
-
}, s = (
|
|
2665
|
-
this.setImageAlign(t,
|
|
2666
|
-
}, l = t.style.float === "left",
|
|
2667
|
-
const g = this.ctxBtn(
|
|
4529
|
+
const a = this.buildImageCtxToolbar(t);
|
|
4530
|
+
(h = this.imgCtx) == null || h.replaceWith(a), this.imgCtx = a, this.positionImageHandles();
|
|
4531
|
+
}, s = (a) => {
|
|
4532
|
+
this.setImageAlign(t, a), i();
|
|
4533
|
+
}, l = t.style.float === "left", o = t.style.float === "right", n = !l && !o && t.style.marginLeft === "auto" && t.style.marginRight === "auto", r = (a, h, d, m) => {
|
|
4534
|
+
const g = this.ctxBtn(a, h, m);
|
|
2668
4535
|
return g.classList.toggle("on", d), g;
|
|
2669
4536
|
};
|
|
2670
4537
|
return e.append(
|
|
2671
|
-
r(
|
|
2672
|
-
r(
|
|
2673
|
-
r(
|
|
4538
|
+
r(c.alignleft, this.t("alignleft"), l, () => s("left")),
|
|
4539
|
+
r(c.aligncenter, this.t("aligncenter"), n, () => s("center")),
|
|
4540
|
+
r(c.alignright, this.t("alignright"), o, () => s("right")),
|
|
2674
4541
|
this.ctxSep(),
|
|
2675
|
-
r(
|
|
4542
|
+
r(c.rotateleft, this.t("rotateleft"), !1, () => {
|
|
2676
4543
|
this.rotateImage(t, -90), i();
|
|
2677
4544
|
}),
|
|
2678
|
-
r(
|
|
4545
|
+
r(c.rotateright, this.t("rotateright"), !1, () => {
|
|
2679
4546
|
this.rotateImage(t, 90), i();
|
|
2680
4547
|
}),
|
|
2681
4548
|
this.ctxSep(),
|
|
2682
|
-
r(
|
|
4549
|
+
r(c.fliphorizontal, this.t("fliphorizontal"), t.dataset.flipx === "1", () => {
|
|
2683
4550
|
this.flipImage(t, "x"), i();
|
|
2684
4551
|
}),
|
|
2685
|
-
r(
|
|
4552
|
+
r(c.flipvertical, this.t("flipvertical"), t.dataset.flipy === "1", () => {
|
|
2686
4553
|
this.flipImage(t, "y"), i();
|
|
2687
4554
|
}),
|
|
2688
4555
|
this.ctxSep(),
|
|
2689
|
-
r(
|
|
2690
|
-
const
|
|
2691
|
-
|
|
4556
|
+
r(c.trash, this.t("deleteimg"), !1, () => {
|
|
4557
|
+
const a = t.closest(".tpl-media");
|
|
4558
|
+
a && this.ed.contains(a) ? t.outerHTML = this.imgPhHTML() : t.remove(), this.clearImageHandles(), this.onChange();
|
|
2692
4559
|
})
|
|
2693
|
-
), e.addEventListener("mousedown", (
|
|
4560
|
+
), e.addEventListener("mousedown", (a) => a.preventDefault()), e.addEventListener("mouseenter", () => this.cancelImgHide()), e.addEventListener("mouseleave", () => this.scheduleImgHide()), document.body.appendChild(e), e;
|
|
2694
4561
|
}
|
|
2695
4562
|
setImageAlign(t, e) {
|
|
2696
4563
|
t.style.float = "", t.style.display = "", t.style.marginLeft = "", t.style.marginRight = "", t.style.marginBottom = "", e === "left" ? (t.style.float = "left", t.style.marginInlineEnd = "1em", t.style.marginBottom = "0.5em") : e === "right" ? (t.style.float = "right", t.style.marginInlineStart = "1em", t.style.marginBottom = "0.5em") : (t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto"), this.onChange();
|
|
@@ -2712,21 +4579,21 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2712
4579
|
this.clearImageHandles();
|
|
2713
4580
|
return;
|
|
2714
4581
|
}
|
|
2715
|
-
const t = this.imgActive.getBoundingClientRect(), e = t.top + scrollY, i = t.left + scrollX, s = t.right + scrollX, l = t.bottom + scrollY,
|
|
4582
|
+
const t = this.imgActive.getBoundingClientRect(), e = t.top + scrollY, i = t.left + scrollX, s = t.right + scrollX, l = t.bottom + scrollY, o = {
|
|
2716
4583
|
nw: [i, e],
|
|
2717
4584
|
ne: [s, e],
|
|
2718
4585
|
sw: [i, l],
|
|
2719
4586
|
se: [s, l]
|
|
2720
4587
|
};
|
|
2721
|
-
if (this.imgHandles.forEach((
|
|
2722
|
-
const [r,
|
|
2723
|
-
|
|
4588
|
+
if (this.imgHandles.forEach((n) => {
|
|
4589
|
+
const [r, a] = o[n.dataset.corner];
|
|
4590
|
+
n.style.left = r - 5 + "px", n.style.top = a - 5 + "px";
|
|
2724
4591
|
}), this.imgCtx) {
|
|
2725
|
-
const
|
|
2726
|
-
let
|
|
2727
|
-
|
|
4592
|
+
const n = this.imgCtx.offsetWidth, r = this.imgCtx.offsetHeight;
|
|
4593
|
+
let a = i + (s - i) / 2 - n / 2;
|
|
4594
|
+
a = Math.max(8 + scrollX, Math.min(a, scrollX + innerWidth - n - 8));
|
|
2728
4595
|
let h = e - r - 8;
|
|
2729
|
-
h < this.ctxMinTop() && (h = l + 8), this.imgCtx.style.left =
|
|
4596
|
+
h < this.ctxMinTop() && (h = l + 8), this.imgCtx.style.left = a + "px", this.imgCtx.style.top = h + "px";
|
|
2730
4597
|
}
|
|
2731
4598
|
}
|
|
2732
4599
|
startImageResizeDrag(t, e) {
|
|
@@ -2734,14 +4601,14 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2734
4601
|
const i = this.imgActive;
|
|
2735
4602
|
if (!i) return;
|
|
2736
4603
|
this.cancelImgHide();
|
|
2737
|
-
const s = t.clientX, l = i.getBoundingClientRect().width,
|
|
2738
|
-
this.withNoTextSelect((
|
|
4604
|
+
const s = t.clientX, l = i.getBoundingClientRect().width, o = e === "nw" || e === "sw" ? -1 : 1;
|
|
4605
|
+
this.withNoTextSelect((n) => {
|
|
2739
4606
|
const r = (h) => {
|
|
2740
|
-
i.style.width = Math.max(24, Math.round(l +
|
|
2741
|
-
},
|
|
2742
|
-
window.removeEventListener("mousemove", r), window.removeEventListener("mouseup",
|
|
4607
|
+
i.style.width = Math.max(24, Math.round(l + o * (h.clientX - s))) + "px", i.style.height = "auto", this.positionImageHandles();
|
|
4608
|
+
}, a = () => {
|
|
4609
|
+
window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", a), n(), this.onChange();
|
|
2743
4610
|
};
|
|
2744
|
-
window.addEventListener("mousemove", r), window.addEventListener("mouseup",
|
|
4611
|
+
window.addEventListener("mousemove", r), window.addEventListener("mouseup", a);
|
|
2745
4612
|
});
|
|
2746
4613
|
}
|
|
2747
4614
|
/* ---------------------------------------------------------- selection bubble toolbar */
|
|
@@ -2765,39 +4632,40 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2765
4632
|
this.selCtx || (this.selCtx = this.buildSelToolbar()), this.positionSelToolbar(e);
|
|
2766
4633
|
}
|
|
2767
4634
|
buildSelToolbar() {
|
|
2768
|
-
var
|
|
4635
|
+
var n;
|
|
2769
4636
|
const t = document.createElement("div");
|
|
2770
4637
|
t.className = "selctx", t.dir = this.dir();
|
|
2771
4638
|
const e = this.ctxBtn(
|
|
2772
4639
|
'<b style="font:600 15px/1 Georgia,serif">A</b><span class="colorbar" data-cb="fore"></span>',
|
|
2773
4640
|
this.t("forecolor"),
|
|
2774
4641
|
() => this.colorMenu(e, "fore")
|
|
2775
|
-
), i = this.ctxBtn(
|
|
2776
|
-
(
|
|
2777
|
-
const s = this.ctxBtn(
|
|
4642
|
+
), i = this.ctxBtn(c.backcolor, this.t("backcolor"), () => this.colorMenu(i, "back"));
|
|
4643
|
+
(n = i.querySelector("svg")) == null || n.insertAdjacentHTML("afterend", '<span class="colorbar" data-cb="back"></span>');
|
|
4644
|
+
const s = this.ctxBtn(c.caseic, this.t("changecase"), () => this.caseMenu(s)), l = this.ctxBtn(c.lineheight, this.t("lineheight"), () => this.lineHeightMenu(l)), o = this.ctxBtn(c.wordspacing, this.t("wordspacing"), () => this.wordSpacingMenu(o));
|
|
2778
4645
|
return t.append(
|
|
2779
|
-
this.ctxBtn(
|
|
2780
|
-
this.ctxBtn(
|
|
4646
|
+
this.ctxBtn(c.bold, this.t("bold"), () => this.exec("bold"), "bold"),
|
|
4647
|
+
this.ctxBtn(c.italic, this.t("italic"), () => this.exec("italic"), "italic"),
|
|
2781
4648
|
e,
|
|
2782
4649
|
i,
|
|
2783
4650
|
this.ctxSep(),
|
|
2784
|
-
this.ctxBtn(
|
|
4651
|
+
this.ctxBtn(c.quote, this.t("quote"), () => this.toggleBlock("blockquote"), "blockquote"),
|
|
4652
|
+
this.ctxBtn(c.inlinecodeic, this.t("code"), () => this.toggleInlineCode(), "code"),
|
|
2785
4653
|
this.ctxBtn('<b style="font:700 12px/1 Arial,sans-serif">H2</b>', this.blockLabel("h2"), () => this.toggleBlock("h2"), "h2"),
|
|
2786
4654
|
this.ctxBtn('<b style="font:700 12px/1 Arial,sans-serif">H3</b>', this.blockLabel("h3"), () => this.toggleBlock("h3"), "h3"),
|
|
2787
4655
|
this.ctxSep(),
|
|
2788
|
-
this.ctxBtn(
|
|
4656
|
+
this.ctxBtn(c.link, this.t("linkttl"), () => this.linkDlg()),
|
|
2789
4657
|
s,
|
|
2790
4658
|
l,
|
|
2791
|
-
|
|
4659
|
+
o
|
|
2792
4660
|
), t.addEventListener("mousedown", (r) => r.preventDefault()), document.body.appendChild(t), this.syncColorSwatches(t), t;
|
|
2793
4661
|
}
|
|
2794
4662
|
positionSelToolbar(t) {
|
|
2795
4663
|
if (!this.selCtx) return;
|
|
2796
|
-
const e = t.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX,
|
|
2797
|
-
let
|
|
2798
|
-
|
|
4664
|
+
const e = t.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, o = e.bottom + scrollY, n = this.selCtx.offsetWidth, r = this.selCtx.offsetHeight;
|
|
4665
|
+
let a = s + (l - s) / 2 - n / 2;
|
|
4666
|
+
a = Math.max(8 + scrollX, Math.min(a, scrollX + innerWidth - n - 8));
|
|
2799
4667
|
let h = i - r - 8;
|
|
2800
|
-
h < this.ctxMinTop() && (h =
|
|
4668
|
+
h < this.ctxMinTop() && (h = o + 8), this.selCtx.style.left = a + "px", this.selCtx.style.top = h + "px";
|
|
2801
4669
|
}
|
|
2802
4670
|
repositionSelToolbar() {
|
|
2803
4671
|
if (!this.selCtx) return;
|
|
@@ -2825,7 +4693,7 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2825
4693
|
return t > 0 ? t + "px" : "";
|
|
2826
4694
|
}
|
|
2827
4695
|
refreshState() {
|
|
2828
|
-
var r,
|
|
4696
|
+
var r, a, h;
|
|
2829
4697
|
const t = window.getSelection(), e = t ? this.ed.contains(t.anchorNode) : !1, i = this.currentBlock();
|
|
2830
4698
|
[this.toolbar, this.selCtx].filter(Boolean).forEach((d) => {
|
|
2831
4699
|
[
|
|
@@ -2839,21 +4707,23 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2839
4707
|
"justifyFull",
|
|
2840
4708
|
"insertOrderedList",
|
|
2841
4709
|
"insertUnorderedList"
|
|
2842
|
-
].forEach((
|
|
2843
|
-
const
|
|
2844
|
-
|
|
2845
|
-
}), ["h2", "h3", "blockquote"].forEach((
|
|
2846
|
-
const
|
|
2847
|
-
|
|
4710
|
+
].forEach((g) => {
|
|
4711
|
+
const u = d.querySelector(`[data-id=${g}]`);
|
|
4712
|
+
u && u.classList.toggle("on", e && document.queryCommandState(g));
|
|
4713
|
+
}), ["h2", "h3", "blockquote"].forEach((g) => {
|
|
4714
|
+
const u = d.querySelector(`[data-id=${g}]`);
|
|
4715
|
+
u && u.classList.toggle("on", e && i === g);
|
|
2848
4716
|
});
|
|
4717
|
+
const m = d.querySelector("[data-id=code]");
|
|
4718
|
+
m && m.classList.toggle("on", e && !!this.closestInlineCode());
|
|
2849
4719
|
});
|
|
2850
|
-
const l = t ? this.closestBlock(t.anchorNode) : null,
|
|
2851
|
-
(
|
|
2852
|
-
const
|
|
2853
|
-
const
|
|
2854
|
-
|
|
4720
|
+
const l = t ? this.closestBlock(t.anchorNode) : null, o = ((r = l == null ? void 0 : l.closest("[dir]")) == null ? void 0 : r.getAttribute("dir")) || this.ed.getAttribute("dir") || this.dir();
|
|
4721
|
+
(a = this.toolbar.querySelector("[data-id=ltr]")) == null || a.classList.toggle("on", e && o === "ltr"), (h = this.toolbar.querySelector("[data-id=rtl]")) == null || h.classList.toggle("on", e && o === "rtl");
|
|
4722
|
+
const n = (d, m, g) => {
|
|
4723
|
+
const u = this.toolbar.querySelector(`[data-id=${d}] .lbl`);
|
|
4724
|
+
u && (u.textContent = m || g || "", u.classList.toggle("empty", !m));
|
|
2855
4725
|
};
|
|
2856
|
-
|
|
4726
|
+
n("fontsel", this.currentFont()), n("sizesel", this.currentSize().replace("px", "")), e && n("blocksel", V.some((d) => d[0] === i) ? this.blockLabel(i) : this.t("para")), this.sbWords.textContent = this.countWords() + " " + this.t("words");
|
|
2857
4727
|
}
|
|
2858
4728
|
countWords() {
|
|
2859
4729
|
const t = (this.ed.textContent || "").trim();
|
|
@@ -2872,26 +4742,33 @@ const wt = ["nw", "ne", "sw", "se"], D = ["img-left", "img-right", "img-top", "i
|
|
|
2872
4742
|
}, l.readAsDataURL(s.getAsFile());
|
|
2873
4743
|
return;
|
|
2874
4744
|
}
|
|
2875
|
-
|
|
4745
|
+
if (!i) {
|
|
4746
|
+
const l = e.getData("text/plain"), o = /^\S+$/.test(l.trim()) ? this.videoEmbedUrl(l.trim()) : null;
|
|
4747
|
+
if (o) {
|
|
4748
|
+
document.execCommand("insertHTML", !1, this.videoEmbedHTML(o)), this.onChange();
|
|
4749
|
+
return;
|
|
4750
|
+
}
|
|
4751
|
+
}
|
|
4752
|
+
i ? document.execCommand("insertHTML", !1, wt(i, this.dir())) : document.execCommand("insertHTML", !1, Tt(e.getData("text/plain"))), this.onChange();
|
|
2876
4753
|
}
|
|
2877
4754
|
/* ---------------------------------------------------------- init */
|
|
2878
4755
|
initUI() {
|
|
2879
|
-
this.closePop(), this.closeDlg(), this.clearTableHandles(), this.clearImgPlaceholderSel(), this.shell.dir = this.dir(), this.ed.dir = this.dir(), this.options.menubar ? this.buildMenubar() : this.menubar.style.display = "none", this.options.toolbar ? this.buildToolbar() : this.toolbar.style.display = "none", this.sbHelp.textContent = this.t("statushelp"), this.refreshState();
|
|
4756
|
+
this.closePop(), this.closeDlg(), this.clearTableHandles(), this.clearImgPlaceholderSel(), this.clearVphPlaceholderSel(), this.clearVidHandles(), this.clearCodeSel(), this.shell.dir = this.dir(), this.ed.dir = this.dir(), this.options.menubar ? this.buildMenubar() : this.menubar.style.display = "none", this.options.toolbar ? this.buildToolbar() : this.toolbar.style.display = "none", this.sbHelp.textContent = this.t("statushelp"), this.refreshState();
|
|
2880
4757
|
}
|
|
2881
4758
|
};
|
|
2882
|
-
|
|
2883
|
-
let
|
|
4759
|
+
I.instanceCounter = 0, I.TBR_COLLAPSE_MAX = 992;
|
|
4760
|
+
let G = I;
|
|
2884
4761
|
export {
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
4762
|
+
V as BLOCKS,
|
|
4763
|
+
Bt as CHARS,
|
|
4764
|
+
ct as COLORS,
|
|
4765
|
+
et as FONTS,
|
|
4766
|
+
G as FableEditor,
|
|
4767
|
+
K as I18N,
|
|
4768
|
+
c as IC,
|
|
4769
|
+
it as SIZES,
|
|
4770
|
+
Nt as TXT,
|
|
4771
|
+
wt as cleanPastedHTML,
|
|
4772
|
+
R as getStrings,
|
|
4773
|
+
Tt as normalizeTextPaste
|
|
2897
4774
|
};
|