@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,172 @@
|
|
|
1
|
+
const C = () => ({
|
|
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 = h();
|
|
19
|
+
if (!t) return !1;
|
|
20
|
+
const e = window.getSelection();
|
|
21
|
+
if (!e || e.rangeCount === 0) return !1;
|
|
22
|
+
const r = e.getRangeAt(0);
|
|
23
|
+
if (!t.contains(r.commonAncestorContainer)) return !1;
|
|
24
|
+
const n = r.cloneRange();
|
|
25
|
+
return t.focus({ preventScroll: !0 }), A(t, n), N(t, n), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
// Keyboard shortcuts
|
|
29
|
+
keymap: {
|
|
30
|
+
"Mod-\\": "clearFormatting"
|
|
31
|
+
}
|
|
32
|
+
}), u = /* @__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
|
+
]), d = /* @__PURE__ */ new Set([
|
|
48
|
+
"H1",
|
|
49
|
+
"H2",
|
|
50
|
+
"H3",
|
|
51
|
+
"H4",
|
|
52
|
+
"H5",
|
|
53
|
+
"H6",
|
|
54
|
+
"BLOCKQUOTE",
|
|
55
|
+
"PRE"
|
|
56
|
+
]), g = [
|
|
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 h() {
|
|
73
|
+
const t = window.getSelection();
|
|
74
|
+
if (t && t.rangeCount > 0) {
|
|
75
|
+
const r = t.getRangeAt(0).startContainer, n = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement, o = n == null ? void 0 : n.closest('[contenteditable="true"], .rte-content, .editora-content');
|
|
76
|
+
if (o) return o;
|
|
77
|
+
}
|
|
78
|
+
const e = document.activeElement;
|
|
79
|
+
return e ? e.getAttribute("contenteditable") === "true" ? e : e.closest('[contenteditable="true"], .rte-content, .editora-content') : null;
|
|
80
|
+
}
|
|
81
|
+
function c(t, e) {
|
|
82
|
+
try {
|
|
83
|
+
if (typeof t.intersectsNode == "function")
|
|
84
|
+
return t.intersectsNode(e);
|
|
85
|
+
} catch (n) {
|
|
86
|
+
}
|
|
87
|
+
const r = document.createRange();
|
|
88
|
+
return e.nodeType === Node.ELEMENT_NODE ? r.selectNodeContents(e) : r.selectNode(e), t.compareBoundaryPoints(Range.END_TO_START, r) > 0 && t.compareBoundaryPoints(Range.START_TO_END, r) < 0;
|
|
89
|
+
}
|
|
90
|
+
function i(t) {
|
|
91
|
+
let e = 0, r = t;
|
|
92
|
+
for (; r && r.parentNode; )
|
|
93
|
+
e += 1, r = r.parentNode;
|
|
94
|
+
return e;
|
|
95
|
+
}
|
|
96
|
+
function m(t) {
|
|
97
|
+
g.forEach((e) => {
|
|
98
|
+
t.style.removeProperty(e);
|
|
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 a(t) {
|
|
102
|
+
const e = t.parentNode;
|
|
103
|
+
if (e) {
|
|
104
|
+
for (; t.firstChild; )
|
|
105
|
+
e.insertBefore(t.firstChild, t);
|
|
106
|
+
e.removeChild(t);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function p(t) {
|
|
110
|
+
return t.tagName !== "P" || t.attributes.length > 0 || (t.textContent || "").trim() !== "" ? !1 : !t.querySelector("img, video, table, iframe, hr, pre, ul, ol");
|
|
111
|
+
}
|
|
112
|
+
function l(t) {
|
|
113
|
+
Array.from(t.children).forEach((e) => {
|
|
114
|
+
p(e) && e.remove();
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function s(t) {
|
|
118
|
+
l(t), a(t);
|
|
119
|
+
}
|
|
120
|
+
function f(t) {
|
|
121
|
+
var r;
|
|
122
|
+
const e = document.createElement("p");
|
|
123
|
+
for (Array.from(t.attributes).forEach((n) => {
|
|
124
|
+
e.setAttribute(n.name, n.value);
|
|
125
|
+
}); t.firstChild; )
|
|
126
|
+
e.appendChild(t.firstChild);
|
|
127
|
+
e.innerHTML.trim() || (e.innerHTML = "<br>"), (r = t.parentNode) == null || r.replaceChild(e, t);
|
|
128
|
+
}
|
|
129
|
+
function E(t) {
|
|
130
|
+
if (l(t), t.parentElement instanceof HTMLLIElement) {
|
|
131
|
+
s(t);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (Array.from(t.childNodes).filter((o) => o.nodeType !== Node.TEXT_NODE || (o.textContent || "").trim() !== "").some((o) => o instanceof HTMLElement && /^(P|DIV|H[1-6]|UL|OL|PRE|TABLE|BLOCKQUOTE)$/.test(o.tagName))) {
|
|
135
|
+
s(t);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
f(t);
|
|
139
|
+
}
|
|
140
|
+
function N(t, e) {
|
|
141
|
+
Array.from(
|
|
142
|
+
t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")
|
|
143
|
+
).forEach((n) => {
|
|
144
|
+
if (c(e, n) && d.has(n.tagName)) {
|
|
145
|
+
if (n.tagName === "BLOCKQUOTE") {
|
|
146
|
+
E(n);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
f(n);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function A(t, e) {
|
|
154
|
+
const r = Array.from(
|
|
155
|
+
t.querySelectorAll(
|
|
156
|
+
"a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"
|
|
157
|
+
)
|
|
158
|
+
);
|
|
159
|
+
r.sort((n, o) => i(o) - i(n)), r.forEach((n) => {
|
|
160
|
+
if (n.isConnected && c(e, n) && !(n.getAttribute("contenteditable") === "false" || n.closest('[contenteditable="false"]'))) {
|
|
161
|
+
if (m(n), u.has(n.tagName)) {
|
|
162
|
+
a(n);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
n.tagName === "SPAN" && n.attributes.length === 0 && a(n);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
C as ClearFormattingPlugin
|
|
171
|
+
};
|
|
172
|
+
//# sourceMappingURL=ClearFormattingPlugin.native-DIS6AN2t.mjs.map
|