@editora/plugins 1.0.12 → 1.0.14
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/dist/approval-workflow.cjs.js +14 -14
- package/dist/approval-workflow.esm.js +265 -262
- package/dist/blockquote.cjs.js +1 -1
- package/dist/blockquote.esm.js +177 -15
- package/dist/blocks-library.cjs.js +6 -6
- package/dist/blocks-library.esm.js +95 -92
- package/dist/bold.cjs.js +1 -1
- package/dist/bold.esm.js +10 -6
- package/dist/capitalization.cjs.js +1 -1
- package/dist/capitalization.esm.js +124 -44
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +251 -191
- package/dist/citations.cjs.js +4 -4
- package/dist/citations.esm.js +131 -128
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +68 -36
- package/dist/code.cjs.js +27 -21
- package/dist/code.esm.js +72 -43
- package/dist/content-rules.cjs.js +5 -5
- package/dist/content-rules.esm.js +104 -101
- package/dist/data-binding.cjs.js +3 -3
- package/dist/data-binding.esm.js +51 -48
- package/dist/direction.cjs.js +1 -1
- package/dist/direction.esm.js +97 -74
- package/dist/doc-schema.cjs.js +4 -4
- package/dist/doc-schema.esm.js +104 -101
- package/dist/embed-iframe.cjs.js +21 -4
- package/dist/embed-iframe.esm.js +279 -116
- package/dist/heading.cjs.js +1 -1
- package/dist/heading.esm.js +239 -56
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +74 -89
- package/dist/inlineFormatting-DOYOJdnD.js +1 -0
- package/dist/inlineFormatting-DuVTGXYG.mjs +95 -0
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +12 -8
- package/dist/math.cjs.js +27 -21
- package/dist/math.esm.js +218 -146
- package/dist/merge-tag.cjs.js +8 -2
- package/dist/merge-tag.esm.js +130 -111
- package/dist/pii-redaction.cjs.js +6 -6
- package/dist/pii-redaction.esm.js +169 -166
- package/dist/smart-paste.cjs.js +5 -5
- package/dist/smart-paste.esm.js +120 -117
- package/dist/special-characters.cjs.js +6 -10
- package/dist/special-characters.esm.js +97 -75
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +11 -25
- package/dist/translation-workflow.cjs.js +7 -7
- package/dist/translation-workflow.esm.js +103 -100
- package/dist/underline.cjs.js +1 -1
- package/dist/underline.esm.js +7 -3
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
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 u=()=>({name:"clearFormatting",toolbar:[{label:"Clear Formatting",command:"clearFormatting",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>',shortcut:"Mod-\\"}],commands:{clearFormatting:()=>{const t=m();if(!t)return!1;const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const n=e.getRangeAt(0);if(!t.contains(n.commonAncestorContainer))return!1;const r=n.cloneRange();return t.focus({preventScroll:!0}),A(t,r),C(t,r),t.dispatchEvent(new Event("input",{bubbles:!0})),!0}},keymap:{"Mod-\\":"clearFormatting"}}),d=new Set(["A","B","STRONG","I","EM","U","S","STRIKE","DEL","FONT","MARK","CODE","SUB","SUP"]),g=new Set(["H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE"]),h=["color","background-color","font-size","font-family","font-weight","font-style","text-decoration","text-transform","line-height","letter-spacing","word-spacing","vertical-align","text-align","padding-left"];function m(){const t=window.getSelection();if(t&&t.rangeCount>0){const n=t.getRangeAt(0).startContainer,o=(n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');if(o)return o}const e=document.activeElement;return e?e.getAttribute("contenteditable")==="true"?e:e.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function c(t,e){try{if(typeof t.intersectsNode=="function")return t.intersectsNode(e)}catch{}const n=document.createRange();return e.nodeType===Node.ELEMENT_NODE?n.selectNodeContents(e):n.selectNode(e),t.compareBoundaryPoints(Range.END_TO_START,n)>0&&t.compareBoundaryPoints(Range.START_TO_END,n)<0}function i(t){let e=0,n=t;for(;n&&n.parentNode;)e+=1,n=n.parentNode;return e}function p(t){h.forEach(e=>{t.style.removeProperty(e)}),(!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")}function a(t){const e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}function E(t){return t.tagName!=="P"||t.attributes.length>0||(t.textContent||"").trim()!==""?!1:!t.querySelector("img, video, table, iframe, hr, pre, ul, ol")}function l(t){Array.from(t.children).forEach(e=>{E(e)&&e.remove()})}function s(t){l(t),a(t)}function f(t){const e=document.createElement("p");for(Array.from(t.attributes).forEach(n=>{e.setAttribute(n.name,n.value)});t.firstChild;)e.appendChild(t.firstChild);e.innerHTML.trim()||(e.innerHTML="<br>"),t.parentNode?.replaceChild(e,t)}function N(t){if(l(t),t.parentElement instanceof HTMLLIElement){s(t);return}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))){s(t);return}f(t)}function C(t,e){Array.from(t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")).forEach(r=>{if(c(e,r)&&g.has(r.tagName)){if(r.tagName==="BLOCKQUOTE"){N(r);return}f(r)}})}function A(t,e){const n=Array.from(t.querySelectorAll("a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"));n.sort((r,o)=>i(o)-i(r)),n.forEach(r=>{if(r.isConnected&&c(e,r)&&!(r.getAttribute("contenteditable")==="false"||r.closest('[contenteditable="false"]'))){if(p(r),d.has(r.tagName)){a(r);return}r.tagName==="SPAN"&&r.attributes.length===0&&a(r)}})}exports.ClearFormattingPlugin=u;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const C = () => ({
|
|
2
2
|
name: "clearFormatting",
|
|
3
3
|
// Toolbar button configuration
|
|
4
4
|
toolbar: [
|
|
@@ -15,21 +15,21 @@ const m = () => ({
|
|
|
15
15
|
* Remove all formatting from current selection
|
|
16
16
|
*/
|
|
17
17
|
clearFormatting: () => {
|
|
18
|
-
const t =
|
|
18
|
+
const t = h();
|
|
19
19
|
if (!t) return !1;
|
|
20
20
|
const e = window.getSelection();
|
|
21
21
|
if (!e || e.rangeCount === 0) return !1;
|
|
22
|
-
const
|
|
23
|
-
if (!t.contains(
|
|
24
|
-
const
|
|
25
|
-
return t.focus({ preventScroll: !0 }),
|
|
22
|
+
const n = e.getRangeAt(0);
|
|
23
|
+
if (!t.contains(n.commonAncestorContainer)) return !1;
|
|
24
|
+
const r = n.cloneRange();
|
|
25
|
+
return t.focus({ preventScroll: !0 }), A(t, r), N(t, r), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
// Keyboard shortcuts
|
|
29
29
|
keymap: {
|
|
30
30
|
"Mod-\\": "clearFormatting"
|
|
31
31
|
}
|
|
32
|
-
}),
|
|
32
|
+
}), u = /* @__PURE__ */ new Set([
|
|
33
33
|
"A",
|
|
34
34
|
"B",
|
|
35
35
|
"STRONG",
|
|
@@ -44,7 +44,7 @@ const m = () => ({
|
|
|
44
44
|
"CODE",
|
|
45
45
|
"SUB",
|
|
46
46
|
"SUP"
|
|
47
|
-
]),
|
|
47
|
+
]), d = /* @__PURE__ */ new Set([
|
|
48
48
|
"H1",
|
|
49
49
|
"H2",
|
|
50
50
|
"H3",
|
|
@@ -53,7 +53,7 @@ const m = () => ({
|
|
|
53
53
|
"H6",
|
|
54
54
|
"BLOCKQUOTE",
|
|
55
55
|
"PRE"
|
|
56
|
-
]),
|
|
56
|
+
]), g = [
|
|
57
57
|
"color",
|
|
58
58
|
"background-color",
|
|
59
59
|
"font-size",
|
|
@@ -69,11 +69,11 @@ const m = () => ({
|
|
|
69
69
|
"text-align",
|
|
70
70
|
"padding-left"
|
|
71
71
|
];
|
|
72
|
-
function
|
|
72
|
+
function h() {
|
|
73
73
|
const t = window.getSelection();
|
|
74
74
|
if (t && t.rangeCount > 0) {
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
75
|
+
const n = t.getRangeAt(0).startContainer, o = (n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');
|
|
76
|
+
if (o) return o;
|
|
77
77
|
}
|
|
78
78
|
const e = document.activeElement;
|
|
79
79
|
return e ? e.getAttribute("contenteditable") === "true" ? e : e.closest('[contenteditable="true"], .rte-content, .editora-content') : null;
|
|
@@ -84,21 +84,21 @@ function c(t, e) {
|
|
|
84
84
|
return t.intersectsNode(e);
|
|
85
85
|
} catch {
|
|
86
86
|
}
|
|
87
|
-
const
|
|
88
|
-
return e.nodeType === Node.ELEMENT_NODE ?
|
|
87
|
+
const n = document.createRange();
|
|
88
|
+
return e.nodeType === Node.ELEMENT_NODE ? n.selectNodeContents(e) : n.selectNode(e), t.compareBoundaryPoints(Range.END_TO_START, n) > 0 && t.compareBoundaryPoints(Range.START_TO_END, n) < 0;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
let e = 0,
|
|
92
|
-
for (;
|
|
93
|
-
e += 1,
|
|
90
|
+
function i(t) {
|
|
91
|
+
let e = 0, n = t;
|
|
92
|
+
for (; n && n.parentNode; )
|
|
93
|
+
e += 1, n = n.parentNode;
|
|
94
94
|
return e;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
|
|
96
|
+
function m(t) {
|
|
97
|
+
g.forEach((e) => {
|
|
98
98
|
t.style.removeProperty(e);
|
|
99
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
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function a(t) {
|
|
102
102
|
const e = t.parentNode;
|
|
103
103
|
if (e) {
|
|
104
104
|
for (; t.firstChild; )
|
|
@@ -106,33 +106,65 @@ function i(t) {
|
|
|
106
106
|
e.removeChild(t);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
function
|
|
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
|
+
const e = document.createElement("p");
|
|
122
|
+
for (Array.from(t.attributes).forEach((n) => {
|
|
123
|
+
e.setAttribute(n.name, n.value);
|
|
124
|
+
}); t.firstChild; )
|
|
125
|
+
e.appendChild(t.firstChild);
|
|
126
|
+
e.innerHTML.trim() || (e.innerHTML = "<br>"), t.parentNode?.replaceChild(e, t);
|
|
127
|
+
}
|
|
128
|
+
function E(t) {
|
|
129
|
+
if (l(t), t.parentElement instanceof HTMLLIElement) {
|
|
130
|
+
s(t);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
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))) {
|
|
134
|
+
s(t);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
f(t);
|
|
138
|
+
}
|
|
139
|
+
function N(t, e) {
|
|
110
140
|
Array.from(
|
|
111
141
|
t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")
|
|
112
|
-
).forEach((
|
|
113
|
-
if (
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
142
|
+
).forEach((r) => {
|
|
143
|
+
if (c(e, r) && d.has(r.tagName)) {
|
|
144
|
+
if (r.tagName === "BLOCKQUOTE") {
|
|
145
|
+
E(r);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
f(r);
|
|
149
|
+
}
|
|
118
150
|
});
|
|
119
151
|
}
|
|
120
|
-
function
|
|
121
|
-
const
|
|
152
|
+
function A(t, e) {
|
|
153
|
+
const n = Array.from(
|
|
122
154
|
t.querySelectorAll(
|
|
123
155
|
"a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"
|
|
124
156
|
)
|
|
125
157
|
);
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
if (
|
|
129
|
-
|
|
158
|
+
n.sort((r, o) => i(o) - i(r)), n.forEach((r) => {
|
|
159
|
+
if (r.isConnected && c(e, r) && !(r.getAttribute("contenteditable") === "false" || r.closest('[contenteditable="false"]'))) {
|
|
160
|
+
if (m(r), u.has(r.tagName)) {
|
|
161
|
+
a(r);
|
|
130
162
|
return;
|
|
131
163
|
}
|
|
132
|
-
|
|
164
|
+
r.tagName === "SPAN" && r.attributes.length === 0 && a(r);
|
|
133
165
|
}
|
|
134
166
|
});
|
|
135
167
|
}
|
|
136
168
|
export {
|
|
137
|
-
|
|
169
|
+
C as ClearFormattingPlugin
|
|
138
170
|
};
|