@editora/core 1.0.10 → 1.0.11

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.
@@ -1,4 +1,4 @@
1
- class z {
1
+ class V {
2
2
  constructor(e = "") {
3
3
  this._lines = [], this._version = 0, this.setText(e);
4
4
  }
@@ -84,7 +84,7 @@ class z {
84
84
  }
85
85
  // Clone the model
86
86
  clone() {
87
- const e = new z();
87
+ const e = new V();
88
88
  return e._lines = [...this._lines], e._version = this._version, e;
89
89
  }
90
90
  normalizeRange(e) {
@@ -99,7 +99,7 @@ class z {
99
99
  }
100
100
  class Q {
101
101
  constructor(e) {
102
- this.gutterWidth = 50, this.lineHeight = 21, 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.container = e, this.createDOM();
102
+ this.gutterWidth = 50, this.gutterFoldColumnWidth = 20, this.gutterFoldColumnGap = 4, this.gutterLineNumberPaddingLeft = 8, this.gutterLineNumberPaddingRight = 4, this.gutterDigitWidth = 9, this.lineHeight = 21, 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.container = e, this.createDOM();
103
103
  }
104
104
  createDOM() {
105
105
  this.container.innerHTML = "";
@@ -114,20 +114,20 @@ class Q {
114
114
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
115
115
  font-size: 14px;
116
116
  line-height: ${this.lineHeight}px;
117
- /* vertical scrolling is shared; horizontal scrolling belongs to the code pane */
118
- overflow-x: hidden;
119
- overflow-y: auto;
117
+ overflow: auto;
120
118
  `, this.lineNumbersElement = document.createElement("div"), this.lineNumbersElement.setAttribute("data-editor-gutter", "true"), this.lineNumbersElement.style.cssText = `
121
119
  display: table-cell;
122
120
  vertical-align: top;
123
121
  position: sticky;
124
122
  left: 0;
125
123
  width: ${this.gutterWidth}px;
124
+ min-width: ${this.gutterWidth}px;
126
125
  background: var(--editor-gutter-background, #252526);
127
126
  color: var(--editor-gutter-foreground, #858585);
128
- padding: 0 8px 0 0;
127
+ padding: 0;
129
128
  text-align: right;
130
129
  border-right: 1px solid var(--editor-gutter-border, #3e3e42);
130
+ box-sizing: border-box;
131
131
  background-clip: padding-box;
132
132
  user-select: none;
133
133
  overflow: hidden;
@@ -135,6 +135,8 @@ class Q {
135
135
  `, this.lineNumbersContentElement = document.createElement("div"), this.lineNumbersContentElement.setAttribute("data-editor-gutter-content", "true"), this.lineNumbersContentElement.style.cssText = `
136
136
  position: relative;
137
137
  z-index: 1;
138
+ box-sizing: border-box;
139
+ padding: 0 ${this.gutterFoldColumnWidth + this.gutterFoldColumnGap}px 0 ${this.gutterLineNumberPaddingLeft}px;
138
140
  `, this.gutterDecorationsElement = document.createElement("div"), this.gutterDecorationsElement.setAttribute("data-editor-gutter-decorations", "true"), this.gutterDecorationsElement.setAttribute("aria-hidden", "true"), this.gutterDecorationsElement.style.cssText = `
139
141
  position: absolute;
140
142
  inset: 0;
@@ -147,6 +149,7 @@ class Q {
147
149
  vertical-align: top;
148
150
  position: relative;
149
151
  width: 100%;
152
+ min-width: max-content;
150
153
  min-height: 400px;
151
154
  `, this.highlightElement = document.createElement("div"), this.highlightElement.setAttribute("data-editor-highlight", "true"), this.highlightElement.setAttribute("aria-hidden", "true"), this.highlightElement.style.cssText = `
152
155
  position: absolute;
@@ -170,14 +173,16 @@ class Q {
170
173
  `, this.contentElement = document.createElement("div"), this.contentElement.style.cssText = `
171
174
  position: relative;
172
175
  z-index: 1;
176
+ display: block;
177
+ box-sizing: border-box;
173
178
  padding: 0 12px;
174
179
  background: transparent;
175
180
  border: none;
176
181
  outline: none;
177
182
  white-space: pre;
178
- overflow-x: auto;
179
- overflow-y: visible;
183
+ overflow: visible;
180
184
  width: 100%;
185
+ min-width: max-content;
181
186
  min-height: 400px;
182
187
  font-family: inherit;
183
188
  font-size: inherit;
@@ -191,18 +196,25 @@ class Q {
191
196
  this.scrollWrapper = i, i.setAttribute("data-editora-editor", "true"), i.style.cssText = `
192
197
  position: relative;
193
198
  display: table;
194
- table-layout: fixed;
199
+ table-layout: auto;
195
200
  width: 100%;
201
+ min-width: 100%;
196
202
  height: 100%;
197
203
  `, this.lineNumbersElement.appendChild(this.lineNumbersContentElement), this.lineNumbersElement.appendChild(this.gutterDecorationsElement), i.appendChild(this.lineNumbersElement), t.appendChild(this.lineDecorationsElement), t.appendChild(this.highlightElement), t.appendChild(this.contentElement), i.appendChild(t), e.appendChild(i), this.container.appendChild(e), this.updateLineNumbers(1);
198
204
  }
199
205
  // Update line numbers
200
206
  updateLineNumbers(e) {
201
- if (e === this.lastLineCount)
207
+ if (this.updateGutterWidth(e), e === this.lastLineCount)
202
208
  return;
203
209
  this.lastLineCount = e;
204
210
  const t = Math.max(e, 1), i = Array.from({ length: t }, (s, n) => n + 1);
205
- this.lineNumbersContentElement.innerHTML = i.map((s) => `<div style="height: ${this.lineHeight}px; line-height: ${this.lineHeight}px; padding-right: 12px;">${s}</div>`).join("");
211
+ this.lineNumbersContentElement.innerHTML = i.map((s) => `<div style="height: ${this.lineHeight}px; line-height: ${this.lineHeight}px;">${s}</div>`).join("");
212
+ }
213
+ updateGutterWidth(e) {
214
+ const t = String(Math.max(e, 1)).length * this.gutterDigitWidth + this.gutterLineNumberPaddingLeft + this.gutterLineNumberPaddingRight, i = Math.ceil(
215
+ t + this.gutterFoldColumnGap + this.gutterFoldColumnWidth
216
+ );
217
+ i !== this.gutterWidth && (this.gutterWidth = i, this.lineNumbersElement.style.display !== "none" && (this.lineNumbersElement.style.width = `${this.gutterWidth}px`, this.lineNumbersElement.style.minWidth = `${this.gutterWidth}px`));
206
218
  }
207
219
  setDecorations(e, t) {
208
220
  this.renderLineDecorations(e), this.renderGutterDecorations(t);
@@ -246,10 +258,10 @@ class Q {
246
258
  this.updateLineNumbers(t);
247
259
  }
248
260
  setLineWrapping(e) {
249
- this.contentElement.style.whiteSpace = e ? "pre-wrap" : "pre", this.contentElement.style.overflowX = e ? "hidden" : "auto", this.contentElement.style.overflowY = "visible", this.contentElement.style.wordBreak = "normal", this.contentElement.style.overflowWrap = e ? "anywhere" : "normal", this.highlightElement.style.whiteSpace = e ? "pre-wrap" : "pre", this.highlightElement.style.wordBreak = "normal", this.highlightElement.style.overflowWrap = e ? "anywhere" : "normal";
261
+ this.contentElement.style.whiteSpace = e ? "pre-wrap" : "pre", this.contentElement.style.overflow = "visible", this.contentElement.style.minWidth = e ? "100%" : "max-content", this.contentSurface.style.minWidth = e ? "100%" : "max-content", this.contentElement.style.wordBreak = "normal", this.contentElement.style.overflowWrap = e ? "anywhere" : "normal", this.highlightElement.style.whiteSpace = e ? "pre-wrap" : "pre", this.highlightElement.style.wordBreak = "normal", this.highlightElement.style.overflowWrap = e ? "anywhere" : "normal";
250
262
  }
251
263
  setLineNumbersVisible(e) {
252
- this.lineNumbersElement.style.display = e ? "table-cell" : "none", this.lineNumbersElement.style.width = e ? `${this.gutterWidth}px` : "0", this.lineNumbersElement.style.paddingRight = e ? "8px" : "0", this.lineNumbersElement.style.borderRightWidth = e ? "1px" : "0", this.scrollWrapper.style.width = e ? "100%" : "auto";
264
+ this.lineNumbersElement.style.display = e ? "table-cell" : "none", this.lineNumbersElement.style.width = e ? `${this.gutterWidth}px` : "0", this.lineNumbersElement.style.minWidth = e ? `${this.gutterWidth}px` : "0", this.lineNumbersElement.style.borderRightWidth = e ? "1px" : "0", this.scrollWrapper.style.width = "100%", this.scrollWrapper.style.minWidth = "100%";
253
265
  }
254
266
  setTabSize(e) {
255
267
  const t = Math.max(1, Math.floor(e) || 2);
@@ -447,8 +459,8 @@ class Q {
447
459
  }
448
460
  // Scroll to position
449
461
  scrollToPosition(e) {
450
- const t = this.lineNumbersElement.children[e.line];
451
- t && t.scrollIntoView({ block: "center", behavior: "smooth" });
462
+ const t = Math.max(0, Math.floor(e.line) || 0) * this.lineHeight - this.editorContainer.clientHeight / 2 + this.lineHeight / 2;
463
+ this.editorContainer.scrollTop = Math.max(0, t);
452
464
  }
453
465
  // Get scroll position
454
466
  getScrollTop() {
@@ -480,7 +492,7 @@ class Q {
480
492
  const t = this.getCaretClientRect(e);
481
493
  if (!t) return;
482
494
  const i = this.editorContainer.getBoundingClientRect(), s = 12;
483
- t.bottom > i.bottom - s ? this.editorContainer.scrollTop += t.bottom - (i.bottom - s) : t.top < i.top + s && (this.editorContainer.scrollTop -= i.top + s - t.top);
495
+ t.bottom > i.bottom - s ? this.editorContainer.scrollTop += t.bottom - (i.bottom - s) : t.top < i.top + s && (this.editorContainer.scrollTop -= i.top + s - t.top), t.right > i.right - s ? this.editorContainer.scrollLeft += t.right - (i.right - s) : t.left < i.left + s && (this.editorContainer.scrollLeft -= i.left + s - t.left);
484
496
  }
485
497
  // Destroy the view
486
498
  destroy() {
@@ -811,7 +823,7 @@ class Q {
811
823
  }
812
824
  }
813
825
  let X = 0;
814
- const U = class O {
826
+ const W = class O {
815
827
  constructor(e, t = {}) {
816
828
  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 = ++X, 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.config = {
817
829
  value: "",
@@ -821,7 +833,7 @@ const U = class O {
821
833
  lineWrapping: !1,
822
834
  lineNumbers: !0,
823
835
  ...t
824
- }, this.textModel = new z(this.config.value), this.view = new Q(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();
836
+ }, this.textModel = new V(this.config.value), this.view = new Q(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();
825
837
  }
826
838
  // Public accessors for extensions
827
839
  getTextModel() {
@@ -1755,8 +1767,8 @@ const U = class O {
1755
1767
  };
1756
1768
  }
1757
1769
  };
1758
- U.CURSOR_SENTINEL = "";
1759
- let Y = U;
1770
+ W.CURSOR_SENTINEL = "";
1771
+ let Y = W;
1760
1772
  class J {
1761
1773
  constructor(e) {
1762
1774
  this.name = "keymap", this.editor = null, this.keymap = {}, this.isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0, this.keymap = e || this.getDefaultKeymap();
@@ -1831,7 +1843,7 @@ class J {
1831
1843
  this.keymap = {}, this.editor = null;
1832
1844
  }
1833
1845
  }
1834
- const W = class V {
1846
+ const U = class z {
1835
1847
  constructor() {
1836
1848
  this.name = "transaction", this.transactions = [];
1837
1849
  }
@@ -1843,9 +1855,9 @@ const W = class V {
1843
1855
  effects: [],
1844
1856
  annotations: []
1845
1857
  };
1846
- this.transactions.push(i), this.transactions.length > V.MAX_TRANSACTIONS && this.transactions.splice(
1858
+ this.transactions.push(i), this.transactions.length > z.MAX_TRANSACTIONS && this.transactions.splice(
1847
1859
  0,
1848
- this.transactions.length - V.MAX_TRANSACTIONS
1860
+ this.transactions.length - z.MAX_TRANSACTIONS
1849
1861
  );
1850
1862
  });
1851
1863
  }
@@ -1856,8 +1868,8 @@ const W = class V {
1856
1868
  this.transactions = [];
1857
1869
  }
1858
1870
  };
1859
- W.MAX_TRANSACTIONS = 200;
1860
- let ee = W;
1871
+ U.MAX_TRANSACTIONS = 200;
1872
+ let ee = U;
1861
1873
  class te {
1862
1874
  constructor() {
1863
1875
  this.name = "line-numbers", this.editor = null, this.lineNumbersElement = null, this.isEnabled = !0;
@@ -2759,12 +2771,10 @@ class ae {
2759
2771
  }
2760
2772
  createFoldingUI() {
2761
2773
  if (!this.editor) return;
2762
- const e = this.editor.getView().getContentElement().closest(
2763
- '[data-lce-editor-container="true"]'
2764
- );
2774
+ const e = this.editor.getView().getLineNumbersElement();
2765
2775
  e && (this.foldingUI = document.createElement("div"), this.foldingUI.setAttribute("data-lce-folding-ui", "true"), this.foldingUI.style.cssText = `
2766
2776
  position: absolute;
2767
- left: 0;
2777
+ right: 0;
2768
2778
  top: 0;
2769
2779
  bottom: 0;
2770
2780
  width: 20px;
@@ -3015,31 +3025,51 @@ class ae {
3015
3025
  }), s;
3016
3026
  }
3017
3027
  toggleFold(e) {
3018
- this.editor && (this.isFoldActive(e) ? this.editor.unfold(e) : this.editor.fold(e), this.syncFoldingState());
3028
+ this.editor && (this.isFoldActive(e) ? this.editor.unfold(e) : this.editor.fold(e), this.syncFoldingStatePreservingScroll());
3019
3029
  }
3020
3030
  foldAtCursor() {
3021
3031
  if (!this.editor) return;
3022
3032
  const e = this.editor.getCursor().position.line, t = this.findBestRegionForLine(e, !1);
3023
- t && (this.editor.fold(t), this.syncFoldingState());
3033
+ t && (this.editor.fold(t), this.syncFoldingStatePreservingScroll());
3024
3034
  }
3025
3035
  unfoldAtCursor() {
3026
3036
  if (!this.editor) return;
3027
3037
  const e = this.editor.getCursor().position.line, t = this.findBestRegionForLine(e, !0);
3028
- t && (this.editor.unfold(t), this.syncFoldingState());
3038
+ t && (this.editor.unfold(t), this.syncFoldingStatePreservingScroll());
3029
3039
  }
3030
3040
  foldAll() {
3031
3041
  if (!this.editor) return;
3032
3042
  const e = this.getTopLevelFoldRegions(this.foldRegions);
3033
3043
  for (const t of e)
3034
3044
  this.editor.fold(t);
3035
- this.syncFoldingState();
3045
+ this.syncFoldingStatePreservingScroll();
3036
3046
  }
3037
3047
  unfoldAll() {
3038
3048
  if (!this.editor) return;
3039
3049
  const e = this.getActiveFolds();
3040
3050
  for (const t of e)
3041
3051
  this.editor.unfold(t);
3042
- this.syncFoldingState();
3052
+ this.syncFoldingStatePreservingScroll();
3053
+ }
3054
+ syncFoldingStatePreservingScroll() {
3055
+ this.withPreservedScroll(() => {
3056
+ this.syncFoldingState();
3057
+ });
3058
+ }
3059
+ withPreservedScroll(e) {
3060
+ var n;
3061
+ const t = (n = this.editor) == null ? void 0 : n.getView().getScrollElement();
3062
+ if (!t) {
3063
+ e();
3064
+ return;
3065
+ }
3066
+ const i = t.scrollLeft, s = t.scrollTop;
3067
+ e(), this.restoreScrollPosition(t, i, s);
3068
+ }
3069
+ restoreScrollPosition(e, t, i) {
3070
+ e.scrollLeft = t, e.scrollTop = i, requestAnimationFrame(() => {
3071
+ e.isConnected && (e.scrollLeft = t, e.scrollTop = i);
3072
+ });
3043
3073
  }
3044
3074
  applyFoldedDisplay() {
3045
3075
  if (!this.editor) return;
@@ -3576,16 +3606,16 @@ class he {
3576
3606
  return x = x.replace(
3577
3607
  /([\w:-]+)(\s*=\s*)((&quot;[\s\S]*?&quot;|&#39;[\s\S]*?&#39;|[^\s&>]+))/g,
3578
3608
  (v, T, w, S) => {
3579
- const L = String(T).toLowerCase(), H = `<span style="color: ${i.attrName};">${T}</span>`;
3580
- let I = S, C = "";
3581
- S.startsWith("&quot;") && S.endsWith("&quot;") ? (I = S.slice(6, -6), C = "&quot;") : S.startsWith("&#39;") && S.endsWith("&#39;") && (I = S.slice(5, -5), C = "&#39;");
3609
+ const L = String(T).toLowerCase(), I = `<span style="color: ${i.attrName};">${T}</span>`;
3610
+ let $ = S, C = "";
3611
+ S.startsWith("&quot;") && S.endsWith("&quot;") ? ($ = S.slice(6, -6), C = "&quot;") : S.startsWith("&#39;") && S.endsWith("&#39;") && ($ = S.slice(5, -5), C = "&#39;");
3582
3612
  let M = S;
3583
3613
  if (L === "style") {
3584
- const D = I.replace(/([\w-]+)\s*:\s*([^;]+)(;?)/g, (A, k, F, $) => `<span style="color: ${i.styleProp};">${k}</span>:<span style="color: ${i.styleVal};">${F}</span>${$}`);
3614
+ const D = $.replace(/([\w-]+)\s*:\s*([^;]+)(;?)/g, (F, k, A, H) => `<span style="color: ${i.styleProp};">${k}</span>:<span style="color: ${i.styleVal};">${A}</span>${H}`);
3585
3615
  C ? M = `${C}${D}${C}` : M = D, M = `<span style="color: ${i.attrValue};">${M}</span>`;
3586
3616
  } else
3587
- C && (M = `${C}${I}${C}`), M = `<span style="color: ${i.attrValue};">${M}</span>`;
3588
- return `${H}${w}${M}`;
3617
+ C && (M = `${C}${$}${C}`), M = `<span style="color: ${i.attrValue};">${M}</span>`;
3618
+ return `${I}${w}${M}`;
3589
3619
  }
3590
3620
  ), `${u}${m}${x}${p}`;
3591
3621
  }), a = a.replace(/\u0002ht(\d+)\u0002/g, (c, u) => o[Number(u)] || ""), this.restoreHighlightTokens(a, n);
@@ -4433,9 +4463,9 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4433
4463
  ".theme-toggle-btn"
4434
4464
  ), L = p.querySelector(
4435
4465
  ".readonly-toggle-btn"
4436
- ), H = p.querySelector(
4437
- ".rte-source-editor-fullscreen-btn"
4438
4466
  ), I = p.querySelector(
4467
+ ".rte-source-editor-fullscreen-btn"
4468
+ ), $ = p.querySelector(
4439
4469
  ".rte-source-editor-close-btn"
4440
4470
  ), C = w.querySelector(
4441
4471
  ".rte-source-editor-btn-cancel"
@@ -4443,16 +4473,16 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4443
4473
  ".rte-source-editor-btn-save"
4444
4474
  ), D = w.querySelector(
4445
4475
  ".unsaved-changes"
4446
- ), A = [], k = (b, R, P, N) => {
4447
- b.addEventListener(R, P, N), A.push(
4476
+ ), F = [], k = (b, R, P, N) => {
4477
+ b.addEventListener(R, P, N), F.push(
4448
4478
  () => b.removeEventListener(R, P, N)
4449
4479
  );
4450
- }, F = (b) => {
4480
+ }, A = (b) => {
4451
4481
  d !== b && (d = b, D && (D.style.display = d ? "inline" : "none"));
4452
- }, $ = () => {
4482
+ }, H = () => {
4453
4483
  if (!c) {
4454
- for (c = !0; A.length; ) {
4455
- const b = A.pop();
4484
+ for (c = !0; F.length; ) {
4485
+ const b = F.pop();
4456
4486
  b == null || b();
4457
4487
  }
4458
4488
  o && (o.destroy(), o = null), g.isConnected && g.remove();
@@ -4489,7 +4519,7 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4489
4519
  </svg>
4490
4520
  `);
4491
4521
  }, q = () => {
4492
- h = !h, g.classList.toggle("fullscreen", h), T.style.height = h ? "calc(100vh - 200px)" : "400px", H && (H.innerHTML = h ? `
4522
+ h = !h, g.classList.toggle("fullscreen", h), T.style.height = h ? "calc(100vh - 200px)" : "400px", I && (I.innerHTML = h ? `
4493
4523
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
4494
4524
  <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"/>
4495
4525
  </svg>
@@ -4499,7 +4529,7 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4499
4529
  </svg>
4500
4530
  `);
4501
4531
  }, G = () => {
4502
- d && !confirm("You have unsaved changes. Are you sure you want to cancel?") || $();
4532
+ d && !confirm("You have unsaved changes. Are you sure you want to cancel?") || H();
4503
4533
  }, Z = () => {
4504
4534
  try {
4505
4535
  const b = (o == null ? void 0 : o.getValue()) || "", R = document.createElement("div");
@@ -4521,16 +4551,16 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4521
4551
  }
4522
4552
  e.dispatchEvent(
4523
4553
  new Event("change", { bubbles: !0 })
4524
- ), F(!1), $();
4554
+ ), A(!1), H();
4525
4555
  } catch (b) {
4526
4556
  alert("Failed to update HTML. Please check your syntax."), console.error("HTML update error:", b);
4527
4557
  }
4528
4558
  };
4529
- S && k(S, "click", _), L && k(L, "click", j), H && k(H, "click", q), I && k(I, "click", $), C && k(C, "click", G), M && k(M, "click", Z), k(g, "click", (b) => {
4530
- b.target === g && $();
4559
+ S && k(S, "click", _), L && k(L, "click", j), I && k(I, "click", q), $ && k($, "click", H), C && k(C, "click", G), M && k(M, "click", Z), k(g, "click", (b) => {
4560
+ b.target === g && H();
4531
4561
  }), k(document, "keydown", (b) => {
4532
4562
  const R = b;
4533
- R.key === "Escape" && (R.preventDefault(), $());
4563
+ R.key === "Escape" && (R.preventDefault(), H());
4534
4564
  }), document.body.appendChild(g), requestAnimationFrame(() => {
4535
4565
  if (!(c || !g.isConnected))
4536
4566
  try {
@@ -4549,7 +4579,7 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4549
4579
  ]
4550
4580
  }), o.on("change", () => {
4551
4581
  const b = (o == null ? void 0 : o.getValue()) || "";
4552
- F(b !== r);
4582
+ A(b !== r);
4553
4583
  }), requestAnimationFrame(() => o == null ? void 0 : o.focus());
4554
4584
  } catch (b) {
4555
4585
  console.error("Failed to initialize code editor:", b);
@@ -4567,4 +4597,4 @@ const B = '[data-theme="dark"], .dark, .editora-theme-dark', de = `/* Source Edi
4567
4597
  export {
4568
4598
  ue as CodePlugin
4569
4599
  };
4570
- //# sourceMappingURL=CodePlugin.native-C5l1IeSS.mjs.map
4600
+ //# sourceMappingURL=CodePlugin.native-veDC_kx5.mjs.map
@@ -2321,7 +2321,7 @@ const rt = {
2321
2321
  clearFormatting: () => import("./ClearFormattingPlugin.native-DIS6AN2t.mjs").then((a) => a.ClearFormattingPlugin()),
2322
2322
  heading: () => import("./HeadingPlugin.native-DZdvubrQ.mjs").then((a) => a.HeadingPlugin()),
2323
2323
  blockquote: () => import("./BlockquotePlugin.native-57_Xcjl1.mjs").then((a) => a.BlockquotePlugin()),
2324
- code: () => import("./CodePlugin.native-C5l1IeSS.mjs").then((a) => a.CodePlugin()),
2324
+ code: () => import("./CodePlugin.native-veDC_kx5.mjs").then((a) => a.CodePlugin()),
2325
2325
  list: () => import("./ListPlugin.native-V7EZC1lM.mjs").then((a) => a.ListPlugin()),
2326
2326
  history: () => import("./HistoryPlugin.native-D2wl32jV.mjs").then((a) => a.HistoryPlugin())
2327
2327
  };