@editora/plugins 1.0.8 → 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 +22 -0
- package/dist/approval-workflow.cjs.js +447 -0
- package/dist/approval-workflow.esm.js +1070 -0
- 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/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/enterprise.cjs.js +1 -0
- package/dist/enterprise.esm.js +56 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +109 -81
- package/dist/mentions.cjs.js +105 -0
- package/dist/mentions.esm.js +726 -0
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +32 -32
- 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/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 +798 -0
- package/package.json +104 -5
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,4 +1,4 @@
|
|
|
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
4
|
if (n === e.innerHTML) return;
|
|
@@ -22,7 +22,7 @@ const h = (e, n) => {
|
|
|
22
22
|
"LI",
|
|
23
23
|
"TD",
|
|
24
24
|
"TH"
|
|
25
|
-
]),
|
|
25
|
+
]), C = () => {
|
|
26
26
|
p || typeof document > "u" || (p = document.createElement("style"), p.textContent = `
|
|
27
27
|
.rte-page-break {
|
|
28
28
|
display: block;
|
|
@@ -99,13 +99,13 @@ const h = (e, n) => {
|
|
|
99
99
|
const e = window.getSelection();
|
|
100
100
|
if (!e || e.rangeCount === 0) return null;
|
|
101
101
|
const n = e.getRangeAt(0);
|
|
102
|
-
return (n.startContainer.nodeType === Node.ELEMENT_NODE ? n.startContainer : n.startContainer.parentElement)?.closest(
|
|
103
|
-
},
|
|
102
|
+
return (n.startContainer.nodeType === Node.ELEMENT_NODE ? n.startContainer : n.startContainer.parentElement)?.closest(f) || null;
|
|
103
|
+
}, v = () => {
|
|
104
104
|
const e = N();
|
|
105
105
|
if (e) return e;
|
|
106
|
-
const t = document.activeElement?.closest(
|
|
107
|
-
return t || document.querySelector(
|
|
108
|
-
},
|
|
106
|
+
const t = document.activeElement?.closest(f);
|
|
107
|
+
return t || document.querySelector(f);
|
|
108
|
+
}, E = (e, n) => {
|
|
109
109
|
let t = e;
|
|
110
110
|
for (; t && t !== n; ) {
|
|
111
111
|
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
@@ -130,7 +130,7 @@ const h = (e, n) => {
|
|
|
130
130
|
const r = t;
|
|
131
131
|
t = t.previousElementSibling, r.remove();
|
|
132
132
|
}
|
|
133
|
-
},
|
|
133
|
+
}, w = (e) => {
|
|
134
134
|
const n = e.nextElementSibling;
|
|
135
135
|
if (n && !n.matches(u))
|
|
136
136
|
return n;
|
|
@@ -151,7 +151,7 @@ const h = (e, n) => {
|
|
|
151
151
|
} else
|
|
152
152
|
t.selectNodeContents(e), t.collapse(!1);
|
|
153
153
|
n.removeAllRanges(), n.addRange(t);
|
|
154
|
-
},
|
|
154
|
+
}, g = (e, n) => {
|
|
155
155
|
let t = e;
|
|
156
156
|
for (; t; ) {
|
|
157
157
|
if (!(t instanceof HTMLElement && t.matches(u)))
|
|
@@ -159,18 +159,18 @@ const h = (e, n) => {
|
|
|
159
159
|
t = n === "previous" ? t.previousSibling : t.nextSibling;
|
|
160
160
|
}
|
|
161
161
|
return null;
|
|
162
|
-
},
|
|
162
|
+
}, A = (e) => {
|
|
163
163
|
const n = window.getSelection();
|
|
164
164
|
if (!n || !e.parentNode) return;
|
|
165
165
|
const t = e.parentNode, r = Array.from(t.childNodes).indexOf(e);
|
|
166
166
|
if (r < 0) return;
|
|
167
167
|
const o = document.createRange();
|
|
168
168
|
o.setStart(t, r), o.setEnd(t, r + 1), n.removeAllRanges(), n.addRange(o), e.focus({ preventScroll: !0 });
|
|
169
|
-
},
|
|
169
|
+
}, y = (e) => {
|
|
170
170
|
if (e.collapsed || e.startContainer !== e.endContainer || e.endOffset !== e.startOffset + 1 || !(e.startContainer instanceof Element || e.startContainer instanceof DocumentFragment)) return null;
|
|
171
171
|
const n = e.startContainer.childNodes[e.startOffset];
|
|
172
172
|
return n instanceof HTMLElement && n.matches(u) ? n : null;
|
|
173
|
-
},
|
|
173
|
+
}, B = (e, n, t) => {
|
|
174
174
|
if (!e.collapsed) return null;
|
|
175
175
|
const { startContainer: r, startOffset: o } = e, a = (i) => i instanceof HTMLElement && i.matches(u) ? i : null, c = (i) => {
|
|
176
176
|
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
@@ -207,10 +207,10 @@ const h = (e, n) => {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
return a(c(t === "Backspace" ? "previous" : "next"));
|
|
210
|
-
},
|
|
211
|
-
const t = e.closest(
|
|
210
|
+
}, k = (e, n) => {
|
|
211
|
+
const t = e.closest(f), r = t?.innerHTML ?? "", o = e.previousSibling, a = e.nextSibling;
|
|
212
212
|
e.remove();
|
|
213
|
-
const c =
|
|
213
|
+
const c = g(o, "previous"), i = g(a, "next");
|
|
214
214
|
if (n === "Backspace") {
|
|
215
215
|
if (c)
|
|
216
216
|
b(c);
|
|
@@ -229,75 +229,75 @@ const h = (e, n) => {
|
|
|
229
229
|
s.innerHTML = "<br>", t.appendChild(s), d(s);
|
|
230
230
|
}
|
|
231
231
|
return t && (h(t, r), t.dispatchEvent(new Event("input", { bubbles: !0 }))), !0;
|
|
232
|
-
},
|
|
233
|
-
const e =
|
|
232
|
+
}, D = () => {
|
|
233
|
+
const e = v();
|
|
234
234
|
if (!e) return !1;
|
|
235
235
|
const n = e.innerHTML, t = window.getSelection();
|
|
236
236
|
if (!t) return !1;
|
|
237
237
|
let r;
|
|
238
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 =
|
|
239
|
+
const o = E(r.endContainer, e) || E(r.startContainer, e), a = T();
|
|
240
240
|
o && o.parentNode ? o.parentNode.insertBefore(a, o.nextSibling) : e.appendChild(a), S(a);
|
|
241
|
-
const c =
|
|
241
|
+
const c = w(a);
|
|
242
242
|
return d(c), h(e, n), e.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
243
|
-
},
|
|
243
|
+
}, R = () => {
|
|
244
244
|
m || typeof document > "u" || (m = !0, document.addEventListener("click", (e) => {
|
|
245
245
|
const t = e.target?.closest(u);
|
|
246
|
-
t && (e.preventDefault(), e.stopPropagation(),
|
|
246
|
+
t && (e.preventDefault(), e.stopPropagation(), A(t));
|
|
247
247
|
}), document.addEventListener("keydown", (e) => {
|
|
248
248
|
const n = e.key;
|
|
249
249
|
if (!["Backspace", "Delete", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(n))
|
|
250
250
|
return;
|
|
251
251
|
const t = window.getSelection();
|
|
252
252
|
if (!t || t.rangeCount === 0) return;
|
|
253
|
-
const r = t.getRangeAt(0), o =
|
|
253
|
+
const r = t.getRangeAt(0), o = v();
|
|
254
254
|
if (!o || !o.contains(r.commonAncestorContainer)) return;
|
|
255
|
-
const a =
|
|
255
|
+
const a = y(r);
|
|
256
256
|
if (a) {
|
|
257
257
|
if (n === "Backspace" || n === "Delete") {
|
|
258
|
-
e.preventDefault(), e.stopPropagation(),
|
|
258
|
+
e.preventDefault(), e.stopPropagation(), k(a, n);
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
261
261
|
if (n === "ArrowRight" || n === "ArrowDown") {
|
|
262
262
|
e.preventDefault();
|
|
263
|
-
const c =
|
|
263
|
+
const c = g(a.nextSibling, "next") || w(a);
|
|
264
264
|
d(c);
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
267
|
if (n === "ArrowLeft" || n === "ArrowUp") {
|
|
268
268
|
e.preventDefault();
|
|
269
|
-
const c =
|
|
269
|
+
const c = g(a.previousSibling, "previous");
|
|
270
270
|
c ? b(c) : d(o);
|
|
271
271
|
return;
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
if (n === "Backspace" || n === "Delete") {
|
|
275
|
-
const c =
|
|
275
|
+
const c = B(
|
|
276
276
|
r,
|
|
277
277
|
o,
|
|
278
278
|
n
|
|
279
279
|
);
|
|
280
280
|
if (!c) return;
|
|
281
|
-
e.preventDefault(), e.stopPropagation(),
|
|
281
|
+
e.preventDefault(), e.stopPropagation(), k(c, n);
|
|
282
282
|
}
|
|
283
283
|
}));
|
|
284
|
-
},
|
|
284
|
+
}, P = () => (C(), R(), {
|
|
285
285
|
name: "pageBreak",
|
|
286
286
|
toolbar: [
|
|
287
287
|
{
|
|
288
288
|
label: "Page Break",
|
|
289
289
|
command: "insertPageBreak",
|
|
290
|
-
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>',
|
|
291
291
|
shortcut: "Mod-Enter"
|
|
292
292
|
}
|
|
293
293
|
],
|
|
294
294
|
commands: {
|
|
295
|
-
insertPageBreak:
|
|
295
|
+
insertPageBreak: D
|
|
296
296
|
},
|
|
297
297
|
keymap: {
|
|
298
298
|
"Mod-Enter": "insertPageBreak"
|
|
299
299
|
}
|
|
300
300
|
});
|
|
301
301
|
export {
|
|
302
|
-
|
|
302
|
+
P as PageBreakPlugin
|
|
303
303
|
};
|