@editora/plugins 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -4
- package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
- package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
- package/dist/anchor.cjs.js +11 -11
- package/dist/anchor.esm.js +130 -107
- package/dist/anchoredPopover-BzqGPOAE.js +1 -0
- package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
- package/dist/background-color.cjs.js +3 -3
- package/dist/background-color.esm.js +116 -119
- package/dist/code.cjs.js +82 -102
- package/dist/code.esm.js +1172 -662
- package/dist/comments.cjs.js +10 -10
- package/dist/comments.esm.js +195 -177
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/documentManager-CTqRftU8.mjs +8369 -0
- package/dist/documentManager-Jf0RbSks.js +17 -0
- package/dist/embed-iframe.cjs.js +2 -2
- package/dist/embed-iframe.esm.js +8 -5
- package/dist/emojis.cjs.js +64 -39
- package/dist/emojis.esm.js +133 -104
- package/dist/html2canvas.esm-B5qzocYs.js +5 -0
- package/dist/html2canvas.esm-BWVIUcAF.mjs +4802 -0
- package/dist/{index-Bskk414V.mjs → index-BFsKNTTj.mjs} +50 -50
- package/dist/index-CvJk4DKa.js +221 -0
- package/dist/index-D3CycEFU.mjs +16543 -0
- package/dist/index-tqLTHcO6.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-Cz1qItab.js → index.es-CE_A4QSm.js} +5 -5
- package/dist/{index.es-DEcRmSTY.mjs → index.es-DQ78mYYo.mjs} +4 -3
- package/dist/index.esm.js +87 -79
- package/dist/jspdf.es.min-BoS80556.js +77 -0
- package/dist/jspdf.es.min-DQCoX5yh.mjs +7889 -0
- package/dist/link.cjs.js +6 -6
- package/dist/link.esm.js +41 -39
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +151 -112
- package/dist/media-manager.cjs.js +15 -15
- package/dist/media-manager.esm.js +227 -206
- package/dist/merge-tag.cjs.js +44 -12
- package/dist/merge-tag.esm.js +368 -241
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +77 -69
- package/dist/special-characters.cjs.js +83 -45
- package/dist/special-characters.esm.js +149 -100
- package/dist/spell-check.cjs.js +9 -9
- package/dist/spell-check.esm.js +235 -216
- package/dist/template.cjs.js +14 -14
- package/dist/template.esm.js +157 -131
- package/dist/text-color.cjs.js +9 -9
- package/dist/text-color.esm.js +131 -115
- package/index.d.ts +51 -1
- package/package.json +6 -4
- package/dist/colorSelectionApply-C0iOfMWb.js +0 -1
- package/dist/colorSelectionApply-D8r_gV32.mjs +0 -63
- package/dist/documentManager-DRUc1-Cs.mjs +0 -37581
- package/dist/documentManager-_tQQfQi9.js +0 -317
- package/dist/index-D3pJyAsj.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const g = {
|
|
2
2
|
all: {
|
|
3
3
|
name: "All",
|
|
4
4
|
characters: [
|
|
@@ -389,7 +389,7 @@ const p = {
|
|
|
389
389
|
name: "Arrows",
|
|
390
390
|
characters: ["←", "↑", "→", "↓", "↔", "↕", "↖", "↗", "↘", "↙", "↚", "↛", "↜", "↝", "↞", "↟", "↠", "↡", "↢", "↣", "↤", "↥", "↦", "↧", "↨", "↩", "↪", "↫", "↬", "↭", "↮", "↯", "↰", "↱", "↲", "↳", "↴", "↵", "↶", "↷", "↸", "↹", "↺", "↻", "↼", "↽", "↾", "↿", "⇀", "⇁", "⇂", "⇃", "⇄", "⇅", "⇆", "⇇", "⇈", "⇉", "⇊", "⇋", "⇌", "⇍", "⇎", "⇏", "⇐", "⇑", "⇒", "⇓", "⇔", "⇕", "⇖", "⇗", "⇘", "⇙", "⇚", "⇛", "⇜", "⇝", "⇞", "⇟", "⇠", "⇡", "⇢", "⇣", "⇤", "⇥", "⇦", "⇧", "⇨", "⇩", "⇪", "⇫", "⇬", "⇭", "⇮", "⇯", "⇰", "⇱", "⇲", "⇳", "⇴", "⇵", "⇶", "⇷", "⇸", "⇹", "⇺", "⇻", "⇼", "⇽", "⇾", "⇿"]
|
|
391
391
|
}
|
|
392
|
-
},
|
|
392
|
+
}, x = {
|
|
393
393
|
"€": "euro",
|
|
394
394
|
"£": "pound",
|
|
395
395
|
"¥": "yen",
|
|
@@ -438,21 +438,21 @@ const p = {
|
|
|
438
438
|
"↓": "down arrow",
|
|
439
439
|
"↔": "left right arrow"
|
|
440
440
|
};
|
|
441
|
-
let
|
|
442
|
-
const
|
|
443
|
-
const
|
|
444
|
-
if (!
|
|
445
|
-
const e =
|
|
441
|
+
let u = !1;
|
|
442
|
+
const C = '[data-theme="dark"], .dark, .editora-theme-dark', k = () => {
|
|
443
|
+
const t = window.getSelection();
|
|
444
|
+
if (!t || t.rangeCount === 0) return null;
|
|
445
|
+
const e = t.anchorNode;
|
|
446
446
|
return (e instanceof HTMLElement ? e : e?.parentElement)?.closest(".rte-content, .editora-content") || null;
|
|
447
|
-
},
|
|
448
|
-
const e =
|
|
449
|
-
return e ? !!e.closest(
|
|
450
|
-
},
|
|
447
|
+
}, E = (t) => {
|
|
448
|
+
const e = t || k();
|
|
449
|
+
return e ? !!e.closest(C) : !1;
|
|
450
|
+
}, z = () => {
|
|
451
451
|
if (typeof document > "u") return;
|
|
452
|
-
const
|
|
453
|
-
if (document.getElementById(
|
|
452
|
+
const t = "special-characters-plugin-styles";
|
|
453
|
+
if (document.getElementById(t)) return;
|
|
454
454
|
const e = document.createElement("style");
|
|
455
|
-
e.id =
|
|
455
|
+
e.id = t, e.textContent = `
|
|
456
456
|
.special-characters-overlay {
|
|
457
457
|
--rte-sc-overlay-bg: rgba(15, 23, 36, 0.56);
|
|
458
458
|
--rte-sc-dialog-bg: #ffffff;
|
|
@@ -464,6 +464,26 @@ const f = '[data-theme="dark"], .dark, .editora-theme-dark', b = () => {
|
|
|
464
464
|
--rte-sc-accent: #1f75fe;
|
|
465
465
|
--rte-sc-accent-strong: #165fd6;
|
|
466
466
|
--rte-sc-ring: rgba(31, 117, 254, 0.18);
|
|
467
|
+
--rte-picker-dialog-width: min(640px, 96vw);
|
|
468
|
+
--rte-picker-dialog-max-height: min(560px, 86vh);
|
|
469
|
+
--rte-picker-dialog-radius: 12px;
|
|
470
|
+
--rte-picker-search-wrap-padding: 12px;
|
|
471
|
+
--rte-picker-search-height: 38px;
|
|
472
|
+
--rte-picker-search-font-size: 13px;
|
|
473
|
+
--rte-picker-search-radius: 8px;
|
|
474
|
+
--rte-picker-tabs-width: 156px;
|
|
475
|
+
--rte-picker-tab-padding-y: 10px;
|
|
476
|
+
--rte-picker-tab-padding-x: 12px;
|
|
477
|
+
--rte-picker-tab-font-size: 13px;
|
|
478
|
+
--rte-picker-grid-padding: 12px;
|
|
479
|
+
--rte-picker-grid-gap: 6px;
|
|
480
|
+
--rte-picker-cell-size: 34px;
|
|
481
|
+
--rte-picker-cell-font-size: 17px;
|
|
482
|
+
--rte-picker-cell-radius: 7px;
|
|
483
|
+
--rte-picker-mobile-tab-min-width: 82px;
|
|
484
|
+
--rte-picker-mobile-cell-size: 32px;
|
|
485
|
+
--rte-picker-mobile-grid-gap: 5px;
|
|
486
|
+
--rte-picker-mobile-dialog-max-height: 88vh;
|
|
467
487
|
position: fixed;
|
|
468
488
|
top: 0;
|
|
469
489
|
left: 0;
|
|
@@ -496,11 +516,10 @@ const f = '[data-theme="dark"], .dark, .editora-theme-dark', b = () => {
|
|
|
496
516
|
background: var(--rte-sc-dialog-bg);
|
|
497
517
|
color: var(--rte-sc-dialog-text);
|
|
498
518
|
border: 1px solid var(--rte-sc-border);
|
|
499
|
-
border-radius:
|
|
519
|
+
border-radius: var(--rte-picker-dialog-radius);
|
|
500
520
|
box-shadow: 0 24px 48px rgba(10, 15, 24, 0.28);
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
max-height: 80vh;
|
|
521
|
+
width: var(--rte-picker-dialog-width);
|
|
522
|
+
max-height: var(--rte-picker-dialog-max-height);
|
|
504
523
|
display: flex;
|
|
505
524
|
flex-direction: column;
|
|
506
525
|
overflow: hidden;
|
|
@@ -554,18 +573,20 @@ const f = '[data-theme="dark"], .dark, .editora-theme-dark', b = () => {
|
|
|
554
573
|
display: flex;
|
|
555
574
|
flex-direction: column;
|
|
556
575
|
overflow: hidden;
|
|
576
|
+
min-width: 0;
|
|
557
577
|
}
|
|
558
578
|
|
|
559
579
|
.special-characters-search {
|
|
560
|
-
padding:
|
|
580
|
+
padding: var(--rte-picker-search-wrap-padding) var(--rte-picker-search-wrap-padding) 0 var(--rte-picker-search-wrap-padding);
|
|
561
581
|
}
|
|
562
582
|
|
|
563
583
|
.special-characters-search-input {
|
|
564
584
|
width: 100%;
|
|
565
|
-
|
|
585
|
+
height: var(--rte-picker-search-height);
|
|
586
|
+
padding: 8px 12px;
|
|
566
587
|
border: 1px solid var(--rte-sc-border);
|
|
567
|
-
border-radius:
|
|
568
|
-
font-size:
|
|
588
|
+
border-radius: var(--rte-picker-search-radius);
|
|
589
|
+
font-size: var(--rte-picker-search-font-size);
|
|
569
590
|
color: var(--rte-sc-dialog-text);
|
|
570
591
|
background-color: var(--rte-sc-subtle-bg);
|
|
571
592
|
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
|
@@ -585,21 +606,23 @@ const f = '[data-theme="dark"], .dark, .editora-theme-dark', b = () => {
|
|
|
585
606
|
.special-characters-tabs {
|
|
586
607
|
display: flex;
|
|
587
608
|
flex-direction: column;
|
|
588
|
-
width:
|
|
609
|
+
width: var(--rte-picker-tabs-width);
|
|
589
610
|
border-right: 1px solid var(--rte-sc-border);
|
|
590
611
|
background-color: var(--rte-sc-subtle-bg);
|
|
612
|
+
overflow-y: auto;
|
|
591
613
|
}
|
|
592
614
|
|
|
593
615
|
.special-characters-tab {
|
|
594
|
-
padding:
|
|
616
|
+
padding: var(--rte-picker-tab-padding-y) var(--rte-picker-tab-padding-x);
|
|
595
617
|
border: none;
|
|
596
618
|
background: none;
|
|
597
619
|
text-align: left;
|
|
598
620
|
cursor: pointer;
|
|
599
|
-
font-size:
|
|
621
|
+
font-size: var(--rte-picker-tab-font-size);
|
|
600
622
|
color: var(--rte-sc-muted-text);
|
|
601
623
|
border-bottom: 1px solid var(--rte-sc-border);
|
|
602
624
|
transition: all 0.2s ease;
|
|
625
|
+
line-height: 1.25;
|
|
603
626
|
}
|
|
604
627
|
|
|
605
628
|
.special-characters-tab:hover {
|
|
@@ -614,24 +637,25 @@ const f = '[data-theme="dark"], .dark, .editora-theme-dark', b = () => {
|
|
|
614
637
|
}
|
|
615
638
|
|
|
616
639
|
.special-characters-grid {
|
|
617
|
-
padding:
|
|
640
|
+
padding: var(--rte-picker-grid-padding);
|
|
618
641
|
overflow-y: auto;
|
|
619
642
|
display: grid;
|
|
620
|
-
grid-template-columns: repeat(auto-fill, minmax(
|
|
621
|
-
gap:
|
|
643
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--rte-picker-cell-size), 1fr));
|
|
644
|
+
gap: var(--rte-picker-grid-gap);
|
|
645
|
+
contain: content;
|
|
622
646
|
}
|
|
623
647
|
|
|
624
648
|
.special-characters-item {
|
|
625
|
-
width:
|
|
626
|
-
height:
|
|
649
|
+
width: var(--rte-picker-cell-size);
|
|
650
|
+
height: var(--rte-picker-cell-size);
|
|
627
651
|
display: flex;
|
|
628
652
|
align-items: center;
|
|
629
653
|
justify-content: center;
|
|
630
654
|
border: 1px solid var(--rte-sc-border);
|
|
631
655
|
background: var(--rte-sc-subtle-bg);
|
|
632
|
-
border-radius:
|
|
656
|
+
border-radius: var(--rte-picker-cell-radius);
|
|
633
657
|
cursor: pointer;
|
|
634
|
-
font-size:
|
|
658
|
+
font-size: var(--rte-picker-cell-font-size);
|
|
635
659
|
transition: all 0.2s ease;
|
|
636
660
|
color: var(--rte-sc-dialog-text);
|
|
637
661
|
}
|
|
@@ -660,8 +684,8 @@ const f = '[data-theme="dark"], .dark, .editora-theme-dark', b = () => {
|
|
|
660
684
|
|
|
661
685
|
@media (max-width: 768px) {
|
|
662
686
|
.special-characters-dialog {
|
|
663
|
-
width:
|
|
664
|
-
max-height:
|
|
687
|
+
width: 96%;
|
|
688
|
+
max-height: var(--rte-picker-mobile-dialog-max-height);
|
|
665
689
|
}
|
|
666
690
|
|
|
667
691
|
.special-characters-content {
|
|
@@ -680,79 +704,104 @@ const f = '[data-theme="dark"], .dark, .editora-theme-dark', b = () => {
|
|
|
680
704
|
border-bottom: none;
|
|
681
705
|
border-right: 1px solid var(--rte-sc-border);
|
|
682
706
|
white-space: nowrap;
|
|
707
|
+
min-width: var(--rte-picker-mobile-tab-min-width);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
.special-characters-grid {
|
|
711
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--rte-picker-mobile-cell-size), 1fr));
|
|
712
|
+
gap: var(--rte-picker-mobile-grid-gap);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
.special-characters-item {
|
|
716
|
+
width: var(--rte-picker-mobile-cell-size);
|
|
717
|
+
height: var(--rte-picker-mobile-cell-size);
|
|
718
|
+
font-size: 16px;
|
|
683
719
|
}
|
|
684
720
|
}
|
|
685
721
|
`, document.head.appendChild(e);
|
|
686
|
-
},
|
|
722
|
+
}, L = (t) => {
|
|
687
723
|
const e = window.getSelection();
|
|
688
724
|
if (e && e.rangeCount > 0) {
|
|
689
|
-
const
|
|
690
|
-
|
|
691
|
-
const c = document.createTextNode(
|
|
692
|
-
|
|
725
|
+
const a = e.getRangeAt(0);
|
|
726
|
+
a.deleteContents();
|
|
727
|
+
const c = document.createTextNode(t);
|
|
728
|
+
a.insertNode(c), a.setStartAfter(c), a.setEndAfter(c), e.removeAllRanges(), e.addRange(a);
|
|
693
729
|
}
|
|
694
|
-
},
|
|
695
|
-
if (typeof window > "u" ||
|
|
696
|
-
|
|
697
|
-
let e = "all",
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
const
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
730
|
+
}, S = (t) => {
|
|
731
|
+
if (typeof window > "u" || u) return;
|
|
732
|
+
u = !0, z();
|
|
733
|
+
let e = "all", a = "", c = null;
|
|
734
|
+
const i = document.createElement("div");
|
|
735
|
+
i.className = "special-characters-overlay", E(t) && i.classList.add("rte-ui-theme-dark");
|
|
736
|
+
const s = document.createElement("div");
|
|
737
|
+
s.className = "special-characters-dialog", s.setAttribute("role", "dialog"), s.setAttribute("aria-modal", "true"), s.innerHTML = `
|
|
738
|
+
<div class="special-characters-header">
|
|
739
|
+
<h2>Insert Special Characters</h2>
|
|
740
|
+
<button class="special-characters-close">×</button>
|
|
741
|
+
</div>
|
|
742
|
+
<div class="special-characters-content">
|
|
743
|
+
<div class="special-characters-tabs">
|
|
744
|
+
${Object.keys(g).map((r) => `
|
|
745
|
+
<button class="special-characters-tab ${e === r ? "active" : ""}" data-category="${r}">
|
|
746
|
+
${g[r].name}
|
|
747
|
+
</button>
|
|
748
|
+
`).join("")}
|
|
712
749
|
</div>
|
|
713
|
-
<div class="special-characters-content">
|
|
714
|
-
<div class="special-characters-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
</div>
|
|
721
|
-
<div class="special-characters-main-content">
|
|
722
|
-
<div class="special-characters-search">
|
|
723
|
-
<input type="text" placeholder="Search characters..." value="${t}" class="special-characters-search-input">
|
|
724
|
-
</div>
|
|
725
|
-
<div class="special-characters-grid">
|
|
726
|
-
${s.length > 0 ? s.map((r) => `
|
|
727
|
-
<button class="special-characters-item" data-char="${r}" title="${g[r] || r}">
|
|
728
|
-
${r}
|
|
729
|
-
</button>
|
|
730
|
-
`).join("") : `<div class="special-characters-no-results">No characters found for "${t}"</div>`}
|
|
731
|
-
</div>
|
|
750
|
+
<div class="special-characters-main-content">
|
|
751
|
+
<div class="special-characters-search">
|
|
752
|
+
<input
|
|
753
|
+
type="text"
|
|
754
|
+
placeholder="Search characters..."
|
|
755
|
+
class="special-characters-search-input"
|
|
756
|
+
>
|
|
732
757
|
</div>
|
|
758
|
+
<div class="special-characters-grid"></div>
|
|
733
759
|
</div>
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
r.
|
|
743
|
-
const i = n.target.getAttribute("data-char");
|
|
744
|
-
i && (v(i), l());
|
|
745
|
-
});
|
|
760
|
+
</div>
|
|
761
|
+
`;
|
|
762
|
+
const b = s.querySelector(".special-characters-tabs"), d = s.querySelector(".special-characters-grid"), m = s.querySelector(".special-characters-search-input"), w = s.querySelector(".special-characters-close"), y = () => g[e].characters.filter((r) => {
|
|
763
|
+
if (!a.trim()) return !0;
|
|
764
|
+
const o = a.toLowerCase();
|
|
765
|
+
return r.toLowerCase().includes(o) || (x[r] || "").toLowerCase().includes(o);
|
|
766
|
+
}), v = () => {
|
|
767
|
+
b?.querySelectorAll(".special-characters-tab").forEach((r) => {
|
|
768
|
+
r.classList.toggle("active", r.getAttribute("data-category") === e);
|
|
746
769
|
});
|
|
747
|
-
},
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
770
|
+
}, h = () => {
|
|
771
|
+
if (!d) return;
|
|
772
|
+
const r = y();
|
|
773
|
+
if (r.length === 0) {
|
|
774
|
+
d.innerHTML = `<div class="special-characters-no-results">No characters found for "${a}"</div>`;
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
d.innerHTML = r.map((o) => `
|
|
778
|
+
<button class="special-characters-item" data-char="${o}" title="${x[o] || o}">
|
|
779
|
+
${o}
|
|
780
|
+
</button>
|
|
781
|
+
`).join("");
|
|
782
|
+
}, p = () => {
|
|
783
|
+
c !== null && (window.clearTimeout(c), c = null), i.parentNode && i.parentNode.removeChild(i), u = !1, document.removeEventListener("keydown", f, !0);
|
|
784
|
+
}, f = (r) => {
|
|
785
|
+
r.key === "Escape" && (r.preventDefault(), r.stopPropagation(), p());
|
|
751
786
|
};
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
787
|
+
w?.addEventListener("click", p), b?.addEventListener("click", (r) => {
|
|
788
|
+
const l = r.target.closest(".special-characters-tab");
|
|
789
|
+
if (!l) return;
|
|
790
|
+
const n = l.getAttribute("data-category");
|
|
791
|
+
!n || e === n || (e = n, v(), h());
|
|
792
|
+
}), m?.addEventListener("input", (r) => {
|
|
793
|
+
a = r.target.value, c !== null && window.clearTimeout(c), c = window.setTimeout(() => {
|
|
794
|
+
c = null, h();
|
|
795
|
+
}, 90);
|
|
796
|
+
}), d?.addEventListener("click", (r) => {
|
|
797
|
+
const l = r.target.closest(".special-characters-item");
|
|
798
|
+
if (!l) return;
|
|
799
|
+
const n = l.getAttribute("data-char");
|
|
800
|
+
n && (L(n), p());
|
|
801
|
+
}), i.addEventListener("click", (r) => {
|
|
802
|
+
r.target === i && p();
|
|
803
|
+
}), document.addEventListener("keydown", f, !0), v(), h(), i.appendChild(s), document.body.appendChild(i), requestAnimationFrame(() => m?.focus());
|
|
804
|
+
}, q = () => ({
|
|
756
805
|
name: "specialCharacters",
|
|
757
806
|
toolbar: [{
|
|
758
807
|
label: "Special Characters",
|
|
@@ -760,13 +809,13 @@ const f = '[data-theme="dark"], .dark, .editora-theme-dark', b = () => {
|
|
|
760
809
|
icon: '<svg width="24" height="24" focusable="false"><path d="M15 18h4l1-2v4h-6v-3.3l1.4-1a6 6 0 0 0 1.8-2.9 6.3 6.3 0 0 0-.1-4.1 5.8 5.8 0 0 0-3-3.2c-.6-.3-1.3-.5-2.1-.5a5.1 5.1 0 0 0-3.9 1.8 6.3 6.3 0 0 0-1.3 6 6.2 6.2 0 0 0 1.8 3l1.4.9V20H4v-4l1 2h4v-.5l-2-1L5.4 15A6.5 6.5 0 0 1 4 11c0-1 .2-1.9.6-2.7A7 7 0 0 1 6.3 6C7.1 5.4 8 5 9 4.5c1-.3 2-.5 3.1-.5a8.8 8.8 0 0 1 5.7 2 7 7 0 0 1 1.7 2.3 6 6 0 0 1 .2 4.8c-.2.7-.6 1.3-1 1.9a7.6 7.6 0 0 1-3.6 2.5v.5Z" fill-rule="evenodd"></path></svg>'
|
|
761
810
|
}],
|
|
762
811
|
commands: {
|
|
763
|
-
insertSpecialCharacter: (
|
|
764
|
-
const
|
|
765
|
-
return
|
|
812
|
+
insertSpecialCharacter: (t, e) => {
|
|
813
|
+
const a = e?.contentElement instanceof HTMLElement ? e.contentElement : k();
|
|
814
|
+
return S(a), !0;
|
|
766
815
|
}
|
|
767
816
|
},
|
|
768
817
|
keymap: {}
|
|
769
818
|
});
|
|
770
819
|
export {
|
|
771
|
-
|
|
820
|
+
q as SpecialCharactersPlugin
|
|
772
821
|
};
|
package/dist/spell-check.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const j=new Set(["the","a","an","and","or","but","in","on","at","to","for","of","with","by","from","is","are","be","was","were","have","has","had","do","does","did","will","would","could","should","may","might","must","can","this","that","these","those","what","which","who","whom","where","when","why","how","all","each","every","both","few","more","most","other","same","such","no","nor","not","only","own","so","than","too","very","just","as","if","because","while","although","though","it","its","their","them","they","you","he","she","we","me","him","her","us","our","i","my","your","his","hers","ours","yours","theirs","editor","document","text","word","paragraph","line","page","content","hello","world","test","example","sample","demo","lorem","ipsum"]),C=new Set,S=new Set;let u=!1,d=null,f=null,a=null,s=null,x=null,y=!1,h=null,_=!1,b=0,g=null;const B={characterData:!0,childList:!0,subtree:!0},H="rte-spellcheck-styles",R="__editoraCommandEditorRoot";function K(e){const t=e?.contentElement||e?.editorElement||null;if(!(t instanceof HTMLElement))return;const r=t.getAttribute("contenteditable")==="true"?t:t.querySelector?.('[contenteditable="true"]');if(r instanceof HTMLElement){s=r,h=r;return}const l=t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?t:null),o=A(l);o&&(s=o,h=o)}function P(){if(typeof window>"u")return null;const e=window[R];if(!(e instanceof HTMLElement))return null;window[R]=null;const t=e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?e:null);if(t){const l=A(t);if(l)return l;if(t.getAttribute("contenteditable")==="true")return t}if(e.getAttribute("contenteditable")==="true")return e;const r=e.closest('[contenteditable="true"]');return r instanceof HTMLElement?r:null}function T(){let e=document.getElementById(H);e||(e=document.createElement("style"),e.id=H,document.head.appendChild(e)),e.textContent=`
|
|
2
2
|
.rte-spell-check-panel {
|
|
3
3
|
position: absolute;
|
|
4
4
|
top: 12px;
|
|
@@ -466,7 +466,7 @@
|
|
|
466
466
|
:is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-spellcheck-menu-item.positive {
|
|
467
467
|
color: #93c5fd;
|
|
468
468
|
}
|
|
469
|
-
`}function k(){if(s&&document.contains(s))return s;const e=
|
|
469
|
+
`}function k(){if(s&&document.contains(s))return s;const e=V();return e&&(s=e),e}function W(e){if(!e)return;const r=(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest('[contenteditable="true"]');r&&(s=r)}function A(e){if(!e)return null;const t=e.querySelector('[contenteditable="true"]');return t instanceof HTMLElement?t:null}function Q(){if(_)return;const e=t=>{const r=t.target;if(!r)return;const l=r.closest('.editora-toolbar-button[data-command="toggleSpellCheck"], .rte-toolbar-button[data-command="toggleSpellCheck"]');if(!l)return;const o=l.closest("[data-editora-editor]"),n=A(o);n&&(h=n,s=n)};document.addEventListener("pointerdown",e,!0),_=!0}function ee(){const e=P();if(e&&document.contains(e))return s=e,h=null,e;if(h&&document.contains(h)){const t=h;return h=null,s=t,t}return V()}function te(){b+=1,b===1&&d&&d.disconnect()}function re(){if(b===0||(b-=1,b>0)||!d)return;const e=k();e&&d.observe(e,B)}function N(e){te();try{return e()}finally{re()}}const oe=()=>{try{const e=localStorage.getItem("rte-custom-dictionary");e&&JSON.parse(e).forEach(r=>C.add(r.toLowerCase()))}catch(e){console.warn("Failed to load custom dictionary:",e)}},le=()=>{try{const e=Array.from(C);localStorage.setItem("rte-custom-dictionary",JSON.stringify(e))}catch(e){console.warn("Failed to save custom dictionary:",e)}};function ne(e,t){const r=[];for(let l=0;l<=t.length;l++)r[l]=[l];for(let l=0;l<=e.length;l++)r[0][l]=l;for(let l=1;l<=t.length;l++)for(let o=1;o<=e.length;o++)t.charAt(l-1)===e.charAt(o-1)?r[l][o]=r[l-1][o-1]:r[l][o]=Math.min(r[l-1][o-1]+1,r[l][o-1]+1,r[l-1][o]+1);return r[t.length][e.length]}function ce(e){const t=e.toLowerCase();return j.has(t)||C.has(t)||S.has(t)}function ae(e,t=5){const r=e.toLowerCase(),o=Array.from(j).map(n=>({word:n,distance:ne(r,n)}));return o.sort((n,c)=>n.distance-c.distance),o.filter(n=>n.distance<=3).slice(0,t).map(n=>n.word)}function se(e){if(e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e;return!!(t.closest('code, pre, [contenteditable="false"], .rte-widget, .rte-template, .rte-comment, .rte-merge-tag')||t.hasAttribute("data-comment-id")||t.hasAttribute("data-template")||t.hasAttribute("data-merge-tag"))}function ie(e){const t=[],r=/([\p{L}\p{M}\p{N}\p{Emoji_Presentation}\u200d'-]+|[\uD800-\uDBFF][\uDC00-\uDFFF])/gu;let l;for(;(l=r.exec(e.data))!==null;){const o=l[0],n=l.index,c=n+o.length;/https?:\/\//.test(o)||/@/.test(o)||/\{\{.*\}\}/.test(o)||/^\d+$/.test(o)||ce(o)||/[a-z][A-Z]/.test(o)||/-/.test(o)||o[0]===o[0].toUpperCase()&&o.length>1||t.push({id:`${o}-${n}`,node:e,startOffset:n,endOffset:c,word:o,suggestions:ae(o),ignored:!1})}return t}const V=()=>{const e=P();if(e&&document.contains(e))return s=e,e;const t=window.getSelection();if(t&&t.rangeCount>0){let l=t.getRangeAt(0).startContainer;for(;l&&l!==document.body;){if(l.nodeType===Node.ELEMENT_NODE){const o=l;if(o.getAttribute("contenteditable")==="true")return o}l=l.parentNode}}const r=document.activeElement;if(r){if(r.getAttribute("contenteditable")==="true")return r;const l=r.closest('[contenteditable="true"]');if(l)return l;const o=r.closest("[data-editora-editor]");if(o){const n=o.querySelector('[contenteditable="true"]');if(n)return n}}return document.querySelector('[contenteditable="true"]')};function M(){const e=k();if(!e)return[];const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:o=>!o.textContent?.trim()||o.parentNode&&se(o.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});let l=r.nextNode();for(;l;)t.push(...ie(l)),l=r.nextNode();return t}function m(e){const t=k();t&&(e||(e=M()),N(()=>{t.querySelectorAll(".rte-misspelled").forEach(r=>{const l=r.parentNode;if(l){for(;r.firstChild;)l.insertBefore(r.firstChild,r);l.removeChild(r)}}),e.forEach(r=>{if(S.has(r.word.toLowerCase()))return;const l=r.node.data.length;if(!(r.startOffset<0||r.endOffset>l||r.startOffset>=r.endOffset))try{const o=document.createRange();o.setStart(r.node,r.startOffset),o.setEnd(r.node,r.endOffset);const n=document.createElement("span");n.className="rte-misspelled",n.setAttribute("data-word",r.word),n.setAttribute("data-suggestions",r.suggestions.join(",")),n.setAttribute("title",`Suggestions: ${r.suggestions.join(", ")}`),n.style.borderBottom="2px wavy red",n.style.cursor="pointer",o.surroundContents(n)}catch{}})}),E(e))}function L(){const e=k();e&&N(()=>{e.querySelectorAll(".rte-misspelled").forEach(t=>{const r=t.parentNode;if(r){for(;t.firstChild;)r.insertBefore(t.firstChild,t);r.removeChild(t)}})})}function de(e,t){N(()=>{const r=document.createRange();r.setStart(e.node,e.startOffset),r.setEnd(e.node,e.endOffset);const l=document.createTextNode(t);r.deleteContents(),r.insertNode(l)})}function G(e){S.add(e.toLowerCase()),L(),m()}function J(e){C.add(e.toLowerCase()),le(),L(),m()}function pe(e){const t=k();if(!t)return{total:0,misspelled:0,accuracy:100};e||(e=M());const r=e.filter(c=>!S.has(c.word.toLowerCase())).length,n=((t.textContent||"").match(/[\p{L}\p{M}\p{N}]+/gu)||[]).length;return{total:n,misspelled:r,accuracy:n>0?(n-r)/n*100:100}}function he(e,t){const r=document.createTextNode(t);e.replaceWith(r)}function ue(e){e.classList.remove("rte-misspelled"),e.removeAttribute("data-word"),e.removeAttribute("data-suggestions"),e.removeAttribute("title"),e.style.borderBottom="",e.style.cursor=""}function me(e,t,r,l,o){W(o),document.querySelectorAll(".rte-spellcheck-menu").forEach(p=>p.remove());const n=document.createElement("div");if(n.className="rte-spellcheck-menu",l.slice(0,5).forEach(p=>{const v=document.createElement("div");v.className="rte-spellcheck-menu-item",v.textContent=p,v.onclick=()=>{he(o,p),window.setTimeout(()=>{u&&(m(),E())},0),n.remove()},n.appendChild(v)}),l.length>0){const p=document.createElement("div");p.style.cssText="height: 1px; background: #ddd; margin: 4px 0;",n.appendChild(p)}const c=document.createElement("div");c.className="rte-spellcheck-menu-item meta",c.textContent="Ignore Once",c.onclick=()=>{ue(o),n.remove()},n.appendChild(c);const i=document.createElement("div");i.className="rte-spellcheck-menu-item meta",i.textContent="Ignore All",i.onclick=()=>{G(r),n.remove()},n.appendChild(i);const w=document.createElement("div");w.className="rte-spellcheck-menu-item positive",w.textContent="Add to Dictionary",w.onclick=()=>{J(r),n.remove()},n.appendChild(w),document.body.appendChild(n);const D=n.getBoundingClientRect(),X=window.innerWidth-D.width-8,Z=window.innerHeight-D.height-8;n.style.left=`${Math.max(8,Math.min(e,X))}px`,n.style.top=`${Math.max(8,Math.min(t,Z))}px`;const F=p=>{n.contains(p.target)||(n.remove(),document.removeEventListener("mousedown",F))};setTimeout(()=>document.addEventListener("mousedown",F),0)}function I(){y||(x=e=>{const t=e.target;if(t&&t.classList.contains("rte-misspelled")){e.preventDefault(),W(t);const r=t.getAttribute("data-word"),l=(t.getAttribute("data-suggestions")||"").split(",").filter(o=>o);me(e.clientX,e.clientY,r,l,t)}},document.addEventListener("contextmenu",x),y=!0)}function ke(){!y||!x||(document.removeEventListener("contextmenu",x),x=null,y=!1)}function fe(e){return e.closest("[data-editora-editor]")||e.parentElement||e}function q(){const e=k();if(!e)throw new Error("Spell check panel requested without active editor");const t=fe(e);T();const r=document.createElement("div");return r.className="rte-spell-check-panel",window.getComputedStyle(t).position==="static"&&(t.style.position="relative"),t.appendChild(r),r}function E(e){if(!a)return;const t=e||M(),r=pe(t);a.innerHTML=`
|
|
470
470
|
<div class="rte-spellcheck-header">
|
|
471
471
|
<div>
|
|
472
472
|
<h3 class="rte-spellcheck-title">Spell Check</h3>
|
|
@@ -478,28 +478,28 @@
|
|
|
478
478
|
<div class="rte-spellcheck-stats">
|
|
479
479
|
<div class="rte-spellcheck-stat">
|
|
480
480
|
<span class="rte-spellcheck-stat-label">Total</span>
|
|
481
|
-
<strong class="rte-spellcheck-stat-value">${
|
|
481
|
+
<strong class="rte-spellcheck-stat-value">${r.total}</strong>
|
|
482
482
|
</div>
|
|
483
483
|
<div class="rte-spellcheck-stat">
|
|
484
484
|
<span class="rte-spellcheck-stat-label">Misspelled</span>
|
|
485
|
-
<strong class="rte-spellcheck-stat-value">${
|
|
485
|
+
<strong class="rte-spellcheck-stat-value">${r.misspelled}</strong>
|
|
486
486
|
</div>
|
|
487
487
|
<div class="rte-spellcheck-stat">
|
|
488
488
|
<span class="rte-spellcheck-stat-label">Accuracy</span>
|
|
489
|
-
<strong class="rte-spellcheck-stat-value">${
|
|
489
|
+
<strong class="rte-spellcheck-stat-value">${r.accuracy.toFixed(1)}%</strong>
|
|
490
490
|
</div>
|
|
491
491
|
</div>
|
|
492
492
|
|
|
493
493
|
<div class="rte-spellcheck-list">
|
|
494
|
-
${
|
|
495
|
-
<div class="rte-spellcheck-item" data-word="${o.word}" data-index="${
|
|
494
|
+
${t.length===0?'<div class="rte-spellcheck-empty">No spelling errors found in this editor.</div>':t.map((o,n)=>`
|
|
495
|
+
<div class="rte-spellcheck-item" data-word="${o.word}" data-index="${n}">
|
|
496
496
|
<button class="rte-spellcheck-word-header" type="button">
|
|
497
497
|
<span class="rte-spellcheck-word">${o.word}</span>
|
|
498
498
|
<span class="rte-spellcheck-caret">▶</span>
|
|
499
499
|
</button>
|
|
500
500
|
<div class="rte-spellcheck-suggestions">
|
|
501
501
|
${o.suggestions.length>0?`<div class="rte-spellcheck-actions">
|
|
502
|
-
${o.suggestions.map(
|
|
502
|
+
${o.suggestions.map(c=>`<button class="rte-spellcheck-btn primary suggestion-btn" data-suggestion="${c}" type="button">${c}</button>`).join("")}
|
|
503
503
|
</div>`:'<div class="rte-spellcheck-subtitle">No suggestions available</div>'}
|
|
504
504
|
<div class="rte-spellcheck-actions">
|
|
505
505
|
<button class="rte-spellcheck-btn ignore-btn" type="button">Ignore</button>
|
|
@@ -509,4 +509,4 @@
|
|
|
509
509
|
</div>
|
|
510
510
|
`).join("")}
|
|
511
511
|
</div>
|
|
512
|
-
`,a.querySelector(".rte-spellcheck-close")?.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),
|
|
512
|
+
`,a.querySelector(".rte-spellcheck-close")?.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),O()}),a.querySelectorAll(".rte-spellcheck-word-header").forEach(o=>{o.addEventListener("click",()=>{const c=o.closest(".rte-spellcheck-item")?.querySelector(".rte-spellcheck-suggestions"),i=o.querySelector(".rte-spellcheck-caret");c&&i&&(c.classList.contains("show")?(c.classList.remove("show"),i.textContent="▶"):(c.classList.add("show"),i.textContent="▼"))})}),a.querySelectorAll(".suggestion-btn").forEach(o=>{o.addEventListener("click",()=>{const n=o.getAttribute("data-suggestion"),c=o.closest(".rte-spellcheck-item");c?.getAttribute("data-word");const i=parseInt(c?.getAttribute("data-index")||"0");t[i]&&(de(t[i],n),m())})}),a.querySelectorAll(".ignore-btn").forEach(o=>{o.addEventListener("click",()=>{const c=o.closest(".rte-spellcheck-item")?.getAttribute("data-word");G(c)})}),a.querySelectorAll(".add-btn").forEach(o=>{o.addEventListener("click",()=>{const c=o.closest(".rte-spellcheck-item")?.getAttribute("data-word");J(c)})})}function $(){const e=k();e&&(d&&d.disconnect(),d=new MutationObserver(t=>{b>0||t.some(r=>r.type==="characterData"||r.type==="childList")&&(f&&clearTimeout(f),f=window.setTimeout(()=>{u&&m()},350))}),d.observe(e,{...B}))}function U(){d&&(d.disconnect(),d=null),f&&(clearTimeout(f),f=null)}function Y(){document.querySelectorAll(".rte-spellcheck-menu").forEach(e=>e.remove())}function z(){g||(g=e=>{e.key!=="Escape"||!u||(e.preventDefault(),e.stopPropagation(),O())},document.addEventListener("keydown",g,!0))}function be(){g&&(document.removeEventListener("keydown",g,!0),g=null)}function O(){return u&&(L(),U(),ke(),Y(),a&&(a.remove(),a=null),s=null,h=null,u=!1,be()),!1}function ge(){const e=ee();return e?u&&s&&s!==e?(L(),U(),Y(),a&&(a.remove(),a=null),s=e,T(),I(),z(),m(),$(),a=q(),E(),!0):u?O():(s=e,u=!0,T(),I(),z(),m(),$(),a&&(a.remove(),a=null),a=q(),E(),!0):!1}const xe=()=>({name:"spellCheck",init:()=>{oe(),Q()},toolbar:[{label:"Spell Check",command:"toggleSpellCheck",icon:'<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M3 12.5L3.84375 9.5M3.84375 9.5L5 5.38889C5 5.38889 5.25 4.5 6 4.5C6.75 4.5 7 5.38889 7 5.38889L8.15625 9.5M3.84375 9.5H8.15625M9 12.5L8.15625 9.5M13 16.8333L15.4615 19.5L21 13.5M12 8.5H15C16.1046 8.5 17 7.60457 17 6.5C17 5.39543 16.1046 4.5 15 4.5H12V8.5ZM12 8.5H16C17.1046 8.5 18 9.39543 18 10.5C18 11.6046 17.1046 12.5 16 12.5H12V8.5Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',shortcut:"F7"}],commands:{toggleSpellCheck:(e,t)=>(K(t),ge(),!0)},keymap:{F7:"toggleSpellCheck"}});exports.SpellCheckPlugin=xe;
|