@editora/core 1.0.7 → 1.0.8
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/dist/ApprovalWorkflowPlugin.native-C3jtAYjG.mjs +1076 -0
- package/dist/BlocksLibraryPlugin.native-HMWKxWNs.mjs +1327 -0
- package/dist/CitationsPlugin.native-BnU0qCwR.mjs +1464 -0
- package/dist/ConditionalContentPlugin.native-CfhY46rU.mjs +1367 -0
- package/dist/ContentRulesPlugin.native-nBLQ8QFZ.mjs +1099 -0
- package/dist/DataBindingPlugin.native-jQ1JPRTp.mjs +917 -0
- package/dist/DocSchemaPlugin.native-CHOge18O.mjs +1325 -0
- package/dist/MentionPlugin.native-BMDlOqur.mjs +734 -0
- package/dist/PIIRedactionPlugin.native-DcsjmtV1.mjs +1396 -0
- package/dist/{PageBreakPlugin.native-CXdX5fAv.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +37 -37
- package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +30 -30
- package/dist/SlashCommandsPlugin.native-CmxvMEaE.mjs +755 -0
- package/dist/SmartPastePlugin.native-BOKKtF07.mjs +1398 -0
- package/dist/TrackChangesPlugin.native-Bghu2q4a.mjs +761 -0
- package/dist/TranslationWorkflowPlugin.native-Bz6jDGvj.mjs +1728 -0
- package/dist/VersionDiffPlugin.native-Bvxgy--t.mjs +776 -0
- package/dist/editora.min.js +13 -13
- package/dist/editora.umd.js +13 -13
- package/dist/index-D1LOqg5C.js +10 -0
- package/dist/{index-yzU4NdPT.mjs → index-DqC57IEH.mjs} +424 -331
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/plugin-loader.js +77 -40
- package/dist/webcomponent-core.js +479 -386
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +39 -39
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +417 -287
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +5664 -394
- package/package.json +2 -2
- package/dist/index-BpE6GFbz.js +0 -10
|
@@ -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;
|
|
@@ -8,7 +8,7 @@ const h = (e, n) => {
|
|
|
8
8
|
t("recordDomTransaction", e, n, e.innerHTML);
|
|
9
9
|
} catch (r) {
|
|
10
10
|
}
|
|
11
|
-
},
|
|
11
|
+
}, x = /* @__PURE__ */ new Set([
|
|
12
12
|
"DIV",
|
|
13
13
|
"P",
|
|
14
14
|
"BLOCKQUOTE",
|
|
@@ -22,7 +22,7 @@ const h = (e, n) => {
|
|
|
22
22
|
"LI",
|
|
23
23
|
"TD",
|
|
24
24
|
"TH"
|
|
25
|
-
]),
|
|
25
|
+
]), N = () => {
|
|
26
26
|
p || typeof document == "undefined" || (p = document.createElement("style"), p.textContent = `
|
|
27
27
|
.rte-page-break {
|
|
28
28
|
display: block;
|
|
@@ -95,28 +95,28 @@ const h = (e, n) => {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
`, document.head.appendChild(p));
|
|
98
|
-
},
|
|
98
|
+
}, T = () => {
|
|
99
99
|
const e = window.getSelection();
|
|
100
100
|
if (!e || e.rangeCount === 0) return null;
|
|
101
101
|
const n = e.getRangeAt(0), t = n.startContainer.nodeType === Node.ELEMENT_NODE ? n.startContainer : n.startContainer.parentElement;
|
|
102
|
-
return (t == null ? void 0 : t.closest(
|
|
103
|
-
},
|
|
104
|
-
const e =
|
|
102
|
+
return (t == null ? void 0 : t.closest(f)) || null;
|
|
103
|
+
}, w = () => {
|
|
104
|
+
const e = T();
|
|
105
105
|
if (e) return e;
|
|
106
|
-
const n = document.activeElement, t = n == null ? void 0 : n.closest(
|
|
107
|
-
return t || document.querySelector(
|
|
106
|
+
const n = document.activeElement, t = n == null ? void 0 : n.closest(f);
|
|
107
|
+
return t || document.querySelector(f);
|
|
108
108
|
}, E = (e, n) => {
|
|
109
109
|
let t = e;
|
|
110
110
|
for (; t && t !== n; ) {
|
|
111
111
|
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
112
112
|
const r = t;
|
|
113
|
-
if (
|
|
113
|
+
if (x.has(r.tagName))
|
|
114
114
|
return r;
|
|
115
115
|
}
|
|
116
116
|
t = t.parentNode;
|
|
117
117
|
}
|
|
118
118
|
return null;
|
|
119
|
-
},
|
|
119
|
+
}, C = () => {
|
|
120
120
|
const e = document.createElement("div");
|
|
121
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;
|
|
122
122
|
}, S = (e) => {
|
|
@@ -130,7 +130,7 @@ const h = (e, n) => {
|
|
|
130
130
|
const r = t;
|
|
131
131
|
t = t.previousElementSibling, r.remove();
|
|
132
132
|
}
|
|
133
|
-
},
|
|
133
|
+
}, v = (e) => {
|
|
134
134
|
var r;
|
|
135
135
|
const n = e.nextElementSibling;
|
|
136
136
|
if (n && !n.matches(u))
|
|
@@ -152,7 +152,7 @@ const h = (e, n) => {
|
|
|
152
152
|
} else
|
|
153
153
|
t.selectNodeContents(e), t.collapse(!1);
|
|
154
154
|
n.removeAllRanges(), n.addRange(t);
|
|
155
|
-
},
|
|
155
|
+
}, g = (e, n) => {
|
|
156
156
|
let t = e;
|
|
157
157
|
for (; t; ) {
|
|
158
158
|
if (!(t instanceof HTMLElement && t.matches(u)))
|
|
@@ -160,18 +160,18 @@ const h = (e, n) => {
|
|
|
160
160
|
t = n === "previous" ? t.previousSibling : t.nextSibling;
|
|
161
161
|
}
|
|
162
162
|
return null;
|
|
163
|
-
},
|
|
163
|
+
}, A = (e) => {
|
|
164
164
|
const n = window.getSelection();
|
|
165
165
|
if (!n || !e.parentNode) return;
|
|
166
166
|
const t = e.parentNode, r = Array.from(t.childNodes).indexOf(e);
|
|
167
167
|
if (r < 0) return;
|
|
168
168
|
const o = document.createRange();
|
|
169
169
|
o.setStart(t, r), o.setEnd(t, r + 1), n.removeAllRanges(), n.addRange(o), e.focus({ preventScroll: !0 });
|
|
170
|
-
},
|
|
170
|
+
}, y = (e) => {
|
|
171
171
|
if (e.collapsed || e.startContainer !== e.endContainer || e.endOffset !== e.startOffset + 1 || !(e.startContainer instanceof Element || e.startContainer instanceof DocumentFragment)) return null;
|
|
172
172
|
const n = e.startContainer.childNodes[e.startOffset];
|
|
173
173
|
return n instanceof HTMLElement && n.matches(u) ? n : null;
|
|
174
|
-
},
|
|
174
|
+
}, B = (e, n, t) => {
|
|
175
175
|
if (!e.collapsed) return null;
|
|
176
176
|
const { startContainer: r, startOffset: o } = e, a = (i) => i instanceof HTMLElement && i.matches(u) ? i : null, s = (i) => {
|
|
177
177
|
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
@@ -208,11 +208,11 @@ const h = (e, n) => {
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
return a(s(t === "Backspace" ? "previous" : "next"));
|
|
211
|
-
},
|
|
211
|
+
}, k = (e, n) => {
|
|
212
212
|
var c;
|
|
213
|
-
const t = e.closest(
|
|
213
|
+
const t = e.closest(f), r = (c = t == null ? void 0 : t.innerHTML) != null ? c : "", o = e.previousSibling, a = e.nextSibling;
|
|
214
214
|
e.remove();
|
|
215
|
-
const s =
|
|
215
|
+
const s = g(o, "previous"), i = g(a, "next");
|
|
216
216
|
if (n === "Backspace") {
|
|
217
217
|
if (s)
|
|
218
218
|
b(s);
|
|
@@ -231,76 +231,76 @@ const h = (e, n) => {
|
|
|
231
231
|
l.innerHTML = "<br>", t.appendChild(l), d(l);
|
|
232
232
|
}
|
|
233
233
|
return t && (h(t, r), t.dispatchEvent(new Event("input", { bubbles: !0 }))), !0;
|
|
234
|
-
},
|
|
235
|
-
const e =
|
|
234
|
+
}, D = () => {
|
|
235
|
+
const e = w();
|
|
236
236
|
if (!e) return !1;
|
|
237
237
|
const n = e.innerHTML, t = window.getSelection();
|
|
238
238
|
if (!t) return !1;
|
|
239
239
|
let r;
|
|
240
240
|
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));
|
|
241
|
-
const o = E(r.endContainer, e) || E(r.startContainer, e), a =
|
|
241
|
+
const o = E(r.endContainer, e) || E(r.startContainer, e), a = C();
|
|
242
242
|
o && o.parentNode ? o.parentNode.insertBefore(a, o.nextSibling) : e.appendChild(a), S(a);
|
|
243
|
-
const s =
|
|
243
|
+
const s = v(a);
|
|
244
244
|
return d(s), h(e, n), e.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
245
|
-
},
|
|
245
|
+
}, R = () => {
|
|
246
246
|
m || typeof document == "undefined" || (m = !0, document.addEventListener("click", (e) => {
|
|
247
247
|
const n = e.target, t = n == null ? void 0 : n.closest(u);
|
|
248
|
-
t && (e.preventDefault(), e.stopPropagation(),
|
|
248
|
+
t && (e.preventDefault(), e.stopPropagation(), A(t));
|
|
249
249
|
}), document.addEventListener("keydown", (e) => {
|
|
250
250
|
const n = e.key;
|
|
251
251
|
if (!["Backspace", "Delete", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(n))
|
|
252
252
|
return;
|
|
253
253
|
const t = window.getSelection();
|
|
254
254
|
if (!t || t.rangeCount === 0) return;
|
|
255
|
-
const r = t.getRangeAt(0), o =
|
|
255
|
+
const r = t.getRangeAt(0), o = w();
|
|
256
256
|
if (!o || !o.contains(r.commonAncestorContainer)) return;
|
|
257
|
-
const a =
|
|
257
|
+
const a = y(r);
|
|
258
258
|
if (a) {
|
|
259
259
|
if (n === "Backspace" || n === "Delete") {
|
|
260
|
-
e.preventDefault(), e.stopPropagation(),
|
|
260
|
+
e.preventDefault(), e.stopPropagation(), k(a, n);
|
|
261
261
|
return;
|
|
262
262
|
}
|
|
263
263
|
if (n === "ArrowRight" || n === "ArrowDown") {
|
|
264
264
|
e.preventDefault();
|
|
265
|
-
const s =
|
|
265
|
+
const s = g(a.nextSibling, "next") || v(a);
|
|
266
266
|
d(s);
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
269
|
if (n === "ArrowLeft" || n === "ArrowUp") {
|
|
270
270
|
e.preventDefault();
|
|
271
|
-
const s =
|
|
271
|
+
const s = g(a.previousSibling, "previous");
|
|
272
272
|
s ? b(s) : d(o);
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
if (n === "Backspace" || n === "Delete") {
|
|
277
|
-
const s =
|
|
277
|
+
const s = B(
|
|
278
278
|
r,
|
|
279
279
|
o,
|
|
280
280
|
n
|
|
281
281
|
);
|
|
282
282
|
if (!s) return;
|
|
283
|
-
e.preventDefault(), e.stopPropagation(),
|
|
283
|
+
e.preventDefault(), e.stopPropagation(), k(s, n);
|
|
284
284
|
}
|
|
285
285
|
}));
|
|
286
|
-
},
|
|
286
|
+
}, P = () => (N(), R(), {
|
|
287
287
|
name: "pageBreak",
|
|
288
288
|
toolbar: [
|
|
289
289
|
{
|
|
290
290
|
label: "Page Break",
|
|
291
291
|
command: "insertPageBreak",
|
|
292
|
-
icon: '<svg
|
|
292
|
+
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>',
|
|
293
293
|
shortcut: "Mod-Enter"
|
|
294
294
|
}
|
|
295
295
|
],
|
|
296
296
|
commands: {
|
|
297
|
-
insertPageBreak:
|
|
297
|
+
insertPageBreak: D
|
|
298
298
|
},
|
|
299
299
|
keymap: {
|
|
300
300
|
"Mod-Enter": "insertPageBreak"
|
|
301
301
|
}
|
|
302
302
|
});
|
|
303
303
|
export {
|
|
304
|
-
|
|
304
|
+
P as PageBreakPlugin
|
|
305
305
|
};
|
|
306
|
-
//# sourceMappingURL=PageBreakPlugin.native-
|
|
306
|
+
//# sourceMappingURL=PageBreakPlugin.native-DijGuHJZ.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
let c = !1;
|
|
2
2
|
const g = () => {
|
|
3
3
|
if (typeof document == "undefined") return;
|
|
4
|
-
const
|
|
5
|
-
if (document.getElementById(
|
|
4
|
+
const i = "rte-preview-plugin-styles";
|
|
5
|
+
if (document.getElementById(i)) return;
|
|
6
6
|
const t = document.createElement("style");
|
|
7
|
-
t.id =
|
|
7
|
+
t.id = i, t.textContent = `
|
|
8
8
|
/* Preview Editor Dialog Styles */
|
|
9
9
|
.rte-preview-editor-overlay {
|
|
10
10
|
position: fixed !important;
|
|
@@ -225,14 +225,14 @@ const g = () => {
|
|
|
225
225
|
}
|
|
226
226
|
`, document.head.appendChild(t);
|
|
227
227
|
}, v = () => {
|
|
228
|
-
const
|
|
229
|
-
if (
|
|
230
|
-
let e =
|
|
228
|
+
const i = window.getSelection();
|
|
229
|
+
if (i && i.rangeCount > 0) {
|
|
230
|
+
let e = i.getRangeAt(0).startContainer;
|
|
231
231
|
for (; e && e !== document.body; ) {
|
|
232
232
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
235
|
-
return
|
|
233
|
+
const n = e;
|
|
234
|
+
if (n.getAttribute("contenteditable") === "true")
|
|
235
|
+
return n;
|
|
236
236
|
}
|
|
237
237
|
e = e.parentNode;
|
|
238
238
|
}
|
|
@@ -246,36 +246,36 @@ const g = () => {
|
|
|
246
246
|
}
|
|
247
247
|
return document.querySelector('[contenteditable="true"]');
|
|
248
248
|
}, h = () => {
|
|
249
|
-
const
|
|
250
|
-
if (!
|
|
251
|
-
const t =
|
|
249
|
+
const i = v();
|
|
250
|
+
if (!i) return "";
|
|
251
|
+
const t = i.cloneNode(!0);
|
|
252
252
|
return [
|
|
253
253
|
".rte-floating-toolbar",
|
|
254
254
|
".rte-selection-marker",
|
|
255
255
|
".rte-toolbar",
|
|
256
256
|
".rte-resize-handle",
|
|
257
257
|
"[data-rte-internal]"
|
|
258
|
-
].forEach((
|
|
259
|
-
t.querySelectorAll(
|
|
258
|
+
].forEach((n) => {
|
|
259
|
+
t.querySelectorAll(n).forEach((r) => r.remove());
|
|
260
260
|
}), t.innerHTML;
|
|
261
|
-
}, w = (
|
|
261
|
+
}, w = (i) => {
|
|
262
262
|
const t = document.createElement("div");
|
|
263
|
-
return t.innerHTML =
|
|
263
|
+
return t.innerHTML = i, t.querySelectorAll(
|
|
264
264
|
'script, iframe[src^="javascript:"], object, embed, form[action^="javascript:"]'
|
|
265
|
-
).forEach((
|
|
266
|
-
Array.from(
|
|
267
|
-
|
|
268
|
-
});
|
|
265
|
+
).forEach((r) => r.remove()), t.querySelectorAll("*").forEach((r) => {
|
|
266
|
+
Array.from(r.attributes).forEach((o) => {
|
|
267
|
+
o.name.startsWith("on") && r.removeAttribute(o.name), (o.name === "href" || o.name === "src") && o.value.startsWith("javascript:") && r.removeAttribute(o.name), o.name.toLowerCase() === "contenteditable" && r.removeAttribute(o.name);
|
|
268
|
+
}), r.setAttribute("contenteditable", "false");
|
|
269
269
|
}), t.innerHTML;
|
|
270
270
|
}, u = () => {
|
|
271
271
|
if (typeof window == "undefined" || c) return;
|
|
272
272
|
c = !0, g();
|
|
273
|
-
const
|
|
273
|
+
const i = h(), t = w(i), e = document.createElement("div");
|
|
274
274
|
e.className = "rte-preview-editor-overlay", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e.setAttribute("aria-labelledby", "preview-editor-title");
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
|
|
275
|
+
const n = document.createElement("div");
|
|
276
|
+
n.className = "rte-preview-editor-modal";
|
|
277
|
+
const r = document.createElement("div");
|
|
278
|
+
r.className = "rte-preview-editor-header", r.innerHTML = `
|
|
279
279
|
<h2 id="preview-editor-title">Preview Editor</h2>
|
|
280
280
|
<div class="rte-preview-editor-header-actions">
|
|
281
281
|
<button class="rte-preview-editor-close-btn" aria-label="Close preview editor">
|
|
@@ -286,17 +286,17 @@ const g = () => {
|
|
|
286
286
|
</button>
|
|
287
287
|
</div>
|
|
288
288
|
`;
|
|
289
|
-
const
|
|
290
|
-
|
|
289
|
+
const o = document.createElement("div");
|
|
290
|
+
o.className = "rte-preview-editor-body";
|
|
291
291
|
const a = document.createElement("div");
|
|
292
292
|
a.className = "rte-preview-editor-content";
|
|
293
293
|
const l = document.createElement("div");
|
|
294
|
-
l.className = "rte-preview-editor-light-editor", l.innerHTML = t, a.appendChild(l),
|
|
294
|
+
l.className = "rte-preview-editor-light-editor", l.innerHTML = t, a.appendChild(l), o.appendChild(a), n.appendChild(r), n.appendChild(o), e.appendChild(n);
|
|
295
295
|
const p = () => {
|
|
296
296
|
e.parentNode && e.parentNode.removeChild(e), c = !1, document.removeEventListener("keydown", s);
|
|
297
297
|
}, s = (d) => {
|
|
298
298
|
d.key === "Escape" && (d.preventDefault(), d.stopPropagation(), p());
|
|
299
|
-
}, m =
|
|
299
|
+
}, m = r.querySelector(".rte-preview-editor-close-btn");
|
|
300
300
|
m && m.addEventListener("click", (d) => {
|
|
301
301
|
d.preventDefault(), d.stopPropagation(), p();
|
|
302
302
|
}), e.addEventListener("click", (d) => {
|
|
@@ -319,4 +319,4 @@ const g = () => {
|
|
|
319
319
|
export {
|
|
320
320
|
f as PreviewPlugin
|
|
321
321
|
};
|
|
322
|
-
//# sourceMappingURL=PreviewPlugin.native-
|
|
322
|
+
//# sourceMappingURL=PreviewPlugin.native-WuIwOAOR.mjs.map
|