@editora/core 1.0.9 → 1.0.10
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 +1 -1
- package/dist/{A11yCheckerPlugin.native-58d12bed.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +12 -23
- package/dist/{AnchorPlugin.native-289a112a.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +102 -112
- package/dist/{ApprovalWorkflowPlugin.native-449ce66c.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +173 -209
- package/dist/{BackgroundColorPlugin.native-8aceb5cc.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +9 -16
- package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
- package/dist/{BlocksLibraryPlugin.native-1cc51e63.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +149 -205
- package/dist/{BoldPlugin.native-f9d7f8e4.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
- package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
- package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
- package/dist/{CitationsPlugin.native-169fb1e8.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +196 -261
- package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
- package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
- package/dist/{CodeSamplePlugin.native-6cc0148e.mjs → CodeSamplePlugin.native-CgGoH-X4.mjs} +10 -19
- package/dist/{CommentsPlugin.native-03659874.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +28 -55
- package/dist/{ConditionalContentPlugin.native-4983143a.mjs → ConditionalContentPlugin.native-CfhY46rU.mjs} +51 -108
- package/dist/{ContentRulesPlugin.native-63ed405b.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +153 -200
- package/dist/{DataBindingPlugin.native-427e9d75.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +88 -124
- package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
- package/dist/{DocSchemaPlugin.native-8e41eda0.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +112 -166
- package/dist/{DocumentManagerPlugin.native-e69895ad.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +4 -4
- package/dist/EmbedIframePlugin.native-BF_-LjTq.mjs +740 -0
- package/dist/{EmojisPlugin.native-65c5ac47.mjs → EmojisPlugin.native-CitxxlWX.mjs} +6 -11
- package/dist/{FontFamilyPlugin.native-f9bc255a.mjs → FontFamilyPlugin.native-j8hMTbg4.mjs} +4 -7
- package/dist/{FontSizePlugin.native-f5647872.mjs → FontSizePlugin.native-B_jCh7dY.mjs} +10 -19
- package/dist/{FootnotePlugin.native-494657b3.mjs → FootnotePlugin.native-D730OGRm.mjs} +39 -77
- package/dist/{FullscreenPlugin.native-87ce92e9.mjs → FullscreenPlugin.native-ChXyxeNw.mjs} +1 -1
- package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
- package/dist/{HistoryPlugin.native-92ed4be4.mjs → HistoryPlugin.native-D2wl32jV.mjs} +107 -143
- package/dist/{IndentPlugin.native-e4ee902b.mjs → IndentPlugin.native-BHixp8sP.mjs} +12 -23
- package/dist/{ItalicPlugin.native-7c95cfbc.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
- package/dist/{LineHeightPlugin.native-5668f78c.mjs → LineHeightPlugin.native-CM7iXdQj.mjs} +10 -19
- package/dist/{LinkPlugin.native-6df29111.mjs → LinkPlugin.native-DYCIcdTm.mjs} +5 -9
- package/dist/{ListPlugin.native-fe2e115a.mjs → ListPlugin.native-V7EZC1lM.mjs} +5 -9
- package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
- package/dist/{MediaManagerPlugin.native-3cf48a00.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +11 -21
- package/dist/{MentionPlugin.native-3b1e8c05.mjs → MentionPlugin.native-BMDlOqur.mjs} +45 -89
- package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
- package/dist/{PIIRedactionPlugin.native-7ab10b9f.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +210 -260
- package/dist/{PageBreakPlugin.native-1794c5fb.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +16 -31
- package/dist/{PreviewPlugin.native-f7b67cc0.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +6 -11
- package/dist/{PrintPlugin.native-f6a168c2.mjs → PrintPlugin.native-7qt5v7L5.mjs} +3 -5
- package/dist/{SlashCommandsPlugin.native-8d45e511.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +36 -71
- package/dist/{SmartPastePlugin.native-a6c5efec.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +173 -219
- package/dist/{SpecialCharactersPlugin.native-7f06d4ba.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +101 -85
- package/dist/{SpellCheckPlugin.native-04e20834.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +21 -41
- package/dist/{StrikethroughPlugin.native-905e9501.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -30
- package/dist/{TablePlugin.native-7d5458c1.mjs → TablePlugin.native-DrHX-efe.mjs} +30 -58
- package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
- package/dist/{TextAlignmentPlugin.native-9357b3ed.mjs → TextAlignmentPlugin.native-sM_1s00t.mjs} +6 -11
- package/dist/{TextColorPlugin.native-d53ed459.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +14 -26
- package/dist/{TrackChangesPlugin.native-e96da509.mjs → TrackChangesPlugin.native-Bghu2q4a.mjs} +58 -115
- package/dist/{TranslationWorkflowPlugin.native-4e711b1e.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +191 -257
- package/dist/{UnderlinePlugin.native-8080c998.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
- package/dist/{VersionDiffPlugin.native-5bbeff85.mjs → VersionDiffPlugin.native-Bvxgy--t.mjs} +26 -51
- package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
- package/dist/{anchoredPopover-5cca53ba.mjs → anchoredPopover-Bxds0VoB.mjs} +1 -1
- package/dist/core.css +1 -0
- package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
- package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +2 -3
- package/dist/editora.min.js +13 -14
- package/dist/editora.umd.js +13 -14
- package/dist/{html2canvas.esm-c51cb3b9.mjs → html2canvas.esm-AYkPY5LS.mjs} +894 -978
- package/dist/index-BslAFzmv.mjs +16544 -0
- package/dist/index-CPMGUZfB.js +10 -0
- package/dist/{index-7da30697.mjs → index-DBoj6QfW.mjs} +127 -164
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-BYD2KEo6.mjs +6666 -0
- package/dist/index.esm.js +7 -12
- package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
- package/dist/{jspdf.es.min-780c82db.mjs → jspdf.es.min-BJGtOnRT.mjs} +3784 -4808
- package/dist/plugin-loader.js +67 -67
- package/dist/{purify.es-3bdbcfc5.mjs → purify.es-CKpwg8Tk.mjs} +10 -20
- package/dist/webcomponent-core.js +131 -168
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +139 -63
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +191 -228
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1240 -1344
- package/package.json +1 -1
- package/dist/BlockquotePlugin.native-3541c714.mjs +0 -49
- package/dist/CapitalizationPlugin.native-42c135dc.mjs +0 -80
- package/dist/ChecklistPlugin.native-3b397ee9.mjs +0 -330
- package/dist/ClearFormattingPlugin.native-77baa514.mjs +0 -145
- package/dist/CodePlugin.native-989cf0aa.mjs +0 -2740
- package/dist/DirectionPlugin.native-4e742f42.mjs +0 -139
- package/dist/EmbedIframePlugin.native-55209c87.mjs +0 -568
- package/dist/HeadingPlugin.native-e38c4a16.mjs +0 -64
- package/dist/MathPlugin.native-735bbac2.mjs +0 -296
- package/dist/MergeTagPlugin.native-31cf7d48.mjs +0 -584
- package/dist/TemplatePlugin.native-580f0f63.mjs +0 -617
- package/dist/_commonjsHelpers-69d58be2.mjs +0 -31
- package/dist/documentManager-8327fb6e.mjs +0 -9166
- package/dist/index-072ef022.js +0 -11
- package/dist/index-49d31221.mjs +0 -16860
- package/dist/index.es-b47a189f.mjs +0 -5782
- package/dist/style.css +0 -1
package/package.json
CHANGED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
const c = () => ({
|
|
2
|
-
name: "blockquote",
|
|
3
|
-
// Schema definition for blockquote node
|
|
4
|
-
nodes: {
|
|
5
|
-
blockquote: {
|
|
6
|
-
content: "block+",
|
|
7
|
-
group: "block",
|
|
8
|
-
parseDOM: [{ tag: "blockquote" }],
|
|
9
|
-
toDOM: () => ["blockquote", 0]
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
// Toolbar button configuration
|
|
13
|
-
toolbar: [
|
|
14
|
-
{
|
|
15
|
-
label: "Quote",
|
|
16
|
-
command: "toggleBlockquote",
|
|
17
|
-
icon: '<svg fill="#000000" height="24px" width="24px" version="1.1" id="Icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" xml:space="preserve"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <path d="M13,11c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5s-2.2-5-5-5c-0.3,0-0.7,0-1,0.1 C9.3,11.8,11,11,13,11z"></path> <path d="M23,13c-0.3,0-0.7,0-1,0.1c1.3-1.3,3-2.1,5-2.1c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5 S25.8,13,23,13z"></path> </g> </g></svg>',
|
|
18
|
-
shortcut: "Mod-Shift-9"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
// Native command implementations
|
|
22
|
-
commands: {
|
|
23
|
-
/**
|
|
24
|
-
* Toggle blockquote formatting on current selection
|
|
25
|
-
*/
|
|
26
|
-
toggleBlockquote: () => {
|
|
27
|
-
const e = window.getSelection();
|
|
28
|
-
if (!e || e.rangeCount === 0)
|
|
29
|
-
return !1;
|
|
30
|
-
let o = e.anchorNode, t = !1;
|
|
31
|
-
for (; o && o !== document.body; ) {
|
|
32
|
-
if (o.nodeName === "BLOCKQUOTE") {
|
|
33
|
-
t = !0;
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
o = o.parentNode;
|
|
37
|
-
}
|
|
38
|
-
return t ? document.execCommand("formatBlock", !1, "p") : document.execCommand("formatBlock", !1, "blockquote"), !0;
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
// Keyboard shortcuts
|
|
42
|
-
keymap: {
|
|
43
|
-
"Mod-Shift-9": "toggleBlockquote"
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
export {
|
|
47
|
-
c as BlockquotePlugin
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=BlockquotePlugin.native-3541c714.mjs.map
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
const i = () => {
|
|
2
|
-
const o = () => {
|
|
3
|
-
try {
|
|
4
|
-
const e = window.getSelection();
|
|
5
|
-
if (e && e.rangeCount > 0 && !e.isCollapsed) {
|
|
6
|
-
const t = e.getRangeAt(0), r = t.toString().toUpperCase();
|
|
7
|
-
return t.deleteContents(), t.insertNode(document.createTextNode(r)), !0;
|
|
8
|
-
}
|
|
9
|
-
return !1;
|
|
10
|
-
} catch (e) {
|
|
11
|
-
return console.error("Failed to convert to uppercase:", e), !1;
|
|
12
|
-
}
|
|
13
|
-
}, a = () => {
|
|
14
|
-
try {
|
|
15
|
-
const e = window.getSelection();
|
|
16
|
-
if (e && e.rangeCount > 0 && !e.isCollapsed) {
|
|
17
|
-
const t = e.getRangeAt(0), r = t.toString().toLowerCase();
|
|
18
|
-
return t.deleteContents(), t.insertNode(document.createTextNode(r)), !0;
|
|
19
|
-
}
|
|
20
|
-
return !1;
|
|
21
|
-
} catch (e) {
|
|
22
|
-
return console.error("Failed to convert to lowercase:", e), !1;
|
|
23
|
-
}
|
|
24
|
-
}, n = () => {
|
|
25
|
-
try {
|
|
26
|
-
const e = window.getSelection();
|
|
27
|
-
if (e && e.rangeCount > 0 && !e.isCollapsed) {
|
|
28
|
-
const t = e.getRangeAt(0), r = t.toString().replace(/\w\S*/g, (l) => l.charAt(0).toUpperCase() + l.substr(1).toLowerCase());
|
|
29
|
-
return t.deleteContents(), t.insertNode(document.createTextNode(r)), !0;
|
|
30
|
-
}
|
|
31
|
-
return !1;
|
|
32
|
-
} catch (e) {
|
|
33
|
-
return console.error("Failed to convert to title case:", e), !1;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
return {
|
|
37
|
-
name: "capitalization",
|
|
38
|
-
toolbar: [
|
|
39
|
-
{
|
|
40
|
-
label: "Capitalization",
|
|
41
|
-
command: "setCapitalization",
|
|
42
|
-
type: "inline-menu",
|
|
43
|
-
options: [
|
|
44
|
-
{ label: "lowercase", value: "lowercase" },
|
|
45
|
-
{ label: "UPPERCASE", value: "uppercase" },
|
|
46
|
-
{ label: "Title Case", value: "titlecase" }
|
|
47
|
-
],
|
|
48
|
-
icon: '<svg fill="#000000" width="24" height="24" viewBox="0 0 32.00 32.00" id="icon" 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" stroke="#CCCCCC" stroke-width="0.192"></g><g id="SVGRepo_iconCarrier"><defs><style>.cls-1{fill:none;}</style></defs><title>letter--Aa</title><path d="M23,13H18v2h5v2H19a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V15A2,2,0,0,0,23,13Zm0,8H19V19h4Z"></path><path d="M13,9H9a2,2,0,0,0-2,2V23H9V18h4v5h2V11A2,2,0,0,0,13,9ZM9,16V11h4v5Z"></path><rect id="_Transparent_Rectangle_" data-name="<Transparent Rectangle>" class="cls-1" width="32" height="32"></rect></g></svg>'
|
|
49
|
-
}
|
|
50
|
-
],
|
|
51
|
-
commands: {
|
|
52
|
-
setCapitalization: (e) => {
|
|
53
|
-
if (!e)
|
|
54
|
-
return !1;
|
|
55
|
-
switch (e) {
|
|
56
|
-
case "uppercase":
|
|
57
|
-
return o();
|
|
58
|
-
case "lowercase":
|
|
59
|
-
return a();
|
|
60
|
-
case "titlecase":
|
|
61
|
-
return n();
|
|
62
|
-
default:
|
|
63
|
-
return !1;
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
toUpperCase: o,
|
|
67
|
-
toLowerCase: a,
|
|
68
|
-
toTitleCase: n
|
|
69
|
-
},
|
|
70
|
-
keymap: {
|
|
71
|
-
"Mod-Shift-u": "toUpperCase",
|
|
72
|
-
"Mod-Shift-k": "toLowerCase",
|
|
73
|
-
"Mod-Shift-t": "toTitleCase"
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
export {
|
|
78
|
-
i as CapitalizationPlugin
|
|
79
|
-
};
|
|
80
|
-
//# sourceMappingURL=CapitalizationPlugin.native-42c135dc.mjs.map
|
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
const N = "__editoraCommandEditorRoot", w = (t) => {
|
|
2
|
-
if (!t)
|
|
3
|
-
return null;
|
|
4
|
-
const e = t.querySelector('[contenteditable="true"]');
|
|
5
|
-
return e instanceof HTMLElement ? e : null;
|
|
6
|
-
}, A = () => {
|
|
7
|
-
if (typeof window == "undefined")
|
|
8
|
-
return null;
|
|
9
|
-
const t = window[N];
|
|
10
|
-
if (!(t instanceof HTMLElement))
|
|
11
|
-
return null;
|
|
12
|
-
window[N] = null;
|
|
13
|
-
const e = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null);
|
|
14
|
-
if (e) {
|
|
15
|
-
const n = w(e);
|
|
16
|
-
if (n)
|
|
17
|
-
return n;
|
|
18
|
-
if (e.getAttribute("contenteditable") === "true")
|
|
19
|
-
return e;
|
|
20
|
-
}
|
|
21
|
-
if (t.getAttribute("contenteditable") === "true")
|
|
22
|
-
return t;
|
|
23
|
-
const r = t.closest('[contenteditable="true"]');
|
|
24
|
-
return r instanceof HTMLElement ? r : null;
|
|
25
|
-
}, _ = () => {
|
|
26
|
-
const t = A();
|
|
27
|
-
if (t && document.contains(t))
|
|
28
|
-
return t;
|
|
29
|
-
const e = window.getSelection();
|
|
30
|
-
if (e && e.rangeCount > 0) {
|
|
31
|
-
let n = e.getRangeAt(0).startContainer;
|
|
32
|
-
for (; n && n !== document.body; ) {
|
|
33
|
-
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
34
|
-
const o = n;
|
|
35
|
-
if (o.getAttribute("contenteditable") === "true")
|
|
36
|
-
return o;
|
|
37
|
-
}
|
|
38
|
-
n = n.parentNode;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
const r = document.activeElement;
|
|
42
|
-
if (r) {
|
|
43
|
-
if (r.getAttribute("contenteditable") === "true")
|
|
44
|
-
return r;
|
|
45
|
-
const n = r.closest('[contenteditable="true"]');
|
|
46
|
-
if (n)
|
|
47
|
-
return n;
|
|
48
|
-
}
|
|
49
|
-
return document.querySelector('[contenteditable="true"]');
|
|
50
|
-
}, H = (t) => t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null, S = (t) => {
|
|
51
|
-
const e = window.getSelection();
|
|
52
|
-
if (!e || e.rangeCount === 0)
|
|
53
|
-
return null;
|
|
54
|
-
const r = e.getRangeAt(0);
|
|
55
|
-
return t.contains(r.commonAncestorContainer) ? r : null;
|
|
56
|
-
}, y = (t) => {
|
|
57
|
-
t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
58
|
-
}, M = (t, e) => {
|
|
59
|
-
if (e === t.innerHTML)
|
|
60
|
-
return;
|
|
61
|
-
const r = window.execEditorCommand || window.executeEditorCommand;
|
|
62
|
-
if (typeof r == "function")
|
|
63
|
-
try {
|
|
64
|
-
r("recordDomTransaction", t, e, t.innerHTML);
|
|
65
|
-
} catch (n) {
|
|
66
|
-
}
|
|
67
|
-
}, k = (t, e) => {
|
|
68
|
-
if (!t.isConnected) {
|
|
69
|
-
e.focus({ preventScroll: !0 });
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const r = window.getSelection();
|
|
73
|
-
if (!r)
|
|
74
|
-
return;
|
|
75
|
-
const n = document.createRange();
|
|
76
|
-
n.selectNodeContents(t), n.collapse(!1), r.removeAllRanges();
|
|
77
|
-
try {
|
|
78
|
-
r.addRange(n);
|
|
79
|
-
} catch (o) {
|
|
80
|
-
e.focus({ preventScroll: !0 });
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
e.focus({ preventScroll: !0 });
|
|
84
|
-
}, I = (t) => {
|
|
85
|
-
let e = t.querySelector(":scope > p");
|
|
86
|
-
if (!e) {
|
|
87
|
-
e = document.createElement("p");
|
|
88
|
-
const r = [];
|
|
89
|
-
t.childNodes.forEach((n) => {
|
|
90
|
-
n.nodeType === Node.ELEMENT_NODE && ["UL", "OL"].includes(n.tagName) || r.push(n);
|
|
91
|
-
}), r.forEach((n) => e.appendChild(n)), t.insertBefore(e, t.firstChild);
|
|
92
|
-
}
|
|
93
|
-
return e.innerHTML.trim() || (e.innerHTML = "<br>"), e;
|
|
94
|
-
}, C = (t) => {
|
|
95
|
-
const e = document.createElement("li");
|
|
96
|
-
e.setAttribute("data-type", "checklist-item"), e.setAttribute("data-checked", "false");
|
|
97
|
-
const r = document.createElement("p");
|
|
98
|
-
return r.innerHTML = t.trim() || "<br>", e.appendChild(r), e;
|
|
99
|
-
}, T = (t) => Array.from(t.children).filter(
|
|
100
|
-
(e) => e instanceof HTMLLIElement
|
|
101
|
-
), R = /* @__PURE__ */ new Set([
|
|
102
|
-
"P",
|
|
103
|
-
"DIV",
|
|
104
|
-
"H1",
|
|
105
|
-
"H2",
|
|
106
|
-
"H3",
|
|
107
|
-
"H4",
|
|
108
|
-
"H5",
|
|
109
|
-
"H6",
|
|
110
|
-
"BLOCKQUOTE",
|
|
111
|
-
"PRE",
|
|
112
|
-
"LI"
|
|
113
|
-
]), b = (t) => R.has(t.tagName) && t.getAttribute("contenteditable") !== "true", v = (t, e) => {
|
|
114
|
-
const r = [], n = /* @__PURE__ */ new Set(), o = (a) => {
|
|
115
|
-
!a || n.has(a) || e.contains(a) && b(a) && (a.closest("ul, ol") || (n.add(a), r.push(a)));
|
|
116
|
-
}, u = (a) => {
|
|
117
|
-
let l = a;
|
|
118
|
-
for (; l && l !== document.body; ) {
|
|
119
|
-
if (l.nodeType === Node.ELEMENT_NODE) {
|
|
120
|
-
const h = l;
|
|
121
|
-
if (b(h))
|
|
122
|
-
return h;
|
|
123
|
-
if (h.getAttribute("contenteditable") === "true")
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
l = l.parentNode;
|
|
127
|
-
}
|
|
128
|
-
return null;
|
|
129
|
-
};
|
|
130
|
-
if (t.collapsed)
|
|
131
|
-
return o(u(t.startContainer)), r;
|
|
132
|
-
const d = document.createTreeWalker(
|
|
133
|
-
e,
|
|
134
|
-
NodeFilter.SHOW_ELEMENT,
|
|
135
|
-
{
|
|
136
|
-
acceptNode: (a) => {
|
|
137
|
-
const l = a;
|
|
138
|
-
if (!b(l) || l.closest("ul, ol"))
|
|
139
|
-
return NodeFilter.FILTER_SKIP;
|
|
140
|
-
if (typeof t.intersectsNode == "function")
|
|
141
|
-
return t.intersectsNode(l) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
142
|
-
const h = document.createRange();
|
|
143
|
-
return h.selectNodeContents(l), t.compareBoundaryPoints(Range.END_TO_START, h) > 0 && t.compareBoundaryPoints(Range.START_TO_END, h) < 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
let i = d.nextNode();
|
|
148
|
-
for (; i; )
|
|
149
|
-
o(i), i = d.nextNode();
|
|
150
|
-
if (r.length === 0 && o(u(t.commonAncestorContainer)), r.length <= 1)
|
|
151
|
-
return r;
|
|
152
|
-
const m = r.filter((a) => !r.some((l) => l !== a && a.contains(l)));
|
|
153
|
-
return m.length > 0 ? m : r;
|
|
154
|
-
}, O = (t) => {
|
|
155
|
-
const e = [], r = document.createElement("div"), n = () => {
|
|
156
|
-
const o = r.innerHTML.trim();
|
|
157
|
-
if (!o)
|
|
158
|
-
return;
|
|
159
|
-
const u = document.createElement("p");
|
|
160
|
-
u.innerHTML = o, e.push(u), r.innerHTML = "";
|
|
161
|
-
};
|
|
162
|
-
if (t.childNodes.forEach((o) => {
|
|
163
|
-
if (o.nodeType === Node.ELEMENT_NODE && ["UL", "OL"].includes(o.tagName)) {
|
|
164
|
-
n();
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
if (o.nodeType === Node.ELEMENT_NODE && o.tagName === "P") {
|
|
168
|
-
n();
|
|
169
|
-
const u = o.innerHTML.trim(), d = document.createElement("p");
|
|
170
|
-
d.innerHTML = u || "<br>", e.push(d);
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
o.nodeType === Node.TEXT_NODE && !(o.textContent || "").trim() || r.appendChild(o.cloneNode(!0));
|
|
174
|
-
}), n(), e.length === 0) {
|
|
175
|
-
const o = document.createElement("p");
|
|
176
|
-
o.innerHTML = "<br>", e.push(o);
|
|
177
|
-
}
|
|
178
|
-
return e;
|
|
179
|
-
}, D = () => ({
|
|
180
|
-
name: "checklist",
|
|
181
|
-
// Initialize click handler when plugin is loaded
|
|
182
|
-
init: () => {
|
|
183
|
-
if (typeof document == "undefined" || typeof window == "undefined" || window.__checklistPluginClickInitialized)
|
|
184
|
-
return;
|
|
185
|
-
window.__checklistPluginClickInitialized = !0;
|
|
186
|
-
const t = (e) => {
|
|
187
|
-
const n = e.target.closest('li[data-type="checklist-item"]');
|
|
188
|
-
if (!n)
|
|
189
|
-
return;
|
|
190
|
-
const o = n.getBoundingClientRect();
|
|
191
|
-
if (!(e.clientX - o.left < 32))
|
|
192
|
-
return;
|
|
193
|
-
e.preventDefault(), e.stopPropagation();
|
|
194
|
-
const i = n.closest("[contenteditable], .rte-content, .editora-content");
|
|
195
|
-
if ((i == null ? void 0 : i.getAttribute("contenteditable")) === "false" || !!(i != null && i.closest('[data-readonly="true"], .editora-editor[readonly], editora-editor[readonly]')))
|
|
196
|
-
return;
|
|
197
|
-
const a = (i == null ? void 0 : i.innerHTML) || "", l = n.getAttribute("data-checked") === "true";
|
|
198
|
-
n.setAttribute("data-checked", (!l).toString()), i && (M(i, a), y(i));
|
|
199
|
-
};
|
|
200
|
-
document.addEventListener("click", t);
|
|
201
|
-
},
|
|
202
|
-
// Schema definition for checklist nodes
|
|
203
|
-
nodes: {
|
|
204
|
-
checklist: {
|
|
205
|
-
content: "checklistItem+",
|
|
206
|
-
group: "block",
|
|
207
|
-
parseDOM: [{ tag: 'ul[data-type="checklist"]' }],
|
|
208
|
-
toDOM: () => ["ul", { "data-type": "checklist" }, 0]
|
|
209
|
-
},
|
|
210
|
-
checklistItem: {
|
|
211
|
-
content: "paragraph",
|
|
212
|
-
attrs: {
|
|
213
|
-
checked: { default: !1 }
|
|
214
|
-
},
|
|
215
|
-
parseDOM: [
|
|
216
|
-
{
|
|
217
|
-
tag: 'li[data-type="checklist-item"]',
|
|
218
|
-
getAttrs: (t) => ({
|
|
219
|
-
checked: t.getAttribute("data-checked") === "true"
|
|
220
|
-
})
|
|
221
|
-
}
|
|
222
|
-
],
|
|
223
|
-
toDOM: (t) => {
|
|
224
|
-
var e;
|
|
225
|
-
return [
|
|
226
|
-
"li",
|
|
227
|
-
{
|
|
228
|
-
"data-type": "checklist-item",
|
|
229
|
-
"data-checked": (e = t == null ? void 0 : t.attrs) != null && e.checked ? "true" : "false"
|
|
230
|
-
},
|
|
231
|
-
0
|
|
232
|
-
];
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
toolbar: [
|
|
237
|
-
{
|
|
238
|
-
label: "Checklist",
|
|
239
|
-
command: "toggleChecklist",
|
|
240
|
-
icon: '<svg width="24px" height="24px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.75 4.48h-.71L2 3.43l.71-.7.69.68L4.81 2l.71.71-1.77 1.77zM6.99 3h8v1h-8V3zm0 3h8v1h-8V6zm8 3h-8v1h8V9zm-8 3h8v1h-8v-1zM3.04 7.48h.71l1.77-1.77-.71-.7L3.4 6.42l-.69-.69-.71.71 1.04 1.04zm.71 3.01h-.71L2 9.45l.71-.71.69.69 1.41-1.42.71.71-1.77 1.77zm-.71 3.01h.71l1.77-1.77-.71-.71-1.41 1.42-.69-.69-.71.7 1.04 1.05z"></path></g></svg>',
|
|
241
|
-
shortcut: "Mod-Shift-9"
|
|
242
|
-
}
|
|
243
|
-
],
|
|
244
|
-
commands: {
|
|
245
|
-
toggleChecklist: () => {
|
|
246
|
-
try {
|
|
247
|
-
const t = _();
|
|
248
|
-
if (!t)
|
|
249
|
-
return !1;
|
|
250
|
-
const e = t.innerHTML, r = () => (M(t, e), y(t), !0), n = S(t);
|
|
251
|
-
if (!n)
|
|
252
|
-
return !1;
|
|
253
|
-
const o = H(n.startContainer);
|
|
254
|
-
if (!o)
|
|
255
|
-
return !1;
|
|
256
|
-
const u = o.closest('ul[data-type="checklist"]');
|
|
257
|
-
if (u && t.contains(u)) {
|
|
258
|
-
const c = T(u);
|
|
259
|
-
if (c.length === 0)
|
|
260
|
-
return !1;
|
|
261
|
-
const p = document.createDocumentFragment();
|
|
262
|
-
let s = null;
|
|
263
|
-
return c.forEach((f, g) => {
|
|
264
|
-
const E = O(f);
|
|
265
|
-
E.forEach((L) => {
|
|
266
|
-
p.appendChild(L), !s && (f.contains(n.startContainer) || g === 0) && (s = L);
|
|
267
|
-
}), !s && g === 0 && E[0] && (s = E[0]);
|
|
268
|
-
}), u.replaceWith(p), s && k(s, t), r();
|
|
269
|
-
}
|
|
270
|
-
const d = o.closest("ul, ol");
|
|
271
|
-
if (d && t.contains(d)) {
|
|
272
|
-
let c;
|
|
273
|
-
if (d.tagName.toLowerCase() === "ul")
|
|
274
|
-
c = d;
|
|
275
|
-
else {
|
|
276
|
-
for (c = document.createElement("ul"); d.firstChild; )
|
|
277
|
-
c.appendChild(d.firstChild);
|
|
278
|
-
d.replaceWith(c);
|
|
279
|
-
}
|
|
280
|
-
c.setAttribute("data-type", "checklist");
|
|
281
|
-
let p = T(c);
|
|
282
|
-
p.length === 0 && (c.appendChild(C("")), p = T(c));
|
|
283
|
-
let s = null;
|
|
284
|
-
p.forEach((g) => {
|
|
285
|
-
g.setAttribute("data-type", "checklist-item"), g.hasAttribute("data-checked") || g.setAttribute("data-checked", "false");
|
|
286
|
-
const E = I(g);
|
|
287
|
-
g.contains(n.startContainer) && (s = E);
|
|
288
|
-
});
|
|
289
|
-
const f = c.querySelector(':scope > li[data-type="checklist-item"] > p');
|
|
290
|
-
return k(s || f || c, t), r();
|
|
291
|
-
}
|
|
292
|
-
const i = v(n, t);
|
|
293
|
-
if (i.length > 1) {
|
|
294
|
-
const c = document.createElement("ul");
|
|
295
|
-
c.setAttribute("data-type", "checklist"), i.forEach((f) => {
|
|
296
|
-
c.appendChild(C(f.innerHTML));
|
|
297
|
-
}), i[0].replaceWith(c), i.slice(1).forEach((f) => {
|
|
298
|
-
f.isConnected && f.remove();
|
|
299
|
-
});
|
|
300
|
-
const s = c.querySelector(':scope > li[data-type="checklist-item"] > p');
|
|
301
|
-
return s && k(s, t), r();
|
|
302
|
-
}
|
|
303
|
-
const m = i[0] || o.closest("p, h1, h2, h3, h4, h5, h6, blockquote, pre");
|
|
304
|
-
if (m && m !== t) {
|
|
305
|
-
const c = document.createElement("ul");
|
|
306
|
-
c.setAttribute("data-type", "checklist");
|
|
307
|
-
const p = C(m.innerHTML);
|
|
308
|
-
c.appendChild(p), m.replaceWith(c);
|
|
309
|
-
const s = p.querySelector(":scope > p");
|
|
310
|
-
return s && k(s, t), r();
|
|
311
|
-
}
|
|
312
|
-
const a = document.createElement("ul");
|
|
313
|
-
a.setAttribute("data-type", "checklist");
|
|
314
|
-
const l = C("");
|
|
315
|
-
a.appendChild(l), n.deleteContents(), n.insertNode(a);
|
|
316
|
-
const h = l.querySelector(":scope > p");
|
|
317
|
-
return h && k(h, t), r();
|
|
318
|
-
} catch (t) {
|
|
319
|
-
return console.error("Failed to toggle checklist:", t), !1;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
},
|
|
323
|
-
keymap: {
|
|
324
|
-
"Mod-Shift-9": "toggleChecklist"
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
export {
|
|
328
|
-
D as ChecklistPlugin
|
|
329
|
-
};
|
|
330
|
-
//# sourceMappingURL=ChecklistPlugin.native-3b397ee9.mjs.map
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
const p = () => ({
|
|
2
|
-
name: "clearFormatting",
|
|
3
|
-
// Toolbar button configuration
|
|
4
|
-
toolbar: [
|
|
5
|
-
{
|
|
6
|
-
label: "Clear Formatting",
|
|
7
|
-
command: "clearFormatting",
|
|
8
|
-
icon: '<svg width="24" height="24" focusable="false"><path d="M13.2 6a1 1 0 0 1 0 .2l-2.6 10a1 1 0 0 1-1 .8h-.2a.8.8 0 0 1-.8-1l2.6-10H8a1 1 0 1 1 0-2h9a1 1 0 0 1 0 2h-3.8ZM5 18h7a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Zm13 1.5L16.5 18 15 19.5a.7.7 0 0 1-1-1l1.5-1.5-1.5-1.5a.7.7 0 0 1 1-1l1.5 1.5 1.5-1.5a.7.7 0 0 1 1 1L17.5 17l1.5 1.5a.7.7 0 0 1-1 1Z" fill-rule="evenodd"></path></svg>',
|
|
9
|
-
shortcut: "Mod-\\"
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
// Native command implementations
|
|
13
|
-
commands: {
|
|
14
|
-
/**
|
|
15
|
-
* Remove all formatting from current selection
|
|
16
|
-
*/
|
|
17
|
-
clearFormatting: () => {
|
|
18
|
-
const t = f();
|
|
19
|
-
if (!t)
|
|
20
|
-
return !1;
|
|
21
|
-
const n = window.getSelection();
|
|
22
|
-
if (!n || n.rangeCount === 0)
|
|
23
|
-
return !1;
|
|
24
|
-
const o = n.getRangeAt(0);
|
|
25
|
-
if (!t.contains(o.commonAncestorContainer))
|
|
26
|
-
return !1;
|
|
27
|
-
const e = o.cloneRange();
|
|
28
|
-
return t.focus({ preventScroll: !0 }), document.execCommand("unlink", !1), document.execCommand("removeFormat", !1), h(t, e), m(t, e), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
// Keyboard shortcuts
|
|
32
|
-
keymap: {
|
|
33
|
-
"Mod-\\": "clearFormatting"
|
|
34
|
-
}
|
|
35
|
-
}), l = /* @__PURE__ */ new Set([
|
|
36
|
-
"A",
|
|
37
|
-
"B",
|
|
38
|
-
"STRONG",
|
|
39
|
-
"I",
|
|
40
|
-
"EM",
|
|
41
|
-
"U",
|
|
42
|
-
"S",
|
|
43
|
-
"STRIKE",
|
|
44
|
-
"DEL",
|
|
45
|
-
"FONT",
|
|
46
|
-
"MARK",
|
|
47
|
-
"CODE",
|
|
48
|
-
"SUB",
|
|
49
|
-
"SUP"
|
|
50
|
-
]), u = /* @__PURE__ */ new Set([
|
|
51
|
-
"H1",
|
|
52
|
-
"H2",
|
|
53
|
-
"H3",
|
|
54
|
-
"H4",
|
|
55
|
-
"H5",
|
|
56
|
-
"H6",
|
|
57
|
-
"BLOCKQUOTE",
|
|
58
|
-
"PRE"
|
|
59
|
-
]), d = [
|
|
60
|
-
"color",
|
|
61
|
-
"background-color",
|
|
62
|
-
"font-size",
|
|
63
|
-
"font-family",
|
|
64
|
-
"font-weight",
|
|
65
|
-
"font-style",
|
|
66
|
-
"text-decoration",
|
|
67
|
-
"text-transform",
|
|
68
|
-
"line-height",
|
|
69
|
-
"letter-spacing",
|
|
70
|
-
"word-spacing",
|
|
71
|
-
"vertical-align",
|
|
72
|
-
"text-align",
|
|
73
|
-
"padding-left"
|
|
74
|
-
];
|
|
75
|
-
function f() {
|
|
76
|
-
const t = window.getSelection();
|
|
77
|
-
if (t && t.rangeCount > 0) {
|
|
78
|
-
const o = t.getRangeAt(0).startContainer, e = o.nodeType === Node.ELEMENT_NODE ? o : o.parentElement, r = e == null ? void 0 : e.closest('[contenteditable="true"], .rte-content, .editora-content');
|
|
79
|
-
if (r)
|
|
80
|
-
return r;
|
|
81
|
-
}
|
|
82
|
-
const n = document.activeElement;
|
|
83
|
-
return n ? n.getAttribute("contenteditable") === "true" ? n : n.closest('[contenteditable="true"], .rte-content, .editora-content') : null;
|
|
84
|
-
}
|
|
85
|
-
function s(t, n) {
|
|
86
|
-
try {
|
|
87
|
-
if (typeof t.intersectsNode == "function")
|
|
88
|
-
return t.intersectsNode(n);
|
|
89
|
-
} catch (e) {
|
|
90
|
-
}
|
|
91
|
-
const o = document.createRange();
|
|
92
|
-
return n.nodeType === Node.ELEMENT_NODE ? o.selectNodeContents(n) : o.selectNode(n), t.compareBoundaryPoints(Range.END_TO_START, o) > 0 && t.compareBoundaryPoints(Range.START_TO_END, o) < 0;
|
|
93
|
-
}
|
|
94
|
-
function i(t) {
|
|
95
|
-
let n = 0, o = t;
|
|
96
|
-
for (; o && o.parentNode; )
|
|
97
|
-
n += 1, o = o.parentNode;
|
|
98
|
-
return n;
|
|
99
|
-
}
|
|
100
|
-
function g(t) {
|
|
101
|
-
d.forEach((n) => {
|
|
102
|
-
t.style.removeProperty(n);
|
|
103
|
-
}), (!t.getAttribute("style") || t.style.length === 0) && t.removeAttribute("style"), t.classList.contains("rte-text-color") && t.classList.remove("rte-text-color"), t.classList.contains("rte-bg-color") && t.classList.remove("rte-bg-color"), t.classList.length === 0 && t.removeAttribute("class");
|
|
104
|
-
}
|
|
105
|
-
function c(t) {
|
|
106
|
-
const n = t.parentNode;
|
|
107
|
-
if (n) {
|
|
108
|
-
for (; t.firstChild; )
|
|
109
|
-
n.insertBefore(t.firstChild, t);
|
|
110
|
-
n.removeChild(t);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function h(t, n) {
|
|
114
|
-
Array.from(
|
|
115
|
-
t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")
|
|
116
|
-
).forEach((e) => {
|
|
117
|
-
var a;
|
|
118
|
-
if (!s(n, e) || !u.has(e.tagName))
|
|
119
|
-
return;
|
|
120
|
-
const r = document.createElement("p");
|
|
121
|
-
for (; e.firstChild; )
|
|
122
|
-
r.appendChild(e.firstChild);
|
|
123
|
-
(a = e.parentNode) == null || a.replaceChild(r, e);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
function m(t, n) {
|
|
127
|
-
const o = Array.from(
|
|
128
|
-
t.querySelectorAll(
|
|
129
|
-
"a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"
|
|
130
|
-
)
|
|
131
|
-
);
|
|
132
|
-
o.sort((e, r) => i(r) - i(e)), o.forEach((e) => {
|
|
133
|
-
if (e.isConnected && s(n, e) && !(e.getAttribute("contenteditable") === "false" || e.closest('[contenteditable="false"]'))) {
|
|
134
|
-
if (g(e), l.has(e.tagName)) {
|
|
135
|
-
c(e);
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
e.tagName === "SPAN" && e.attributes.length === 0 && c(e);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
export {
|
|
143
|
-
p as ClearFormattingPlugin
|
|
144
|
-
};
|
|
145
|
-
//# sourceMappingURL=ClearFormattingPlugin.native-77baa514.mjs.map
|