@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.
- package/README.md +6 -1
- package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +136 -133
- package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
- package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +90 -87
- package/dist/{BoldPlugin.native-BAzzoqU5.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-BnU0qCwR.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +132 -129
- package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
- package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
- package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +105 -102
- package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +49 -46
- package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
- package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +55 -52
- package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-BF_-LjTq.mjs} +287 -115
- package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
- package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-D2wl32jV.mjs} +88 -103
- package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
- package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
- package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +204 -202
- package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
- package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +158 -155
- package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +2 -2
- package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +127 -124
- package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +100 -76
- package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -26
- package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
- package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +104 -101
- package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
- package/dist/editora.min.js +1 -1
- package/dist/editora.umd.js +1 -1
- package/dist/index-CPMGUZfB.js +10 -0
- package/dist/{index-DqC57IEH.mjs → index-DBoj6QfW.mjs} +17 -15
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
- package/dist/plugin-loader.js +37 -37
- package/dist/webcomponent-core.js +18 -16
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +139 -62
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +50 -48
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1174 -1071
- package/package.json +11 -5
- package/LICENSE +0 -21
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +0 -48
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +0 -79
- package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +0 -309
- package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +0 -140
- package/dist/CodePlugin.native-DlpTPdkd.mjs +0 -2691
- package/dist/DirectionPlugin.native-CDnbdNyl.mjs +0 -130
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +0 -64
- package/dist/MathPlugin.native-f_mDp8VL.mjs +0 -292
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +0 -559
- package/dist/TemplatePlugin.native-CrpfKRJ8.mjs +0 -602
- package/dist/index-D1LOqg5C.js +0 -10
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
const m = '.rte-content, .editora-content, [contenteditable="true"]', B = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", k = [
|
|
2
|
+
"p",
|
|
3
|
+
"div",
|
|
4
|
+
"h1",
|
|
5
|
+
"h2",
|
|
6
|
+
"h3",
|
|
7
|
+
"h4",
|
|
8
|
+
"h5",
|
|
9
|
+
"h6",
|
|
10
|
+
"ul",
|
|
11
|
+
"ol",
|
|
12
|
+
"blockquote",
|
|
13
|
+
"pre",
|
|
14
|
+
"table"
|
|
15
|
+
].join(",");
|
|
16
|
+
function E(e) {
|
|
17
|
+
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
18
|
+
}
|
|
19
|
+
function b(e) {
|
|
20
|
+
const t = e == null ? void 0 : e.contentElement;
|
|
21
|
+
if (t instanceof HTMLElement) return t;
|
|
22
|
+
const n = e == null ? void 0 : e.editorElement;
|
|
23
|
+
if (n instanceof HTMLElement) {
|
|
24
|
+
const r = n.querySelector(m);
|
|
25
|
+
if (r instanceof HTMLElement) return r;
|
|
26
|
+
if (n.getAttribute("contenteditable") === "true") return n;
|
|
27
|
+
}
|
|
28
|
+
const o = window.getSelection();
|
|
29
|
+
if (o && o.rangeCount > 0) {
|
|
30
|
+
const r = E(o.getRangeAt(0).startContainer), i = r == null ? void 0 : r.closest(m);
|
|
31
|
+
if (i instanceof HTMLElement) return i;
|
|
32
|
+
const f = r == null ? void 0 : r.closest(B), d = f == null ? void 0 : f.querySelector(m);
|
|
33
|
+
if (d instanceof HTMLElement) return d;
|
|
34
|
+
}
|
|
35
|
+
const c = document.activeElement, l = c == null ? void 0 : c.closest(m);
|
|
36
|
+
return l instanceof HTMLElement ? l : document.querySelector(m);
|
|
37
|
+
}
|
|
38
|
+
function M(e) {
|
|
39
|
+
const t = window.getSelection();
|
|
40
|
+
if (!t || t.rangeCount === 0) return null;
|
|
41
|
+
const n = t.getRangeAt(0);
|
|
42
|
+
return !e.contains(n.startContainer) || !e.contains(n.endContainer) ? null : n;
|
|
43
|
+
}
|
|
44
|
+
function N(e, t) {
|
|
45
|
+
let n = E(t);
|
|
46
|
+
if (!n || n === e || !e.contains(n)) return null;
|
|
47
|
+
for (; n.parentElement && n.parentElement !== e; )
|
|
48
|
+
n = n.parentElement;
|
|
49
|
+
if (n.parentElement !== e) return null;
|
|
50
|
+
if (n.matches(k)) return n;
|
|
51
|
+
const o = n.closest(k);
|
|
52
|
+
return o instanceof HTMLElement && o.parentElement === e ? o : n;
|
|
53
|
+
}
|
|
54
|
+
function w(e, t) {
|
|
55
|
+
if (typeof e.intersectsNode == "function")
|
|
56
|
+
try {
|
|
57
|
+
return e.intersectsNode(t);
|
|
58
|
+
} catch (o) {
|
|
59
|
+
return !1;
|
|
60
|
+
}
|
|
61
|
+
const n = document.createRange();
|
|
62
|
+
return n.selectNode(t), e.compareBoundaryPoints(Range.END_TO_START, n) < 0 && e.compareBoundaryPoints(Range.START_TO_END, n) > 0;
|
|
63
|
+
}
|
|
64
|
+
function q(e, t) {
|
|
65
|
+
const n = N(e, t.startContainer), o = N(e, t.endContainer);
|
|
66
|
+
if (!n) return [];
|
|
67
|
+
if (!o || n === o) return [n];
|
|
68
|
+
const l = Array.from(e.children).filter(
|
|
69
|
+
(r) => r instanceof HTMLElement
|
|
70
|
+
).filter((r) => w(t, r));
|
|
71
|
+
return l.length > 0 ? l : [n];
|
|
72
|
+
}
|
|
73
|
+
function S(e, t) {
|
|
74
|
+
const n = E(t), o = n == null ? void 0 : n.closest("blockquote");
|
|
75
|
+
return o instanceof HTMLQuoteElement && e.contains(o) ? o : null;
|
|
76
|
+
}
|
|
77
|
+
function v(e) {
|
|
78
|
+
return e.tagName !== "P" || e.attributes.length > 0 || (e.textContent || "").trim() !== "" ? !1 : !e.querySelector("img, video, table, iframe, hr, pre, ul, ol");
|
|
79
|
+
}
|
|
80
|
+
function O(e) {
|
|
81
|
+
Array.from(e.children).forEach((t) => {
|
|
82
|
+
v(t) && t.remove();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function h(e) {
|
|
86
|
+
O(e);
|
|
87
|
+
const t = e.parentNode;
|
|
88
|
+
if (!t) return;
|
|
89
|
+
Array.from(e.childNodes).forEach((o) => {
|
|
90
|
+
t.insertBefore(o, e);
|
|
91
|
+
}), t.removeChild(e);
|
|
92
|
+
}
|
|
93
|
+
function y(e) {
|
|
94
|
+
return e.nodeType === Node.TEXT_NODE && (e.textContent || "").trim() === "";
|
|
95
|
+
}
|
|
96
|
+
function L(e) {
|
|
97
|
+
const t = Array.from(e.childNodes).filter((o) => !y(o));
|
|
98
|
+
if (t.length !== 1) return null;
|
|
99
|
+
const n = t[0];
|
|
100
|
+
return n instanceof HTMLQuoteElement ? n : null;
|
|
101
|
+
}
|
|
102
|
+
function R(e) {
|
|
103
|
+
const t = document.createElement("blockquote");
|
|
104
|
+
return Array.from(e.childNodes).filter((o) => !y(o)).forEach((o) => {
|
|
105
|
+
t.appendChild(o);
|
|
106
|
+
}), t.childNodes.length || (t.innerHTML = "<br>"), e.appendChild(t), t;
|
|
107
|
+
}
|
|
108
|
+
function A(e, t) {
|
|
109
|
+
const n = Array.from(e.querySelectorAll("li")).filter(
|
|
110
|
+
(c) => c instanceof HTMLLIElement && w(t, c)
|
|
111
|
+
), o = new Set(n);
|
|
112
|
+
return n.filter((c) => {
|
|
113
|
+
var r, i;
|
|
114
|
+
let l = (r = c.parentElement) == null ? void 0 : r.closest("li");
|
|
115
|
+
for (; l; ) {
|
|
116
|
+
if (o.has(l)) return !1;
|
|
117
|
+
l = (i = l.parentElement) == null ? void 0 : i.closest("li");
|
|
118
|
+
}
|
|
119
|
+
return !0;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function g(e) {
|
|
123
|
+
const t = window.getSelection();
|
|
124
|
+
if (!t) return;
|
|
125
|
+
const n = document.createRange(), o = e instanceof HTMLElement && e.querySelector("p,li,h1,h2,h3,h4,h5,h6") || e;
|
|
126
|
+
n.selectNodeContents(o), n.collapse(!0), t.removeAllRanges(), t.addRange(n);
|
|
127
|
+
}
|
|
128
|
+
function H(e) {
|
|
129
|
+
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
130
|
+
}
|
|
131
|
+
function I(e, t, n) {
|
|
132
|
+
const o = window.execEditorCommand;
|
|
133
|
+
if (typeof o == "function") {
|
|
134
|
+
o("recordDomTransaction", e, t, n);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const c = window.executeEditorCommand;
|
|
138
|
+
typeof c == "function" && c("recordDomTransaction", { editor: e, beforeHTML: t, afterHTML: n });
|
|
139
|
+
}
|
|
140
|
+
function _(e) {
|
|
141
|
+
var T, C;
|
|
142
|
+
const t = b(e);
|
|
143
|
+
if (!t) return !1;
|
|
144
|
+
const n = M(t);
|
|
145
|
+
if (!n) return !1;
|
|
146
|
+
const o = t.innerHTML, c = S(t, n.startContainer), l = S(t, n.endContainer), r = A(t, n), i = q(t, n), f = i.length > 0 && i.every((s) => s.tagName === "BLOCKQUOTE");
|
|
147
|
+
if (c && c === l) {
|
|
148
|
+
const s = c.firstChild || c;
|
|
149
|
+
h(c), g(s);
|
|
150
|
+
} else if (r.length > 0) {
|
|
151
|
+
const s = r.map(L);
|
|
152
|
+
if (s.every(Boolean)) {
|
|
153
|
+
const u = ((T = s[0]) == null ? void 0 : T.firstChild) || r[0];
|
|
154
|
+
s.forEach((a) => {
|
|
155
|
+
a && h(a);
|
|
156
|
+
}), g(u);
|
|
157
|
+
} else {
|
|
158
|
+
const u = r[0];
|
|
159
|
+
r.forEach((a) => {
|
|
160
|
+
L(a) || R(a);
|
|
161
|
+
}), g(u);
|
|
162
|
+
}
|
|
163
|
+
} else if (f) {
|
|
164
|
+
const s = i[0].firstChild || i[0];
|
|
165
|
+
i.forEach(h), g(s);
|
|
166
|
+
} else {
|
|
167
|
+
const s = i.filter((a) => a.tagName !== "BLOCKQUOTE");
|
|
168
|
+
if (s.length === 0) return !1;
|
|
169
|
+
const p = document.createElement("blockquote"), u = s[0];
|
|
170
|
+
(C = u.parentNode) == null || C.insertBefore(p, u), s.forEach((a) => {
|
|
171
|
+
p.appendChild(a);
|
|
172
|
+
}), g(p);
|
|
173
|
+
}
|
|
174
|
+
const d = t.innerHTML;
|
|
175
|
+
return o === d ? !1 : (I(t, o, d), H(t), !0);
|
|
176
|
+
}
|
|
177
|
+
const x = () => ({
|
|
178
|
+
name: "blockquote",
|
|
179
|
+
// Schema definition for blockquote node
|
|
180
|
+
nodes: {
|
|
181
|
+
blockquote: {
|
|
182
|
+
content: "block+",
|
|
183
|
+
group: "block",
|
|
184
|
+
parseDOM: [{ tag: "blockquote" }],
|
|
185
|
+
toDOM: () => ["blockquote", 0]
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
// Toolbar button configuration
|
|
189
|
+
toolbar: [
|
|
190
|
+
{
|
|
191
|
+
label: "Quote",
|
|
192
|
+
command: "toggleBlockquote",
|
|
193
|
+
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>',
|
|
194
|
+
shortcut: "Mod-Shift-9"
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
// Native command implementations
|
|
198
|
+
commands: {
|
|
199
|
+
/**
|
|
200
|
+
* Toggle blockquote formatting on current selection
|
|
201
|
+
*/
|
|
202
|
+
toggleBlockquote: (e, t) => _(t)
|
|
203
|
+
},
|
|
204
|
+
// Keyboard shortcuts
|
|
205
|
+
keymap: {
|
|
206
|
+
"Mod-Shift-9": "toggleBlockquote"
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
export {
|
|
210
|
+
x as BlockquotePlugin
|
|
211
|
+
};
|
|
212
|
+
//# sourceMappingURL=BlockquotePlugin.native-57_Xcjl1.mjs.map
|