@editora/core 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs} +23 -12
- package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-289a112a.mjs} +112 -102
- package/dist/ApprovalWorkflowPlugin.native-449ce66c.mjs +1115 -0
- package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-8aceb5cc.mjs} +16 -9
- package/dist/{BlockquotePlugin.native-JFmOLsxN.mjs → BlockquotePlugin.native-3541c714.mjs} +3 -2
- package/dist/BlocksLibraryPlugin.native-1cc51e63.mjs +1386 -0
- package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-f9d7f8e4.mjs} +1 -1
- package/dist/{CapitalizationPlugin.native-DOMsh5R7.mjs → CapitalizationPlugin.native-42c135dc.mjs} +3 -2
- package/dist/{ChecklistPlugin.native-nuSSEFNI.mjs → ChecklistPlugin.native-3b397ee9.mjs} +43 -22
- package/dist/CitationsPlugin.native-169fb1e8.mjs +1532 -0
- package/dist/{ClearFormattingPlugin.native-Bq_XcTh2.mjs → ClearFormattingPlugin.native-77baa514.mjs} +11 -6
- package/dist/{CodePlugin.native-DlpTPdkd.mjs → CodePlugin.native-989cf0aa.mjs} +629 -580
- package/dist/{CodeSamplePlugin.native-CgGoH-X4.mjs → CodeSamplePlugin.native-6cc0148e.mjs} +19 -10
- package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-03659874.mjs} +55 -28
- package/dist/ConditionalContentPlugin.native-4983143a.mjs +1424 -0
- package/dist/ContentRulesPlugin.native-63ed405b.mjs +1149 -0
- package/dist/DataBindingPlugin.native-427e9d75.mjs +956 -0
- package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
- package/dist/DocSchemaPlugin.native-8e41eda0.mjs +1382 -0
- package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-e69895ad.mjs} +4 -4
- package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-55209c87.mjs} +70 -70
- package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-65c5ac47.mjs} +11 -6
- package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-f9bc255a.mjs} +7 -4
- package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-f5647872.mjs} +19 -10
- package/dist/{FootnotePlugin.native-D730OGRm.mjs → FootnotePlugin.native-494657b3.mjs} +77 -39
- package/dist/{FullscreenPlugin.native-ChXyxeNw.mjs → FullscreenPlugin.native-87ce92e9.mjs} +1 -1
- package/dist/{HeadingPlugin.native-DrLYwQnQ.mjs → HeadingPlugin.native-e38c4a16.mjs} +1 -1
- package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-92ed4be4.mjs} +43 -22
- package/dist/{IndentPlugin.native-BHixp8sP.mjs → IndentPlugin.native-e4ee902b.mjs} +23 -12
- package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-7c95cfbc.mjs} +1 -1
- package/dist/{LineHeightPlugin.native-CM7iXdQj.mjs → LineHeightPlugin.native-5668f78c.mjs} +19 -10
- package/dist/{LinkPlugin.native-DYCIcdTm.mjs → LinkPlugin.native-6df29111.mjs} +9 -5
- package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-fe2e115a.mjs} +9 -5
- package/dist/{MathPlugin.native-f_mDp8VL.mjs → MathPlugin.native-735bbac2.mjs} +9 -5
- package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs} +219 -207
- package/dist/MentionPlugin.native-3b1e8c05.mjs +778 -0
- package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
- package/dist/PIIRedactionPlugin.native-7ab10b9f.mjs +1449 -0
- package/dist/{PageBreakPlugin.native-CXdX5fAv.mjs → PageBreakPlugin.native-1794c5fb.mjs} +67 -52
- package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-f7b67cc0.mjs} +38 -33
- package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
- package/dist/SlashCommandsPlugin.native-8d45e511.mjs +790 -0
- package/dist/SmartPastePlugin.native-a6c5efec.mjs +1447 -0
- package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-7f06d4ba.mjs} +17 -9
- package/dist/{SpellCheckPlugin.native-BZB9AewP.mjs → SpellCheckPlugin.native-04e20834.mjs} +41 -21
- package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-905e9501.mjs} +9 -5
- package/dist/{TablePlugin.native-DrHX-efe.mjs → TablePlugin.native-7d5458c1.mjs} +58 -30
- package/dist/{TemplatePlugin.native-CrpfKRJ8.mjs → TemplatePlugin.native-580f0f63.mjs} +32 -17
- package/dist/{TextAlignmentPlugin.native-sM_1s00t.mjs → TextAlignmentPlugin.native-9357b3ed.mjs} +11 -6
- package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-d53ed459.mjs} +26 -14
- package/dist/TrackChangesPlugin.native-e96da509.mjs +818 -0
- package/dist/TranslationWorkflowPlugin.native-4e711b1e.mjs +1797 -0
- package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
- package/dist/VersionDiffPlugin.native-5bbeff85.mjs +801 -0
- package/dist/_commonjsHelpers-69d58be2.mjs +31 -0
- package/dist/{anchoredPopover-Bxds0VoB.mjs → anchoredPopover-5cca53ba.mjs} +1 -1
- package/dist/documentManager-8327fb6e.mjs +9166 -0
- package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +3 -2
- package/dist/editora.min.js +14 -13
- package/dist/editora.umd.js +14 -13
- package/dist/{html2canvas.esm-AYkPY5LS.mjs → html2canvas.esm-c51cb3b9.mjs} +978 -894
- package/dist/index-072ef022.js +11 -0
- package/dist/index-49d31221.mjs +16860 -0
- package/dist/{index-yzU4NdPT.mjs → index-7da30697.mjs} +490 -358
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-b47a189f.mjs +5782 -0
- package/dist/index.esm.js +12 -7
- package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-780c82db.mjs} +4808 -3784
- package/dist/plugin-loader.js +77 -40
- package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
- package/dist/style.css +1 -0
- package/dist/webcomponent-core.js +546 -414
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +40 -39
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +484 -315
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +6035 -558
- package/package.json +11 -5
- package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
- package/dist/core.css +0 -1
- package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
- package/dist/index-BpE6GFbz.js +0 -10
- package/dist/index-BslAFzmv.mjs +0 -16544
- package/dist/index.es-BYD2KEo6.mjs +0 -6666
package/dist/webcomponent.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class L {
|
|
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 D {
|
|
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 B {
|
|
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 D(t, e);
|
|
136
136
|
}
|
|
137
137
|
getCommands() {
|
|
138
138
|
const t = {};
|
|
@@ -150,7 +150,7 @@ 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
155
|
switch (a) {
|
|
156
156
|
case "local":
|
|
@@ -166,7 +166,7 @@ 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
|
}
|
|
@@ -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 N {
|
|
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 B(), 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 N(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,10 +315,11 @@ class M {
|
|
|
315
315
|
return this.isDestroyed;
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
class
|
|
318
|
+
class O {
|
|
319
319
|
// PluginLoader instance to get all registered plugins
|
|
320
320
|
setLastCommandTrigger(t, e) {
|
|
321
|
-
if (typeof window == "undefined" || !t)
|
|
321
|
+
if (typeof window == "undefined" || !t)
|
|
322
|
+
return;
|
|
322
323
|
const o = e || t.getAttribute("data-command") || void 0;
|
|
323
324
|
o && (window.__editoraLastCommandButton = t, window.__editoraLastCommand = o);
|
|
324
325
|
}
|
|
@@ -335,9 +336,9 @@ class L {
|
|
|
335
336
|
* Parse toolbar string into button groups
|
|
336
337
|
*/
|
|
337
338
|
parseToolbarString(t) {
|
|
338
|
-
const e = [], o = t.split("|").map((s) => s.trim()), r = this.getAvailableToolbarItems(),
|
|
339
|
+
const e = [], o = t.split("|").map((s) => s.trim()), r = this.getAvailableToolbarItems(), n = /* @__PURE__ */ new Map();
|
|
339
340
|
r.forEach((s) => {
|
|
340
|
-
s.command &&
|
|
341
|
+
s.command && n.set(s.command, s), s.type === "group" && s.label && n.set(s.label, s);
|
|
341
342
|
});
|
|
342
343
|
const a = {
|
|
343
344
|
bold: "toggleBold",
|
|
@@ -350,6 +351,9 @@ class L {
|
|
|
350
351
|
link: "openLinkDialog",
|
|
351
352
|
image: "openImageDialog",
|
|
352
353
|
table: "insertTable",
|
|
354
|
+
trackChanges: "toggleTrackChanges",
|
|
355
|
+
acceptTrackChanges: "acceptAllTrackChanges",
|
|
356
|
+
rejectTrackChanges: "rejectAllTrackChanges",
|
|
353
357
|
anchor: "insertAnchor",
|
|
354
358
|
code: "toggleSourceView",
|
|
355
359
|
blockquote: "toggleBlockquote",
|
|
@@ -381,6 +385,14 @@ class L {
|
|
|
381
385
|
toggleComments: "toggleComments",
|
|
382
386
|
footnote: "insertFootnote",
|
|
383
387
|
mergeTags: "insertMergeTag",
|
|
388
|
+
dataBinding: "openDataBindingDialog",
|
|
389
|
+
dataBindingPreview: "openDataBindingDialog",
|
|
390
|
+
contentRules: "toggleContentRulesPanel",
|
|
391
|
+
contentRulesAudit: "runContentRulesAudit",
|
|
392
|
+
contentRulesRealtime: "toggleContentRulesRealtime",
|
|
393
|
+
mention: "insertMention",
|
|
394
|
+
slash: "openSlashCommands",
|
|
395
|
+
slashCommands: "openSlashCommands",
|
|
384
396
|
pageBreak: "insertPageBreak",
|
|
385
397
|
template: "insertTemplate",
|
|
386
398
|
importWord: "importWord",
|
|
@@ -394,7 +406,7 @@ class L {
|
|
|
394
406
|
const l = [];
|
|
395
407
|
s.split(/\s+/).filter(Boolean).forEach((d) => {
|
|
396
408
|
if (d === "direction") {
|
|
397
|
-
const u =
|
|
409
|
+
const u = n.get("setDirectionLTR"), f = n.get("setDirectionRTL");
|
|
398
410
|
u && l.push({
|
|
399
411
|
id: "directionLTR",
|
|
400
412
|
label: u.label,
|
|
@@ -402,18 +414,18 @@ class L {
|
|
|
402
414
|
icon: u.icon,
|
|
403
415
|
type: u.type || "button",
|
|
404
416
|
options: u.options
|
|
405
|
-
}),
|
|
417
|
+
}), f && l.push({
|
|
406
418
|
id: "directionRTL",
|
|
407
|
-
label:
|
|
408
|
-
command:
|
|
409
|
-
icon:
|
|
410
|
-
type:
|
|
411
|
-
options:
|
|
419
|
+
label: f.label,
|
|
420
|
+
command: f.command,
|
|
421
|
+
icon: f.icon,
|
|
422
|
+
type: f.type || "button",
|
|
423
|
+
options: f.options
|
|
412
424
|
});
|
|
413
425
|
return;
|
|
414
426
|
}
|
|
415
427
|
if (d === "comments") {
|
|
416
|
-
const u =
|
|
428
|
+
const u = n.get("addComment"), f = n.get("toggleComments");
|
|
417
429
|
u && l.push({
|
|
418
430
|
id: "addComment",
|
|
419
431
|
label: u.label,
|
|
@@ -421,26 +433,26 @@ class L {
|
|
|
421
433
|
icon: u.icon,
|
|
422
434
|
type: u.type || "button",
|
|
423
435
|
options: u.options
|
|
424
|
-
}),
|
|
436
|
+
}), f && l.push({
|
|
425
437
|
id: "toggleComments",
|
|
426
|
-
label:
|
|
427
|
-
command:
|
|
428
|
-
icon:
|
|
429
|
-
type:
|
|
430
|
-
options:
|
|
438
|
+
label: f.label,
|
|
439
|
+
command: f.command,
|
|
440
|
+
icon: f.icon,
|
|
441
|
+
type: f.type || "button",
|
|
442
|
+
options: f.options
|
|
431
443
|
});
|
|
432
444
|
return;
|
|
433
445
|
}
|
|
434
|
-
const
|
|
435
|
-
let
|
|
436
|
-
|
|
446
|
+
const h = a[d] || d;
|
|
447
|
+
let p = n.get(h);
|
|
448
|
+
p || (p = n.get(d)), p && l.push({
|
|
437
449
|
id: d,
|
|
438
|
-
label:
|
|
439
|
-
command:
|
|
440
|
-
icon:
|
|
441
|
-
type:
|
|
442
|
-
options:
|
|
443
|
-
items:
|
|
450
|
+
label: p.label,
|
|
451
|
+
command: p.command,
|
|
452
|
+
icon: p.icon,
|
|
453
|
+
type: p.type === "separator" ? "separator" : p.type || "button",
|
|
454
|
+
options: p.options,
|
|
455
|
+
items: p.items
|
|
444
456
|
});
|
|
445
457
|
}), l.length > 0 && e.push(l);
|
|
446
458
|
}), e;
|
|
@@ -457,11 +469,11 @@ class L {
|
|
|
457
469
|
render(t) {
|
|
458
470
|
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}`);
|
|
459
471
|
const e = this.config.items || this.getDefaultToolbarString(), o = this.parseToolbarString(e);
|
|
460
|
-
o.forEach((r,
|
|
472
|
+
o.forEach((r, n) => {
|
|
461
473
|
const a = document.createElement("div");
|
|
462
474
|
if (a.className = "editora-toolbar-group", r.forEach((s) => {
|
|
463
475
|
this.appendToolbarButton(a, s);
|
|
464
|
-
}), t.appendChild(a),
|
|
476
|
+
}), t.appendChild(a), n < o.length - 1) {
|
|
465
477
|
const s = document.createElement("div");
|
|
466
478
|
s.className = "editora-toolbar-separator", t.appendChild(s);
|
|
467
479
|
}
|
|
@@ -495,18 +507,18 @@ class L {
|
|
|
495
507
|
* Create a toolbar button element
|
|
496
508
|
*/
|
|
497
509
|
createGroupButton(t) {
|
|
498
|
-
const e = document.createElement("div");
|
|
499
|
-
if (e.className =
|
|
510
|
+
const e = document.createElement("div"), o = t.label.toLowerCase().replace(/\s+/g, "-");
|
|
511
|
+
if (e.className = `editora-toolbar-group-button ${o}`, e.title = t.label, t.icon)
|
|
500
512
|
if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
|
|
501
|
-
const
|
|
502
|
-
|
|
513
|
+
const r = document.createElement("span");
|
|
514
|
+
r.className = "editora-toolbar-icon", r.innerHTML = t.icon, e.appendChild(r);
|
|
503
515
|
} else
|
|
504
516
|
e.innerHTML = t.icon;
|
|
505
517
|
if (t.items && t.items.length) {
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
this.appendToolbarButton(
|
|
509
|
-
}), e.appendChild(
|
|
518
|
+
const r = document.createElement("div");
|
|
519
|
+
r.className = `editora-toolbar-group-items ${o}`, t.items.forEach((n) => {
|
|
520
|
+
this.appendToolbarButton(r, n);
|
|
521
|
+
}), e.appendChild(r);
|
|
510
522
|
}
|
|
511
523
|
return e;
|
|
512
524
|
}
|
|
@@ -555,13 +567,13 @@ class L {
|
|
|
555
567
|
const l = r.style.display === "block";
|
|
556
568
|
r.style.display = l ? "none" : "block";
|
|
557
569
|
});
|
|
558
|
-
const
|
|
570
|
+
const n = (s) => {
|
|
559
571
|
e.contains(s.target) || (r.style.display = "none");
|
|
560
572
|
}, a = (s) => {
|
|
561
573
|
s.key === "Escape" && (r.style.display = "none");
|
|
562
574
|
};
|
|
563
|
-
return document.addEventListener("mousedown",
|
|
564
|
-
document.removeEventListener("mousedown",
|
|
575
|
+
return document.addEventListener("mousedown", n, !0), document.addEventListener("keydown", a), e._cleanupDropdown = () => {
|
|
576
|
+
document.removeEventListener("mousedown", n, !0), document.removeEventListener("keydown", a);
|
|
565
577
|
}, e.appendChild(o), e.appendChild(r), e;
|
|
566
578
|
}
|
|
567
579
|
/**
|
|
@@ -595,13 +607,13 @@ class L {
|
|
|
595
607
|
d !== r && (d.style.display = "none");
|
|
596
608
|
}), r.style.display = r.style.display === "none" ? "block" : "none";
|
|
597
609
|
});
|
|
598
|
-
const
|
|
610
|
+
const n = (s) => {
|
|
599
611
|
e.contains(s.target) || (r.style.display = "none");
|
|
600
612
|
}, a = (s) => {
|
|
601
613
|
s.key === "Escape" && (r.style.display = "none");
|
|
602
614
|
};
|
|
603
|
-
return document.addEventListener("mousedown",
|
|
604
|
-
document.removeEventListener("mousedown",
|
|
615
|
+
return document.addEventListener("mousedown", n, !0), document.addEventListener("keydown", a), e._cleanupDropdown = () => {
|
|
616
|
+
document.removeEventListener("mousedown", n, !0), document.removeEventListener("keydown", a);
|
|
605
617
|
}, e.appendChild(o), e.appendChild(r), e;
|
|
606
618
|
}
|
|
607
619
|
/**
|
|
@@ -614,7 +626,8 @@ class L {
|
|
|
614
626
|
* Update button state
|
|
615
627
|
*/
|
|
616
628
|
updateButtonState(t, e) {
|
|
617
|
-
if (!this.container)
|
|
629
|
+
if (!this.container)
|
|
630
|
+
return;
|
|
618
631
|
const o = this.container.querySelector(
|
|
619
632
|
`[data-command="${t}"]`
|
|
620
633
|
);
|
|
@@ -630,7 +643,7 @@ class L {
|
|
|
630
643
|
}), this.container.innerHTML = ""), this.commandHandler = void 0;
|
|
631
644
|
}
|
|
632
645
|
}
|
|
633
|
-
class
|
|
646
|
+
class z {
|
|
634
647
|
constructor(t) {
|
|
635
648
|
this.visible = !1, this.config = t;
|
|
636
649
|
}
|
|
@@ -672,7 +685,7 @@ class T {
|
|
|
672
685
|
this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0, this.visible = !1;
|
|
673
686
|
}
|
|
674
687
|
}
|
|
675
|
-
class
|
|
688
|
+
class H {
|
|
676
689
|
constructor(t = {}) {
|
|
677
690
|
this.statusInfo = {}, this.config = t;
|
|
678
691
|
}
|
|
@@ -693,7 +706,8 @@ class I {
|
|
|
693
706
|
* Render status bar content
|
|
694
707
|
*/
|
|
695
708
|
render() {
|
|
696
|
-
if (!this.container)
|
|
709
|
+
if (!this.container)
|
|
710
|
+
return;
|
|
697
711
|
this.container.innerHTML = "";
|
|
698
712
|
const t = document.createElement("div");
|
|
699
713
|
t.className = "editora-statusbar-left";
|
|
@@ -701,25 +715,25 @@ class I {
|
|
|
701
715
|
e.className = "editora-statusbar-right";
|
|
702
716
|
const o = [];
|
|
703
717
|
if (this.statusInfo.selectionInfo) {
|
|
704
|
-
const
|
|
705
|
-
|
|
718
|
+
const n = this.statusInfo.selectionInfo;
|
|
719
|
+
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`));
|
|
706
720
|
} else if (this.statusInfo.cursorPosition) {
|
|
707
|
-
const
|
|
708
|
-
o.push(`Ln ${
|
|
721
|
+
const n = this.statusInfo.cursorPosition;
|
|
722
|
+
o.push(`Ln ${n.line}, Col ${n.column}`);
|
|
709
723
|
}
|
|
710
724
|
this.statusInfo.language && o.push(this.statusInfo.language);
|
|
711
725
|
const r = [];
|
|
712
|
-
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(([
|
|
713
|
-
r.push(`${
|
|
714
|
-
}), o.forEach((
|
|
726
|
+
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]) => {
|
|
727
|
+
r.push(`${n}: ${a}`);
|
|
728
|
+
}), o.forEach((n, a) => {
|
|
715
729
|
const s = document.createElement("span");
|
|
716
|
-
if (s.className = "editora-statusbar-item", s.textContent =
|
|
730
|
+
if (s.className = "editora-statusbar-item", s.textContent = n, t.appendChild(s), a < o.length - 1) {
|
|
717
731
|
const l = document.createElement("span");
|
|
718
732
|
l.className = "editora-statusbar-separator", l.textContent = "|", t.appendChild(l);
|
|
719
733
|
}
|
|
720
|
-
}), r.forEach((
|
|
734
|
+
}), r.forEach((n, a) => {
|
|
721
735
|
const s = document.createElement("span");
|
|
722
|
-
if (s.className = "editora-statusbar-item", s.textContent =
|
|
736
|
+
if (s.className = "editora-statusbar-item", s.textContent = n, e.appendChild(s), a < r.length - 1) {
|
|
723
737
|
const l = document.createElement("span");
|
|
724
738
|
l.className = "editora-statusbar-separator", l.textContent = "|", e.appendChild(l);
|
|
725
739
|
}
|
|
@@ -732,50 +746,51 @@ class I {
|
|
|
732
746
|
this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0;
|
|
733
747
|
}
|
|
734
748
|
}
|
|
735
|
-
function
|
|
736
|
-
const e =
|
|
737
|
-
`), a =
|
|
749
|
+
function j(i, t) {
|
|
750
|
+
const e = i.textContent || "", o = F(i, t.startContainer, t.startOffset), n = e.substring(0, o).split(`
|
|
751
|
+
`), a = n.length, s = n[n.length - 1].length + 1;
|
|
738
752
|
return { line: a, column: s };
|
|
739
753
|
}
|
|
740
|
-
function
|
|
754
|
+
function F(i, t, e) {
|
|
741
755
|
var a;
|
|
742
756
|
let o = 0;
|
|
743
757
|
const r = document.createTreeWalker(
|
|
744
|
-
|
|
758
|
+
i,
|
|
745
759
|
NodeFilter.SHOW_TEXT,
|
|
746
760
|
null
|
|
747
761
|
);
|
|
748
|
-
let
|
|
749
|
-
for (;
|
|
750
|
-
if (
|
|
762
|
+
let n = r.firstChild();
|
|
763
|
+
for (; n; ) {
|
|
764
|
+
if (n === t) {
|
|
751
765
|
o += e;
|
|
752
766
|
break;
|
|
753
|
-
} else
|
|
754
|
-
|
|
767
|
+
} else
|
|
768
|
+
n.nodeType === Node.TEXT_NODE && (o += ((a = n.textContent) == null ? void 0 : a.length) || 0);
|
|
769
|
+
n = r.nextNode();
|
|
755
770
|
}
|
|
756
771
|
return o;
|
|
757
772
|
}
|
|
758
|
-
function
|
|
773
|
+
function $(i) {
|
|
759
774
|
var o, r;
|
|
760
|
-
const t =
|
|
775
|
+
const t = i.querySelectorAll("div, p, br, h1, h2, h3, h4, h5, h6, blockquote, li, pre");
|
|
761
776
|
let e = 1;
|
|
762
777
|
if (t.length > 0) {
|
|
763
778
|
e = t.length;
|
|
764
|
-
const
|
|
765
|
-
(
|
|
779
|
+
const n = t[t.length - 1];
|
|
780
|
+
(n.tagName === "BR" || ((o = n.innerHTML) == null ? void 0 : o.trim()) === "" || ((r = n.textContent) == null ? void 0 : r.trim()) === "") && e++;
|
|
766
781
|
} else {
|
|
767
|
-
const a = (
|
|
782
|
+
const a = (i.textContent || "").split(`
|
|
768
783
|
`).length;
|
|
769
784
|
e = Math.max(1, a);
|
|
770
785
|
}
|
|
771
786
|
return e;
|
|
772
787
|
}
|
|
773
|
-
function
|
|
774
|
-
const t =
|
|
788
|
+
function W(i) {
|
|
789
|
+
const t = i.trim() ? i.trim().split(/\s+/).length : 0, e = i.length;
|
|
775
790
|
return { words: t, chars: e };
|
|
776
791
|
}
|
|
777
|
-
function
|
|
778
|
-
const e =
|
|
792
|
+
function _(i, t) {
|
|
793
|
+
const e = i.toString();
|
|
779
794
|
return {
|
|
780
795
|
startLine: t.line,
|
|
781
796
|
startColumn: t.column,
|
|
@@ -786,7 +801,7 @@ function B(n, t) {
|
|
|
786
801
|
selectedWords: e.trim().split(/\s+/).filter(Boolean).length
|
|
787
802
|
};
|
|
788
803
|
}
|
|
789
|
-
class
|
|
804
|
+
class U {
|
|
790
805
|
constructor(t) {
|
|
791
806
|
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) => {
|
|
792
807
|
this.registerShortcut(e);
|
|
@@ -1072,7 +1087,8 @@ class O {
|
|
|
1072
1087
|
return t.ctrlKey && e.push("ctrl"), t.altKey && e.push("alt"), t.shiftKey && e.push("shift"), t.metaKey && e.push("meta"), e.push(t.key.toLowerCase()), e.join("+");
|
|
1073
1088
|
}
|
|
1074
1089
|
handleKeyDown(t, e) {
|
|
1075
|
-
if (!this.enabled)
|
|
1090
|
+
if (!this.enabled)
|
|
1091
|
+
return !1;
|
|
1076
1092
|
const o = this.getEventKey(t), r = this.shortcuts.get(o);
|
|
1077
1093
|
return r ? (r.preventDefault !== !1 && (t.preventDefault(), t.stopPropagation()), e(r.command, r.params), !0) : !1;
|
|
1078
1094
|
}
|
|
@@ -1100,14 +1116,14 @@ class O {
|
|
|
1100
1116
|
getShortcutsHelp() {
|
|
1101
1117
|
const t = this.getAllShortcuts(), e = /* @__PURE__ */ new Map();
|
|
1102
1118
|
t.forEach((r) => {
|
|
1103
|
-
const
|
|
1104
|
-
e.has(
|
|
1119
|
+
const n = this.getShortcutCategory(r.command);
|
|
1120
|
+
e.has(n) || e.set(n, []), e.get(n).push(r);
|
|
1105
1121
|
});
|
|
1106
1122
|
let o = `# Keyboard Shortcuts
|
|
1107
1123
|
|
|
1108
1124
|
`;
|
|
1109
|
-
return e.forEach((r,
|
|
1110
|
-
o += `## ${
|
|
1125
|
+
return e.forEach((r, n) => {
|
|
1126
|
+
o += `## ${n}
|
|
1111
1127
|
|
|
1112
1128
|
`, r.forEach((a) => {
|
|
1113
1129
|
const s = this.getShortcutDescription(a);
|
|
@@ -1121,7 +1137,7 @@ class O {
|
|
|
1121
1137
|
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";
|
|
1122
1138
|
}
|
|
1123
1139
|
}
|
|
1124
|
-
const
|
|
1140
|
+
const K = [
|
|
1125
1141
|
"p",
|
|
1126
1142
|
"br",
|
|
1127
1143
|
"strong",
|
|
@@ -1156,11 +1172,12 @@ const H = [
|
|
|
1156
1172
|
"code",
|
|
1157
1173
|
"span",
|
|
1158
1174
|
"div",
|
|
1175
|
+
"section",
|
|
1159
1176
|
"sup",
|
|
1160
1177
|
"sub",
|
|
1161
1178
|
"hr"
|
|
1162
|
-
],
|
|
1163
|
-
"*": ["class", "style", "id", "data-*"],
|
|
1179
|
+
], q = {
|
|
1180
|
+
"*": ["class", "style", "id", "data-*", "role", "aria-*", "tabindex", "contenteditable", "spellcheck"],
|
|
1164
1181
|
a: ["href", "target", "rel", "title"],
|
|
1165
1182
|
img: ["src", "alt", "width", "height", "loading"],
|
|
1166
1183
|
video: ["src", "controls", "width", "height", "autoplay", "loop", "muted"],
|
|
@@ -1169,51 +1186,52 @@ const H = [
|
|
|
1169
1186
|
td: ["colspan", "rowspan", "align", "valign"],
|
|
1170
1187
|
th: ["colspan", "rowspan", "align", "valign"]
|
|
1171
1188
|
};
|
|
1172
|
-
function
|
|
1189
|
+
function M(i, t, e) {
|
|
1173
1190
|
if ((t == null ? void 0 : t.sanitize) === !1)
|
|
1174
|
-
return
|
|
1175
|
-
const o = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags :
|
|
1176
|
-
return a.innerHTML =
|
|
1191
|
+
return i;
|
|
1192
|
+
const o = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags : K, n = !!(t != null && t.allowedAttributes) && Object.keys(t.allowedAttributes).length > 0 ? t.allowedAttributes : q, a = document.createElement("div");
|
|
1193
|
+
return a.innerHTML = i, P(a, o, n), a.innerHTML;
|
|
1177
1194
|
}
|
|
1178
|
-
function
|
|
1179
|
-
const o = Array.from(
|
|
1195
|
+
function P(i, t, e) {
|
|
1196
|
+
const o = Array.from(i.childNodes);
|
|
1180
1197
|
for (const r of o)
|
|
1181
1198
|
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
1182
|
-
const
|
|
1199
|
+
const n = r, a = n.tagName.toLowerCase();
|
|
1183
1200
|
if (!t.includes(a)) {
|
|
1184
|
-
for (;
|
|
1185
|
-
|
|
1186
|
-
|
|
1201
|
+
for (; n.firstChild; )
|
|
1202
|
+
i.insertBefore(n.firstChild, n);
|
|
1203
|
+
i.removeChild(n);
|
|
1187
1204
|
continue;
|
|
1188
1205
|
}
|
|
1189
|
-
|
|
1190
|
-
} else
|
|
1206
|
+
V(n, e), P(n, t, e);
|
|
1207
|
+
} else
|
|
1208
|
+
r.nodeType !== Node.TEXT_NODE && i.removeChild(r);
|
|
1191
1209
|
}
|
|
1192
|
-
function
|
|
1193
|
-
const e =
|
|
1210
|
+
function V(i, t) {
|
|
1211
|
+
const e = i.tagName.toLowerCase(), o = Array.from(i.attributes), r = t[e] || [], n = t["*"] || [], a = [...r, ...n];
|
|
1194
1212
|
for (const s of o) {
|
|
1195
1213
|
const l = s.name.toLowerCase();
|
|
1196
1214
|
let c = !1;
|
|
1197
1215
|
a.includes(l) && (c = !0);
|
|
1198
1216
|
for (const d of a)
|
|
1199
1217
|
if (d.endsWith("*")) {
|
|
1200
|
-
const
|
|
1201
|
-
if (l.startsWith(
|
|
1218
|
+
const h = d.slice(0, -1);
|
|
1219
|
+
if (l.startsWith(h)) {
|
|
1202
1220
|
c = !0;
|
|
1203
1221
|
break;
|
|
1204
1222
|
}
|
|
1205
1223
|
}
|
|
1206
|
-
(l.startsWith("on") || l === "javascript:" || l === "href" && s.value.trim().toLowerCase().startsWith("javascript:") || l === "src" && s.value.trim().toLowerCase().startsWith("javascript:")) && (c = !1), c ||
|
|
1224
|
+
(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);
|
|
1207
1225
|
}
|
|
1208
|
-
|
|
1226
|
+
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");
|
|
1209
1227
|
}
|
|
1210
|
-
function
|
|
1211
|
-
return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ?
|
|
1228
|
+
function G(i, t, e) {
|
|
1229
|
+
return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ? i : M(i, t);
|
|
1212
1230
|
}
|
|
1213
|
-
function
|
|
1214
|
-
return (e == null ? void 0 : e.sanitizeOnInput) === !1 ?
|
|
1231
|
+
function X(i, t, e) {
|
|
1232
|
+
return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? i : M(i, t);
|
|
1215
1233
|
}
|
|
1216
|
-
|
|
1234
|
+
class I {
|
|
1217
1235
|
/**
|
|
1218
1236
|
* Resolve configuration from multiple sources with priority
|
|
1219
1237
|
*/
|
|
@@ -1273,24 +1291,24 @@ const k = class k {
|
|
|
1273
1291
|
const a = typeof e.spellcheck == "object" && e.spellcheck ? { ...e.spellcheck } : {};
|
|
1274
1292
|
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;
|
|
1275
1293
|
}
|
|
1276
|
-
const
|
|
1294
|
+
const n = {
|
|
1277
1295
|
enabled: !1,
|
|
1278
1296
|
provider: "browser",
|
|
1279
1297
|
apiUrl: ""
|
|
1280
1298
|
};
|
|
1281
1299
|
if (typeof e.spellcheck == "boolean")
|
|
1282
1300
|
e.spellcheck = {
|
|
1283
|
-
...
|
|
1301
|
+
...n,
|
|
1284
1302
|
enabled: e.spellcheck
|
|
1285
1303
|
};
|
|
1286
1304
|
else if (typeof e.spellcheck == "object" && e.spellcheck) {
|
|
1287
1305
|
const a = {
|
|
1288
|
-
...
|
|
1306
|
+
...n,
|
|
1289
1307
|
...e.spellcheck
|
|
1290
1308
|
};
|
|
1291
1309
|
!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;
|
|
1292
1310
|
} else
|
|
1293
|
-
e.spellcheck =
|
|
1311
|
+
e.spellcheck = n;
|
|
1294
1312
|
return e.contextMenuEnabled !== void 0 && (e.contextMenu = {
|
|
1295
1313
|
enabled: !!e.contextMenuEnabled
|
|
1296
1314
|
}), typeof e.contextMenu == "boolean" ? e.contextMenu = { enabled: e.contextMenu } : typeof e.contextMenu == "object" && e.contextMenu ? e.contextMenu = {
|
|
@@ -1351,8 +1369,8 @@ const k = class k {
|
|
|
1351
1369
|
static parseAttributes(t) {
|
|
1352
1370
|
const e = {};
|
|
1353
1371
|
for (const [o, r] of Object.entries(t)) {
|
|
1354
|
-
const
|
|
1355
|
-
e[
|
|
1372
|
+
const n = this.kebabToCamel(o);
|
|
1373
|
+
e[n] = this.parseAttributeValue(r);
|
|
1356
1374
|
}
|
|
1357
1375
|
return e;
|
|
1358
1376
|
}
|
|
@@ -1360,10 +1378,14 @@ const k = class k {
|
|
|
1360
1378
|
* Parse attribute value to appropriate type
|
|
1361
1379
|
*/
|
|
1362
1380
|
static parseAttributeValue(t) {
|
|
1363
|
-
if (t === "true")
|
|
1364
|
-
|
|
1365
|
-
if (
|
|
1366
|
-
|
|
1381
|
+
if (t === "true")
|
|
1382
|
+
return !0;
|
|
1383
|
+
if (t === "false")
|
|
1384
|
+
return !1;
|
|
1385
|
+
if (/^\d+$/.test(t))
|
|
1386
|
+
return parseInt(t, 10);
|
|
1387
|
+
if (/^\d+\.\d+$/.test(t))
|
|
1388
|
+
return parseFloat(t);
|
|
1367
1389
|
if (t.startsWith("{") || t.startsWith("["))
|
|
1368
1390
|
try {
|
|
1369
1391
|
return JSON.parse(t);
|
|
@@ -1400,12 +1422,12 @@ const k = class k {
|
|
|
1400
1422
|
static merge(...t) {
|
|
1401
1423
|
const e = {};
|
|
1402
1424
|
for (const o of t)
|
|
1403
|
-
for (const [r,
|
|
1404
|
-
|
|
1425
|
+
for (const [r, n] of Object.entries(o))
|
|
1426
|
+
n != null && (typeof n == "object" && !Array.isArray(n) && e[r] ? e[r] = this.merge(e[r], n) : e[r] = n);
|
|
1405
1427
|
return e;
|
|
1406
1428
|
}
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1429
|
+
}
|
|
1430
|
+
I.EDITOR_DEFAULTS = {
|
|
1409
1431
|
height: 400,
|
|
1410
1432
|
width: "100%",
|
|
1411
1433
|
readonly: !1,
|
|
@@ -1455,26 +1477,96 @@ k.EDITOR_DEFAULTS = {
|
|
|
1455
1477
|
},
|
|
1456
1478
|
statusbar: !1
|
|
1457
1479
|
};
|
|
1458
|
-
let v = k;
|
|
1459
|
-
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}}';
|
|
1460
|
-
let
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1480
|
+
const Y = `.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 0%,#1c2430 100%);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:white;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 0%,#1b2430 100%)!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 0%,#252d37 100%);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:rgba(0,102,204,.2)}.editora-theme-dark .editora-content ::selection{background:rgba(77,184,255,.2)}.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:#ffffff;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:#ffffff;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:#ffffff;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}}
|
|
1481
|
+
`;
|
|
1482
|
+
let y;
|
|
1483
|
+
const J = "__editoraCommandEditorRoot", Q = "__editoraLastCommandButton", E = "editora-editor, [data-editora-editor], .rte-editor, .editora-editor", S = ".rte-content, .editora-content", x = /* @__PURE__ */ new Set();
|
|
1484
|
+
let m = null, A = !1, w = null, C = null;
|
|
1485
|
+
function T(i) {
|
|
1486
|
+
if (!(i instanceof HTMLElement))
|
|
1487
|
+
return !1;
|
|
1488
|
+
const t = i;
|
|
1489
|
+
return typeof t.execCommand == "function" && (t.tagName.toLowerCase() === "editora-editor" || t.classList.contains("editora-editor") || t.hasAttribute("data-editora-editor"));
|
|
1490
|
+
}
|
|
1491
|
+
function Z(i) {
|
|
1492
|
+
return i ? i.nodeType === Node.ELEMENT_NODE ? i : i.parentElement : null;
|
|
1493
|
+
}
|
|
1494
|
+
function b(i) {
|
|
1495
|
+
if (!i)
|
|
1496
|
+
return null;
|
|
1497
|
+
if (T(i))
|
|
1498
|
+
return i;
|
|
1499
|
+
const t = i.matches(E) ? i : i.closest(E);
|
|
1500
|
+
return !t || !T(t) ? null : t;
|
|
1501
|
+
}
|
|
1502
|
+
function tt() {
|
|
1503
|
+
var r;
|
|
1504
|
+
if (typeof window == "undefined")
|
|
1505
|
+
return null;
|
|
1506
|
+
const i = window[J];
|
|
1507
|
+
if (i instanceof HTMLElement) {
|
|
1508
|
+
const n = b(i);
|
|
1509
|
+
if (n)
|
|
1510
|
+
return n;
|
|
1511
|
+
const a = i.matches(S) ? i : i.querySelector(S);
|
|
1512
|
+
if (a) {
|
|
1513
|
+
const s = b(a);
|
|
1514
|
+
if (s)
|
|
1515
|
+
return s;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
const t = window[Q];
|
|
1519
|
+
if (t instanceof HTMLElement) {
|
|
1520
|
+
const n = b(t);
|
|
1521
|
+
if (n)
|
|
1522
|
+
return n;
|
|
1523
|
+
}
|
|
1524
|
+
const e = document.activeElement;
|
|
1525
|
+
if (e) {
|
|
1526
|
+
const n = b(e);
|
|
1527
|
+
if (n)
|
|
1528
|
+
return n;
|
|
1529
|
+
}
|
|
1530
|
+
const o = (r = window.getSelection) == null ? void 0 : r.call(window);
|
|
1531
|
+
if (o && o.rangeCount > 0) {
|
|
1532
|
+
const n = b(Z(o.getRangeAt(0).startContainer));
|
|
1533
|
+
if (n)
|
|
1534
|
+
return n;
|
|
1535
|
+
}
|
|
1536
|
+
if (m && m.isConnected)
|
|
1537
|
+
return m;
|
|
1538
|
+
for (const n of x)
|
|
1539
|
+
if (n.isConnected)
|
|
1540
|
+
return n;
|
|
1541
|
+
return null;
|
|
1542
|
+
}
|
|
1543
|
+
function et() {
|
|
1544
|
+
if (typeof window == "undefined" || A)
|
|
1545
|
+
return;
|
|
1546
|
+
w = typeof window.executeEditorCommand == "function" ? window.executeEditorCommand.bind(window) : null, C = typeof window.execEditorCommand == "function" ? window.execEditorCommand.bind(window) : null;
|
|
1547
|
+
const i = (t, e) => {
|
|
1548
|
+
const o = tt();
|
|
1549
|
+
return o ? o.execCommand(t, e) : w ? w(t, e) : C ? C(t, e) : !1;
|
|
1550
|
+
};
|
|
1551
|
+
window.executeEditorCommand = i, window.execEditorCommand = i, A = !0;
|
|
1552
|
+
}
|
|
1553
|
+
function ot() {
|
|
1554
|
+
const i = "editora-webcomponent-styles";
|
|
1555
|
+
if (!document.getElementById(i)) {
|
|
1464
1556
|
const t = document.createElement("style");
|
|
1465
|
-
t.id =
|
|
1557
|
+
t.id = i, t.textContent = Y, document.head.appendChild(t);
|
|
1466
1558
|
}
|
|
1467
1559
|
}
|
|
1468
|
-
function
|
|
1469
|
-
if (!
|
|
1470
|
-
const
|
|
1471
|
-
|
|
1560
|
+
function it() {
|
|
1561
|
+
if (!y) {
|
|
1562
|
+
const i = g.__globalPluginLoader;
|
|
1563
|
+
i ? y = i : y = new L();
|
|
1472
1564
|
}
|
|
1473
|
-
return
|
|
1565
|
+
return y;
|
|
1474
1566
|
}
|
|
1475
|
-
class
|
|
1567
|
+
class g extends HTMLElement {
|
|
1476
1568
|
constructor() {
|
|
1477
|
-
if (super(), this.pluginLoader =
|
|
1569
|
+
if (super(), this.pluginLoader = it(), this.config = {}, this.isInitialized = !1, this.keyboardShortcutManager = new U(), this.lastAutosavedContent = "", this.loadedPlugins = [], this.lastBeforeInputType = null, ot(), !this.hasAttribute("data-initial-content")) {
|
|
1478
1570
|
const t = this.innerHTML.trim();
|
|
1479
1571
|
t && this.setAttribute("data-initial-content", t);
|
|
1480
1572
|
}
|
|
@@ -1537,16 +1629,16 @@ class p extends HTMLElement {
|
|
|
1537
1629
|
});
|
|
1538
1630
|
}
|
|
1539
1631
|
/**
|
|
1540
|
-
* Wait for the
|
|
1632
|
+
* Wait for the globalThis plugin loader to be available
|
|
1541
1633
|
*/
|
|
1542
1634
|
async waitForPluginLoader() {
|
|
1543
|
-
if (
|
|
1544
|
-
this.pluginLoader =
|
|
1635
|
+
if (g.__globalPluginLoader) {
|
|
1636
|
+
this.pluginLoader = g.__globalPluginLoader;
|
|
1545
1637
|
return;
|
|
1546
1638
|
}
|
|
1547
1639
|
return new Promise((t) => {
|
|
1548
1640
|
const e = () => {
|
|
1549
|
-
|
|
1641
|
+
g.__globalPluginLoader ? (this.pluginLoader = g.__globalPluginLoader, t()) : setTimeout(e, 0);
|
|
1550
1642
|
};
|
|
1551
1643
|
e();
|
|
1552
1644
|
});
|
|
@@ -1574,19 +1666,20 @@ class p extends HTMLElement {
|
|
|
1574
1666
|
*/
|
|
1575
1667
|
async initialize() {
|
|
1576
1668
|
var o;
|
|
1577
|
-
if (this.querySelector(".editora-toolbar") || this.isInitialized)
|
|
1578
|
-
|
|
1669
|
+
if (this.querySelector(".editora-toolbar") || this.isInitialized)
|
|
1670
|
+
return;
|
|
1671
|
+
this.setAttribute("data-editora-editor", "true"), x.add(this), m || (m = this), et(), 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}`);
|
|
1579
1672
|
const t = await this.loadPlugins();
|
|
1580
1673
|
this.loadedPlugins = t, t.forEach((r) => {
|
|
1581
1674
|
if (r.init && typeof r.init == "function")
|
|
1582
1675
|
try {
|
|
1583
1676
|
r.init({ editorElement: this });
|
|
1584
|
-
} catch (
|
|
1585
|
-
console.error(`[RichTextEditor] Error initializing plugin ${r.name}:`,
|
|
1677
|
+
} catch (n) {
|
|
1678
|
+
console.error(`[RichTextEditor] Error initializing plugin ${r.name}:`, n);
|
|
1586
1679
|
}
|
|
1587
1680
|
});
|
|
1588
1681
|
const e = (o = this.restoreAutosavedContent()) != null ? o : this.getAttribute("data-initial-content") || "";
|
|
1589
|
-
this.engine = new
|
|
1682
|
+
this.engine = new R({
|
|
1590
1683
|
content: e,
|
|
1591
1684
|
plugins: t,
|
|
1592
1685
|
readonly: this.config.readonly
|
|
@@ -1612,27 +1705,27 @@ class p extends HTMLElement {
|
|
|
1612
1705
|
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;
|
|
1613
1706
|
if (e) {
|
|
1614
1707
|
if (typeof this.config.plugins == "string") {
|
|
1615
|
-
const
|
|
1616
|
-
r && !
|
|
1617
|
-
for (const a of
|
|
1708
|
+
const n = this.config.plugins.split(/\s+/).filter(Boolean);
|
|
1709
|
+
r && !n.includes("a11yChecker") && n.push("a11yChecker");
|
|
1710
|
+
for (const a of n) {
|
|
1618
1711
|
const s = await this.pluginLoader.load(a, this.getPluginLoadConfig(a));
|
|
1619
1712
|
s && t.push(s);
|
|
1620
1713
|
}
|
|
1621
1714
|
} else if (Array.isArray(this.config.plugins)) {
|
|
1622
|
-
for (const
|
|
1623
|
-
if (typeof
|
|
1624
|
-
const a = await this.pluginLoader.load(
|
|
1715
|
+
for (const n of this.config.plugins)
|
|
1716
|
+
if (typeof n == "string") {
|
|
1717
|
+
const a = await this.pluginLoader.load(n, this.getPluginLoadConfig(n));
|
|
1625
1718
|
a && t.push(a);
|
|
1626
1719
|
} else
|
|
1627
|
-
t.push(
|
|
1628
|
-
if (r && !t.some((
|
|
1629
|
-
const
|
|
1630
|
-
|
|
1720
|
+
t.push(n);
|
|
1721
|
+
if (r && !t.some((n) => (n == null ? void 0 : n.name) === "a11yChecker")) {
|
|
1722
|
+
const n = await this.pluginLoader.load("a11yChecker", this.getPluginLoadConfig("a11yChecker"));
|
|
1723
|
+
n && t.push(n);
|
|
1631
1724
|
}
|
|
1632
1725
|
}
|
|
1633
1726
|
} else {
|
|
1634
|
-
const
|
|
1635
|
-
for (const a of
|
|
1727
|
+
const n = this.pluginLoader.getRegisteredPluginNames();
|
|
1728
|
+
for (const a of n) {
|
|
1636
1729
|
const s = await this.pluginLoader.load(a, this.getPluginLoadConfig(a));
|
|
1637
1730
|
s && t.push(s);
|
|
1638
1731
|
}
|
|
@@ -1641,14 +1734,20 @@ class p extends HTMLElement {
|
|
|
1641
1734
|
}
|
|
1642
1735
|
resolveToolbarItems() {
|
|
1643
1736
|
const t = this.config.toolbarItems;
|
|
1644
|
-
if (typeof t == "string")
|
|
1645
|
-
|
|
1737
|
+
if (typeof t == "string")
|
|
1738
|
+
return t;
|
|
1739
|
+
if (Array.isArray(t))
|
|
1740
|
+
return t.join(" ");
|
|
1646
1741
|
const e = this.config.toolbar;
|
|
1647
|
-
if (typeof e == "string")
|
|
1648
|
-
|
|
1742
|
+
if (typeof e == "string")
|
|
1743
|
+
return e;
|
|
1744
|
+
if (!e || typeof e != "object")
|
|
1745
|
+
return;
|
|
1649
1746
|
const o = e.items;
|
|
1650
|
-
if (typeof o == "string")
|
|
1651
|
-
|
|
1747
|
+
if (typeof o == "string")
|
|
1748
|
+
return o;
|
|
1749
|
+
if (Array.isArray(o))
|
|
1750
|
+
return o.join(" ");
|
|
1652
1751
|
}
|
|
1653
1752
|
isToolbarStickyEnabled() {
|
|
1654
1753
|
const t = this.config.toolbar;
|
|
@@ -1710,12 +1809,14 @@ class p extends HTMLElement {
|
|
|
1710
1809
|
};
|
|
1711
1810
|
}
|
|
1712
1811
|
isEditorInViewport() {
|
|
1713
|
-
if (!this.contentElement || typeof window == "undefined")
|
|
1812
|
+
if (!this.contentElement || typeof window == "undefined")
|
|
1813
|
+
return !0;
|
|
1714
1814
|
const t = this.contentElement.getBoundingClientRect();
|
|
1715
1815
|
return t.bottom >= 0 && t.top <= window.innerHeight;
|
|
1716
1816
|
}
|
|
1717
1817
|
applyAccessibilitySettings() {
|
|
1718
|
-
if (!this.contentElement)
|
|
1818
|
+
if (!this.contentElement)
|
|
1819
|
+
return;
|
|
1719
1820
|
const t = this.getAccessibilityConfig();
|
|
1720
1821
|
if (t.enableARIA) {
|
|
1721
1822
|
this.contentElement.setAttribute("role", "textbox"), this.contentElement.setAttribute("aria-multiline", "true"), this.contentElement.setAttribute("aria-disabled", this.config.readonly ? "true" : "false");
|
|
@@ -1726,7 +1827,8 @@ class p extends HTMLElement {
|
|
|
1726
1827
|
this.contentElement.tabIndex = t.keyboardNavigation ? 0 : -1;
|
|
1727
1828
|
}
|
|
1728
1829
|
applyLanguageSettings() {
|
|
1729
|
-
if (!this.contentElement)
|
|
1830
|
+
if (!this.contentElement)
|
|
1831
|
+
return;
|
|
1730
1832
|
const t = this.getLanguageConfig();
|
|
1731
1833
|
this.contentElement.setAttribute("lang", t.locale), this.contentElement.setAttribute("dir", t.direction);
|
|
1732
1834
|
}
|
|
@@ -1748,12 +1850,13 @@ class p extends HTMLElement {
|
|
|
1748
1850
|
return { enabled: !1, provider: "browser" };
|
|
1749
1851
|
}
|
|
1750
1852
|
applySpellcheckSettings() {
|
|
1751
|
-
if (!this.contentElement)
|
|
1853
|
+
if (!this.contentElement)
|
|
1854
|
+
return;
|
|
1752
1855
|
const t = this.getSpellcheckConfig(), e = t.enabled && t.provider === "browser";
|
|
1753
1856
|
this.contentElement.spellcheck = e, this.contentElement.setAttribute("spellcheck", e ? "true" : "false");
|
|
1754
1857
|
}
|
|
1755
1858
|
executeCommand(t, e) {
|
|
1756
|
-
var
|
|
1859
|
+
var n;
|
|
1757
1860
|
typeof window != "undefined" && (window.__editoraCommandEditorRoot = this);
|
|
1758
1861
|
const o = {
|
|
1759
1862
|
editorElement: this,
|
|
@@ -1769,24 +1872,37 @@ class p extends HTMLElement {
|
|
|
1769
1872
|
return console.error(`[RichTextEditor] Error executing native command ${t}:`, s), !1;
|
|
1770
1873
|
}
|
|
1771
1874
|
}
|
|
1772
|
-
return ((
|
|
1875
|
+
return ((n = this.engine) == null ? void 0 : n.execCommand(t, e)) || !1;
|
|
1773
1876
|
}
|
|
1774
1877
|
getPluginLoadConfig(t) {
|
|
1775
1878
|
const e = this.config.pluginConfig;
|
|
1776
1879
|
if (e && typeof e == "object") {
|
|
1777
|
-
const
|
|
1778
|
-
if (
|
|
1779
|
-
return
|
|
1880
|
+
const n = e[t];
|
|
1881
|
+
if (n && typeof n == "object")
|
|
1882
|
+
return n;
|
|
1780
1883
|
}
|
|
1781
1884
|
const o = {
|
|
1782
|
-
spellCheck: ["spellcheck", "spellCheck"]
|
|
1885
|
+
spellCheck: ["spellcheck", "spellCheck"],
|
|
1886
|
+
trackChanges: ["trackchanges", "track-changes", "trackChanges"],
|
|
1887
|
+
versionDiff: ["versiondiff", "version-diff", "versionDiff"],
|
|
1888
|
+
"version-diff": ["versiondiff", "version-diff", "versionDiff"],
|
|
1889
|
+
conditionalContent: ["conditionalcontent", "conditional-content", "conditionalContent"],
|
|
1890
|
+
"conditional-content": ["conditionalcontent", "conditional-content", "conditionalContent"],
|
|
1891
|
+
dataBinding: ["databinding", "data-binding", "dataBinding"],
|
|
1892
|
+
"data-binding": ["databinding", "data-binding", "dataBinding"],
|
|
1893
|
+
contentRules: ["contentrules", "content-rules", "contentRules"],
|
|
1894
|
+
"content-rules": ["contentrules", "content-rules", "contentRules"],
|
|
1895
|
+
mentions: ["mention", "mentions"],
|
|
1896
|
+
mention: ["mention", "mentions"],
|
|
1897
|
+
slashCommands: ["slashcommands", "slash-commands", "slashCommands"],
|
|
1898
|
+
"slash-commands": ["slashcommands", "slash-commands", "slashCommands"]
|
|
1783
1899
|
}, r = [
|
|
1784
1900
|
t,
|
|
1785
1901
|
t.toLowerCase(),
|
|
1786
1902
|
...o[t] || []
|
|
1787
1903
|
];
|
|
1788
|
-
for (const
|
|
1789
|
-
const a = this.config[
|
|
1904
|
+
for (const n of r) {
|
|
1905
|
+
const a = this.config[n];
|
|
1790
1906
|
if (a && typeof a == "object" && !Array.isArray(a))
|
|
1791
1907
|
return a;
|
|
1792
1908
|
}
|
|
@@ -1848,7 +1964,8 @@ class p extends HTMLElement {
|
|
|
1848
1964
|
}
|
|
1849
1965
|
restoreAutosavedContent() {
|
|
1850
1966
|
const t = this.getAutosaveConfig();
|
|
1851
|
-
if (!t.enabled || t.provider !== "localStorage")
|
|
1967
|
+
if (!t.enabled || t.provider !== "localStorage")
|
|
1968
|
+
return null;
|
|
1852
1969
|
try {
|
|
1853
1970
|
const e = localStorage.getItem(t.storageKey);
|
|
1854
1971
|
if (e)
|
|
@@ -1870,17 +1987,18 @@ class p extends HTMLElement {
|
|
|
1870
1987
|
}, t.intervalMs));
|
|
1871
1988
|
}
|
|
1872
1989
|
insertHTMLAtSelection(t) {
|
|
1873
|
-
if (!this.contentElement)
|
|
1990
|
+
if (!this.contentElement)
|
|
1991
|
+
return;
|
|
1874
1992
|
const e = window.getSelection();
|
|
1875
1993
|
if (e && e.rangeCount > 0) {
|
|
1876
1994
|
const o = e.getRangeAt(0);
|
|
1877
1995
|
o.deleteContents();
|
|
1878
1996
|
const r = document.createElement("div");
|
|
1879
1997
|
r.innerHTML = t;
|
|
1880
|
-
const
|
|
1998
|
+
const n = document.createDocumentFragment();
|
|
1881
1999
|
for (; r.firstChild; )
|
|
1882
|
-
|
|
1883
|
-
o.insertNode(
|
|
2000
|
+
n.appendChild(r.firstChild);
|
|
2001
|
+
o.insertNode(n), o.collapse(!1), e.removeAllRanges(), e.addRange(o);
|
|
1884
2002
|
} else
|
|
1885
2003
|
this.contentElement.focus(), document.execCommand("insertHTML", !1, t);
|
|
1886
2004
|
}
|
|
@@ -1889,7 +2007,7 @@ class p extends HTMLElement {
|
|
|
1889
2007
|
*/
|
|
1890
2008
|
createUI(t, e) {
|
|
1891
2009
|
const o = this.querySelector('[slot="toolbar"]'), r = this.querySelector('[slot="statusbar"]');
|
|
1892
|
-
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
|
|
2010
|
+
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 O(
|
|
1893
2011
|
{
|
|
1894
2012
|
items: this.resolveToolbarItems(),
|
|
1895
2013
|
sticky: this.isToolbarStickyEnabled(),
|
|
@@ -1898,7 +2016,7 @@ class p extends HTMLElement {
|
|
|
1898
2016
|
t,
|
|
1899
2017
|
this.pluginLoader
|
|
1900
2018
|
// Pass plugin loader to get all registered plugins
|
|
1901
|
-
), this.toolbar.setCommandHandler((
|
|
2019
|
+
), this.toolbar.setCommandHandler((n, a) => {
|
|
1902
2020
|
var s;
|
|
1903
2021
|
if (this.contentElement) {
|
|
1904
2022
|
this.contentElement.focus();
|
|
@@ -1908,16 +2026,16 @@ class p extends HTMLElement {
|
|
|
1908
2026
|
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);
|
|
1909
2027
|
}
|
|
1910
2028
|
}
|
|
1911
|
-
return this.executeCommand(
|
|
2029
|
+
return this.executeCommand(n, a);
|
|
1912
2030
|
}), 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);
|
|
1913
2031
|
try {
|
|
1914
2032
|
document.execCommand("defaultParagraphSeparator", !1, "p");
|
|
1915
|
-
} catch (
|
|
1916
|
-
console.warn("defaultParagraphSeparator not supported:",
|
|
2033
|
+
} catch (n) {
|
|
2034
|
+
console.warn("defaultParagraphSeparator not supported:", n);
|
|
1917
2035
|
}
|
|
1918
2036
|
if (e) {
|
|
1919
|
-
const
|
|
1920
|
-
|
|
2037
|
+
const n = document.createElement("div");
|
|
2038
|
+
n.innerHTML = e.trim(), !Array.from(n.childNodes).some((s) => {
|
|
1921
2039
|
if (s.nodeType === Node.ELEMENT_NODE) {
|
|
1922
2040
|
const l = s.tagName;
|
|
1923
2041
|
return ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "BLOCKQUOTE", "PRE"].includes(l);
|
|
@@ -1926,50 +2044,56 @@ class p extends HTMLElement {
|
|
|
1926
2044
|
}) && e.trim() ? this.contentElement.innerHTML = `<p>${e.trim()}</p>` : this.contentElement.innerHTML = e;
|
|
1927
2045
|
} else
|
|
1928
2046
|
this.config.placeholder ? this.contentElement.innerHTML = "" : this.contentElement.innerHTML = "<p><br></p>";
|
|
1929
|
-
this.appendChild(this.contentElement), this.isToolbarFloatingEnabled() && (this.floatingToolbar = new
|
|
1930
|
-
var
|
|
1931
|
-
return (
|
|
2047
|
+
this.appendChild(this.contentElement), this.isToolbarFloatingEnabled() && (this.floatingToolbar = new z({ 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 H({ position: this.getStatusbarPosition() }), this.statusBar.create(this.statusBarElement)), this.config.autofocus && setTimeout(() => {
|
|
2048
|
+
var n;
|
|
2049
|
+
return (n = this.contentElement) == null ? void 0 : n.focus();
|
|
1932
2050
|
}, 0);
|
|
1933
2051
|
}
|
|
1934
2052
|
/**
|
|
1935
2053
|
* Setup event listeners
|
|
1936
2054
|
*/
|
|
1937
2055
|
setupEventListeners() {
|
|
1938
|
-
if (!this.contentElement || !this.engine)
|
|
2056
|
+
if (!this.contentElement || !this.engine)
|
|
2057
|
+
return;
|
|
1939
2058
|
const t = this.keyboardShortcutManager;
|
|
1940
|
-
this.contentElement.addEventListener("
|
|
1941
|
-
|
|
2059
|
+
this.contentElement.addEventListener("beforeinput", (o) => {
|
|
2060
|
+
this.lastBeforeInputType = o.inputType || null;
|
|
2061
|
+
}), this.contentElement.addEventListener("input", () => {
|
|
2062
|
+
if (!this.contentElement)
|
|
2063
|
+
return;
|
|
1942
2064
|
let o = this.contentElement.innerHTML;
|
|
1943
|
-
const r = this.getPerformanceConfig(),
|
|
1944
|
-
if (a.sanitizeOnInput !== !1 &&
|
|
1945
|
-
const
|
|
1946
|
-
if (
|
|
1947
|
-
const
|
|
1948
|
-
if (this.contentElement.innerHTML =
|
|
2065
|
+
const r = this.getPerformanceConfig(), n = this.getContentSanitizeConfig(), a = this.getSecurityConfig(), s = this.lastBeforeInputType;
|
|
2066
|
+
if (this.lastBeforeInputType = null, a.sanitizeOnInput !== !1 && n.sanitize !== !1 && !s) {
|
|
2067
|
+
const d = X(o, n, a);
|
|
2068
|
+
if (d !== o) {
|
|
2069
|
+
const h = window.getSelection(), p = h && h.rangeCount > 0 ? h.getRangeAt(0) : null;
|
|
2070
|
+
if (this.contentElement.innerHTML = d, p && h)
|
|
1949
2071
|
try {
|
|
1950
|
-
|
|
1951
|
-
} catch (
|
|
2072
|
+
h.removeAllRanges(), h.addRange(p);
|
|
2073
|
+
} catch (u) {
|
|
1952
2074
|
}
|
|
1953
|
-
o =
|
|
2075
|
+
o = d;
|
|
1954
2076
|
}
|
|
1955
2077
|
}
|
|
1956
2078
|
this.contentChangeDebounceTimer && clearTimeout(this.contentChangeDebounceTimer);
|
|
1957
|
-
const
|
|
2079
|
+
const c = () => {
|
|
1958
2080
|
this.dispatchEvent(new CustomEvent("content-change", {
|
|
1959
2081
|
detail: { html: o },
|
|
1960
2082
|
bubbles: !0
|
|
1961
2083
|
}));
|
|
1962
2084
|
};
|
|
1963
|
-
r.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(
|
|
2085
|
+
r.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(c, r.debounceInputMs) : c(), this.updateStatusBar();
|
|
1964
2086
|
}), this.contentElement.addEventListener("contextmenu", (o) => {
|
|
1965
2087
|
const r = this.config.contextMenu;
|
|
1966
2088
|
(r === !1 || typeof r == "object" && r !== null && r.enabled === !1) && o.preventDefault();
|
|
1967
2089
|
}), this.contentElement.addEventListener("paste", (o) => {
|
|
1968
|
-
var d,
|
|
2090
|
+
var d, h;
|
|
2091
|
+
if (o.__editoraSmartPasteHandled === !0 || o.defaultPrevented)
|
|
2092
|
+
return;
|
|
1969
2093
|
o.preventDefault();
|
|
1970
2094
|
const r = this.config.paste || {};
|
|
1971
|
-
let
|
|
1972
|
-
const a = ((
|
|
2095
|
+
let n = ((d = o.clipboardData) == null ? void 0 : d.getData("text/html")) || "";
|
|
2096
|
+
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);
|
|
1973
2097
|
if ((r.clean || !r.keepFormatting) && a) {
|
|
1974
2098
|
document.execCommand("insertText", !1, a);
|
|
1975
2099
|
return;
|
|
@@ -1978,31 +2102,32 @@ class p extends HTMLElement {
|
|
|
1978
2102
|
document.execCommand("insertText", !1, a);
|
|
1979
2103
|
return;
|
|
1980
2104
|
}
|
|
1981
|
-
if (
|
|
1982
|
-
l.sanitizeOnPaste !== !1 && s.sanitize !== !1 && (
|
|
2105
|
+
if (n) {
|
|
2106
|
+
l.sanitizeOnPaste !== !1 && s.sanitize !== !1 && (n = G(n, s, l)), this.insertHTMLAtSelection(n);
|
|
1983
2107
|
return;
|
|
1984
2108
|
}
|
|
1985
2109
|
a && document.execCommand("insertText", !1, a);
|
|
1986
2110
|
}), this.contentElement.addEventListener("focus", () => {
|
|
1987
|
-
this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
|
|
2111
|
+
m = this, this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
|
|
1988
2112
|
}), this.contentElement.addEventListener("blur", () => {
|
|
1989
2113
|
this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && this.dispatchEvent(new CustomEvent("content-change", {
|
|
1990
2114
|
detail: { html: this.contentElement.innerHTML },
|
|
1991
2115
|
bubbles: !0
|
|
1992
2116
|
})), this.dispatchEvent(new Event("editor-blur", { bubbles: !0 })), this.updateFloatingToolbar(), this.updateStatusBar();
|
|
1993
2117
|
}), this.contentElement.addEventListener("keydown", (o) => {
|
|
1994
|
-
this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (
|
|
1995
|
-
this.executeCommand(
|
|
2118
|
+
this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (n, a) => {
|
|
2119
|
+
this.executeCommand(n, a);
|
|
1996
2120
|
});
|
|
1997
2121
|
});
|
|
1998
2122
|
const e = () => {
|
|
1999
|
-
const o = this.getSelectionRangeInEditor(), r = document.activeElement,
|
|
2000
|
-
this.getPerformanceConfig().viewportOnlyScan && !this.isEditorInViewport() && !
|
|
2123
|
+
const o = this.getSelectionRangeInEditor(), r = document.activeElement, n = !!r && !!this.contentElement && (r === this.contentElement || this.contentElement.contains(r));
|
|
2124
|
+
this.getPerformanceConfig().viewportOnlyScan && !this.isEditorInViewport() && !n || !o && !n || (this.updateFloatingToolbar(), this.updateStatusBar());
|
|
2001
2125
|
};
|
|
2002
2126
|
this.selectionChangeHandler = e, document.addEventListener("selectionchange", this.selectionChangeHandler);
|
|
2003
2127
|
}
|
|
2004
2128
|
getSelectionRangeInEditor() {
|
|
2005
|
-
if (!this.contentElement)
|
|
2129
|
+
if (!this.contentElement)
|
|
2130
|
+
return null;
|
|
2006
2131
|
const t = window.getSelection();
|
|
2007
2132
|
if (!t || t.rangeCount === 0)
|
|
2008
2133
|
return null;
|
|
@@ -2010,7 +2135,8 @@ class p extends HTMLElement {
|
|
|
2010
2135
|
return this.contentElement.contains(o) ? e : null;
|
|
2011
2136
|
}
|
|
2012
2137
|
isSelectionBackward(t) {
|
|
2013
|
-
if (!t.anchorNode || !t.focusNode)
|
|
2138
|
+
if (!t.anchorNode || !t.focusNode)
|
|
2139
|
+
return !1;
|
|
2014
2140
|
try {
|
|
2015
2141
|
const e = document.createRange();
|
|
2016
2142
|
return e.setStart(t.anchorNode, t.anchorOffset), e.setEnd(t.focusNode, t.focusOffset), e.collapsed;
|
|
@@ -2019,39 +2145,44 @@ class p extends HTMLElement {
|
|
|
2019
2145
|
}
|
|
2020
2146
|
}
|
|
2021
2147
|
getSelectionAnchorRect(t, e) {
|
|
2022
|
-
const o = Array.from(e.getClientRects()).filter((
|
|
2148
|
+
const o = Array.from(e.getClientRects()).filter((n) => n.width > 0 || n.height > 0);
|
|
2023
2149
|
return o.length === 0 ? e.getBoundingClientRect() : this.isSelectionBackward(t) ? o[0] : o[o.length - 1];
|
|
2024
2150
|
}
|
|
2025
2151
|
/**
|
|
2026
2152
|
* Update floating toolbar position
|
|
2027
2153
|
*/
|
|
2028
2154
|
updateFloatingToolbar() {
|
|
2029
|
-
if (!this.floatingToolbar)
|
|
2030
|
-
|
|
2031
|
-
if (
|
|
2155
|
+
if (!this.floatingToolbar || !this.contentElement)
|
|
2156
|
+
return;
|
|
2157
|
+
if (this.config.readonly || this.contentElement.contentEditable === "false" || this.contentElement.getAttribute("data-readonly") === "true" || this.getAttribute("readonly") === "true" || this.getAttribute("data-readonly") === "true") {
|
|
2032
2158
|
this.floatingToolbar.hide();
|
|
2033
2159
|
return;
|
|
2034
2160
|
}
|
|
2035
|
-
const o = this.
|
|
2036
|
-
if (!o) {
|
|
2161
|
+
const e = this.getPerformanceConfig(), o = document.activeElement === this.contentElement || !!this.contentElement && this.contentElement.contains(document.activeElement);
|
|
2162
|
+
if (e.viewportOnlyScan && !this.isEditorInViewport() && !o) {
|
|
2037
2163
|
this.floatingToolbar.hide();
|
|
2038
2164
|
return;
|
|
2039
2165
|
}
|
|
2040
|
-
|
|
2166
|
+
const r = this.getSelectionRangeInEditor();
|
|
2167
|
+
if (!r) {
|
|
2041
2168
|
this.floatingToolbar.hide();
|
|
2042
2169
|
return;
|
|
2043
2170
|
}
|
|
2044
|
-
|
|
2045
|
-
|
|
2171
|
+
if (r.collapsed) {
|
|
2172
|
+
this.floatingToolbar.hide();
|
|
2173
|
+
return;
|
|
2174
|
+
}
|
|
2175
|
+
const n = window.getSelection();
|
|
2176
|
+
if (!n) {
|
|
2046
2177
|
this.floatingToolbar.hide();
|
|
2047
2178
|
return;
|
|
2048
2179
|
}
|
|
2049
|
-
const
|
|
2050
|
-
if (!
|
|
2180
|
+
const a = this.getSelectionAnchorRect(n, r);
|
|
2181
|
+
if (!a) {
|
|
2051
2182
|
this.floatingToolbar.hide();
|
|
2052
2183
|
return;
|
|
2053
2184
|
}
|
|
2054
|
-
this.floatingToolbar.show(
|
|
2185
|
+
this.floatingToolbar.show(a.left, a.top - 40);
|
|
2055
2186
|
}
|
|
2056
2187
|
/**
|
|
2057
2188
|
* Update status bar with selection and cursor information
|
|
@@ -2060,16 +2191,17 @@ class p extends HTMLElement {
|
|
|
2060
2191
|
* Update status bar with current content and cursor information
|
|
2061
2192
|
*/
|
|
2062
2193
|
updateStatusBar() {
|
|
2063
|
-
if (!this.statusBar || !this.contentElement)
|
|
2194
|
+
if (!this.statusBar || !this.contentElement)
|
|
2195
|
+
return;
|
|
2064
2196
|
const t = this.getPerformanceConfig(), e = document.activeElement === this.contentElement || this.contentElement.contains(document.activeElement);
|
|
2065
2197
|
if (t.viewportOnlyScan && !this.isEditorInViewport() && !e)
|
|
2066
2198
|
return;
|
|
2067
|
-
const o = this.contentElement.textContent || "", { words: r, chars:
|
|
2199
|
+
const o = this.contentElement.textContent || "", { words: r, chars: n } = W(o), a = $(this.contentElement);
|
|
2068
2200
|
let s, l;
|
|
2069
2201
|
const c = this.getSelectionRangeInEditor();
|
|
2070
|
-
c && (s =
|
|
2202
|
+
c && (s = j(this.contentElement, c), c.collapsed || (l = _(c, s), s = void 0)), this.statusBar.update({
|
|
2071
2203
|
wordCount: r,
|
|
2072
|
-
charCount:
|
|
2204
|
+
charCount: n,
|
|
2073
2205
|
lineCount: a,
|
|
2074
2206
|
cursorPosition: s,
|
|
2075
2207
|
selectionInfo: l
|
|
@@ -2152,7 +2284,7 @@ class p extends HTMLElement {
|
|
|
2152
2284
|
const o = this.attributes[e];
|
|
2153
2285
|
t[o.name] = o.value;
|
|
2154
2286
|
}
|
|
2155
|
-
return
|
|
2287
|
+
return I.resolve({
|
|
2156
2288
|
jsConfig: this.jsConfig,
|
|
2157
2289
|
attributes: t
|
|
2158
2290
|
});
|
|
@@ -2193,7 +2325,7 @@ class p extends HTMLElement {
|
|
|
2193
2325
|
*/
|
|
2194
2326
|
destroy() {
|
|
2195
2327
|
var t, e, o, r;
|
|
2196
|
-
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 }));
|
|
2328
|
+
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, x.delete(this), m === this && (m = null), this.dispatchEvent(new Event("editor-destroy", { bubbles: !0 }));
|
|
2197
2329
|
}
|
|
2198
2330
|
// Public API methods
|
|
2199
2331
|
getContent() {
|
|
@@ -2215,80 +2347,117 @@ class p extends HTMLElement {
|
|
|
2215
2347
|
(t = this.contentElement) == null || t.blur();
|
|
2216
2348
|
}
|
|
2217
2349
|
}
|
|
2218
|
-
const
|
|
2219
|
-
|
|
2220
|
-
const
|
|
2350
|
+
const k = new L();
|
|
2351
|
+
g.__globalPluginLoader = k;
|
|
2352
|
+
const nt = {
|
|
2221
2353
|
// Core editing plugins (always loaded)
|
|
2222
|
-
bold: () => import("./BoldPlugin.native-
|
|
2223
|
-
italic: () => import("./ItalicPlugin.native-
|
|
2224
|
-
underline: () => import("./UnderlinePlugin.native-
|
|
2225
|
-
strikethrough: () => import("./StrikethroughPlugin.native-
|
|
2226
|
-
clearFormatting: () => import("./ClearFormattingPlugin.native-
|
|
2227
|
-
heading: () => import("./HeadingPlugin.native-
|
|
2228
|
-
blockquote: () => import("./BlockquotePlugin.native-
|
|
2229
|
-
code: () => import("./CodePlugin.native-
|
|
2230
|
-
codeSample: () => import("./CodeSamplePlugin.native-
|
|
2231
|
-
list: () => import("./ListPlugin.native-
|
|
2232
|
-
checklist: () => import("./ChecklistPlugin.native-
|
|
2233
|
-
textAlignment: () => import("./TextAlignmentPlugin.native-
|
|
2234
|
-
indent: () => import("./IndentPlugin.native-
|
|
2235
|
-
direction: () => import("./DirectionPlugin.native-
|
|
2236
|
-
textColor: () => import("./TextColorPlugin.native-
|
|
2237
|
-
backgroundColor: () => import("./BackgroundColorPlugin.native-
|
|
2238
|
-
fontSize: () => import("./FontSizePlugin.native-
|
|
2239
|
-
fontFamily: () => import("./FontFamilyPlugin.native-
|
|
2240
|
-
lineHeight: () => import("./LineHeightPlugin.native-
|
|
2241
|
-
capitalization: () => import("./CapitalizationPlugin.native-
|
|
2242
|
-
history: () => import("./HistoryPlugin.native-
|
|
2354
|
+
bold: () => import("./BoldPlugin.native-f9d7f8e4.mjs").then((i) => i.BoldPlugin()),
|
|
2355
|
+
italic: () => import("./ItalicPlugin.native-7c95cfbc.mjs").then((i) => i.ItalicPlugin()),
|
|
2356
|
+
underline: () => import("./UnderlinePlugin.native-8080c998.mjs").then((i) => i.UnderlinePlugin()),
|
|
2357
|
+
strikethrough: () => import("./StrikethroughPlugin.native-905e9501.mjs").then((i) => i.StrikethroughPlugin()),
|
|
2358
|
+
clearFormatting: () => import("./ClearFormattingPlugin.native-77baa514.mjs").then((i) => i.ClearFormattingPlugin()),
|
|
2359
|
+
heading: () => import("./HeadingPlugin.native-e38c4a16.mjs").then((i) => i.HeadingPlugin()),
|
|
2360
|
+
blockquote: () => import("./BlockquotePlugin.native-3541c714.mjs").then((i) => i.BlockquotePlugin()),
|
|
2361
|
+
code: () => import("./CodePlugin.native-989cf0aa.mjs").then((i) => i.CodePlugin()),
|
|
2362
|
+
codeSample: () => import("./CodeSamplePlugin.native-6cc0148e.mjs").then((i) => i.CodeSamplePlugin()),
|
|
2363
|
+
list: () => import("./ListPlugin.native-fe2e115a.mjs").then((i) => i.ListPlugin()),
|
|
2364
|
+
checklist: () => import("./ChecklistPlugin.native-3b397ee9.mjs").then((i) => i.ChecklistPlugin()),
|
|
2365
|
+
textAlignment: () => import("./TextAlignmentPlugin.native-9357b3ed.mjs").then((i) => i.TextAlignmentPlugin()),
|
|
2366
|
+
indent: () => import("./IndentPlugin.native-e4ee902b.mjs").then((i) => i.IndentPlugin()),
|
|
2367
|
+
direction: () => import("./DirectionPlugin.native-4e742f42.mjs").then((i) => i.DirectionPlugin()),
|
|
2368
|
+
textColor: () => import("./TextColorPlugin.native-d53ed459.mjs").then((i) => i.TextColorPlugin()),
|
|
2369
|
+
backgroundColor: () => import("./BackgroundColorPlugin.native-8aceb5cc.mjs").then((i) => i.BackgroundColorPlugin()),
|
|
2370
|
+
fontSize: () => import("./FontSizePlugin.native-f5647872.mjs").then((i) => i.FontSizePlugin()),
|
|
2371
|
+
fontFamily: () => import("./FontFamilyPlugin.native-f9bc255a.mjs").then((i) => i.FontFamilyPlugin()),
|
|
2372
|
+
lineHeight: () => import("./LineHeightPlugin.native-5668f78c.mjs").then((i) => i.LineHeightPlugin()),
|
|
2373
|
+
capitalization: () => import("./CapitalizationPlugin.native-42c135dc.mjs").then((i) => i.CapitalizationPlugin()),
|
|
2374
|
+
history: () => import("./HistoryPlugin.native-92ed4be4.mjs").then((i) => i.HistoryPlugin()),
|
|
2243
2375
|
// Advanced plugins (lazy loaded)
|
|
2244
|
-
link: () => import("./LinkPlugin.native-
|
|
2245
|
-
table: () => import("./TablePlugin.native-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2376
|
+
link: () => import("./LinkPlugin.native-6df29111.mjs").then((i) => i.LinkPlugin()),
|
|
2377
|
+
table: () => import("./TablePlugin.native-7d5458c1.mjs").then((i) => i.TablePlugin()),
|
|
2378
|
+
trackChanges: () => import("./TrackChangesPlugin.native-e96da509.mjs").then((i) => i.TrackChangesPlugin()),
|
|
2379
|
+
versionDiff: () => import("./VersionDiffPlugin.native-5bbeff85.mjs").then((i) => i.VersionDiffPlugin()),
|
|
2380
|
+
"version-diff": () => import("./VersionDiffPlugin.native-5bbeff85.mjs").then((i) => i.VersionDiffPlugin()),
|
|
2381
|
+
versiondiff: () => import("./VersionDiffPlugin.native-5bbeff85.mjs").then((i) => i.VersionDiffPlugin()),
|
|
2382
|
+
conditionalContent: () => import("./ConditionalContentPlugin.native-4983143a.mjs").then((i) => i.ConditionalContentPlugin()),
|
|
2383
|
+
"conditional-content": () => import("./ConditionalContentPlugin.native-4983143a.mjs").then((i) => i.ConditionalContentPlugin()),
|
|
2384
|
+
conditionalcontent: () => import("./ConditionalContentPlugin.native-4983143a.mjs").then((i) => i.ConditionalContentPlugin()),
|
|
2385
|
+
dataBinding: () => import("./DataBindingPlugin.native-427e9d75.mjs").then((i) => i.DataBindingPlugin()),
|
|
2386
|
+
"data-binding": () => import("./DataBindingPlugin.native-427e9d75.mjs").then((i) => i.DataBindingPlugin()),
|
|
2387
|
+
databinding: () => import("./DataBindingPlugin.native-427e9d75.mjs").then((i) => i.DataBindingPlugin()),
|
|
2388
|
+
docSchema: () => import("./DocSchemaPlugin.native-8e41eda0.mjs").then((i) => i.DocSchemaPlugin()),
|
|
2389
|
+
"doc-schema": () => import("./DocSchemaPlugin.native-8e41eda0.mjs").then((i) => i.DocSchemaPlugin()),
|
|
2390
|
+
docschema: () => import("./DocSchemaPlugin.native-8e41eda0.mjs").then((i) => i.DocSchemaPlugin()),
|
|
2391
|
+
translationWorkflow: () => import("./TranslationWorkflowPlugin.native-4e711b1e.mjs").then((i) => i.TranslationWorkflowPlugin()),
|
|
2392
|
+
"translation-workflow": () => import("./TranslationWorkflowPlugin.native-4e711b1e.mjs").then((i) => i.TranslationWorkflowPlugin()),
|
|
2393
|
+
translationworkflow: () => import("./TranslationWorkflowPlugin.native-4e711b1e.mjs").then((i) => i.TranslationWorkflowPlugin()),
|
|
2394
|
+
contentRules: () => import("./ContentRulesPlugin.native-63ed405b.mjs").then((i) => i.ContentRulesPlugin()),
|
|
2395
|
+
"content-rules": () => import("./ContentRulesPlugin.native-63ed405b.mjs").then((i) => i.ContentRulesPlugin()),
|
|
2396
|
+
contentrules: () => import("./ContentRulesPlugin.native-63ed405b.mjs").then((i) => i.ContentRulesPlugin()),
|
|
2397
|
+
citations: () => import("./CitationsPlugin.native-169fb1e8.mjs").then((i) => i.CitationsPlugin()),
|
|
2398
|
+
citation: () => import("./CitationsPlugin.native-169fb1e8.mjs").then((i) => i.CitationsPlugin()),
|
|
2399
|
+
approvalWorkflow: () => import("./ApprovalWorkflowPlugin.native-449ce66c.mjs").then((i) => i.ApprovalWorkflowPlugin()),
|
|
2400
|
+
"approval-workflow": () => import("./ApprovalWorkflowPlugin.native-449ce66c.mjs").then((i) => i.ApprovalWorkflowPlugin()),
|
|
2401
|
+
approvalworkflow: () => import("./ApprovalWorkflowPlugin.native-449ce66c.mjs").then((i) => i.ApprovalWorkflowPlugin()),
|
|
2402
|
+
piiRedaction: () => import("./PIIRedactionPlugin.native-7ab10b9f.mjs").then((i) => i.PIIRedactionPlugin()),
|
|
2403
|
+
"pii-redaction": () => import("./PIIRedactionPlugin.native-7ab10b9f.mjs").then((i) => i.PIIRedactionPlugin()),
|
|
2404
|
+
piiredaction: () => import("./PIIRedactionPlugin.native-7ab10b9f.mjs").then((i) => i.PIIRedactionPlugin()),
|
|
2405
|
+
smartPaste: () => import("./SmartPastePlugin.native-a6c5efec.mjs").then((i) => i.SmartPastePlugin()),
|
|
2406
|
+
"smart-paste": () => import("./SmartPastePlugin.native-a6c5efec.mjs").then((i) => i.SmartPastePlugin()),
|
|
2407
|
+
smartpaste: () => import("./SmartPastePlugin.native-a6c5efec.mjs").then((i) => i.SmartPastePlugin()),
|
|
2408
|
+
blocksLibrary: () => import("./BlocksLibraryPlugin.native-1cc51e63.mjs").then((i) => i.BlocksLibraryPlugin()),
|
|
2409
|
+
"blocks-library": () => import("./BlocksLibraryPlugin.native-1cc51e63.mjs").then((i) => i.BlocksLibraryPlugin()),
|
|
2410
|
+
blockslibrary: () => import("./BlocksLibraryPlugin.native-1cc51e63.mjs").then((i) => i.BlocksLibraryPlugin()),
|
|
2411
|
+
mentions: () => import("./MentionPlugin.native-3b1e8c05.mjs").then((i) => i.MentionPlugin()),
|
|
2412
|
+
mention: () => import("./MentionPlugin.native-3b1e8c05.mjs").then((i) => i.MentionPlugin()),
|
|
2413
|
+
anchor: () => import("./AnchorPlugin.native-289a112a.mjs").then((i) => i.AnchorPlugin()),
|
|
2414
|
+
embedIframe: () => import("./EmbedIframePlugin.native-55209c87.mjs").then((i) => i.EmbedIframePlugin()),
|
|
2415
|
+
math: () => import("./MathPlugin.native-735bbac2.mjs").then((i) => i.MathPlugin()),
|
|
2416
|
+
image: () => import("./MediaManagerPlugin.native-3cf48a00.mjs").then((i) => i.MediaManagerPlugin()),
|
|
2417
|
+
mergeTag: () => import("./MergeTagPlugin.native-31cf7d48.mjs").then((i) => i.MergeTagPlugin()),
|
|
2418
|
+
pageBreak: () => import("./PageBreakPlugin.native-1794c5fb.mjs").then((i) => i.PageBreakPlugin()),
|
|
2419
|
+
print: () => import("./PrintPlugin.native-f6a168c2.mjs").then((i) => i.PrintPlugin()),
|
|
2420
|
+
preview: () => import("./PreviewPlugin.native-f7b67cc0.mjs").then((i) => i.PreviewPlugin()),
|
|
2421
|
+
specialCharacters: () => import("./SpecialCharactersPlugin.native-7f06d4ba.mjs").then((i) => i.SpecialCharactersPlugin()),
|
|
2422
|
+
slashCommands: () => import("./SlashCommandsPlugin.native-8d45e511.mjs").then((i) => i.SlashCommandsPlugin()),
|
|
2423
|
+
"slash-commands": () => import("./SlashCommandsPlugin.native-8d45e511.mjs").then((i) => i.SlashCommandsPlugin()),
|
|
2424
|
+
spellCheck: () => import("./SpellCheckPlugin.native-04e20834.mjs").then((i) => i.SpellCheckPlugin()),
|
|
2425
|
+
emojis: () => import("./EmojisPlugin.native-65c5ac47.mjs").then((i) => i.EmojisPlugin()),
|
|
2426
|
+
a11yChecker: () => import("./A11yCheckerPlugin.native-58d12bed.mjs").then((i) => i.A11yCheckerPlugin()),
|
|
2427
|
+
comments: () => import("./CommentsPlugin.native-03659874.mjs").then((i) => i.CommentsPlugin()),
|
|
2428
|
+
"document-manager": () => import("./DocumentManagerPlugin.native-e69895ad.mjs").then((i) => i.DocumentManagerPlugin()),
|
|
2429
|
+
fullscreen: () => import("./FullscreenPlugin.native-87ce92e9.mjs").then((i) => i.FullscreenPlugin()),
|
|
2430
|
+
template: () => import("./TemplatePlugin.native-580f0f63.mjs").then((i) => i.TemplatePlugin()),
|
|
2431
|
+
footnote: () => import("./FootnotePlugin.native-494657b3.mjs").then((i) => i.FootnotePlugin())
|
|
2263
2432
|
};
|
|
2264
|
-
async function
|
|
2265
|
-
return Object.entries(
|
|
2266
|
-
|
|
2267
|
-
}),
|
|
2433
|
+
async function rt() {
|
|
2434
|
+
return Object.entries(nt).forEach(([i, t]) => {
|
|
2435
|
+
k.register(i, t);
|
|
2436
|
+
}), k;
|
|
2268
2437
|
}
|
|
2269
|
-
typeof window != "undefined" &&
|
|
2270
|
-
|
|
2438
|
+
typeof window != "undefined" && rt().then((i) => {
|
|
2439
|
+
g.__globalPluginLoader = i, customElements.get("editora-editor") || customElements.define("editora-editor", g);
|
|
2271
2440
|
const t = document.querySelectorAll("editora-editor:not([data-initial-content])"), e = [];
|
|
2272
|
-
t.forEach((
|
|
2273
|
-
const a =
|
|
2274
|
-
e.push(a), a &&
|
|
2441
|
+
t.forEach((n) => {
|
|
2442
|
+
const a = n.innerHTML.trim();
|
|
2443
|
+
e.push(a), a && n.setAttribute("data-initial-content", a);
|
|
2275
2444
|
});
|
|
2276
2445
|
const o = document.querySelectorAll("editora-editor");
|
|
2277
|
-
Array.from(o).filter((
|
|
2278
|
-
const a = Array.from(o).indexOf(
|
|
2279
|
-
e[a] &&
|
|
2446
|
+
Array.from(o).filter((n) => !n.hasAttribute("data-initial-content")).forEach((n) => {
|
|
2447
|
+
const a = Array.from(o).indexOf(n);
|
|
2448
|
+
e[a] && n.setAttribute("data-initial-content", e[a]);
|
|
2280
2449
|
}), window.Editora = {
|
|
2281
2450
|
version: "1.0.0",
|
|
2282
|
-
plugins:
|
|
2283
|
-
WebComponent:
|
|
2284
|
-
init: async (
|
|
2285
|
-
const s = document.querySelector(
|
|
2286
|
-
return s instanceof
|
|
2451
|
+
plugins: k.getRegisteredPluginNames(),
|
|
2452
|
+
WebComponent: g,
|
|
2453
|
+
init: async (n, a) => {
|
|
2454
|
+
const s = document.querySelector(n);
|
|
2455
|
+
return s instanceof g ? (a && await s.setConfig(a), s.getAPI()) : null;
|
|
2287
2456
|
}
|
|
2288
2457
|
};
|
|
2289
2458
|
});
|
|
2290
2459
|
export {
|
|
2291
|
-
|
|
2292
|
-
|
|
2460
|
+
g as RichTextEditorElement,
|
|
2461
|
+
rt as initWebComponent
|
|
2293
2462
|
};
|
|
2294
2463
|
//# sourceMappingURL=webcomponent.js.map
|