@editora/core 1.0.8 → 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.
Files changed (58) hide show
  1. package/README.md +6 -1
  2. package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +136 -133
  3. package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
  4. package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +90 -87
  5. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
  6. package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
  7. package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
  8. package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +132 -129
  9. package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
  10. package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
  11. package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +105 -102
  12. package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +49 -46
  13. package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
  14. package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +55 -52
  15. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-BF_-LjTq.mjs} +287 -115
  16. package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
  17. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-D2wl32jV.mjs} +88 -103
  18. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
  19. package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
  20. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +204 -202
  21. package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
  22. package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +158 -155
  23. package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +2 -2
  24. package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +127 -124
  25. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +100 -76
  26. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -26
  27. package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
  28. package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +104 -101
  29. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
  30. package/dist/editora.min.js +1 -1
  31. package/dist/editora.umd.js +1 -1
  32. package/dist/index-CPMGUZfB.js +10 -0
  33. package/dist/{index-DqC57IEH.mjs → index-DBoj6QfW.mjs} +17 -15
  34. package/dist/index.cjs.js +1 -1
  35. package/dist/index.esm.js +2 -2
  36. package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
  37. package/dist/plugin-loader.js +37 -37
  38. package/dist/webcomponent-core.js +18 -16
  39. package/dist/webcomponent-core.min.css +1 -1
  40. package/dist/webcomponent-core.min.js +139 -62
  41. package/dist/webcomponent.cjs.js +1 -1
  42. package/dist/webcomponent.esm.js +1 -1
  43. package/dist/webcomponent.js +50 -48
  44. package/dist/webcomponent.min.css +1 -1
  45. package/dist/webcomponent.min.js +1174 -1071
  46. package/package.json +11 -5
  47. package/LICENSE +0 -21
  48. package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +0 -48
  49. package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +0 -79
  50. package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +0 -309
  51. package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +0 -140
  52. package/dist/CodePlugin.native-DlpTPdkd.mjs +0 -2691
  53. package/dist/DirectionPlugin.native-CDnbdNyl.mjs +0 -130
  54. package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +0 -64
  55. package/dist/MathPlugin.native-f_mDp8VL.mjs +0 -292
  56. package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +0 -559
  57. package/dist/TemplatePlugin.native-CrpfKRJ8.mjs +0 -602
  58. package/dist/index-D1LOqg5C.js +0 -10
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@editora/core",
3
- "version": "1.0.8",
4
- "description": "Framework-agnostic core editor engine for Editora Rich Text Editor",
3
+ "version": "1.0.10",
4
+ "description": "Framework-agnostic rich text editor core for React and web apps, built for enterprise editing workflows.",
5
5
  "author": "Ajay Kumar <ajaykr089@gmail.com>",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -9,11 +9,17 @@
9
9
  "url": "https://github.com/ajaykr089/Editora.git",
10
10
  "directory": "packages/core"
11
11
  },
12
- "homepage": "https://editora-free.netlify.app/",
12
+ "homepage": "https://editora-ecosystem.netlify.app/",
13
13
  "bugs": {
14
14
  "url": "https://github.com/ajaykr089/Editora/issues"
15
15
  },
16
16
  "keywords": [
17
+ "react ui library",
18
+ "react component library",
19
+ "saas ui components",
20
+ "enterprise react components",
21
+ "modern design system",
22
+ "rich text editor react",
17
23
  "editor",
18
24
  "rich-text",
19
25
  "wysiwyg",
@@ -122,10 +128,10 @@
122
128
  },
123
129
  "devDependencies": {
124
130
  "typescript": "^5.0.0",
125
- "vite": "^7.3.1"
131
+ "vite": "^4.5.14"
126
132
  },
127
133
  "publishConfig": {
128
134
  "access": "public"
129
135
  },
