@editora/core 1.0.22 → 1.0.24
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 +247 -243
- package/dist/{A11yCheckerPlugin.native-qW_njhLY.mjs → A11yCheckerPlugin.native-BBCsR5Ur.mjs} +7 -5
- package/dist/{AnchorPlugin.native-Drmxhy98.mjs → AnchorPlugin.native-Dk9R26cF.mjs} +20 -19
- package/dist/{ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs → ApprovalWorkflowPlugin.native-AeJsehXM.mjs} +56 -55
- package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs} +103 -98
- package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs} +42 -43
- package/dist/{CitationsPlugin.native-C_7wWQ-k.mjs → CitationsPlugin.native-BFChgCSV.mjs} +51 -51
- package/dist/{CodePlugin.native-CAHk9ecG.mjs → CodePlugin.native-BRBEIqY7.mjs} +167 -113
- package/dist/{CodePlugin.native-DZgIez08.mjs → CodePlugin.native-CPfKDrkr.mjs} +1383 -1094
- package/dist/{CodeSamplePlugin.native-svbAFWh_.mjs → CodeSamplePlugin.native-Bai8bgl3.mjs} +5 -5
- package/dist/{CommentsPlugin.native-DncTHiEe.mjs → CommentsPlugin.native-DHCDUm9f.mjs} +161 -141
- package/dist/{ConditionalContentPlugin.native-Bf7XgRSW.mjs → ConditionalContentPlugin.native-B3R6xcqn.mjs} +3 -3
- package/dist/{ContentRulesPlugin.native-vPx5nC73.mjs → ContentRulesPlugin.native-BISqhQKJ.mjs} +52 -52
- package/dist/{DataBindingPlugin.native-B7lpI_0c.mjs → DataBindingPlugin.native-DbaDeXNp.mjs} +37 -37
- package/dist/{DocumentManagerPlugin.native-B8K-Oqom.mjs → DocumentManagerPlugin.native-tZqIa9o5.mjs} +21 -20
- package/dist/{EmbedIframePlugin.native-BfZ_HGlV.mjs → EmbedIframePlugin.native-qHMf1Jtg.mjs} +7 -7
- package/dist/{EmojisPlugin.native-D92aaOKi.mjs → EmojisPlugin.native-B64efKg5.mjs} +4 -4
- package/dist/{FormatPainterPlugin.native-BhjzsiVq.mjs → FormatPainterPlugin.native-CAc1N6xU.mjs} +183 -161
- package/dist/{HeadingPlugin.native-DZdvubrQ.mjs → HeadingPlugin.native-C3YiGERx.mjs} +85 -72
- package/dist/HistoryPlugin.native-C8GyxsgC.mjs +330 -0
- package/dist/{LinkPlugin.native-BsQXYsK6.mjs → LinkPlugin.native-Dt_p6Ukb.mjs} +4 -4
- package/dist/ListPlugin.native-UYaoRiub.mjs +239 -0
- package/dist/{MathPlugin.native-Byo3WL0f.mjs → MathPlugin.native-Cq9WQ7cq.mjs} +148 -130
- package/dist/MediaManagerPlugin.native-BjrEarV6.mjs +1161 -0
- package/dist/{MediaManagerPlugin.native-BT1NZIJS.mjs → MediaManagerPlugin.native-CRi24Mrb.mjs} +340 -281
- package/dist/{MentionPlugin.native-S_lwGZQO.mjs → MentionPlugin.native-Zb1dwdxU.mjs} +304 -300
- package/dist/{MergeTagPlugin.native-7-6F3S1Y.mjs → MergeTagPlugin.native-BXkVPvCo.mjs} +6 -4
- package/dist/{PIIRedactionPlugin.native-g7j4jOmm.mjs → PIIRedactionPlugin.native-Cm0bpzQb.mjs} +2 -2
- package/dist/{PreviewPlugin.native-Dv5OsffK.mjs → PreviewPlugin.native-CrfiwP2J.mjs} +2 -2
- package/dist/{SlashCommandsPlugin.native-BDIIwGNs.mjs → SlashCommandsPlugin.native-BzGTRmMB.mjs} +264 -240
- package/dist/{SmartPastePlugin.native-BATLCds5.mjs → SmartPastePlugin.native-DnOJhDsf.mjs} +2 -2
- package/dist/{SpecialCharactersPlugin.native-CdZoc1GB.mjs → SpecialCharactersPlugin.native-B0XaCfjZ.mjs} +4 -4
- package/dist/{SpellCheckPlugin.native-BGm2qPfn.mjs → SpellCheckPlugin.native-BE7os1Xj.mjs} +302 -265
- package/dist/{TablePlugin.native-C1YZ372P.mjs → TablePlugin.native-CWxEFpV8.mjs} +159 -136
- package/dist/{TemplatePlugin.native-Dwk8TgxI.mjs → TemplatePlugin.native-OD8Wc1R7.mjs} +6 -4
- package/dist/{TextColorPlugin.native-KMZ2uzlq.mjs → TextColorPlugin.native-C2IjioNM.mjs} +75 -71
- package/dist/{TranslationWorkflowPlugin.native-CZtG--06.mjs → TranslationWorkflowPlugin.native-BGXVJD9f.mjs} +101 -98
- package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs} +11 -11
- package/dist/anchoredPopover-QN4jNbW1.mjs +134 -0
- package/dist/confirmDialog-BP8hZPpX.mjs +112 -0
- package/dist/dialogHelpers-Dzn8DHoF.mjs +194 -0
- package/dist/{documentManager-BWK_-KJp.mjs → documentManager-8gnG-uG_.mjs} +1728 -1715
- package/dist/editora.min.js +21 -21
- package/dist/editora.umd.js +10 -10
- package/dist/{index-C1sO7DAC.js → index--wO0CZVN.js} +6 -6
- package/dist/{index-DGMYWPLx.mjs → index-BICrB5kg.mjs} +397 -326
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/katex-DLIObQUm.mjs +11683 -0
- package/dist/katex.min--Ws3c9be.mjs +6 -0
- package/dist/notify-DCQGpmq-.mjs +60 -0
- package/dist/plugin-loader.js +54 -54
- package/dist/webcomponent-core.js +305 -234
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +153 -80
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +631 -560
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1677 -1328
- package/package.json +1 -1
- package/dist/HistoryPlugin.native-DPvhks6h.mjs +0 -246
- package/dist/ListPlugin.native-Bt0LANbO.mjs +0 -139
- package/dist/anchoredPopover-DJFD2oAP.mjs +0 -116
- package/dist/dialogHelpers-DBf7WqYH.mjs +0 -40
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import {
|
|
1
|
+
import { i as Y } from "./dialogHelpers-Dzn8DHoF.mjs";
|
|
2
|
+
import { n as _ } from "./notify-DCQGpmq-.mjs";
|
|
3
|
+
import { c as X } from "./confirmDialog-BP8hZPpX.mjs";
|
|
4
|
+
import { s as J } from "./sanitizeHtml-DA0ajC6k.mjs";
|
|
3
5
|
class V {
|
|
4
6
|
constructor(e = "") {
|
|
5
7
|
this._lines = [], this._version = 0, this.setText(e);
|
|
@@ -99,7 +101,7 @@ class V {
|
|
|
99
101
|
return e.line !== t.line ? e.line - t.line : e.column - t.column;
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
|
-
class
|
|
104
|
+
class ee {
|
|
103
105
|
constructor(e) {
|
|
104
106
|
this.gutterWidth = 50, this.gutterFoldColumnWidth = 24, this.gutterFoldColumnGap = 4, this.gutterLineNumberPaddingLeft = 8, this.gutterLineNumberPaddingRight = 4, this.gutterDigitWidth = 9, this.lineHeight = 24, this.trailingNewlineMarkerAttr = "data-lce-trailing-newline-marker", this.foldPlaceholderAttr = "data-lce-fold-placeholder", this.virtualMarkerRegex = /[\u200B\uE000]/, this.virtualMarkerGlobalRegex = /[\u200B\uE000]/g, this.lastLineCount = 0, this.lastHighlightHTML = "", this.highlightOverlayActive = !1, this.lastLineDecorationSnapshot = "", this.lastGutterDecorationSnapshot = "", this.lineDecorations = [], this.gutterDecorations = [], this.lineWrapping = !1, this.measuredHeights = null, this.measuredTops = [], this.measuredLines = null, this.measuredSignature = "", this.measureQueued = !1, this.measurer = null, this.resizeObserver = null, this.destroyed = !1, this.container = e, this.createDOM();
|
|
105
107
|
}
|
|
@@ -936,10 +938,10 @@ class X {
|
|
|
936
938
|
this.contentElement.__lceFoldPlaceholderSources = e;
|
|
937
939
|
}
|
|
938
940
|
}
|
|
939
|
-
let
|
|
940
|
-
const
|
|
941
|
+
let te = 0;
|
|
942
|
+
const ie = 200, ne = 1e3, se = 8e3, T = class T {
|
|
941
943
|
constructor(e, t = {}) {
|
|
942
|
-
this.extensions = /* @__PURE__ */ new Map(), this.commands = /* @__PURE__ */ new Map(), this.eventListeners = /* @__PURE__ */ new Map(), this.folds = [], this.currentTheme = "default", this.isDestroyed = !1, this.undoStack = [], this.redoStack = [], this.suppressHistory = !1, this.highlightTimeout = null, this.expectingProgrammaticCursor = !1, this.lastKnownCursor = { line: 0, column: 0 }, this.editorInstanceId = ++
|
|
944
|
+
this.extensions = /* @__PURE__ */ new Map(), this.commands = /* @__PURE__ */ new Map(), this.eventListeners = /* @__PURE__ */ new Map(), this.folds = [], this.currentTheme = "default", this.isDestroyed = !1, this.undoStack = [], this.redoStack = [], this.suppressHistory = !1, this.highlightTimeout = null, this.expectingProgrammaticCursor = !1, this.lastKnownCursor = { line: 0, column: 0 }, this.typingRun = null, this.editorInstanceId = ++te, this.decorationHighlightStyleId = `editora-decoration-style-${this.editorInstanceId}`, this.decorationHighlightLimit = 1e3, this.decorationLayers = /* @__PURE__ */ new Map(), this.inlineDecorationHighlightNames = /* @__PURE__ */ new Set(), this.decorationRenderRaf = null, this.decorationMutationObserver = null, this.hasCustomDecorationHighlightSupport = !1, this.lastProgrammaticClipboardInsertAt = 0, this.tabReleased = !1, this.config = {
|
|
943
945
|
value: "",
|
|
944
946
|
theme: "default",
|
|
945
947
|
readOnly: !1,
|
|
@@ -947,7 +949,7 @@ const w = class w {
|
|
|
947
949
|
lineWrapping: !1,
|
|
948
950
|
lineNumbers: !0,
|
|
949
951
|
...t
|
|
950
|
-
}, this.textModel = new V(this.config.value), this.view = new
|
|
952
|
+
}, this.textModel = new V(this.config.value), this.view = new ee(e), this.view.setTabSize(this.config.tabSize || 2), this.view.setLineWrapping(!!this.config.lineWrapping), this.view.setLineNumbersVisible(this.config.lineNumbers !== !1), this.hasCustomDecorationHighlightSupport = this.detectCustomHighlightSupport(), this.observeDecorationRelevantMutations(), this.setupEventHandlers(), this.config.extensions && this.config.extensions.forEach((i) => this.addExtension(i)), this.setTheme(this.config.theme), this.view.setReadOnly(this.config.readOnly || !1), this.renderTextWithHighlight(this.textModel.getText()), this.registerBuiltInCommands();
|
|
951
953
|
}
|
|
952
954
|
// Public accessors for extensions
|
|
953
955
|
getTextModel() {
|
|
@@ -991,12 +993,12 @@ const w = class w {
|
|
|
991
993
|
return;
|
|
992
994
|
}
|
|
993
995
|
if (!t.isComposing) {
|
|
994
|
-
const i =
|
|
996
|
+
const i = T.deletionUnit(t.inputType, "Backward");
|
|
995
997
|
if (i) {
|
|
996
998
|
t.preventDefault(), this.pendingInputSnapshot = void 0, this.deleteBackward(i);
|
|
997
999
|
return;
|
|
998
1000
|
}
|
|
999
|
-
const n =
|
|
1001
|
+
const n = T.deletionUnit(t.inputType, "Forward");
|
|
1000
1002
|
if (n) {
|
|
1001
1003
|
t.preventDefault(), this.pendingInputSnapshot = void 0, this.deleteForward(n);
|
|
1002
1004
|
return;
|
|
@@ -1025,12 +1027,22 @@ const w = class w {
|
|
|
1025
1027
|
}), e.addEventListener("input", () => {
|
|
1026
1028
|
var n;
|
|
1027
1029
|
const t = this.view.getText(), i = this.textModel.getText();
|
|
1028
|
-
t !== i
|
|
1029
|
-
(
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1030
|
+
if (t !== i) {
|
|
1031
|
+
if (!this.suppressHistory) {
|
|
1032
|
+
const s = T.describeEdit(i, t);
|
|
1033
|
+
this.recordUndoStep(
|
|
1034
|
+
(n = this.pendingInputSnapshot) != null ? n : this.captureHistorySnapshot(i),
|
|
1035
|
+
s.removedLength,
|
|
1036
|
+
s.inserted,
|
|
1037
|
+
t
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
this.pendingInputSnapshot = void 0, this.textModel.setText(t), this.view.syncTrailingNewlineMarkerForText(t), this.hasRenderedFoldPlaceholders() ? this.clearPendingHighlightRender() : (this.clearPendingHighlightRender(), this.highlightTimeout = setTimeout(() => {
|
|
1041
|
+
const s = this.view.getText();
|
|
1042
|
+
s !== this.textModel.getText() && this.textModel.setText(s), this.renderTextWithHighlight(this.textModel.getText(), !1), this.highlightTimeout = null;
|
|
1043
|
+
}, 300)), this.updateLineNumbers(), this.emit("change", [{ range: this.getFullRange(), text: t, oldText: i }]);
|
|
1044
|
+
} else
|
|
1045
|
+
this.pendingInputSnapshot = void 0;
|
|
1034
1046
|
}), this.documentSelectionChangeHandler = () => {
|
|
1035
1047
|
var n, s, r;
|
|
1036
1048
|
const t = this.syncSelectionCacheFromView();
|
|
@@ -1044,7 +1056,7 @@ const w = class w {
|
|
|
1044
1056
|
}, document.addEventListener("selectionchange", this.documentSelectionChangeHandler), e.addEventListener("blur", () => {
|
|
1045
1057
|
this.tabReleased = !1;
|
|
1046
1058
|
}), e.addEventListener("keydown", (t) => {
|
|
1047
|
-
if (this.emit("keydown", t), t.key === "Tab" && this.tabReleased && !t.ctrlKey && !t.metaKey && !t.altKey) {
|
|
1059
|
+
if (/^(Arrow(Left|Right|Up|Down)|Home|End|Page(Up|Down))$/.test(t.key) && this.closeTypingRun(), this.emit("keydown", t), t.key === "Tab" && this.tabReleased && !t.ctrlKey && !t.metaKey && !t.altKey) {
|
|
1048
1060
|
this.tabReleased = !1;
|
|
1049
1061
|
return;
|
|
1050
1062
|
}
|
|
@@ -1073,7 +1085,7 @@ const w = class w {
|
|
|
1073
1085
|
return;
|
|
1074
1086
|
}
|
|
1075
1087
|
}), e.addEventListener("mousedown", (t) => {
|
|
1076
|
-
this.emit("mousedown", t);
|
|
1088
|
+
this.closeTypingRun(), this.emit("mousedown", t);
|
|
1077
1089
|
const i = Array.from(this.extensions.values()).reverse();
|
|
1078
1090
|
for (const n of i)
|
|
1079
1091
|
if (n.onMouseDown && n.onMouseDown(t) === !1) {
|
|
@@ -1293,7 +1305,7 @@ const w = class w {
|
|
|
1293
1305
|
let n = 0;
|
|
1294
1306
|
for (let s = 0; s < e.length; s++) {
|
|
1295
1307
|
const r = e[s];
|
|
1296
|
-
r === "" || r ===
|
|
1308
|
+
r === "" || r === T.CURSOR_SENTINEL || (t.push(r), n += 1, i[n] = s + 1);
|
|
1297
1309
|
}
|
|
1298
1310
|
return i[n] = e.length, {
|
|
1299
1311
|
normalizedText: t.join(""),
|
|
@@ -1377,8 +1389,8 @@ const w = class w {
|
|
|
1377
1389
|
return;
|
|
1378
1390
|
}
|
|
1379
1391
|
if (r && (l !== void 0 || a !== void 0)) {
|
|
1380
|
-
const g = l !== void 0 ? l : o, p = a !== void 0 ? a : o, m = Math.min(g, p), y = Math.max(g, p),
|
|
1381
|
-
this.view.setSelectionRange({ start:
|
|
1392
|
+
const g = l !== void 0 ? l : o, p = a !== void 0 ? a : o, m = Math.min(g, p), y = Math.max(g, p), v = this.textModel.offsetToPosition(m), S = this.textModel.offsetToPosition(y);
|
|
1393
|
+
this.view.setSelectionRange({ start: v, end: S });
|
|
1382
1394
|
} else if (o !== void 0) {
|
|
1383
1395
|
const g = this.textModel.offsetToPosition(o);
|
|
1384
1396
|
this.view.setCursorPosition(g);
|
|
@@ -1410,19 +1422,19 @@ const w = class w {
|
|
|
1410
1422
|
return n.selectNodeContents(i), n.setEnd(t.endContainer, t.endOffset), this.stripVirtualMarkers(n.toString()).length;
|
|
1411
1423
|
}
|
|
1412
1424
|
stripVirtualMarkers(e) {
|
|
1413
|
-
return e.replace(/\u200B/g, "").split(
|
|
1425
|
+
return e.replace(/\u200B/g, "").split(T.CURSOR_SENTINEL).join("");
|
|
1414
1426
|
}
|
|
1415
1427
|
insertSentinelAtOffset(e, t) {
|
|
1416
1428
|
const i = Math.max(0, Math.min(t, e.length));
|
|
1417
|
-
return e.slice(0, i) +
|
|
1429
|
+
return e.slice(0, i) + T.CURSOR_SENTINEL + e.slice(i);
|
|
1418
1430
|
}
|
|
1419
1431
|
restoreCursorFromSentinel() {
|
|
1420
1432
|
var o;
|
|
1421
1433
|
const e = this.view.getContentElement(), t = window.getSelection(), i = document.createTreeWalker(e, NodeFilter.SHOW_TEXT);
|
|
1422
1434
|
let n = i.nextNode(), s = null, r = 0;
|
|
1423
1435
|
for (; n; ) {
|
|
1424
|
-
const l = (o = n.textContent) != null ? o : "", a = l.indexOf(
|
|
1425
|
-
a !== -1 && (s || (s = n, r = a), n.textContent = l.split(
|
|
1436
|
+
const l = (o = n.textContent) != null ? o : "", a = l.indexOf(T.CURSOR_SENTINEL);
|
|
1437
|
+
a !== -1 && (s || (s = n, r = a), n.textContent = l.split(T.CURSOR_SENTINEL).join("")), n = i.nextNode();
|
|
1426
1438
|
}
|
|
1427
1439
|
if (!s || !t) return !1;
|
|
1428
1440
|
try {
|
|
@@ -1444,7 +1456,9 @@ const w = class w {
|
|
|
1444
1456
|
// History: undo/redo
|
|
1445
1457
|
undo() {
|
|
1446
1458
|
if (this.undoStack.length === 0) return;
|
|
1447
|
-
const e = this.undoStack.pop()
|
|
1459
|
+
const e = this.undoStack.pop();
|
|
1460
|
+
this.closeTypingRun();
|
|
1461
|
+
const t = this.captureHistorySnapshot();
|
|
1448
1462
|
this.pushSnapshot(this.redoStack, t);
|
|
1449
1463
|
try {
|
|
1450
1464
|
this.suppressHistory = !0, this.expectingProgrammaticCursor = !0, this.restoreHistorySnapshot(e), setTimeout(() => {
|
|
@@ -1456,7 +1470,9 @@ const w = class w {
|
|
|
1456
1470
|
}
|
|
1457
1471
|
redo() {
|
|
1458
1472
|
if (this.redoStack.length === 0) return;
|
|
1459
|
-
const e = this.redoStack.pop()
|
|
1473
|
+
const e = this.redoStack.pop();
|
|
1474
|
+
this.closeTypingRun();
|
|
1475
|
+
const t = this.captureHistorySnapshot();
|
|
1460
1476
|
this.pushSnapshot(this.undoStack, t);
|
|
1461
1477
|
try {
|
|
1462
1478
|
this.suppressHistory = !0, this.expectingProgrammaticCursor = !0, this.restoreHistorySnapshot(e), setTimeout(() => {
|
|
@@ -1489,7 +1505,7 @@ const w = class w {
|
|
|
1489
1505
|
`, a), c = h === -1 ? t.length : h, d = t.slice(l, c).split(`
|
|
1490
1506
|
`);
|
|
1491
1507
|
let f = 0, u = 0;
|
|
1492
|
-
const g = d.map((y,
|
|
1508
|
+
const g = d.map((y, v) => {
|
|
1493
1509
|
let S = y;
|
|
1494
1510
|
if (!e)
|
|
1495
1511
|
S = y.length === 0 ? y : o + y;
|
|
@@ -1499,8 +1515,8 @@ const w = class w {
|
|
|
1499
1515
|
const C = /^ */.exec(y)[0].length;
|
|
1500
1516
|
S = y.slice(Math.min(C, o.length));
|
|
1501
1517
|
}
|
|
1502
|
-
const
|
|
1503
|
-
return
|
|
1518
|
+
const w = S.length - y.length;
|
|
1519
|
+
return v === 0 && (f = w), u += w, S;
|
|
1504
1520
|
});
|
|
1505
1521
|
if (u === 0) return !0;
|
|
1506
1522
|
this.replaceOffsetsWithText(l, c, g.join(`
|
|
@@ -1580,8 +1596,40 @@ const w = class w {
|
|
|
1580
1596
|
pushUndoSnapshot(e) {
|
|
1581
1597
|
this.pushSnapshot(this.undoStack, e), this.redoStack.length = 0;
|
|
1582
1598
|
}
|
|
1599
|
+
/** A change of one or two characters, nothing else replaced, is typing; anything bigger is an edit of its own. */
|
|
1600
|
+
static typingKind(e, t) {
|
|
1601
|
+
return e === 0 && t.length > 0 && t.length <= 2 && !t.includes(`
|
|
1602
|
+
`) ? "insert" : e > 0 && e <= 2 && t.length === 0 ? "delete" : null;
|
|
1603
|
+
}
|
|
1604
|
+
/** What changed between two versions of the text, found from both ends. */
|
|
1605
|
+
static describeEdit(e, t) {
|
|
1606
|
+
const i = Math.min(e.length, t.length);
|
|
1607
|
+
let n = 0;
|
|
1608
|
+
for (; n < i && e.charCodeAt(n) === t.charCodeAt(n); ) n++;
|
|
1609
|
+
let s = 0;
|
|
1610
|
+
for (; s < i - n && e.charCodeAt(e.length - 1 - s) === t.charCodeAt(t.length - 1 - s); )
|
|
1611
|
+
s++;
|
|
1612
|
+
return { removedLength: e.length - n - s, inserted: t.slice(n, t.length - s) };
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* Records the state before an edit as an undo step, unless the edit continues the typing (or deleting) the
|
|
1616
|
+
* newest step is already collecting: then one Undo takes back the whole word, not one letter. A space or a
|
|
1617
|
+
* line end finishes a word (it stays with the word before it); a pause, a click, a caret key, Undo and Redo
|
|
1618
|
+
* start a new step.
|
|
1619
|
+
*/
|
|
1620
|
+
recordUndoStep(e, t, i, n) {
|
|
1621
|
+
const s = T.typingKind(t, i), r = Date.now(), o = s === "insert" && /\s/.test(i), l = this.typingRun;
|
|
1622
|
+
if (s && l && l.kind === s && !l.closed && l.endText === e.text && r - l.updatedAt <= ne && r - l.startedAt <= se) {
|
|
1623
|
+
l.endText = n, l.updatedAt = r, o && (l.closed = !0);
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1626
|
+
this.pushUndoSnapshot(e), this.typingRun = s ? { kind: s, startedAt: r, updatedAt: r, endText: n, closed: o } : null;
|
|
1627
|
+
}
|
|
1628
|
+
closeTypingRun() {
|
|
1629
|
+
this.typingRun && (this.typingRun.closed = !0);
|
|
1630
|
+
}
|
|
1583
1631
|
pushSnapshot(e, t) {
|
|
1584
|
-
e.push(t), e.length >
|
|
1632
|
+
e.push(t), e.length > ie && e.shift();
|
|
1585
1633
|
}
|
|
1586
1634
|
clampPositionToText(e, t) {
|
|
1587
1635
|
var r, o;
|
|
@@ -1725,21 +1773,21 @@ const w = class w {
|
|
|
1725
1773
|
if (e === "backward") {
|
|
1726
1774
|
if (r === 0)
|
|
1727
1775
|
return;
|
|
1728
|
-
const a =
|
|
1776
|
+
const a = T.deletionBoundary(i, r, "backward", t);
|
|
1729
1777
|
this.replaceOffsetsWithText(a, r, "");
|
|
1730
1778
|
return;
|
|
1731
1779
|
}
|
|
1732
1780
|
if (o >= i.length)
|
|
1733
1781
|
return;
|
|
1734
|
-
const l =
|
|
1782
|
+
const l = T.deletionBoundary(i, o, "forward", t);
|
|
1735
1783
|
this.replaceOffsetsWithText(o, l, "");
|
|
1736
1784
|
}
|
|
1737
1785
|
static getGraphemeSegmenter() {
|
|
1738
|
-
if (
|
|
1786
|
+
if (T.graphemeSegmenter === void 0) {
|
|
1739
1787
|
const e = Intl.Segmenter;
|
|
1740
|
-
|
|
1788
|
+
T.graphemeSegmenter = e ? new e(void 0, { granularity: "grapheme" }) : null;
|
|
1741
1789
|
}
|
|
1742
|
-
return
|
|
1790
|
+
return T.graphemeSegmenter;
|
|
1743
1791
|
}
|
|
1744
1792
|
/**
|
|
1745
1793
|
* Where a deletion of `unit` starting at `offset` ends. Characters are whole grapheme
|
|
@@ -1788,7 +1836,7 @@ const w = class w {
|
|
|
1788
1836
|
const d = e.lastIndexOf(`
|
|
1789
1837
|
`, t - 1) + 1;
|
|
1790
1838
|
if (d === t) return t - 1;
|
|
1791
|
-
const f =
|
|
1839
|
+
const f = T.getGraphemeSegmenter();
|
|
1792
1840
|
if (f) {
|
|
1793
1841
|
let p = 1;
|
|
1794
1842
|
for (const { segment: m } of f.segment(e.slice(d, t))) p = m.length;
|
|
@@ -1800,7 +1848,7 @@ const w = class w {
|
|
|
1800
1848
|
if (e[t] === `
|
|
1801
1849
|
`) return t + 1;
|
|
1802
1850
|
const o = e.indexOf(`
|
|
1803
|
-
`, t), l = o === -1 ? e.length : o, a =
|
|
1851
|
+
`, t), l = o === -1 ? e.length : o, a = T.getGraphemeSegmenter();
|
|
1804
1852
|
if (a) {
|
|
1805
1853
|
for (const { segment: d } of a.segment(e.slice(t, l))) return t + d.length;
|
|
1806
1854
|
return t + 1;
|
|
@@ -1819,7 +1867,7 @@ const w = class w {
|
|
|
1819
1867
|
},
|
|
1820
1868
|
n
|
|
1821
1869
|
);
|
|
1822
|
-
this.pendingInputSnapshot = void 0, this.suppressHistory || this.
|
|
1870
|
+
this.pendingInputSnapshot = void 0, this.suppressHistory || this.recordUndoStep(r, h - a, n, this.textModel.getText());
|
|
1823
1871
|
const d = a + n.length;
|
|
1824
1872
|
return this.expectingProgrammaticCursor = !0, this.renderTextWithHighlight(this.textModel.getText(), !1), this.setCursor(this.textModel.offsetToPosition(d)), setTimeout(() => {
|
|
1825
1873
|
this.expectingProgrammaticCursor = !1;
|
|
@@ -2018,9 +2066,9 @@ const w = class w {
|
|
|
2018
2066
|
};
|
|
2019
2067
|
}
|
|
2020
2068
|
};
|
|
2021
|
-
|
|
2022
|
-
let z =
|
|
2023
|
-
class
|
|
2069
|
+
T.CURSOR_SENTINEL = "";
|
|
2070
|
+
let z = T;
|
|
2071
|
+
class re {
|
|
2024
2072
|
constructor(e) {
|
|
2025
2073
|
this.name = "keymap", this.editor = null, this.keymap = {}, this.isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0, this.keymap = e || this.getDefaultKeymap();
|
|
2026
2074
|
}
|
|
@@ -2049,7 +2097,7 @@ class ee {
|
|
|
2049
2097
|
}
|
|
2050
2098
|
getDefaultKeymap() {
|
|
2051
2099
|
const e = {};
|
|
2052
|
-
return this.addBinding(e, "f", { ctrlKey: !this.isMac, metaKey: this.isMac }, "find"), this.addBinding(e, "h", { ctrlKey: !this.isMac, metaKey: this.isMac }, "replace"), this.addBinding(e, "f3", {}, "findNext"), this.addBinding(e, "f3", { shiftKey: !0 }, "findPrev"), this.addBinding(e, "g", { ctrlKey: !this.isMac, metaKey: this.isMac }, "findNext"), this.addBinding(e, "[", { ctrlKey: !this.isMac, metaKey: this.isMac, shiftKey: !0 }, "fold"), this.addBinding(e, "]", { ctrlKey: !this.isMac, metaKey: this.isMac, shiftKey: !0 }, "unfold"), this.addBinding(e, "s", { ctrlKey: !0 }, "save"), this.addBinding(e, "s", { metaKey: !0 }, "save"), this.addBinding(e, "z", { ctrlKey: !0 }, "undo"), this.addBinding(e, "z", { metaKey: !0 }, "undo"), this.addBinding(e, "y", { ctrlKey: !0 }, "redo"), this.addBinding(e, "y", { metaKey: !0 }, "redo"), this.addBinding(e, "z", { ctrlKey: !0, shiftKey: !0 }, "redo"), this.addBinding(e, "z", { metaKey: !0, shiftKey: !0 }, "redo"), this.addBinding(e, "tab", { shiftKey: !0 }, "outdent"), this.addBinding(e, "tab", { shiftKey: !1, ctrlKey: !1, altKey: !1, metaKey: !1 }, "insertTab"), this.addBinding(e, "t", { ctrlKey: !this.isMac, metaKey: this.isMac, shiftKey: !0 }, "toggleTheme"), this.addBinding(e, "f", { altKey: !0, shiftKey: !0 }, "formatDocument"), e;
|
|
2100
|
+
return this.addBinding(e, "f", { ctrlKey: !this.isMac, metaKey: this.isMac }, "find"), this.addBinding(e, "h", { ctrlKey: !this.isMac, metaKey: this.isMac }, "replace"), this.addBinding(e, "f3", {}, "findNext"), this.addBinding(e, "f3", { shiftKey: !0 }, "findPrev"), this.addBinding(e, "g", { ctrlKey: !this.isMac, metaKey: this.isMac }, "findNext"), this.addBinding(e, "[", { ctrlKey: !this.isMac, metaKey: this.isMac, shiftKey: !0 }, "fold"), this.addBinding(e, "]", { ctrlKey: !this.isMac, metaKey: this.isMac, shiftKey: !0 }, "unfold"), this.addBinding(e, "s", { ctrlKey: !0 }, "save"), this.addBinding(e, "s", { metaKey: !0 }, "save"), this.addBinding(e, "z", { ctrlKey: !0, shiftKey: !1 }, "undo"), this.addBinding(e, "z", { metaKey: !0, shiftKey: !1 }, "undo"), this.addBinding(e, "y", { ctrlKey: !0 }, "redo"), this.addBinding(e, "y", { metaKey: !0 }, "redo"), this.addBinding(e, "z", { ctrlKey: !0, shiftKey: !0 }, "redo"), this.addBinding(e, "z", { metaKey: !0, shiftKey: !0 }, "redo"), this.addBinding(e, "tab", { shiftKey: !0 }, "outdent"), this.addBinding(e, "tab", { shiftKey: !1, ctrlKey: !1, altKey: !1, metaKey: !1 }, "insertTab"), this.addBinding(e, "t", { ctrlKey: !this.isMac, metaKey: this.isMac, shiftKey: !0 }, "toggleTheme"), this.addBinding(e, "f", { altKey: !0, shiftKey: !0 }, "formatDocument"), e;
|
|
2053
2101
|
}
|
|
2054
2102
|
addBinding(e, t, i, n) {
|
|
2055
2103
|
const s = t.toLowerCase();
|
|
@@ -2094,7 +2142,7 @@ class ee {
|
|
|
2094
2142
|
this.keymap = {}, this.editor = null;
|
|
2095
2143
|
}
|
|
2096
2144
|
}
|
|
2097
|
-
const
|
|
2145
|
+
const D = class D {
|
|
2098
2146
|
constructor() {
|
|
2099
2147
|
this.name = "transaction", this.transactions = [];
|
|
2100
2148
|
}
|
|
@@ -2106,9 +2154,9 @@ const N = class N {
|
|
|
2106
2154
|
effects: [],
|
|
2107
2155
|
annotations: []
|
|
2108
2156
|
};
|
|
2109
|
-
this.transactions.push(i), this.transactions.length >
|
|
2157
|
+
this.transactions.push(i), this.transactions.length > D.MAX_TRANSACTIONS && this.transactions.splice(
|
|
2110
2158
|
0,
|
|
2111
|
-
this.transactions.length -
|
|
2159
|
+
this.transactions.length - D.MAX_TRANSACTIONS
|
|
2112
2160
|
);
|
|
2113
2161
|
});
|
|
2114
2162
|
}
|
|
@@ -2119,9 +2167,9 @@ const N = class N {
|
|
|
2119
2167
|
this.transactions = [];
|
|
2120
2168
|
}
|
|
2121
2169
|
};
|
|
2122
|
-
|
|
2123
|
-
let B =
|
|
2124
|
-
class
|
|
2170
|
+
D.MAX_TRANSACTIONS = 200;
|
|
2171
|
+
let B = D;
|
|
2172
|
+
class oe {
|
|
2125
2173
|
constructor() {
|
|
2126
2174
|
this.name = "line-numbers", this.editor = null, this.lineNumbersElement = null, this.isEnabled = !0;
|
|
2127
2175
|
}
|
|
@@ -2150,7 +2198,7 @@ class te {
|
|
|
2150
2198
|
this.lineNumbersElement = null, this.editor = null;
|
|
2151
2199
|
}
|
|
2152
2200
|
}
|
|
2153
|
-
class
|
|
2201
|
+
class le {
|
|
2154
2202
|
constructor() {
|
|
2155
2203
|
this.name = "theme", this.editor = null, this.currentTheme = "dark";
|
|
2156
2204
|
}
|
|
@@ -2175,7 +2223,7 @@ class ie {
|
|
|
2175
2223
|
this.editor = null;
|
|
2176
2224
|
}
|
|
2177
2225
|
}
|
|
2178
|
-
class
|
|
2226
|
+
class ae {
|
|
2179
2227
|
constructor() {
|
|
2180
2228
|
this.name = "read-only", this.editor = null, this.isReadOnly = !1;
|
|
2181
2229
|
}
|
|
@@ -2202,14 +2250,14 @@ class ne {
|
|
|
2202
2250
|
this.editor = null;
|
|
2203
2251
|
}
|
|
2204
2252
|
}
|
|
2205
|
-
let
|
|
2253
|
+
let he = 0;
|
|
2206
2254
|
const b = class b {
|
|
2207
2255
|
constructor(e = {}) {
|
|
2208
2256
|
this.name = "search", this.editor = null, this.searchUI = null, this.isVisible = !1, this.currentResults = [], this.currentIndex = -1, this.searchDebounceTimer = null, this.liveRefreshTimer = null, this.statusResetTimer = null, this.statusFreezeUntil = 0, this.findInput = null, this.replaceInputEl = null, this.statusDiv = null, this.modeDiv = null, this.caseSensitiveInput = null, this.wholeWordInput = null, this.regexInput = null, this.currentQuery = "", this.savedCursor = null, this.editorChangeHandler = null, this.searchOptions = {
|
|
2209
2257
|
caseSensitive: !1,
|
|
2210
2258
|
wholeWord: !1,
|
|
2211
2259
|
regex: !1
|
|
2212
|
-
}, this.trailingMarkerAttr = "data-lce-trailing-newline-marker", this.editorContainerSelector = '[data-lce-editor-container="true"]', this.highlightId = ++
|
|
2260
|
+
}, this.trailingMarkerAttr = "data-lce-trailing-newline-marker", this.editorContainerSelector = '[data-lce-editor-container="true"]', this.highlightId = ++he, this.highlightMatchName = `editora-search-match-${this.highlightId}`, this.highlightActiveName = `editora-search-active-${this.highlightId}`, this.highlightStyleId = `editora-search-highlight-style-${this.highlightId}`, this.maxCustomHighlightRanges = 2e3, this.virtualMarkerRegex = /[\u200B\uE000]/, this.hasCustomHighlightSupport = !1, this.config = {
|
|
2213
2261
|
replaceAndFindNext: !0,
|
|
2214
2262
|
...e
|
|
2215
2263
|
};
|
|
@@ -2406,10 +2454,10 @@ const b = class b {
|
|
|
2406
2454
|
if (h) {
|
|
2407
2455
|
const c = l.getClientRects()[0] || l.getBoundingClientRect(), d = h.getBoundingClientRect(), u = h.scrollTop + (c.top - d.top) - d.height / 2 + c.height / 2, g = 18;
|
|
2408
2456
|
let p = t ? u : h.scrollTop, m = h.scrollLeft;
|
|
2409
|
-
const y = h.scrollLeft + (c.left - d.left),
|
|
2410
|
-
c.right > d.right - g ? m =
|
|
2411
|
-
const S = Math.max(0, h.scrollHeight - h.clientHeight),
|
|
2412
|
-
if (p = Math.min(S, Math.max(0, p)), m = Math.min(
|
|
2457
|
+
const y = h.scrollLeft + (c.left - d.left), v = y + c.width;
|
|
2458
|
+
c.right > d.right - g ? m = v - d.width + g : c.left < d.left + g && (m = Math.max(0, y - g));
|
|
2459
|
+
const S = Math.max(0, h.scrollHeight - h.clientHeight), w = Math.max(0, h.scrollWidth - h.clientWidth);
|
|
2460
|
+
if (p = Math.min(S, Math.max(0, p)), m = Math.min(w, Math.max(0, m)), S === 0 && w === 0) {
|
|
2413
2461
|
a == null || a.scrollIntoView({
|
|
2414
2462
|
block: t ? "center" : "nearest",
|
|
2415
2463
|
inline: "nearest",
|
|
@@ -2776,8 +2824,8 @@ b.css = {
|
|
|
2776
2824
|
mode: "search-mode",
|
|
2777
2825
|
modeLayout: "lce-search-mode"
|
|
2778
2826
|
};
|
|
2779
|
-
let W = b,
|
|
2780
|
-
class
|
|
2827
|
+
let W = b, ce = 0;
|
|
2828
|
+
class de {
|
|
2781
2829
|
constructor() {
|
|
2782
2830
|
this.name = "bracket-matching", this.editor = null, this.bracketPairs = {
|
|
2783
2831
|
"(": ")",
|
|
@@ -2789,7 +2837,7 @@ class oe {
|
|
|
2789
2837
|
"]": "[",
|
|
2790
2838
|
"}": "{",
|
|
2791
2839
|
">": "<"
|
|
2792
|
-
}, this.highlightId = ++
|
|
2840
|
+
}, this.highlightId = ++ce, this.highlightName = `editora-bracket-match-${this.highlightId}`, this.highlightStyleId = `editora-bracket-match-style-${this.highlightId}`, this.currentMatch = null, this.hasCustomHighlightSupport = !1, this.observer = null, this.pendingUpdateRaf = null, this.updateRequestVersion = 0, this.cursorHandler = null, this.changeHandler = null;
|
|
2793
2841
|
}
|
|
2794
2842
|
setup(e) {
|
|
2795
2843
|
this.editor = e, this.hasCustomHighlightSupport = this.detectCustomHighlightSupport(), this.hasCustomHighlightSupport && (this.ensureHighlightStyles(), this.observeContentMutations()), this.cursorHandler = () => {
|
|
@@ -2947,7 +2995,7 @@ class oe {
|
|
|
2947
2995
|
this.cursorHandler = null, this.changeHandler = null, this.editor = null;
|
|
2948
2996
|
}
|
|
2949
2997
|
}
|
|
2950
|
-
class
|
|
2998
|
+
class ue {
|
|
2951
2999
|
constructor() {
|
|
2952
3000
|
this.name = "code-folding", this.lineHeight = 24, this.voidMarkupTags = /* @__PURE__ */ new Set([
|
|
2953
3001
|
"area",
|
|
@@ -3615,7 +3663,7 @@ class le {
|
|
|
3615
3663
|
this.pendingUpdateRaf !== null && (cancelAnimationFrame(this.pendingUpdateRaf), this.pendingUpdateRaf = null), this.editor && this.changeHandler && this.editor.off("change", this.changeHandler), this.foldingUI && this.foldingUI.parentNode && this.foldingUI.parentNode.removeChild(this.foldingUI), this.restoreFullDisplay(), this.changeHandler = null, this.lastSnapshot = "", this.lastParsedText = null, this.foldingUI = null, this.foldRegions = [], this.cachedLineInfo = null, this.editor = null;
|
|
3616
3664
|
}
|
|
3617
3665
|
}
|
|
3618
|
-
class
|
|
3666
|
+
class ge {
|
|
3619
3667
|
constructor() {
|
|
3620
3668
|
this.name = "syntax-highlighting", this.editor = null, this.currentTheme = "dark", this.currentLanguage = null, this.modes = /* @__PURE__ */ new Map();
|
|
3621
3669
|
}
|
|
@@ -3836,9 +3884,9 @@ class ae {
|
|
|
3836
3884
|
}
|
|
3837
3885
|
let c = 0;
|
|
3838
3886
|
return a = a.replace(/(<script\b([^&>]*)>)([\s\S]*?)(<\/script>)/gi, (d, f, u, g, p) => {
|
|
3839
|
-
var
|
|
3840
|
-
const m = (S = (
|
|
3841
|
-
(((
|
|
3887
|
+
var v, S, w;
|
|
3888
|
+
const m = (S = (v = h[c++]) == null ? void 0 : v.inner) != null ? S : this.unescapeEntitiesRepeated(g || "");
|
|
3889
|
+
(((w = h[c - 1]) == null ? void 0 : w.attrs) || u || "").toLowerCase();
|
|
3842
3890
|
const y = this._highlightJS(m, i);
|
|
3843
3891
|
return `${f}${y}${p}`;
|
|
3844
3892
|
}), a = a.replace(/(<style\b[^&]*>)([\s\S]*?)(<\/style>)/gi, (d, f, u, g) => {
|
|
@@ -3855,17 +3903,17 @@ class ae {
|
|
|
3855
3903
|
let y = g;
|
|
3856
3904
|
return y = y.replace(
|
|
3857
3905
|
/([\w:-]+)(\s*=\s*)(("[\s\S]*?"|'[\s\S]*?'|[^\s&>]+))/g,
|
|
3858
|
-
(
|
|
3906
|
+
(v, S, w, C) => {
|
|
3859
3907
|
const L = String(S).toLowerCase(), I = `<span style="color: ${i.attrName};">${S}</span>`;
|
|
3860
3908
|
let O = C, M = "";
|
|
3861
3909
|
C.startsWith(""") && C.endsWith(""") ? (O = C.slice(6, -6), M = """) : C.startsWith("'") && C.endsWith("'") && (O = C.slice(5, -5), M = "'");
|
|
3862
|
-
let
|
|
3910
|
+
let R = C;
|
|
3863
3911
|
if (L === "style") {
|
|
3864
|
-
const
|
|
3865
|
-
M ?
|
|
3912
|
+
const A = O.replace(/([\w-]+)\s*:\s*([^;]+)(;?)/g, (N, k, F, H) => `<span style="color: ${i.styleProp};">${k}</span>:<span style="color: ${i.styleVal};">${F}</span>${H}`);
|
|
3913
|
+
M ? R = `${M}${A}${M}` : R = A, R = `<span style="color: ${i.attrValue};">${R}</span>`;
|
|
3866
3914
|
} else
|
|
3867
|
-
M && (
|
|
3868
|
-
return `${I}${
|
|
3915
|
+
M && (R = `${M}${O}${M}`), R = `<span style="color: ${i.attrValue};">${R}</span>`;
|
|
3916
|
+
return `${I}${w}${R}`;
|
|
3869
3917
|
}
|
|
3870
3918
|
), `${f}${m}${y}${p}`;
|
|
3871
3919
|
}), a = a.replace(/\u0002ht(\d+)\u0002/g, (d, f) => o[Number(f)] || ""), this.restoreHighlightTokens(a, s);
|
|
@@ -3958,10 +4006,10 @@ class ae {
|
|
|
3958
4006
|
(p, m, y) => `<span style="color: ${t.comment};">${m}</span>${y}`
|
|
3959
4007
|
), g = g.replace(
|
|
3960
4008
|
/^(\s*)([-*+])(\s+\[[ xX]\])(\s+)/,
|
|
3961
|
-
(p, m, y,
|
|
4009
|
+
(p, m, y, v, S) => `${m}<span style="color: ${t.keyword};">${y}</span><span style="color: ${t.attrName};">${v}</span>${S}`
|
|
3962
4010
|
), g = g.replace(
|
|
3963
4011
|
/^(\s*)([-*+]|\d+\.)(\s+)/,
|
|
3964
|
-
(p, m, y,
|
|
4012
|
+
(p, m, y, v) => `${m}<span style="color: ${t.keyword};">${y}</span>${v}`
|
|
3965
4013
|
), g = g.replace(
|
|
3966
4014
|
/^(\s*\|.*\|\s*)$/,
|
|
3967
4015
|
(p) => p.replace(/\|/g, (m) => `<span style="color: ${t.keyword};">${m}</span>`)
|
|
@@ -4195,11 +4243,11 @@ class ae {
|
|
|
4195
4243
|
this.editor = null, this.modes.clear();
|
|
4196
4244
|
}
|
|
4197
4245
|
}
|
|
4198
|
-
function
|
|
4246
|
+
function fe(E, e) {
|
|
4199
4247
|
const t = { ...e };
|
|
4200
|
-
return t.extensions || (t.extensions = []), t.extensions.some((s) => s.name === "keymap") || t.extensions.unshift(new
|
|
4248
|
+
return t.extensions || (t.extensions = []), t.extensions.some((s) => s.name === "keymap") || t.extensions.unshift(new re(t.keymap)), t.extensions.some((s) => s.name === "transaction") || t.extensions.unshift(new B()), new z(E, t);
|
|
4201
4249
|
}
|
|
4202
|
-
const P = '[data-theme="dark"], .dark, .editora-theme-dark',
|
|
4250
|
+
const P = '[data-theme="dark"], .dark, .editora-theme-dark', pe = `/* Source Editor Dialog Styles */
|
|
4203
4251
|
.rte-source-editor-overlay {
|
|
4204
4252
|
position: fixed !important;
|
|
4205
4253
|
top: 0 !important;
|
|
@@ -4498,7 +4546,7 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4498
4546
|
}
|
|
4499
4547
|
|
|
4500
4548
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn.active {
|
|
4501
|
-
background: #
|
|
4549
|
+
background: #2563eb;
|
|
4502
4550
|
color: #ffffff;
|
|
4503
4551
|
}
|
|
4504
4552
|
|
|
@@ -4540,11 +4588,11 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4540
4588
|
}
|
|
4541
4589
|
|
|
4542
4590
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save {
|
|
4543
|
-
background: #
|
|
4591
|
+
background: #2563eb;
|
|
4544
4592
|
}
|
|
4545
4593
|
|
|
4546
4594
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save:hover:not(:disabled) {
|
|
4547
|
-
background: #
|
|
4595
|
+
background: #1d4ed8;
|
|
4548
4596
|
}
|
|
4549
4597
|
|
|
4550
4598
|
/* Responsive design */
|
|
@@ -4576,7 +4624,7 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4576
4624
|
flex: 1;
|
|
4577
4625
|
text-align: center;
|
|
4578
4626
|
}
|
|
4579
|
-
}`,
|
|
4627
|
+
}`, Se = () => ({
|
|
4580
4628
|
name: "code",
|
|
4581
4629
|
// Toolbar button configuration
|
|
4582
4630
|
toolbar: [
|
|
@@ -4630,7 +4678,7 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4630
4678
|
return document.querySelector(".rte-content");
|
|
4631
4679
|
})();
|
|
4632
4680
|
if (!e)
|
|
4633
|
-
return console.error("[CodePlugin] Editor content area not found"),
|
|
4681
|
+
return console.error("[CodePlugin] Editor content area not found"), _(
|
|
4634
4682
|
"Editor content area not found. Please click inside the editor first."
|
|
4635
4683
|
), !1;
|
|
4636
4684
|
const t = e.innerHTML, i = (s) => {
|
|
@@ -4648,7 +4696,7 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4648
4696
|
const r = i(t);
|
|
4649
4697
|
let o = null, l = "dark", a = !1, h = !1, c = !1, d = !1;
|
|
4650
4698
|
const f = !!e.closest(P) || document.body.matches(P) || document.documentElement.matches(P), u = document.createElement("div");
|
|
4651
|
-
|
|
4699
|
+
Y(u), u.className = "rte-source-editor-overlay", f && u.classList.add("rte-theme-dark");
|
|
4652
4700
|
const g = document.createElement("div");
|
|
4653
4701
|
g.className = "rte-source-editor-modal", g.setAttribute("role", "dialog"), g.setAttribute("aria-modal", "true"), g.setAttribute("aria-labelledby", "source-editor-title");
|
|
4654
4702
|
const p = document.createElement("div");
|
|
@@ -4693,12 +4741,12 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4693
4741
|
m.className = "rte-source-editor-body";
|
|
4694
4742
|
const y = document.createElement("div");
|
|
4695
4743
|
y.className = "rte-source-editor-content";
|
|
4696
|
-
const T = document.createElement("div");
|
|
4697
|
-
T.className = "rte-source-editor-warning", T.textContent = "⚠️ Advanced users only. Invalid HTML may break the editor.";
|
|
4698
|
-
const S = document.createElement("div");
|
|
4699
|
-
S.className = "rte-source-editor-light-editor", S.style.height = "400px", y.appendChild(T), y.appendChild(S), m.appendChild(y);
|
|
4700
4744
|
const v = document.createElement("div");
|
|
4701
|
-
|
|
4745
|
+
v.className = "rte-source-editor-warning", v.textContent = "⚠️ Advanced users only. Invalid HTML may break the editor.";
|
|
4746
|
+
const S = document.createElement("div");
|
|
4747
|
+
S.className = "rte-source-editor-light-editor", S.style.height = "400px", y.appendChild(v), y.appendChild(S), m.appendChild(y);
|
|
4748
|
+
const w = document.createElement("div");
|
|
4749
|
+
if (w.className = "rte-source-editor-footer", w.innerHTML = `
|
|
4702
4750
|
<div class="rte-source-editor-footer-info">
|
|
4703
4751
|
<span class="unsaved-changes" style="display: none;">• Unsaved changes</span>
|
|
4704
4752
|
</div>
|
|
@@ -4706,9 +4754,9 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4706
4754
|
<button class="rte-source-editor-btn rte-source-editor-btn-cancel">Cancel</button>
|
|
4707
4755
|
<button class="rte-source-editor-btn rte-source-editor-btn-save">Save</button>
|
|
4708
4756
|
</div>
|
|
4709
|
-
`, g.appendChild(p), g.appendChild(m), g.appendChild(
|
|
4757
|
+
`, g.appendChild(p), g.appendChild(m), g.appendChild(w), u.appendChild(g), !document.getElementById("rte-source-editor-styles")) {
|
|
4710
4758
|
const x = document.createElement("style");
|
|
4711
|
-
x.id = "rte-source-editor-styles", x.textContent =
|
|
4759
|
+
x.id = "rte-source-editor-styles", x.textContent = pe, document.head.appendChild(x);
|
|
4712
4760
|
}
|
|
4713
4761
|
const C = p.querySelector(
|
|
4714
4762
|
".theme-toggle-btn"
|
|
@@ -4718,27 +4766,27 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4718
4766
|
".rte-source-editor-fullscreen-btn"
|
|
4719
4767
|
), O = p.querySelector(
|
|
4720
4768
|
".rte-source-editor-close-btn"
|
|
4721
|
-
), M =
|
|
4769
|
+
), M = w.querySelector(
|
|
4722
4770
|
".rte-source-editor-btn-cancel"
|
|
4723
|
-
),
|
|
4771
|
+
), R = w.querySelector(
|
|
4724
4772
|
".rte-source-editor-btn-save"
|
|
4725
|
-
),
|
|
4773
|
+
), A = w.querySelector(
|
|
4726
4774
|
".unsaved-changes"
|
|
4727
|
-
),
|
|
4728
|
-
x.addEventListener($, U, K),
|
|
4775
|
+
), N = [], k = (x, $, U, K) => {
|
|
4776
|
+
x.addEventListener($, U, K), N.push(
|
|
4729
4777
|
() => x.removeEventListener($, U, K)
|
|
4730
4778
|
);
|
|
4731
4779
|
}, F = (x) => {
|
|
4732
|
-
c !== x && (c = x,
|
|
4780
|
+
c !== x && (c = x, A && (A.style.display = c ? "inline" : "none"));
|
|
4733
4781
|
}, H = () => {
|
|
4734
4782
|
if (!d) {
|
|
4735
|
-
for (d = !0;
|
|
4736
|
-
const x =
|
|
4783
|
+
for (d = !0; N.length; ) {
|
|
4784
|
+
const x = N.pop();
|
|
4737
4785
|
x == null || x();
|
|
4738
4786
|
}
|
|
4739
4787
|
o && (o.destroy(), o = null), u.isConnected && u.remove();
|
|
4740
4788
|
}
|
|
4741
|
-
},
|
|
4789
|
+
}, j = () => {
|
|
4742
4790
|
l = l === "dark" ? "light" : "dark", o == null || o.setTheme(l), C && (C.innerHTML = l === "light" ? `
|
|
4743
4791
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
4744
4792
|
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
|
|
@@ -4756,7 +4804,7 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4756
4804
|
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
|
|
4757
4805
|
</svg>
|
|
4758
4806
|
`);
|
|
4759
|
-
},
|
|
4807
|
+
}, q = () => {
|
|
4760
4808
|
a = !a, o == null || o.setReadOnly(a), L && (L.classList.toggle("active", a), L.innerHTML = a ? `
|
|
4761
4809
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
4762
4810
|
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
|
|
@@ -4769,7 +4817,7 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4769
4817
|
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
|
|
4770
4818
|
</svg>
|
|
4771
4819
|
`);
|
|
4772
|
-
},
|
|
4820
|
+
}, G = () => {
|
|
4773
4821
|
h = !h, u.classList.toggle("fullscreen", h), S.style.height = h ? "calc(100vh - 200px)" : "400px", I && (I.innerHTML = h ? `
|
|
4774
4822
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
4775
4823
|
<path d="M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 0 2-2h3M3 16h3a2 2 0 0 0 2 2v3"/>
|
|
@@ -4779,12 +4827,18 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4779
4827
|
<path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>
|
|
4780
4828
|
</svg>
|
|
4781
4829
|
`);
|
|
4782
|
-
},
|
|
4783
|
-
c && !
|
|
4784
|
-
|
|
4830
|
+
}, Z = async () => {
|
|
4831
|
+
c && !await X("You have unsaved changes. Are you sure you want to cancel?", {
|
|
4832
|
+
title: "Discard changes?",
|
|
4833
|
+
confirmText: "Discard changes",
|
|
4834
|
+
cancelText: "Keep editing",
|
|
4835
|
+
danger: !0,
|
|
4836
|
+
context: e
|
|
4837
|
+
}) || H();
|
|
4838
|
+
}, Q = () => {
|
|
4785
4839
|
try {
|
|
4786
4840
|
const x = (o == null ? void 0 : o.getValue()) || "";
|
|
4787
|
-
e.innerHTML =
|
|
4841
|
+
e.innerHTML = J(x);
|
|
4788
4842
|
try {
|
|
4789
4843
|
e.dispatchEvent(
|
|
4790
4844
|
new InputEvent("input", {
|
|
@@ -4802,10 +4856,10 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4802
4856
|
new Event("change", { bubbles: !0 })
|
|
4803
4857
|
), F(!1), H();
|
|
4804
4858
|
} catch (x) {
|
|
4805
|
-
|
|
4859
|
+
_("Failed to update HTML. Please check your syntax.", "error"), console.error("HTML update error:", x);
|
|
4806
4860
|
}
|
|
4807
4861
|
};
|
|
4808
|
-
C && k(C, "click",
|
|
4862
|
+
C && k(C, "click", j), L && k(L, "click", q), I && k(I, "click", G), O && k(O, "click", H), M && k(M, "click", Z), R && k(R, "click", Q), k(u, "click", (x) => {
|
|
4809
4863
|
x.target === u && H();
|
|
4810
4864
|
}), k(document, "keydown", (x) => {
|
|
4811
4865
|
const $ = x;
|
|
@@ -4813,18 +4867,18 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4813
4867
|
}), document.body.appendChild(u), requestAnimationFrame(() => {
|
|
4814
4868
|
if (!(d || !u.isConnected))
|
|
4815
4869
|
try {
|
|
4816
|
-
o =
|
|
4870
|
+
o = fe(S, {
|
|
4817
4871
|
value: r,
|
|
4818
4872
|
theme: "dark",
|
|
4819
4873
|
readOnly: !1,
|
|
4820
4874
|
extensions: [
|
|
4821
|
-
new te(),
|
|
4822
|
-
new ie(),
|
|
4823
|
-
new ne(),
|
|
4824
4875
|
new oe(),
|
|
4825
|
-
new W(),
|
|
4826
4876
|
new le(),
|
|
4827
|
-
new ae()
|
|
4877
|
+
new ae(),
|
|
4878
|
+
new de(),
|
|
4879
|
+
new W(),
|
|
4880
|
+
new ue(),
|
|
4881
|
+
new ge()
|
|
4828
4882
|
]
|
|
4829
4883
|
}), o.on("change", () => {
|
|
4830
4884
|
const x = (o == null ? void 0 : o.getValue()) || "";
|
|
@@ -4844,6 +4898,6 @@ const P = '[data-theme="dark"], .dark, .editora-theme-dark', ce = `/* Source Edi
|
|
|
4844
4898
|
}
|
|
4845
4899
|
});
|
|
4846
4900
|
export {
|
|
4847
|
-
|
|
4901
|
+
Se as CodePlugin
|
|
4848
4902
|
};
|
|
4849
|
-
//# sourceMappingURL=CodePlugin.native-
|
|
4903
|
+
//# sourceMappingURL=CodePlugin.native-BRBEIqY7.mjs.map
|