@editora/plugins 1.0.7 → 1.0.9
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/LICENSE +21 -0
- package/README.md +72 -4
- package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
- package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
- package/dist/anchor.cjs.js +11 -11
- package/dist/anchor.esm.js +130 -107
- package/dist/anchoredPopover-BzqGPOAE.js +1 -0
- package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
- package/dist/approval-workflow.cjs.js +447 -0
- package/dist/approval-workflow.esm.js +1070 -0
- package/dist/background-color.cjs.js +3 -3
- package/dist/background-color.esm.js +116 -119
- package/dist/blocks-library.cjs.js +442 -0
- package/dist/blocks-library.esm.js +1317 -0
- package/dist/citations.cjs.js +548 -0
- package/dist/citations.esm.js +1457 -0
- package/dist/code.cjs.js +82 -102
- package/dist/code.esm.js +1172 -662
- package/dist/comments.cjs.js +10 -10
- package/dist/comments.esm.js +195 -177
- package/dist/conditional-content.cjs.js +626 -0
- package/dist/conditional-content.esm.js +1360 -0
- package/dist/content-rules.cjs.js +408 -0
- package/dist/content-rules.esm.js +1093 -0
- package/dist/data-binding.cjs.js +321 -0
- package/dist/data-binding.esm.js +913 -0
- package/dist/doc-schema.cjs.js +398 -0
- package/dist/doc-schema.esm.js +1310 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/documentManager-CTqRftU8.mjs +8369 -0
- package/dist/documentManager-Jf0RbSks.js +17 -0
- package/dist/embed-iframe.cjs.js +2 -2
- package/dist/embed-iframe.esm.js +8 -5
- package/dist/emojis.cjs.js +64 -39
- package/dist/emojis.esm.js +133 -104
- package/dist/enterprise.cjs.js +1 -0
- package/dist/enterprise.esm.js +56 -0
- package/dist/html2canvas.esm-B5qzocYs.js +5 -0
- package/dist/html2canvas.esm-BWVIUcAF.mjs +4802 -0
- package/dist/{index-Bskk414V.mjs → index-BFsKNTTj.mjs} +50 -50
- package/dist/index-CvJk4DKa.js +221 -0
- package/dist/index-D3CycEFU.mjs +16543 -0
- package/dist/index-tqLTHcO6.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-Cz1qItab.js → index.es-CE_A4QSm.js} +5 -5
- package/dist/{index.es-DEcRmSTY.mjs → index.es-DQ78mYYo.mjs} +4 -3
- package/dist/index.esm.js +111 -75
- package/dist/jspdf.es.min-BoS80556.js +77 -0
- package/dist/jspdf.es.min-DQCoX5yh.mjs +7889 -0
- package/dist/link.cjs.js +6 -6
- package/dist/link.esm.js +41 -39
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +151 -112
- package/dist/media-manager.cjs.js +15 -15
- package/dist/media-manager.esm.js +227 -206
- package/dist/mentions.cjs.js +105 -0
- package/dist/mentions.esm.js +726 -0
- package/dist/merge-tag.cjs.js +44 -12
- package/dist/merge-tag.esm.js +368 -241
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +85 -77
- package/dist/pii-redaction.cjs.js +436 -0
- package/dist/pii-redaction.esm.js +1377 -0
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +29 -29
- package/dist/slash-commands.cjs.js +90 -0
- package/dist/slash-commands.esm.js +752 -0
- package/dist/smart-paste.cjs.js +398 -0
- package/dist/smart-paste.esm.js +1388 -0
- package/dist/special-characters.cjs.js +83 -45
- package/dist/special-characters.esm.js +149 -100
- package/dist/spell-check.cjs.js +9 -9
- package/dist/spell-check.esm.js +235 -216
- package/dist/template.cjs.js +14 -14
- package/dist/template.esm.js +157 -131
- package/dist/text-color.cjs.js +9 -9
- package/dist/text-color.esm.js +131 -115
- package/dist/track-changes.cjs.js +77 -0
- package/dist/track-changes.esm.js +755 -0
- package/dist/translation-workflow.cjs.js +626 -0
- package/dist/translation-workflow.esm.js +1718 -0
- package/dist/version-diff.cjs.js +362 -0
- package/dist/version-diff.esm.js +768 -0
- package/index.d.ts +849 -1
- package/package.json +105 -6
- package/dist/colorSelectionApply-C0iOfMWb.js +0 -1
- package/dist/colorSelectionApply-D8r_gV32.mjs +0 -63
- package/dist/documentManager-DRUc1-Cs.mjs +0 -37581
- package/dist/documentManager-_tQQfQi9.js +0 -317
- package/dist/index-D3pJyAsj.js +0 -1
package/dist/page-break.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d='.rte-page-break[data-type="page-break"]',
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d='.rte-page-break[data-type="page-break"]',f=".rte-content, .editora-content";let p=null,m=!1;const h=(e,n)=>{if(n===e.innerHTML)return;const t=window.execEditorCommand||window.executeEditorCommand;if(typeof t=="function")try{t("recordDomTransaction",e,n,e.innerHTML)}catch{}},x=new Set(["DIV","P","BLOCKQUOTE","PRE","H1","H2","H3","H4","H5","H6","LI","TD","TH"]),C=()=>{p||typeof document>"u"||(p=document.createElement("style"),p.textContent=`
|
|
2
2
|
.rte-page-break {
|
|
3
3
|
display: block;
|
|
4
4
|
position: relative;
|
|
@@ -69,4 +69,4 @@
|
|
|
69
69
|
display: none;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
`,document.head.appendChild(p))},N=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0);return(n.startContainer.nodeType===Node.ELEMENT_NODE?n.startContainer:n.startContainer.parentElement)?.closest(
|
|
72
|
+
`,document.head.appendChild(p))},N=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0);return(n.startContainer.nodeType===Node.ELEMENT_NODE?n.startContainer:n.startContainer.parentElement)?.closest(f)||null},v=()=>{const e=N();if(e)return e;const t=document.activeElement?.closest(f);return t||document.querySelector(f)},E=(e,n)=>{let t=e;for(;t&&t!==n;){if(t.nodeType===Node.ELEMENT_NODE){const r=t;if(x.has(r.tagName))return r}t=t.parentNode}return null},T=()=>{const e=document.createElement("div");return e.className="rte-page-break",e.setAttribute("data-page-break","true"),e.setAttribute("data-type","page-break"),e.setAttribute("contenteditable","false"),e.setAttribute("tabindex","0"),e.setAttribute("role","separator"),e.setAttribute("aria-label","Page break"),e},S=e=>{let n=e.nextElementSibling;for(;n&&n.matches(d);){const r=n;n=n.nextElementSibling,r.remove()}let t=e.previousElementSibling;for(;t&&t.matches(d);){const r=t;t=t.previousElementSibling,r.remove()}},w=e=>{const n=e.nextElementSibling;if(n&&!n.matches(d))return n;const t=document.createElement("p");return t.innerHTML="<br>",e.parentNode?.insertBefore(t,e.nextSibling),t},u=e=>{const n=window.getSelection();if(!n)return;const t=document.createRange();e.nodeType,Node.TEXT_NODE,t.setStart(e,0),t.collapse(!0),n.removeAllRanges(),n.addRange(t)},b=e=>{const n=window.getSelection();if(!n)return;const t=document.createRange();if(e.nodeType===Node.TEXT_NODE){const r=e;t.setStart(r,r.data.length)}else t.selectNodeContents(e),t.collapse(!1);n.removeAllRanges(),n.addRange(t)},g=(e,n)=>{let t=e;for(;t;){if(!(t instanceof HTMLElement&&t.matches(d)))return t;t=n==="previous"?t.previousSibling:t.nextSibling}return null},A=e=>{const n=window.getSelection();if(!n||!e.parentNode)return;const t=e.parentNode,r=Array.from(t.childNodes).indexOf(e);if(r<0)return;const o=document.createRange();o.setStart(t,r),o.setEnd(t,r+1),n.removeAllRanges(),n.addRange(o),e.focus({preventScroll:!0})},y=e=>{if(e.collapsed||e.startContainer!==e.endContainer||e.endOffset!==e.startOffset+1||!(e.startContainer instanceof Element||e.startContainer instanceof DocumentFragment))return null;const n=e.startContainer.childNodes[e.startOffset];return n instanceof HTMLElement&&n.matches(d)?n:null},B=(e,n,t)=>{if(!e.collapsed)return null;const{startContainer:r,startOffset:o}=e,a=i=>i instanceof HTMLElement&&i.matches(d)?i:null,c=i=>{if(r.nodeType===Node.ELEMENT_NODE){const l=r;if(i==="previous"){if(o>0)return l.childNodes[o-1]||null}else if(o<l.childNodes.length)return l.childNodes[o]||null}if(r.nodeType===Node.TEXT_NODE&&(i==="previous"&&o<r.data.length||i==="next"&&o>0))return null;let s=r;for(;s&&s!==n;){const l=i==="previous"?s.previousSibling:s.nextSibling;if(l)return l;s=s.parentNode}return null};if(r.nodeType===Node.ELEMENT_NODE){const i=r;return t==="Backspace"&&o>0?a(i.childNodes[o-1]||null):t==="Delete"?a(i.childNodes[o]||null):null}if(r.nodeType===Node.TEXT_NODE){const i=r;if(t==="Backspace"&&o===0){const s=a(i.previousSibling);return s||a(c("previous"))}if(t==="Delete"&&o===i.data.length){const s=a(i.nextSibling);return s||a(c("next"))}}return a(c(t==="Backspace"?"previous":"next"))},k=(e,n)=>{const t=e.closest(f),r=t?.innerHTML??"",o=e.previousSibling,a=e.nextSibling;e.remove();const c=g(o,"previous"),i=g(a,"next");if(n==="Backspace"){if(c)b(c);else if(i)u(i);else if(t){const s=document.createElement("p");s.innerHTML="<br>",t.appendChild(s),u(s)}}else if(i)u(i);else if(c)b(c);else if(t){const s=document.createElement("p");s.innerHTML="<br>",t.appendChild(s),u(s)}return t&&(h(t,r),t.dispatchEvent(new Event("input",{bubbles:!0}))),!0},P=()=>{const e=v();if(!e)return!1;const n=e.innerHTML,t=window.getSelection();if(!t)return!1;let r;t.rangeCount>0&&e.contains(t.getRangeAt(0).commonAncestorContainer)?r=t.getRangeAt(0):(r=document.createRange(),r.selectNodeContents(e),r.collapse(!1),t.removeAllRanges(),t.addRange(r));const o=E(r.endContainer,e)||E(r.startContainer,e),a=T();o&&o.parentNode?o.parentNode.insertBefore(a,o.nextSibling):e.appendChild(a),S(a);const c=w(a);return u(c),h(e,n),e.dispatchEvent(new Event("input",{bubbles:!0})),!0},D=()=>{m||typeof document>"u"||(m=!0,document.addEventListener("click",e=>{const t=e.target?.closest(d);t&&(e.preventDefault(),e.stopPropagation(),A(t))}),document.addEventListener("keydown",e=>{const n=e.key;if(!["Backspace","Delete","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(n))return;const t=window.getSelection();if(!t||t.rangeCount===0)return;const r=t.getRangeAt(0),o=v();if(!o||!o.contains(r.commonAncestorContainer))return;const a=y(r);if(a){if(n==="Backspace"||n==="Delete"){e.preventDefault(),e.stopPropagation(),k(a,n);return}if(n==="ArrowRight"||n==="ArrowDown"){e.preventDefault();const c=g(a.nextSibling,"next")||w(a);u(c);return}if(n==="ArrowLeft"||n==="ArrowUp"){e.preventDefault();const c=g(a.previousSibling,"previous");c?b(c):u(o);return}}if(n==="Backspace"||n==="Delete"){const c=B(r,o,n);if(!c)return;e.preventDefault(),e.stopPropagation(),k(c,n)}}))},R=()=>(C(),D(),{name:"pageBreak",toolbar:[{label:"Page Break",command:"insertPageBreak",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M5 5H19" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/><path d="M5 9H19" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/><path d="M5 15H19" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-dasharray="3.2 3.2"/><path d="M5 19H19" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/></svg>',shortcut:"Mod-Enter"}],commands:{insertPageBreak:P},keymap:{"Mod-Enter":"insertPageBreak"}});exports.PageBreakPlugin=R;
|
package/dist/page-break.esm.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
const u = '.rte-page-break[data-type="page-break"]',
|
|
1
|
+
const u = '.rte-page-break[data-type="page-break"]', f = ".rte-content, .editora-content";
|
|
2
2
|
let p = null, m = !1;
|
|
3
|
-
const
|
|
3
|
+
const h = (e, n) => {
|
|
4
|
+
if (n === e.innerHTML) return;
|
|
5
|
+
const t = window.execEditorCommand || window.executeEditorCommand;
|
|
6
|
+
if (typeof t == "function")
|
|
7
|
+
try {
|
|
8
|
+
t("recordDomTransaction", e, n, e.innerHTML);
|
|
9
|
+
} catch {
|
|
10
|
+
}
|
|
11
|
+
}, x = /* @__PURE__ */ new Set([
|
|
4
12
|
"DIV",
|
|
5
13
|
"P",
|
|
6
14
|
"BLOCKQUOTE",
|
|
@@ -14,7 +22,7 @@ const v = /* @__PURE__ */ new Set([
|
|
|
14
22
|
"LI",
|
|
15
23
|
"TD",
|
|
16
24
|
"TH"
|
|
17
|
-
]),
|
|
25
|
+
]), C = () => {
|
|
18
26
|
p || typeof document > "u" || (p = document.createElement("style"), p.textContent = `
|
|
19
27
|
.rte-page-break {
|
|
20
28
|
display: block;
|
|
@@ -91,24 +99,24 @@ const v = /* @__PURE__ */ new Set([
|
|
|
91
99
|
const e = window.getSelection();
|
|
92
100
|
if (!e || e.rangeCount === 0) return null;
|
|
93
101
|
const n = e.getRangeAt(0);
|
|
94
|
-
return (n.startContainer.nodeType === Node.ELEMENT_NODE ? n.startContainer : n.startContainer.parentElement)?.closest(
|
|
95
|
-
},
|
|
102
|
+
return (n.startContainer.nodeType === Node.ELEMENT_NODE ? n.startContainer : n.startContainer.parentElement)?.closest(f) || null;
|
|
103
|
+
}, v = () => {
|
|
96
104
|
const e = N();
|
|
97
105
|
if (e) return e;
|
|
98
|
-
const t = document.activeElement?.closest(
|
|
99
|
-
return t || document.querySelector(
|
|
100
|
-
},
|
|
106
|
+
const t = document.activeElement?.closest(f);
|
|
107
|
+
return t || document.querySelector(f);
|
|
108
|
+
}, E = (e, n) => {
|
|
101
109
|
let t = e;
|
|
102
110
|
for (; t && t !== n; ) {
|
|
103
111
|
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
104
112
|
const r = t;
|
|
105
|
-
if (
|
|
113
|
+
if (x.has(r.tagName))
|
|
106
114
|
return r;
|
|
107
115
|
}
|
|
108
116
|
t = t.parentNode;
|
|
109
117
|
}
|
|
110
118
|
return null;
|
|
111
|
-
},
|
|
119
|
+
}, T = () => {
|
|
112
120
|
const e = document.createElement("div");
|
|
113
121
|
return e.className = "rte-page-break", e.setAttribute("data-page-break", "true"), e.setAttribute("data-type", "page-break"), e.setAttribute("contenteditable", "false"), e.setAttribute("tabindex", "0"), e.setAttribute("role", "separator"), e.setAttribute("aria-label", "Page break"), e;
|
|
114
122
|
}, S = (e) => {
|
|
@@ -122,7 +130,7 @@ const v = /* @__PURE__ */ new Set([
|
|
|
122
130
|
const r = t;
|
|
123
131
|
t = t.previousElementSibling, r.remove();
|
|
124
132
|
}
|
|
125
|
-
},
|
|
133
|
+
}, w = (e) => {
|
|
126
134
|
const n = e.nextElementSibling;
|
|
127
135
|
if (n && !n.matches(u))
|
|
128
136
|
return n;
|
|
@@ -143,7 +151,7 @@ const v = /* @__PURE__ */ new Set([
|
|
|
143
151
|
} else
|
|
144
152
|
t.selectNodeContents(e), t.collapse(!1);
|
|
145
153
|
n.removeAllRanges(), n.addRange(t);
|
|
146
|
-
},
|
|
154
|
+
}, g = (e, n) => {
|
|
147
155
|
let t = e;
|
|
148
156
|
for (; t; ) {
|
|
149
157
|
if (!(t instanceof HTMLElement && t.matches(u)))
|
|
@@ -158,81 +166,81 @@ const v = /* @__PURE__ */ new Set([
|
|
|
158
166
|
if (r < 0) return;
|
|
159
167
|
const o = document.createRange();
|
|
160
168
|
o.setStart(t, r), o.setEnd(t, r + 1), n.removeAllRanges(), n.addRange(o), e.focus({ preventScroll: !0 });
|
|
161
|
-
},
|
|
169
|
+
}, y = (e) => {
|
|
162
170
|
if (e.collapsed || e.startContainer !== e.endContainer || e.endOffset !== e.startOffset + 1 || !(e.startContainer instanceof Element || e.startContainer instanceof DocumentFragment)) return null;
|
|
163
171
|
const n = e.startContainer.childNodes[e.startOffset];
|
|
164
172
|
return n instanceof HTMLElement && n.matches(u) ? n : null;
|
|
165
|
-
},
|
|
173
|
+
}, B = (e, n, t) => {
|
|
166
174
|
if (!e.collapsed) return null;
|
|
167
|
-
const { startContainer: r, startOffset: o } = e,
|
|
175
|
+
const { startContainer: r, startOffset: o } = e, a = (i) => i instanceof HTMLElement && i.matches(u) ? i : null, c = (i) => {
|
|
168
176
|
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
169
|
-
const
|
|
170
|
-
if (
|
|
177
|
+
const l = r;
|
|
178
|
+
if (i === "previous") {
|
|
171
179
|
if (o > 0)
|
|
172
|
-
return
|
|
173
|
-
} else if (o <
|
|
174
|
-
return
|
|
180
|
+
return l.childNodes[o - 1] || null;
|
|
181
|
+
} else if (o < l.childNodes.length)
|
|
182
|
+
return l.childNodes[o] || null;
|
|
175
183
|
}
|
|
176
|
-
if (r.nodeType === Node.TEXT_NODE && (
|
|
184
|
+
if (r.nodeType === Node.TEXT_NODE && (i === "previous" && o < r.data.length || i === "next" && o > 0))
|
|
177
185
|
return null;
|
|
178
|
-
let
|
|
179
|
-
for (;
|
|
180
|
-
const
|
|
181
|
-
if (
|
|
182
|
-
|
|
186
|
+
let s = r;
|
|
187
|
+
for (; s && s !== n; ) {
|
|
188
|
+
const l = i === "previous" ? s.previousSibling : s.nextSibling;
|
|
189
|
+
if (l) return l;
|
|
190
|
+
s = s.parentNode;
|
|
183
191
|
}
|
|
184
192
|
return null;
|
|
185
193
|
};
|
|
186
194
|
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
187
|
-
const
|
|
188
|
-
return t === "Backspace" && o > 0 ? i
|
|
195
|
+
const i = r;
|
|
196
|
+
return t === "Backspace" && o > 0 ? a(i.childNodes[o - 1] || null) : t === "Delete" ? a(i.childNodes[o] || null) : null;
|
|
189
197
|
}
|
|
190
198
|
if (r.nodeType === Node.TEXT_NODE) {
|
|
191
|
-
const
|
|
199
|
+
const i = r;
|
|
192
200
|
if (t === "Backspace" && o === 0) {
|
|
193
|
-
const
|
|
194
|
-
return
|
|
201
|
+
const s = a(i.previousSibling);
|
|
202
|
+
return s || a(c("previous"));
|
|
195
203
|
}
|
|
196
|
-
if (t === "Delete" && o ===
|
|
197
|
-
const
|
|
198
|
-
return
|
|
204
|
+
if (t === "Delete" && o === i.data.length) {
|
|
205
|
+
const s = a(i.nextSibling);
|
|
206
|
+
return s || a(c("next"));
|
|
199
207
|
}
|
|
200
208
|
}
|
|
201
|
-
return
|
|
202
|
-
},
|
|
203
|
-
const t = e.closest(
|
|
209
|
+
return a(c(t === "Backspace" ? "previous" : "next"));
|
|
210
|
+
}, k = (e, n) => {
|
|
211
|
+
const t = e.closest(f), r = t?.innerHTML ?? "", o = e.previousSibling, a = e.nextSibling;
|
|
204
212
|
e.remove();
|
|
205
|
-
const
|
|
213
|
+
const c = g(o, "previous"), i = g(a, "next");
|
|
206
214
|
if (n === "Backspace") {
|
|
207
|
-
if (
|
|
208
|
-
b(
|
|
209
|
-
else if (
|
|
210
|
-
d(
|
|
215
|
+
if (c)
|
|
216
|
+
b(c);
|
|
217
|
+
else if (i)
|
|
218
|
+
d(i);
|
|
211
219
|
else if (t) {
|
|
212
|
-
const
|
|
213
|
-
|
|
220
|
+
const s = document.createElement("p");
|
|
221
|
+
s.innerHTML = "<br>", t.appendChild(s), d(s);
|
|
214
222
|
}
|
|
215
|
-
} else if (
|
|
216
|
-
d(
|
|
217
|
-
else if (
|
|
218
|
-
b(
|
|
223
|
+
} else if (i)
|
|
224
|
+
d(i);
|
|
225
|
+
else if (c)
|
|
226
|
+
b(c);
|
|
219
227
|
else if (t) {
|
|
220
|
-
const
|
|
221
|
-
|
|
228
|
+
const s = document.createElement("p");
|
|
229
|
+
s.innerHTML = "<br>", t.appendChild(s), d(s);
|
|
222
230
|
}
|
|
223
|
-
return t && t.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
224
|
-
},
|
|
225
|
-
const e =
|
|
231
|
+
return t && (h(t, r), t.dispatchEvent(new Event("input", { bubbles: !0 }))), !0;
|
|
232
|
+
}, D = () => {
|
|
233
|
+
const e = v();
|
|
226
234
|
if (!e) return !1;
|
|
227
|
-
const n = window.getSelection();
|
|
228
|
-
if (!
|
|
229
|
-
let
|
|
230
|
-
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
return d(
|
|
235
|
-
},
|
|
235
|
+
const n = e.innerHTML, t = window.getSelection();
|
|
236
|
+
if (!t) return !1;
|
|
237
|
+
let r;
|
|
238
|
+
t.rangeCount > 0 && e.contains(t.getRangeAt(0).commonAncestorContainer) ? r = t.getRangeAt(0) : (r = document.createRange(), r.selectNodeContents(e), r.collapse(!1), t.removeAllRanges(), t.addRange(r));
|
|
239
|
+
const o = E(r.endContainer, e) || E(r.startContainer, e), a = T();
|
|
240
|
+
o && o.parentNode ? o.parentNode.insertBefore(a, o.nextSibling) : e.appendChild(a), S(a);
|
|
241
|
+
const c = w(a);
|
|
242
|
+
return d(c), h(e, n), e.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
243
|
+
}, R = () => {
|
|
236
244
|
m || typeof document > "u" || (m = !0, document.addEventListener("click", (e) => {
|
|
237
245
|
const t = e.target?.closest(u);
|
|
238
246
|
t && (e.preventDefault(), e.stopPropagation(), A(t));
|
|
@@ -242,54 +250,54 @@ const v = /* @__PURE__ */ new Set([
|
|
|
242
250
|
return;
|
|
243
251
|
const t = window.getSelection();
|
|
244
252
|
if (!t || t.rangeCount === 0) return;
|
|
245
|
-
const r = t.getRangeAt(0), o =
|
|
253
|
+
const r = t.getRangeAt(0), o = v();
|
|
246
254
|
if (!o || !o.contains(r.commonAncestorContainer)) return;
|
|
247
|
-
const
|
|
248
|
-
if (
|
|
255
|
+
const a = y(r);
|
|
256
|
+
if (a) {
|
|
249
257
|
if (n === "Backspace" || n === "Delete") {
|
|
250
|
-
e.preventDefault(), e.stopPropagation(),
|
|
258
|
+
e.preventDefault(), e.stopPropagation(), k(a, n);
|
|
251
259
|
return;
|
|
252
260
|
}
|
|
253
261
|
if (n === "ArrowRight" || n === "ArrowDown") {
|
|
254
262
|
e.preventDefault();
|
|
255
|
-
const
|
|
256
|
-
d(
|
|
263
|
+
const c = g(a.nextSibling, "next") || w(a);
|
|
264
|
+
d(c);
|
|
257
265
|
return;
|
|
258
266
|
}
|
|
259
267
|
if (n === "ArrowLeft" || n === "ArrowUp") {
|
|
260
268
|
e.preventDefault();
|
|
261
|
-
const
|
|
262
|
-
|
|
269
|
+
const c = g(a.previousSibling, "previous");
|
|
270
|
+
c ? b(c) : d(o);
|
|
263
271
|
return;
|
|
264
272
|
}
|
|
265
273
|
}
|
|
266
274
|
if (n === "Backspace" || n === "Delete") {
|
|
267
|
-
const
|
|
275
|
+
const c = B(
|
|
268
276
|
r,
|
|
269
277
|
o,
|
|
270
278
|
n
|
|
271
279
|
);
|
|
272
|
-
if (!
|
|
273
|
-
e.preventDefault(), e.stopPropagation(),
|
|
280
|
+
if (!c) return;
|
|
281
|
+
e.preventDefault(), e.stopPropagation(), k(c, n);
|
|
274
282
|
}
|
|
275
283
|
}));
|
|
276
|
-
},
|
|
284
|
+
}, P = () => (C(), R(), {
|
|
277
285
|
name: "pageBreak",
|
|
278
286
|
toolbar: [
|
|
279
287
|
{
|
|
280
288
|
label: "Page Break",
|
|
281
289
|
command: "insertPageBreak",
|
|
282
|
-
icon: '<svg
|
|
290
|
+
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M5 5H19" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/><path d="M5 9H19" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/><path d="M5 15H19" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-dasharray="3.2 3.2"/><path d="M5 19H19" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/></svg>',
|
|
283
291
|
shortcut: "Mod-Enter"
|
|
284
292
|
}
|
|
285
293
|
],
|
|
286
294
|
commands: {
|
|
287
|
-
insertPageBreak:
|
|
295
|
+
insertPageBreak: D
|
|
288
296
|
},
|
|
289
297
|
keymap: {
|
|
290
298
|
"Mod-Enter": "insertPageBreak"
|
|
291
299
|
}
|
|
292
300
|
});
|
|
293
301
|
export {
|
|
294
|
-
|
|
302
|
+
P as PageBreakPlugin
|
|
295
303
|
};
|