130
- "gitHead": "80e0808ae4909de63b8e0f1dd915b06b33a8ed44"
136
+ "gitHead": "7883627e823aa99dd5ecb66a5201116df972f88b"
131
137
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Ajay Kumar
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,48 +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) return !1;
29
- let o = e.anchorNode, t = !1;
30
- for (; o && o !== document.body; ) {
31
- if (o.nodeName === "BLOCKQUOTE") {
32
- t = !0;
33
- break;
34
- }
35
- o = o.parentNode;
36
- }
37
- return t ? document.execCommand("formatBlock", !1, "p") : document.execCommand("formatBlock", !1, "blockquote"), !0;
38
- }
39
- },
40
- // Keyboard shortcuts
41
- keymap: {
42
- "Mod-Shift-9": "toggleBlockquote"
43
- }
44
- });
45
- export {
46
- c as BlockquotePlugin
47
- };
48
- //# sourceMappingURL=BlockquotePlugin.native-JFmOLsxN.mjs.map
@@ -1,79 +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="&lt;Transparent Rectangle&gt;" class="cls-1" width="32" height="32"></rect></g></svg>'
49
- }
50
- ],
51
- commands: {
52
- setCapitalization: (e) => {
53
- if (!e) return !1;
54
- switch (e) {
55
- case "uppercase":
56
- return o();
57
- case "lowercase":
58
- return a();
59
- case "titlecase":
60
- return n();
61
- default:
62
- return !1;
63
- }
64
- },
65
- toUpperCase: o,
66
- toLowerCase: a,
67
- toTitleCase: n
68
- },
69
- keymap: {
70
- "Mod-Shift-u": "toUpperCase",
71
- "Mod-Shift-k": "toLowerCase",
72
- "Mod-Shift-t": "toTitleCase"
73
- }
74
- };
75
- };
76
- export {
77
- i as CapitalizationPlugin
78
- };
79
- //# sourceMappingURL=CapitalizationPlugin.native-DOMsh5R7.mjs.map
@@ -1,309 +0,0 @@
1
- const N = "__editoraCommandEditorRoot", w = (t) => {
2
- if (!t) return null;
3
- const e = t.querySelector('[contenteditable="true"]');
4
- return e instanceof HTMLElement ? e : null;
5
- }, A = () => {
6
- if (typeof window == "undefined") return null;
7
- const t = window[N];
8
- if (!(t instanceof HTMLElement)) return null;
9
- window[N] = null;
10
- 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);
11
- if (e) {
12
- const n = w(e);
13
- if (n) return n;
14
- if (e.getAttribute("contenteditable") === "true") return e;
15
- }
16
- if (t.getAttribute("contenteditable") === "true")
17
- return t;
18
- const r = t.closest('[contenteditable="true"]');
19
- return r instanceof HTMLElement ? r : null;
20
- }, _ = () => {
21
- const t = A();
22
- if (t && document.contains(t))
23
- return t;
24
- const e = window.getSelection();
25
- if (e && e.rangeCount > 0) {
26
- let n = e.getRangeAt(0).startContainer;
27
- for (; n && n !== document.body; ) {
28
- if (n.nodeType === Node.ELEMENT_NODE) {
29
- const o = n;
30
- if (o.getAttribute("contenteditable") === "true")
31
- return o;
32
- }
33
- n = n.parentNode;
34
- }
35
- }
36
- const r = document.activeElement;
37
- if (r) {
38
- if (r.getAttribute("contenteditable") === "true")
39
- return r;
40
- const n = r.closest('[contenteditable="true"]');
41
- if (n) return n;
42
- }
43
- return document.querySelector('[contenteditable="true"]');
44
- }, H = (t) => t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null, S = (t) => {
45
- const e = window.getSelection();
46
- if (!e || e.rangeCount === 0) return null;
47
- const r = e.getRangeAt(0);
48
- return t.contains(r.commonAncestorContainer) ? r : null;
49
- }, y = (t) => {
50
- t.dispatchEvent(new Event("input", { bubbles: !0 }));
51
- }, M = (t, e) => {
52
- if (e === t.innerHTML) return;
53
- const r = window.execEditorCommand || window.executeEditorCommand;
54
- if (typeof r == "function")
55
- try {
56
- r("recordDomTransaction", t, e, t.innerHTML);
57
- } catch (n) {
58
- }
59
- }, k = (t, e) => {
60
- if (!t.isConnected) {
61
- e.focus({ preventScroll: !0 });
62
- return;
63
- }
64
- const r = window.getSelection();
65
- if (!r) return;
66
- const n = document.createRange();
67
- n.selectNodeContents(t), n.collapse(!1), r.removeAllRanges();
68
- try {
69
- r.addRange(n);
70
- } catch (o) {
71
- e.focus({ preventScroll: !0 });
72
- return;
73
- }
74
- e.focus({ preventScroll: !0 });
75
- }, I = (t) => {
76
- let e = t.querySelector(":scope > p");
77
- if (!e) {
78
- e = document.createElement("p");
79
- const r = [];
80
- t.childNodes.forEach((n) => {
81
- n.nodeType === Node.ELEMENT_NODE && ["UL", "OL"].includes(n.tagName) || r.push(n);
82
- }), r.forEach((n) => e.appendChild(n)), t.insertBefore(e, t.firstChild);
83
- }
84
- return e.innerHTML.trim() || (e.innerHTML = "<br>"), e;
85
- }, C = (t) => {
86
- const e = document.createElement("li");
87
- e.setAttribute("data-type", "checklist-item"), e.setAttribute("data-checked", "false");
88
- const r = document.createElement("p");
89
- return r.innerHTML = t.trim() || "<br>", e.appendChild(r), e;
90
- }, T = (t) => Array.from(t.children).filter(
91
- (e) => e instanceof HTMLLIElement
92
- ), R = /* @__PURE__ */ new Set([
93
- "P",
94
- "DIV",
95
- "H1",
96
- "H2",
97
- "H3",
98
- "H4",
99
- "H5",
100
- "H6",
101
- "BLOCKQUOTE",
102
- "PRE",
103
- "LI"
104
- ]), b = (t) => R.has(t.tagName) && t.getAttribute("contenteditable") !== "true", v = (t, e) => {
105
- const r = [], n = /* @__PURE__ */ new Set(), o = (a) => {
106
- !a || n.has(a) || e.contains(a) && b(a) && (a.closest("ul, ol") || (n.add(a), r.push(a)));
107
- }, u = (a) => {
108
- let l = a;
109
- for (; l && l !== document.body; ) {
110
- if (l.nodeType === Node.ELEMENT_NODE) {
111
- const h = l;
112
- if (b(h)) return h;
113
- if (h.getAttribute("contenteditable") === "true") break;
114
- }
115
- l = l.parentNode;
116
- }
117
- return null;
118
- };
119
- if (t.collapsed)
120
- return o(u(t.startContainer)), r;
121
- const d = document.createTreeWalker(
122
- e,
123
- NodeFilter.SHOW_ELEMENT,
124
- {
125
- acceptNode: (a) => {
126
- const l = a;
127
- if (!b(l) || l.closest("ul, ol")) return NodeFilter.FILTER_SKIP;
128
- if (typeof t.intersectsNode == "function")
129
- return t.intersectsNode(l) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
130
- const h = document.createRange();
131
- 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;
132
- }
133
- }
134
- );
135
- let i = d.nextNode();
136
- for (; i; )
137
- o(i), i = d.nextNode();
138
- if (r.length === 0 && o(u(t.commonAncestorContainer)), r.length <= 1)
139
- return r;
140
- const m = r.filter((a) => !r.some((l) => l !== a && a.contains(l)));
141
- return m.length > 0 ? m : r;
142
- }, O = (t) => {
143
- const e = [], r = document.createElement("div"), n = () => {
144
- const o = r.innerHTML.trim();
145
- if (!o) return;
146
- const u = document.createElement("p");
147
- u.innerHTML = o, e.push(u), r.innerHTML = "";
148
- };
149
- if (t.childNodes.forEach((o) => {
150
- if (o.nodeType === Node.ELEMENT_NODE && ["UL", "OL"].includes(o.tagName)) {
151
- n();
152
- return;
153
- }
154
- if (o.nodeType === Node.ELEMENT_NODE && o.tagName === "P") {
155
- n();
156
- const u = o.innerHTML.trim(), d = document.createElement("p");
157
- d.innerHTML = u || "<br>", e.push(d);
158
- return;
159
- }
160
- o.nodeType === Node.TEXT_NODE && !(o.textContent || "").trim() || r.appendChild(o.cloneNode(!0));
161
- }), n(), e.length === 0) {
162
- const o = document.createElement("p");
163
- o.innerHTML = "<br>", e.push(o);
164
- }
165
- return e;
166
- }, D = () => ({
167
- name: "checklist",
168
- // Initialize click handler when plugin is loaded
169
- init: () => {
170
- if (typeof document == "undefined" || typeof window == "undefined" || window.__checklistPluginClickInitialized) return;
171
- window.__checklistPluginClickInitialized = !0;
172
- const t = (e) => {
173
- const n = e.target.closest('li[data-type="checklist-item"]');
174
- if (!n) return;
175
- const o = n.getBoundingClientRect();
176
- if (!(e.clientX - o.left < 32)) return;
177
- e.preventDefault(), e.stopPropagation();
178
- const i = n.closest("[contenteditable], .rte-content, .editora-content");
179
- if ((i == null ? void 0 : i.getAttribute("contenteditable")) === "false" || !!(i != null && i.closest('[data-readonly="true"], .editora-editor[readonly], editora-editor[readonly]'))) return;
180
- const a = (i == null ? void 0 : i.innerHTML) || "", l = n.getAttribute("data-checked") === "true";
181
- n.setAttribute("data-checked", (!l).toString()), i && (M(i, a), y(i));
182
- };
183
- document.addEventListener("click", t);
184
- },
185
- // Schema definition for checklist nodes
186
- nodes: {
187
- checklist: {
188
- content: "checklistItem+",
189
- group: "block",
190
- parseDOM: [{ tag: 'ul[data-type="checklist"]' }],
191
- toDOM: () => ["ul", { "data-type": "checklist" }, 0]
192
- },
193
- checklistItem: {
194
- content: "paragraph",
195
- attrs: {
196
- checked: { default: !1 }
197
- },
198
- parseDOM: [
199
- {
200
- tag: 'li[data-type="checklist-item"]',
201
- getAttrs: (t) => ({
202
- checked: t.getAttribute("data-checked") === "true"
203
- })
204
- }
205
- ],
206
- toDOM: (t) => {
207
- var e;
208
- return [
209
- "li",
210
- {
211
- "data-type": "checklist-item",
212
- "data-checked": (e = t == null ? void 0 : t.attrs) != null && e.checked ? "true" : "false"
213
- },
214
- 0
215
- ];
216
- }
217
- }
218
- },
219
- toolbar: [
220
- {
221
- label: "Checklist",
222
- command: "toggleChecklist",
223
- 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>',
224
- shortcut: "Mod-Shift-9"
225
- }
226
- ],
227
- commands: {
228
- toggleChecklist: () => {
229
- try {
230
- const t = _();
231
- if (!t) return !1;
232
- const e = t.innerHTML, r = () => (M(t, e), y(t), !0), n = S(t);
233
- if (!n) return !1;
234
- const o = H(n.startContainer);
235
- if (!o) return !1;
236
- const u = o.closest('ul[data-type="checklist"]');
237
- if (u && t.contains(u)) {
238
- const c = T(u);
239
- if (c.length === 0) return !1;
240
- const p = document.createDocumentFragment();
241
- let s = null;
242
- return c.forEach((f, g) => {
243
- const E = O(f);
244
- E.forEach((L) => {
245
- p.appendChild(L), !s && (f.contains(n.startContainer) || g === 0) && (s = L);
246
- }), !s && g === 0 && E[0] && (s = E[0]);
247
- }), u.replaceWith(p), s && k(s, t), r();
248
- }
249
- const d = o.closest("ul, ol");
250
- if (d && t.contains(d)) {
251
- let c;
252
- if (d.tagName.toLowerCase() === "ul")
253
- c = d;
254
- else {
255
- for (c = document.createElement("ul"); d.firstChild; )
256
- c.appendChild(d.firstChild);
257
- d.replaceWith(c);
258
- }
259
- c.setAttribute("data-type", "checklist");
260
- let p = T(c);
261
- p.length === 0 && (c.appendChild(C("")), p = T(c));
262
- let s = null;
263
- p.forEach((g) => {
264
- g.setAttribute("data-type", "checklist-item"), g.hasAttribute("data-checked") || g.setAttribute("data-checked", "false");
265
- const E = I(g);
266
- g.contains(n.startContainer) && (s = E);
267
- });
268
- const f = c.querySelector(':scope > li[data-type="checklist-item"] > p');
269
- return k(s || f || c, t), r();
270
- }
271
- const i = v(n, t);
272
- if (i.length > 1) {
273
- const c = document.createElement("ul");
274
- c.setAttribute("data-type", "checklist"), i.forEach((f) => {
275
- c.appendChild(C(f.innerHTML));
276
- }), i[0].replaceWith(c), i.slice(1).forEach((f) => {
277
- f.isConnected && f.remove();
278
- });
279
- const s = c.querySelector(':scope > li[data-type="checklist-item"] > p');
280
- return s && k(s, t), r();
281
- }
282
- const m = i[0] || o.closest("p, h1, h2, h3, h4, h5, h6, blockquote, pre");
283
- if (m && m !== t) {
284
- const c = document.createElement("ul");
285
- c.setAttribute("data-type", "checklist");
286
- const p = C(m.innerHTML);
287
- c.appendChild(p), m.replaceWith(c);
288
- const s = p.querySelector(":scope > p");
289
- return s && k(s, t), r();
290
- }
291
- const a = document.createElement("ul");
292
- a.setAttribute("data-type", "checklist");
293
- const l = C("");
294
- a.appendChild(l), n.deleteContents(), n.insertNode(a);
295
- const h = l.querySelector(":scope > p");
296
- return h && k(h, t), r();
297
- } catch (t) {
298
- return console.error("Failed to toggle checklist:", t), !1;
299
- }
300
- }
301
- },
302
- keymap: {
303
- "Mod-Shift-9": "toggleChecklist"
304
- }
305
- });
306
- export {
307
- D as ChecklistPlugin
308
- };
309
- //# sourceMappingURL=ChecklistPlugin.native-nuSSEFNI.mjs.map
@@ -1,140 +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) return !1;
20
- const n = window.getSelection();
21
- if (!n || n.rangeCount === 0) return !1;
22
- const o = n.getRangeAt(0);
23
- if (!t.contains(o.commonAncestorContainer)) return !1;
24
- const e = o.cloneRange();
25
- 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;
26
- }
27
- },
28
- // Keyboard shortcuts
29
- keymap: {
30
- "Mod-\\": "clearFormatting"
31
- }
32
- }), l = /* @__PURE__ */ new Set([
33
- "A",
34
- "B",
35
- "STRONG",
36
- "I",
37
- "EM",
38
- "U",
39
- "S",
40
- "STRIKE",
41
- "DEL",
42
- "FONT",
43
- "MARK",
44
- "CODE",
45
- "SUB",
46
- "SUP"
47
- ]), u = /* @__PURE__ */ new Set([
48
- "H1",
49
- "H2",
50
- "H3",
51
- "H4",
52
- "H5",
53
- "H6",
54
- "BLOCKQUOTE",
55
- "PRE"
56
- ]), d = [
57
- "color",
58
- "background-color",
59
- "font-size",
60
- "font-family",
61
- "font-weight",
62
- "font-style",
63
- "text-decoration",
64
- "text-transform",
65
- "line-height",
66
- "letter-spacing",
67
- "word-spacing",
68
- "vertical-align",
69
- "text-align",
70
- "padding-left"
71
- ];
72
- function f() {
73
- const t = window.getSelection();
74
- if (t && t.rangeCount > 0) {
75
- 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');
76
- if (r) return r;
77
- }
78
- const n = document.activeElement;
79
- return n ? n.getAttribute("contenteditable") === "true" ? n : n.closest('[contenteditable="true"], .rte-content, .editora-content') : null;
80
- }
81
- function s(t, n) {
82
- try {
83
- if (typeof t.intersectsNode == "function")
84
- return t.intersectsNode(n);
85
- } catch (e) {
86
- }
87
- const o = document.createRange();
88
- 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;
89
- }
90
- function i(t) {
91
- let n = 0, o = t;
92
- for (; o && o.parentNode; )
93
- n += 1, o = o.parentNode;
94
- return n;
95
- }
96
- function g(t) {
97
- d.forEach((n) => {
98
- t.style.removeProperty(n);
99
- }), (!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");
100
- }
101
- function c(t) {
102
- const n = t.parentNode;
103
- if (n) {
104
- for (; t.firstChild; )
105
- n.insertBefore(t.firstChild, t);
106
- n.removeChild(t);
107
- }
108
- }
109
- function h(t, n) {
110
- Array.from(
111
- t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")
112
- ).forEach((e) => {
113
- var a;
114
- if (!s(n, e) || !u.has(e.tagName)) return;
115
- const r = document.createElement("p");
116
- for (; e.firstChild; )
117
- r.appendChild(e.firstChild);
118
- (a = e.parentNode) == null || a.replaceChild(r, e);
119
- });
120
- }
121
- function m(t, n) {
122
- const o = Array.from(
123
- t.querySelectorAll(
124
- "a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"
125
- )
126
- );
127
- o.sort((e, r) => i(r) - i(e)), o.forEach((e) => {
128
- if (e.isConnected && s(n, e) && !(e.getAttribute("contenteditable") === "false" || e.closest('[contenteditable="false"]'))) {
129
- if (g(e), l.has(e.tagName)) {
130
- c(e);
131
- return;
132
- }
133
- e.tagName === "SPAN" && e.attributes.length === 0 && c(e);
134
- }
135
- });
136
- }
137
- export {
138
- p as ClearFormattingPlugin
139
- };
140
- //# sourceMappingURL=ClearFormattingPlugin.native-Bq_XcTh2.mjs.map