@editora/plugins 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 +27 -0
- package/dist/_commonjsHelpers-6763f629.js +1 -0
- package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +98 -80
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +128 -115
- package/dist/anchoredPopover-33f1358d.mjs +109 -0
- package/dist/anchoredPopover-8151d535.js +1 -0
- package/dist/approval-workflow.cjs.js +447 -0
- package/dist/approval-workflow.esm.js +1111 -0
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +68 -55
- package/dist/blockquote.esm.js +2 -1
- package/dist/blocks-library.cjs.js +442 -0
- package/dist/blocks-library.esm.js +1384 -0
- package/dist/capitalization.esm.js +2 -1
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +82 -58
- package/dist/citations.cjs.js +548 -0
- package/dist/citations.esm.js +1530 -0
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +33 -27
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +93 -82
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +653 -594
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +158 -116
- package/dist/conditional-content.cjs.js +626 -0
- package/dist/conditional-content.esm.js +1421 -0
- package/dist/content-rules.cjs.js +408 -0
- package/dist/content-rules.esm.js +1147 -0
- package/dist/data-binding.cjs.js +321 -0
- package/dist/data-binding.esm.js +953 -0
- package/dist/direction.esm.js +18 -9
- package/dist/doc-schema.cjs.js +398 -0
- package/dist/doc-schema.esm.js +1378 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +5 -4
- package/dist/documentManager-25b6203c.mjs +9122 -0
- package/dist/documentManager-b69e7054.js +17 -0
- package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +81 -73
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +77 -65
- package/dist/enterprise.cjs.js +1 -0
- package/dist/enterprise.esm.js +58 -0
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +47 -39
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +53 -37
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +117 -76
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +92 -70
- package/dist/html2canvas.esm-09133e29.js +22 -0
- package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +24 -12
- package/dist/index-656d224b.js +231 -0
- package/dist/index-6a8c48bb.js +1 -0
- package/dist/index-d027b7e2.mjs +16859 -0
- package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-730f2d98.mjs +5775 -0
- package/dist/index.es-dd40173b.js +18 -0
- package/dist/index.esm.js +124 -93
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +9 -8
- package/dist/jspdf.es.min-90db2c97.js +243 -0
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +24 -11
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +30 -24
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +25 -20
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +61 -59
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +146 -139
- package/dist/media-manager.cjs.js +38 -38
- package/dist/media-manager.esm.js +325 -308
- package/dist/mentions.cjs.js +105 -0
- package/dist/mentions.esm.js +774 -0
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +216 -177
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +67 -51
- package/dist/pii-redaction.cjs.js +436 -0
- package/dist/pii-redaction.esm.js +1447 -0
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +37 -32
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +20 -17
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
- package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
- package/dist/slash-commands.cjs.js +90 -0
- package/dist/slash-commands.esm.js +788 -0
- package/dist/smart-paste.cjs.js +398 -0
- package/dist/smart-paste.esm.js +1444 -0
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +69 -61
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +123 -97
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +19 -14
- package/dist/style.css +1 -0
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +225 -191
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +153 -124
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +27 -21
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +87 -70
- package/dist/track-changes.cjs.js +77 -0
- package/dist/track-changes.esm.js +817 -0
- package/dist/translation-workflow.cjs.js +626 -0
- package/dist/translation-workflow.esm.js +1794 -0
- package/dist/version-diff.cjs.js +362 -0
- package/dist/version-diff.esm.js +797 -0
- package/index.d.ts +798 -0
- package/package.json +114 -9
- package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
- package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/documentManager-CTqRftU8.mjs +0 -8369
- package/dist/documentManager-Jf0RbSks.js +0 -17
- package/dist/html2canvas.esm-B5qzocYs.js +0 -5
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-D3CycEFU.mjs +0 -16543
- package/dist/index-tqLTHcO6.js +0 -1
- package/dist/index.es-CE_A4QSm.js +0 -5
- package/dist/index.es-DQ78mYYo.mjs +0 -6665
- package/dist/jspdf.es.min-BoS80556.js +0 -77
- package/dist/plugins.css +0 -1
- /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
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"]),N=()=>{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))},
|
|
72
|
+
`,document.head.appendChild(p))},T=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0),t=n.startContainer.nodeType===Node.ELEMENT_NODE?n.startContainer:n.startContainer.parentElement;return(t==null?void 0:t.closest(f))||null},v=()=>{const e=T();if(e)return e;const n=document.activeElement,t=n==null?void 0:n.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},C=()=>{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=>{var r;const n=e.nextElementSibling;if(n&&!n.matches(d))return n;const t=document.createElement("p");return t.innerHTML="<br>",(r=e.parentNode)==null||r.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==null?void 0: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=C();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 n=e.target,t=n==null?void 0:n.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=()=>(N(),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,7 +1,8 @@
|
|
|
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
3
|
const h = (e, n) => {
|
|
4
|
-
if (n === e.innerHTML)
|
|
4
|
+
if (n === e.innerHTML)
|
|
5
|
+
return;
|
|
5
6
|
const t = window.execEditorCommand || window.executeEditorCommand;
|
|
6
7
|
if (typeof t == "function")
|
|
7
8
|
try {
|
|
@@ -22,7 +23,7 @@ const h = (e, n) => {
|
|
|
22
23
|
"LI",
|
|
23
24
|
"TD",
|
|
24
25
|
"TH"
|
|
25
|
-
]),
|
|
26
|
+
]), N = () => {
|
|
26
27
|
p || typeof document > "u" || (p = document.createElement("style"), p.textContent = `
|
|
27
28
|
.rte-page-break {
|
|
28
29
|
display: block;
|
|
@@ -95,17 +96,19 @@ const h = (e, n) => {
|
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
`, document.head.appendChild(p));
|
|
98
|
-
},
|
|
99
|
+
}, T = () => {
|
|
99
100
|
const e = window.getSelection();
|
|
100
|
-
if (!e || e.rangeCount === 0)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
if (!e || e.rangeCount === 0)
|
|
102
|
+
return null;
|
|
103
|
+
const n = e.getRangeAt(0), t = n.startContainer.nodeType === Node.ELEMENT_NODE ? n.startContainer : n.startContainer.parentElement;
|
|
104
|
+
return (t == null ? void 0 : t.closest(f)) || null;
|
|
105
|
+
}, w = () => {
|
|
106
|
+
const e = T();
|
|
107
|
+
if (e)
|
|
108
|
+
return e;
|
|
109
|
+
const n = document.activeElement, t = n == null ? void 0 : n.closest(f);
|
|
110
|
+
return t || document.querySelector(f);
|
|
111
|
+
}, E = (e, n) => {
|
|
109
112
|
let t = e;
|
|
110
113
|
for (; t && t !== n; ) {
|
|
111
114
|
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
@@ -116,7 +119,7 @@ const h = (e, n) => {
|
|
|
116
119
|
t = t.parentNode;
|
|
117
120
|
}
|
|
118
121
|
return null;
|
|
119
|
-
},
|
|
122
|
+
}, C = () => {
|
|
120
123
|
const e = document.createElement("div");
|
|
121
124
|
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;
|
|
122
125
|
}, S = (e) => {
|
|
@@ -131,19 +134,22 @@ const h = (e, n) => {
|
|
|
131
134
|
t = t.previousElementSibling, r.remove();
|
|
132
135
|
}
|
|
133
136
|
}, v = (e) => {
|
|
137
|
+
var r;
|
|
134
138
|
const n = e.nextElementSibling;
|
|
135
139
|
if (n && !n.matches(u))
|
|
136
140
|
return n;
|
|
137
141
|
const t = document.createElement("p");
|
|
138
|
-
return t.innerHTML = "<br>", e.parentNode
|
|
142
|
+
return t.innerHTML = "<br>", (r = e.parentNode) == null || r.insertBefore(t, e.nextSibling), t;
|
|
139
143
|
}, d = (e) => {
|
|
140
144
|
const n = window.getSelection();
|
|
141
|
-
if (!n)
|
|
145
|
+
if (!n)
|
|
146
|
+
return;
|
|
142
147
|
const t = document.createRange();
|
|
143
148
|
e.nodeType, Node.TEXT_NODE, t.setStart(e, 0), t.collapse(!0), n.removeAllRanges(), n.addRange(t);
|
|
144
149
|
}, b = (e) => {
|
|
145
150
|
const n = window.getSelection();
|
|
146
|
-
if (!n)
|
|
151
|
+
if (!n)
|
|
152
|
+
return;
|
|
147
153
|
const t = document.createRange();
|
|
148
154
|
if (e.nodeType === Node.TEXT_NODE) {
|
|
149
155
|
const r = e;
|
|
@@ -151,7 +157,7 @@ const h = (e, n) => {
|
|
|
151
157
|
} else
|
|
152
158
|
t.selectNodeContents(e), t.collapse(!1);
|
|
153
159
|
n.removeAllRanges(), n.addRange(t);
|
|
154
|
-
},
|
|
160
|
+
}, g = (e, n) => {
|
|
155
161
|
let t = e;
|
|
156
162
|
for (; t; ) {
|
|
157
163
|
if (!(t instanceof HTMLElement && t.matches(u)))
|
|
@@ -159,19 +165,23 @@ const h = (e, n) => {
|
|
|
159
165
|
t = n === "previous" ? t.previousSibling : t.nextSibling;
|
|
160
166
|
}
|
|
161
167
|
return null;
|
|
162
|
-
},
|
|
168
|
+
}, A = (e) => {
|
|
163
169
|
const n = window.getSelection();
|
|
164
|
-
if (!n || !e.parentNode)
|
|
170
|
+
if (!n || !e.parentNode)
|
|
171
|
+
return;
|
|
165
172
|
const t = e.parentNode, r = Array.from(t.childNodes).indexOf(e);
|
|
166
|
-
if (r < 0)
|
|
173
|
+
if (r < 0)
|
|
174
|
+
return;
|
|
167
175
|
const o = document.createRange();
|
|
168
176
|
o.setStart(t, r), o.setEnd(t, r + 1), n.removeAllRanges(), n.addRange(o), e.focus({ preventScroll: !0 });
|
|
169
|
-
},
|
|
170
|
-
if (e.collapsed || e.startContainer !== e.endContainer || e.endOffset !== e.startOffset + 1 || !(e.startContainer instanceof Element || e.startContainer instanceof DocumentFragment))
|
|
177
|
+
}, y = (e) => {
|
|
178
|
+
if (e.collapsed || e.startContainer !== e.endContainer || e.endOffset !== e.startOffset + 1 || !(e.startContainer instanceof Element || e.startContainer instanceof DocumentFragment))
|
|
179
|
+
return null;
|
|
171
180
|
const n = e.startContainer.childNodes[e.startOffset];
|
|
172
181
|
return n instanceof HTMLElement && n.matches(u) ? n : null;
|
|
173
|
-
},
|
|
174
|
-
if (!e.collapsed)
|
|
182
|
+
}, B = (e, n, t) => {
|
|
183
|
+
if (!e.collapsed)
|
|
184
|
+
return null;
|
|
175
185
|
const { startContainer: r, startOffset: o } = e, a = (i) => i instanceof HTMLElement && i.matches(u) ? i : null, c = (i) => {
|
|
176
186
|
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
177
187
|
const l = r;
|
|
@@ -186,7 +196,8 @@ const h = (e, n) => {
|
|
|
186
196
|
let s = r;
|
|
187
197
|
for (; s && s !== n; ) {
|
|
188
198
|
const l = i === "previous" ? s.previousSibling : s.nextSibling;
|
|
189
|
-
if (l)
|
|
199
|
+
if (l)
|
|
200
|
+
return l;
|
|
190
201
|
s = s.parentNode;
|
|
191
202
|
}
|
|
192
203
|
return null;
|
|
@@ -207,10 +218,10 @@ const h = (e, n) => {
|
|
|
207
218
|
}
|
|
208
219
|
}
|
|
209
220
|
return a(c(t === "Backspace" ? "previous" : "next"));
|
|
210
|
-
},
|
|
211
|
-
const t = e.closest(
|
|
221
|
+
}, k = (e, n) => {
|
|
222
|
+
const t = e.closest(f), r = (t == null ? void 0 : t.innerHTML) ?? "", o = e.previousSibling, a = e.nextSibling;
|
|
212
223
|
e.remove();
|
|
213
|
-
const c =
|
|
224
|
+
const c = g(o, "previous"), i = g(a, "next");
|
|
214
225
|
if (n === "Backspace") {
|
|
215
226
|
if (c)
|
|
216
227
|
b(c);
|
|
@@ -229,75 +240,80 @@ const h = (e, n) => {
|
|
|
229
240
|
s.innerHTML = "<br>", t.appendChild(s), d(s);
|
|
230
241
|
}
|
|
231
242
|
return t && (h(t, r), t.dispatchEvent(new Event("input", { bubbles: !0 }))), !0;
|
|
232
|
-
},
|
|
233
|
-
const e =
|
|
234
|
-
if (!e)
|
|
243
|
+
}, D = () => {
|
|
244
|
+
const e = w();
|
|
245
|
+
if (!e)
|
|
246
|
+
return !1;
|
|
235
247
|
const n = e.innerHTML, t = window.getSelection();
|
|
236
|
-
if (!t)
|
|
248
|
+
if (!t)
|
|
249
|
+
return !1;
|
|
237
250
|
let r;
|
|
238
251
|
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 =
|
|
252
|
+
const o = E(r.endContainer, e) || E(r.startContainer, e), a = C();
|
|
240
253
|
o && o.parentNode ? o.parentNode.insertBefore(a, o.nextSibling) : e.appendChild(a), S(a);
|
|
241
254
|
const c = v(a);
|
|
242
255
|
return d(c), h(e, n), e.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
243
|
-
},
|
|
256
|
+
}, R = () => {
|
|
244
257
|
m || typeof document > "u" || (m = !0, document.addEventListener("click", (e) => {
|
|
245
|
-
const
|
|
246
|
-
t && (e.preventDefault(), e.stopPropagation(),
|
|
258
|
+
const n = e.target, t = n == null ? void 0 : n.closest(u);
|
|
259
|
+
t && (e.preventDefault(), e.stopPropagation(), A(t));
|
|
247
260
|
}), document.addEventListener("keydown", (e) => {
|
|
248
261
|
const n = e.key;
|
|
249
262
|
if (!["Backspace", "Delete", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(n))
|
|
250
263
|
return;
|
|
251
264
|
const t = window.getSelection();
|
|
252
|
-
if (!t || t.rangeCount === 0)
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
265
|
+
if (!t || t.rangeCount === 0)
|
|
266
|
+
return;
|
|
267
|
+
const r = t.getRangeAt(0), o = w();
|
|
268
|
+
if (!o || !o.contains(r.commonAncestorContainer))
|
|
269
|
+
return;
|
|
270
|
+
const a = y(r);
|
|
256
271
|
if (a) {
|
|
257
272
|
if (n === "Backspace" || n === "Delete") {
|
|
258
|
-
e.preventDefault(), e.stopPropagation(),
|
|
273
|
+
e.preventDefault(), e.stopPropagation(), k(a, n);
|
|
259
274
|
return;
|
|
260
275
|
}
|
|
261
276
|
if (n === "ArrowRight" || n === "ArrowDown") {
|
|
262
277
|
e.preventDefault();
|
|
263
|
-
const c =
|
|
278
|
+
const c = g(a.nextSibling, "next") || v(a);
|
|
264
279
|
d(c);
|
|
265
280
|
return;
|
|
266
281
|
}
|
|
267
282
|
if (n === "ArrowLeft" || n === "ArrowUp") {
|
|
268
283
|
e.preventDefault();
|
|
269
|
-
const c =
|
|
284
|
+
const c = g(a.previousSibling, "previous");
|
|
270
285
|
c ? b(c) : d(o);
|
|
271
286
|
return;
|
|
272
287
|
}
|
|
273
288
|
}
|
|
274
289
|
if (n === "Backspace" || n === "Delete") {
|
|
275
|
-
const c =
|
|
290
|
+
const c = B(
|
|
276
291
|
r,
|
|
277
292
|
o,
|
|
278
293
|
n
|
|
279
294
|
);
|
|
280
|
-
if (!c)
|
|
281
|
-
|
|
295
|
+
if (!c)
|
|
296
|
+
return;
|
|
297
|
+
e.preventDefault(), e.stopPropagation(), k(c, n);
|
|
282
298
|
}
|
|
283
299
|
}));
|
|
284
|
-
},
|
|
300
|
+
}, P = () => (N(), R(), {
|
|
285
301
|
name: "pageBreak",
|
|
286
302
|
toolbar: [
|
|
287
303
|
{
|
|
288
304
|
label: "Page Break",
|
|
289
305
|
command: "insertPageBreak",
|
|
290
|
-
icon: '<svg
|
|
306
|
+
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>',
|
|
291
307
|
shortcut: "Mod-Enter"
|
|
292
308
|
}
|
|
293
309
|
],
|
|
294
310
|
commands: {
|
|
295
|
-
insertPageBreak:
|
|
311
|
+
insertPageBreak: D
|
|
296
312
|
},
|
|
297
313
|
keymap: {
|
|
298
314
|
"Mod-Enter": "insertPageBreak"
|
|
299
315
|
}
|
|
300
316
|
});
|
|
301
317
|
export {
|
|
302
|
-
|
|
318
|
+
P as PageBreakPlugin
|
|
303
319
|
};
|