@editora/core 1.0.6 → 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/{AnchorPlugin.native-C1Rw5m04.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +129 -105
- package/dist/ApprovalWorkflowPlugin.native-C3jtAYjG.mjs +1076 -0
- package/dist/{BackgroundColorPlugin.native-BE-p9DRd.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +119 -122
- package/dist/BlocksLibraryPlugin.native-HMWKxWNs.mjs +1327 -0
- package/dist/CitationsPlugin.native-BnU0qCwR.mjs +1464 -0
- package/dist/CodePlugin.native-DlpTPdkd.mjs +2691 -0
- package/dist/{CommentsPlugin.native-tMnWn8a2.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +153 -135
- 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/{DocumentManagerPlugin.native-BvZL5CSG.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +43 -43
- package/dist/{EmbedIframePlugin.native-CSWIB1jm.mjs → EmbedIframePlugin.native-DKJx2OS7.mjs} +61 -58
- package/dist/{EmojisPlugin.native-DxTm_DL-.mjs → EmojisPlugin.native-CitxxlWX.mjs} +135 -104
- package/dist/{LinkPlugin.native-CS2g-G18.mjs → LinkPlugin.native-DYCIcdTm.mjs} +47 -45
- package/dist/{MathPlugin.native-KUxz0o8C.mjs → MathPlugin.native-f_mDp8VL.mjs} +149 -108
- package/dist/{MediaManagerPlugin.native-CgP5iInD.mjs → MediaManagerPlugin.native-BiXiK8FC.mjs} +238 -217
- package/dist/MentionPlugin.native-BMDlOqur.mjs +734 -0
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +559 -0
- package/dist/PIIRedactionPlugin.native-DcsjmtV1.mjs +1396 -0
- package/dist/{PageBreakPlugin.native-CGiQxXqR.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +86 -77
- 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/{SpecialCharactersPlugin.native-DANrbExJ.mjs → SpecialCharactersPlugin.native-CZDato89.mjs} +143 -98
- package/dist/{SpellCheckPlugin.native-C8bPvRHy.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +239 -219
- package/dist/{TemplatePlugin.native-4lKEm-WY.mjs → TemplatePlugin.native-CrpfKRJ8.mjs} +167 -143
- package/dist/{TextColorPlugin.native-Clgtb50j.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +134 -118
- 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/_commonjsHelpers-DOllISpa.mjs +32 -0
- package/dist/anchoredPopover-Bxds0VoB.mjs +110 -0
- package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
- package/dist/editora.min.js +13 -13
- package/dist/editora.umd.js +13 -13
- package/dist/html2canvas.esm-AYkPY5LS.mjs +4803 -0
- package/dist/index-BslAFzmv.mjs +16544 -0
- package/dist/index-D1LOqg5C.js +10 -0
- package/dist/{index-OwnkG39N.mjs → index-DqC57IEH.mjs} +438 -328
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-CuicffkQ.mjs → index.es-BYD2KEo6.mjs} +5 -4
- package/dist/index.esm.js +2 -2
- package/dist/jspdf.es.min-BJGtOnRT.mjs +7890 -0
- package/dist/plugin-loader.js +77 -40
- package/dist/webcomponent-core.js +456 -346
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +87 -107
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +503 -356
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +6003 -658
- package/package.json +2 -2
- package/dist/CodePlugin.native-B263UI8O.mjs +0 -2173
- package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +0 -419
- package/dist/colorSelectionApply-CK1My9N2.mjs +0 -67
- package/dist/documentManager-irzj9n3V.mjs +0 -37627
- package/dist/index-CqWQFb3D.js +0 -10
package/dist/webcomponent.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class P {
|
|
2
2
|
constructor() {
|
|
3
3
|
this.loadedPlugins = /* @__PURE__ */ new Map(), this.pluginRegistry = /* @__PURE__ */ new Map();
|
|
4
4
|
}
|
|
@@ -72,19 +72,19 @@ class x {
|
|
|
72
72
|
return this.loadedPlugins.has(t);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
class
|
|
75
|
+
class v {
|
|
76
76
|
constructor(t, e, o) {
|
|
77
77
|
this.doc = t, this.selection = e, this.schema = o;
|
|
78
78
|
}
|
|
79
79
|
static create(t, e) {
|
|
80
80
|
const o = e || t.node("doc", {}, [t.node("paragraph")]);
|
|
81
|
-
return new
|
|
81
|
+
return new v(o, { anchor: 0, head: 0 }, t);
|
|
82
82
|
}
|
|
83
83
|
apply(t, e) {
|
|
84
|
-
return new
|
|
84
|
+
return new v(t, e || this.selection, this.schema);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
class
|
|
87
|
+
class B {
|
|
88
88
|
constructor(t, e) {
|
|
89
89
|
this.nodes = new Map(Object.entries(t)), this.marks = new Map(Object.entries(e));
|
|
90
90
|
}
|
|
@@ -95,7 +95,7 @@ class E {
|
|
|
95
95
|
return { type: "text", text: t, marks: e };
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
class
|
|
98
|
+
class N {
|
|
99
99
|
constructor() {
|
|
100
100
|
this.plugins = [], this.pluginConfigs = /* @__PURE__ */ new Map();
|
|
101
101
|
}
|
|
@@ -132,7 +132,7 @@ class S {
|
|
|
132
132
|
const t = {}, e = {};
|
|
133
133
|
return this.plugins.forEach((o) => {
|
|
134
134
|
o.nodes && Object.assign(t, o.nodes), o.marks && Object.assign(e, o.marks);
|
|
135
|
-
}), new
|
|
135
|
+
}), new B(t, e);
|
|
136
136
|
}
|
|
137
137
|
getCommands() {
|
|
138
138
|
const t = {};
|
|
@@ -150,9 +150,9 @@ class S {
|
|
|
150
150
|
const r = this.getPlugin(t);
|
|
151
151
|
if (!r)
|
|
152
152
|
throw new Error(`Plugin not found: ${t}`);
|
|
153
|
-
const
|
|
153
|
+
const n = this.getPluginConfig(t) || r.config || {}, a = n.mode || "local";
|
|
154
154
|
try {
|
|
155
|
-
switch (
|
|
155
|
+
switch (a) {
|
|
156
156
|
case "local":
|
|
157
157
|
return r.executeLocal ? r.executeLocal(e, ...o) : null;
|
|
158
158
|
case "api":
|
|
@@ -166,13 +166,13 @@ class S {
|
|
|
166
166
|
if (r.executeAPI)
|
|
167
167
|
return await r.executeAPI(e, ...o);
|
|
168
168
|
} catch (s) {
|
|
169
|
-
if (console.warn(`API execution failed for ${t}, falling back to local`, s), r.executeLocal &&
|
|
169
|
+
if (console.warn(`API execution failed for ${t}, falling back to local`, s), r.executeLocal && n.fallbackToLocal !== !1)
|
|
170
170
|
return r.executeLocal(e, ...o);
|
|
171
171
|
throw s;
|
|
172
172
|
}
|
|
173
173
|
break;
|
|
174
174
|
default:
|
|
175
|
-
throw new Error(`Unknown plugin mode: ${
|
|
175
|
+
throw new Error(`Unknown plugin mode: ${a}`);
|
|
176
176
|
}
|
|
177
177
|
} catch (s) {
|
|
178
178
|
throw console.error(`Error executing command ${e} on plugin ${t}:`, s), s;
|
|
@@ -186,7 +186,7 @@ class S {
|
|
|
186
186
|
await Promise.all(t), this.plugins = [], this.pluginConfigs.clear();
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
class
|
|
189
|
+
class O {
|
|
190
190
|
constructor(t = {}) {
|
|
191
191
|
this.commands = /* @__PURE__ */ new Map(), Object.entries(t).forEach(([e, o]) => {
|
|
192
192
|
this.register(e, o);
|
|
@@ -229,11 +229,11 @@ class A {
|
|
|
229
229
|
this.commands.clear();
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
class
|
|
232
|
+
class R {
|
|
233
233
|
constructor(t = {}) {
|
|
234
|
-
this.listeners = /* @__PURE__ */ new Map(), this.isReadonly = !1, this.isDestroyed = !1, this.isReadonly = t.readonly || !1, this.pluginManager = new
|
|
234
|
+
this.listeners = /* @__PURE__ */ new Map(), this.isReadonly = !1, this.isDestroyed = !1, this.isReadonly = t.readonly || !1, this.pluginManager = new N(), t.plugins && Array.isArray(t.plugins) && t.plugins.forEach((o) => this.pluginManager.register(o));
|
|
235
235
|
const e = this.pluginManager.buildSchema();
|
|
236
|
-
this.state =
|
|
236
|
+
this.state = v.create(e), this.commandRegistry = new O(this.pluginManager.getCommands());
|
|
237
237
|
}
|
|
238
238
|
/**
|
|
239
239
|
* Execute a command
|
|
@@ -247,10 +247,10 @@ class M {
|
|
|
247
247
|
if (!o)
|
|
248
248
|
return console.warn(`Command not found: ${t}`), !1;
|
|
249
249
|
let r;
|
|
250
|
-
return e !== void 0 ? r = o(this.state, e) : r = o(this.state), r instanceof Promise ? (r.then((
|
|
251
|
-
|
|
252
|
-
}).catch((
|
|
253
|
-
console.error(`Async command failed: ${t}`,
|
|
250
|
+
return e !== void 0 ? r = o(this.state, e) : r = o(this.state), r instanceof Promise ? (r.then((n) => {
|
|
251
|
+
n && typeof n == "object" && "doc" in n && "selection" in n && (this.setState(n), this.emit("change", this.state));
|
|
252
|
+
}).catch((n) => {
|
|
253
|
+
console.error(`Async command failed: ${t}`, n);
|
|
254
254
|
}), !0) : r && typeof r == "object" && "doc" in r && "selection" in r ? (this.setState(r), this.emit("change", this.state), !0) : r !== !1 && r != null;
|
|
255
255
|
}
|
|
256
256
|
/**
|
|
@@ -297,8 +297,8 @@ class M {
|
|
|
297
297
|
o && o.forEach((r) => {
|
|
298
298
|
try {
|
|
299
299
|
r(...e);
|
|
300
|
-
} catch (
|
|
301
|
-
console.error(`Error in ${t} handler:`,
|
|
300
|
+
} catch (n) {
|
|
301
|
+
console.error(`Error in ${t} handler:`, n);
|
|
302
302
|
}
|
|
303
303
|
});
|
|
304
304
|
}
|
|
@@ -315,8 +315,13 @@ class M {
|
|
|
315
315
|
return this.isDestroyed;
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
class
|
|
318
|
+
class z {
|
|
319
319
|
// PluginLoader instance to get all registered plugins
|
|
320
|
+
setLastCommandTrigger(t, e) {
|
|
321
|
+
if (typeof window == "undefined" || !t) return;
|
|
322
|
+
const o = e || t.getAttribute("data-command") || void 0;
|
|
323
|
+
o && (window.__editoraLastCommandButton = t, window.__editoraLastCommand = o);
|
|
324
|
+
}
|
|
320
325
|
constructor(t, e, o) {
|
|
321
326
|
this.config = t, this.plugins = e, this.pluginLoader = o;
|
|
322
327
|
}
|
|
@@ -330,11 +335,11 @@ class L {
|
|
|
330
335
|
* Parse toolbar string into button groups
|
|
331
336
|
*/
|
|
332
337
|
parseToolbarString(t) {
|
|
333
|
-
const e = [], o = t.split("|").map((s) => s.trim()), r = this.getAvailableToolbarItems(),
|
|
338
|
+
const e = [], o = t.split("|").map((s) => s.trim()), r = this.getAvailableToolbarItems(), n = /* @__PURE__ */ new Map();
|
|
334
339
|
r.forEach((s) => {
|
|
335
|
-
s.command &&
|
|
340
|
+
s.command && n.set(s.command, s), s.type === "group" && s.label && n.set(s.label, s);
|
|
336
341
|
});
|
|
337
|
-
const
|
|
342
|
+
const a = {
|
|
338
343
|
bold: "toggleBold",
|
|
339
344
|
italic: "toggleItalic",
|
|
340
345
|
underline: "toggleUnderline",
|
|
@@ -345,6 +350,9 @@ class L {
|
|
|
345
350
|
link: "openLinkDialog",
|
|
346
351
|
image: "openImageDialog",
|
|
347
352
|
table: "insertTable",
|
|
353
|
+
trackChanges: "toggleTrackChanges",
|
|
354
|
+
acceptTrackChanges: "acceptAllTrackChanges",
|
|
355
|
+
rejectTrackChanges: "rejectAllTrackChanges",
|
|
348
356
|
anchor: "insertAnchor",
|
|
349
357
|
code: "toggleSourceView",
|
|
350
358
|
blockquote: "toggleBlockquote",
|
|
@@ -376,6 +384,14 @@ class L {
|
|
|
376
384
|
toggleComments: "toggleComments",
|
|
377
385
|
footnote: "insertFootnote",
|
|
378
386
|
mergeTags: "insertMergeTag",
|
|
387
|
+
dataBinding: "openDataBindingDialog",
|
|
388
|
+
dataBindingPreview: "openDataBindingDialog",
|
|
389
|
+
contentRules: "toggleContentRulesPanel",
|
|
390
|
+
contentRulesAudit: "runContentRulesAudit",
|
|
391
|
+
contentRulesRealtime: "toggleContentRulesRealtime",
|
|
392
|
+
mention: "insertMention",
|
|
393
|
+
slash: "openSlashCommands",
|
|
394
|
+
slashCommands: "openSlashCommands",
|
|
379
395
|
pageBreak: "insertPageBreak",
|
|
380
396
|
template: "insertTemplate",
|
|
381
397
|
importWord: "importWord",
|
|
@@ -389,7 +405,7 @@ class L {
|
|
|
389
405
|
const l = [];
|
|
390
406
|
s.split(/\s+/).filter(Boolean).forEach((d) => {
|
|
391
407
|
if (d === "direction") {
|
|
392
|
-
const u =
|
|
408
|
+
const u = n.get("setDirectionLTR"), f = n.get("setDirectionRTL");
|
|
393
409
|
u && l.push({
|
|
394
410
|
id: "directionLTR",
|
|
395
411
|
label: u.label,
|
|
@@ -397,18 +413,18 @@ class L {
|
|
|
397
413
|
icon: u.icon,
|
|
398
414
|
type: u.type || "button",
|
|
399
415
|
options: u.options
|
|
400
|
-
}),
|
|
416
|
+
}), f && l.push({
|
|
401
417
|
id: "directionRTL",
|
|
402
|
-
label:
|
|
403
|
-
command:
|
|
404
|
-
icon:
|
|
405
|
-
type:
|
|
406
|
-
options:
|
|
418
|
+
label: f.label,
|
|
419
|
+
command: f.command,
|
|
420
|
+
icon: f.icon,
|
|
421
|
+
type: f.type || "button",
|
|
422
|
+
options: f.options
|
|
407
423
|
});
|
|
408
424
|
return;
|
|
409
425
|
}
|
|
410
426
|
if (d === "comments") {
|
|
411
|
-
const u =
|
|
427
|
+
const u = n.get("addComment"), f = n.get("toggleComments");
|
|
412
428
|
u && l.push({
|
|
413
429
|
id: "addComment",
|
|
414
430
|
label: u.label,
|
|
@@ -416,26 +432,26 @@ class L {
|
|
|
416
432
|
icon: u.icon,
|
|
417
433
|
type: u.type || "button",
|
|
418
434
|
options: u.options
|
|
419
|
-
}),
|
|
435
|
+
}), f && l.push({
|
|
420
436
|
id: "toggleComments",
|
|
421
|
-
label:
|
|
422
|
-
command:
|
|
423
|
-
icon:
|
|
424
|
-
type:
|
|
425
|
-
options:
|
|
437
|
+
label: f.label,
|
|
438
|
+
command: f.command,
|
|
439
|
+
icon: f.icon,
|
|
440
|
+
type: f.type || "button",
|
|
441
|
+
options: f.options
|
|
426
442
|
});
|
|
427
443
|
return;
|
|
428
444
|
}
|
|
429
|
-
const
|
|
430
|
-
let
|
|
431
|
-
|
|
445
|
+
const h = a[d] || d;
|
|
446
|
+
let p = n.get(h);
|
|
447
|
+
p || (p = n.get(d)), p && l.push({
|
|
432
448
|
id: d,
|
|
433
|
-
label:
|
|
434
|
-
command:
|
|
435
|
-
icon:
|
|
436
|
-
type:
|
|
437
|
-
options:
|
|
438
|
-
items:
|
|
449
|
+
label: p.label,
|
|
450
|
+
command: p.command,
|
|
451
|
+
icon: p.icon,
|
|
452
|
+
type: p.type === "separator" ? "separator" : p.type || "button",
|
|
453
|
+
options: p.options,
|
|
454
|
+
items: p.items
|
|
439
455
|
});
|
|
440
456
|
}), l.length > 0 && e.push(l);
|
|
441
457
|
}), e;
|
|
@@ -452,11 +468,11 @@ class L {
|
|
|
452
468
|
render(t) {
|
|
453
469
|
this.container = t, t.innerHTML = "", t.className = "editora-toolbar", this.config.sticky && t.classList.add("editora-toolbar-sticky"), this.config.position && t.classList.add(`editora-toolbar-${this.config.position}`);
|
|
454
470
|
const e = this.config.items || this.getDefaultToolbarString(), o = this.parseToolbarString(e);
|
|
455
|
-
o.forEach((r,
|
|
456
|
-
const
|
|
457
|
-
if (
|
|
458
|
-
this.appendToolbarButton(
|
|
459
|
-
}), t.appendChild(
|
|
471
|
+
o.forEach((r, n) => {
|
|
472
|
+
const a = document.createElement("div");
|
|
473
|
+
if (a.className = "editora-toolbar-group", r.forEach((s) => {
|
|
474
|
+
this.appendToolbarButton(a, s);
|
|
475
|
+
}), t.appendChild(a), n < o.length - 1) {
|
|
460
476
|
const s = document.createElement("div");
|
|
461
477
|
s.className = "editora-toolbar-separator", t.appendChild(s);
|
|
462
478
|
}
|
|
@@ -490,18 +506,18 @@ class L {
|
|
|
490
506
|
* Create a toolbar button element
|
|
491
507
|
*/
|
|
492
508
|
createGroupButton(t) {
|
|
493
|
-
const e = document.createElement("div");
|
|
494
|
-
if (e.className =
|
|
509
|
+
const e = document.createElement("div"), o = t.label.toLowerCase().replace(/\s+/g, "-");
|
|
510
|
+
if (e.className = `editora-toolbar-group-button ${o}`, e.title = t.label, t.icon)
|
|
495
511
|
if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
|
|
496
|
-
const
|
|
497
|
-
|
|
512
|
+
const r = document.createElement("span");
|
|
513
|
+
r.className = "editora-toolbar-icon", r.innerHTML = t.icon, e.appendChild(r);
|
|
498
514
|
} else
|
|
499
515
|
e.innerHTML = t.icon;
|
|
500
516
|
if (t.items && t.items.length) {
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
this.appendToolbarButton(
|
|
504
|
-
}), e.appendChild(
|
|
517
|
+
const r = document.createElement("div");
|
|
518
|
+
r.className = `editora-toolbar-group-items ${o}`, t.items.forEach((n) => {
|
|
519
|
+
this.appendToolbarButton(r, n);
|
|
520
|
+
}), e.appendChild(r);
|
|
505
521
|
}
|
|
506
522
|
return e;
|
|
507
523
|
}
|
|
@@ -511,7 +527,7 @@ class L {
|
|
|
511
527
|
createInput(t) {
|
|
512
528
|
const e = document.createElement("input");
|
|
513
529
|
return e.className = `editora-toolbar-input ${t.label.toLowerCase().replace(/\s+/g, "-")}`, e.type = "text", e.title = t.label, e.placeholder = t.placeholder || "", t.command && e.setAttribute("data-command", t.command), t.active && e.classList.add("active"), t.disabled && (e.disabled = !0), e.addEventListener("click", (o) => {
|
|
514
|
-
o.preventDefault(), this.commandHandler && t.command && this.commandHandler(t.command);
|
|
530
|
+
o.preventDefault(), this.setLastCommandTrigger(e, t.command), this.commandHandler && t.command && this.commandHandler(t.command);
|
|
515
531
|
}), e;
|
|
516
532
|
}
|
|
517
533
|
/**
|
|
@@ -540,21 +556,23 @@ class L {
|
|
|
540
556
|
const o = document.createElement("button");
|
|
541
557
|
o.className = "editora-toolbar-button editora-toolbar-dropdown-trigger", o.type = "button", o.textContent = t.label;
|
|
542
558
|
const r = document.createElement("div");
|
|
543
|
-
r.className = "editora-toolbar-dropdown-menu", r.style.display = "none", t.options && t.options.forEach((
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
}), r.appendChild(
|
|
548
|
-
}), o.addEventListener("click", (
|
|
549
|
-
|
|
550
|
-
const
|
|
551
|
-
r.style.display =
|
|
559
|
+
r.className = "editora-toolbar-dropdown-menu", r.style.display = "none", t.options && t.options.forEach((s) => {
|
|
560
|
+
const l = document.createElement("button");
|
|
561
|
+
l.className = "editora-toolbar-dropdown-item", l.type = "button", l.textContent = s.label, l.setAttribute("data-value", s.value), l.addEventListener("click", (c) => {
|
|
562
|
+
c.preventDefault(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, s.value), r.style.display = "none";
|
|
563
|
+
}), r.appendChild(l);
|
|
564
|
+
}), o.addEventListener("click", (s) => {
|
|
565
|
+
s.preventDefault(), s.stopPropagation(), this.setLastCommandTrigger(o, t.command);
|
|
566
|
+
const l = r.style.display === "block";
|
|
567
|
+
r.style.display = l ? "none" : "block";
|
|
552
568
|
});
|
|
553
|
-
const
|
|
554
|
-
e.contains(
|
|
569
|
+
const n = (s) => {
|
|
570
|
+
e.contains(s.target) || (r.style.display = "none");
|
|
571
|
+
}, a = (s) => {
|
|
572
|
+
s.key === "Escape" && (r.style.display = "none");
|
|
555
573
|
};
|
|
556
|
-
return document.addEventListener("
|
|
557
|
-
document.removeEventListener("
|
|
574
|
+
return document.addEventListener("mousedown", n, !0), document.addEventListener("keydown", a), e._cleanupDropdown = () => {
|
|
575
|
+
document.removeEventListener("mousedown", n, !0), document.removeEventListener("keydown", a);
|
|
558
576
|
}, e.appendChild(o), e.appendChild(r), e;
|
|
559
577
|
}
|
|
560
578
|
/**
|
|
@@ -566,30 +584,36 @@ class L {
|
|
|
566
584
|
const o = document.createElement("button");
|
|
567
585
|
if (o.className = "editora-toolbar-button", o.type = "button", o.title = t.label, t.icon)
|
|
568
586
|
if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
|
|
569
|
-
const
|
|
570
|
-
|
|
587
|
+
const s = document.createElement("span");
|
|
588
|
+
s.className = "editora-toolbar-icon", s.innerHTML = t.icon, o.appendChild(s);
|
|
571
589
|
} else
|
|
572
590
|
o.innerHTML = t.icon;
|
|
573
591
|
else
|
|
574
592
|
o.textContent = t.label;
|
|
575
593
|
const r = document.createElement("div");
|
|
576
|
-
|
|
577
|
-
const
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
}), r.appendChild(
|
|
581
|
-
}), o.addEventListener("click", (
|
|
582
|
-
var
|
|
583
|
-
|
|
584
|
-
const
|
|
594
|
+
r.className = "editora-toolbar-dropdown-menu", r.style.display = "none", t.options && t.options.forEach((s) => {
|
|
595
|
+
const l = document.createElement("button");
|
|
596
|
+
l.className = "editora-toolbar-dropdown-item", l.type = "button", l.textContent = s.label, l.setAttribute("data-value", s.value), l.addEventListener("click", (c) => {
|
|
597
|
+
c.preventDefault(), c.stopPropagation(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, s.value), r.style.display = "none";
|
|
598
|
+
}), r.appendChild(l);
|
|
599
|
+
}), o.addEventListener("click", (s) => {
|
|
600
|
+
var c;
|
|
601
|
+
s.preventDefault(), s.stopPropagation(), this.setLastCommandTrigger(o, t.command);
|
|
602
|
+
const l = (c = this.container) == null ? void 0 : c.querySelectorAll(
|
|
585
603
|
".editora-toolbar-dropdown-menu"
|
|
586
604
|
);
|
|
587
|
-
|
|
588
|
-
|
|
605
|
+
l == null || l.forEach((d) => {
|
|
606
|
+
d !== r && (d.style.display = "none");
|
|
589
607
|
}), r.style.display = r.style.display === "none" ? "block" : "none";
|
|
590
|
-
})
|
|
591
|
-
|
|
592
|
-
|
|
608
|
+
});
|
|
609
|
+
const n = (s) => {
|
|
610
|
+
e.contains(s.target) || (r.style.display = "none");
|
|
611
|
+
}, a = (s) => {
|
|
612
|
+
s.key === "Escape" && (r.style.display = "none");
|
|
613
|
+
};
|
|
614
|
+
return document.addEventListener("mousedown", n, !0), document.addEventListener("keydown", a), e._cleanupDropdown = () => {
|
|
615
|
+
document.removeEventListener("mousedown", n, !0), document.removeEventListener("keydown", a);
|
|
616
|
+
}, e.appendChild(o), e.appendChild(r), e;
|
|
593
617
|
}
|
|
594
618
|
/**
|
|
595
619
|
* Get default toolbar string if none provided
|
|
@@ -617,7 +641,7 @@ class L {
|
|
|
617
641
|
}), this.container.innerHTML = ""), this.commandHandler = void 0;
|
|
618
642
|
}
|
|
619
643
|
}
|
|
620
|
-
class
|
|
644
|
+
class H {
|
|
621
645
|
constructor(t) {
|
|
622
646
|
this.visible = !1, this.config = t;
|
|
623
647
|
}
|
|
@@ -659,7 +683,7 @@ class T {
|
|
|
659
683
|
this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0, this.visible = !1;
|
|
660
684
|
}
|
|
661
685
|
}
|
|
662
|
-
class
|
|
686
|
+
class j {
|
|
663
687
|
constructor(t = {}) {
|
|
664
688
|
this.statusInfo = {}, this.config = t;
|
|
665
689
|
}
|
|
@@ -688,25 +712,25 @@ class I {
|
|
|
688
712
|
e.className = "editora-statusbar-right";
|
|
689
713
|
const o = [];
|
|
690
714
|
if (this.statusInfo.selectionInfo) {
|
|
691
|
-
const
|
|
692
|
-
|
|
715
|
+
const n = this.statusInfo.selectionInfo;
|
|
716
|
+
n.startLine === n.endLine && n.startColumn === n.endColumn ? o.push(`Ln ${n.startLine}, Col ${n.startColumn}`) : (n.startLine === n.endLine ? o.push(`Ln ${n.startLine}, Col ${n.startColumn}-${n.endColumn}`) : o.push(`Ln ${n.startLine}:${n.startColumn} - ${n.endLine}:${n.endColumn}`), o.push(`${n.selectedChars} chars selected`));
|
|
693
717
|
} else if (this.statusInfo.cursorPosition) {
|
|
694
|
-
const
|
|
695
|
-
o.push(`Ln ${
|
|
718
|
+
const n = this.statusInfo.cursorPosition;
|
|
719
|
+
o.push(`Ln ${n.line}, Col ${n.column}`);
|
|
696
720
|
}
|
|
697
721
|
this.statusInfo.language && o.push(this.statusInfo.language);
|
|
698
722
|
const r = [];
|
|
699
|
-
this.statusInfo.wordCount !== void 0 && r.push(`${this.statusInfo.wordCount} words`), this.statusInfo.charCount !== void 0 && r.push(`${this.statusInfo.charCount} chars`), this.statusInfo.lineCount !== void 0 && r.push(`${this.statusInfo.lineCount} lines`), this.statusInfo.custom && Object.entries(this.statusInfo.custom).forEach(([
|
|
700
|
-
r.push(`${
|
|
701
|
-
}), o.forEach((
|
|
723
|
+
this.statusInfo.wordCount !== void 0 && r.push(`${this.statusInfo.wordCount} words`), this.statusInfo.charCount !== void 0 && r.push(`${this.statusInfo.charCount} chars`), this.statusInfo.lineCount !== void 0 && r.push(`${this.statusInfo.lineCount} lines`), this.statusInfo.custom && Object.entries(this.statusInfo.custom).forEach(([n, a]) => {
|
|
724
|
+
r.push(`${n}: ${a}`);
|
|
725
|
+
}), o.forEach((n, a) => {
|
|
702
726
|
const s = document.createElement("span");
|
|
703
|
-
if (s.className = "editora-statusbar-item", s.textContent =
|
|
727
|
+
if (s.className = "editora-statusbar-item", s.textContent = n, t.appendChild(s), a < o.length - 1) {
|
|
704
728
|
const l = document.createElement("span");
|
|
705
729
|
l.className = "editora-statusbar-separator", l.textContent = "|", t.appendChild(l);
|
|
706
730
|
}
|
|
707
|
-
}), r.forEach((
|
|
731
|
+
}), r.forEach((n, a) => {
|
|
708
732
|
const s = document.createElement("span");
|
|
709
|
-
if (s.className = "editora-statusbar-item", s.textContent =
|
|
733
|
+
if (s.className = "editora-statusbar-item", s.textContent = n, e.appendChild(s), a < r.length - 1) {
|
|
710
734
|
const l = document.createElement("span");
|
|
711
735
|
l.className = "editora-statusbar-separator", l.textContent = "|", e.appendChild(l);
|
|
712
736
|
}
|
|
@@ -719,50 +743,50 @@ class I {
|
|
|
719
743
|
this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0;
|
|
720
744
|
}
|
|
721
745
|
}
|
|
722
|
-
function
|
|
723
|
-
const e =
|
|
724
|
-
`),
|
|
725
|
-
return { line:
|
|
746
|
+
function F(i, t) {
|
|
747
|
+
const e = i.textContent || "", o = $(i, t.startContainer, t.startOffset), n = e.substring(0, o).split(`
|
|
748
|
+
`), a = n.length, s = n[n.length - 1].length + 1;
|
|
749
|
+
return { line: a, column: s };
|
|
726
750
|
}
|
|
727
|
-
function
|
|
728
|
-
var
|
|
751
|
+
function $(i, t, e) {
|
|
752
|
+
var a;
|
|
729
753
|
let o = 0;
|
|
730
754
|
const r = document.createTreeWalker(
|
|
731
|
-
|
|
755
|
+
i,
|
|
732
756
|
NodeFilter.SHOW_TEXT,
|
|
733
757
|
null
|
|
734
758
|
);
|
|
735
|
-
let
|
|
736
|
-
for (;
|
|
737
|
-
if (
|
|
759
|
+
let n = r.firstChild();
|
|
760
|
+
for (; n; ) {
|
|
761
|
+
if (n === t) {
|
|
738
762
|
o += e;
|
|
739
763
|
break;
|
|
740
|
-
} else
|
|
741
|
-
|
|
764
|
+
} else n.nodeType === Node.TEXT_NODE && (o += ((a = n.textContent) == null ? void 0 : a.length) || 0);
|
|
765
|
+
n = r.nextNode();
|
|
742
766
|
}
|
|
743
767
|
return o;
|
|
744
768
|
}
|
|
745
|
-
function
|
|
769
|
+
function W(i) {
|
|
746
770
|
var o, r;
|
|
747
|
-
const t =
|
|
771
|
+
const t = i.querySelectorAll("div, p, br, h1, h2, h3, h4, h5, h6, blockquote, li, pre");
|
|
748
772
|
let e = 1;
|
|
749
773
|
if (t.length > 0) {
|
|
750
774
|
e = t.length;
|
|
751
|
-
const
|
|
752
|
-
(
|
|
775
|
+
const n = t[t.length - 1];
|
|
776
|
+
(n.tagName === "BR" || ((o = n.innerHTML) == null ? void 0 : o.trim()) === "" || ((r = n.textContent) == null ? void 0 : r.trim()) === "") && e++;
|
|
753
777
|
} else {
|
|
754
|
-
const
|
|
778
|
+
const a = (i.textContent || "").split(`
|
|
755
779
|
`).length;
|
|
756
|
-
e = Math.max(1,
|
|
780
|
+
e = Math.max(1, a);
|
|
757
781
|
}
|
|
758
782
|
return e;
|
|
759
783
|
}
|
|
760
|
-
function
|
|
761
|
-
const t =
|
|
784
|
+
function _(i) {
|
|
785
|
+
const t = i.trim() ? i.trim().split(/\s+/).length : 0, e = i.length;
|
|
762
786
|
return { words: t, chars: e };
|
|
763
787
|
}
|
|
764
|
-
function
|
|
765
|
-
const e =
|
|
788
|
+
function U(i, t) {
|
|
789
|
+
const e = i.toString();
|
|
766
790
|
return {
|
|
767
791
|
startLine: t.line,
|
|
768
792
|
startColumn: t.column,
|
|
@@ -773,7 +797,7 @@ function B(a, t) {
|
|
|
773
797
|
selectedWords: e.trim().split(/\s+/).filter(Boolean).length
|
|
774
798
|
};
|
|
775
799
|
}
|
|
776
|
-
class
|
|
800
|
+
class K {
|
|
777
801
|
constructor(t) {
|
|
778
802
|
this.shortcuts = /* @__PURE__ */ new Map(), this.enabled = !0, this.isMac = typeof navigator != "undefined" && navigator.platform.toUpperCase().indexOf("MAC") >= 0, (t == null ? void 0 : t.enabled) === !1 && (this.enabled = !1), this.registerDefaultShortcuts(), t != null && t.shortcuts && t.shortcuts.forEach((e) => this.registerShortcut(e)), t != null && t.customShortcuts && Object.values(t.customShortcuts).forEach((e) => {
|
|
779
803
|
this.registerShortcut(e);
|
|
@@ -1087,18 +1111,18 @@ class O {
|
|
|
1087
1111
|
getShortcutsHelp() {
|
|
1088
1112
|
const t = this.getAllShortcuts(), e = /* @__PURE__ */ new Map();
|
|
1089
1113
|
t.forEach((r) => {
|
|
1090
|
-
const
|
|
1091
|
-
e.has(
|
|
1114
|
+
const n = this.getShortcutCategory(r.command);
|
|
1115
|
+
e.has(n) || e.set(n, []), e.get(n).push(r);
|
|
1092
1116
|
});
|
|
1093
1117
|
let o = `# Keyboard Shortcuts
|
|
1094
1118
|
|
|
1095
1119
|
`;
|
|
1096
|
-
return e.forEach((r,
|
|
1097
|
-
o += `## ${
|
|
1120
|
+
return e.forEach((r, n) => {
|
|
1121
|
+
o += `## ${n}
|
|
1098
1122
|
|
|
1099
|
-
`, r.forEach((
|
|
1100
|
-
const s = this.getShortcutDescription(
|
|
1101
|
-
o += `- **${s}**: ${
|
|
1123
|
+
`, r.forEach((a) => {
|
|
1124
|
+
const s = this.getShortcutDescription(a);
|
|
1125
|
+
o += `- **${s}**: ${a.description || a.command}
|
|
1102
1126
|
`;
|
|
1103
1127
|
}), o += `
|
|
1104
1128
|
`;
|
|
@@ -1108,7 +1132,7 @@ class O {
|
|
|
1108
1132
|
return t.includes("toggle") && (t.includes("Bold") || t.includes("Italic") || t.includes("Underline") || t.includes("Strike") || t.includes("Code") || t.includes("Super") || t.includes("Sub")) ? "Text Formatting" : t.includes("Heading") || t.includes("Paragraph") ? "Block Formatting" : t.includes("List") || t.includes("Checklist") ? "Lists" : t.includes("Alignment") || t.includes("Indent") ? "Alignment & Indentation" : t.includes("undo") || t.includes("redo") ? "History" : t.includes("insert") ? "Insert" : t.includes("find") || t.includes("replace") ? "Find & Replace" : t.includes("Accessibility") || t.includes("spell") ? "Tools" : "Other";
|
|
1109
1133
|
}
|
|
1110
1134
|
}
|
|
1111
|
-
const
|
|
1135
|
+
const q = [
|
|
1112
1136
|
"p",
|
|
1113
1137
|
"br",
|
|
1114
1138
|
"strong",
|
|
@@ -1143,11 +1167,12 @@ const H = [
|
|
|
1143
1167
|
"code",
|
|
1144
1168
|
"span",
|
|
1145
1169
|
"div",
|
|
1170
|
+
"section",
|
|
1146
1171
|
"sup",
|
|
1147
1172
|
"sub",
|
|
1148
1173
|
"hr"
|
|
1149
|
-
],
|
|
1150
|
-
"*": ["class", "style", "id", "data-*"],
|
|
1174
|
+
], V = {
|
|
1175
|
+
"*": ["class", "style", "id", "data-*", "role", "aria-*", "tabindex", "contenteditable", "spellcheck"],
|
|
1151
1176
|
a: ["href", "target", "rel", "title"],
|
|
1152
1177
|
img: ["src", "alt", "width", "height", "loading"],
|
|
1153
1178
|
video: ["src", "controls", "width", "height", "autoplay", "loop", "muted"],
|
|
@@ -1156,51 +1181,51 @@ const H = [
|
|
|
1156
1181
|
td: ["colspan", "rowspan", "align", "valign"],
|
|
1157
1182
|
th: ["colspan", "rowspan", "align", "valign"]
|
|
1158
1183
|
};
|
|
1159
|
-
function
|
|
1184
|
+
function I(i, t, e) {
|
|
1160
1185
|
if ((t == null ? void 0 : t.sanitize) === !1)
|
|
1161
|
-
return
|
|
1162
|
-
const o = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags :
|
|
1163
|
-
return
|
|
1186
|
+
return i;
|
|
1187
|
+
const o = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags : q, n = !!(t != null && t.allowedAttributes) && Object.keys(t.allowedAttributes).length > 0 ? t.allowedAttributes : V, a = document.createElement("div");
|
|
1188
|
+
return a.innerHTML = i, D(a, o, n), a.innerHTML;
|
|
1164
1189
|
}
|
|
1165
|
-
function
|
|
1166
|
-
const o = Array.from(
|
|
1190
|
+
function D(i, t, e) {
|
|
1191
|
+
const o = Array.from(i.childNodes);
|
|
1167
1192
|
for (const r of o)
|
|
1168
1193
|
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
1169
|
-
const
|
|
1170
|
-
if (!t.includes(
|
|
1171
|
-
for (;
|
|
1172
|
-
|
|
1173
|
-
|
|
1194
|
+
const n = r, a = n.tagName.toLowerCase();
|
|
1195
|
+
if (!t.includes(a)) {
|
|
1196
|
+
for (; n.firstChild; )
|
|
1197
|
+
i.insertBefore(n.firstChild, n);
|
|
1198
|
+
i.removeChild(n);
|
|
1174
1199
|
continue;
|
|
1175
1200
|
}
|
|
1176
|
-
|
|
1177
|
-
} else r.nodeType !== Node.TEXT_NODE &&
|
|
1201
|
+
G(n, e), D(n, t, e);
|
|
1202
|
+
} else r.nodeType !== Node.TEXT_NODE && i.removeChild(r);
|
|
1178
1203
|
}
|
|
1179
|
-
function
|
|
1180
|
-
const e =
|
|
1204
|
+
function G(i, t) {
|
|
1205
|
+
const e = i.tagName.toLowerCase(), o = Array.from(i.attributes), r = t[e] || [], n = t["*"] || [], a = [...r, ...n];
|
|
1181
1206
|
for (const s of o) {
|
|
1182
1207
|
const l = s.name.toLowerCase();
|
|
1183
1208
|
let c = !1;
|
|
1184
|
-
|
|
1185
|
-
for (const d of
|
|
1209
|
+
a.includes(l) && (c = !0);
|
|
1210
|
+
for (const d of a)
|
|
1186
1211
|
if (d.endsWith("*")) {
|
|
1187
|
-
const
|
|
1188
|
-
if (l.startsWith(
|
|
1212
|
+
const h = d.slice(0, -1);
|
|
1213
|
+
if (l.startsWith(h)) {
|
|
1189
1214
|
c = !0;
|
|
1190
1215
|
break;
|
|
1191
1216
|
}
|
|
1192
1217
|
}
|
|
1193
|
-
(l.startsWith("on") || l === "javascript:" || l === "href" && s.value.trim().toLowerCase().startsWith("javascript:") || l === "src" && s.value.trim().toLowerCase().startsWith("javascript:")) && (c = !1), c ||
|
|
1218
|
+
(l.startsWith("on") || l === "javascript:" || l === "href" && s.value.trim().toLowerCase().startsWith("javascript:") || l === "src" && s.value.trim().toLowerCase().startsWith("javascript:")) && (c = !1), c || i.removeAttribute(s.name);
|
|
1194
1219
|
}
|
|
1195
|
-
|
|
1220
|
+
i.hasAttribute("href") && (i.getAttribute("href") || "").trim().toLowerCase().startsWith("javascript:") && i.removeAttribute("href"), i.hasAttribute("src") && (i.getAttribute("src") || "").trim().toLowerCase().startsWith("javascript:") && i.removeAttribute("src");
|
|
1196
1221
|
}
|
|
1197
|
-
function
|
|
1198
|
-
return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ?
|
|
1222
|
+
function X(i, t, e) {
|
|
1223
|
+
return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ? i : I(i, t);
|
|
1199
1224
|
}
|
|
1200
|
-
function
|
|
1201
|
-
return (e == null ? void 0 : e.sanitizeOnInput) === !1 ?
|
|
1225
|
+
function Y(i, t, e) {
|
|
1226
|
+
return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? i : I(i, t);
|
|
1202
1227
|
}
|
|
1203
|
-
const
|
|
1228
|
+
const S = class S {
|
|
1204
1229
|
/**
|
|
1205
1230
|
* Resolve configuration from multiple sources with priority
|
|
1206
1231
|
*/
|
|
@@ -1218,12 +1243,12 @@ const k = class k {
|
|
|
1218
1243
|
static normalizeConfig(t) {
|
|
1219
1244
|
const e = { ...t };
|
|
1220
1245
|
if (e.toolbarFloating !== void 0 || e.toolbarSticky !== void 0) {
|
|
1221
|
-
const
|
|
1222
|
-
e.toolbarFloating !== void 0 && (
|
|
1246
|
+
const a = typeof e.toolbar == "object" && e.toolbar ? { ...e.toolbar } : typeof e.toolbar == "string" ? { items: e.toolbar } : {};
|
|
1247
|
+
e.toolbarFloating !== void 0 && (a.floating = !!e.toolbarFloating), e.toolbarSticky !== void 0 && (a.sticky = !!e.toolbarSticky), e.toolbar = a;
|
|
1223
1248
|
}
|
|
1224
1249
|
if (e.toolbarItems !== void 0 && typeof e.toolbar == "object" && e.toolbar && (e.toolbar.items = e.toolbarItems), e.autosaveEnabled !== void 0 || e.autosaveIntervalMs !== void 0 || e.autosaveStorageKey !== void 0 || e.autosaveProvider !== void 0 || e.autosaveApiUrl !== void 0) {
|
|
1225
|
-
const
|
|
1226
|
-
e.autosaveEnabled !== void 0 && (
|
|
1250
|
+
const a = typeof e.autosave == "object" && e.autosave ? { ...e.autosave } : {};
|
|
1251
|
+
e.autosaveEnabled !== void 0 && (a.enabled = !!e.autosaveEnabled), e.autosaveIntervalMs !== void 0 && (a.intervalMs = Number(e.autosaveIntervalMs)), e.autosaveStorageKey !== void 0 && (a.storageKey = e.autosaveStorageKey), e.autosaveProvider !== void 0 && (a.provider = e.autosaveProvider), e.autosaveApiUrl !== void 0 && (a.apiUrl = e.autosaveApiUrl), e.autosave = a;
|
|
1227
1252
|
}
|
|
1228
1253
|
const o = {
|
|
1229
1254
|
enabled: !1,
|
|
@@ -1238,16 +1263,16 @@ const k = class k {
|
|
|
1238
1263
|
enabled: e.autosave
|
|
1239
1264
|
};
|
|
1240
1265
|
else if (typeof e.autosave == "object" && e.autosave) {
|
|
1241
|
-
const
|
|
1266
|
+
const a = {
|
|
1242
1267
|
...o,
|
|
1243
1268
|
...e.autosave
|
|
1244
1269
|
};
|
|
1245
|
-
|
|
1270
|
+
a.intervalMs === void 0 && a.interval !== void 0 && (a.intervalMs = Number(a.interval)), a.enabled === void 0 && (a.enabled = !0), (!Number.isFinite(a.intervalMs) || a.intervalMs <= 0) && (a.intervalMs = o.intervalMs), e.autosave = a;
|
|
1246
1271
|
} else
|
|
1247
1272
|
e.autosave = o;
|
|
1248
1273
|
if (e.languageLocale !== void 0 || e.languageDirection !== void 0) {
|
|
1249
|
-
const
|
|
1250
|
-
e.languageLocale !== void 0 && (
|
|
1274
|
+
const a = typeof e.language == "object" && e.language ? { ...e.language } : {};
|
|
1275
|
+
e.languageLocale !== void 0 && (a.locale = e.languageLocale), e.languageDirection !== void 0 && (a.direction = e.languageDirection), e.language = a;
|
|
1251
1276
|
}
|
|
1252
1277
|
const r = { locale: "en", direction: "ltr" };
|
|
1253
1278
|
if (typeof e.language == "string" ? e.language = {
|
|
@@ -1257,27 +1282,27 @@ const k = class k {
|
|
|
1257
1282
|
...r,
|
|
1258
1283
|
...e.language
|
|
1259
1284
|
} : e.language = r, e.spellcheckEnabled !== void 0 || e.spellcheckProvider !== void 0 || e.spellcheckApiUrl !== void 0) {
|
|
1260
|
-
const
|
|
1261
|
-
e.spellcheckEnabled !== void 0 && (
|
|
1285
|
+
const a = typeof e.spellcheck == "object" && e.spellcheck ? { ...e.spellcheck } : {};
|
|
1286
|
+
e.spellcheckEnabled !== void 0 && (a.enabled = !!e.spellcheckEnabled), e.spellcheckProvider !== void 0 && (a.provider = e.spellcheckProvider), e.spellcheckApiUrl !== void 0 && (a.apiUrl = e.spellcheckApiUrl), e.spellcheck = a;
|
|
1262
1287
|
}
|
|
1263
|
-
const
|
|
1288
|
+
const n = {
|
|
1264
1289
|
enabled: !1,
|
|
1265
1290
|
provider: "browser",
|
|
1266
1291
|
apiUrl: ""
|
|
1267
1292
|
};
|
|
1268
1293
|
if (typeof e.spellcheck == "boolean")
|
|
1269
1294
|
e.spellcheck = {
|
|
1270
|
-
...
|
|
1295
|
+
...n,
|
|
1271
1296
|
enabled: e.spellcheck
|
|
1272
1297
|
};
|
|
1273
1298
|
else if (typeof e.spellcheck == "object" && e.spellcheck) {
|
|
1274
|
-
const
|
|
1275
|
-
...
|
|
1299
|
+
const a = {
|
|
1300
|
+
...n,
|
|
1276
1301
|
...e.spellcheck
|
|
1277
1302
|
};
|
|
1278
|
-
!
|
|
1303
|
+
!a.provider && a.mode && (a.provider = a.mode === "local" ? "browser" : "api"), a.enabled === void 0 && (a.enabled = !!(a.mode || a.provider || a.apiUrl)), e.spellcheck = a;
|
|
1279
1304
|
} else
|
|
1280
|
-
e.spellcheck =
|
|
1305
|
+
e.spellcheck = n;
|
|
1281
1306
|
return e.contextMenuEnabled !== void 0 && (e.contextMenu = {
|
|
1282
1307
|
enabled: !!e.contextMenuEnabled
|
|
1283
1308
|
}), typeof e.contextMenu == "boolean" ? e.contextMenu = { enabled: e.contextMenu } : typeof e.contextMenu == "object" && e.contextMenu ? e.contextMenu = {
|
|
@@ -1338,8 +1363,8 @@ const k = class k {
|
|
|
1338
1363
|
static parseAttributes(t) {
|
|
1339
1364
|
const e = {};
|
|
1340
1365
|
for (const [o, r] of Object.entries(t)) {
|
|
1341
|
-
const
|
|
1342
|
-
e[
|
|
1366
|
+
const n = this.kebabToCamel(o);
|
|
1367
|
+
e[n] = this.parseAttributeValue(r);
|
|
1343
1368
|
}
|
|
1344
1369
|
return e;
|
|
1345
1370
|
}
|
|
@@ -1387,12 +1412,12 @@ const k = class k {
|
|
|
1387
1412
|
static merge(...t) {
|
|
1388
1413
|
const e = {};
|
|
1389
1414
|
for (const o of t)
|
|
1390
|
-
for (const [r,
|
|
1391
|
-
|
|
1415
|
+
for (const [r, n] of Object.entries(o))
|
|
1416
|
+
n != null && (typeof n == "object" && !Array.isArray(n) && e[r] ? e[r] = this.merge(e[r], n) : e[r] = n);
|
|
1392
1417
|
return e;
|
|
1393
1418
|
}
|
|
1394
1419
|
};
|
|
1395
|
-
|
|
1420
|
+
S.EDITOR_DEFAULTS = {
|
|
1396
1421
|
height: 400,
|
|
1397
1422
|
width: "100%",
|
|
1398
1423
|
readonly: !1,
|
|
@@ -1442,26 +1467,86 @@ k.EDITOR_DEFAULTS = {
|
|
|
1442
1467
|
},
|
|
1443
1468
|
statusbar: !1
|
|
1444
1469
|
};
|
|
1445
|
-
let
|
|
1446
|
-
const U = '.editora-editor{display:flex;flex-direction:column;border:1px solid #ddd;border-radius:4px;background:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;font-size:14px;overflow:hidden}.editora-editor *{box-sizing:border-box}.editora-theme-light{background:#fff;color:#333}.editora-theme-dark{--editora-dark-toolbar-bg-start: #353d48;--editora-dark-toolbar-bg-end: #2d3540;--editora-dark-button-bg-start: #46505f;--editora-dark-button-bg-end: #3b4553;--editora-dark-button-hover-start: #525d6d;--editora-dark-button-hover-end: #465262;--editora-dark-button-active-start: #5eaaf6;--editora-dark-button-active-end: #4a95de;--editora-dark-border: #475263;--editora-dark-border-strong: #566275;--editora-dark-text: #e1e9f5;--editora-dark-text-strong: #f3f7ff;--editora-dark-text-muted: #aeb9cc;--editora-dark-surface: #1d242d;--editora-dark-content: #1f2732;background:linear-gradient(180deg,#1b2330,#1c2430);color:var(--editora-dark-text);border-color:var(--editora-dark-border)}.editora-toolbar{display:flex;align-items:center;gap:4px;padding:8px;background:#f5f5f5;border-bottom:1px solid #ddd;flex-wrap:wrap}.editora-theme-dark .editora-toolbar{background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%);border-bottom-color:var(--editora-dark-border);box-shadow:inset 0 1px #ffffff0d}.editora-toolbar-sticky{position:sticky;top:0;z-index:100;position:-webkit-sticky}.editora-toolbar-group{display:flex;align-items:center;gap:2px}.editora-toolbar-button{padding:6px 12px;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-weight:600;font-size:14px;height:30px;display:flex;align-items:center;white-space:nowrap}.editora-toolbar-group-button{display:flex;align-items:center}.editora-toolbar-input.font-size{width:40px;padding:.25rem;text-align:center;font-size:14px;background:#fff;border:1px solid var(--rte-color-border-light);border-radius:var(--rte-radius-sm)}.editora-toolbar-group-items{display:flex;align-items:center;border:1px solid #ccc;.editora-toolbar-button{border:none;border-radius:0;&:first-child{border-right:1px solid #ccc;border-top-left-radius:3px;border-bottom-left-radius:3px}&:last-child{border-left:1px solid #ccc;border-top-right-radius:3px;border-bottom-right-radius:3px}}}.editora-theme-dark .editora-toolbar-button{background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%);border-color:var(--editora-dark-border-strong);color:var(--editora-dark-text);box-shadow:inset 0 1px #ffffff14,0 1px 1px #00000059}.editora-theme-dark .editora-toolbar-group-items{border-color:var(--editora-dark-border-strong);background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%)}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:first-child{border-right-color:#566275}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:last-child{border-left-color:#566275}.editora-theme-dark .editora-toolbar-input.font-size{background-color:#2e3642;color:var(--editora-dark-text-strong);border-color:var(--editora-dark-border-strong);caret-color:var(--editora-dark-text-strong)}.editora-theme-dark .editora-toolbar-input.font-size::placeholder{color:var(--editora-dark-text-strong);opacity:1}.editora-toolbar-button:hover{background:#e0e0e0;border-color:#ccc}.editora-theme-dark .editora-toolbar-button:hover{background:linear-gradient(180deg,var(--editora-dark-button-hover-start) 0%,var(--editora-dark-button-hover-end) 100%);border-color:#66748a;color:var(--editora-dark-text-strong)}.editora-toolbar-button:active,.editora-toolbar-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-button:active,.editora-theme-dark .editora-toolbar-button.active{background:linear-gradient(180deg,var(--editora-dark-button-active-start) 0%,var(--editora-dark-button-active-end) 100%);border-color:#67adf4;color:#0f1b2a}.editora-theme-dark .editora-toolbar-button:disabled{background:#313946;border-color:#424d5e;color:#7f8ca1}.editora-theme-dark .editora-toolbar-button[data-command=insertTable],.editora-theme-dark .editora-toolbar-button[data-command=print],.editora-theme-dark .editora-toolbar-button[data-command=toggleSpellCheck],.editora-theme-dark .editora-toolbar-button[data-command=toggleA11yChecker],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionLTR],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionRTL]{color:#f1f6ff}.editora-toolbar-button:disabled{opacity:.5;cursor:not-allowed}.editora-toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;line-height:1}.editora-toolbar-button svg,.editora-toolbar-icon svg{width:20px;height:20px;display:block;color:currentColor;fill:currentColor}.editora-theme-dark .editora-toolbar-icon,.editora-theme-dark .editora-toolbar-icon *{color:inherit}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([stroke="#000" i],[stroke="#000000" i],[stroke=black i],[stroke="#0f0f0f" i],[stroke="#111111" i],[style*="stroke:#000" i],[style*="stroke: #000" i],[style*="stroke:black" i],[style*="stroke: black" i],[style*="stroke:#0f0f0f" i],[style*="stroke: #0f0f0f" i]){stroke:currentColor!important}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([fill="#000" i],[fill="#000000" i],[fill=black i],[fill="#0f0f0f" i],[fill="#111111" i],[style*="fill:#000" i],[style*="fill: #000" i],[style*="fill:black" i],[style*="fill: black" i],[style*="fill:#0f0f0f" i],[style*="fill: #0f0f0f" i]){fill:currentColor!important}.editora-toolbar-separator{width:1px;height:24px;background:#ddd;margin:0 4px}.editora-theme-dark .editora-toolbar-separator{background:#4d596b}.editora-toolbar-dropdown{position:relative}.editora-toolbar-dropdown-menu{position:absolute;top:100%;left:0;min-width:150px;margin-top:4px;padding:4px 0;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-toolbar-dropdown-menu{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;color:#333;text-align:left;cursor:pointer;font-size:13px;transition:background .15s ease}.editora-theme-dark .editora-toolbar-dropdown-item{color:#d7deea}.editora-toolbar-dropdown-item:hover{background:#f5f5f5}.editora-theme-dark .editora-toolbar-dropdown-item:hover{background:#3a4554;color:#f0f6ff}.editora-content{flex:1;min-height:200px;padding:16px;outline:none;overflow-y:auto;line-height:1.6}.editora-theme-dark .editora-content{color:#ecf3ff;background:linear-gradient(180deg,var(--editora-dark-content) 0%,#1c232e 100%)}.editora-content:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none}.editora-theme-dark .editora-content:empty:before{color:#8f9bb0}.editora-content h1{font-size:2em;margin:.67em 0;font-weight:600}.editora-content h2{font-size:1.5em;margin:.75em 0;font-weight:600}.editora-content h3{font-size:1.17em;margin:.83em 0;font-weight:600}.editora-content p{margin:1em 0}.editora-content ul,.editora-content ol{margin:1em 0;padding-left:2em}.editora-content a{color:#06c;text-decoration:underline}.editora-theme-dark .editora-content a{color:#4db8ff}.editora-content code{padding:2px 4px;background:#f5f5f5;border-radius:3px;font-family:Monaco,Menlo,Consolas,monospace;font-size:.9em}.editora-theme-dark .editora-content code{background:#1e1e1e}.editora-content pre{padding:12px;background:#f5f5f5;border-radius:4px;overflow-x:auto;margin:1em 0}.editora-theme-dark .editora-content pre{background:#1e1e1e}.editora-theme-dark .rte-code-block{background:linear-gradient(180deg,#212a36,#1b2430)!important;border-color:#4f5b70!important;color:#e7effc!important}.editora-theme-dark .rte-code-block code{color:#e7effc!important}.editora-theme-dark .rte-code-block:before{background:#111927!important;color:#dce8ff!important}.editora-theme-dark .rte-code-block .rte-code-copy{background:#2b3441!important;border-color:#5a667b!important;color:#dce8ff!important}.editora-content blockquote{margin:1em 0;padding-left:1em;border-left:4px solid #ddd;color:#666}.editora-theme-dark .editora-content blockquote{border-left-color:#3c3c3c;color:#9a9a9a}.editora-floating-toolbar{position:absolute;padding:4px;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-floating-toolbar{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-statusbar-container{display:flex;flex-direction:column}.editora-statusbar-left{display:flex;align-items:center;gap:8px}.editora-statusbar-right{display:flex;align-items:center;gap:8px;margin-left:auto}.editora-statusbar{display:flex;align-items:center;gap:12px;padding:6px 12px;background:#f5f5f5;border-top:1px solid #ddd;font-size:12px;color:#666}.editora-theme-dark .editora-statusbar{background:linear-gradient(180deg,#2c3440,#252d37);border-top-color:#3f4a5b;color:#d7deea}.editora-statusbar-item{white-space:nowrap}.editora-statusbar-separator{color:#ddd}.editora-theme-dark .editora-statusbar-separator{color:#566275}.editora-editor[readonly] .editora-content{background:#fafafa;cursor:not-allowed}.editora-theme-dark.editora-editor[readonly] .editora-content{background:#1a1a1a}.editora-editor:focus-within{border-color:#06c;box-shadow:0 0 0 3px #0066cc1a}.editora-theme-dark.editora-editor:focus-within{border-color:#4db8ff;box-shadow:0 0 0 3px #4db8ff1a}.editora-editor[disabled]{opacity:.6;pointer-events:none}@media(max-width:768px){.editora-toolbar{padding:4px}.editora-toolbar-button{min-width:28px;min-height:28px;padding:4px 8px;font-size:12px}.editora-content{padding:12px}}.editora-content ::selection{background:#06c3}.editora-theme-dark .editora-content ::selection{background:#4db8ff33}.editora-content table{border-collapse:collapse;width:100%;margin:1em 0}.editora-content th,.editora-content td{border:1px solid #ddd;padding:8px 12px;text-align:left}.editora-theme-dark .editora-content th,.editora-theme-dark .editora-content td{border-color:#3c3c3c}.editora-content th{background:#f5f5f5;font-weight:600}.editora-theme-dark .editora-content th{background:#252526}.editora-content img{max-width:100%;height:auto;border-radius:4px;display:block}.editora-content video{max-width:100%;height:auto;border-radius:4px;display:block}.editora-editor.loading{opacity:.7;pointer-events:none}.editora-editor.loading:after{content:"";position:absolute;top:50%;left:50%;width:24px;height:24px;margin:-12px 0 0 -12px;border:3px solid #ddd;border-top-color:#06c;border-radius:50%;animation:editora-spin .8s linear infinite}@keyframes editora-spin{to{transform:rotate(360deg)}}.toolbar-container-wrapper{display:flex;align-items:center;background:#fff;border-bottom:1px solid #e0e0e0;padding:0;margin:0;width:100%;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:14px;line-height:1.5;position:relative}.toolbar-container-wrapper[data-toolbar-sticky=true]{position:sticky;top:0;z-index:999;box-shadow:0 2px 4px #0000001a}.toolbar-container-wrapper[data-toolbar-floating=true]{position:fixed;top:0;left:0;right:0;z-index:1000;box-shadow:0 4px 12px #00000026}.toolbar-container-wrapper[data-toolbar-position=bottom]{border-bottom:none;border-top:1px solid #e0e0e0}.toolbar-container-wrapper .toolbar-wrapper{display:flex;width:100%;padding:8px;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar{display:flex;width:100%;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar-container{display:flex;gap:4px;flex-wrap:wrap;align-items:center;flex:1;position:relative}.toolbar-container-wrapper .toolbar-item{display:flex;align-items:center;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:6px 10px;border:1px solid #d1d5db;background:#fff;border-radius:4px;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center;gap:4px;transition:all .15s ease;min-height:32px;white-space:nowrap}.toolbar-container-wrapper .toolbar-button:hover{background-color:#f3f4f6;border-color:#9ca3af}.toolbar-container-wrapper .toolbar-button:active,.toolbar-container-wrapper .toolbar-button[data-active=true]{background-color:#06c;color:#fff;border-color:#0052a3;box-shadow:inset 0 1px 3px #0000001a}.toolbar-container-wrapper .toolbar-button:disabled{opacity:.5;cursor:not-allowed;background-color:#f9fafb}.toolbar-container-wrapper .toolbar-more-button{padding:6px 8px;font-size:16px;font-weight:500;line-height:1}.toolbar-container-wrapper .toolbar-separator{width:1px;height:24px;background-color:#d1d5db;margin:0 4px}.toolbar-container-wrapper .toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.toolbar-container-wrapper .toolbar-icon svg{width:100%;height:100%}.toolbar-container-wrapper .toolbar-dropdown{position:relative;display:flex;align-items:center}.toolbar-container-wrapper .toolbar-dropdown-arrow{font-size:10px;margin-left:2px;line-height:1}.toolbar-container-wrapper .toolbar-dropdown-menu{position:absolute;top:100%;left:0;background:#fff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:1000;min-width:160px;padding:4px 0;margin-top:4px;display:none}.toolbar-container-wrapper .toolbar-dropdown-menu.show{display:block}.toolbar-container-wrapper .toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;font-size:13px;color:#1f2937;transition:background-color .15s ease;font-family:inherit}.toolbar-container-wrapper .toolbar-dropdown-item:hover{background-color:#f3f4f6}.toolbar-container-wrapper .toolbar-dropdown-item:active{background-color:#e5e7eb}.toolbar-container-wrapper .toolbar-input{padding:6px 8px;border:1px solid #d1d5db;border-radius:4px;font-size:13px;font-family:inherit;background-color:#fff;color:#1f2937;transition:all .15s ease}.toolbar-container-wrapper .toolbar-input:focus{outline:none;border-color:#06c;box-shadow:0 0 0 3px #0066cc1a;background-color:#fff}.toolbar-container-wrapper .toolbar-input::placeholder{color:#9ca3af}.toolbar-overflow-menu{animation:slideDown .2s ease-out}@keyframes slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.toolbar-overflow-item{transition:background-color .15s ease}.floating-toolbar{user-select:none;-webkit-user-select:none;font-family:system-ui,-apple-system,sans-serif;font-size:14px;animation:fadeInUp .15s ease-out}@keyframes fadeInUp{0%{opacity:0;transform:translate(-50%) translateY(10px)}to{opacity:1;transform:translate(-50%) translateY(0)}}.floating-toolbar-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:4px;color:#495057;cursor:pointer;font-size:14px;font-weight:500;transition:all .15s ease;outline:none}.floating-toolbar-btn:hover{background:#f8f9fa;color:#212529}.floating-toolbar-btn:active{background:#e9ecef;transform:scale(.95)}.floating-toolbar-btn.floating-toolbar-toggle{color:#dc3545;font-weight:700}.floating-toolbar-btn.floating-toolbar-toggle:hover{background:#f8d7da;color:#721c24}.floating-toolbar-separator{width:1px;height:20px;background:#e1e5e9;margin:0 2px}@media(max-width:768px){.toolbar-container-wrapper .toolbar-button{padding:5px 8px;font-size:12px;min-height:28px}.toolbar-container-wrapper .toolbar-icon{width:16px;height:16px}.toolbar-container-wrapper .toolbar-dropdown-menu{min-width:140px}.toolbar-container-wrapper .toolbar-dropdown-item{padding:6px 10px;font-size:12px}.floating-toolbar{padding:4px;gap:2px}.floating-toolbar-btn{width:28px;height:28px;font-size:12px}}@media(max-width:480px){.toolbar-container-wrapper{padding:4px}.toolbar-container-wrapper .toolbar-wrapper{padding:4px;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:4px 6px;font-size:11px;min-height:24px}.toolbar-container-wrapper .toolbar-icon{width:14px;height:14px}}.floating-toolbar{pointer-events:auto}.floating-toolbar{max-width:calc(100vw - 20px);overflow-x:auto}@media(prefers-color-scheme:dark){.floating-toolbar{background:#2d3748;border-color:#4a5568;color:#e2e8f0}.floating-toolbar-btn:hover{background:#4a5568;color:#f7fafc}.floating-toolbar-btn:active{background:#718096}.floating-toolbar-separator{background:#4a5568}}';
|
|
1447
|
-
let
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1470
|
+
let x = S;
|
|
1471
|
+
const J = '.editora-editor{display:flex;flex-direction:column;border:1px solid #ddd;border-radius:4px;background:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;font-size:14px;overflow:hidden}.editora-editor *{box-sizing:border-box}.editora-theme-light{background:#fff;color:#333}.editora-theme-dark{--editora-dark-toolbar-bg-start: #353d48;--editora-dark-toolbar-bg-end: #2d3540;--editora-dark-button-bg-start: #46505f;--editora-dark-button-bg-end: #3b4553;--editora-dark-button-hover-start: #525d6d;--editora-dark-button-hover-end: #465262;--editora-dark-button-active-start: #5eaaf6;--editora-dark-button-active-end: #4a95de;--editora-dark-border: #475263;--editora-dark-border-strong: #566275;--editora-dark-text: #e1e9f5;--editora-dark-text-strong: #f3f7ff;--editora-dark-text-muted: #aeb9cc;--editora-dark-surface: #1d242d;--editora-dark-content: #1f2732;background:linear-gradient(180deg,#1b2330,#1c2430);color:var(--editora-dark-text);border-color:var(--editora-dark-border)}.editora-toolbar{display:flex;align-items:center;gap:4px;padding:8px;background:#f5f5f5;border-bottom:1px solid #ddd;flex-wrap:wrap}.editora-theme-dark .editora-toolbar{background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%);border-bottom-color:var(--editora-dark-border);box-shadow:inset 0 1px #ffffff0d}.editora-toolbar-sticky{position:sticky;top:0;z-index:100;position:-webkit-sticky}.editora-toolbar-group{display:flex;align-items:center;gap:2px}.editora-toolbar-button{padding:6px 12px;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-weight:600;font-size:14px;height:30px;display:flex;align-items:center;white-space:nowrap}.editora-toolbar-group-button{display:flex;align-items:center}.editora-toolbar-input.font-size{width:40px;padding:.25rem;text-align:center;font-size:14px;background:#fff;border:1px solid var(--rte-color-border-light);border-radius:var(--rte-radius-sm)}.editora-toolbar-group-items{display:flex;align-items:center;border:1px solid #ccc;.editora-toolbar-button{border:none;border-radius:0;&:first-child{border-right:1px solid #ccc;border-top-left-radius:3px;border-bottom-left-radius:3px}&:last-child{border:0px solid #ccc;border-radius:0!important}&:hover{background:#e0e0e0;border-color:#ccc}}}.editora-theme-dark .editora-toolbar-button{background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%);border-color:var(--editora-dark-border-strong);color:var(--editora-dark-text);box-shadow:inset 0 1px #ffffff14,0 1px 1px #00000059}.editora-theme-dark .editora-toolbar-group-items{border-color:var(--editora-dark-border-strong);background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%)}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:first-child{border-right-color:#566275}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:last-child{border-left-color:#566275}.editora-theme-dark .editora-toolbar-input.font-size{background-color:#2e3642;color:var(--editora-dark-text-strong);border-color:var(--editora-dark-border-strong);caret-color:var(--editora-dark-text-strong)}.editora-theme-dark .editora-toolbar-input.font-size::placeholder{color:var(--editora-dark-text-strong);opacity:1}.editora-toolbar-button:hover{background:#e0e0e0;border-color:#ccc}.editora-theme-dark .editora-toolbar-button:hover{background:linear-gradient(180deg,var(--editora-dark-button-hover-start) 0%,var(--editora-dark-button-hover-end) 100%);border-color:#66748a;color:var(--editora-dark-text-strong)}.editora-toolbar-button:active,.editora-toolbar-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-button:active,.editora-theme-dark .editora-toolbar-button.active{background:linear-gradient(180deg,var(--editora-dark-button-active-start) 0%,var(--editora-dark-button-active-end) 100%);border-color:#67adf4;color:#0f1b2a}.editora-theme-dark .editora-toolbar-button:disabled{background:#313946;border-color:#424d5e;color:#7f8ca1}.editora-theme-dark .editora-toolbar-button[data-command=insertTable],.editora-theme-dark .editora-toolbar-button[data-command=print],.editora-theme-dark .editora-toolbar-button[data-command=toggleSpellCheck],.editora-theme-dark .editora-toolbar-button[data-command=toggleA11yChecker],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionLTR],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionRTL]{color:#f1f6ff}.editora-toolbar-button:disabled{opacity:.5;cursor:not-allowed}.editora-toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;line-height:1}.editora-toolbar-button svg,.editora-toolbar-icon svg{width:20px;height:20px;display:block;color:currentColor;fill:currentColor}.editora-theme-dark .editora-toolbar-icon,.editora-theme-dark .editora-toolbar-icon *{color:inherit}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([stroke="#000" i],[stroke="#000000" i],[stroke=black i],[stroke="#0f0f0f" i],[stroke="#111111" i],[style*="stroke:#000" i],[style*="stroke: #000" i],[style*="stroke:black" i],[style*="stroke: black" i],[style*="stroke:#0f0f0f" i],[style*="stroke: #0f0f0f" i]){stroke:currentColor!important}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([fill="#000" i],[fill="#000000" i],[fill=black i],[fill="#0f0f0f" i],[fill="#111111" i],[style*="fill:#000" i],[style*="fill: #000" i],[style*="fill:black" i],[style*="fill: black" i],[style*="fill:#0f0f0f" i],[style*="fill: #0f0f0f" i]){fill:currentColor!important}.editora-toolbar-separator{width:1px;height:24px;background:#ddd;margin:0 4px}.editora-theme-dark .editora-toolbar-separator{background:#4d596b}.editora-toolbar-dropdown{position:relative}.editora-toolbar-dropdown-menu{position:absolute;top:100%;left:0;min-width:150px;margin-top:4px;padding:4px 0;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-toolbar-dropdown-menu{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;color:#333;text-align:left;cursor:pointer;font-size:13px;transition:background .15s ease}.editora-theme-dark .editora-toolbar-dropdown-item{color:#d7deea}.editora-toolbar-dropdown-item:hover{background:#f5f5f5}.editora-theme-dark .editora-toolbar-dropdown-item:hover{background:#3a4554;color:#f0f6ff}.editora-content{flex:1;min-height:200px;padding:16px;outline:none;overflow-y:auto;line-height:1.6}.editora-theme-dark .editora-content{color:#ecf3ff;background:linear-gradient(180deg,var(--editora-dark-content) 0%,#1c232e 100%)}.editora-content:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none}.editora-theme-dark .editora-content:empty:before{color:#8f9bb0}.editora-content h1{font-size:2em;margin:.67em 0;font-weight:600}.editora-content h2{font-size:1.5em;margin:.75em 0;font-weight:600}.editora-content h3{font-size:1.17em;margin:.83em 0;font-weight:600}.editora-content p{margin:1em 0}.editora-theme-dark .editora-content,.editora-theme-dark .editora-content :is(p,span,div,li,ul,ol,td,th,h1,h2,h3,h4,h5,h6,strong,em,u,s,small,sub,sup,blockquote,code,pre,a){color:#ecf3ff}.editora-content ul,.editora-content ol{margin:1em 0;padding-left:2em}.editora-content a{color:#06c;text-decoration:underline}.editora-theme-dark .editora-content a{color:#ecf3ff}.editora-content code{padding:2px 4px;background:#f5f5f5;border-radius:3px;font-family:Monaco,Menlo,Consolas,monospace;font-size:.9em}.editora-theme-dark .editora-content code{background:#1e1e1e}.editora-content pre{padding:12px;background:#f5f5f5;border-radius:4px;overflow-x:auto;margin:1em 0}.editora-theme-dark .editora-content pre{background:#1e1e1e}.editora-theme-dark .rte-code-block{background:linear-gradient(180deg,#212a36,#1b2430)!important;border-color:#4f5b70!important;color:#e7effc!important}.editora-theme-dark .rte-code-block code{color:#e7effc!important}.editora-theme-dark .rte-code-block:before{background:#111927!important;color:#dce8ff!important}.editora-theme-dark .rte-code-block .rte-code-copy{background:#2b3441!important;border-color:#5a667b!important;color:#dce8ff!important}.editora-content blockquote{margin:1em 0;padding-left:1em;border-left:4px solid #ddd;color:#666}.editora-theme-dark .editora-content blockquote{border-left-color:#3c3c3c;color:#ecf3ff}.editora-floating-toolbar{position:absolute;padding:4px;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-floating-toolbar{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-statusbar-container{display:flex;flex-direction:column}.editora-statusbar-left{display:flex;align-items:center;gap:8px}.editora-statusbar-right{display:flex;align-items:center;gap:8px;margin-left:auto}.editora-statusbar{display:flex;align-items:center;gap:12px;padding:6px 12px;background:#f5f5f5;border-top:1px solid #ddd;font-size:12px;color:#666}.editora-theme-dark .editora-statusbar{background:linear-gradient(180deg,#2c3440,#252d37);border-top-color:#3f4a5b;color:#d7deea}.editora-statusbar-item{white-space:nowrap}.editora-statusbar-separator{color:#ddd}.editora-theme-dark .editora-statusbar-separator{color:#566275}.editora-editor[readonly] .editora-content{background:#fafafa;cursor:not-allowed}.editora-theme-dark.editora-editor[readonly] .editora-content{background:#1a1a1a}.editora-editor:focus-within{border-color:#06c;box-shadow:0 0 0 3px #0066cc1a}.editora-theme-dark.editora-editor:focus-within{border-color:#4db8ff;box-shadow:0 0 0 3px #4db8ff1a}.editora-editor[disabled]{opacity:.6;pointer-events:none}@media(max-width:768px){.editora-toolbar{padding:4px}.editora-toolbar-button{min-width:28px;min-height:28px;padding:4px 8px;font-size:12px}.editora-content{padding:12px}}.editora-content ::selection{background:#06c3}.editora-theme-dark .editora-content ::selection{background:#4db8ff33}.editora-content table{border-collapse:collapse;width:100%;margin:1em 0}.editora-content th,.editora-content td{border:1px solid #ddd;padding:8px 12px;text-align:left}.editora-theme-dark .editora-content th,.editora-theme-dark .editora-content td{border-color:#3c3c3c}.editora-content th{background:#f5f5f5;font-weight:600}.editora-theme-dark .editora-content th{background:#252526}.editora-content img{max-width:100%;height:auto;border-radius:4px;display:block}.editora-content video{max-width:100%;height:auto;border-radius:4px;display:block}.editora-editor.loading{opacity:.7;pointer-events:none}.editora-editor.loading:after{content:"";position:absolute;top:50%;left:50%;width:24px;height:24px;margin:-12px 0 0 -12px;border:3px solid #ddd;border-top-color:#06c;border-radius:50%;animation:editora-spin .8s linear infinite}@keyframes editora-spin{to{transform:rotate(360deg)}}.toolbar-container-wrapper{display:flex;align-items:center;background:#fff;border-bottom:1px solid #e0e0e0;padding:0;margin:0;width:100%;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:14px;line-height:1.5;position:relative}.toolbar-container-wrapper[data-toolbar-sticky=true]{position:sticky;top:0;z-index:999;box-shadow:0 2px 4px #0000001a}.toolbar-container-wrapper[data-toolbar-floating=true]{position:fixed;top:0;left:0;right:0;z-index:1000;box-shadow:0 4px 12px #00000026}.toolbar-container-wrapper[data-toolbar-position=bottom]{border-bottom:none;border-top:1px solid #e0e0e0}.toolbar-container-wrapper .toolbar-wrapper{display:flex;width:100%;padding:8px;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar{display:flex;width:100%;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar-container{display:flex;gap:4px;flex-wrap:wrap;align-items:center;flex:1;position:relative}.toolbar-container-wrapper .toolbar-item{display:flex;align-items:center;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:6px 10px;border:1px solid #d1d5db;background:#fff;border-radius:4px;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center;gap:4px;transition:all .15s ease;min-height:32px;white-space:nowrap}.toolbar-container-wrapper .toolbar-button:hover{background-color:#f3f4f6;border-color:#9ca3af}.toolbar-container-wrapper .toolbar-button:active,.toolbar-container-wrapper .toolbar-button[data-active=true]{background-color:#06c;color:#fff;border-color:#0052a3;box-shadow:inset 0 1px 3px #0000001a}.toolbar-container-wrapper .toolbar-button:disabled{opacity:.5;cursor:not-allowed;background-color:#f9fafb}.toolbar-container-wrapper .toolbar-more-button{padding:6px 8px;font-size:16px;font-weight:500;line-height:1}.toolbar-container-wrapper .toolbar-separator{width:1px;height:24px;background-color:#d1d5db;margin:0 4px}.toolbar-container-wrapper .toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.toolbar-container-wrapper .toolbar-icon svg{width:100%;height:100%}.toolbar-container-wrapper .toolbar-dropdown{position:relative;display:flex;align-items:center}.toolbar-container-wrapper .toolbar-dropdown-arrow{font-size:10px;margin-left:2px;line-height:1}.toolbar-container-wrapper .toolbar-dropdown-menu{position:absolute;top:100%;left:0;background:#fff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:1000;min-width:160px;padding:4px 0;margin-top:4px;display:none}.toolbar-container-wrapper .toolbar-dropdown-menu.show{display:block}.toolbar-container-wrapper .toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;font-size:13px;color:#1f2937;transition:background-color .15s ease;font-family:inherit}.toolbar-container-wrapper .toolbar-dropdown-item:hover{background-color:#f3f4f6}.toolbar-container-wrapper .toolbar-dropdown-item:active{background-color:#e5e7eb}.toolbar-container-wrapper .toolbar-input{padding:6px 8px;border:1px solid #d1d5db;border-radius:4px;font-size:13px;font-family:inherit;background-color:#fff;color:#1f2937;transition:all .15s ease}.toolbar-container-wrapper .toolbar-input:focus{outline:none;border-color:#06c;box-shadow:0 0 0 3px #0066cc1a;background-color:#fff}.toolbar-container-wrapper .toolbar-input::placeholder{color:#9ca3af}.toolbar-overflow-menu{animation:slideDown .2s ease-out}@keyframes slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.toolbar-overflow-item{transition:background-color .15s ease}.floating-toolbar{user-select:none;-webkit-user-select:none;font-family:system-ui,-apple-system,sans-serif;font-size:14px;animation:fadeInUp .15s ease-out}@keyframes fadeInUp{0%{opacity:0;transform:translate(-50%) translateY(10px)}to{opacity:1;transform:translate(-50%) translateY(0)}}.floating-toolbar-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:4px;color:#495057;cursor:pointer;font-size:14px;font-weight:500;transition:all .15s ease;outline:none}.floating-toolbar-btn:hover{background:#f8f9fa;color:#212529}.floating-toolbar-btn:active{background:#e9ecef;transform:scale(.95)}.floating-toolbar-btn.floating-toolbar-toggle{color:#dc3545;font-weight:700}.floating-toolbar-btn.floating-toolbar-toggle:hover{background:#f8d7da;color:#721c24}.floating-toolbar-separator{width:1px;height:20px;background:#e1e5e9;margin:0 2px}@media(max-width:768px){.toolbar-container-wrapper .toolbar-button{padding:5px 8px;font-size:12px;min-height:28px}.toolbar-container-wrapper .toolbar-icon{width:16px;height:16px}.toolbar-container-wrapper .toolbar-dropdown-menu{min-width:140px}.toolbar-container-wrapper .toolbar-dropdown-item{padding:6px 10px;font-size:12px}.floating-toolbar{padding:4px;gap:2px}.floating-toolbar-btn{width:28px;height:28px;font-size:12px}}@media(max-width:480px){.toolbar-container-wrapper{padding:4px}.toolbar-container-wrapper .toolbar-wrapper{padding:4px;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:4px 6px;font-size:11px;min-height:24px}.toolbar-container-wrapper .toolbar-icon{width:14px;height:14px}}.floating-toolbar{pointer-events:auto}.floating-toolbar{max-width:calc(100vw - 20px);overflow-x:auto}@media(prefers-color-scheme:dark){.floating-toolbar{background:#2d3748;border-color:#4a5568;color:#e2e8f0}.floating-toolbar-btn:hover{background:#4a5568;color:#f7fafc}.floating-toolbar-btn:active{background:#718096}.floating-toolbar-separator{background:#4a5568}}';
|
|
1472
|
+
let y;
|
|
1473
|
+
const Q = "__editoraCommandEditorRoot", Z = "__editoraLastCommandButton", A = "editora-editor, [data-editora-editor], .rte-editor, .editora-editor", T = ".rte-content, .editora-content", E = /* @__PURE__ */ new Set();
|
|
1474
|
+
let m = null, L = !1, w = null, C = null;
|
|
1475
|
+
function M(i) {
|
|
1476
|
+
if (!(i instanceof HTMLElement)) return !1;
|
|
1477
|
+
const t = i;
|
|
1478
|
+
return typeof t.execCommand == "function" && (t.tagName.toLowerCase() === "editora-editor" || t.classList.contains("editora-editor") || t.hasAttribute("data-editora-editor"));
|
|
1479
|
+
}
|
|
1480
|
+
function tt(i) {
|
|
1481
|
+
return i ? i.nodeType === Node.ELEMENT_NODE ? i : i.parentElement : null;
|
|
1482
|
+
}
|
|
1483
|
+
function b(i) {
|
|
1484
|
+
if (!i) return null;
|
|
1485
|
+
if (M(i))
|
|
1486
|
+
return i;
|
|
1487
|
+
const t = i.matches(A) ? i : i.closest(A);
|
|
1488
|
+
return !t || !M(t) ? null : t;
|
|
1489
|
+
}
|
|
1490
|
+
function et() {
|
|
1491
|
+
var r;
|
|
1492
|
+
if (typeof window == "undefined") return null;
|
|
1493
|
+
const i = window[Q];
|
|
1494
|
+
if (i instanceof HTMLElement) {
|
|
1495
|
+
const n = b(i);
|
|
1496
|
+
if (n) return n;
|
|
1497
|
+
const a = i.matches(T) ? i : i.querySelector(T);
|
|
1498
|
+
if (a) {
|
|
1499
|
+
const s = b(a);
|
|
1500
|
+
if (s) return s;
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
const t = window[Z];
|
|
1504
|
+
if (t instanceof HTMLElement) {
|
|
1505
|
+
const n = b(t);
|
|
1506
|
+
if (n) return n;
|
|
1507
|
+
}
|
|
1508
|
+
const e = document.activeElement;
|
|
1509
|
+
if (e) {
|
|
1510
|
+
const n = b(e);
|
|
1511
|
+
if (n) return n;
|
|
1512
|
+
}
|
|
1513
|
+
const o = (r = window.getSelection) == null ? void 0 : r.call(window);
|
|
1514
|
+
if (o && o.rangeCount > 0) {
|
|
1515
|
+
const n = b(tt(o.getRangeAt(0).startContainer));
|
|
1516
|
+
if (n) return n;
|
|
1517
|
+
}
|
|
1518
|
+
if (m && m.isConnected)
|
|
1519
|
+
return m;
|
|
1520
|
+
for (const n of E)
|
|
1521
|
+
if (n.isConnected) return n;
|
|
1522
|
+
return null;
|
|
1523
|
+
}
|
|
1524
|
+
function ot() {
|
|
1525
|
+
if (typeof window == "undefined" || L) return;
|
|
1526
|
+
w = typeof window.executeEditorCommand == "function" ? window.executeEditorCommand.bind(window) : null, C = typeof window.execEditorCommand == "function" ? window.execEditorCommand.bind(window) : null;
|
|
1527
|
+
const i = (t, e) => {
|
|
1528
|
+
const o = et();
|
|
1529
|
+
return o ? o.execCommand(t, e) : w ? w(t, e) : C ? C(t, e) : !1;
|
|
1530
|
+
};
|
|
1531
|
+
window.executeEditorCommand = i, window.execEditorCommand = i, L = !0;
|
|
1532
|
+
}
|
|
1533
|
+
function it() {
|
|
1534
|
+
const i = "editora-webcomponent-styles";
|
|
1535
|
+
if (!document.getElementById(i)) {
|
|
1451
1536
|
const t = document.createElement("style");
|
|
1452
|
-
t.id =
|
|
1537
|
+
t.id = i, t.textContent = J, document.head.appendChild(t);
|
|
1453
1538
|
}
|
|
1454
1539
|
}
|
|
1455
|
-
function
|
|
1456
|
-
if (!
|
|
1457
|
-
const
|
|
1458
|
-
|
|
1540
|
+
function nt() {
|
|
1541
|
+
if (!y) {
|
|
1542
|
+
const i = g.__globalPluginLoader;
|
|
1543
|
+
i ? y = i : y = new P();
|
|
1459
1544
|
}
|
|
1460
|
-
return
|
|
1545
|
+
return y;
|
|
1461
1546
|
}
|
|
1462
|
-
class
|
|
1547
|
+
class g extends HTMLElement {
|
|
1463
1548
|
constructor() {
|
|
1464
|
-
if (super(), this.pluginLoader =
|
|
1549
|
+
if (super(), this.pluginLoader = nt(), this.config = {}, this.isInitialized = !1, this.keyboardShortcutManager = new K(), this.lastAutosavedContent = "", this.loadedPlugins = [], this.lastBeforeInputType = null, it(), !this.hasAttribute("data-initial-content")) {
|
|
1465
1550
|
const t = this.innerHTML.trim();
|
|
1466
1551
|
t && this.setAttribute("data-initial-content", t);
|
|
1467
1552
|
}
|
|
@@ -1527,13 +1612,13 @@ class p extends HTMLElement {
|
|
|
1527
1612
|
* Wait for the global plugin loader to be available
|
|
1528
1613
|
*/
|
|
1529
1614
|
async waitForPluginLoader() {
|
|
1530
|
-
if (
|
|
1531
|
-
this.pluginLoader =
|
|
1615
|
+
if (g.__globalPluginLoader) {
|
|
1616
|
+
this.pluginLoader = g.__globalPluginLoader;
|
|
1532
1617
|
return;
|
|
1533
1618
|
}
|
|
1534
1619
|
return new Promise((t) => {
|
|
1535
1620
|
const e = () => {
|
|
1536
|
-
|
|
1621
|
+
g.__globalPluginLoader ? (this.pluginLoader = g.__globalPluginLoader, t()) : setTimeout(e, 0);
|
|
1537
1622
|
};
|
|
1538
1623
|
e();
|
|
1539
1624
|
});
|
|
@@ -1562,18 +1647,18 @@ class p extends HTMLElement {
|
|
|
1562
1647
|
async initialize() {
|
|
1563
1648
|
var o;
|
|
1564
1649
|
if (this.querySelector(".editora-toolbar") || this.isInitialized) return;
|
|
1565
|
-
this.setAttribute("data-editora-editor", "true"), this.config.height && (this.style.height = typeof this.config.height == "number" ? `${this.config.height}px` : this.config.height), this.config.width && (this.style.width = typeof this.config.width == "number" ? `${this.config.width}px` : this.config.width), this.classList.add("editora-editor"), this.config.theme && this.classList.add(`editora-theme-${this.config.theme}`);
|
|
1650
|
+
this.setAttribute("data-editora-editor", "true"), E.add(this), m || (m = this), ot(), this.config.height && (this.style.height = typeof this.config.height == "number" ? `${this.config.height}px` : this.config.height), this.config.width && (this.style.width = typeof this.config.width == "number" ? `${this.config.width}px` : this.config.width), this.classList.add("editora-editor"), this.config.theme && this.classList.add(`editora-theme-${this.config.theme}`);
|
|
1566
1651
|
const t = await this.loadPlugins();
|
|
1567
1652
|
this.loadedPlugins = t, t.forEach((r) => {
|
|
1568
1653
|
if (r.init && typeof r.init == "function")
|
|
1569
1654
|
try {
|
|
1570
1655
|
r.init({ editorElement: this });
|
|
1571
|
-
} catch (
|
|
1572
|
-
console.error(`[RichTextEditor] Error initializing plugin ${r.name}:`,
|
|
1656
|
+
} catch (n) {
|
|
1657
|
+
console.error(`[RichTextEditor] Error initializing plugin ${r.name}:`, n);
|
|
1573
1658
|
}
|
|
1574
1659
|
});
|
|
1575
1660
|
const e = (o = this.restoreAutosavedContent()) != null ? o : this.getAttribute("data-initial-content") || "";
|
|
1576
|
-
this.engine = new
|
|
1661
|
+
this.engine = new R({
|
|
1577
1662
|
content: e,
|
|
1578
1663
|
plugins: t,
|
|
1579
1664
|
readonly: this.config.readonly
|
|
@@ -1599,28 +1684,28 @@ class p extends HTMLElement {
|
|
|
1599
1684
|
const t = [], e = this.config.plugins && (typeof this.config.plugins == "string" && this.config.plugins.length > 0 || Array.isArray(this.config.plugins) && this.config.plugins.length > 0), r = this.getAccessibilityConfig().checker === !0;
|
|
1600
1685
|
if (e) {
|
|
1601
1686
|
if (typeof this.config.plugins == "string") {
|
|
1602
|
-
const
|
|
1603
|
-
r && !
|
|
1604
|
-
for (const
|
|
1605
|
-
const s = await this.pluginLoader.load(
|
|
1687
|
+
const n = this.config.plugins.split(/\s+/).filter(Boolean);
|
|
1688
|
+
r && !n.includes("a11yChecker") && n.push("a11yChecker");
|
|
1689
|
+
for (const a of n) {
|
|
1690
|
+
const s = await this.pluginLoader.load(a, this.getPluginLoadConfig(a));
|
|
1606
1691
|
s && t.push(s);
|
|
1607
1692
|
}
|
|
1608
1693
|
} else if (Array.isArray(this.config.plugins)) {
|
|
1609
|
-
for (const
|
|
1610
|
-
if (typeof
|
|
1611
|
-
const
|
|
1612
|
-
|
|
1694
|
+
for (const n of this.config.plugins)
|
|
1695
|
+
if (typeof n == "string") {
|
|
1696
|
+
const a = await this.pluginLoader.load(n, this.getPluginLoadConfig(n));
|
|
1697
|
+
a && t.push(a);
|
|
1613
1698
|
} else
|
|
1614
|
-
t.push(
|
|
1615
|
-
if (r && !t.some((
|
|
1616
|
-
const
|
|
1617
|
-
|
|
1699
|
+
t.push(n);
|
|
1700
|
+
if (r && !t.some((n) => (n == null ? void 0 : n.name) === "a11yChecker")) {
|
|
1701
|
+
const n = await this.pluginLoader.load("a11yChecker", this.getPluginLoadConfig("a11yChecker"));
|
|
1702
|
+
n && t.push(n);
|
|
1618
1703
|
}
|
|
1619
1704
|
}
|
|
1620
1705
|
} else {
|
|
1621
|
-
const
|
|
1622
|
-
for (const
|
|
1623
|
-
const s = await this.pluginLoader.load(
|
|
1706
|
+
const n = this.pluginLoader.getRegisteredPluginNames();
|
|
1707
|
+
for (const a of n) {
|
|
1708
|
+
const s = await this.pluginLoader.load(a, this.getPluginLoadConfig(a));
|
|
1624
1709
|
s && t.push(s);
|
|
1625
1710
|
}
|
|
1626
1711
|
}
|
|
@@ -1740,38 +1825,55 @@ class p extends HTMLElement {
|
|
|
1740
1825
|
this.contentElement.spellcheck = e, this.contentElement.setAttribute("spellcheck", e ? "true" : "false");
|
|
1741
1826
|
}
|
|
1742
1827
|
executeCommand(t, e) {
|
|
1743
|
-
var
|
|
1828
|
+
var n;
|
|
1744
1829
|
typeof window != "undefined" && (window.__editoraCommandEditorRoot = this);
|
|
1745
|
-
const o =
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1830
|
+
const o = {
|
|
1831
|
+
editorElement: this,
|
|
1832
|
+
contentElement: this.contentElement,
|
|
1833
|
+
toolbarElement: this.toolbarElement
|
|
1834
|
+
}, r = this.loadedPlugins.find((a) => a.commands && a.commands[t]);
|
|
1835
|
+
if (r && r.commands) {
|
|
1836
|
+
const a = r.commands[t];
|
|
1837
|
+
if (typeof a == "function")
|
|
1749
1838
|
try {
|
|
1750
|
-
return
|
|
1751
|
-
} catch (
|
|
1752
|
-
return console.error(`[RichTextEditor] Error executing native command ${t}:`,
|
|
1839
|
+
return a(t === "toggleFullscreen" ? this : e, o), !0;
|
|
1840
|
+
} catch (s) {
|
|
1841
|
+
return console.error(`[RichTextEditor] Error executing native command ${t}:`, s), !1;
|
|
1753
1842
|
}
|
|
1754
1843
|
}
|
|
1755
|
-
return ((
|
|
1844
|
+
return ((n = this.engine) == null ? void 0 : n.execCommand(t, e)) || !1;
|
|
1756
1845
|
}
|
|
1757
1846
|
getPluginLoadConfig(t) {
|
|
1758
1847
|
const e = this.config.pluginConfig;
|
|
1759
1848
|
if (e && typeof e == "object") {
|
|
1760
|
-
const
|
|
1761
|
-
if (
|
|
1762
|
-
return
|
|
1849
|
+
const n = e[t];
|
|
1850
|
+
if (n && typeof n == "object")
|
|
1851
|
+
return n;
|
|
1763
1852
|
}
|
|
1764
1853
|
const o = {
|
|
1765
|
-
spellCheck: ["spellcheck", "spellCheck"]
|
|
1854
|
+
spellCheck: ["spellcheck", "spellCheck"],
|
|
1855
|
+
trackChanges: ["trackchanges", "track-changes", "trackChanges"],
|
|
1856
|
+
versionDiff: ["versiondiff", "version-diff", "versionDiff"],
|
|
1857
|
+
"version-diff": ["versiondiff", "version-diff", "versionDiff"],
|
|
1858
|
+
conditionalContent: ["conditionalcontent", "conditional-content", "conditionalContent"],
|
|
1859
|
+
"conditional-content": ["conditionalcontent", "conditional-content", "conditionalContent"],
|
|
1860
|
+
dataBinding: ["databinding", "data-binding", "dataBinding"],
|
|
1861
|
+
"data-binding": ["databinding", "data-binding", "dataBinding"],
|
|
1862
|
+
contentRules: ["contentrules", "content-rules", "contentRules"],
|
|
1863
|
+
"content-rules": ["contentrules", "content-rules", "contentRules"],
|
|
1864
|
+
mentions: ["mention", "mentions"],
|
|
1865
|
+
mention: ["mention", "mentions"],
|
|
1866
|
+
slashCommands: ["slashcommands", "slash-commands", "slashCommands"],
|
|
1867
|
+
"slash-commands": ["slashcommands", "slash-commands", "slashCommands"]
|
|
1766
1868
|
}, r = [
|
|
1767
1869
|
t,
|
|
1768
1870
|
t.toLowerCase(),
|
|
1769
1871
|
...o[t] || []
|
|
1770
1872
|
];
|
|
1771
|
-
for (const
|
|
1772
|
-
const
|
|
1773
|
-
if (
|
|
1774
|
-
return
|
|
1873
|
+
for (const n of r) {
|
|
1874
|
+
const a = this.config[n];
|
|
1875
|
+
if (a && typeof a == "object" && !Array.isArray(a))
|
|
1876
|
+
return a;
|
|
1775
1877
|
}
|
|
1776
1878
|
}
|
|
1777
1879
|
getContentSanitizeConfig() {
|
|
@@ -1860,10 +1962,10 @@ class p extends HTMLElement {
|
|
|
1860
1962
|
o.deleteContents();
|
|
1861
1963
|
const r = document.createElement("div");
|
|
1862
1964
|
r.innerHTML = t;
|
|
1863
|
-
const
|
|
1965
|
+
const n = document.createDocumentFragment();
|
|
1864
1966
|
for (; r.firstChild; )
|
|
1865
|
-
|
|
1866
|
-
o.insertNode(
|
|
1967
|
+
n.appendChild(r.firstChild);
|
|
1968
|
+
o.insertNode(n), o.collapse(!1), e.removeAllRanges(), e.addRange(o);
|
|
1867
1969
|
} else
|
|
1868
1970
|
this.contentElement.focus(), document.execCommand("insertHTML", !1, t);
|
|
1869
1971
|
}
|
|
@@ -1872,7 +1974,7 @@ class p extends HTMLElement {
|
|
|
1872
1974
|
*/
|
|
1873
1975
|
createUI(t, e) {
|
|
1874
1976
|
const o = this.querySelector('[slot="toolbar"]'), r = this.querySelector('[slot="statusbar"]');
|
|
1875
|
-
this.innerHTML = "", this.config.toolbar !== !1 && !o ? (this.toolbarElement = document.createElement("div"), this.toolbarElement.className = "editora-toolbar-container", this.appendChild(this.toolbarElement), this.toolbar = new
|
|
1977
|
+
this.innerHTML = "", this.config.toolbar !== !1 && !o ? (this.toolbarElement = document.createElement("div"), this.toolbarElement.className = "editora-toolbar-container", this.appendChild(this.toolbarElement), this.toolbar = new z(
|
|
1876
1978
|
{
|
|
1877
1979
|
items: this.resolveToolbarItems(),
|
|
1878
1980
|
sticky: this.isToolbarStickyEnabled(),
|
|
@@ -1881,7 +1983,7 @@ class p extends HTMLElement {
|
|
|
1881
1983
|
t,
|
|
1882
1984
|
this.pluginLoader
|
|
1883
1985
|
// Pass plugin loader to get all registered plugins
|
|
1884
|
-
), this.toolbar.setCommandHandler((
|
|
1986
|
+
), this.toolbar.setCommandHandler((n, a) => {
|
|
1885
1987
|
var s;
|
|
1886
1988
|
if (this.contentElement) {
|
|
1887
1989
|
this.contentElement.focus();
|
|
@@ -1891,16 +1993,16 @@ class p extends HTMLElement {
|
|
|
1891
1993
|
d.nodeType === Node.TEXT_NODE ? c.setStart(d, ((s = d.textContent) == null ? void 0 : s.length) || 0) : d.nodeType === Node.ELEMENT_NODE ? (c.selectNodeContents(d), c.collapse(!1)) : c.setStart(this.contentElement, 0), c.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(c);
|
|
1892
1994
|
}
|
|
1893
1995
|
}
|
|
1894
|
-
return this.executeCommand(
|
|
1996
|
+
return this.executeCommand(n, a);
|
|
1895
1997
|
}), this.toolbar.render(this.toolbarElement)) : o && this.appendChild(o), this.contentElement = document.createElement("div"), this.contentElement.className = "editora-content rte-content", this.contentElement.contentEditable = this.config.readonly ? "false" : "true", this.applyLanguageSettings(), this.applyAccessibilitySettings(), this.applySpellcheckSettings(), this.config.placeholder && this.contentElement.setAttribute("data-placeholder", this.config.placeholder);
|
|
1896
1998
|
try {
|
|
1897
1999
|
document.execCommand("defaultParagraphSeparator", !1, "p");
|
|
1898
|
-
} catch (
|
|
1899
|
-
console.warn("defaultParagraphSeparator not supported:",
|
|
2000
|
+
} catch (n) {
|
|
2001
|
+
console.warn("defaultParagraphSeparator not supported:", n);
|
|
1900
2002
|
}
|
|
1901
2003
|
if (e) {
|
|
1902
|
-
const
|
|
1903
|
-
|
|
2004
|
+
const n = document.createElement("div");
|
|
2005
|
+
n.innerHTML = e.trim(), !Array.from(n.childNodes).some((s) => {
|
|
1904
2006
|
if (s.nodeType === Node.ELEMENT_NODE) {
|
|
1905
2007
|
const l = s.tagName;
|
|
1906
2008
|
return ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "BLOCKQUOTE", "PRE"].includes(l);
|
|
@@ -1909,9 +2011,9 @@ class p extends HTMLElement {
|
|
|
1909
2011
|
}) && e.trim() ? this.contentElement.innerHTML = `<p>${e.trim()}</p>` : this.contentElement.innerHTML = e;
|
|
1910
2012
|
} else
|
|
1911
2013
|
this.config.placeholder ? this.contentElement.innerHTML = "" : this.contentElement.innerHTML = "<p><br></p>";
|
|
1912
|
-
this.appendChild(this.contentElement), this.isToolbarFloatingEnabled() && (this.floatingToolbar = new
|
|
1913
|
-
var
|
|
1914
|
-
return (
|
|
2014
|
+
this.appendChild(this.contentElement), this.isToolbarFloatingEnabled() && (this.floatingToolbar = new H({ enabled: !0 }), this.floatingToolbar.create(this)), r ? this.appendChild(r) : this.isStatusbarEnabled() && (this.statusBarElement = document.createElement("div"), this.statusBarElement.className = "editora-statusbar-container", this.appendChild(this.statusBarElement), this.statusBar = new j({ position: this.getStatusbarPosition() }), this.statusBar.create(this.statusBarElement)), this.config.autofocus && setTimeout(() => {
|
|
2015
|
+
var n;
|
|
2016
|
+
return (n = this.contentElement) == null ? void 0 : n.focus();
|
|
1915
2017
|
}, 0);
|
|
1916
2018
|
}
|
|
1917
2019
|
/**
|
|
@@ -1920,67 +2022,71 @@ class p extends HTMLElement {
|
|
|
1920
2022
|
setupEventListeners() {
|
|
1921
2023
|
if (!this.contentElement || !this.engine) return;
|
|
1922
2024
|
const t = this.keyboardShortcutManager;
|
|
1923
|
-
this.contentElement.addEventListener("
|
|
2025
|
+
this.contentElement.addEventListener("beforeinput", (o) => {
|
|
2026
|
+
this.lastBeforeInputType = o.inputType || null;
|
|
2027
|
+
}), this.contentElement.addEventListener("input", () => {
|
|
1924
2028
|
if (!this.contentElement) return;
|
|
1925
2029
|
let o = this.contentElement.innerHTML;
|
|
1926
|
-
const r = this.getPerformanceConfig(),
|
|
1927
|
-
if (
|
|
1928
|
-
const
|
|
1929
|
-
if (
|
|
1930
|
-
const
|
|
1931
|
-
if (this.contentElement.innerHTML =
|
|
2030
|
+
const r = this.getPerformanceConfig(), n = this.getContentSanitizeConfig(), a = this.getSecurityConfig(), s = this.lastBeforeInputType;
|
|
2031
|
+
if (this.lastBeforeInputType = null, a.sanitizeOnInput !== !1 && n.sanitize !== !1 && !s) {
|
|
2032
|
+
const d = Y(o, n, a);
|
|
2033
|
+
if (d !== o) {
|
|
2034
|
+
const h = window.getSelection(), p = h && h.rangeCount > 0 ? h.getRangeAt(0) : null;
|
|
2035
|
+
if (this.contentElement.innerHTML = d, p && h)
|
|
1932
2036
|
try {
|
|
1933
|
-
|
|
1934
|
-
} catch (
|
|
2037
|
+
h.removeAllRanges(), h.addRange(p);
|
|
2038
|
+
} catch (u) {
|
|
1935
2039
|
}
|
|
1936
|
-
o =
|
|
2040
|
+
o = d;
|
|
1937
2041
|
}
|
|
1938
2042
|
}
|
|
1939
2043
|
this.contentChangeDebounceTimer && clearTimeout(this.contentChangeDebounceTimer);
|
|
1940
|
-
const
|
|
2044
|
+
const c = () => {
|
|
1941
2045
|
this.dispatchEvent(new CustomEvent("content-change", {
|
|
1942
2046
|
detail: { html: o },
|
|
1943
2047
|
bubbles: !0
|
|
1944
2048
|
}));
|
|
1945
2049
|
};
|
|
1946
|
-
r.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(
|
|
2050
|
+
r.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(c, r.debounceInputMs) : c(), this.updateStatusBar();
|
|
1947
2051
|
}), this.contentElement.addEventListener("contextmenu", (o) => {
|
|
1948
2052
|
const r = this.config.contextMenu;
|
|
1949
2053
|
(r === !1 || typeof r == "object" && r !== null && r.enabled === !1) && o.preventDefault();
|
|
1950
2054
|
}), this.contentElement.addEventListener("paste", (o) => {
|
|
1951
|
-
var d,
|
|
2055
|
+
var d, h;
|
|
2056
|
+
if (o.__editoraSmartPasteHandled === !0 || o.defaultPrevented)
|
|
2057
|
+
return;
|
|
1952
2058
|
o.preventDefault();
|
|
1953
2059
|
const r = this.config.paste || {};
|
|
1954
|
-
let
|
|
1955
|
-
const
|
|
1956
|
-
if ((r.clean || !r.keepFormatting) &&
|
|
1957
|
-
document.execCommand("insertText", !1,
|
|
2060
|
+
let n = ((d = o.clipboardData) == null ? void 0 : d.getData("text/html")) || "";
|
|
2061
|
+
const a = ((h = o.clipboardData) == null ? void 0 : h.getData("text/plain")) || "", s = this.getContentSanitizeConfig(), l = this.getSecurityConfig(), c = !!n && /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(n);
|
|
2062
|
+
if ((r.clean || !r.keepFormatting) && a) {
|
|
2063
|
+
document.execCommand("insertText", !1, a);
|
|
1958
2064
|
return;
|
|
1959
2065
|
}
|
|
1960
|
-
if (r.convertWord === !1 && c &&
|
|
1961
|
-
document.execCommand("insertText", !1,
|
|
2066
|
+
if (r.convertWord === !1 && c && a) {
|
|
2067
|
+
document.execCommand("insertText", !1, a);
|
|
1962
2068
|
return;
|
|
1963
2069
|
}
|
|
1964
|
-
if (
|
|
1965
|
-
l.sanitizeOnPaste !== !1 && s.sanitize !== !1 && (
|
|
2070
|
+
if (n) {
|
|
2071
|
+
l.sanitizeOnPaste !== !1 && s.sanitize !== !1 && (n = X(n, s, l)), this.insertHTMLAtSelection(n);
|
|
1966
2072
|
return;
|
|
1967
2073
|
}
|
|
1968
|
-
|
|
2074
|
+
a && document.execCommand("insertText", !1, a);
|
|
1969
2075
|
}), this.contentElement.addEventListener("focus", () => {
|
|
1970
|
-
this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
|
|
2076
|
+
m = this, this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
|
|
1971
2077
|
}), this.contentElement.addEventListener("blur", () => {
|
|
1972
2078
|
this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && this.dispatchEvent(new CustomEvent("content-change", {
|
|
1973
2079
|
detail: { html: this.contentElement.innerHTML },
|
|
1974
2080
|
bubbles: !0
|
|
1975
2081
|
})), this.dispatchEvent(new Event("editor-blur", { bubbles: !0 })), this.updateFloatingToolbar(), this.updateStatusBar();
|
|
1976
2082
|
}), this.contentElement.addEventListener("keydown", (o) => {
|
|
1977
|
-
this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (
|
|
1978
|
-
this.executeCommand(
|
|
2083
|
+
this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (n, a) => {
|
|
2084
|
+
this.executeCommand(n, a);
|
|
1979
2085
|
});
|
|
1980
2086
|
});
|
|
1981
2087
|
const e = () => {
|
|
1982
|
-
const o = this.getSelectionRangeInEditor(), r = document.activeElement,
|
|
1983
|
-
this.getPerformanceConfig().viewportOnlyScan && !this.isEditorInViewport() && !
|
|
2088
|
+
const o = this.getSelectionRangeInEditor(), r = document.activeElement, n = !!r && !!this.contentElement && (r === this.contentElement || this.contentElement.contains(r));
|
|
2089
|
+
this.getPerformanceConfig().viewportOnlyScan && !this.isEditorInViewport() && !n || !o && !n || (this.updateFloatingToolbar(), this.updateStatusBar());
|
|
1984
2090
|
};
|
|
1985
2091
|
this.selectionChangeHandler = e, document.addEventListener("selectionchange", this.selectionChangeHandler);
|
|
1986
2092
|
}
|
|
@@ -2002,39 +2108,43 @@ class p extends HTMLElement {
|
|
|
2002
2108
|
}
|
|
2003
2109
|
}
|
|
2004
2110
|
getSelectionAnchorRect(t, e) {
|
|
2005
|
-
const o = Array.from(e.getClientRects()).filter((
|
|
2111
|
+
const o = Array.from(e.getClientRects()).filter((n) => n.width > 0 || n.height > 0);
|
|
2006
2112
|
return o.length === 0 ? e.getBoundingClientRect() : this.isSelectionBackward(t) ? o[0] : o[o.length - 1];
|
|
2007
2113
|
}
|
|
2008
2114
|
/**
|
|
2009
2115
|
* Update floating toolbar position
|
|
2010
2116
|
*/
|
|
2011
2117
|
updateFloatingToolbar() {
|
|
2012
|
-
if (!this.floatingToolbar) return;
|
|
2013
|
-
|
|
2014
|
-
if (t.viewportOnlyScan && !this.isEditorInViewport() && !e) {
|
|
2118
|
+
if (!this.floatingToolbar || !this.contentElement) return;
|
|
2119
|
+
if (this.config.readonly || this.contentElement.contentEditable === "false" || this.contentElement.getAttribute("data-readonly") === "true" || this.getAttribute("readonly") === "true" || this.getAttribute("data-readonly") === "true") {
|
|
2015
2120
|
this.floatingToolbar.hide();
|
|
2016
2121
|
return;
|
|
2017
2122
|
}
|
|
2018
|
-
const o = this.
|
|
2019
|
-
if (!o) {
|
|
2123
|
+
const e = this.getPerformanceConfig(), o = document.activeElement === this.contentElement || !!this.contentElement && this.contentElement.contains(document.activeElement);
|
|
2124
|
+
if (e.viewportOnlyScan && !this.isEditorInViewport() && !o) {
|
|
2020
2125
|
this.floatingToolbar.hide();
|
|
2021
2126
|
return;
|
|
2022
2127
|
}
|
|
2023
|
-
|
|
2128
|
+
const r = this.getSelectionRangeInEditor();
|
|
2129
|
+
if (!r) {
|
|
2024
2130
|
this.floatingToolbar.hide();
|
|
2025
2131
|
return;
|
|
2026
2132
|
}
|
|
2027
|
-
|
|
2028
|
-
|
|
2133
|
+
if (r.collapsed) {
|
|
2134
|
+
this.floatingToolbar.hide();
|
|
2135
|
+
return;
|
|
2136
|
+
}
|
|
2137
|
+
const n = window.getSelection();
|
|
2138
|
+
if (!n) {
|
|
2029
2139
|
this.floatingToolbar.hide();
|
|
2030
2140
|
return;
|
|
2031
2141
|
}
|
|
2032
|
-
const
|
|
2033
|
-
if (!
|
|
2142
|
+
const a = this.getSelectionAnchorRect(n, r);
|
|
2143
|
+
if (!a) {
|
|
2034
2144
|
this.floatingToolbar.hide();
|
|
2035
2145
|
return;
|
|
2036
2146
|
}
|
|
2037
|
-
this.floatingToolbar.show(
|
|
2147
|
+
this.floatingToolbar.show(a.left, a.top - 40);
|
|
2038
2148
|
}
|
|
2039
2149
|
/**
|
|
2040
2150
|
* Update status bar with selection and cursor information
|
|
@@ -2047,13 +2157,13 @@ class p extends HTMLElement {
|
|
|
2047
2157
|
const t = this.getPerformanceConfig(), e = document.activeElement === this.contentElement || this.contentElement.contains(document.activeElement);
|
|
2048
2158
|
if (t.viewportOnlyScan && !this.isEditorInViewport() && !e)
|
|
2049
2159
|
return;
|
|
2050
|
-
const o = this.contentElement.textContent || "", { words: r, chars:
|
|
2160
|
+
const o = this.contentElement.textContent || "", { words: r, chars: n } = _(o), a = W(this.contentElement);
|
|
2051
2161
|
let s, l;
|
|
2052
2162
|
const c = this.getSelectionRangeInEditor();
|
|
2053
|
-
c && (s =
|
|
2163
|
+
c && (s = F(this.contentElement, c), c.collapsed || (l = U(c, s), s = void 0)), this.statusBar.update({
|
|
2054
2164
|
wordCount: r,
|
|
2055
|
-
charCount:
|
|
2056
|
-
lineCount:
|
|
2165
|
+
charCount: n,
|
|
2166
|
+
lineCount: a,
|
|
2057
2167
|
cursorPosition: s,
|
|
2058
2168
|
selectionInfo: l
|
|
2059
2169
|
});
|
|
@@ -2135,7 +2245,7 @@ class p extends HTMLElement {
|
|
|
2135
2245
|
const o = this.attributes[e];
|
|
2136
2246
|
t[o.name] = o.value;
|
|
2137
2247
|
}
|
|
2138
|
-
return
|
|
2248
|
+
return x.resolve({
|
|
2139
2249
|
jsConfig: this.jsConfig,
|
|
2140
2250
|
attributes: t
|
|
2141
2251
|
});
|
|
@@ -2176,7 +2286,7 @@ class p extends HTMLElement {
|
|
|
2176
2286
|
*/
|
|
2177
2287
|
destroy() {
|
|
2178
2288
|
var t, e, o, r;
|
|
2179
|
-
this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && this.persistAutosave(this.contentElement.innerHTML || ""), this.stopAutosave(), this.selectionChangeHandler && (document.removeEventListener("selectionchange", this.selectionChangeHandler), this.selectionChangeHandler = void 0), (t = this.engine) == null || t.destroy(), (e = this.toolbar) == null || e.destroy(), (o = this.floatingToolbar) == null || o.destroy(), (r = this.statusBar) == null || r.destroy(), this.innerHTML = "", this.contentElement = void 0, this.toolbarElement = void 0, this.statusBarElement = void 0, this.loadedPlugins = [], this.isInitialized = !1, this.dispatchEvent(new Event("editor-destroy", { bubbles: !0 }));
|
|
2289
|
+
this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && this.persistAutosave(this.contentElement.innerHTML || ""), this.stopAutosave(), this.selectionChangeHandler && (document.removeEventListener("selectionchange", this.selectionChangeHandler), this.selectionChangeHandler = void 0), (t = this.engine) == null || t.destroy(), (e = this.toolbar) == null || e.destroy(), (o = this.floatingToolbar) == null || o.destroy(), (r = this.statusBar) == null || r.destroy(), this.innerHTML = "", this.contentElement = void 0, this.toolbarElement = void 0, this.statusBarElement = void 0, this.loadedPlugins = [], this.isInitialized = !1, E.delete(this), m === this && (m = null), this.dispatchEvent(new Event("editor-destroy", { bubbles: !0 }));
|
|
2180
2290
|
}
|
|
2181
2291
|
// Public API methods
|
|
2182
2292
|
getContent() {
|
|
@@ -2198,80 +2308,117 @@ class p extends HTMLElement {
|
|
|
2198
2308
|
(t = this.contentElement) == null || t.blur();
|
|
2199
2309
|
}
|
|
2200
2310
|
}
|
|
2201
|
-
const
|
|
2202
|
-
|
|
2203
|
-
const
|
|
2311
|
+
const k = new P();
|
|
2312
|
+
g.__globalPluginLoader = k;
|
|
2313
|
+
const rt = {
|
|
2204
2314
|
// Core editing plugins (always loaded)
|
|
2205
|
-
bold: () => import("./BoldPlugin.native-BAzzoqU5.mjs").then((
|
|
2206
|
-
italic: () => import("./ItalicPlugin.native-CQjjDyUL.mjs").then((
|
|
2207
|
-
underline: () => import("./UnderlinePlugin.native-QpIcK4L2.mjs").then((
|
|
2208
|
-
strikethrough: () => import("./StrikethroughPlugin.native-0Be7j49s.mjs").then((
|
|
2209
|
-
clearFormatting: () => import("./ClearFormattingPlugin.native-Bq_XcTh2.mjs").then((
|
|
2210
|
-
heading: () => import("./HeadingPlugin.native-DrLYwQnQ.mjs").then((
|
|
2211
|
-
blockquote: () => import("./BlockquotePlugin.native-JFmOLsxN.mjs").then((
|
|
2212
|
-
code: () => import("./CodePlugin.native-
|
|
2213
|
-
codeSample: () => import("./CodeSamplePlugin.native-CgGoH-X4.mjs").then((
|
|
2214
|
-
list: () => import("./ListPlugin.native-V7EZC1lM.mjs").then((
|
|
2215
|
-
checklist: () => import("./ChecklistPlugin.native-nuSSEFNI.mjs").then((
|
|
2216
|
-
textAlignment: () => import("./TextAlignmentPlugin.native-sM_1s00t.mjs").then((
|
|
2217
|
-
indent: () => import("./IndentPlugin.native-BHixp8sP.mjs").then((
|
|
2218
|
-
direction: () => import("./DirectionPlugin.native-CDnbdNyl.mjs").then((
|
|
2219
|
-
textColor: () => import("./TextColorPlugin.native-
|
|
2220
|
-
backgroundColor: () => import("./BackgroundColorPlugin.native-
|
|
2221
|
-
fontSize: () => import("./FontSizePlugin.native-B_jCh7dY.mjs").then((
|
|
2222
|
-
fontFamily: () => import("./FontFamilyPlugin.native-j8hMTbg4.mjs").then((
|
|
2223
|
-
lineHeight: () => import("./LineHeightPlugin.native-CM7iXdQj.mjs").then((
|
|
2224
|
-
capitalization: () => import("./CapitalizationPlugin.native-DOMsh5R7.mjs").then((
|
|
2225
|
-
history: () => import("./HistoryPlugin.native-TDnVMsEO.mjs").then((
|
|
2315
|
+
bold: () => import("./BoldPlugin.native-BAzzoqU5.mjs").then((i) => i.BoldPlugin()),
|
|
2316
|
+
italic: () => import("./ItalicPlugin.native-CQjjDyUL.mjs").then((i) => i.ItalicPlugin()),
|
|
2317
|
+
underline: () => import("./UnderlinePlugin.native-QpIcK4L2.mjs").then((i) => i.UnderlinePlugin()),
|
|
2318
|
+
strikethrough: () => import("./StrikethroughPlugin.native-0Be7j49s.mjs").then((i) => i.StrikethroughPlugin()),
|
|
2319
|
+
clearFormatting: () => import("./ClearFormattingPlugin.native-Bq_XcTh2.mjs").then((i) => i.ClearFormattingPlugin()),
|
|
2320
|
+
heading: () => import("./HeadingPlugin.native-DrLYwQnQ.mjs").then((i) => i.HeadingPlugin()),
|
|
2321
|
+
blockquote: () => import("./BlockquotePlugin.native-JFmOLsxN.mjs").then((i) => i.BlockquotePlugin()),
|
|
2322
|
+
code: () => import("./CodePlugin.native-DlpTPdkd.mjs").then((i) => i.CodePlugin()),
|
|
2323
|
+
codeSample: () => import("./CodeSamplePlugin.native-CgGoH-X4.mjs").then((i) => i.CodeSamplePlugin()),
|
|
2324
|
+
list: () => import("./ListPlugin.native-V7EZC1lM.mjs").then((i) => i.ListPlugin()),
|
|
2325
|
+
checklist: () => import("./ChecklistPlugin.native-nuSSEFNI.mjs").then((i) => i.ChecklistPlugin()),
|
|
2326
|
+
textAlignment: () => import("./TextAlignmentPlugin.native-sM_1s00t.mjs").then((i) => i.TextAlignmentPlugin()),
|
|
2327
|
+
indent: () => import("./IndentPlugin.native-BHixp8sP.mjs").then((i) => i.IndentPlugin()),
|
|
2328
|
+
direction: () => import("./DirectionPlugin.native-CDnbdNyl.mjs").then((i) => i.DirectionPlugin()),
|
|
2329
|
+
textColor: () => import("./TextColorPlugin.native-Bwl_bSmc.mjs").then((i) => i.TextColorPlugin()),
|
|
2330
|
+
backgroundColor: () => import("./BackgroundColorPlugin.native-50iAT9xU.mjs").then((i) => i.BackgroundColorPlugin()),
|
|
2331
|
+
fontSize: () => import("./FontSizePlugin.native-B_jCh7dY.mjs").then((i) => i.FontSizePlugin()),
|
|
2332
|
+
fontFamily: () => import("./FontFamilyPlugin.native-j8hMTbg4.mjs").then((i) => i.FontFamilyPlugin()),
|
|
2333
|
+
lineHeight: () => import("./LineHeightPlugin.native-CM7iXdQj.mjs").then((i) => i.LineHeightPlugin()),
|
|
2334
|
+
capitalization: () => import("./CapitalizationPlugin.native-DOMsh5R7.mjs").then((i) => i.CapitalizationPlugin()),
|
|
2335
|
+
history: () => import("./HistoryPlugin.native-TDnVMsEO.mjs").then((i) => i.HistoryPlugin()),
|
|
2226
2336
|
// Advanced plugins (lazy loaded)
|
|
2227
|
-
link: () => import("./LinkPlugin.native-
|
|
2228
|
-
table: () => import("./TablePlugin.native-DrHX-efe.mjs").then((
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2337
|
+
link: () => import("./LinkPlugin.native-DYCIcdTm.mjs").then((i) => i.LinkPlugin()),
|
|
2338
|
+
table: () => import("./TablePlugin.native-DrHX-efe.mjs").then((i) => i.TablePlugin()),
|
|
2339
|
+
trackChanges: () => import("./TrackChangesPlugin.native-Bghu2q4a.mjs").then((i) => i.TrackChangesPlugin()),
|
|
2340
|
+
versionDiff: () => import("./VersionDiffPlugin.native-Bvxgy--t.mjs").then((i) => i.VersionDiffPlugin()),
|
|
2341
|
+
"version-diff": () => import("./VersionDiffPlugin.native-Bvxgy--t.mjs").then((i) => i.VersionDiffPlugin()),
|
|
2342
|
+
versiondiff: () => import("./VersionDiffPlugin.native-Bvxgy--t.mjs").then((i) => i.VersionDiffPlugin()),
|
|
2343
|
+
conditionalContent: () => import("./ConditionalContentPlugin.native-CfhY46rU.mjs").then((i) => i.ConditionalContentPlugin()),
|
|
2344
|
+
"conditional-content": () => import("./ConditionalContentPlugin.native-CfhY46rU.mjs").then((i) => i.ConditionalContentPlugin()),
|
|
2345
|
+
conditionalcontent: () => import("./ConditionalContentPlugin.native-CfhY46rU.mjs").then((i) => i.ConditionalContentPlugin()),
|
|
2346
|
+
dataBinding: () => import("./DataBindingPlugin.native-jQ1JPRTp.mjs").then((i) => i.DataBindingPlugin()),
|
|
2347
|
+
"data-binding": () => import("./DataBindingPlugin.native-jQ1JPRTp.mjs").then((i) => i.DataBindingPlugin()),
|
|
2348
|
+
databinding: () => import("./DataBindingPlugin.native-jQ1JPRTp.mjs").then((i) => i.DataBindingPlugin()),
|
|
2349
|
+
docSchema: () => import("./DocSchemaPlugin.native-CHOge18O.mjs").then((i) => i.DocSchemaPlugin()),
|
|
2350
|
+
"doc-schema": () => import("./DocSchemaPlugin.native-CHOge18O.mjs").then((i) => i.DocSchemaPlugin()),
|
|
2351
|
+
docschema: () => import("./DocSchemaPlugin.native-CHOge18O.mjs").then((i) => i.DocSchemaPlugin()),
|
|
2352
|
+
translationWorkflow: () => import("./TranslationWorkflowPlugin.native-Bz6jDGvj.mjs").then((i) => i.TranslationWorkflowPlugin()),
|
|
2353
|
+
"translation-workflow": () => import("./TranslationWorkflowPlugin.native-Bz6jDGvj.mjs").then((i) => i.TranslationWorkflowPlugin()),
|
|
2354
|
+
translationworkflow: () => import("./TranslationWorkflowPlugin.native-Bz6jDGvj.mjs").then((i) => i.TranslationWorkflowPlugin()),
|
|
2355
|
+
contentRules: () => import("./ContentRulesPlugin.native-nBLQ8QFZ.mjs").then((i) => i.ContentRulesPlugin()),
|
|
2356
|
+
"content-rules": () => import("./ContentRulesPlugin.native-nBLQ8QFZ.mjs").then((i) => i.ContentRulesPlugin()),
|
|
2357
|
+
contentrules: () => import("./ContentRulesPlugin.native-nBLQ8QFZ.mjs").then((i) => i.ContentRulesPlugin()),
|
|
2358
|
+
citations: () => import("./CitationsPlugin.native-BnU0qCwR.mjs").then((i) => i.CitationsPlugin()),
|
|
2359
|
+
citation: () => import("./CitationsPlugin.native-BnU0qCwR.mjs").then((i) => i.CitationsPlugin()),
|
|
2360
|
+
approvalWorkflow: () => import("./ApprovalWorkflowPlugin.native-C3jtAYjG.mjs").then((i) => i.ApprovalWorkflowPlugin()),
|
|
2361
|
+
"approval-workflow": () => import("./ApprovalWorkflowPlugin.native-C3jtAYjG.mjs").then((i) => i.ApprovalWorkflowPlugin()),
|
|
2362
|
+
approvalworkflow: () => import("./ApprovalWorkflowPlugin.native-C3jtAYjG.mjs").then((i) => i.ApprovalWorkflowPlugin()),
|
|
2363
|
+
piiRedaction: () => import("./PIIRedactionPlugin.native-DcsjmtV1.mjs").then((i) => i.PIIRedactionPlugin()),
|
|
2364
|
+
"pii-redaction": () => import("./PIIRedactionPlugin.native-DcsjmtV1.mjs").then((i) => i.PIIRedactionPlugin()),
|
|
2365
|
+
piiredaction: () => import("./PIIRedactionPlugin.native-DcsjmtV1.mjs").then((i) => i.PIIRedactionPlugin()),
|
|
2366
|
+
smartPaste: () => import("./SmartPastePlugin.native-BOKKtF07.mjs").then((i) => i.SmartPastePlugin()),
|
|
2367
|
+
"smart-paste": () => import("./SmartPastePlugin.native-BOKKtF07.mjs").then((i) => i.SmartPastePlugin()),
|
|
2368
|
+
smartpaste: () => import("./SmartPastePlugin.native-BOKKtF07.mjs").then((i) => i.SmartPastePlugin()),
|
|
2369
|
+
blocksLibrary: () => import("./BlocksLibraryPlugin.native-HMWKxWNs.mjs").then((i) => i.BlocksLibraryPlugin()),
|
|
2370
|
+
"blocks-library": () => import("./BlocksLibraryPlugin.native-HMWKxWNs.mjs").then((i) => i.BlocksLibraryPlugin()),
|
|
2371
|
+
blockslibrary: () => import("./BlocksLibraryPlugin.native-HMWKxWNs.mjs").then((i) => i.BlocksLibraryPlugin()),
|
|
2372
|
+
mentions: () => import("./MentionPlugin.native-BMDlOqur.mjs").then((i) => i.MentionPlugin()),
|
|
2373
|
+
mention: () => import("./MentionPlugin.native-BMDlOqur.mjs").then((i) => i.MentionPlugin()),
|
|
2374
|
+
anchor: () => import("./AnchorPlugin.native-BcYGEtd9.mjs").then((i) => i.AnchorPlugin()),
|
|
2375
|
+
embedIframe: () => import("./EmbedIframePlugin.native-DKJx2OS7.mjs").then((i) => i.EmbedIframePlugin()),
|
|
2376
|
+
math: () => import("./MathPlugin.native-f_mDp8VL.mjs").then((i) => i.MathPlugin()),
|
|
2377
|
+
image: () => import("./MediaManagerPlugin.native-BiXiK8FC.mjs").then((i) => i.MediaManagerPlugin()),
|
|
2378
|
+
mergeTag: () => import("./MergeTagPlugin.native-C3eOfEgw.mjs").then((i) => i.MergeTagPlugin()),
|
|
2379
|
+
pageBreak: () => import("./PageBreakPlugin.native-DijGuHJZ.mjs").then((i) => i.PageBreakPlugin()),
|
|
2380
|
+
print: () => import("./PrintPlugin.native-7qt5v7L5.mjs").then((i) => i.PrintPlugin()),
|
|
2381
|
+
preview: () => import("./PreviewPlugin.native-WuIwOAOR.mjs").then((i) => i.PreviewPlugin()),
|
|
2382
|
+
specialCharacters: () => import("./SpecialCharactersPlugin.native-CZDato89.mjs").then((i) => i.SpecialCharactersPlugin()),
|
|
2383
|
+
slashCommands: () => import("./SlashCommandsPlugin.native-CmxvMEaE.mjs").then((i) => i.SlashCommandsPlugin()),
|
|
2384
|
+
"slash-commands": () => import("./SlashCommandsPlugin.native-CmxvMEaE.mjs").then((i) => i.SlashCommandsPlugin()),
|
|
2385
|
+
spellCheck: () => import("./SpellCheckPlugin.native-BZB9AewP.mjs").then((i) => i.SpellCheckPlugin()),
|
|
2386
|
+
emojis: () => import("./EmojisPlugin.native-CitxxlWX.mjs").then((i) => i.EmojisPlugin()),
|
|
2387
|
+
a11yChecker: () => import("./A11yCheckerPlugin.native-BRdGYMju.mjs").then((i) => i.A11yCheckerPlugin()),
|
|
2388
|
+
comments: () => import("./CommentsPlugin.native-DPSqTkiv.mjs").then((i) => i.CommentsPlugin()),
|
|
2389
|
+
"document-manager": () => import("./DocumentManagerPlugin.native-C2cs_1w4.mjs").then((i) => i.DocumentManagerPlugin()),
|
|
2390
|
+
fullscreen: () => import("./FullscreenPlugin.native-ChXyxeNw.mjs").then((i) => i.FullscreenPlugin()),
|
|
2391
|
+
template: () => import("./TemplatePlugin.native-CrpfKRJ8.mjs").then((i) => i.TemplatePlugin()),
|
|
2392
|
+
footnote: () => import("./FootnotePlugin.native-D730OGRm.mjs").then((i) => i.FootnotePlugin())
|
|
2246
2393
|
};
|
|
2247
|
-
async function
|
|
2248
|
-
return Object.entries(
|
|
2249
|
-
|
|
2250
|
-
}),
|
|
2394
|
+
async function at() {
|
|
2395
|
+
return Object.entries(rt).forEach(([i, t]) => {
|
|
2396
|
+
k.register(i, t);
|
|
2397
|
+
}), k;
|
|
2251
2398
|
}
|
|
2252
|
-
typeof window != "undefined" &&
|
|
2253
|
-
|
|
2399
|
+
typeof window != "undefined" && at().then((i) => {
|
|
2400
|
+
g.__globalPluginLoader = i, customElements.get("editora-editor") || customElements.define("editora-editor", g);
|
|
2254
2401
|
const t = document.querySelectorAll("editora-editor:not([data-initial-content])"), e = [];
|
|
2255
|
-
t.forEach((
|
|
2256
|
-
const
|
|
2257
|
-
e.push(
|
|
2402
|
+
t.forEach((n) => {
|
|
2403
|
+
const a = n.innerHTML.trim();
|
|
2404
|
+
e.push(a), a && n.setAttribute("data-initial-content", a);
|
|
2258
2405
|
});
|
|
2259
2406
|
const o = document.querySelectorAll("editora-editor");
|
|
2260
|
-
Array.from(o).filter((
|
|
2261
|
-
const
|
|
2262
|
-
e[
|
|
2407
|
+
Array.from(o).filter((n) => !n.hasAttribute("data-initial-content")).forEach((n) => {
|
|
2408
|
+
const a = Array.from(o).indexOf(n);
|
|
2409
|
+
e[a] && n.setAttribute("data-initial-content", e[a]);
|
|
2263
2410
|
}), window.Editora = {
|
|
2264
2411
|
version: "1.0.0",
|
|
2265
|
-
plugins:
|
|
2266
|
-
WebComponent:
|
|
2267
|
-
init: async (
|
|
2268
|
-
const s = document.querySelector(
|
|
2269
|
-
return s instanceof
|
|
2412
|
+
plugins: k.getRegisteredPluginNames(),
|
|
2413
|
+
WebComponent: g,
|
|
2414
|
+
init: async (n, a) => {
|
|
2415
|
+
const s = document.querySelector(n);
|
|
2416
|
+
return s instanceof g ? (a && await s.setConfig(a), s.getAPI()) : null;
|
|
2270
2417
|
}
|
|
2271
2418
|
};
|
|
2272
2419
|
});
|
|
2273
2420
|
export {
|
|
2274
|
-
|
|
2275
|
-
|
|
2421
|
+
g as RichTextEditorElement,
|
|
2422
|
+
at as initWebComponent
|
|
2276
2423
|
};
|
|
2277
2424
|
//# sourceMappingURL=webcomponent.js.map
|