wysimark-lite 0.24.0 → 0.25.1

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/dist/index.mjs CHANGED
@@ -3,17 +3,17 @@
3
3
  // src/index.tsx
4
4
  import {
5
5
  createRef,
6
- useCallback as useCallback17,
6
+ useCallback as useCallback19,
7
7
  useImperativeHandle,
8
- useRef as useRef13,
8
+ useRef as useRef15,
9
9
  useState as useState14
10
10
  } from "react";
11
11
  import { createRoot } from "react-dom/client";
12
12
 
13
13
  // src/entry/index.tsx
14
14
  import throttle3 from "lodash.throttle";
15
- import { useCallback as useCallback16, useRef as useRef12, useState as useState13 } from "react";
16
- import { Editor as Editor66, Transforms as Transforms49 } from "slate";
15
+ import { useCallback as useCallback18, useRef as useRef14, useState as useState13 } from "react";
16
+ import { Editor as Editor66, Transforms as Transforms48 } from "slate";
17
17
  import { ReactEditor as ReactEditor18, Slate as Slate2 } from "slate-react";
18
18
 
19
19
  // src/convert/parse/index.ts
@@ -87,17 +87,22 @@ function replace($0, $1) {
87
87
  // src/convert/parse/custom-gfm.ts
88
88
  import { gfm } from "micromark-extension-gfm";
89
89
  import { gfmToMarkdown } from "mdast-util-gfm";
90
+ function wrapHandler(originalHandler) {
91
+ if (!originalHandler)
92
+ return void 0;
93
+ return function(token) {
94
+ if (!this.data) {
95
+ this.data = {};
96
+ }
97
+ return originalHandler.call(this, token);
98
+ };
99
+ }
90
100
  function customRemarkGfm() {
91
101
  return function() {
92
102
  if (!this) {
93
103
  return;
94
104
  }
95
- if (!this.data) {
96
- this.data = {};
97
- } else if (typeof this.data === "function") {
98
- this.data();
99
- }
100
- const data = typeof this.data === "function" ? this.data() : this.data;
105
+ const data = this.data();
101
106
  const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
102
107
  const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
103
108
  const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
@@ -105,29 +110,13 @@ function customRemarkGfm() {
105
110
  const patchedFromMarkdown = function() {
106
111
  const extension = gfmTableFromMarkdown();
107
112
  if (extension.enter) {
108
- const originalEnterTable = extension.enter.table;
109
- if (originalEnterTable) {
110
- extension.enter.table = function(token) {
111
- if (!this.data) {
112
- this.data = {};
113
- }
114
- originalEnterTable.call(this, token);
115
- this.data.inTable = true;
116
- };
113
+ for (const key2 of Object.keys(extension.enter)) {
114
+ extension.enter[key2] = wrapHandler(extension.enter[key2]);
117
115
  }
118
116
  }
119
117
  if (extension.exit) {
120
- const originalExitTable = extension.exit.table;
121
- if (originalExitTable) {
122
- extension.exit.table = function(token) {
123
- if (!this.data) {
124
- this.data = {};
125
- }
126
- originalExitTable.call(this, token);
127
- if (this.data) {
128
- this.data.inTable = void 0;
129
- }
130
- };
118
+ for (const key2 of Object.keys(extension.exit)) {
119
+ extension.exit[key2] = wrapHandler(extension.exit[key2]);
131
120
  }
132
121
  }
133
122
  return extension;
@@ -240,11 +229,12 @@ function isPlainSpace(segment) {
240
229
  }
241
230
 
242
231
  // src/convert/serialize/serialize-line/utils/mark-utils/mark-convert-utils.ts
243
- var MARK_KEY_TO_TOKEN = {
232
+ var MARK_KEY_TO_OPEN_TOKEN = {
244
233
  bold: "**",
245
234
  italic: "_",
246
235
  // ins: "++",
247
236
  strike: "~~",
237
+ highlight: "<mark>",
248
238
  /**
249
239
  * IMPORTANT!
250
240
  *
@@ -256,25 +246,41 @@ var MARK_KEY_TO_TOKEN = {
256
246
  *
257
247
  * This is handled in the `serializeLine` code.
258
248
  */
259
- code: "",
260
- /**
261
- * Highlight is handled specially in `serializeLine` using <mark> tags.
262
- */
263
- highlight: ""
249
+ code: ""
264
250
  };
265
- function convertMarkToSymbol(mark) {
266
- if (mark in MARK_KEY_TO_TOKEN)
267
- return MARK_KEY_TO_TOKEN[mark];
268
- return "";
251
+ var MARK_KEY_TO_CLOSE_TOKEN = {
252
+ bold: "**",
253
+ italic: "_",
254
+ // ins: "++",
255
+ strike: "~~",
256
+ highlight: "</mark>",
257
+ code: ""
258
+ };
259
+ function convertMarkToOpenSymbol(mark) {
260
+ if (mark in MARK_KEY_TO_OPEN_TOKEN)
261
+ return MARK_KEY_TO_OPEN_TOKEN[mark];
262
+ throw new Error(
263
+ `Could not find mark ${JSON.stringify(mark)} in MARK_KEY_TO_OPEN_TOKEN lookup`
264
+ );
265
+ }
266
+ function convertMarkToCloseSymbol(mark) {
267
+ if (mark in MARK_KEY_TO_CLOSE_TOKEN)
268
+ return MARK_KEY_TO_CLOSE_TOKEN[mark];
269
+ throw new Error(
270
+ `Could not find mark ${JSON.stringify(mark)} in MARK_KEY_TO_CLOSE_TOKEN lookup`
271
+ );
272
+ }
273
+ function convertMarksToOpenSymbols(marks) {
274
+ return marks.map(convertMarkToOpenSymbol).join("");
269
275
  }
270
- function convertMarksToSymbolsExceptCode(marks) {
271
- return marks.map(convertMarkToSymbol).join("");
276
+ function convertMarksToCloseSymbols(marks) {
277
+ return marks.map(convertMarkToCloseSymbol).join("");
272
278
  }
273
279
 
274
280
  // src/convert/serialize/serialize-line/utils/mark-utils/mark-get-utils.ts
275
281
  import { Text as SlateText } from "slate";
276
282
  function getMarksFromText(text) {
277
- const { text: _, ...marks } = text;
283
+ const { text: _textContent, ...marks } = text;
278
284
  return Object.keys(marks);
279
285
  }
280
286
  function getMarksFromSegment(segment) {
@@ -325,6 +331,7 @@ var ORDERED_MARK_KEYS = [
325
331
  "italic",
326
332
  "underline",
327
333
  "strike",
334
+ "highlight",
328
335
  "code"
329
336
  ];
330
337
  function sortMarks(marks) {
@@ -559,6 +566,13 @@ function parseInlineImage(image) {
559
566
  }
560
567
 
561
568
  // src/convert/parse/parse-phrasing-content/parse-phrasing-content.ts
569
+ function parseInlineHtml(htmlValue, marks) {
570
+ const markMatch = htmlValue.match(/^<mark>(.+?)<\/mark>$/s);
571
+ if (markMatch) {
572
+ return [{ text: markMatch[1], ...marks, highlight: true }];
573
+ }
574
+ return [{ text: htmlValue, code: true }];
575
+ }
562
576
  function parsePhrasingContents(phrasingContents, marks = {}) {
563
577
  const segments = [];
564
578
  for (const phrasingContent of phrasingContents) {
@@ -581,13 +595,8 @@ function parsePhrasingContent(phrasingContent, marks = {}) {
581
595
  });
582
596
  case "footnoteReference":
583
597
  return [{ text: `[${phrasingContent.identifier}]` }];
584
- case "html": {
585
- const markMatch = phrasingContent.value.match(/^<mark>(.*)<\/mark>$/s);
586
- if (markMatch) {
587
- return [{ text: markMatch[1], ...marks, highlight: true }];
588
- }
589
- return [{ text: phrasingContent.value, code: true }];
590
- }
598
+ case "html":
599
+ return parseInlineHtml(phrasingContent.value, marks);
591
600
  case "image":
592
601
  return parseInlineImage(phrasingContent);
593
602
  case "inlineCode": {
@@ -1372,19 +1381,11 @@ function serializeLine(inputSegments, leadingMarks = [], trailingMarks = []) {
1372
1381
  substrings.push(segment.text);
1373
1382
  continue;
1374
1383
  }
1375
- substrings.push(convertMarksToSymbolsExceptCode(leadingDiff.add));
1376
- const hasHighlightOpen = leadingDiff.add.includes("highlight");
1377
- if (hasHighlightOpen) {
1378
- substrings.push("<mark>");
1379
- }
1384
+ substrings.push(convertMarksToOpenSymbols(leadingDiff.add));
1380
1385
  substrings.push(serializeSegment(segment));
1381
1386
  const nextMarks = getNextMarks(segments, i, trailingMarks);
1382
1387
  const trailingDiff = diffMarks(leadingDiff.nextOrderedMarks, nextMarks);
1383
- const hasHighlightClose = trailingDiff.remove.includes("highlight");
1384
- if (hasHighlightClose) {
1385
- substrings.push("</mark>");
1386
- }
1387
- substrings.push(convertMarksToSymbolsExceptCode(trailingDiff.remove));
1388
+ substrings.push(convertMarksToCloseSymbols(trailingDiff.remove));
1388
1389
  leadingDiff = trailingDiff;
1389
1390
  }
1390
1391
  return substrings.join("");
@@ -1548,13 +1549,13 @@ function serializeElements(elements) {
1548
1549
  return replaceConsecutiveNewlines(replaceLeadingNewlines(joined)).trim();
1549
1550
  }
1550
1551
  function replaceLeadingNewlines(input) {
1551
- return input.replace(/^\n\n/g, "&nbsp;\n\n");
1552
+ return input.replace(/^\n\n/g, "\\\n\n");
1552
1553
  }
1553
1554
  function replaceConsecutiveNewlines(input) {
1554
1555
  return input.replace(/(\n{4,})/g, (match) => {
1555
1556
  const newlineCount = match.length;
1556
1557
  const count = Math.floor((newlineCount - 2) / 2);
1557
- return "\n\n" + Array(count).fill("&nbsp;").join("\n\n") + "\n\n";
1558
+ return "\n\n" + Array(count).fill("\\").join("\n\n") + "\n\n";
1558
1559
  });
1559
1560
  }
1560
1561
 
@@ -1612,7 +1613,11 @@ var translations = {
1612
1613
  imageSourceUrl: "URL",
1613
1614
  imageSourceFile: "\u30D5\u30A1\u30A4\u30EB",
1614
1615
  selectFile: "\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E",
1615
- uploading: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D..."
1616
+ uploading: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D...",
1617
+ saving: "\u4FDD\u5B58\u4E2D...",
1618
+ uploadComplete: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5B8C\u4E86",
1619
+ vaultPath: "\u4FDD\u5B58\u5148\u30D1\u30B9\uFF1A",
1620
+ vaultPathHint: "vault\u5185\u306E\u4FDD\u5B58\u5148\u30D1\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"
1616
1621
  },
1617
1622
  en: {
1618
1623
  bold: "Bold",
@@ -1660,7 +1665,11 @@ var translations = {
1660
1665
  imageSourceUrl: "URL",
1661
1666
  imageSourceFile: "File",
1662
1667
  selectFile: "Select File",
1663
- uploading: "Uploading..."
1668
+ uploading: "Uploading...",
1669
+ saving: "Saving...",
1670
+ uploadComplete: "Upload Complete",
1671
+ vaultPath: "Save Path:",
1672
+ vaultPathHint: "Enter the path within the vault to save the file"
1664
1673
  }
1665
1674
  };
1666
1675
  var getLanguage = () => {
@@ -1700,8 +1709,8 @@ function defined(value) {
1700
1709
  }
1701
1710
 
1702
1711
  // src/sink/editable/create-decorate.ts
1703
- function createDecorate(originalFn, plugins) {
1704
- const fns = plugins.map((plugin) => plugin.editableProps?.decorate).filter(defined);
1712
+ function createDecorate(originalFn, plugins2) {
1713
+ const fns = plugins2.map((plugin) => plugin.editableProps?.decorate).filter(defined);
1705
1714
  return function(entry) {
1706
1715
  const ranges = [];
1707
1716
  for (const fn of fns) {
@@ -1717,8 +1726,8 @@ function createDecorate(originalFn, plugins) {
1717
1726
  // src/sink/editable/create-editable.tsx
1718
1727
  import { Editable } from "slate-react";
1719
1728
  import { jsx } from "react/jsx-runtime";
1720
- function createEditable(plugins) {
1721
- const fns = plugins.map((plugin) => plugin.renderEditable).filter(defined);
1729
+ function createEditable(plugins2) {
1730
+ const fns = plugins2.map((plugin) => plugin.renderEditable).filter(defined);
1722
1731
  let CurrentRenderEditable = (props) => /* @__PURE__ */ jsx(Editable, { ...props });
1723
1732
  for (const fn of fns) {
1724
1733
  const PrevRenderEditable = CurrentRenderEditable;
@@ -1733,9 +1742,9 @@ function createEditable(plugins) {
1733
1742
  }
1734
1743
 
1735
1744
  // src/sink/editable/create-handler.ts
1736
- function extractEditableFns(plugins, key2) {
1745
+ function extractEditableFns(plugins2, key2) {
1737
1746
  const fns = [];
1738
- for (const plugin of plugins) {
1747
+ for (const plugin of plugins2) {
1739
1748
  const maybeFn = plugin.editableProps?.[key2];
1740
1749
  if (maybeFn)
1741
1750
  fns.push(maybeFn);
@@ -1751,26 +1760,26 @@ function createHandlerFn(fns, originalFn) {
1751
1760
  originalFn?.(event);
1752
1761
  };
1753
1762
  }
1754
- var createOnKeyDown = (originalFn, plugins) => {
1755
- const fns = extractEditableFns(plugins, "onKeyDown");
1763
+ var createOnKeyDown = (originalFn, plugins2) => {
1764
+ const fns = extractEditableFns(plugins2, "onKeyDown");
1756
1765
  return createHandlerFn(fns, originalFn);
1757
1766
  };
1758
- var createOnKeyUp = (originalFn, plugins) => {
1759
- const fns = extractEditableFns(plugins, "onKeyUp");
1767
+ var createOnKeyUp = (originalFn, plugins2) => {
1768
+ const fns = extractEditableFns(plugins2, "onKeyUp");
1760
1769
  return createHandlerFn(fns, originalFn);
1761
1770
  };
1762
- var createOnPaste = (originalFn, plugins) => {
1763
- const fns = extractEditableFns(plugins, "onPaste");
1771
+ var createOnPaste = (originalFn, plugins2) => {
1772
+ const fns = extractEditableFns(plugins2, "onPaste");
1764
1773
  return createHandlerFn(fns, originalFn);
1765
1774
  };
1766
- var createOnDrop = (originalFn, plugins) => {
1767
- const fns = extractEditableFns(plugins, "onDrop");
1775
+ var createOnDrop = (originalFn, plugins2) => {
1776
+ const fns = extractEditableFns(plugins2, "onDrop");
1768
1777
  return createHandlerFn(fns, originalFn);
1769
1778
  };
1770
1779
 
1771
1780
  // src/sink/editable/create-render-element.ts
1772
- function createRenderElement(originalFn, plugins) {
1773
- const fns = plugins.map((plugin) => plugin.editableProps?.renderElement).filter(defined);
1781
+ function createRenderElement(originalFn, plugins2) {
1782
+ const fns = plugins2.map((plugin) => plugin.editableProps?.renderElement).filter(defined);
1774
1783
  return function renderElement5(renderElementProps) {
1775
1784
  for (const fn of fns) {
1776
1785
  const result = fn(renderElementProps);
@@ -1788,11 +1797,11 @@ function createRenderElement(originalFn, plugins) {
1788
1797
 
1789
1798
  // src/sink/editable/create-render-leaf.ts
1790
1799
  import { cloneElement } from "react";
1791
- function createRenderLeaf(originalFn, plugins) {
1800
+ function createRenderLeaf(originalFn, plugins2) {
1792
1801
  if (originalFn === void 0) {
1793
1802
  throw new Error(`renderLeaf was not defined on SinkEditable`);
1794
1803
  }
1795
- const fns = plugins.map((plugin) => plugin.editableProps?.renderLeaf).filter(defined).reverse();
1804
+ const fns = plugins2.map((plugin) => plugin.editableProps?.renderLeaf).filter(defined).reverse();
1796
1805
  return function(renderLeafProps) {
1797
1806
  let value = originalFn({
1798
1807
  ...renderLeafProps,
@@ -1821,10 +1830,10 @@ function createRenderLeaf(originalFn, plugins) {
1821
1830
  }
1822
1831
 
1823
1832
  // src/sink/editable/create-render-placeholder.tsx
1824
- function createRenderPlaceholder(originalFn, plugins) {
1833
+ function createRenderPlaceholder(originalFn, plugins2) {
1825
1834
  if (originalFn)
1826
1835
  return originalFn;
1827
- const fns = plugins.map((plugin) => plugin.editableProps?.renderPlaceholder).filter(defined);
1836
+ const fns = plugins2.map((plugin) => plugin.editableProps?.renderPlaceholder).filter(defined);
1828
1837
  if (fns.length === 0)
1829
1838
  return void 0;
1830
1839
  return function(renderPlaceholderProps) {
@@ -1858,16 +1867,16 @@ function SinkEditable(originalProps) {
1858
1867
  useEffect(() => {
1859
1868
  Editor.normalize(editor, { force: true });
1860
1869
  }, []);
1861
- const { plugins } = editor.sink;
1870
+ const { plugins: plugins2 } = editor.sink;
1862
1871
  const nextProps = useMemo(
1863
1872
  () => ({
1864
1873
  ...originalProps,
1865
- decorate: createDecorate(originalProps.decorate, plugins),
1866
- renderElement: createRenderElement(originalProps.renderElement, plugins),
1867
- renderLeaf: createRenderLeaf(originalProps.renderLeaf, plugins),
1874
+ decorate: createDecorate(originalProps.decorate, plugins2),
1875
+ renderElement: createRenderElement(originalProps.renderElement, plugins2),
1876
+ renderLeaf: createRenderLeaf(originalProps.renderLeaf, plugins2),
1868
1877
  renderPlaceholder: createRenderPlaceholder(
1869
1878
  originalProps.renderPlaceholder,
1870
- plugins
1879
+ plugins2
1871
1880
  ),
1872
1881
  /**
1873
1882
  * NOTE: We skip `onKeyUp` as it is deprecated. If somebody needs it in new
@@ -1875,35 +1884,38 @@ function SinkEditable(originalProps) {
1875
1884
  *
1876
1885
  * https://developer.mozilla.org/en-US/docs/Web/API/Element/keypress_event
1877
1886
  */
1878
- onKeyDown: createOnKeyDown(originalProps.onKeyDown, plugins),
1879
- onKeyUp: createOnKeyUp(originalProps.onKeyUp, plugins),
1880
- onPaste: createOnPaste(originalProps.onPaste, plugins),
1881
- onDrop: createOnDrop(originalProps.onDrop, plugins)
1887
+ onKeyDown: createOnKeyDown(originalProps.onKeyDown, plugins2),
1888
+ onKeyUp: createOnKeyUp(originalProps.onKeyUp, plugins2),
1889
+ onPaste: createOnPaste(originalProps.onPaste, plugins2),
1890
+ onDrop: createOnDrop(originalProps.onDrop, plugins2)
1882
1891
  }),
1883
1892
  Object.values(originalProps)
1884
1893
  );
1885
- const NextEditable = useMemo(() => createEditable(plugins), [plugins]);
1894
+ const NextEditable = useMemo(() => createEditable(plugins2), [plugins2]);
1886
1895
  return /* @__PURE__ */ jsx2(NextEditable, { ...nextProps });
1887
1896
  }
1888
1897
 
1889
1898
  // src/sink/editor/create-boolean-action.ts
1890
- function createBooleanAction(editor, actionKey, plugins) {
1899
+ function createBooleanAction(editor, actionKey, plugins2) {
1891
1900
  const originalAction = editor[actionKey];
1892
- const actionPlugins = plugins.filter((plugin) => plugin.editor?.[actionKey]);
1901
+ const actionPlugins = plugins2.filter((plugin) => plugin.editor?.[actionKey]);
1893
1902
  return function nextBooleanAction(node) {
1894
1903
  for (const plugin of actionPlugins) {
1895
- const result = plugin.editor?.[actionKey]?.(node);
1904
+ const editorPlugin = plugin.editor;
1905
+ const actionFn = editorPlugin?.[actionKey];
1906
+ const result = actionFn?.(node);
1896
1907
  if (typeof result === "boolean")
1897
1908
  return result;
1898
1909
  }
1899
- return originalAction(node);
1910
+ const origFn = originalAction;
1911
+ return origFn(node);
1900
1912
  };
1901
1913
  }
1902
1914
 
1903
1915
  // src/sink/editor/create-void-action.ts
1904
- function createVoidAction(editor, actionKey, plugins) {
1916
+ function createVoidAction(editor, actionKey, plugins2) {
1905
1917
  const originalAction = editor[actionKey];
1906
- const actionPlugins = plugins.filter((plugin) => plugin.editor?.[actionKey]);
1918
+ const actionPlugins = plugins2.filter((plugin) => plugin.editor?.[actionKey]);
1907
1919
  return function nextVoidAction(...args) {
1908
1920
  let isHandled = false;
1909
1921
  const afterHandledCallbacks = [];
@@ -1927,10 +1939,10 @@ function createVoidAction(editor, actionKey, plugins) {
1927
1939
  function createWithSink(pluginFns) {
1928
1940
  return (originalEditor, options) => {
1929
1941
  const editor = originalEditor;
1930
- const plugins = pluginFns.map(
1942
+ const plugins2 = pluginFns.map(
1931
1943
  (plugin) => plugin(editor, options, { createPolicy: (x) => x })
1932
1944
  );
1933
- editor.sink = { plugins };
1945
+ editor.sink = { plugins: plugins2 };
1934
1946
  editor.isMaster = "isMaster" in editor ? editor.isMaster : () => false;
1935
1947
  editor.isSlave = "isSlave" in editor ? editor.isSlave : () => false;
1936
1948
  editor.isStandalone = "isStandalone" in editor ? editor.isStandalone : () => false;
@@ -1938,22 +1950,22 @@ function createWithSink(pluginFns) {
1938
1950
  /**
1939
1951
  * void
1940
1952
  */
1941
- normalizeNode: createVoidAction(editor, "normalizeNode", plugins),
1942
- deleteBackward: createVoidAction(editor, "deleteBackward", plugins),
1943
- deleteForward: createVoidAction(editor, "deleteForward", plugins),
1944
- deleteFragment: createVoidAction(editor, "deleteFragment", plugins),
1945
- insertBreak: createVoidAction(editor, "insertBreak", plugins),
1946
- insertFragment: createVoidAction(editor, "insertFragment", plugins),
1947
- insertNode: createVoidAction(editor, "insertNode", plugins),
1948
- insertText: createVoidAction(editor, "insertText", plugins),
1953
+ normalizeNode: createVoidAction(editor, "normalizeNode", plugins2),
1954
+ deleteBackward: createVoidAction(editor, "deleteBackward", plugins2),
1955
+ deleteForward: createVoidAction(editor, "deleteForward", plugins2),
1956
+ deleteFragment: createVoidAction(editor, "deleteFragment", plugins2),
1957
+ insertBreak: createVoidAction(editor, "insertBreak", plugins2),
1958
+ insertFragment: createVoidAction(editor, "insertFragment", plugins2),
1959
+ insertNode: createVoidAction(editor, "insertNode", plugins2),
1960
+ insertText: createVoidAction(editor, "insertText", plugins2),
1949
1961
  /**
1950
1962
  * boolean
1951
1963
  */
1952
- isInline: createBooleanAction(editor, "isInline", plugins),
1953
- isVoid: createBooleanAction(editor, "isVoid", plugins),
1954
- isMaster: createBooleanAction(editor, "isMaster", plugins),
1955
- isSlave: createBooleanAction(editor, "isSlave", plugins),
1956
- isStandalone: createBooleanAction(editor, "isStandalone", plugins)
1964
+ isInline: createBooleanAction(editor, "isInline", plugins2),
1965
+ isVoid: createBooleanAction(editor, "isVoid", plugins2),
1966
+ isMaster: createBooleanAction(editor, "isMaster", plugins2),
1967
+ isSlave: createBooleanAction(editor, "isSlave", plugins2),
1968
+ isStandalone: createBooleanAction(editor, "isStandalone", plugins2)
1957
1969
  });
1958
1970
  return editor;
1959
1971
  };
@@ -2020,8 +2032,9 @@ function standardizeNodeMatcher(matchNode) {
2020
2032
  return (node) => Element4.isElement(node) && node.type === matchNode;
2021
2033
  if (Array.isArray(matchNode))
2022
2034
  return (node) => Element4.isElement(node) && matchNode.includes(node.type);
2035
+ const exhaustiveCheck = matchNode;
2023
2036
  throw new Error(
2024
- `Expected matchNode to be a function, string or array but is ${matchNode}`
2037
+ `Expected matchNode to be a function, string or array but is ${exhaustiveCheck}`
2025
2038
  );
2026
2039
  }
2027
2040
 
@@ -2191,13 +2204,13 @@ function forceNormalizePath(editor, path) {
2191
2204
  Editor8.withoutNormalizing(editor, () => {
2192
2205
  Transforms2.setNodes(
2193
2206
  editor,
2194
- // @ts-ignore
2207
+ // @ts-expect-error - intentional dummy property for normalization
2195
2208
  { __DOESNT_MATTER_JUST_TO_START_NORMALIZING__: "123" },
2196
2209
  { at: path }
2197
2210
  );
2198
2211
  Transforms2.setNodes(
2199
2212
  editor,
2200
- // @ts-ignore
2213
+ // @ts-expect-error - intentional dummy property for normalization
2201
2214
  { __DOESNT_MATTER_JUST_TO_START_NORMALIZING__: null },
2202
2215
  { at: path }
2203
2216
  );
@@ -2305,7 +2318,7 @@ function isUrl(s) {
2305
2318
  let url;
2306
2319
  try {
2307
2320
  url = new URL(s);
2308
- } catch (_) {
2321
+ } catch {
2309
2322
  return false;
2310
2323
  }
2311
2324
  return url.protocol === "http:" || url.protocol === "https:" || url.protocol === "mailto:";
@@ -2407,7 +2420,7 @@ function normalizeNode(editor, entry) {
2407
2420
 
2408
2421
  // src/anchor-plugin/render-element/anchor.tsx
2409
2422
  import { clsx } from "clsx";
2410
- import { useEffect as useEffect3, useRef as useRef4 } from "react";
2423
+ import { useEffect as useEffect3, useRef as useRef5 } from "react";
2411
2424
  import { useSelected, useSlate } from "slate-react";
2412
2425
 
2413
2426
  // src/use-layer/layers.tsx
@@ -2527,8 +2540,8 @@ var $ProgressBarFill = styled2("span")`
2527
2540
  `;
2528
2541
 
2529
2542
  // src/anchor-plugin/render-element/AnchorDialog.tsx
2530
- import styled14 from "@emotion/styled";
2531
- import { useCallback as useCallback4 } from "react";
2543
+ import styled15 from "@emotion/styled";
2544
+ import { useCallback as useCallback5, useState as useState4 } from "react";
2532
2545
  import { useSlateStatic as useSlateStatic4 } from "slate-react";
2533
2546
 
2534
2547
  // src/shared-overlays/components/CloseMask/index.tsx
@@ -2738,10 +2751,21 @@ function useAbsoluteReposition(elementLikeRecord, fn) {
2738
2751
  function positionInside(src, container, pos, { margin = 0 } = {}) {
2739
2752
  if (src == null)
2740
2753
  return { ...pos, left: -1024 };
2741
- const right = pos.left + src.width;
2742
- if (right <= container.right - margin)
2743
- return pos;
2744
- return { ...pos, left: container.right - src.width - margin };
2754
+ const { top } = pos;
2755
+ let { left } = pos;
2756
+ const containerWidth = container.right - container.left - margin * 2;
2757
+ if (src.width >= containerWidth) {
2758
+ left = container.left + margin;
2759
+ } else {
2760
+ const right = left + src.width;
2761
+ if (right > container.right - margin) {
2762
+ left = container.right - src.width - margin;
2763
+ }
2764
+ if (left < container.left + margin) {
2765
+ left = container.left + margin;
2766
+ }
2767
+ }
2768
+ return { left, top };
2745
2769
  }
2746
2770
 
2747
2771
  // src/toolbar-plugin/styles/anchor-dialog-styles.ts
@@ -2779,8 +2803,9 @@ var $Panel = styled4(SinkReset)`
2779
2803
 
2780
2804
  // src/toolbar-plugin/styles/anchor-dialog-styles.ts
2781
2805
  var $AnchorDialog = styled5($Panel)`
2782
- padding: 1em;
2783
2806
  width: 24em;
2807
+ padding: 0;
2808
+ overflow: hidden;
2784
2809
  `;
2785
2810
  var $AnchorDialogInputLine = styled5("div")`
2786
2811
  display: flex;
@@ -2791,6 +2816,7 @@ var $AnchorDialogInput = styled5("input")`
2791
2816
  padding: 0.5em 0.75em;
2792
2817
  border-radius: 0.25em;
2793
2818
  color: var(--shade-700);
2819
+ background: var(--shade-50);
2794
2820
  border: 1px solid var(--shade-300);
2795
2821
  font-size: 0.9375em;
2796
2822
  &:focus {
@@ -2855,6 +2881,7 @@ var $Menu = styled8($Panel)`
2855
2881
  padding-top: 0.5em;
2856
2882
  padding-bottom: 0.5em;
2857
2883
  transition: all 200ms;
2884
+ min-width: 12em;
2858
2885
  /**
2859
2886
  * Prevent clicks from stealing focus from the editor
2860
2887
  */
@@ -2884,9 +2911,10 @@ var $MenuItem = styled8("div")`
2884
2911
  }
2885
2912
  }
2886
2913
  .--title {
2887
- flex: 1 0;
2914
+ flex: 1 1 auto;
2888
2915
  font-size: 0.875em;
2889
2916
  color: var(--shade-800);
2917
+ white-space: nowrap;
2890
2918
  }
2891
2919
  .--hotkey {
2892
2920
  flex: 0 0;
@@ -3190,8 +3218,8 @@ function useTooltip({
3190
3218
  }
3191
3219
 
3192
3220
  // src/anchor-plugin/render-element/AnchorEditDialog.tsx
3193
- import styled13 from "@emotion/styled";
3194
- import { useCallback as useCallback3, useRef as useRef3, useState as useState3 } from "react";
3221
+ import styled14 from "@emotion/styled";
3222
+ import { useCallback as useCallback4, useRef as useRef4, useState as useState3 } from "react";
3195
3223
  import { Node as Node6 } from "slate";
3196
3224
  import { useSlateStatic as useSlateStatic3 } from "slate-react";
3197
3225
 
@@ -3223,6 +3251,7 @@ var $Textarea = styled12("input")`
3223
3251
  padding: 0.5em 0.75em;
3224
3252
  border-radius: 0.25em;
3225
3253
  color: var(--shade-700);
3254
+ background: var(--shade-50);
3226
3255
  font-family: inherit;
3227
3256
  border: 1px solid var(--shade-300);
3228
3257
  font-size: 0.9375em;
@@ -3236,6 +3265,7 @@ var $Input = styled12("input")`
3236
3265
  padding: 0.5em 0.75em;
3237
3266
  border-radius: 0.25em;
3238
3267
  color: var(--shade-700);
3268
+ background: var(--shade-50);
3239
3269
  border: 1px solid var(--shade-300);
3240
3270
  font-size: 0.9375em;
3241
3271
  &:focus {
@@ -3284,12 +3314,96 @@ var $CancelButton = styled12($BaseButton)`
3284
3314
  }
3285
3315
  `;
3286
3316
 
3317
+ // src/toolbar-plugin/components/dialog/DraggableHeader.tsx
3318
+ import { useRef as useRef3, useCallback as useCallback3 } from "react";
3319
+ import styled13 from "@emotion/styled";
3320
+ import { jsx as jsx11 } from "react/jsx-runtime";
3321
+ var $DragHandle = styled13.div`
3322
+ display: flex;
3323
+ align-items: center;
3324
+ justify-content: center;
3325
+ padding: 6px 0;
3326
+ cursor: grab;
3327
+ background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
3328
+ border-bottom: 1px solid #ddd;
3329
+ border-radius: 4px 4px 0 0;
3330
+ user-select: none;
3331
+ touch-action: none;
3332
+
3333
+ &:active {
3334
+ cursor: grabbing;
3335
+ }
3336
+ `;
3337
+ var $DragIndicator = styled13.div`
3338
+ width: 32px;
3339
+ height: 4px;
3340
+ background: #ccc;
3341
+ border-radius: 2px;
3342
+ `;
3343
+ function DraggableHeader({ onDrag }) {
3344
+ const startPos = useRef3(null);
3345
+ const handleStart = useCallback3((clientX, clientY) => {
3346
+ startPos.current = { x: clientX, y: clientY };
3347
+ }, []);
3348
+ const handleMove = useCallback3((clientX, clientY) => {
3349
+ if (!startPos.current)
3350
+ return;
3351
+ const deltaX = clientX - startPos.current.x;
3352
+ const deltaY = clientY - startPos.current.y;
3353
+ startPos.current = { x: clientX, y: clientY };
3354
+ onDrag(deltaX, deltaY);
3355
+ }, [onDrag]);
3356
+ const handleEnd = useCallback3(() => {
3357
+ startPos.current = null;
3358
+ }, []);
3359
+ const onMouseDown = useCallback3((e) => {
3360
+ e.preventDefault();
3361
+ handleStart(e.clientX, e.clientY);
3362
+ const onMouseMove = (e2) => {
3363
+ handleMove(e2.clientX, e2.clientY);
3364
+ };
3365
+ const onMouseUp = () => {
3366
+ handleEnd();
3367
+ document.removeEventListener("mousemove", onMouseMove);
3368
+ document.removeEventListener("mouseup", onMouseUp);
3369
+ };
3370
+ document.addEventListener("mousemove", onMouseMove);
3371
+ document.addEventListener("mouseup", onMouseUp);
3372
+ }, [handleStart, handleMove, handleEnd]);
3373
+ const onTouchStart = useCallback3((e) => {
3374
+ if (e.touches.length !== 1)
3375
+ return;
3376
+ const touch = e.touches[0];
3377
+ handleStart(touch.clientX, touch.clientY);
3378
+ }, [handleStart]);
3379
+ const onTouchMove = useCallback3((e) => {
3380
+ if (e.touches.length !== 1)
3381
+ return;
3382
+ const touch = e.touches[0];
3383
+ handleMove(touch.clientX, touch.clientY);
3384
+ }, [handleMove]);
3385
+ const onTouchEnd = useCallback3(() => {
3386
+ handleEnd();
3387
+ }, [handleEnd]);
3388
+ return /* @__PURE__ */ jsx11(
3389
+ $DragHandle,
3390
+ {
3391
+ onMouseDown,
3392
+ onTouchStart,
3393
+ onTouchMove,
3394
+ onTouchEnd,
3395
+ children: /* @__PURE__ */ jsx11($DragIndicator, {})
3396
+ }
3397
+ );
3398
+ }
3399
+
3287
3400
  // src/anchor-plugin/render-element/AnchorEditDialog.tsx
3288
- import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
3289
- var $AnchorEditDialog = styled13($Panel)`
3401
+ import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
3402
+ var $AnchorEditDialog = styled14($Panel)`
3290
3403
  position: absolute;
3291
3404
  width: 20em;
3292
- padding: 1em;
3405
+ padding: 0;
3406
+ overflow: hidden;
3293
3407
  `;
3294
3408
  function AnchorEditDialog({
3295
3409
  destAnchor,
@@ -3297,7 +3411,11 @@ function AnchorEditDialog({
3297
3411
  element
3298
3412
  }) {
3299
3413
  const dialog = useLayer("dialog");
3300
- const style = useAbsoluteReposition(
3414
+ const [dragOffset, setDragOffset] = useState3({ x: 0, y: 0 });
3415
+ const handleDrag = useCallback4((deltaX, deltaY) => {
3416
+ setDragOffset((prev) => ({ x: prev.x + deltaX, y: prev.y + deltaY }));
3417
+ }, []);
3418
+ const baseStyle = useAbsoluteReposition(
3301
3419
  { destAnchor, destStartEdge },
3302
3420
  ({ destAnchor: destAnchor2, destStartEdge: destStartEdge2 }) => {
3303
3421
  return {
@@ -3306,23 +3424,28 @@ function AnchorEditDialog({
3306
3424
  };
3307
3425
  }
3308
3426
  );
3427
+ const style = {
3428
+ ...baseStyle,
3429
+ left: baseStyle.left + dragOffset.x,
3430
+ top: baseStyle.top + dragOffset.y
3431
+ };
3309
3432
  const editor = useSlateStatic3();
3310
3433
  const [href, setHref] = useState3(element.href);
3311
3434
  const [text, setText] = useState3(Node6.string(element));
3312
3435
  const [title, setTitle] = useState3(element.title || "");
3313
- const formRef = useRef3({ href, text, title });
3436
+ const formRef = useRef4({ href, text, title });
3314
3437
  formRef.current = { href, text, title };
3315
- const handleHrefChange = useCallback3((e) => {
3438
+ const handleHrefChange = useCallback4((e) => {
3316
3439
  setHref(e.target.value);
3317
3440
  }, []);
3318
- const handleTextChange = useCallback3((e) => {
3441
+ const handleTextChange = useCallback4((e) => {
3319
3442
  setText(e.target.value);
3320
3443
  }, []);
3321
- const handleTitleChange = useCallback3((e) => {
3444
+ const handleTitleChange = useCallback4((e) => {
3322
3445
  setTitle(e.target.value);
3323
3446
  }, []);
3324
- const openAnchorDialog = useCallback3(() => {
3325
- dialog.open(() => /* @__PURE__ */ jsx11(
3447
+ const openAnchorDialog = useCallback4(() => {
3448
+ dialog.open(() => /* @__PURE__ */ jsx12(
3326
3449
  AnchorDialog,
3327
3450
  {
3328
3451
  destAnchor,
@@ -3331,45 +3454,49 @@ function AnchorEditDialog({
3331
3454
  }
3332
3455
  ));
3333
3456
  }, [destAnchor, destStartEdge, element]);
3334
- const handleSubmit = useCallback3(() => {
3457
+ const handleSubmit = useCallback4(() => {
3335
3458
  const { href: href2, text: text2, title: title2 } = formRef.current;
3336
3459
  editor.anchor.editLink({ href: href2, text: text2, title: title2 }, { at: element });
3337
3460
  openAnchorDialog();
3338
3461
  }, [openAnchorDialog]);
3339
3462
  return /* @__PURE__ */ jsxs5($AnchorEditDialog, { contentEditable: false, style, children: [
3340
- /* @__PURE__ */ jsxs5($FormGroup, { children: [
3341
- /* @__PURE__ */ jsx11($FormCaption, { children: t("linkUrl") }),
3342
- /* @__PURE__ */ jsx11($Input, { type: "text", value: href, onChange: handleHrefChange })
3343
- ] }),
3344
- /* @__PURE__ */ jsxs5($FormGroup, { children: [
3345
- /* @__PURE__ */ jsx11($FormCaption, { children: t("linkText") }),
3346
- /* @__PURE__ */ jsx11($Input, { type: "text", value: text, onChange: handleTextChange }),
3347
- /* @__PURE__ */ jsx11($FormHint, { children: t("linkTextHint") })
3348
- ] }),
3349
- /* @__PURE__ */ jsxs5($FormGroup, { children: [
3350
- /* @__PURE__ */ jsx11($FormCaption, { children: t("tooltipText") }),
3351
- /* @__PURE__ */ jsx11($Input, { type: "text", value: title, onChange: handleTitleChange }),
3352
- /* @__PURE__ */ jsx11($FormHint, { children: t("tooltipHint") })
3353
- ] }),
3354
- /* @__PURE__ */ jsx11($FormGroup, { children: /* @__PURE__ */ jsx11($PrimaryButton, { onClick: handleSubmit, children: t("apply") }) }),
3355
- /* @__PURE__ */ jsx11($FormGroup, { children: /* @__PURE__ */ jsx11($CancelButton, { onClick: openAnchorDialog, children: t("cancel") }) })
3463
+ /* @__PURE__ */ jsx12(DraggableHeader, { onDrag: handleDrag }),
3464
+ /* @__PURE__ */ jsxs5("div", { style: { padding: "1em" }, children: [
3465
+ /* @__PURE__ */ jsxs5($FormGroup, { children: [
3466
+ /* @__PURE__ */ jsx12($FormCaption, { children: t("linkUrl") }),
3467
+ /* @__PURE__ */ jsx12($Textarea, { as: "textarea", value: href, onChange: handleHrefChange })
3468
+ ] }),
3469
+ /* @__PURE__ */ jsxs5($FormGroup, { children: [
3470
+ /* @__PURE__ */ jsx12($FormCaption, { children: t("linkText") }),
3471
+ /* @__PURE__ */ jsx12($Input, { type: "text", value: text, onChange: handleTextChange }),
3472
+ /* @__PURE__ */ jsx12($FormHint, { children: t("linkTextHint") })
3473
+ ] }),
3474
+ /* @__PURE__ */ jsxs5($FormGroup, { children: [
3475
+ /* @__PURE__ */ jsx12($FormCaption, { children: t("tooltipText") }),
3476
+ /* @__PURE__ */ jsx12($Input, { type: "text", value: title, onChange: handleTitleChange }),
3477
+ /* @__PURE__ */ jsx12($FormHint, { children: t("tooltipHint") })
3478
+ ] }),
3479
+ /* @__PURE__ */ jsx12($FormGroup, { children: /* @__PURE__ */ jsx12($PrimaryButton, { onClick: handleSubmit, children: t("apply") }) }),
3480
+ /* @__PURE__ */ jsx12($FormGroup, { children: /* @__PURE__ */ jsx12($CancelButton, { onClick: openAnchorDialog, children: t("cancel") }) })
3481
+ ] })
3356
3482
  ] });
3357
3483
  }
3358
3484
 
3359
3485
  // src/anchor-plugin/render-element/icons.tsx
3360
- import { jsx as jsx12 } from "react/jsx-runtime";
3361
- var ExternalLinkIcon = (props) => /* @__PURE__ */ jsx12(TablerIcon, { ...props, children: /* @__PURE__ */ jsx12("path", { d: "M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6M11 13l9-9M15 4h5v5" }) });
3362
- var LinkOffIcon = (props) => /* @__PURE__ */ jsx12(TablerIcon, { ...props, children: /* @__PURE__ */ jsx12("path", { d: "m9 15 3-3m2-2 1-1M11 6l.463-.536a5 5 0 0 1 7.071 7.072L18 13M3 3l18 18M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0 4.972 4.972 0 0 1 0-7.071L6 11" }) });
3363
- var PencilIcon = (props) => /* @__PURE__ */ jsx12(TablerIcon, { ...props, children: /* @__PURE__ */ jsx12("path", { d: "M4 20h4L18.5 9.5a1.5 1.5 0 0 0-4-4L4 16v4M13.5 6.5l4 4" }) });
3486
+ import { jsx as jsx13 } from "react/jsx-runtime";
3487
+ var ExternalLinkIcon = (props) => /* @__PURE__ */ jsx13(TablerIcon, { ...props, children: /* @__PURE__ */ jsx13("path", { d: "M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6M11 13l9-9M15 4h5v5" }) });
3488
+ var LinkOffIcon = (props) => /* @__PURE__ */ jsx13(TablerIcon, { ...props, children: /* @__PURE__ */ jsx13("path", { d: "m9 15 3-3m2-2 1-1M11 6l.463-.536a5 5 0 0 1 7.071 7.072L18 13M3 3l18 18M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0 4.972 4.972 0 0 1 0-7.071L6 11" }) });
3489
+ var PencilIcon = (props) => /* @__PURE__ */ jsx13(TablerIcon, { ...props, children: /* @__PURE__ */ jsx13("path", { d: "M4 20h4L18.5 9.5a1.5 1.5 0 0 0-4-4L4 16v4M13.5 6.5l4 4" }) });
3490
+ var CloseIcon = (props) => /* @__PURE__ */ jsx13(TablerIcon, { ...props, children: /* @__PURE__ */ jsx13("path", { d: "M18 6L6 18M6 6l12 12" }) });
3364
3491
 
3365
3492
  // src/anchor-plugin/render-element/AnchorDialog.tsx
3366
- import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
3367
- var $AnchorDialog2 = styled14($Panel)`
3493
+ import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
3494
+ var $AnchorDialog2 = styled15($Panel)`
3368
3495
  position: absolute;
3369
- display: flex;
3370
3496
  width: 20em;
3371
- z-index: 10;
3372
- padding: 1em;
3497
+ z-index: 1000;
3498
+ padding: 0;
3499
+ overflow: hidden;
3373
3500
  color: var(--shade-400);
3374
3501
 
3375
3502
  .--icons {
@@ -3465,7 +3592,11 @@ function AnchorDialog({
3465
3592
  const dialog = useLayer("dialog");
3466
3593
  const editor = useSlateStatic4();
3467
3594
  const url = parseUrl2(element.href);
3468
- const style = useAbsoluteReposition(
3595
+ const [dragOffset, setDragOffset] = useState4({ x: 0, y: 0 });
3596
+ const handleDrag = useCallback5((deltaX, deltaY) => {
3597
+ setDragOffset((prev) => ({ x: prev.x + deltaX, y: prev.y + deltaY }));
3598
+ }, []);
3599
+ const baseStyle = useAbsoluteReposition(
3469
3600
  { destAnchor, destStartEdge },
3470
3601
  ({ destAnchor: destAnchor2, destStartEdge: destStartEdge2 }) => {
3471
3602
  return {
@@ -3474,16 +3605,25 @@ function AnchorDialog({
3474
3605
  };
3475
3606
  }
3476
3607
  );
3608
+ const style = {
3609
+ ...baseStyle,
3610
+ left: baseStyle.left + dragOffset.x,
3611
+ top: baseStyle.top + dragOffset.y
3612
+ };
3477
3613
  const removeTooltip = useTooltip({ title: "\u30EA\u30F3\u30AF\u3092\u524A\u9664" });
3478
3614
  const editTooltip = useTooltip({ title: "\u30EA\u30F3\u30AF\u3092\u7DE8\u96C6" });
3479
- const removeLink2 = useCallback4(() => {
3615
+ const closeTooltip = useTooltip({ title: "\u9589\u3058\u308B" });
3616
+ const closeDialog = useCallback5(() => {
3617
+ dialog.close();
3618
+ }, [dialog]);
3619
+ const removeLink2 = useCallback5(() => {
3480
3620
  editor.anchor.removeLink({ at: element });
3481
3621
  dialog.close();
3482
3622
  }, [editor, dialog]);
3483
- const openEditDialog = useCallback4(() => {
3623
+ const openEditDialog = useCallback5(() => {
3484
3624
  editTooltip.onMouseLeave();
3485
3625
  dialog.open(() => {
3486
- return /* @__PURE__ */ jsx13(
3626
+ return /* @__PURE__ */ jsx14(
3487
3627
  AnchorEditDialog,
3488
3628
  {
3489
3629
  destAnchor,
@@ -3494,57 +3634,70 @@ function AnchorDialog({
3494
3634
  });
3495
3635
  }, [destAnchor, destStartEdge, element]);
3496
3636
  return /* @__PURE__ */ jsxs6($AnchorDialog2, { contentEditable: false, style, children: [
3497
- /* @__PURE__ */ jsxs6(
3498
- "a",
3499
- {
3500
- className: "--link",
3501
- href: element.href,
3502
- target: "_blank",
3503
- rel: "noreferrer",
3504
- children: [
3505
- /* @__PURE__ */ jsx13(ExternalLinkIcon, {}),
3506
- /* @__PURE__ */ jsxs6("div", { className: "--url", children: [
3507
- /* @__PURE__ */ jsx13("div", { className: "--hostname", children: url.hostname }),
3508
- url.pathname === "" || url.pathname === "/" ? null : /* @__PURE__ */ jsx13("div", { className: "--pathname", children: url.pathname }),
3509
- element.title == null || element.title === "" ? null : /* @__PURE__ */ jsx13("div", { className: "--tooltip", children: element.title })
3510
- ] })
3511
- ]
3512
- }
3513
- ),
3514
- /* @__PURE__ */ jsxs6("span", { className: "--icons", children: [
3515
- /* @__PURE__ */ jsx13(
3516
- "span",
3637
+ /* @__PURE__ */ jsx14(DraggableHeader, { onDrag: handleDrag }),
3638
+ /* @__PURE__ */ jsxs6("div", { style: { display: "flex", padding: "1em" }, children: [
3639
+ /* @__PURE__ */ jsxs6(
3640
+ "a",
3517
3641
  {
3518
- className: "--icon",
3519
- onClick: removeLink2,
3520
- onMouseEnter: removeTooltip.onMouseEnter,
3521
- onMouseLeave: removeTooltip.onMouseLeave,
3522
- children: /* @__PURE__ */ jsx13(LinkOffIcon, {})
3642
+ className: "--link",
3643
+ href: element.href,
3644
+ target: "_blank",
3645
+ rel: "noreferrer",
3646
+ children: [
3647
+ /* @__PURE__ */ jsx14(ExternalLinkIcon, {}),
3648
+ /* @__PURE__ */ jsxs6("div", { className: "--url", children: [
3649
+ /* @__PURE__ */ jsx14("div", { className: "--hostname", children: url.hostname }),
3650
+ url.pathname === "" || url.pathname === "/" ? null : /* @__PURE__ */ jsx14("div", { className: "--pathname", children: url.pathname }),
3651
+ element.title == null || element.title === "" ? null : /* @__PURE__ */ jsx14("div", { className: "--tooltip", children: element.title })
3652
+ ] })
3653
+ ]
3523
3654
  }
3524
3655
  ),
3525
- /* @__PURE__ */ jsx13(
3526
- "span",
3527
- {
3528
- className: "--icon",
3529
- onMouseEnter: editTooltip.onMouseEnter,
3530
- onMouseLeave: editTooltip.onMouseLeave,
3531
- onClick: openEditDialog,
3532
- children: /* @__PURE__ */ jsx13(PencilIcon, {})
3533
- }
3534
- )
3656
+ /* @__PURE__ */ jsxs6("span", { className: "--icons", children: [
3657
+ /* @__PURE__ */ jsx14(
3658
+ "span",
3659
+ {
3660
+ className: "--icon",
3661
+ onClick: removeLink2,
3662
+ onMouseEnter: removeTooltip.onMouseEnter,
3663
+ onMouseLeave: removeTooltip.onMouseLeave,
3664
+ children: /* @__PURE__ */ jsx14(LinkOffIcon, {})
3665
+ }
3666
+ ),
3667
+ /* @__PURE__ */ jsx14(
3668
+ "span",
3669
+ {
3670
+ className: "--icon",
3671
+ onMouseEnter: editTooltip.onMouseEnter,
3672
+ onMouseLeave: editTooltip.onMouseLeave,
3673
+ onClick: openEditDialog,
3674
+ children: /* @__PURE__ */ jsx14(PencilIcon, {})
3675
+ }
3676
+ ),
3677
+ /* @__PURE__ */ jsx14(
3678
+ "span",
3679
+ {
3680
+ className: "--icon",
3681
+ onClick: closeDialog,
3682
+ onMouseEnter: closeTooltip.onMouseEnter,
3683
+ onMouseLeave: closeTooltip.onMouseLeave,
3684
+ children: /* @__PURE__ */ jsx14(CloseIcon, {})
3685
+ }
3686
+ )
3687
+ ] })
3535
3688
  ] })
3536
3689
  ] });
3537
3690
  }
3538
3691
 
3539
3692
  // src/anchor-plugin/render-element/anchor.tsx
3540
- import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
3693
+ import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
3541
3694
  function Anchor({
3542
3695
  element,
3543
3696
  attributes,
3544
3697
  children
3545
3698
  }) {
3546
- const startEdgeRef = useRef4(null);
3547
- const anchorRef = useRef4(null);
3699
+ const startEdgeRef = useRef5(null);
3700
+ const anchorRef = useRef5(null);
3548
3701
  const selected = useSelected();
3549
3702
  const editor = useSlate();
3550
3703
  const dialog = useLayer("dialog");
@@ -3556,7 +3709,7 @@ function Anchor({
3556
3709
  const hasSelection = editor.selection && editor.selection.anchor.offset !== editor.selection.focus.offset;
3557
3710
  if (selected && !hasSelection) {
3558
3711
  setTimeout(() => {
3559
- dialog.open(() => /* @__PURE__ */ jsx14(
3712
+ dialog.open(() => /* @__PURE__ */ jsx15(
3560
3713
  AnchorDialog,
3561
3714
  {
3562
3715
  destAnchor: anchor,
@@ -3578,16 +3731,16 @@ function Anchor({
3578
3731
  ...attributes,
3579
3732
  ref: anchorRef,
3580
3733
  children: [
3581
- /* @__PURE__ */ jsx14($Edge, { ref: startEdgeRef, contentEditable: false }),
3582
- /* @__PURE__ */ jsx14("span", { children }),
3583
- /* @__PURE__ */ jsx14($Edge, { contentEditable: false })
3734
+ /* @__PURE__ */ jsx15($Edge, { ref: startEdgeRef, contentEditable: false }),
3735
+ /* @__PURE__ */ jsx15("span", { children }),
3736
+ /* @__PURE__ */ jsx15($Edge, { contentEditable: false })
3584
3737
  ]
3585
3738
  }
3586
3739
  );
3587
3740
  }
3588
3741
 
3589
3742
  // src/anchor-plugin/index.tsx
3590
- import { jsx as jsx15 } from "react/jsx-runtime";
3743
+ import { jsx as jsx16 } from "react/jsx-runtime";
3591
3744
  var AnchorPlugin = createPlugin(
3592
3745
  (editor, _options, { createPolicy }) => {
3593
3746
  editor.anchor = createAnchorMethods(editor);
@@ -3604,7 +3757,7 @@ var AnchorPlugin = createPlugin(
3604
3757
  onPaste: curryOne(onPaste, editor),
3605
3758
  renderElement: ({ element, attributes, children }) => {
3606
3759
  if (element.type === "anchor") {
3607
- return /* @__PURE__ */ jsx15(Anchor, { element, attributes, children });
3760
+ return /* @__PURE__ */ jsx16(Anchor, { element, attributes, children });
3608
3761
  }
3609
3762
  }
3610
3763
  }
@@ -3680,8 +3833,7 @@ import { ReactEditor as ReactEditor9 } from "slate-react";
3680
3833
  // src/image-plugin/methods/index.ts
3681
3834
  import { Editor as Editor20, Transforms as Transforms12 } from "slate";
3682
3835
  import { ReactEditor as ReactEditor3 } from "slate-react";
3683
- function noop(editor) {
3684
- editor;
3836
+ function noop(_editor) {
3685
3837
  }
3686
3838
  function insertImageFromUrl(editor, url, alt, title) {
3687
3839
  const { selection } = editor;
@@ -3708,9 +3860,7 @@ function createImageMethods(editor) {
3708
3860
  }
3709
3861
 
3710
3862
  // src/image-plugin/normalize-node/index.ts
3711
- function normalizeNode2(editor, entry) {
3712
- editor;
3713
- entry;
3863
+ function normalizeNode2(_editor, _entry) {
3714
3864
  return false;
3715
3865
  }
3716
3866
 
@@ -3718,20 +3868,20 @@ function normalizeNode2(editor, entry) {
3718
3868
  import { useSlateStatic as useSlateStatic9 } from "slate-react";
3719
3869
 
3720
3870
  // src/image-plugin/styles/image-block-styles.tsx
3721
- import styled15 from "@emotion/styled";
3722
- var $ImageBlock = styled15("div")`
3871
+ import styled16 from "@emotion/styled";
3872
+ var $ImageBlock = styled16("div")`
3723
3873
  display: block;
3724
3874
  margin: 1em 0;
3725
3875
  `;
3726
3876
 
3727
3877
  // src/image-plugin/render-element/image-with-controls/index.tsx
3728
3878
  import { clsx as clsx4 } from "clsx";
3729
- import { useState as useState4 } from "react";
3879
+ import { useState as useState5 } from "react";
3730
3880
  import { useSelected as useSelected2 } from "slate-react";
3731
3881
 
3732
3882
  // src/image-plugin/styles/image-with-controls-styles/image-with-controls-styles.tsx
3733
- import styled16 from "@emotion/styled";
3734
- var $ImageContainer = styled16("span")`
3883
+ import styled17 from "@emotion/styled";
3884
+ var $ImageContainer = styled17("span")`
3735
3885
  /**
3736
3886
  * In order for this container to wrap tightly (without space), it needs to be
3737
3887
  * an "inline-block". If it's just an "inline" we end up with spacing
@@ -3744,7 +3894,7 @@ var $ImageContainer = styled16("span")`
3744
3894
  */
3745
3895
  position: relative;
3746
3896
  `;
3747
- var $Image = styled16("img")`
3897
+ var $Image = styled17("img")`
3748
3898
  /**
3749
3899
  * TODO:
3750
3900
  *
@@ -3810,7 +3960,7 @@ var $Image = styled16("img")`
3810
3960
 
3811
3961
  // src/image-plugin/render-element/image-with-controls/image-resize-controls/image-resize-control.tsx
3812
3962
  import { clsx as clsx2 } from "clsx";
3813
- import { useCallback as useCallback5 } from "react";
3963
+ import { useCallback as useCallback6 } from "react";
3814
3964
  import { Transforms as Transforms13 } from "slate";
3815
3965
  import { ReactEditor as ReactEditor5, useSlateStatic as useSlateStatic5 } from "slate-react";
3816
3966
 
@@ -3829,8 +3979,8 @@ function useResizeBrowser() {
3829
3979
  }
3830
3980
 
3831
3981
  // src/image-plugin/styles/image-with-controls-styles/image-resize-handle-styles.tsx
3832
- import styled17 from "@emotion/styled";
3833
- var $ImageResizeInvisibleHandle = styled17("span")`
3982
+ import styled18 from "@emotion/styled";
3983
+ var $ImageResizeInvisibleHandle = styled18("span")`
3834
3984
  position: absolute;
3835
3985
  display: block;
3836
3986
  /**
@@ -3858,7 +4008,7 @@ var $ImageResizeInvisibleHandle = styled17("span")`
3858
4008
  width: 1.25em;
3859
4009
  }
3860
4010
  `;
3861
- var $ImageResizeHandle = styled17("span")`
4011
+ var $ImageResizeHandle = styled18("span")`
3862
4012
  position: absolute;
3863
4013
  display: block;
3864
4014
  background: var(--select-color);
@@ -4009,7 +4159,7 @@ function getEditorWidth(editor) {
4009
4159
  }
4010
4160
 
4011
4161
  // src/image-plugin/render-element/image-with-controls/image-resize-controls/image-resize-control.tsx
4012
- import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
4162
+ import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
4013
4163
  function getImageBoundsFromSlateElement(editor, element) {
4014
4164
  const imageContainerDOMNode = ReactEditor5.toDOMNode(editor, element);
4015
4165
  const imgDOMNode = imageContainerDOMNode.querySelector("img");
@@ -4031,7 +4181,7 @@ function ImageResizeControl({
4031
4181
  const width = size.width;
4032
4182
  const maxWidth = Math.min(srcSize.width, editorWidth);
4033
4183
  const minWidth = Math.min(12, srcSize.width);
4034
- const onMouseDown = useCallback5(
4184
+ const onMouseDown = useCallback6(
4035
4185
  (e) => {
4036
4186
  stopEvent(e);
4037
4187
  setIsDragging(true);
@@ -4065,7 +4215,7 @@ function ImageResizeControl({
4065
4215
  },
4066
4216
  [srcSize.width, srcSize.height, size.width, element]
4067
4217
  );
4068
- const onTouchStart = useCallback5(
4218
+ const onTouchStart = useCallback6(
4069
4219
  (e) => {
4070
4220
  stopEvent(e);
4071
4221
  setIsDragging(true);
@@ -4105,24 +4255,24 @@ function ImageResizeControl({
4105
4255
  "--dragging": isDragging,
4106
4256
  "--small": width <= 64 || size.height <= 64
4107
4257
  });
4108
- return /* @__PURE__ */ jsx16(Fragment3, { children: /* @__PURE__ */ jsx16(
4258
+ return /* @__PURE__ */ jsx17(Fragment3, { children: /* @__PURE__ */ jsx17(
4109
4259
  $ImageResizeInvisibleHandle,
4110
4260
  {
4111
4261
  className,
4112
4262
  onMouseDown,
4113
4263
  onTouchStart,
4114
4264
  children: /* @__PURE__ */ jsxs8($ImageResizeHandle, { children: [
4115
- /* @__PURE__ */ jsx16("span", { className: "--bar --bar-left" }),
4116
- /* @__PURE__ */ jsx16("span", { className: "--bar --bar-center" }),
4117
- /* @__PURE__ */ jsx16("span", { className: "--bar --bar-right" })
4265
+ /* @__PURE__ */ jsx17("span", { className: "--bar --bar-left" }),
4266
+ /* @__PURE__ */ jsx17("span", { className: "--bar --bar-center" }),
4267
+ /* @__PURE__ */ jsx17("span", { className: "--bar --bar-right" })
4118
4268
  ] })
4119
4269
  }
4120
4270
  ) });
4121
4271
  }
4122
4272
 
4123
4273
  // src/image-plugin/styles/image-with-controls-styles/image-size-status-styles.tsx
4124
- import styled18 from "@emotion/styled";
4125
- var $ImageSizeStatus = styled18("span")`
4274
+ import styled19 from "@emotion/styled";
4275
+ var $ImageSizeStatus = styled19("span")`
4126
4276
  position: absolute;
4127
4277
  /**
4128
4278
  * The status appears with a 1px gap from the outline.
@@ -4157,8 +4307,8 @@ function ImageSizeStatus({ size }) {
4157
4307
  }
4158
4308
 
4159
4309
  // src/image-plugin/styles/image-with-controls-styles/image-toolbar-styles.tsx
4160
- import styled19 from "@emotion/styled";
4161
- var $ImageToolbar = styled19("span")`
4310
+ import styled20 from "@emotion/styled";
4311
+ var $ImageToolbar = styled20("span")`
4162
4312
  position: absolute;
4163
4313
  /**
4164
4314
  * On top of the image +1 for space inside outline, +2 for outline,
@@ -4192,8 +4342,8 @@ var $ImageToolbar = styled19("span")`
4192
4342
  `;
4193
4343
 
4194
4344
  // src/image-plugin/styles/image-with-controls-styles/image-buttons-styles.tsx
4195
- import styled20 from "@emotion/styled";
4196
- var $ImageButtonGroup = styled20("span")`
4345
+ import styled21 from "@emotion/styled";
4346
+ var $ImageButtonGroup = styled21("span")`
4197
4347
  /* font-size: 0.75em; */
4198
4348
  border-radius: 0.5em;
4199
4349
  display: flex;
@@ -4207,7 +4357,7 @@ var $ImageButtonGroup = styled20("span")`
4207
4357
  */
4208
4358
  outline: 1px solid white;
4209
4359
  `;
4210
- var $ImageButton = styled20("span")`
4360
+ var $ImageButton = styled21("span")`
4211
4361
  font-size: 0.75em;
4212
4362
  line-height: 2em;
4213
4363
  padding: 0 0.625em;
@@ -4265,10 +4415,10 @@ var $ImageButton = styled20("span")`
4265
4415
 
4266
4416
  // src/image-plugin/render-element/image-with-controls/image-toolbar/image-preset-buttons/image-preset-button.tsx
4267
4417
  import { clsx as clsx3 } from "clsx";
4268
- import { useCallback as useCallback6 } from "react";
4418
+ import { useCallback as useCallback7 } from "react";
4269
4419
  import { Transforms as Transforms14 } from "slate";
4270
4420
  import { ReactEditor as ReactEditor6, useSlateStatic as useSlateStatic6 } from "slate-react";
4271
- import { jsx as jsx17 } from "react/jsx-runtime";
4421
+ import { jsx as jsx18 } from "react/jsx-runtime";
4272
4422
  function ImagePresetButton({
4273
4423
  element,
4274
4424
  preset,
@@ -4282,7 +4432,7 @@ function ImagePresetButton({
4282
4432
  title: preset.title,
4283
4433
  hotkey: `${presetSize.width}x${presetSize.height}`
4284
4434
  });
4285
- const onClick = useCallback6(() => {
4435
+ const onClick = useCallback7(() => {
4286
4436
  const path = ReactEditor6.findPath(editor, element);
4287
4437
  const nextSize = resizeInPreset(size, srcSize, preset);
4288
4438
  setSize(nextSize);
@@ -4295,7 +4445,7 @@ function ImagePresetButton({
4295
4445
  "--disabled": isDisabled,
4296
4446
  "--selected": !isDisabled && isSelected
4297
4447
  });
4298
- return /* @__PURE__ */ jsx17(
4448
+ return /* @__PURE__ */ jsx18(
4299
4449
  $ImageButton,
4300
4450
  {
4301
4451
  className,
@@ -4308,7 +4458,7 @@ function ImagePresetButton({
4308
4458
  }
4309
4459
 
4310
4460
  // src/image-plugin/render-element/image-with-controls/image-toolbar/image-preset-buttons/image-preset-button-group.tsx
4311
- import { jsx as jsx18 } from "react/jsx-runtime";
4461
+ import { jsx as jsx19 } from "react/jsx-runtime";
4312
4462
  function ImagePresetButtonGroup({
4313
4463
  element,
4314
4464
  size,
@@ -4316,8 +4466,8 @@ function ImagePresetButtonGroup({
4316
4466
  srcSize,
4317
4467
  presets
4318
4468
  }) {
4319
- return /* @__PURE__ */ jsx18($ImageButtonGroup, { children: presets.map((preset, i) => {
4320
- return /* @__PURE__ */ jsx18(
4469
+ return /* @__PURE__ */ jsx19($ImageButtonGroup, { children: presets.map((preset, i) => {
4470
+ return /* @__PURE__ */ jsx19(
4321
4471
  ImagePresetButton,
4322
4472
  {
4323
4473
  element,
@@ -4332,18 +4482,18 @@ function ImagePresetButtonGroup({
4332
4482
  }
4333
4483
 
4334
4484
  // src/image-plugin/render-element/image-with-controls/image-toolbar/image-type-buttons/block-image-type-button.tsx
4335
- import { useCallback as useCallback7 } from "react";
4485
+ import { useCallback as useCallback8 } from "react";
4336
4486
  import { useSlateStatic as useSlateStatic7 } from "slate-react";
4337
4487
 
4338
4488
  // src/image-plugin/render-element/icons.tsx
4339
- import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
4489
+ import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
4340
4490
  var BlockIcon = (props) => /* @__PURE__ */ jsxs10(TablerIcon, { ...props, children: [
4341
- /* @__PURE__ */ jsx19("rect", { width: 6, height: 6, x: 4, y: 5, rx: 1 }),
4342
- /* @__PURE__ */ jsx19("path", { d: "M4 15h16M4 19h16" })
4491
+ /* @__PURE__ */ jsx20("rect", { width: 6, height: 6, x: 4, y: 5, rx: 1 }),
4492
+ /* @__PURE__ */ jsx20("path", { d: "M4 15h16M4 19h16" })
4343
4493
  ] });
4344
4494
  var InlineIcon = (props) => /* @__PURE__ */ jsxs10(TablerIcon, { ...props, children: [
4345
- /* @__PURE__ */ jsx19("rect", { width: 6, height: 6, x: 9, y: 5, rx: 1 }),
4346
- /* @__PURE__ */ jsx19("path", { d: "M4 7h1M4 11h1M19 7h1M19 11h1M4 15h16M4 19h16" })
4495
+ /* @__PURE__ */ jsx20("rect", { width: 6, height: 6, x: 9, y: 5, rx: 1 }),
4496
+ /* @__PURE__ */ jsx20("path", { d: "M4 7h1M4 11h1M19 7h1M19 11h1M4 15h16M4 19h16" })
4347
4497
  ] });
4348
4498
 
4349
4499
  // src/image-plugin/render-element/image-with-controls/image-toolbar/image-type-buttons/convert-to-inline-image.tsx
@@ -4377,7 +4527,7 @@ function convertToInlineImage(editor, element) {
4377
4527
  }
4378
4528
 
4379
4529
  // src/image-plugin/render-element/image-with-controls/image-toolbar/image-type-buttons/block-image-type-button.tsx
4380
- import { jsx as jsx20 } from "react/jsx-runtime";
4530
+ import { jsx as jsx21 } from "react/jsx-runtime";
4381
4531
  function BlockImageTypeButton({
4382
4532
  element
4383
4533
  }) {
@@ -4386,25 +4536,25 @@ function BlockImageTypeButton({
4386
4536
  title: "Inline Image",
4387
4537
  hotkey: "In a line with text"
4388
4538
  });
4389
- const onClickInline = useCallback7(() => {
4539
+ const onClickInline = useCallback8(() => {
4390
4540
  if (element.type !== "image-block")
4391
4541
  return;
4392
4542
  convertToInlineImage(editor, element);
4393
4543
  }, [editor, element]);
4394
- return /* @__PURE__ */ jsx20(
4544
+ return /* @__PURE__ */ jsx21(
4395
4545
  $ImageButton,
4396
4546
  {
4397
4547
  className: element.type === "image-inline" ? "--selected" : "",
4398
4548
  onClick: element.type === "image-inline" ? void 0 : onClickInline,
4399
4549
  onMouseEnter: tooltip.onMouseEnter,
4400
4550
  onMouseLeave: tooltip.onMouseLeave,
4401
- children: /* @__PURE__ */ jsx20(InlineIcon, {})
4551
+ children: /* @__PURE__ */ jsx21(InlineIcon, {})
4402
4552
  }
4403
4553
  );
4404
4554
  }
4405
4555
 
4406
4556
  // src/image-plugin/render-element/image-with-controls/image-toolbar/image-type-buttons/inline-image-type-button.tsx
4407
- import { useCallback as useCallback8 } from "react";
4557
+ import { useCallback as useCallback9 } from "react";
4408
4558
  import { useSlateStatic as useSlateStatic8 } from "slate-react";
4409
4559
 
4410
4560
  // src/image-plugin/render-element/image-with-controls/image-toolbar/image-type-buttons/convert-to-block-image.tsx
@@ -4457,7 +4607,7 @@ function convertToBlockImage(editor, element) {
4457
4607
  }
4458
4608
 
4459
4609
  // src/image-plugin/render-element/image-with-controls/image-toolbar/image-type-buttons/inline-image-type-button.tsx
4460
- import { jsx as jsx21 } from "react/jsx-runtime";
4610
+ import { jsx as jsx22 } from "react/jsx-runtime";
4461
4611
  function InlineImageTypeButton({
4462
4612
  element
4463
4613
  }) {
@@ -4466,36 +4616,36 @@ function InlineImageTypeButton({
4466
4616
  title: "Block Image",
4467
4617
  hotkey: "On a line by itself"
4468
4618
  });
4469
- const onClickBlock = useCallback8(() => {
4619
+ const onClickBlock = useCallback9(() => {
4470
4620
  if (element.type !== "image-inline")
4471
4621
  return;
4472
4622
  convertToBlockImage(editor, element);
4473
4623
  }, [editor, element]);
4474
- return /* @__PURE__ */ jsx21(
4624
+ return /* @__PURE__ */ jsx22(
4475
4625
  $ImageButton,
4476
4626
  {
4477
4627
  className: element.type === "image-block" ? "--selected" : "",
4478
4628
  onClick: element.type === "image-block" ? void 0 : onClickBlock,
4479
4629
  onMouseEnter: tooltip.onMouseEnter,
4480
4630
  onMouseLeave: tooltip.onMouseLeave,
4481
- children: /* @__PURE__ */ jsx21(BlockIcon, {})
4631
+ children: /* @__PURE__ */ jsx22(BlockIcon, {})
4482
4632
  }
4483
4633
  );
4484
4634
  }
4485
4635
 
4486
4636
  // src/image-plugin/render-element/image-with-controls/image-toolbar/image-type-buttons/image-type-button-group.tsx
4487
- import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
4637
+ import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
4488
4638
  function ImageTypeButtonGroup({
4489
4639
  element
4490
4640
  }) {
4491
4641
  return /* @__PURE__ */ jsxs11($ImageButtonGroup, { children: [
4492
- /* @__PURE__ */ jsx22(InlineImageTypeButton, { element }),
4493
- /* @__PURE__ */ jsx22(BlockImageTypeButton, { element })
4642
+ /* @__PURE__ */ jsx23(InlineImageTypeButton, { element }),
4643
+ /* @__PURE__ */ jsx23(BlockImageTypeButton, { element })
4494
4644
  ] });
4495
4645
  }
4496
4646
 
4497
4647
  // src/image-plugin/render-element/image-with-controls/image-toolbar/image-toolbar.tsx
4498
- import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
4648
+ import { jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
4499
4649
  function ImageToolbar({
4500
4650
  element,
4501
4651
  size,
@@ -4504,8 +4654,8 @@ function ImageToolbar({
4504
4654
  presets
4505
4655
  }) {
4506
4656
  return /* @__PURE__ */ jsxs12($ImageToolbar, { children: [
4507
- /* @__PURE__ */ jsx23(ImageTypeButtonGroup, { element }),
4508
- /* @__PURE__ */ jsx23(
4657
+ /* @__PURE__ */ jsx24(ImageTypeButtonGroup, { element }),
4658
+ /* @__PURE__ */ jsx24(
4509
4659
  ImagePresetButtonGroup,
4510
4660
  {
4511
4661
  element,
@@ -4519,15 +4669,15 @@ function ImageToolbar({
4519
4669
  }
4520
4670
 
4521
4671
  // src/image-plugin/render-element/image-with-controls/index.tsx
4522
- import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
4672
+ import { jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
4523
4673
  function ImageWithControls({
4524
4674
  element,
4525
4675
  presets
4526
4676
  }) {
4527
4677
  const url = element.url;
4528
4678
  const selected = useSelected2();
4529
- const [isDragging, setIsDragging] = useState4(false);
4530
- const [size, setSize] = useState4(
4679
+ const [isDragging, setIsDragging] = useState5(false);
4680
+ const [size, setSize] = useState5(
4531
4681
  element.srcWidth && element.srcHeight && element.width && element.height ? { width: element.width, height: element.height } : null
4532
4682
  );
4533
4683
  const srcSize = element.srcWidth && element.srcHeight ? { width: element.srcWidth, height: element.srcHeight } : null;
@@ -4538,8 +4688,8 @@ function ImageWithControls({
4538
4688
  "--small": size && (size.width <= 64 || size.height <= 64)
4539
4689
  });
4540
4690
  return /* @__PURE__ */ jsxs13($ImageContainer, { className, children: [
4541
- /* @__PURE__ */ jsx24($Image, { src: url, width: size?.width, height: size?.height }),
4542
- showControls ? /* @__PURE__ */ jsx24(
4691
+ /* @__PURE__ */ jsx25($Image, { src: url, width: size?.width, height: size?.height }),
4692
+ showControls ? /* @__PURE__ */ jsx25(
4543
4693
  ImageToolbar,
4544
4694
  {
4545
4695
  element,
@@ -4549,8 +4699,8 @@ function ImageWithControls({
4549
4699
  presets
4550
4700
  }
4551
4701
  ) : null,
4552
- isDragging && size ? /* @__PURE__ */ jsx24(ImageSizeStatus, { size }) : null,
4553
- showControls ? /* @__PURE__ */ jsx24(
4702
+ isDragging && size ? /* @__PURE__ */ jsx25(ImageSizeStatus, { size }) : null,
4703
+ showControls ? /* @__PURE__ */ jsx25(
4554
4704
  ImageResizeControl,
4555
4705
  {
4556
4706
  element,
@@ -4565,7 +4715,7 @@ function ImageWithControls({
4565
4715
  }
4566
4716
 
4567
4717
  // src/image-plugin/render-element/image-block.tsx
4568
- import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
4718
+ import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
4569
4719
  function ImageBlock({
4570
4720
  element,
4571
4721
  attributes,
@@ -4573,7 +4723,7 @@ function ImageBlock({
4573
4723
  }) {
4574
4724
  const editor = useSlateStatic9();
4575
4725
  return /* @__PURE__ */ jsxs14("div", { ...attributes, children: [
4576
- /* @__PURE__ */ jsx25($ImageBlock, { contentEditable: false, children: /* @__PURE__ */ jsx25(
4726
+ /* @__PURE__ */ jsx26($ImageBlock, { contentEditable: false, children: /* @__PURE__ */ jsx26(
4577
4727
  ImageWithControls,
4578
4728
  {
4579
4729
  element,
@@ -4588,13 +4738,13 @@ function ImageBlock({
4588
4738
  import { useSlateStatic as useSlateStatic10 } from "slate-react";
4589
4739
 
4590
4740
  // src/image-plugin/styles/image-inline-styles.tsx
4591
- import styled21 from "@emotion/styled";
4592
- var $ImageInline = styled21("span")`
4741
+ import styled22 from "@emotion/styled";
4742
+ var $ImageInline = styled22("span")`
4593
4743
  display: inline;
4594
4744
  `;
4595
4745
 
4596
4746
  // src/image-plugin/render-element/image-inline.tsx
4597
- import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
4747
+ import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
4598
4748
  function ImageInline({
4599
4749
  element,
4600
4750
  attributes,
@@ -4602,7 +4752,7 @@ function ImageInline({
4602
4752
  }) {
4603
4753
  const editor = useSlateStatic10();
4604
4754
  return /* @__PURE__ */ jsxs15("span", { ...attributes, style: { display: "inline-block" }, children: [
4605
- /* @__PURE__ */ jsx26($ImageInline, { contentEditable: false, children: /* @__PURE__ */ jsx26(
4755
+ /* @__PURE__ */ jsx27($ImageInline, { contentEditable: false, children: /* @__PURE__ */ jsx27(
4606
4756
  ImageWithControls,
4607
4757
  {
4608
4758
  element,
@@ -4614,7 +4764,7 @@ function ImageInline({
4614
4764
  }
4615
4765
 
4616
4766
  // src/image-plugin/render-element/index.tsx
4617
- import { jsx as jsx27 } from "react/jsx-runtime";
4767
+ import { jsx as jsx28 } from "react/jsx-runtime";
4618
4768
  function renderElement({
4619
4769
  element,
4620
4770
  attributes,
@@ -4622,9 +4772,9 @@ function renderElement({
4622
4772
  }) {
4623
4773
  switch (element.type) {
4624
4774
  case "image-block":
4625
- return /* @__PURE__ */ jsx27(ImageBlock, { element, attributes, children });
4775
+ return /* @__PURE__ */ jsx28(ImageBlock, { element, attributes, children });
4626
4776
  case "image-inline":
4627
- return /* @__PURE__ */ jsx27(ImageInline, { element, attributes, children });
4777
+ return /* @__PURE__ */ jsx28(ImageInline, { element, attributes, children });
4628
4778
  }
4629
4779
  }
4630
4780
 
@@ -4762,8 +4912,8 @@ var ImagePlugin = (
4762
4912
  import { Editor as Editor25, Element as Element11, Transforms as Transforms18 } from "slate";
4763
4913
 
4764
4914
  // src/block-quote-plugin/styles.tsx
4765
- import styled22 from "@emotion/styled";
4766
- var $BlockQuote = styled22("blockquote")`
4915
+ import styled23 from "@emotion/styled";
4916
+ var $BlockQuote = styled23("blockquote")`
4767
4917
  position: relative;
4768
4918
  margin-top: 1em;
4769
4919
  margin-bottom: 1em;
@@ -4773,7 +4923,7 @@ var $BlockQuote = styled22("blockquote")`
4773
4923
  `;
4774
4924
 
4775
4925
  // src/block-quote-plugin/index.tsx
4776
- import { jsx as jsx28 } from "react/jsx-runtime";
4926
+ import { jsx as jsx29 } from "react/jsx-runtime";
4777
4927
  function matchBlockQuoteSafe(node) {
4778
4928
  return Element11.isElement(node) && /**
4779
4929
  * TODO:
@@ -4886,7 +5036,7 @@ var BlockQuotePlugin = createPlugin(
4886
5036
  editableProps: {
4887
5037
  renderElement: ({ element, attributes, children }) => {
4888
5038
  if (element.type === "block-quote") {
4889
- return /* @__PURE__ */ jsx28($BlockQuote, { ...attributes, children });
5039
+ return /* @__PURE__ */ jsx29($BlockQuote, { ...attributes, children });
4890
5040
  }
4891
5041
  },
4892
5042
  onKeyDown: createHotkeyHandler({
@@ -5034,6 +5184,17 @@ var tokenStyles = {
5034
5184
  italic: italicStyle
5035
5185
  };
5036
5186
 
5187
+ // src/code-block-plugin/types.tsx
5188
+ var LanguageList = [
5189
+ "text",
5190
+ "html",
5191
+ "css",
5192
+ "svg",
5193
+ "javascript",
5194
+ "java",
5195
+ "c"
5196
+ ];
5197
+
5037
5198
  // src/code-block-plugin/normalizeNode.tsx
5038
5199
  import { Element as Element14, Node as Node9, Transforms as Transforms20 } from "slate";
5039
5200
  function normalizeNode3(editor, entry) {
@@ -5078,12 +5239,16 @@ function normalizeNode3(editor, entry) {
5078
5239
  }
5079
5240
 
5080
5241
  // src/code-block-plugin/render-element/CodeBlock.tsx
5081
- import { useCallback as useCallback9, useState as useState5 } from "react";
5082
- import { useSelected as useSelected3, useSlateStatic as useSlateStatic11 } from "slate-react";
5242
+ import { useCallback as useCallback10, useRef as useRef6 } from "react";
5243
+ import { useSelected as useSelected3 } from "slate-react";
5244
+
5245
+ // src/code-block-plugin/icons/ChevronDownIcon.tsx
5246
+ import { jsx as jsx30 } from "react/jsx-runtime";
5247
+ var ChevronDownIcon = (props) => /* @__PURE__ */ jsx30(TablerIcon, { ...props, children: /* @__PURE__ */ jsx30("path", { d: "m6 9 6 6 6-6" }) });
5083
5248
 
5084
5249
  // src/code-block-plugin/styles.ts
5085
- import styled23 from "@emotion/styled";
5086
- var $CodeBlock = styled23("div")`
5250
+ import styled24 from "@emotion/styled";
5251
+ var $CodeBlock = styled24("div")`
5087
5252
  position: relative;
5088
5253
  background: var(--code-block-bgcolor);
5089
5254
  margin: 1em 0;
@@ -5103,12 +5268,12 @@ var $CodeBlock = styled23("div")`
5103
5268
  */
5104
5269
  overflow-x: hidden;
5105
5270
  `;
5106
- var $CodeBlockScroller = styled23("div")`
5271
+ var $CodeBlockScroller = styled24("div")`
5107
5272
  padding: 2.25em 1em 1.5em 1em;
5108
5273
  border-radius: 0.5em;
5109
5274
  overflow-x: auto;
5110
5275
  `;
5111
- var $CodeBlockLanguage = styled23("span")`
5276
+ var $CodeBlockLanguage = styled24("span")`
5112
5277
  cursor: pointer;
5113
5278
  position: absolute;
5114
5279
  top: 0.25em;
@@ -5135,7 +5300,7 @@ var $CodeBlockLanguage = styled23("span")`
5135
5300
  background: var(--shade-300);
5136
5301
  }
5137
5302
  `;
5138
- var $CodeBlockLine = styled23("div")`
5303
+ var $CodeBlockLine = styled24("div")`
5139
5304
  white-space: pre;
5140
5305
  line-height: 1.5em;
5141
5306
  counter-increment: line;
@@ -5161,70 +5326,50 @@ var $CodeBlockLine = styled23("div")`
5161
5326
  `;
5162
5327
 
5163
5328
  // src/code-block-plugin/render-element/CodeBlock.tsx
5164
- import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
5329
+ import { jsx as jsx31, jsxs as jsxs16 } from "react/jsx-runtime";
5165
5330
  function CodeBlock({
5166
5331
  element,
5167
5332
  attributes,
5168
5333
  children
5169
5334
  }) {
5170
- const editor = useSlateStatic11();
5335
+ const ref = useRef6(null);
5171
5336
  const selected = useSelected3();
5172
- const [isEditing, setIsEditing] = useState5(false);
5173
- const [inputValue, setInputValue] = useState5(element.language);
5174
- const handleClick = useCallback9(() => {
5175
- setInputValue(element.language);
5176
- setIsEditing(true);
5177
- }, [element.language]);
5178
- const handleBlur = useCallback9(() => {
5179
- setIsEditing(false);
5180
- if (inputValue !== element.language) {
5181
- editor.codeBlock.setCodeBlockLanguage(inputValue || "text", { at: element });
5182
- }
5183
- }, [editor, element, inputValue]);
5184
- const handleKeyDown = useCallback9((e) => {
5185
- if (e.key === "Enter") {
5186
- e.preventDefault();
5187
- e.target.blur();
5188
- } else if (e.key === "Escape") {
5189
- setInputValue(element.language);
5190
- setIsEditing(false);
5191
- }
5192
- }, [element.language]);
5193
- return /* @__PURE__ */ jsxs16($CodeBlock, { className: selected ? "--selected" : "", ...attributes, children: [
5194
- /* @__PURE__ */ jsx29($CodeBlockLanguage, { contentEditable: false, children: isEditing ? /* @__PURE__ */ jsx29(
5195
- "input",
5196
- {
5197
- type: "text",
5198
- value: inputValue,
5199
- onChange: (e) => setInputValue(e.target.value),
5200
- onBlur: handleBlur,
5201
- onKeyDown: handleKeyDown,
5202
- autoFocus: true,
5203
- style: {
5204
- width: "100%",
5205
- border: "none",
5206
- background: "transparent",
5207
- font: "inherit",
5208
- color: "inherit",
5209
- padding: 0,
5210
- outline: "none",
5211
- textAlign: "right"
5337
+ const dropdown = useLayer("code-block-dropdown");
5338
+ const onClick = useCallback10(() => {
5339
+ if (dropdown.layer)
5340
+ dropdown.close();
5341
+ const dest = ref.current;
5342
+ if (dest === null)
5343
+ return;
5344
+ const items = LanguageList.map((language) => {
5345
+ return {
5346
+ icon: () => /* @__PURE__ */ jsx31("span", {}),
5347
+ title: language,
5348
+ action: (editor) => {
5349
+ editor.codeBlock.setCodeBlockLanguage(language, { at: element });
5212
5350
  }
5213
- }
5214
- ) : /* @__PURE__ */ jsx29("span", { onClick: handleClick, style: { cursor: "pointer", width: "100%" }, children: element.language || "text" }) }),
5215
- /* @__PURE__ */ jsx29($CodeBlockScroller, { children })
5351
+ };
5352
+ });
5353
+ dropdown.open(() => /* @__PURE__ */ jsx31(Menu, { dest, items, close: dropdown.close }));
5354
+ }, [element]);
5355
+ return /* @__PURE__ */ jsxs16($CodeBlock, { className: selected ? "--selected" : "", ...attributes, children: [
5356
+ /* @__PURE__ */ jsxs16($CodeBlockLanguage, { contentEditable: false, onClick, ref, children: [
5357
+ /* @__PURE__ */ jsx31("span", { children: element.language }),
5358
+ /* @__PURE__ */ jsx31(ChevronDownIcon, {})
5359
+ ] }),
5360
+ /* @__PURE__ */ jsx31($CodeBlockScroller, { children })
5216
5361
  ] });
5217
5362
  }
5218
5363
 
5219
5364
  // src/code-block-plugin/render-element/CodeBlockLine.tsx
5220
5365
  import { useSelected as useSelected4 } from "slate-react";
5221
- import { jsx as jsx30 } from "react/jsx-runtime";
5366
+ import { jsx as jsx32 } from "react/jsx-runtime";
5222
5367
  function CodeBlockLine({
5223
5368
  attributes,
5224
5369
  children
5225
5370
  }) {
5226
5371
  const selected = useSelected4();
5227
- return /* @__PURE__ */ jsx30(
5372
+ return /* @__PURE__ */ jsx32(
5228
5373
  $CodeBlockLine,
5229
5374
  {
5230
5375
  className: selected ? "--selected" : "",
@@ -5236,21 +5381,21 @@ function CodeBlockLine({
5236
5381
  }
5237
5382
 
5238
5383
  // src/code-block-plugin/render-element/index.tsx
5239
- import { jsx as jsx31 } from "react/jsx-runtime";
5384
+ import { jsx as jsx33 } from "react/jsx-runtime";
5240
5385
  function renderElement2({
5241
5386
  element,
5242
5387
  attributes,
5243
5388
  children
5244
5389
  }) {
5245
5390
  if (element.type === "code-block") {
5246
- return /* @__PURE__ */ jsx31(CodeBlock, { element, attributes, children });
5391
+ return /* @__PURE__ */ jsx33(CodeBlock, { element, attributes, children });
5247
5392
  } else if (element.type === "code-block-line") {
5248
- return /* @__PURE__ */ jsx31(CodeBlockLine, { element, attributes, children });
5393
+ return /* @__PURE__ */ jsx33(CodeBlockLine, { element, attributes, children });
5249
5394
  }
5250
5395
  }
5251
5396
 
5252
5397
  // src/code-block-plugin/index.tsx
5253
- import { jsx as jsx32 } from "react/jsx-runtime";
5398
+ import { jsx as jsx34 } from "react/jsx-runtime";
5254
5399
  var CodeBlockPlugin = createPlugin(
5255
5400
  (editor, _options, { createPolicy }) => {
5256
5401
  editor.codeBlock = createCodeBlockMethods(editor);
@@ -5308,7 +5453,7 @@ var CodeBlockPlugin = createPlugin(
5308
5453
  if (style === null) {
5309
5454
  return children;
5310
5455
  } else {
5311
- return /* @__PURE__ */ jsx32("span", { style, children });
5456
+ return /* @__PURE__ */ jsx34("span", { style, children });
5312
5457
  }
5313
5458
  }
5314
5459
  }
@@ -5320,8 +5465,8 @@ var CodeBlockPlugin = createPlugin(
5320
5465
  import { Transforms as Transforms22 } from "slate";
5321
5466
 
5322
5467
  // src/html-block-plugin/styles.ts
5323
- import styled24 from "@emotion/styled";
5324
- var $HtmlBlock = styled24("div")`
5468
+ import styled25 from "@emotion/styled";
5469
+ var $HtmlBlock = styled25("div")`
5325
5470
  position: relative;
5326
5471
  background-color: var(--shade-100);
5327
5472
  border: 1px solid var(--shade-300);
@@ -5340,7 +5485,7 @@ var $HtmlBlock = styled24("div")`
5340
5485
  outline: 2px solid var(--select-color);
5341
5486
  }
5342
5487
  `;
5343
- var $HtmlBlockLabel = styled24("span")`
5488
+ var $HtmlBlockLabel = styled25("span")`
5344
5489
  position: absolute;
5345
5490
  top: 0.25em;
5346
5491
  right: 0.5em;
@@ -5351,21 +5496,21 @@ var $HtmlBlockLabel = styled24("span")`
5351
5496
  `;
5352
5497
 
5353
5498
  // src/html-block-plugin/render-element.tsx
5354
- import { jsx as jsx33, jsxs as jsxs17 } from "react/jsx-runtime";
5499
+ import { jsx as jsx35, jsxs as jsxs17 } from "react/jsx-runtime";
5355
5500
  function HtmlBlock({
5356
5501
  attributes,
5357
5502
  children,
5358
5503
  element
5359
5504
  }) {
5360
5505
  return /* @__PURE__ */ jsxs17($HtmlBlock, { ...attributes, contentEditable: false, children: [
5361
- /* @__PURE__ */ jsx33($HtmlBlockLabel, { children: "HTML" }),
5362
- /* @__PURE__ */ jsx33("div", { children: unescapeUrlSlashes(element.html) }),
5506
+ /* @__PURE__ */ jsx35($HtmlBlockLabel, { children: "HTML" }),
5507
+ /* @__PURE__ */ jsx35("div", { children: unescapeUrlSlashes(element.html) }),
5363
5508
  children
5364
5509
  ] });
5365
5510
  }
5366
5511
 
5367
5512
  // src/html-block-plugin/index.tsx
5368
- import { jsx as jsx34 } from "react/jsx-runtime";
5513
+ import { jsx as jsx36 } from "react/jsx-runtime";
5369
5514
  var HtmlBlockPlugin = createPlugin(
5370
5515
  (editor, _options, { createPolicy }) => {
5371
5516
  function onDelete() {
@@ -5399,7 +5544,7 @@ var HtmlBlockPlugin = createPlugin(
5399
5544
  editableProps: {
5400
5545
  renderElement: ({ element, attributes, children }) => {
5401
5546
  if (element.type === "html-block") {
5402
- return /* @__PURE__ */ jsx34(HtmlBlock, { element, attributes, children });
5547
+ return /* @__PURE__ */ jsx36(HtmlBlock, { element, attributes, children });
5403
5548
  }
5404
5549
  }
5405
5550
  }
@@ -5473,8 +5618,8 @@ import { clsx as clsx5 } from "clsx";
5473
5618
  import { useSelected as useSelected5 } from "slate-react";
5474
5619
 
5475
5620
  // src/collapsible-paragraph-plugin/render-element/styles.ts
5476
- import styled25 from "@emotion/styled";
5477
- var $Paragraph = styled25("p")`
5621
+ import styled26 from "@emotion/styled";
5622
+ var $Paragraph = styled26("p")`
5478
5623
  padding: 0;
5479
5624
  margin: 0;
5480
5625
  &:first-child {
@@ -5513,7 +5658,7 @@ function getIsEmpty(element) {
5513
5658
  }
5514
5659
 
5515
5660
  // src/collapsible-paragraph-plugin/render-element/paragraph.tsx
5516
- import { jsx as jsx35 } from "react/jsx-runtime";
5661
+ import { jsx as jsx37 } from "react/jsx-runtime";
5517
5662
  function Paragraph({
5518
5663
  element,
5519
5664
  attributes,
@@ -5521,7 +5666,7 @@ function Paragraph({
5521
5666
  }) {
5522
5667
  const selected = useSelected5();
5523
5668
  const isEmpty = getIsEmpty(element);
5524
- return /* @__PURE__ */ jsx35(
5669
+ return /* @__PURE__ */ jsx37(
5525
5670
  $Paragraph,
5526
5671
  {
5527
5672
  ...attributes,
@@ -5536,7 +5681,7 @@ function Paragraph({
5536
5681
  }
5537
5682
 
5538
5683
  // src/collapsible-paragraph-plugin/index.tsx
5539
- import { jsx as jsx36 } from "react/jsx-runtime";
5684
+ import { jsx as jsx38 } from "react/jsx-runtime";
5540
5685
  var CollapsibleParagraphPlugin = createPlugin((editor) => {
5541
5686
  const { insertBreak: insertBreak3 } = editor;
5542
5687
  editor.insertBreak = () => {
@@ -5583,7 +5728,7 @@ var CollapsibleParagraphPlugin = createPlugin((editor) => {
5583
5728
  renderElement: ({ element, attributes, children }) => {
5584
5729
  switch (element.type) {
5585
5730
  case "paragraph": {
5586
- return /* @__PURE__ */ jsx36(Paragraph, { element, attributes, children });
5731
+ return /* @__PURE__ */ jsx38(Paragraph, { element, attributes, children });
5587
5732
  }
5588
5733
  }
5589
5734
  },
@@ -5749,21 +5894,21 @@ function convertElements(editor, matchForToggle, targetElement, allowToggle) {
5749
5894
  const { selection } = editor;
5750
5895
  if (!selection)
5751
5896
  return false;
5897
+ let savedAnchorOffset = -1;
5898
+ let savedFocusOffset = -1;
5899
+ const isCollapsed2 = Range5.isCollapsed(selection);
5752
5900
  const entries = Array.from(
5753
5901
  Editor33.nodes(editor, {
5754
5902
  match: (node) => Element20.isElement(node) && editor.convertElement.isConvertibleElement(node)
5755
5903
  })
5756
5904
  );
5757
- if (entries.length === 0)
5758
- return false;
5759
- let savedAnchorOffset = -1;
5760
- let savedFocusOffset = -1;
5761
- let isCollapsed2 = Range5.isCollapsed(selection);
5762
5905
  if (entries.length > 0) {
5763
5906
  const [, firstPath] = entries[0];
5764
5907
  savedAnchorOffset = getOffsetInElement(editor, selection.anchor, firstPath);
5765
5908
  savedFocusOffset = getOffsetInElement(editor, selection.focus, firstPath);
5766
5909
  }
5910
+ if (entries.length === 0)
5911
+ return false;
5767
5912
  const allPaths = [];
5768
5913
  Editor33.withoutNormalizing(editor, () => {
5769
5914
  for (let i = entries.length - 1; i >= 0; i--) {
@@ -5934,7 +6079,7 @@ function createHeadingMethods(editor) {
5934
6079
 
5935
6080
  // src/heading-plugin/styles.ts
5936
6081
  import { css } from "@emotion/react";
5937
- import styled26 from "@emotion/styled";
6082
+ import styled27 from "@emotion/styled";
5938
6083
  var headingStyles = css`
5939
6084
  margin-top: 1em;
5940
6085
  &:first-child {
@@ -5942,34 +6087,34 @@ var headingStyles = css`
5942
6087
  }
5943
6088
  font-weight: bold;
5944
6089
  `;
5945
- var $H1 = styled26("h1")`
6090
+ var $H1 = styled27("h1")`
5946
6091
  ${headingStyles}
5947
6092
  font-size: 2.25em;
5948
6093
  letter-spacing: -0.01em;
5949
6094
  `;
5950
- var $H2 = styled26("h2")`
6095
+ var $H2 = styled27("h2")`
5951
6096
  ${headingStyles}
5952
6097
  font-size: 1.5em;
5953
6098
  `;
5954
- var $H3 = styled26("h3")`
6099
+ var $H3 = styled27("h3")`
5955
6100
  ${headingStyles}
5956
6101
  font-size: 1.25em;
5957
6102
  `;
5958
- var $H4 = styled26("h4")`
6103
+ var $H4 = styled27("h4")`
5959
6104
  ${headingStyles}
5960
6105
  font-size: 1em;
5961
6106
  `;
5962
- var $H5 = styled26("h5")`
6107
+ var $H5 = styled27("h5")`
5963
6108
  ${headingStyles}
5964
6109
  font-size: 1em;
5965
6110
  `;
5966
- var $H6 = styled26("h6")`
6111
+ var $H6 = styled27("h6")`
5967
6112
  ${headingStyles}
5968
6113
  font-size: 1em;
5969
6114
  `;
5970
6115
 
5971
6116
  // src/heading-plugin/index.tsx
5972
- import { jsx as jsx37 } from "react/jsx-runtime";
6117
+ import { jsx as jsx39 } from "react/jsx-runtime";
5973
6118
  var HeadingPlugin = createPlugin(
5974
6119
  (editor) => {
5975
6120
  editor.convertElement.addConvertElementType("heading");
@@ -6000,17 +6145,17 @@ var HeadingPlugin = createPlugin(
6000
6145
  if (element.type === "heading") {
6001
6146
  switch (element.level) {
6002
6147
  case 1:
6003
- return /* @__PURE__ */ jsx37($H1, { ...attributes, children });
6148
+ return /* @__PURE__ */ jsx39($H1, { ...attributes, children });
6004
6149
  case 2:
6005
- return /* @__PURE__ */ jsx37($H2, { ...attributes, children });
6150
+ return /* @__PURE__ */ jsx39($H2, { ...attributes, children });
6006
6151
  case 3:
6007
- return /* @__PURE__ */ jsx37($H3, { ...attributes, children });
6152
+ return /* @__PURE__ */ jsx39($H3, { ...attributes, children });
6008
6153
  case 4:
6009
- return /* @__PURE__ */ jsx37($H4, { ...attributes, children });
6154
+ return /* @__PURE__ */ jsx39($H4, { ...attributes, children });
6010
6155
  case 5:
6011
- return /* @__PURE__ */ jsx37($H5, { ...attributes, children });
6156
+ return /* @__PURE__ */ jsx39($H5, { ...attributes, children });
6012
6157
  case 6:
6013
- return /* @__PURE__ */ jsx37($H6, { ...attributes, children });
6158
+ return /* @__PURE__ */ jsx39($H6, { ...attributes, children });
6014
6159
  default: {
6015
6160
  const exhaustiveCheck = element.level;
6016
6161
  throw new Error(
@@ -6036,8 +6181,8 @@ var HeadingPlugin = createPlugin(
6036
6181
  import { useSelected as useSelected6 } from "slate-react";
6037
6182
 
6038
6183
  // src/horizontal-rule-plugin/styles.tsx
6039
- import styled27 from "@emotion/styled";
6040
- var $HorizontalRule = styled27("hr")`
6184
+ import styled28 from "@emotion/styled";
6185
+ var $HorizontalRule = styled28("hr")`
6041
6186
  position: relative;
6042
6187
  height: 1em;
6043
6188
  /* background-color: var(--hr-color); */
@@ -6070,7 +6215,7 @@ var $HorizontalRule = styled27("hr")`
6070
6215
  `;
6071
6216
 
6072
6217
  // src/horizontal-rule-plugin/horizontal-rule.tsx
6073
- import { jsx as jsx38, jsxs as jsxs18 } from "react/jsx-runtime";
6218
+ import { jsx as jsx40, jsxs as jsxs18 } from "react/jsx-runtime";
6074
6219
  function HorizontalRule({
6075
6220
  attributes,
6076
6221
  children
@@ -6078,7 +6223,7 @@ function HorizontalRule({
6078
6223
  const selected = useSelected6();
6079
6224
  return /* @__PURE__ */ jsxs18("div", { ...attributes, draggable: true, children: [
6080
6225
  children,
6081
- /* @__PURE__ */ jsx38("div", { contentEditable: false, children: /* @__PURE__ */ jsx38($HorizontalRule, { className: selected ? "--selected" : "" }) })
6226
+ /* @__PURE__ */ jsx40("div", { contentEditable: false, children: /* @__PURE__ */ jsx40($HorizontalRule, { className: selected ? "--selected" : "" }) })
6082
6227
  ] });
6083
6228
  }
6084
6229
 
@@ -6096,7 +6241,7 @@ function createHorizontalRuleMethods(editor) {
6096
6241
  }
6097
6242
 
6098
6243
  // src/horizontal-rule-plugin/index.tsx
6099
- import { jsx as jsx39 } from "react/jsx-runtime";
6244
+ import { jsx as jsx41 } from "react/jsx-runtime";
6100
6245
  var HorizontalRulePlugin = createPlugin(
6101
6246
  (editor, _options, { createPolicy }) => {
6102
6247
  editor.horizontalRule = createHorizontalRuleMethods(editor);
@@ -6111,7 +6256,7 @@ var HorizontalRulePlugin = createPlugin(
6111
6256
  editableProps: {
6112
6257
  renderElement: (props) => {
6113
6258
  if (props.element.type === "horizontal-rule") {
6114
- return /* @__PURE__ */ jsx39(HorizontalRule, { ...props });
6259
+ return /* @__PURE__ */ jsx41(HorizontalRule, { ...props });
6115
6260
  }
6116
6261
  },
6117
6262
  onKeyDown: createHotkeyHandler({
@@ -6123,8 +6268,8 @@ var HorizontalRulePlugin = createPlugin(
6123
6268
  );
6124
6269
 
6125
6270
  // src/inline-code-plugin/styles.ts
6126
- import styled28 from "@emotion/styled";
6127
- var $InlineCode = styled28("code")`
6271
+ import styled29 from "@emotion/styled";
6272
+ var $InlineCode = styled29("code")`
6128
6273
  color: var(--shade-600);
6129
6274
  background-color: var(--inline-code-bgcolor);
6130
6275
  border: 1px solid var(--inline-code-border-color);
@@ -6146,7 +6291,7 @@ var $InlineCode = styled28("code")`
6146
6291
  font-size: 0.75em;
6147
6292
  vertical-align: baseline;
6148
6293
  `;
6149
- var $InvisibleSpan = styled28("span")`
6294
+ var $InvisibleSpan = styled29("span")`
6150
6295
  display: inline-block;
6151
6296
  opacity: 0;
6152
6297
  width: 1px;
@@ -6154,7 +6299,7 @@ var $InvisibleSpan = styled28("span")`
6154
6299
  `;
6155
6300
 
6156
6301
  // src/inline-code-plugin/index.tsx
6157
- import { jsx as jsx40, jsxs as jsxs19 } from "react/jsx-runtime";
6302
+ import { jsx as jsx42, jsxs as jsxs19 } from "react/jsx-runtime";
6158
6303
  var InlineCodePlugin = createPlugin(
6159
6304
  (editor) => {
6160
6305
  if (!editor.marksPlugin)
@@ -6174,9 +6319,9 @@ var InlineCodePlugin = createPlugin(
6174
6319
  * Disable spellCheck because it's computer code usually.
6175
6320
  */
6176
6321
  /* @__PURE__ */ jsxs19($InlineCode, { spellCheck: false, children: [
6177
- /* @__PURE__ */ jsx40($InvisibleSpan, { contentEditable: false, children: "|" }),
6322
+ /* @__PURE__ */ jsx42($InvisibleSpan, { contentEditable: false, children: "|" }),
6178
6323
  children,
6179
- /* @__PURE__ */ jsx40($InvisibleSpan, { contentEditable: false, children: "|" })
6324
+ /* @__PURE__ */ jsx42($InvisibleSpan, { contentEditable: false, children: "|" })
6180
6325
  ] })
6181
6326
  );
6182
6327
  } else {
@@ -6390,16 +6535,16 @@ function normalizeNode5(editor, entry) {
6390
6535
  // src/list-plugin/render-element/ordered-list-item.tsx
6391
6536
  import { clsx as clsx6 } from "clsx";
6392
6537
  import { useEffect as useEffect5 } from "react";
6393
- import { ReactEditor as ReactEditor10, useSlateStatic as useSlateStatic12 } from "slate-react";
6538
+ import { ReactEditor as ReactEditor10, useSlateStatic as useSlateStatic11 } from "slate-react";
6394
6539
 
6395
6540
  // src/list-plugin/render-element/styles.ts
6396
- import styled29 from "@emotion/styled";
6397
- var $ListItem = styled29("li")`
6541
+ import styled30 from "@emotion/styled";
6542
+ var $ListItem = styled30("li")`
6398
6543
  margin-top: 0.5em;
6399
6544
  margin-bottom: 0.5em;
6400
6545
  list-style-position: outside;
6401
6546
  `;
6402
- var $UnorderedListItem = styled29($ListItem)`
6547
+ var $UnorderedListItem = styled30($ListItem)`
6403
6548
  position: relative;
6404
6549
  list-style-type: none;
6405
6550
  .--list-item-icon {
@@ -6410,7 +6555,7 @@ var $UnorderedListItem = styled29($ListItem)`
6410
6555
  color: var(--shade-600);
6411
6556
  }
6412
6557
  `;
6413
- var $OrderedListItem = styled29($ListItem)`
6558
+ var $OrderedListItem = styled30($ListItem)`
6414
6559
  position: relative;
6415
6560
  list-style-type: none;
6416
6561
  counter-increment: var(--list-item-var);
@@ -6436,7 +6581,7 @@ var $OrderedListItem = styled29($ListItem)`
6436
6581
  font-variant-numeric: tabular-nums;
6437
6582
  }
6438
6583
  `;
6439
- var $TaskListItem = styled29($ListItem)`
6584
+ var $TaskListItem = styled30($ListItem)`
6440
6585
  position: relative;
6441
6586
  list-style-type: none;
6442
6587
  .--list-item-icon {
@@ -6453,13 +6598,13 @@ var $TaskListItem = styled29($ListItem)`
6453
6598
  `;
6454
6599
 
6455
6600
  // src/list-plugin/render-element/ordered-list-item.tsx
6456
- import { jsx as jsx41 } from "react/jsx-runtime";
6601
+ import { jsx as jsx43 } from "react/jsx-runtime";
6457
6602
  function OrderedListItem({
6458
6603
  element,
6459
6604
  attributes,
6460
6605
  children
6461
6606
  }) {
6462
- const editor = useSlateStatic12();
6607
+ const editor = useSlateStatic11();
6463
6608
  useEffect5(() => {
6464
6609
  const path = ReactEditor10.findPath(editor, element);
6465
6610
  normalizeOrderedFirstAtDepth(editor, [element, path]);
@@ -6469,15 +6614,15 @@ function OrderedListItem({
6469
6614
  "--list-item-var": `list-item-depth-${element.depth}`
6470
6615
  };
6471
6616
  const className = clsx6({ "--first-at-depth": element.__firstAtDepth });
6472
- return /* @__PURE__ */ jsx41($OrderedListItem, { ...attributes, className, style, children });
6617
+ return /* @__PURE__ */ jsx43($OrderedListItem, { ...attributes, className, style, children });
6473
6618
  }
6474
6619
 
6475
6620
  // src/list-plugin/render-element/task-list-item.tsx
6476
- import { useCallback as useCallback10 } from "react";
6477
- import { useSlateStatic as useSlateStatic13 } from "slate-react";
6621
+ import { useCallback as useCallback11 } from "react";
6622
+ import { useSlateStatic as useSlateStatic12 } from "slate-react";
6478
6623
 
6479
6624
  // src/list-plugin/render-element/list-icons.tsx
6480
- import { jsx as jsx42, jsxs as jsxs20 } from "react/jsx-runtime";
6625
+ import { jsx as jsx44, jsxs as jsxs20 } from "react/jsx-runtime";
6481
6626
  var UncheckedIcon = (props) => /* @__PURE__ */ jsxs20(
6482
6627
  "svg",
6483
6628
  {
@@ -6492,8 +6637,8 @@ var UncheckedIcon = (props) => /* @__PURE__ */ jsxs20(
6492
6637
  viewBox: "0 0 24 24",
6493
6638
  ...props,
6494
6639
  children: [
6495
- /* @__PURE__ */ jsx42("path", { d: "M0 0h24v24H0z", stroke: "none" }),
6496
- /* @__PURE__ */ jsx42("rect", { x: 4, y: 4, width: 16, height: 16, rx: 2 })
6640
+ /* @__PURE__ */ jsx44("path", { d: "M0 0h24v24H0z", stroke: "none" }),
6641
+ /* @__PURE__ */ jsx44("rect", { x: 4, y: 4, width: 16, height: 16, rx: 2 })
6497
6642
  ]
6498
6643
  }
6499
6644
  );
@@ -6512,13 +6657,13 @@ var CheckedIcon = (props) => /* @__PURE__ */ jsxs20(
6512
6657
  viewBox: "0 0 24 24",
6513
6658
  ...props,
6514
6659
  children: [
6515
- /* @__PURE__ */ jsx42("path", { d: "M0 0h24v24H0z", stroke: "none" }),
6516
- /* @__PURE__ */ jsx42("path", { d: "m9 11 3 3 8-8", className: "--checkmark" }),
6517
- /* @__PURE__ */ jsx42("path", { d: "M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9" })
6660
+ /* @__PURE__ */ jsx44("path", { d: "M0 0h24v24H0z", stroke: "none" }),
6661
+ /* @__PURE__ */ jsx44("path", { d: "m9 11 3 3 8-8", className: "--checkmark" }),
6662
+ /* @__PURE__ */ jsx44("path", { d: "M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9" })
6518
6663
  ]
6519
6664
  }
6520
6665
  );
6521
- var BulletIcon = (props) => /* @__PURE__ */ jsx42(
6666
+ var BulletIcon = (props) => /* @__PURE__ */ jsx44(
6522
6667
  "svg",
6523
6668
  {
6524
6669
  xmlns: "http://www.w3.org/2000/svg",
@@ -6527,30 +6672,30 @@ var BulletIcon = (props) => /* @__PURE__ */ jsx42(
6527
6672
  width: "1em",
6528
6673
  height: "1em",
6529
6674
  ...props,
6530
- children: /* @__PURE__ */ jsx42("path", { d: "M12 8.25a3.75 3.75 0 1 0 0 7.5 3.75 3.75 0 0 0 0-7.5z" })
6675
+ children: /* @__PURE__ */ jsx44("path", { d: "M12 8.25a3.75 3.75 0 1 0 0 7.5 3.75 3.75 0 0 0 0-7.5z" })
6531
6676
  }
6532
6677
  );
6533
6678
 
6534
6679
  // src/list-plugin/render-element/task-list-item.tsx
6535
- import { jsx as jsx43, jsxs as jsxs21 } from "react/jsx-runtime";
6680
+ import { jsx as jsx45, jsxs as jsxs21 } from "react/jsx-runtime";
6536
6681
  function TaskListItem({
6537
6682
  element,
6538
6683
  attributes,
6539
6684
  children
6540
6685
  }) {
6541
- const editor = useSlateStatic13();
6542
- const toggle = useCallback10(() => {
6686
+ const editor = useSlateStatic12();
6687
+ const toggle = useCallback11(() => {
6543
6688
  editor.list.toggleTaskListItem({ at: element });
6544
6689
  }, [editor, element]);
6545
6690
  const marginLeft = `${2 + element.depth * 2}em`;
6546
6691
  return /* @__PURE__ */ jsxs21($TaskListItem, { ...attributes, style: { marginLeft }, children: [
6547
- /* @__PURE__ */ jsx43("div", { className: "--list-item-icon", contentEditable: false, children: element.checked ? /* @__PURE__ */ jsx43(CheckedIcon, { onClick: toggle, style: { cursor: "pointer" } }) : /* @__PURE__ */ jsx43(UncheckedIcon, { onClick: toggle, style: { cursor: "pointer" } }) }),
6692
+ /* @__PURE__ */ jsx45("div", { className: "--list-item-icon", contentEditable: false, children: element.checked ? /* @__PURE__ */ jsx45(CheckedIcon, { onClick: toggle, style: { cursor: "pointer" } }) : /* @__PURE__ */ jsx45(UncheckedIcon, { onClick: toggle, style: { cursor: "pointer" } }) }),
6548
6693
  children
6549
6694
  ] });
6550
6695
  }
6551
6696
 
6552
6697
  // src/list-plugin/render-element/unordered-list-item.tsx
6553
- import { jsx as jsx44, jsxs as jsxs22 } from "react/jsx-runtime";
6698
+ import { jsx as jsx46, jsxs as jsxs22 } from "react/jsx-runtime";
6554
6699
  function UnorderedListItem({
6555
6700
  element,
6556
6701
  attributes,
@@ -6558,13 +6703,13 @@ function UnorderedListItem({
6558
6703
  }) {
6559
6704
  const marginLeft = `${2 + element.depth * 2}em`;
6560
6705
  return /* @__PURE__ */ jsxs22($UnorderedListItem, { ...attributes, style: { marginLeft }, children: [
6561
- /* @__PURE__ */ jsx44("div", { className: "--list-item-icon", contentEditable: false, children: /* @__PURE__ */ jsx44(BulletIcon, {}) }),
6706
+ /* @__PURE__ */ jsx46("div", { className: "--list-item-icon", contentEditable: false, children: /* @__PURE__ */ jsx46(BulletIcon, {}) }),
6562
6707
  children
6563
6708
  ] });
6564
6709
  }
6565
6710
 
6566
6711
  // src/list-plugin/render-element/index.tsx
6567
- import { jsx as jsx45 } from "react/jsx-runtime";
6712
+ import { jsx as jsx47 } from "react/jsx-runtime";
6568
6713
  function renderElement3({
6569
6714
  element,
6570
6715
  attributes,
@@ -6572,11 +6717,11 @@ function renderElement3({
6572
6717
  }) {
6573
6718
  switch (element.type) {
6574
6719
  case "ordered-list-item":
6575
- return /* @__PURE__ */ jsx45(OrderedListItem, { element, attributes, children });
6720
+ return /* @__PURE__ */ jsx47(OrderedListItem, { element, attributes, children });
6576
6721
  case "unordered-list-item":
6577
- return /* @__PURE__ */ jsx45(UnorderedListItem, { element, attributes, children });
6722
+ return /* @__PURE__ */ jsx47(UnorderedListItem, { element, attributes, children });
6578
6723
  case "task-list-item":
6579
- return /* @__PURE__ */ jsx45(TaskListItem, { element, attributes, children });
6724
+ return /* @__PURE__ */ jsx47(TaskListItem, { element, attributes, children });
6580
6725
  }
6581
6726
  }
6582
6727
 
@@ -6683,7 +6828,7 @@ function toggleMark(editor, markKey, unsetKey, { at = editor.selection } = {}) {
6683
6828
  [validMarkKey]: true
6684
6829
  };
6685
6830
  } else {
6686
- const { [validMarkKey]: _, ...remainingMarks } = editor.activeMarks || {};
6831
+ const { [validMarkKey]: _unused, ...remainingMarks } = editor.activeMarks || {};
6687
6832
  editor.activeMarks = remainingMarks;
6688
6833
  }
6689
6834
  }
@@ -6711,8 +6856,8 @@ function createMarksMethods(editor) {
6711
6856
  }
6712
6857
 
6713
6858
  // src/marks-plugin/styles.tsx
6714
- import styled30 from "@emotion/styled";
6715
- var $MarksSpan = styled30("span")`
6859
+ import styled31 from "@emotion/styled";
6860
+ var $MarksSpan = styled31("span")`
6716
6861
  &.--bold {
6717
6862
  font-weight: bold;
6718
6863
  }
@@ -6733,12 +6878,12 @@ var $MarksSpan = styled30("span")`
6733
6878
  text-decoration: underline line-through;
6734
6879
  }
6735
6880
  &.--highlight {
6736
- background-color: #ffeb3b;
6881
+ background-color: #ffff00;
6737
6882
  }
6738
6883
  `;
6739
6884
 
6740
6885
  // src/marks-plugin/index.tsx
6741
- import { jsx as jsx46 } from "react/jsx-runtime";
6886
+ import { jsx as jsx48 } from "react/jsx-runtime";
6742
6887
  var MarksPlugin = createPlugin((editor) => {
6743
6888
  editor.marksPlugin = createMarksMethods(editor);
6744
6889
  editor.activeMarks = {};
@@ -6747,7 +6892,8 @@ var MarksPlugin = createPlugin((editor) => {
6747
6892
  "mod+i": editor.marksPlugin.toggleItalic,
6748
6893
  "mod+u": editor.marksPlugin.toggleUnderline,
6749
6894
  "super+0": editor.marksPlugin.removeMarks,
6750
- "super+k": editor.marksPlugin.toggleStrike
6895
+ "super+k": editor.marksPlugin.toggleStrike,
6896
+ "mod+h": editor.marksPlugin.toggleHighlight
6751
6897
  });
6752
6898
  const { insertText: defaultInsertText } = editor;
6753
6899
  editor.insertText = (text) => {
@@ -6778,7 +6924,7 @@ var MarksPlugin = createPlugin((editor) => {
6778
6924
  name: "marks",
6779
6925
  editableProps: {
6780
6926
  renderLeaf: ({ leaf, children }) => {
6781
- return /* @__PURE__ */ jsx46(
6927
+ return /* @__PURE__ */ jsx48(
6782
6928
  $MarksSpan,
6783
6929
  {
6784
6930
  className: clsx7({
@@ -6851,7 +6997,7 @@ var NormalizeAfterDeletePlugin = createPlugin((editor) => {
6851
6997
  import { Element as Element23 } from "slate";
6852
6998
 
6853
6999
  // src/table-plugin/delete-fragment/index.ts
6854
- import { Editor as Editor46, Path as Path12, Transforms as Transforms32 } from "slate";
7000
+ import { Editor as Editor46, Path as Path12, Transforms as Transforms31 } from "slate";
6855
7001
 
6856
7002
  // src/table-plugin/delete-fragment/get-reversed-delete-safe-ranges.ts
6857
7003
  import { Editor as Editor45, Path as Path11 } from "slate";
@@ -6906,15 +7052,15 @@ function deleteFragmentWithProtectedTypes(editor, protectedTypes) {
6906
7052
  );
6907
7053
  Editor46.withoutNormalizing(editor, () => {
6908
7054
  for (const range of reversedRanges) {
6909
- Transforms32.delete(editor, { at: range });
7055
+ Transforms31.delete(editor, { at: range });
6910
7056
  }
6911
- Transforms32.collapse(editor, { edge: "start" });
7057
+ Transforms31.collapse(editor, { edge: "start" });
6912
7058
  });
6913
7059
  return true;
6914
7060
  }
6915
7061
 
6916
7062
  // src/table-plugin/methods/index.ts
6917
- import { Transforms as Transforms41 } from "slate";
7063
+ import { Transforms as Transforms40 } from "slate";
6918
7064
 
6919
7065
  // src/table-plugin/methods/get-table-info.ts
6920
7066
  function getTableInfo(editor, { at = editor.selection } = {}) {
@@ -6952,7 +7098,7 @@ function getTableInfo(editor, { at = editor.selection } = {}) {
6952
7098
  }
6953
7099
 
6954
7100
  // src/table-plugin/methods/insert-column.ts
6955
- import { Editor as Editor47, Transforms as Transforms33 } from "slate";
7101
+ import { Editor as Editor47, Transforms as Transforms32 } from "slate";
6956
7102
 
6957
7103
  // src/table-plugin/methods/utils.ts
6958
7104
  function createCell(index, children = [
@@ -6978,9 +7124,9 @@ function insertColumn(editor, { offset = 0, at = editor.selection } = {}) {
6978
7124
  const { columns } = tableElement;
6979
7125
  const nextColumns = [...columns];
6980
7126
  nextColumns.splice(nextCellIndex, 0, columns[nextCellIndex]);
6981
- Transforms33.setNodes(editor, { columns: nextColumns }, { at: tablePath });
7127
+ Transforms32.setNodes(editor, { columns: nextColumns }, { at: tablePath });
6982
7128
  tableElement.children.forEach((rowElement, i) => {
6983
- Transforms33.insertNodes(editor, createCell(nextCellIndex), {
7129
+ Transforms32.insertNodes(editor, createCell(nextCellIndex), {
6984
7130
  at: [...tablePath, i, nextCellIndex]
6985
7131
  });
6986
7132
  });
@@ -6989,7 +7135,7 @@ function insertColumn(editor, { offset = 0, at = editor.selection } = {}) {
6989
7135
  }
6990
7136
 
6991
7137
  // src/table-plugin/methods/insert-row.ts
6992
- import { Transforms as Transforms34 } from "slate";
7138
+ import { Transforms as Transforms33 } from "slate";
6993
7139
  function createRow(columnCount) {
6994
7140
  return {
6995
7141
  type: "table-row",
@@ -7001,7 +7147,7 @@ function insertRow(editor, { at = editor.selection, offset = 0 } = {}) {
7001
7147
  if (!t2)
7002
7148
  return false;
7003
7149
  const nextRowElement = createRow(t2.tableElement.columns.length);
7004
- Transforms34.insertNodes(editor, nextRowElement, {
7150
+ Transforms33.insertNodes(editor, nextRowElement, {
7005
7151
  at: [...t2.tablePath, t2.rowIndex + offset]
7006
7152
  });
7007
7153
  return true;
@@ -7011,7 +7157,7 @@ function insertRowBelow(editor, { at } = {}) {
7011
7157
  }
7012
7158
 
7013
7159
  // src/table-plugin/methods/insert-table.ts
7014
- import { Editor as Editor49, Element as Element22, Path as Path13, Transforms as Transforms35 } from "slate";
7160
+ import { Editor as Editor49, Element as Element22, Path as Path13, Transforms as Transforms34 } from "slate";
7015
7161
  function createRange(size) {
7016
7162
  return [...Array(size).keys()];
7017
7163
  }
@@ -7045,17 +7191,17 @@ function insertRootElement2(editor, element, { at = editor.selection } = {}) {
7045
7191
  if (entry == null) {
7046
7192
  const selection = editor.selection;
7047
7193
  Editor49.withoutNormalizing(editor, () => {
7048
- Transforms35.insertNodes(editor, element, { at });
7194
+ Transforms34.insertNodes(editor, element, { at });
7049
7195
  if (selection) {
7050
- Transforms35.select(editor, selection);
7051
- Transforms35.move(editor);
7196
+ Transforms34.select(editor, selection);
7197
+ Transforms34.move(editor);
7052
7198
  }
7053
7199
  });
7054
7200
  } else {
7055
7201
  const nextPath = Path13.next(entry[1]);
7056
7202
  Editor49.withoutNormalizing(editor, () => {
7057
- Transforms35.insertNodes(editor, element, { at: nextPath });
7058
- Transforms35.select(editor, Editor49.start(editor, nextPath));
7203
+ Transforms34.insertNodes(editor, element, { at: nextPath });
7204
+ Transforms34.select(editor, Editor49.start(editor, nextPath));
7059
7205
  });
7060
7206
  }
7061
7207
  return true;
@@ -7072,7 +7218,7 @@ function selectElementBelow(editor, t2) {
7072
7218
  try {
7073
7219
  selectStartOfElement(editor, Path14.next(tablePath));
7074
7220
  return true;
7075
- } catch (e) {
7221
+ } catch {
7076
7222
  return false;
7077
7223
  }
7078
7224
  }
@@ -7085,7 +7231,7 @@ function selectElementAbove(editor, t2) {
7085
7231
  try {
7086
7232
  selectEndOfElement(editor, Path14.previous(tablePath));
7087
7233
  return true;
7088
- } catch (e) {
7234
+ } catch {
7089
7235
  return false;
7090
7236
  }
7091
7237
  }
@@ -7135,15 +7281,15 @@ function up(editor) {
7135
7281
  }
7136
7282
 
7137
7283
  // src/table-plugin/methods/remove-column.ts
7138
- import { Editor as Editor52, Transforms as Transforms37 } from "slate";
7284
+ import { Editor as Editor52, Transforms as Transforms36 } from "slate";
7139
7285
 
7140
7286
  // src/table-plugin/methods/remove-table.ts
7141
- import { Transforms as Transforms36 } from "slate";
7287
+ import { Transforms as Transforms35 } from "slate";
7142
7288
  function removeTable(editor) {
7143
7289
  const t2 = editor.tablePlugin.getTableInfo();
7144
7290
  if (t2 === void 0)
7145
7291
  return false;
7146
- Transforms36.removeNodes(editor, { at: t2.tablePath });
7292
+ Transforms35.removeNodes(editor, { at: t2.tablePath });
7147
7293
  return true;
7148
7294
  }
7149
7295
 
@@ -7159,9 +7305,9 @@ function removeColumn(editor, { at = editor.selection } = {}) {
7159
7305
  Editor52.withoutNormalizing(editor, () => {
7160
7306
  const columns = [...tableElement.columns];
7161
7307
  columns.splice(cellIndex, 1);
7162
- Transforms37.setNodes(editor, { columns }, { at: tablePath });
7308
+ Transforms36.setNodes(editor, { columns }, { at: tablePath });
7163
7309
  tableElement.children.forEach((rowElement, rowIndex2) => {
7164
- Transforms37.removeNodes(editor, {
7310
+ Transforms36.removeNodes(editor, {
7165
7311
  at: [...tablePath, rowIndex2, cellIndex]
7166
7312
  });
7167
7313
  });
@@ -7170,12 +7316,12 @@ function removeColumn(editor, { at = editor.selection } = {}) {
7170
7316
  rowIndex,
7171
7317
  Math.min(cellIndex, cellCount - 2)
7172
7318
  ]);
7173
- Transforms37.select(editor, selection);
7319
+ Transforms36.select(editor, selection);
7174
7320
  });
7175
7321
  }
7176
7322
 
7177
7323
  // src/table-plugin/methods/remove-row.ts
7178
- import { Editor as Editor53, Transforms as Transforms38 } from "slate";
7324
+ import { Editor as Editor53, Transforms as Transforms37 } from "slate";
7179
7325
  function removeRow(editor, { at = editor.selection } = {}) {
7180
7326
  const t2 = getTableInfo(editor, { at });
7181
7327
  if (t2 === void 0)
@@ -7185,8 +7331,8 @@ function removeRow(editor, { at = editor.selection } = {}) {
7185
7331
  return true;
7186
7332
  }
7187
7333
  Editor53.withoutNormalizing(editor, () => {
7188
- Transforms38.removeNodes(editor, { at: t2.rowPath });
7189
- Transforms38.select(
7334
+ Transforms37.removeNodes(editor, { at: t2.rowPath });
7335
+ Transforms37.select(
7190
7336
  editor,
7191
7337
  Editor53.start(editor, [
7192
7338
  ...t2.tablePath,
@@ -7199,7 +7345,7 @@ function removeRow(editor, { at = editor.selection } = {}) {
7199
7345
  }
7200
7346
 
7201
7347
  // src/table-plugin/methods/setTableColumnAlign.ts
7202
- import { Transforms as Transforms39 } from "slate";
7348
+ import { Transforms as Transforms38 } from "slate";
7203
7349
  function setTableColumnAlign(editor, options) {
7204
7350
  const t2 = getTableInfo(editor);
7205
7351
  if (t2 === void 0)
@@ -7207,12 +7353,12 @@ function setTableColumnAlign(editor, options) {
7207
7353
  const { tableElement, tablePath, cellIndex } = t2;
7208
7354
  const nextColumns = tableElement.columns.slice();
7209
7355
  nextColumns.splice(cellIndex, 1, { align: options.align });
7210
- Transforms39.setNodes(editor, { columns: nextColumns }, { at: tablePath });
7356
+ Transforms38.setNodes(editor, { columns: nextColumns }, { at: tablePath });
7211
7357
  return true;
7212
7358
  }
7213
7359
 
7214
7360
  // src/table-plugin/methods/tab.ts
7215
- import { Path as Path15, Transforms as Transforms40 } from "slate";
7361
+ import { Path as Path15, Transforms as Transforms39 } from "slate";
7216
7362
  function tabForward(editor) {
7217
7363
  const t2 = getTableInfo(editor);
7218
7364
  if (!t2)
@@ -7227,7 +7373,7 @@ function tabForward(editor) {
7227
7373
  return true;
7228
7374
  }
7229
7375
  const nextPath = Path15.next(tablePath);
7230
- Transforms40.insertNodes(
7376
+ Transforms39.insertNodes(
7231
7377
  editor,
7232
7378
  { type: "paragraph", children: [{ text: "" }] },
7233
7379
  { at: nextPath }
@@ -7291,12 +7437,12 @@ function selectCell(editor, { at = editor.selection } = {}) {
7291
7437
  if (t2 === void 0)
7292
7438
  return false;
7293
7439
  const { cellPath } = t2;
7294
- Transforms41.select(editor, cellPath);
7440
+ Transforms40.select(editor, cellPath);
7295
7441
  return true;
7296
7442
  }
7297
7443
 
7298
7444
  // src/table-plugin/normalize/normalize-table.ts
7299
- import { Transforms as Transforms42 } from "slate";
7445
+ import { Transforms as Transforms41 } from "slate";
7300
7446
  function normalizeTableIndexes(editor, entry) {
7301
7447
  let isTransformed = false;
7302
7448
  const rowElements = entry[0].children;
@@ -7304,7 +7450,7 @@ function normalizeTableIndexes(editor, entry) {
7304
7450
  const cellElements = rowElement.children;
7305
7451
  cellElements.forEach((cellElement, x) => {
7306
7452
  if (cellElement.x !== x || cellElement.y !== y) {
7307
- Transforms42.setNodes(editor, { x, y }, { at: [...entry[1], y, x] });
7453
+ Transforms41.setNodes(editor, { x, y }, { at: [...entry[1], y, x] });
7308
7454
  isTransformed = true;
7309
7455
  }
7310
7456
  });
@@ -7313,14 +7459,14 @@ function normalizeTableIndexes(editor, entry) {
7313
7459
  }
7314
7460
 
7315
7461
  // src/table-plugin/normalize/normalize-table-cell.ts
7316
- import { Editor as Editor58, Transforms as Transforms43 } from "slate";
7462
+ import { Editor as Editor58, Transforms as Transforms42 } from "slate";
7317
7463
  function normalizeTableCell(editor, entry) {
7318
7464
  const [node, path] = entry;
7319
7465
  if (node.children.length === 1 && node.children[0].type === "table-content") {
7320
7466
  return false;
7321
7467
  }
7322
7468
  Editor58.withoutNormalizing(editor, () => {
7323
- Transforms43.insertNodes(
7469
+ Transforms42.insertNodes(
7324
7470
  editor,
7325
7471
  {
7326
7472
  type: "table-content",
@@ -7329,9 +7475,9 @@ function normalizeTableCell(editor, entry) {
7329
7475
  { at: [...entry[1], 0] }
7330
7476
  );
7331
7477
  for (let i = node.children.length; i >= 0; i--) {
7332
- Transforms43.mergeNodes(editor, { at: [...path, i] });
7478
+ Transforms42.mergeNodes(editor, { at: [...path, i] });
7333
7479
  }
7334
- Transforms43.delete(editor, {
7480
+ Transforms42.delete(editor, {
7335
7481
  at: { path: [...path, 0, 0], offset: 0 },
7336
7482
  unit: "character"
7337
7483
  });
@@ -7341,14 +7487,14 @@ function normalizeTableCell(editor, entry) {
7341
7487
 
7342
7488
  // src/table-plugin/render-element/table.tsx
7343
7489
  import { useEffect as useEffect6 } from "react";
7344
- import { ReactEditor as ReactEditor12, useSelected as useSelected7, useSlateStatic as useSlateStatic14 } from "slate-react";
7490
+ import { ReactEditor as ReactEditor12, useSelected as useSelected7, useSlateStatic as useSlateStatic13 } from "slate-react";
7345
7491
 
7346
7492
  // src/table-plugin/render-element/styles/index.ts
7347
- import styled32 from "@emotion/styled";
7493
+ import styled33 from "@emotion/styled";
7348
7494
 
7349
7495
  // src/table-plugin/render-element/styles/table-menu-styles.ts
7350
- import styled31 from "@emotion/styled";
7351
- var $BaseMenu = styled31("div")`
7496
+ import styled32 from "@emotion/styled";
7497
+ var $BaseMenu = styled32("div")`
7352
7498
  position: absolute;
7353
7499
  /**
7354
7500
  * very slightly shaded
@@ -7373,7 +7519,7 @@ var $BaseMenu = styled31("div")`
7373
7519
  }
7374
7520
  }
7375
7521
  `;
7376
- var $ColumnMenu = styled31($BaseMenu)`
7522
+ var $ColumnMenu = styled32($BaseMenu)`
7377
7523
  cursor: pointer;
7378
7524
  /**
7379
7525
  * hangs out on top
@@ -7384,7 +7530,7 @@ var $ColumnMenu = styled31($BaseMenu)`
7384
7530
  height: 3em;
7385
7531
  top: -3em;
7386
7532
  `;
7387
- var $RowMenu = styled31($BaseMenu)`
7533
+ var $RowMenu = styled32($BaseMenu)`
7388
7534
  /**
7389
7535
  * hangs out on left
7390
7536
  */
@@ -7393,7 +7539,7 @@ var $RowMenu = styled31($BaseMenu)`
7393
7539
  width: 3em;
7394
7540
  left: -3em;
7395
7541
  `;
7396
- var $MenuTile = styled31("div")`
7542
+ var $MenuTile = styled32("div")`
7397
7543
  position: absolute;
7398
7544
  background: rgba(0, 0, 0, 0.05);
7399
7545
  border: 1px solid rgba(0, 0, 0, 0.05);
@@ -7406,7 +7552,7 @@ var $MenuTile = styled31("div")`
7406
7552
  right: 0;
7407
7553
  bottom: 0;
7408
7554
  `;
7409
- var $ColumnMenuTile = styled31($MenuTile)`
7555
+ var $ColumnMenuTile = styled32($MenuTile)`
7410
7556
  top: 50%;
7411
7557
  border-bottom: none;
7412
7558
  border-right: none;
@@ -7433,7 +7579,7 @@ var $ColumnMenuTile = styled31($MenuTile)`
7433
7579
  /* border-top-left-radius: 0.5em;
7434
7580
  border-top-right-radius: 0.5em; */
7435
7581
  `;
7436
- var $RowMenuTile = styled31($MenuTile)`
7582
+ var $RowMenuTile = styled32($MenuTile)`
7437
7583
  left: 50%;
7438
7584
  border-right: none;
7439
7585
  border-bottom: none;
@@ -7460,7 +7606,7 @@ var $RowMenuTile = styled31($MenuTile)`
7460
7606
  /* border-top-left-radius: 0.5em;
7461
7607
  border-bottom-left-radius: 0.5em; */
7462
7608
  `;
7463
- var $MenuButton = styled31("div")`
7609
+ var $MenuButton = styled32("div")`
7464
7610
  position: absolute;
7465
7611
  font-size: 1.5em;
7466
7612
  background: white;
@@ -7470,13 +7616,13 @@ var $MenuButton = styled31("div")`
7470
7616
  display: block;
7471
7617
  }
7472
7618
  `;
7473
- var $AddMenuButton = styled31($MenuButton)`
7619
+ var $AddMenuButton = styled32($MenuButton)`
7474
7620
  color: #c0c0c0;
7475
7621
  &:hover {
7476
7622
  color: royalblue;
7477
7623
  }
7478
7624
  `;
7479
- var $RemoveMenuButton = styled31($MenuButton)`
7625
+ var $RemoveMenuButton = styled32($MenuButton)`
7480
7626
  color: #c0c0c0;
7481
7627
  &:hover {
7482
7628
  color: firebrick;
@@ -7484,20 +7630,20 @@ var $RemoveMenuButton = styled31($MenuButton)`
7484
7630
  `;
7485
7631
 
7486
7632
  // src/table-plugin/render-element/styles/index.ts
7487
- var $Table = styled32("table")`
7633
+ var $Table = styled33("table")`
7488
7634
  border-collapse: collapse;
7489
7635
  margin: 1em 0;
7490
7636
  ${({ columns }) => columns.map(
7491
7637
  (column, index) => `td:nth-of-type(${index + 1}) { text-align: ${column.align}; }`
7492
7638
  ).join("\n")}
7493
7639
  `;
7494
- var $TableRow = styled32("tr")`
7640
+ var $TableRow = styled33("tr")`
7495
7641
  position: relative;
7496
7642
  &:first-of-type {
7497
7643
  background: var(--table-head-bgcolor);
7498
7644
  }
7499
7645
  `;
7500
- var $TableCell = styled32("td")`
7646
+ var $TableCell = styled33("td")`
7501
7647
  position: relative;
7502
7648
  border-width: 1px;
7503
7649
  border-style: solid;
@@ -7518,7 +7664,7 @@ var $TableCell = styled32("td")`
7518
7664
  border-right-color: var(--table-border-color);
7519
7665
  }
7520
7666
  `;
7521
- var $TableContent = styled32("div")`
7667
+ var $TableContent = styled33("div")`
7522
7668
  /**
7523
7669
  * Smaller font inside a table than outside of it
7524
7670
  */
@@ -7539,19 +7685,19 @@ var TableContext = createContext2({
7539
7685
  });
7540
7686
 
7541
7687
  // src/table-plugin/render-element/table.tsx
7542
- import { jsx as jsx47 } from "react/jsx-runtime";
7688
+ import { jsx as jsx49 } from "react/jsx-runtime";
7543
7689
  function Table({
7544
7690
  element,
7545
7691
  attributes,
7546
7692
  children
7547
7693
  }) {
7548
- const editor = useSlateStatic14();
7694
+ const editor = useSlateStatic13();
7549
7695
  const isSelected = useSelected7();
7550
7696
  useEffect6(() => {
7551
7697
  const path = ReactEditor12.findPath(editor, element);
7552
7698
  normalizeTableIndexes(editor, [element, path]);
7553
7699
  }, []);
7554
- return /* @__PURE__ */ jsx47(TableContext.Provider, { value: { isSelected }, children: /* @__PURE__ */ jsx47($Table, { ...attributes, columns: element.columns, children: /* @__PURE__ */ jsx47("tbody", { children }) }) });
7700
+ return /* @__PURE__ */ jsx49(TableContext.Provider, { value: { isSelected }, children: /* @__PURE__ */ jsx49($Table, { ...attributes, columns: element.columns, children: /* @__PURE__ */ jsx49("tbody", { children }) }) });
7555
7701
  }
7556
7702
 
7557
7703
  // src/table-plugin/render-element/table-cell/index.tsx
@@ -7559,12 +7705,12 @@ import { useContext as useContext2 } from "react";
7559
7705
  import { useSelected as useSelected8 } from "slate-react";
7560
7706
 
7561
7707
  // src/table-plugin/render-element/table-cell/column-menu/index.tsx
7562
- import { useCallback as useCallback11, useRef as useRef5, useState as useState6 } from "react";
7563
- import { useSlateStatic as useSlateStatic15 } from "slate-react";
7708
+ import { useCallback as useCallback12, useRef as useRef7, useState as useState6 } from "react";
7709
+ import { useSlateStatic as useSlateStatic14 } from "slate-react";
7564
7710
 
7565
7711
  // src/table-plugin/icons.tsx
7566
- import { jsx as jsx48 } from "react/jsx-runtime";
7567
- var PlusIcon = (props) => /* @__PURE__ */ jsx48(
7712
+ import { jsx as jsx50 } from "react/jsx-runtime";
7713
+ var PlusIcon = (props) => /* @__PURE__ */ jsx50(
7568
7714
  "svg",
7569
7715
  {
7570
7716
  xmlns: "http://www.w3.org/2000/svg",
@@ -7573,7 +7719,7 @@ var PlusIcon = (props) => /* @__PURE__ */ jsx48(
7573
7719
  width: "1em",
7574
7720
  height: "1em",
7575
7721
  ...props,
7576
- children: /* @__PURE__ */ jsx48(
7722
+ children: /* @__PURE__ */ jsx50(
7577
7723
  "path",
7578
7724
  {
7579
7725
  fillRule: "evenodd",
@@ -7583,7 +7729,7 @@ var PlusIcon = (props) => /* @__PURE__ */ jsx48(
7583
7729
  )
7584
7730
  }
7585
7731
  );
7586
- var MinusIcon = (props) => /* @__PURE__ */ jsx48(
7732
+ var MinusIcon = (props) => /* @__PURE__ */ jsx50(
7587
7733
  "svg",
7588
7734
  {
7589
7735
  xmlns: "http://www.w3.org/2000/svg",
@@ -7592,7 +7738,7 @@ var MinusIcon = (props) => /* @__PURE__ */ jsx48(
7592
7738
  width: "1em",
7593
7739
  height: "1em",
7594
7740
  ...props,
7595
- children: /* @__PURE__ */ jsx48(
7741
+ children: /* @__PURE__ */ jsx50(
7596
7742
  "path",
7597
7743
  {
7598
7744
  fillRule: "evenodd",
@@ -7602,25 +7748,25 @@ var MinusIcon = (props) => /* @__PURE__ */ jsx48(
7602
7748
  )
7603
7749
  }
7604
7750
  );
7605
- var BarsIcon = () => /* @__PURE__ */ jsx48(TablerIcon, { children: /* @__PURE__ */ jsx48("path", { d: "M4 6h16M4 12h16M4 18h16" }) });
7606
- var AlignLeft = () => /* @__PURE__ */ jsx48(TablerIcon, { children: /* @__PURE__ */ jsx48("path", { d: "M4 6h16M4 12h10M4 18h14" }) });
7607
- var AlignCenter = () => /* @__PURE__ */ jsx48(TablerIcon, { children: /* @__PURE__ */ jsx48("path", { d: "M4 6h16M8 12h8M6 18h12" }) });
7608
- var AlignRight = () => /* @__PURE__ */ jsx48(TablerIcon, { children: /* @__PURE__ */ jsx48("path", { d: "M4 6h16M10 12h10M6 18h14" }) });
7751
+ var BarsIcon = () => /* @__PURE__ */ jsx50(TablerIcon, { children: /* @__PURE__ */ jsx50("path", { d: "M4 6h16M4 12h16M4 18h16" }) });
7752
+ var AlignLeft = () => /* @__PURE__ */ jsx50(TablerIcon, { children: /* @__PURE__ */ jsx50("path", { d: "M4 6h16M4 12h10M4 18h14" }) });
7753
+ var AlignCenter = () => /* @__PURE__ */ jsx50(TablerIcon, { children: /* @__PURE__ */ jsx50("path", { d: "M4 6h16M8 12h8M6 18h12" }) });
7754
+ var AlignRight = () => /* @__PURE__ */ jsx50(TablerIcon, { children: /* @__PURE__ */ jsx50("path", { d: "M4 6h16M10 12h10M6 18h14" }) });
7609
7755
 
7610
7756
  // src/table-plugin/render-element/table-cell/column-menu/index.tsx
7611
- import { Fragment as Fragment4, jsx as jsx49, jsxs as jsxs23 } from "react/jsx-runtime";
7757
+ import { Fragment as Fragment4, jsx as jsx51, jsxs as jsxs23 } from "react/jsx-runtime";
7612
7758
  function ColumnMenu({ cellElement }) {
7613
- const editor = useSlateStatic15();
7759
+ const editor = useSlateStatic14();
7614
7760
  const menu = useLayer("column-menu");
7615
- const buttonRef = useRef5(null);
7761
+ const buttonRef = useRef7(null);
7616
7762
  const [hover, setHover] = useState6(false);
7617
- const onMouseEnter = useCallback11(() => {
7763
+ const onMouseEnter = useCallback12(() => {
7618
7764
  setHover(true);
7619
7765
  }, []);
7620
- const onMouseLeave = useCallback11(() => {
7766
+ const onMouseLeave = useCallback12(() => {
7621
7767
  setHover(false);
7622
7768
  }, []);
7623
- const onClick = useCallback11(() => {
7769
+ const onClick = useCallback12(() => {
7624
7770
  if (menu.layer)
7625
7771
  menu.close();
7626
7772
  const dest = buttonRef.current;
@@ -7649,7 +7795,7 @@ function ColumnMenu({ cellElement }) {
7649
7795
  }
7650
7796
  }
7651
7797
  ];
7652
- menu.open(() => /* @__PURE__ */ jsx49(Menu, { dest, items, close: menu.close }));
7798
+ menu.open(() => /* @__PURE__ */ jsx51(Menu, { dest, items, close: menu.close }));
7653
7799
  }, []);
7654
7800
  return /* @__PURE__ */ jsxs23(
7655
7801
  $ColumnMenu,
@@ -7660,9 +7806,9 @@ function ColumnMenu({ cellElement }) {
7660
7806
  onMouseEnter,
7661
7807
  onMouseLeave,
7662
7808
  children: [
7663
- /* @__PURE__ */ jsx49($ColumnMenuTile, { className: "--tile", children: /* @__PURE__ */ jsx49(BarsIcon, {}) }),
7809
+ /* @__PURE__ */ jsx51($ColumnMenuTile, { className: "--tile", children: /* @__PURE__ */ jsx51(BarsIcon, {}) }),
7664
7810
  hover ? /* @__PURE__ */ jsxs23(Fragment4, { children: [
7665
- /* @__PURE__ */ jsx49(
7811
+ /* @__PURE__ */ jsx51(
7666
7812
  $RemoveMenuButton,
7667
7813
  {
7668
7814
  style: {
@@ -7671,23 +7817,23 @@ function ColumnMenu({ cellElement }) {
7671
7817
  marginLeft: "-0.5em"
7672
7818
  },
7673
7819
  onMouseDown: () => editor.tablePlugin.removeColumn({ at: cellElement }),
7674
- children: /* @__PURE__ */ jsx49(MinusIcon, {})
7820
+ children: /* @__PURE__ */ jsx51(MinusIcon, {})
7675
7821
  }
7676
7822
  ),
7677
- /* @__PURE__ */ jsx49(
7823
+ /* @__PURE__ */ jsx51(
7678
7824
  $AddMenuButton,
7679
7825
  {
7680
7826
  style: { left: "-0.5em", top: 0 },
7681
7827
  onMouseDown: () => editor.tablePlugin.insertColumn({ at: cellElement }),
7682
- children: /* @__PURE__ */ jsx49(PlusIcon, {})
7828
+ children: /* @__PURE__ */ jsx51(PlusIcon, {})
7683
7829
  }
7684
7830
  ),
7685
- /* @__PURE__ */ jsx49(
7831
+ /* @__PURE__ */ jsx51(
7686
7832
  $AddMenuButton,
7687
7833
  {
7688
7834
  style: { right: "-0.5em", top: 0 },
7689
7835
  onMouseDown: () => editor.tablePlugin.insertColumn({ at: cellElement, offset: 1 }),
7690
- children: /* @__PURE__ */ jsx49(PlusIcon, {})
7836
+ children: /* @__PURE__ */ jsx51(PlusIcon, {})
7691
7837
  }
7692
7838
  )
7693
7839
  ] }) : null
@@ -7698,10 +7844,10 @@ function ColumnMenu({ cellElement }) {
7698
7844
 
7699
7845
  // src/table-plugin/render-element/table-cell/row-menu/index.tsx
7700
7846
  import { useState as useState7 } from "react";
7701
- import { useSlateStatic as useSlateStatic16 } from "slate-react";
7702
- import { Fragment as Fragment5, jsx as jsx50, jsxs as jsxs24 } from "react/jsx-runtime";
7847
+ import { useSlateStatic as useSlateStatic15 } from "slate-react";
7848
+ import { Fragment as Fragment5, jsx as jsx52, jsxs as jsxs24 } from "react/jsx-runtime";
7703
7849
  function RowMenu({ cellElement }) {
7704
- const editor = useSlateStatic16();
7850
+ const editor = useSlateStatic15();
7705
7851
  const [hover, setHover] = useState7(false);
7706
7852
  return /* @__PURE__ */ jsxs24(
7707
7853
  $RowMenu,
@@ -7710,9 +7856,9 @@ function RowMenu({ cellElement }) {
7710
7856
  onMouseEnter: () => setHover(true),
7711
7857
  onMouseLeave: () => setHover(false),
7712
7858
  children: [
7713
- /* @__PURE__ */ jsx50($RowMenuTile, { className: "--tile", children: /* @__PURE__ */ jsx50(BarsIcon, {}) }),
7859
+ /* @__PURE__ */ jsx52($RowMenuTile, { className: "--tile", children: /* @__PURE__ */ jsx52(BarsIcon, {}) }),
7714
7860
  hover ? /* @__PURE__ */ jsxs24(Fragment5, { children: [
7715
- /* @__PURE__ */ jsx50(
7861
+ /* @__PURE__ */ jsx52(
7716
7862
  $RemoveMenuButton,
7717
7863
  {
7718
7864
  style: {
@@ -7721,23 +7867,23 @@ function RowMenu({ cellElement }) {
7721
7867
  marginTop: "-0.5em"
7722
7868
  },
7723
7869
  onMouseDown: () => editor.tablePlugin.removeRow({ at: cellElement }),
7724
- children: /* @__PURE__ */ jsx50(MinusIcon, {})
7870
+ children: /* @__PURE__ */ jsx52(MinusIcon, {})
7725
7871
  }
7726
7872
  ),
7727
- /* @__PURE__ */ jsx50(
7873
+ /* @__PURE__ */ jsx52(
7728
7874
  $AddMenuButton,
7729
7875
  {
7730
7876
  style: { top: "-0.5em", left: "0.5em" },
7731
7877
  onMouseDown: () => editor.tablePlugin.insertRow({ at: cellElement }),
7732
- children: /* @__PURE__ */ jsx50(PlusIcon, {})
7878
+ children: /* @__PURE__ */ jsx52(PlusIcon, {})
7733
7879
  }
7734
7880
  ),
7735
- /* @__PURE__ */ jsx50(
7881
+ /* @__PURE__ */ jsx52(
7736
7882
  $AddMenuButton,
7737
7883
  {
7738
7884
  style: { bottom: "-0.5em", left: "0.5em" },
7739
7885
  onMouseDown: () => editor.tablePlugin.insertRow({ at: cellElement, offset: 1 }),
7740
- children: /* @__PURE__ */ jsx50(PlusIcon, {})
7886
+ children: /* @__PURE__ */ jsx52(PlusIcon, {})
7741
7887
  }
7742
7888
  )
7743
7889
  ] }) : null
@@ -7747,8 +7893,8 @@ function RowMenu({ cellElement }) {
7747
7893
  }
7748
7894
 
7749
7895
  // src/table-plugin/render-element/table-cell/table-menu/$table-menu.tsx
7750
- import styled33 from "@emotion/styled";
7751
- var $TableMenu = styled33("div")`
7896
+ import styled34 from "@emotion/styled";
7897
+ var $TableMenu = styled34("div")`
7752
7898
  position: absolute;
7753
7899
  /**
7754
7900
  * very slightly shaded
@@ -7781,7 +7927,7 @@ var $TableMenu = styled33("div")`
7781
7927
  }
7782
7928
  }
7783
7929
  `;
7784
- var $TableMenuTile = styled33("div")`
7930
+ var $TableMenuTile = styled34("div")`
7785
7931
  position: absolute;
7786
7932
  left: 0;
7787
7933
  top: 0;
@@ -7792,13 +7938,13 @@ var $TableMenuTile = styled33("div")`
7792
7938
  `;
7793
7939
 
7794
7940
  // src/table-plugin/render-element/table-cell/table-menu/index.tsx
7795
- import { jsx as jsx51 } from "react/jsx-runtime";
7941
+ import { jsx as jsx53 } from "react/jsx-runtime";
7796
7942
  function TableMenu() {
7797
- return /* @__PURE__ */ jsx51($TableMenu, { contentEditable: false, children: /* @__PURE__ */ jsx51($TableMenuTile, { className: "--table-menu-tile" }) });
7943
+ return /* @__PURE__ */ jsx53($TableMenu, { contentEditable: false, children: /* @__PURE__ */ jsx53($TableMenuTile, { className: "--table-menu-tile" }) });
7798
7944
  }
7799
7945
 
7800
7946
  // src/table-plugin/render-element/table-cell/index.tsx
7801
- import { jsx as jsx52, jsxs as jsxs25 } from "react/jsx-runtime";
7947
+ import { jsx as jsx54, jsxs as jsxs25 } from "react/jsx-runtime";
7802
7948
  function TableCell({
7803
7949
  element,
7804
7950
  attributes,
@@ -7818,34 +7964,34 @@ function TableCell({
7818
7964
  "data-y": element.y,
7819
7965
  children: [
7820
7966
  children,
7821
- showTableMenu ? /* @__PURE__ */ jsx52(TableMenu, {}) : null,
7822
- showRowMenu ? /* @__PURE__ */ jsx52(RowMenu, { cellElement: element }) : null,
7823
- showColumnMenu ? /* @__PURE__ */ jsx52(ColumnMenu, { cellElement: element }) : null
7967
+ showTableMenu ? /* @__PURE__ */ jsx54(TableMenu, {}) : null,
7968
+ showRowMenu ? /* @__PURE__ */ jsx54(RowMenu, { cellElement: element }) : null,
7969
+ showColumnMenu ? /* @__PURE__ */ jsx54(ColumnMenu, { cellElement: element }) : null
7824
7970
  ]
7825
7971
  }
7826
7972
  );
7827
7973
  }
7828
7974
 
7829
7975
  // src/table-plugin/render-element/table-content.tsx
7830
- import { jsx as jsx53 } from "react/jsx-runtime";
7976
+ import { jsx as jsx55 } from "react/jsx-runtime";
7831
7977
  function TableContent({
7832
7978
  attributes,
7833
7979
  children
7834
7980
  }) {
7835
- return /* @__PURE__ */ jsx53($TableContent, { ...attributes, children });
7981
+ return /* @__PURE__ */ jsx55($TableContent, { ...attributes, children });
7836
7982
  }
7837
7983
 
7838
7984
  // src/table-plugin/render-element/table-row.tsx
7839
- import { jsx as jsx54 } from "react/jsx-runtime";
7985
+ import { jsx as jsx56 } from "react/jsx-runtime";
7840
7986
  function TableRow({
7841
7987
  attributes,
7842
7988
  children
7843
7989
  }) {
7844
- return /* @__PURE__ */ jsx54($TableRow, { ...attributes, children });
7990
+ return /* @__PURE__ */ jsx56($TableRow, { ...attributes, children });
7845
7991
  }
7846
7992
 
7847
7993
  // src/table-plugin/render-element/index.tsx
7848
- import { jsx as jsx55 } from "react/jsx-runtime";
7994
+ import { jsx as jsx57 } from "react/jsx-runtime";
7849
7995
  function renderElement4({
7850
7996
  element,
7851
7997
  attributes,
@@ -7853,13 +7999,13 @@ function renderElement4({
7853
7999
  }) {
7854
8000
  switch (element.type) {
7855
8001
  case "table":
7856
- return /* @__PURE__ */ jsx55(Table, { element, attributes, children });
8002
+ return /* @__PURE__ */ jsx57(Table, { element, attributes, children });
7857
8003
  case "table-row":
7858
- return /* @__PURE__ */ jsx55(TableRow, { element, attributes, children });
8004
+ return /* @__PURE__ */ jsx57(TableRow, { element, attributes, children });
7859
8005
  case "table-cell":
7860
- return /* @__PURE__ */ jsx55(TableCell, { element, attributes, children });
8006
+ return /* @__PURE__ */ jsx57(TableCell, { element, attributes, children });
7861
8007
  case "table-content":
7862
- return /* @__PURE__ */ jsx55(TableContent, { element, attributes, children });
8008
+ return /* @__PURE__ */ jsx57(TableContent, { element, attributes, children });
7863
8009
  }
7864
8010
  }
7865
8011
 
@@ -8003,7 +8149,7 @@ var globalStyles = css2`
8003
8149
  `;
8004
8150
 
8005
8151
  // src/theme-plugin/index.tsx
8006
- import { Fragment as Fragment6, jsx as jsx56, jsxs as jsxs26 } from "react/jsx-runtime";
8152
+ import { Fragment as Fragment6, jsx as jsx58, jsxs as jsxs26 } from "react/jsx-runtime";
8007
8153
  var ThemePlugin = createPlugin((editor) => {
8008
8154
  editor.theme = true;
8009
8155
  return {
@@ -8011,8 +8157,8 @@ var ThemePlugin = createPlugin((editor) => {
8011
8157
  editor: {},
8012
8158
  renderEditable: ({ attributes, Editable: Editable3 }) => {
8013
8159
  return /* @__PURE__ */ jsxs26(Fragment6, { children: [
8014
- /* @__PURE__ */ jsx56(Global, { styles: globalStyles }),
8015
- /* @__PURE__ */ jsx56(Editable3, { ...attributes })
8160
+ /* @__PURE__ */ jsx58(Global, { styles: globalStyles }),
8161
+ /* @__PURE__ */ jsx58(Editable3, { ...attributes })
8016
8162
  ] });
8017
8163
  },
8018
8164
  editableProps: {}
@@ -8021,27 +8167,27 @@ var ThemePlugin = createPlugin((editor) => {
8021
8167
 
8022
8168
  // src/toolbar-plugin/render-editable/index.tsx
8023
8169
  import { clsx as clsx10 } from "clsx";
8024
- import { useCallback as useCallback15, useRef as useRef11 } from "react";
8025
- import { Editor as Editor62, Transforms as Transforms45 } from "slate";
8026
- import { ReactEditor as ReactEditor16, useFocused, useSlateStatic as useSlateStatic22 } from "slate-react";
8170
+ import { useCallback as useCallback17, useRef as useRef13 } from "react";
8171
+ import { Editor as Editor62, Transforms as Transforms44 } from "slate";
8172
+ import { ReactEditor as ReactEditor16, useFocused, useSlateStatic as useSlateStatic21 } from "slate-react";
8027
8173
 
8028
8174
  // src/toolbar-plugin/components/dialog/table-dialog.tsx
8029
8175
  import { clsx as clsx8 } from "clsx";
8030
- import { useCallback as useCallback12, useRef as useRef6, useState as useState8 } from "react";
8031
- import { ReactEditor as ReactEditor13, useSlateStatic as useSlateStatic17 } from "slate-react";
8176
+ import { useCallback as useCallback13, useRef as useRef8, useState as useState8 } from "react";
8177
+ import { ReactEditor as ReactEditor13, useSlateStatic as useSlateStatic16 } from "slate-react";
8032
8178
 
8033
8179
  // src/toolbar-plugin/styles/table-styles.ts
8034
- import styled34 from "@emotion/styled";
8035
- var $TableDialog = styled34($Panel)`
8180
+ import styled35 from "@emotion/styled";
8181
+ var $TableDialog = styled35($Panel)`
8036
8182
  padding: 0.5em;
8037
8183
  `;
8038
- var $TableDialogGrid = styled34("div")`
8184
+ var $TableDialogGrid = styled35("div")`
8039
8185
  display: grid;
8040
8186
  grid-template-columns: repeat(5, 1.75em);
8041
8187
  grid-template-rows: 1.5em;
8042
8188
  /* grid-gap: 1px; */
8043
8189
  `;
8044
- var $TableDialogGridCell = styled34("div")`
8190
+ var $TableDialogGridCell = styled35("div")`
8045
8191
  background: var(--shade-100);
8046
8192
  height: 1.5em;
8047
8193
  border-radius: 0.125em;
@@ -8054,7 +8200,7 @@ var $TableDialogGridCell = styled34("div")`
8054
8200
  `;
8055
8201
 
8056
8202
  // src/toolbar-plugin/components/dialog/table-dialog.tsx
8057
- import { Fragment as Fragment7, jsx as jsx57, jsxs as jsxs27 } from "react/jsx-runtime";
8203
+ import { Fragment as Fragment7, jsx as jsx59, jsxs as jsxs27 } from "react/jsx-runtime";
8058
8204
  function createRange2(size) {
8059
8205
  return [...Array(size).keys()];
8060
8206
  }
@@ -8063,20 +8209,20 @@ function TableDialog({
8063
8209
  close
8064
8210
  }) {
8065
8211
  const [hover, setHover] = useState8({ x: 0, y: 0 });
8066
- const editor = useSlateStatic17();
8067
- const ref = useRef6(null);
8212
+ const editor = useSlateStatic16();
8213
+ const ref = useRef8(null);
8068
8214
  const style = useAbsoluteReposition({ src: ref, dest }, ({ dest: dest2 }) => {
8069
8215
  return { left: dest2.left - 8, top: dest2.top + dest2.height };
8070
8216
  });
8071
8217
  const rows = createRange2(5).map((i) => i + 1);
8072
8218
  const cols = createRange2(5).map((i) => i + 1);
8073
- const hoverCell = useCallback12(
8219
+ const hoverCell = useCallback13(
8074
8220
  (x, y) => {
8075
8221
  setHover({ x, y });
8076
8222
  },
8077
8223
  [setHover]
8078
8224
  );
8079
- const createTable2 = useCallback12(
8225
+ const createTable2 = useCallback13(
8080
8226
  (x, y) => {
8081
8227
  editor.tablePlugin.insertTable(x, y);
8082
8228
  ReactEditor13.focus(editor);
@@ -8085,11 +8231,11 @@ function TableDialog({
8085
8231
  [editor]
8086
8232
  );
8087
8233
  return /* @__PURE__ */ jsxs27(Fragment7, { children: [
8088
- /* @__PURE__ */ jsx57(CloseMask, { close }),
8089
- /* @__PURE__ */ jsx57($TableDialog, { ref, style, children: /* @__PURE__ */ jsx57($TableDialogGrid, { onMouseLeave: () => hoverCell(0, 0), children: rows.map((y) => {
8234
+ /* @__PURE__ */ jsx59(CloseMask, { close }),
8235
+ /* @__PURE__ */ jsx59($TableDialog, { ref, style, children: /* @__PURE__ */ jsx59($TableDialogGrid, { onMouseLeave: () => hoverCell(0, 0), children: rows.map((y) => {
8090
8236
  return cols.map((x) => {
8091
8237
  const selected = x <= hover.x && y <= hover.y;
8092
- return /* @__PURE__ */ jsx57(
8238
+ return /* @__PURE__ */ jsx59(
8093
8239
  $TableDialogGridCell,
8094
8240
  {
8095
8241
  className: clsx8({ "--selected": selected }),
@@ -8105,66 +8251,57 @@ function TableDialog({
8105
8251
 
8106
8252
  // src/toolbar-plugin/components/toolbar/toolbar.tsx
8107
8253
  import throttle2 from "lodash.throttle";
8108
- import { useEffect as useEffect8, useRef as useRef10, useState as useState11 } from "react";
8109
- import { useSlateStatic as useSlateStatic21 } from "slate-react";
8254
+ import { useEffect as useEffect8, useRef as useRef12, useState as useState11 } from "react";
8255
+ import { useSlateStatic as useSlateStatic20 } from "slate-react";
8110
8256
 
8111
8257
  // src/toolbar-plugin/icons.tsx
8112
- import { jsx as jsx58, jsxs as jsxs28 } from "react/jsx-runtime";
8113
- var H = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4" }) });
8114
- var More = () => /* @__PURE__ */ jsx58(TablerIcon, { className: "--more-icon", width: "0.5em", viewBox: "0 0 12 24", children: /* @__PURE__ */ jsx58("path", { d: "m2 12 4 4 4-4" }) });
8115
- var LinkPlus = () => /* @__PURE__ */ jsx58(TablerIcon, { width: "0.5em", viewBox: "6 0 12 24", children: /* @__PURE__ */ jsx58("path", { d: "M9 12h6M12 9v6" }) });
8116
- var H1 = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2" }) });
8117
- var H2 = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M17 12a2 2 0 1 1 4 0c0 .591-.417 1.318-.816 1.858L17 18.001h4M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2" }) });
8118
- var H3 = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M19 14a2 2 0 1 0-2-2M17 16a2 2 0 1 0 2-2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2" }) });
8119
- var Normal = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z" }) });
8120
- var Bold = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7" }) });
8121
- var Italic = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M11 5h6M7 19h6M14 5l-4 14" }) });
8258
+ import { jsx as jsx60, jsxs as jsxs28 } from "react/jsx-runtime";
8259
+ var H = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4" }) });
8260
+ var More = () => /* @__PURE__ */ jsx60(TablerIcon, { className: "--more-icon", width: "0.5em", viewBox: "0 0 12 24", children: /* @__PURE__ */ jsx60("path", { d: "m2 12 4 4 4-4" }) });
8261
+ var LinkPlus = () => /* @__PURE__ */ jsx60(TablerIcon, { width: "0.5em", viewBox: "6 0 12 24", children: /* @__PURE__ */ jsx60("path", { d: "M9 12h6M12 9v6" }) });
8262
+ var H1 = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2" }) });
8263
+ var H2 = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M17 12a2 2 0 1 1 4 0c0 .591-.417 1.318-.816 1.858L17 18.001h4M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2" }) });
8264
+ var H3 = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M19 14a2 2 0 1 0-2-2M17 16a2 2 0 1 0 2-2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2" }) });
8265
+ var Normal = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z" }) });
8266
+ var Bold = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7" }) });
8267
+ var Italic = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M11 5h6M7 19h6M14 5l-4 14" }) });
8122
8268
  var Link = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
8123
- /* @__PURE__ */ jsx58("path", { d: "M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5" }),
8124
- /* @__PURE__ */ jsx58("path", { d: "M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5" })
8269
+ /* @__PURE__ */ jsx60("path", { d: "M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5" }),
8270
+ /* @__PURE__ */ jsx60("path", { d: "M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5" })
8125
8271
  ] });
8126
- var Quote = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M10 11H6a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5M19 11h-4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5" }) });
8272
+ var Quote = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M10 11H6a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5M19 11h-4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5" }) });
8127
8273
  var DoubleQuote = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
8128
- /* @__PURE__ */ jsx58("path", { d: "M10 9l4 3-4 3" }),
8129
- /* @__PURE__ */ jsx58("path", { d: "M16 9l4 3-4 3" })
8274
+ /* @__PURE__ */ jsx60("path", { d: "M10 9l4 3-4 3" }),
8275
+ /* @__PURE__ */ jsx60("path", { d: "M16 9l4 3-4 3" })
8130
8276
  ] });
8131
- var BulletList = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01" }) });
8277
+ var BulletList = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01" }) });
8132
8278
  var Table2 = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
8133
- /* @__PURE__ */ jsx58("rect", { x: 4, y: 4, width: 16, height: 16, rx: 2 }),
8134
- /* @__PURE__ */ jsx58("path", { d: "M4 10h16M10 4v16" })
8279
+ /* @__PURE__ */ jsx60("rect", { x: 4, y: 4, width: 16, height: 16, rx: 2 }),
8280
+ /* @__PURE__ */ jsx60("path", { d: "M4 10h16M10 4v16" })
8135
8281
  ] });
8136
- var Code = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16" }) });
8137
- var CodeBlock2 = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M9 8L5 12L9 16M15 8L19 12L15 16" }) });
8282
+ var Code = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16" }) });
8283
+ var CodeBlock2 = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M9 8L5 12L9 16M15 8L19 12L15 16" }) });
8138
8284
  var Image = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
8139
- /* @__PURE__ */ jsx58("path", { d: "M15 8h.01" }),
8140
- /* @__PURE__ */ jsx58("rect", { x: 4, y: 4, width: 16, height: 16, rx: 3 }),
8141
- /* @__PURE__ */ jsx58("path", { d: "m4 15 4-4a3 5 0 0 1 3 0l5 5" }),
8142
- /* @__PURE__ */ jsx58("path", { d: "m14 14 1-1a3 5 0 0 1 3 0l2 2" })
8285
+ /* @__PURE__ */ jsx60("path", { d: "M15 8h.01" }),
8286
+ /* @__PURE__ */ jsx60("rect", { x: 4, y: 4, width: 16, height: 16, rx: 3 }),
8287
+ /* @__PURE__ */ jsx60("path", { d: "m4 15 4-4a3 5 0 0 1 3 0l5 5" }),
8288
+ /* @__PURE__ */ jsx60("path", { d: "m14 14 1-1a3 5 0 0 1 3 0l2 2" })
8143
8289
  ] });
8144
- var Plus = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M12 5v14M5 12h14" }) });
8145
- var Strikethrough = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M5 12h14M16 6.5A4 2 0 0 0 12 5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1-4-1.5" }) });
8146
- var Underline = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M7 5v5a5 5 0 0 0 10 0V5M5 19h14" }) });
8290
+ var Plus = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M12 5v14M5 12h14" }) });
8291
+ var Strikethrough = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M5 12h14M16 6.5A4 2 0 0 0 12 5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1-4-1.5" }) });
8292
+ var Underline = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M7 5v5a5 5 0 0 0 10 0V5M5 19h14" }) });
8147
8293
  var ListCheck = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
8148
- /* @__PURE__ */ jsx58("path", { d: "m9 11 3 3 8-8" }),
8149
- /* @__PURE__ */ jsx58("path", { d: "M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9" })
8150
- ] });
8151
- var ListNumbers = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6" }) });
8152
- var IncreaseDepth = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3" }) });
8153
- var DecreaseDepth = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3" }) });
8154
- var Markdown = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
8155
- /* @__PURE__ */ jsx58("path", { d: "M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z" }),
8156
- /* @__PURE__ */ jsx58("path", { d: "M7 15V9l2 2 2-2v6M14 9v6h4M14 13h2" })
8157
- ] });
8158
- var VisualEditor = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
8159
- /* @__PURE__ */ jsx58("path", { d: "M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z" }),
8160
- /* @__PURE__ */ jsx58("path", { d: "M8 8h8M8 12h8M8 16h5" }),
8161
- /* @__PURE__ */ jsx58("path", { d: "M16 16h1" })
8294
+ /* @__PURE__ */ jsx60("path", { d: "m9 11 3 3 8-8" }),
8295
+ /* @__PURE__ */ jsx60("path", { d: "M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9" })
8162
8296
  ] });
8297
+ var ListNumbers = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6" }) });
8298
+ var IncreaseDepth = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3" }) });
8299
+ var DecreaseDepth = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3" }) });
8300
+ var Close = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M18 6L6 18M6 6l12 12" }) });
8163
8301
  var Highlight = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
8164
- /* @__PURE__ */ jsx58("path", { d: "M3 19h4L17.5 8.5a2.828 2.828 0 1 0-4-4L3 15v4" }),
8165
- /* @__PURE__ */ jsx58("path", { d: "m12.5 5.5 4 4" }),
8166
- /* @__PURE__ */ jsx58("path", { d: "M3 21h7" }),
8167
- /* @__PURE__ */ jsx58("path", { d: "M18 19h3M19.5 17.5v3" })
8302
+ /* @__PURE__ */ jsx60("path", { d: "M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4" }),
8303
+ /* @__PURE__ */ jsx60("path", { d: "M13.5 6.5l4 4" }),
8304
+ /* @__PURE__ */ jsx60("path", { d: "m14 19 6-6M18 15l2 2M5 21h4" })
8168
8305
  ] });
8169
8306
 
8170
8307
  // src/toolbar-plugin/items/block-items.tsx
@@ -8173,17 +8310,15 @@ var listDepthItems = [
8173
8310
  icon: IncreaseDepth,
8174
8311
  title: t("increaseDepth"),
8175
8312
  hotkey: "tab",
8176
- action: (editor) => editor.list?.increaseDepth(),
8177
- active: (editor) => editor.list?.canIncreaseDepth() ?? false,
8178
- show: (editor) => !!editor.list
8313
+ action: (editor) => editor.list.increaseDepth(),
8314
+ active: (editor) => editor.list.canIncreaseDepth()
8179
8315
  },
8180
8316
  {
8181
8317
  icon: DecreaseDepth,
8182
8318
  title: t("decreaseDepth"),
8183
8319
  hotkey: "shift+tab",
8184
- action: (editor) => editor.list?.decreaseDepth(),
8185
- active: (editor) => editor.list?.canDecreaseDepth() ?? false,
8186
- show: (editor) => !!editor.list
8320
+ action: (editor) => editor.list.decreaseDepth(),
8321
+ active: (editor) => editor.list.canDecreaseDepth()
8187
8322
  }
8188
8323
  ];
8189
8324
  var blockItems = [
@@ -8228,33 +8363,51 @@ var compactBlockItems = [
8228
8363
  ];
8229
8364
 
8230
8365
  // src/toolbar-plugin/components/dialog/image-url-dialog.tsx
8231
- import { useState as useState9, useRef as useRef7, useEffect as useEffect7 } from "react";
8232
- import { useSlateStatic as useSlateStatic18 } from "slate-react";
8366
+ import { useState as useState9, useRef as useRef9, useEffect as useEffect7, useCallback as useCallback14 } from "react";
8367
+ import { useSlateStatic as useSlateStatic17 } from "slate-react";
8233
8368
 
8234
8369
  // src/toolbar-plugin/styles/file-dialog-styles.ts
8235
- import styled35 from "@emotion/styled";
8236
- var $FileDialog = styled35($Panel)`
8237
- padding: 1em;
8370
+ import styled36 from "@emotion/styled";
8371
+ var $FileDialog = styled36($Panel)`
8238
8372
  width: 18em;
8373
+ padding: 0;
8374
+ overflow: hidden;
8239
8375
  `;
8240
8376
 
8241
8377
  // src/toolbar-plugin/components/dialog/image-url-dialog.tsx
8242
- import { Fragment as Fragment8, jsx as jsx59, jsxs as jsxs29 } from "react/jsx-runtime";
8378
+ import { Fragment as Fragment8, jsx as jsx61, jsxs as jsxs29 } from "react/jsx-runtime";
8243
8379
  function ImageUrlDialog({
8244
8380
  dest,
8245
8381
  close
8246
8382
  }) {
8247
- const editor = useSlateStatic18();
8248
- const ref = useRef7(void 0);
8249
- const fileInputRef = useRef7(null);
8383
+ const editor = useSlateStatic17();
8384
+ const ref = useRef9(void 0);
8385
+ const fileInputRef = useRef9(null);
8386
+ const [dragOffset, setDragOffset] = useState9({ x: 0, y: 0 });
8387
+ const handleDrag = useCallback14((deltaX, deltaY) => {
8388
+ setDragOffset((prev) => ({ x: prev.x + deltaX, y: prev.y + deltaY }));
8389
+ }, []);
8250
8390
  const savedState = editor.wysimark?.imageDialogState;
8251
8391
  const hasOnImageChange = !!editor.wysimark?.onImageChange;
8252
8392
  const [url, setUrl] = useState9(savedState?.url ?? "");
8253
8393
  const [alt, setAlt] = useState9(savedState?.alt ?? "");
8254
8394
  const [title, setTitle] = useState9(savedState?.title ?? "");
8395
+ const [titleManuallyEdited, setTitleManuallyEdited] = useState9(false);
8255
8396
  const [imageSource, setImageSource] = useState9(savedState?.imageSource ?? (hasOnImageChange ? "file" : "url"));
8256
8397
  const [isUploading, setIsUploading] = useState9(false);
8257
8398
  const [uploadedUrl, setUploadedUrl] = useState9(savedState?.uploadedUrl ?? "");
8399
+ const [uploadedFileName, setUploadedFileName] = useState9("");
8400
+ const handleAltChange = useCallback14((e) => {
8401
+ const newAlt = e.target.value;
8402
+ setAlt(newAlt);
8403
+ if (!titleManuallyEdited) {
8404
+ setTitle(newAlt);
8405
+ }
8406
+ }, [titleManuallyEdited]);
8407
+ const handleTitleChange = useCallback14((e) => {
8408
+ setTitle(e.target.value);
8409
+ setTitleManuallyEdited(true);
8410
+ }, []);
8258
8411
  useEffect7(() => {
8259
8412
  if (editor.wysimark) {
8260
8413
  editor.wysimark.imageDialogState = { url, alt, title, imageSource, uploadedUrl };
@@ -8265,12 +8418,12 @@ function ImageUrlDialog({
8265
8418
  editor.wysimark.imageDialogState = void 0;
8266
8419
  }
8267
8420
  };
8268
- const style = useAbsoluteReposition(
8421
+ const baseStyle = useAbsoluteReposition(
8269
8422
  { src: ref, dest },
8270
- ({ src, dest: dest2 }) => {
8423
+ ({ src, dest: dest2 }, viewport) => {
8271
8424
  return positionInside(
8272
8425
  src,
8273
- dest2,
8426
+ viewport,
8274
8427
  {
8275
8428
  left: dest2.left - 16,
8276
8429
  top: dest2.top + dest2.height
@@ -8279,6 +8432,11 @@ function ImageUrlDialog({
8279
8432
  );
8280
8433
  }
8281
8434
  );
8435
+ const style = {
8436
+ ...baseStyle,
8437
+ left: baseStyle.left + dragOffset.x,
8438
+ top: baseStyle.top + dragOffset.y
8439
+ };
8282
8440
  function handleSubmit(e) {
8283
8441
  e.preventDefault();
8284
8442
  const finalUrl = imageSource === "file" ? uploadedUrl : url;
@@ -8296,6 +8454,7 @@ function ImageUrlDialog({
8296
8454
  const file = e.target.files?.[0];
8297
8455
  if (!file || !editor.wysimark?.onImageChange)
8298
8456
  return;
8457
+ setUploadedFileName(file.name);
8299
8458
  setIsUploading(true);
8300
8459
  try {
8301
8460
  const resultUrl = await editor.wysimark.onImageChange(file);
@@ -8311,198 +8470,196 @@ function ImageUrlDialog({
8311
8470
  }
8312
8471
  const isSubmitDisabled = imageSource === "file" ? uploadedUrl.trim() === "" || isUploading : url.trim() === "";
8313
8472
  return /* @__PURE__ */ jsxs29(Fragment8, { children: [
8314
- /* @__PURE__ */ jsx59(CloseMask, { close }),
8315
- /* @__PURE__ */ jsx59($FileDialog, { ref, style, children: /* @__PURE__ */ jsxs29("form", { onSubmit: handleSubmit, style: { padding: "8px" }, children: [
8316
- hasOnImageChange && /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "12px" }, children: [
8317
- /* @__PURE__ */ jsxs29("label", { style: { display: "inline-flex", alignItems: "center", marginRight: "16px", cursor: "pointer" }, children: [
8318
- /* @__PURE__ */ jsx59(
8473
+ /* @__PURE__ */ jsx61(CloseMask, { close }),
8474
+ /* @__PURE__ */ jsxs29($FileDialog, { ref, style, children: [
8475
+ /* @__PURE__ */ jsx61(DraggableHeader, { onDrag: handleDrag }),
8476
+ /* @__PURE__ */ jsxs29("form", { onSubmit: (e) => void handleSubmit(e), style: { padding: "8px" }, children: [
8477
+ hasOnImageChange && /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "12px" }, children: [
8478
+ /* @__PURE__ */ jsxs29("label", { style: { display: "inline-flex", alignItems: "center", marginRight: "16px", cursor: "pointer" }, children: [
8479
+ /* @__PURE__ */ jsx61(
8480
+ "input",
8481
+ {
8482
+ type: "radio",
8483
+ name: "imageSource",
8484
+ value: "file",
8485
+ checked: imageSource === "file",
8486
+ onChange: () => setImageSource("file"),
8487
+ style: { marginRight: "4px" }
8488
+ }
8489
+ ),
8490
+ t("imageSourceFile")
8491
+ ] }),
8492
+ /* @__PURE__ */ jsxs29("label", { style: { display: "inline-flex", alignItems: "center", cursor: "pointer" }, children: [
8493
+ /* @__PURE__ */ jsx61(
8494
+ "input",
8495
+ {
8496
+ type: "radio",
8497
+ name: "imageSource",
8498
+ value: "url",
8499
+ checked: imageSource === "url",
8500
+ onChange: () => setImageSource("url"),
8501
+ style: { marginRight: "4px" }
8502
+ }
8503
+ ),
8504
+ t("imageSourceUrl")
8505
+ ] })
8506
+ ] }),
8507
+ imageSource === "url" ? /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
8508
+ /* @__PURE__ */ jsx61("label", { style: { display: "block", marginBottom: "4px" }, children: t("imageUrlRequired") }),
8509
+ /* @__PURE__ */ jsx61(
8510
+ "input",
8511
+ {
8512
+ type: "text",
8513
+ value: url,
8514
+ onChange: (e) => setUrl(e.target.value),
8515
+ style: {
8516
+ width: "100%",
8517
+ padding: "6px",
8518
+ boxSizing: "border-box",
8519
+ border: "1px solid var(--shade-300)",
8520
+ borderRadius: "4px",
8521
+ backgroundColor: "var(--shade-50)",
8522
+ color: "var(--shade-700)"
8523
+ },
8524
+ placeholder: "https://example.com/image.jpg"
8525
+ }
8526
+ )
8527
+ ] }) : /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
8528
+ /* @__PURE__ */ jsx61(
8319
8529
  "input",
8320
8530
  {
8321
- type: "radio",
8322
- name: "imageSource",
8323
- value: "file",
8324
- checked: imageSource === "file",
8325
- onChange: () => setImageSource("file"),
8326
- style: { marginRight: "4px" }
8531
+ ref: fileInputRef,
8532
+ type: "file",
8533
+ accept: "image/*",
8534
+ onChange: (e) => void handleFileSelect(e),
8535
+ style: { display: "none" }
8327
8536
  }
8328
8537
  ),
8329
- t("imageSourceFile")
8538
+ /* @__PURE__ */ jsx61(
8539
+ "button",
8540
+ {
8541
+ type: "button",
8542
+ onClick: handleSelectFileClick,
8543
+ disabled: isUploading,
8544
+ style: {
8545
+ padding: "8px 16px",
8546
+ backgroundColor: isUploading ? "#ccc" : "#0078d4",
8547
+ color: isUploading ? "#666" : "white",
8548
+ border: "none",
8549
+ borderRadius: "4px",
8550
+ cursor: isUploading ? "not-allowed" : "pointer",
8551
+ marginBottom: "8px",
8552
+ fontWeight: "bold"
8553
+ },
8554
+ children: isUploading ? t("uploading") : t("selectFile")
8555
+ }
8556
+ ),
8557
+ uploadedUrl && /* @__PURE__ */ jsxs29("div", { style: { marginTop: "8px", padding: "8px", backgroundColor: "var(--shade-100)", borderRadius: "4px" }, children: [
8558
+ /* @__PURE__ */ jsxs29("div", { style: { color: "green", marginBottom: "4px" }, children: [
8559
+ "\u2713 ",
8560
+ t("uploadComplete")
8561
+ ] }),
8562
+ uploadedFileName && /* @__PURE__ */ jsx61("div", { style: { fontSize: "12px", color: "var(--shade-500)" }, children: uploadedFileName })
8563
+ ] })
8330
8564
  ] }),
8331
- /* @__PURE__ */ jsxs29("label", { style: { display: "inline-flex", alignItems: "center", cursor: "pointer" }, children: [
8332
- /* @__PURE__ */ jsx59(
8565
+ /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
8566
+ /* @__PURE__ */ jsx61("label", { style: { display: "block", marginBottom: "4px" }, children: t("altText") }),
8567
+ /* @__PURE__ */ jsx61(
8333
8568
  "input",
8334
8569
  {
8335
- type: "radio",
8336
- name: "imageSource",
8337
- value: "url",
8338
- checked: imageSource === "url",
8339
- onChange: () => setImageSource("url"),
8340
- style: { marginRight: "4px" }
8570
+ type: "text",
8571
+ value: alt,
8572
+ onChange: handleAltChange,
8573
+ style: {
8574
+ width: "100%",
8575
+ padding: "6px",
8576
+ boxSizing: "border-box",
8577
+ border: "1px solid var(--shade-300)",
8578
+ borderRadius: "4px",
8579
+ backgroundColor: "var(--shade-50)",
8580
+ color: "var(--shade-700)"
8581
+ },
8582
+ placeholder: t("imageDescription")
8341
8583
  }
8342
- ),
8343
- t("imageSourceUrl")
8344
- ] })
8345
- ] }),
8346
- imageSource === "url" ? /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
8347
- /* @__PURE__ */ jsx59("label", { style: { display: "block", marginBottom: "4px" }, children: t("imageUrlRequired") }),
8348
- /* @__PURE__ */ jsx59(
8349
- "input",
8350
- {
8351
- type: "text",
8352
- value: url,
8353
- onChange: (e) => setUrl(e.target.value),
8354
- style: {
8355
- width: "100%",
8356
- padding: "6px",
8357
- boxSizing: "border-box",
8358
- border: "1px solid #ccc",
8359
- borderRadius: "4px"
8360
- },
8361
- placeholder: "https://example.com/image.jpg"
8362
- }
8363
- )
8364
- ] }) : /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
8365
- /* @__PURE__ */ jsx59(
8366
- "input",
8367
- {
8368
- ref: fileInputRef,
8369
- type: "file",
8370
- accept: "image/*",
8371
- onChange: handleFileSelect,
8372
- style: { display: "none" }
8373
- }
8374
- ),
8375
- /* @__PURE__ */ jsx59(
8376
- "button",
8377
- {
8378
- type: "button",
8379
- onClick: handleSelectFileClick,
8380
- disabled: isUploading,
8381
- style: {
8382
- padding: "8px 16px",
8383
- backgroundColor: isUploading ? "#ccc" : "#f0f0f0",
8384
- border: "1px solid #ccc",
8385
- borderRadius: "4px",
8386
- cursor: isUploading ? "not-allowed" : "pointer",
8387
- marginBottom: "8px"
8388
- },
8389
- children: isUploading ? t("uploading") : t("selectFile")
8390
- }
8391
- ),
8392
- uploadedUrl && /* @__PURE__ */ jsxs29("div", { style: { marginTop: "8px" }, children: [
8393
- /* @__PURE__ */ jsx59("label", { style: { display: "block", marginBottom: "4px" }, children: t("imageUrlRequired") }),
8394
- /* @__PURE__ */ jsx59(
8584
+ )
8585
+ ] }),
8586
+ /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
8587
+ /* @__PURE__ */ jsx61("label", { style: { display: "block", marginBottom: "4px" }, children: t("title") }),
8588
+ /* @__PURE__ */ jsx61(
8395
8589
  "input",
8396
8590
  {
8397
8591
  type: "text",
8398
- value: uploadedUrl,
8399
- disabled: true,
8592
+ value: title,
8593
+ onChange: handleTitleChange,
8400
8594
  style: {
8401
8595
  width: "100%",
8402
8596
  padding: "6px",
8403
8597
  boxSizing: "border-box",
8404
- border: "1px solid #ccc",
8598
+ border: "1px solid var(--shade-300)",
8405
8599
  borderRadius: "4px",
8406
- backgroundColor: "#f5f5f5",
8407
- color: "#666"
8408
- }
8600
+ backgroundColor: "var(--shade-50)",
8601
+ color: "var(--shade-700)"
8602
+ },
8603
+ placeholder: t("imageTitle")
8604
+ }
8605
+ )
8606
+ ] }),
8607
+ /* @__PURE__ */ jsxs29("div", { style: { display: "flex", gap: "8px" }, children: [
8608
+ /* @__PURE__ */ jsx61(
8609
+ "button",
8610
+ {
8611
+ type: "submit",
8612
+ disabled: isSubmitDisabled,
8613
+ style: {
8614
+ display: "flex",
8615
+ alignItems: "center",
8616
+ padding: "8px 16px",
8617
+ backgroundColor: isSubmitDisabled ? "#ccc" : "#0078d4",
8618
+ color: "white",
8619
+ border: "none",
8620
+ borderRadius: "4px",
8621
+ cursor: isSubmitDisabled ? "not-allowed" : "pointer",
8622
+ fontWeight: "bold"
8623
+ },
8624
+ children: t("register")
8625
+ }
8626
+ ),
8627
+ /* @__PURE__ */ jsx61(
8628
+ "button",
8629
+ {
8630
+ type: "button",
8631
+ onClick: handleCancel,
8632
+ style: {
8633
+ padding: "8px 16px",
8634
+ backgroundColor: "var(--shade-100)",
8635
+ color: "var(--shade-700)",
8636
+ border: "1px solid var(--shade-300)",
8637
+ borderRadius: "4px",
8638
+ cursor: "pointer"
8639
+ },
8640
+ children: t("cancel")
8409
8641
  }
8410
8642
  )
8411
8643
  ] })
8412
- ] }),
8413
- /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
8414
- /* @__PURE__ */ jsx59("label", { style: { display: "block", marginBottom: "4px" }, children: t("altText") }),
8415
- /* @__PURE__ */ jsx59(
8416
- "input",
8417
- {
8418
- type: "text",
8419
- value: alt,
8420
- onChange: (e) => setAlt(e.target.value),
8421
- style: {
8422
- width: "100%",
8423
- padding: "6px",
8424
- boxSizing: "border-box",
8425
- border: "1px solid #ccc",
8426
- borderRadius: "4px"
8427
- },
8428
- placeholder: t("imageDescription")
8429
- }
8430
- )
8431
- ] }),
8432
- /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
8433
- /* @__PURE__ */ jsx59("label", { style: { display: "block", marginBottom: "4px" }, children: t("title") }),
8434
- /* @__PURE__ */ jsx59(
8435
- "input",
8436
- {
8437
- type: "text",
8438
- value: title,
8439
- onChange: (e) => setTitle(e.target.value),
8440
- style: {
8441
- width: "100%",
8442
- padding: "6px",
8443
- boxSizing: "border-box",
8444
- border: "1px solid #ccc",
8445
- borderRadius: "4px"
8446
- },
8447
- placeholder: t("imageTitle")
8448
- }
8449
- )
8450
- ] }),
8451
- /* @__PURE__ */ jsxs29("div", { style: { display: "flex", gap: "8px" }, children: [
8452
- /* @__PURE__ */ jsx59(
8453
- "button",
8454
- {
8455
- type: "submit",
8456
- disabled: isSubmitDisabled,
8457
- style: {
8458
- display: "flex",
8459
- alignItems: "center",
8460
- padding: "8px 16px",
8461
- backgroundColor: isSubmitDisabled ? "#ccc" : "#0078d4",
8462
- color: "white",
8463
- border: "none",
8464
- borderRadius: "4px",
8465
- cursor: isSubmitDisabled ? "not-allowed" : "pointer",
8466
- fontWeight: "bold"
8467
- },
8468
- children: t("register")
8469
- }
8470
- ),
8471
- /* @__PURE__ */ jsx59(
8472
- "button",
8473
- {
8474
- type: "button",
8475
- onClick: handleCancel,
8476
- style: {
8477
- padding: "8px 16px",
8478
- backgroundColor: "#f0f0f0",
8479
- color: "#333",
8480
- border: "1px solid #ccc",
8481
- borderRadius: "4px",
8482
- cursor: "pointer"
8483
- },
8484
- children: t("cancel")
8485
- }
8486
- )
8487
8644
  ] })
8488
- ] }) })
8645
+ ] })
8489
8646
  ] });
8490
8647
  }
8491
8648
 
8492
8649
  // src/toolbar-plugin/components/dialog/anchor-dialog.tsx
8493
8650
  import { isHotkey as isHotkey3 } from "is-hotkey";
8494
8651
  import {
8495
- useCallback as useCallback13,
8652
+ useCallback as useCallback15,
8496
8653
  useMemo as useMemo2,
8497
- useRef as useRef8,
8654
+ useRef as useRef10,
8498
8655
  useState as useState10
8499
8656
  } from "react";
8500
8657
  import { Editor as Editor59, Range as Range10 } from "slate";
8501
- import { ReactEditor as ReactEditor14, useSlateStatic as useSlateStatic19 } from "slate-react";
8658
+ import { ReactEditor as ReactEditor14, useSlateStatic as useSlateStatic18 } from "slate-react";
8502
8659
 
8503
8660
  // src/toolbar-plugin/styles/dialog-shared-styles.ts
8504
- import styled36 from "@emotion/styled";
8505
- var $DialogButton = styled36("div")`
8661
+ import styled37 from "@emotion/styled";
8662
+ var $DialogButton = styled37("div")`
8506
8663
  /* Center vertically and horizontally */
8507
8664
  display: flex;
8508
8665
  align-items: center;
@@ -8527,7 +8684,7 @@ var $DialogButton = styled36("div")`
8527
8684
  stroke-width: 2px;
8528
8685
  }
8529
8686
  `;
8530
- var $DialogHint = styled36("div")`
8687
+ var $DialogHint = styled37("div")`
8531
8688
  font-size: 0.875em;
8532
8689
  margin-top: 0.5em;
8533
8690
  color: var(--shade-500);
@@ -8535,15 +8692,19 @@ var $DialogHint = styled36("div")`
8535
8692
  `;
8536
8693
 
8537
8694
  // src/toolbar-plugin/components/dialog/anchor-dialog.tsx
8538
- import { Fragment as Fragment9, jsx as jsx60, jsxs as jsxs30 } from "react/jsx-runtime";
8695
+ import { Fragment as Fragment9, jsx as jsx62, jsxs as jsxs30 } from "react/jsx-runtime";
8539
8696
  var isEnter = isHotkey3("enter");
8540
8697
  function AnchorDialog2({
8541
8698
  dest,
8542
8699
  close
8543
8700
  }) {
8544
- const editor = useSlateStatic19();
8545
- const ref = useRef8(null);
8546
- const style = useAbsoluteReposition(
8701
+ const editor = useSlateStatic18();
8702
+ const ref = useRef10(null);
8703
+ const [dragOffset, setDragOffset] = useState10({ x: 0, y: 0 });
8704
+ const handleDrag = useCallback15((deltaX, deltaY) => {
8705
+ setDragOffset((prev) => ({ x: prev.x + deltaX, y: prev.y + deltaY }));
8706
+ }, []);
8707
+ const baseStyle = useAbsoluteReposition(
8547
8708
  { src: ref, dest },
8548
8709
  ({ src, dest: dest2 }, viewport) => {
8549
8710
  return positionInside(
@@ -8557,6 +8718,11 @@ function AnchorDialog2({
8557
8718
  );
8558
8719
  }
8559
8720
  );
8721
+ const style = {
8722
+ ...baseStyle,
8723
+ left: baseStyle.left + dragOffset.x,
8724
+ top: baseStyle.top + dragOffset.y
8725
+ };
8560
8726
  const initialText = useMemo2(() => {
8561
8727
  const { selection } = editor;
8562
8728
  if (selection && !Range10.isCollapsed(selection)) {
@@ -8575,13 +8741,13 @@ function AnchorDialog2({
8575
8741
  ReactEditor14.focus(editor);
8576
8742
  close();
8577
8743
  };
8578
- const onChangeUrl = useCallback13(
8744
+ const onChangeUrl = useCallback15(
8579
8745
  (e) => {
8580
8746
  setUrl(e.currentTarget.value);
8581
8747
  },
8582
8748
  [setUrl]
8583
8749
  );
8584
- const onChangeText = useCallback13(
8750
+ const onChangeText = useCallback15(
8585
8751
  (e) => {
8586
8752
  const newText = e.currentTarget.value;
8587
8753
  setText(newText);
@@ -8591,7 +8757,7 @@ function AnchorDialog2({
8591
8757
  },
8592
8758
  [setText, setTitle, titleManuallyEdited]
8593
8759
  );
8594
- const onChangeTitle = useCallback13(
8760
+ const onChangeTitle = useCallback15(
8595
8761
  (e) => {
8596
8762
  setTitle(e.currentTarget.value);
8597
8763
  setTitleManuallyEdited(true);
@@ -8606,46 +8772,50 @@ function AnchorDialog2({
8606
8772
  insertLink2();
8607
8773
  };
8608
8774
  return /* @__PURE__ */ jsxs30(Fragment9, { children: [
8609
- /* @__PURE__ */ jsx60(CloseMask, { close }),
8775
+ /* @__PURE__ */ jsx62(CloseMask, { close }),
8610
8776
  /* @__PURE__ */ jsxs30($AnchorDialog, { ref, style, children: [
8611
- /* @__PURE__ */ jsx60($AnchorDialogInputLine, { children: /* @__PURE__ */ jsx60(
8612
- $AnchorDialogInput,
8613
- {
8614
- type: "text",
8615
- value: url,
8616
- autoFocus: true,
8617
- placeholder: t("linkUrl"),
8618
- onChange: onChangeUrl,
8619
- onKeyDown
8620
- }
8621
- ) }),
8622
- /* @__PURE__ */ jsx60($AnchorDialogInputLine, { style: { marginTop: "0.5em" }, children: /* @__PURE__ */ jsx60(
8623
- $AnchorDialogInput,
8624
- {
8625
- type: "text",
8626
- value: text,
8627
- placeholder: t("linkText"),
8628
- onChange: onChangeText,
8629
- onKeyDown
8630
- }
8631
- ) }),
8632
- /* @__PURE__ */ jsxs30($AnchorDialogInputLine, { style: { marginTop: "0.5em" }, children: [
8633
- /* @__PURE__ */ jsx60(
8777
+ /* @__PURE__ */ jsx62(DraggableHeader, { onDrag: handleDrag }),
8778
+ /* @__PURE__ */ jsxs30("div", { style: { padding: "0.75em" }, children: [
8779
+ /* @__PURE__ */ jsx62($AnchorDialogInputLine, { children: /* @__PURE__ */ jsx62(
8634
8780
  $AnchorDialogInput,
8635
8781
  {
8636
8782
  type: "text",
8637
- value: title,
8638
- placeholder: t("tooltipText"),
8639
- onChange: onChangeTitle,
8783
+ value: url,
8784
+ autoFocus: true,
8785
+ placeholder: t("linkUrl"),
8786
+ onChange: onChangeUrl,
8640
8787
  onKeyDown
8641
8788
  }
8642
- ),
8643
- /* @__PURE__ */ jsxs30($DialogButton, { onClick: insertLink2, children: [
8644
- /* @__PURE__ */ jsx60(Link, {}),
8645
- /* @__PURE__ */ jsx60(LinkPlus, {})
8646
- ] })
8647
- ] }),
8648
- /* @__PURE__ */ jsx60($DialogHint, { children: t("tooltipHint") })
8789
+ ) }),
8790
+ /* @__PURE__ */ jsx62($AnchorDialogInputLine, { style: { marginTop: "0.5em" }, children: /* @__PURE__ */ jsx62(
8791
+ $AnchorDialogInput,
8792
+ {
8793
+ type: "text",
8794
+ value: text,
8795
+ placeholder: t("linkText"),
8796
+ onChange: onChangeText,
8797
+ onKeyDown
8798
+ }
8799
+ ) }),
8800
+ /* @__PURE__ */ jsxs30($AnchorDialogInputLine, { style: { marginTop: "0.5em" }, children: [
8801
+ /* @__PURE__ */ jsx62(
8802
+ $AnchorDialogInput,
8803
+ {
8804
+ type: "text",
8805
+ value: title,
8806
+ placeholder: t("tooltipText"),
8807
+ onChange: onChangeTitle,
8808
+ onKeyDown
8809
+ }
8810
+ ),
8811
+ /* @__PURE__ */ jsxs30($DialogButton, { onClick: insertLink2, children: [
8812
+ /* @__PURE__ */ jsx62(Link, {}),
8813
+ /* @__PURE__ */ jsx62(LinkPlus, {})
8814
+ ] }),
8815
+ /* @__PURE__ */ jsx62($DialogButton, { onClick: close, style: { marginLeft: "0.25em", background: "var(--shade-400)" }, children: /* @__PURE__ */ jsx62(Close, {}) })
8816
+ ] }),
8817
+ /* @__PURE__ */ jsx62($DialogHint, { children: t("tooltipHint") })
8818
+ ] })
8649
8819
  ] })
8650
8820
  ] });
8651
8821
  }
@@ -8735,9 +8905,10 @@ var primaryMarkItems = [
8735
8905
  {
8736
8906
  icon: Highlight,
8737
8907
  title: t("highlight"),
8908
+ hotkey: "mod+h",
8738
8909
  action: (editor) => editor.marksPlugin.toggleHighlight(),
8739
8910
  active: (editor) => getMarks(editor).highlight,
8740
- show: (editor) => !editor.wysimark?.disableHighlight
8911
+ show: (editor) => !editor.wysimark.disableHighlight
8741
8912
  }
8742
8913
  ];
8743
8914
  var expandedMarkItems = primaryMarkItems;
@@ -8756,22 +8927,20 @@ var listItems = [
8756
8927
  icon: BulletList,
8757
8928
  title: t("bulletList"),
8758
8929
  hotkey: "super+8",
8759
- action: (editor) => editor.list?.convertUnorderedList(true),
8760
- show: (editor) => !!editor.list
8930
+ action: (editor) => editor.list.convertUnorderedList(true)
8761
8931
  },
8762
8932
  {
8763
8933
  icon: ListNumbers,
8764
8934
  title: t("numberedList"),
8765
8935
  hotkey: "super+7",
8766
- action: (editor) => editor.list?.convertOrderedList(true),
8767
- show: (editor) => !!editor.list
8936
+ action: (editor) => editor.list.convertOrderedList(true)
8768
8937
  },
8769
8938
  {
8770
8939
  icon: ListCheck,
8771
8940
  title: t("checkList"),
8772
8941
  hotkey: "super+9",
8773
- action: (editor) => editor.list?.convertTaskList(true),
8774
- show: (editor) => !!editor.list && !editor.wysimark?.disableTaskList
8942
+ action: (editor) => editor.list.convertTaskList(true),
8943
+ show: (editor) => !editor.wysimark.disableTaskList
8775
8944
  }
8776
8945
  ];
8777
8946
  var expandedListItems = [...listItems, "divider", ...listDepthItems];
@@ -8780,13 +8949,12 @@ var compactListItems = [
8780
8949
  icon: ListNumbers,
8781
8950
  title: t("list"),
8782
8951
  more: true,
8783
- children: [...listItems, "divider", ...listDepthItems],
8784
- show: (editor) => !!editor.list
8952
+ children: [...listItems, "divider", ...listDepthItems]
8785
8953
  }
8786
8954
  ];
8787
8955
 
8788
8956
  // src/toolbar-plugin/items/quote-items.tsx
8789
- import { Editor as Editor61, Transforms as Transforms44 } from "slate";
8957
+ import { Editor as Editor61, Transforms as Transforms43 } from "slate";
8790
8958
  var quoteItemsList = [
8791
8959
  {
8792
8960
  icon: Quote,
@@ -8814,10 +8982,10 @@ var quoteItemsList = [
8814
8982
  const { selection } = editor;
8815
8983
  const codeBlockEntry = findElementUp(editor, "code-block");
8816
8984
  if (codeBlockEntry) {
8817
- const [codeBlock, path] = codeBlockEntry;
8985
+ const [, path] = codeBlockEntry;
8818
8986
  const textContent = Editor61.string(editor, path);
8819
- Transforms44.removeNodes(editor, { at: path });
8820
- Transforms44.insertNodes(
8987
+ Transforms43.removeNodes(editor, { at: path });
8988
+ Transforms43.insertNodes(
8821
8989
  editor,
8822
8990
  {
8823
8991
  type: "paragraph",
@@ -8828,13 +8996,13 @@ var quoteItemsList = [
8828
8996
  return;
8829
8997
  }
8830
8998
  if (selection && JSON.stringify(selection.anchor.path) !== JSON.stringify(selection.focus.path)) {
8831
- editor.codeBlock?.createCodeBlock({ language: "text" });
8999
+ editor.codeBlock.createCodeBlock({ language: "text" });
8832
9000
  return;
8833
9001
  }
8834
9002
  if (selection && (selection.anchor.offset !== selection.focus.offset || JSON.stringify(selection.anchor.path) !== JSON.stringify(selection.focus.path))) {
8835
9003
  const selectedText = Editor61.string(editor, selection);
8836
- Transforms44.delete(editor);
8837
- Transforms44.insertNodes(
9004
+ Transforms43.delete(editor);
9005
+ Transforms43.insertNodes(
8838
9006
  editor,
8839
9007
  {
8840
9008
  type: "code-block",
@@ -8849,10 +9017,10 @@ var quoteItemsList = [
8849
9017
  );
8850
9018
  return;
8851
9019
  }
8852
- editor.codeBlock?.createCodeBlock({ language: "text" });
9020
+ editor.codeBlock.createCodeBlock({ language: "text" });
8853
9021
  },
8854
9022
  active: (editor) => !!findElementUp(editor, "code-block"),
8855
- show: (editor) => !!editor.codeBlock && !editor.wysimark?.disableCodeBlock
9023
+ show: (editor) => !editor.wysimark.disableCodeBlock
8856
9024
  }
8857
9025
  ];
8858
9026
  var expandedQuoteItems = quoteItemsList;
@@ -8865,38 +9033,6 @@ var compactQuoteItems = [
8865
9033
  }
8866
9034
  ];
8867
9035
 
8868
- // src/toolbar-plugin/items/raw-mode-item.tsx
8869
- var rawModeItem = {
8870
- icon: Markdown,
8871
- title: t("switchToRawMarkdown"),
8872
- action: (editor) => {
8873
- if (editor.wysimark && typeof editor.wysimark.toggleRawMode === "function") {
8874
- editor.wysimark.toggleRawMode();
8875
- }
8876
- },
8877
- // Only show in the toolbar when not in Raw mode and toggleRawMode is available
8878
- show: (editor) => {
8879
- return editor.wysimark && typeof editor.wysimark.toggleRawMode === "function" && !editor.wysimark.isRawMode;
8880
- },
8881
- active: () => false
8882
- // Never show as active in the toolbar
8883
- };
8884
- var visualModeItem = {
8885
- icon: VisualEditor,
8886
- title: t("switchToVisualEditor"),
8887
- action: (editor) => {
8888
- if (editor.wysimark && typeof editor.wysimark.toggleRawMode === "function") {
8889
- editor.wysimark.toggleRawMode();
8890
- }
8891
- },
8892
- // Only show in the toolbar when in Raw mode
8893
- show: (editor) => {
8894
- return !!(editor.wysimark && editor.wysimark.isRawMode);
8895
- },
8896
- active: () => false
8897
- // Never show as active in the toolbar
8898
- };
8899
-
8900
9036
  // src/toolbar-plugin/items/index.tsx
8901
9037
  var largeItems = [
8902
9038
  ...expandedBlockItems,
@@ -8907,10 +9043,7 @@ var largeItems = [
8907
9043
  "divider",
8908
9044
  ...expandedDialogItems,
8909
9045
  "divider",
8910
- ...expandedQuoteItems,
8911
- "divider",
8912
- rawModeItem,
8913
- visualModeItem
9046
+ ...expandedQuoteItems
8914
9047
  ];
8915
9048
  var mediumItems = [
8916
9049
  ...compactBlockItems,
@@ -8921,10 +9054,7 @@ var mediumItems = [
8921
9054
  "divider",
8922
9055
  ...compactDialogItems,
8923
9056
  "divider",
8924
- ...expandedQuoteItems,
8925
- "divider",
8926
- rawModeItem,
8927
- visualModeItem
9057
+ ...expandedQuoteItems
8928
9058
  ];
8929
9059
  var smallItems = [
8930
9060
  ...compactBlockItems,
@@ -8935,44 +9065,41 @@ var smallItems = [
8935
9065
  "divider",
8936
9066
  ...smallDialogItems,
8937
9067
  "divider",
8938
- ...compactQuoteItems,
8939
- "divider",
8940
- rawModeItem,
8941
- visualModeItem
9068
+ ...compactQuoteItems
8942
9069
  ];
8943
9070
  var initialItems = smallItems;
8944
9071
  var itemSets = [largeItems, mediumItems, smallItems];
8945
9072
 
8946
9073
  // src/toolbar-plugin/components/toolbar/toolbar-button.tsx
8947
9074
  import { clsx as clsx9 } from "clsx";
8948
- import { useCallback as useCallback14, useRef as useRef9 } from "react";
8949
- import { ReactEditor as ReactEditor15, useSlate as useSlate2, useSlateStatic as useSlateStatic20 } from "slate-react";
8950
- import { jsx as jsx61, jsxs as jsxs31 } from "react/jsx-runtime";
9075
+ import { useCallback as useCallback16, useRef as useRef11 } from "react";
9076
+ import { ReactEditor as ReactEditor15, useSlate as useSlate2, useSlateStatic as useSlateStatic19 } from "slate-react";
9077
+ import { jsx as jsx63, jsxs as jsxs31 } from "react/jsx-runtime";
8951
9078
  function ToolbarButton({
8952
9079
  item
8953
9080
  }) {
8954
- const staticEditor = useSlateStatic20();
9081
+ const staticEditor = useSlateStatic19();
8955
9082
  const editor = useSlate2();
8956
9083
  const isActive = item.active ? item.active(editor) : false;
8957
- const ref = useRef9(null);
9084
+ const ref = useRef11(null);
8958
9085
  const tooltip = useTooltip({
8959
9086
  title: item.title,
8960
9087
  hotkey: () => item.hotkey ? formatHotkey(item.hotkey) : void 0
8961
9088
  });
8962
9089
  const menuLayer = useLayer("menu");
8963
- const openMenu = useCallback14(() => {
9090
+ const openMenu = useCallback16(() => {
8964
9091
  const dest = ref.current;
8965
9092
  const items = item.children;
8966
9093
  const Component = item.Component;
8967
9094
  if (!dest)
8968
9095
  return;
8969
9096
  if (items) {
8970
- menuLayer.open(() => /* @__PURE__ */ jsx61(Menu, { dest, items, close: menuLayer.close }));
9097
+ menuLayer.open(() => /* @__PURE__ */ jsx63(Menu, { dest, items, close: menuLayer.close }));
8971
9098
  } else if (Component) {
8972
- menuLayer.open(() => /* @__PURE__ */ jsx61(Component, { dest, close: menuLayer.close }));
9099
+ menuLayer.open(() => /* @__PURE__ */ jsx63(Component, { dest, close: menuLayer.close }));
8973
9100
  }
8974
9101
  }, [item]);
8975
- const onClick = useCallback14(() => {
9102
+ const onClick = useCallback16(() => {
8976
9103
  if (item.action) {
8977
9104
  item.action(staticEditor);
8978
9105
  ReactEditor15.focus(staticEditor);
@@ -8984,7 +9111,7 @@ function ToolbarButton({
8984
9111
  openMenu();
8985
9112
  }
8986
9113
  }, [menuLayer.layer, item]);
8987
- const onMouseEnter = useCallback14(
9114
+ const onMouseEnter = useCallback16(
8988
9115
  (e) => {
8989
9116
  tooltip.onMouseEnter(e);
8990
9117
  if (menuLayer.layer)
@@ -9006,24 +9133,24 @@ function ToolbarButton({
9006
9133
  "--disabled": !isActive && r(item?.title)?.includes("Depth")
9007
9134
  }),
9008
9135
  children: [
9009
- /* @__PURE__ */ jsx61(item.icon, {}),
9010
- item.more ? /* @__PURE__ */ jsx61(More, {}) : null
9136
+ /* @__PURE__ */ jsx63(item.icon, {}),
9137
+ item.more ? /* @__PURE__ */ jsx63(More, {}) : null
9011
9138
  ]
9012
9139
  }
9013
9140
  );
9014
9141
  }
9015
9142
 
9016
9143
  // src/toolbar-plugin/components/toolbar/toolbar.tsx
9017
- import { jsx as jsx62 } from "react/jsx-runtime";
9144
+ import { jsx as jsx64 } from "react/jsx-runtime";
9018
9145
  function ToolbarItem({ item }) {
9019
- const editor = useSlateStatic21();
9146
+ const editor = useSlateStatic20();
9020
9147
  if (item === "divider") {
9021
- return /* @__PURE__ */ jsx62($ToolbarDividerContainer, { "data-item-type": "divider", children: /* @__PURE__ */ jsx62($ToolbarDivider, {}) });
9148
+ return /* @__PURE__ */ jsx64($ToolbarDividerContainer, { "data-item-type": "divider", children: /* @__PURE__ */ jsx64($ToolbarDivider, {}) });
9022
9149
  }
9023
9150
  const show = item.show === void 0 ? true : item.show(editor);
9024
9151
  if (!show)
9025
9152
  return null;
9026
- return /* @__PURE__ */ jsx62(ToolbarButton, { item });
9153
+ return /* @__PURE__ */ jsx64(ToolbarButton, { item });
9027
9154
  }
9028
9155
  function getWidths(toolbar) {
9029
9156
  const button = toolbar.querySelector(
@@ -9049,7 +9176,7 @@ function measureItemSetWidth(items, buttonWidth, dividerWidth) {
9049
9176
  }
9050
9177
  var WIDTH_BUFFER_PX = 48;
9051
9178
  function Toolbar() {
9052
- const ref = useRef10(null);
9179
+ const ref = useRef12(null);
9053
9180
  const [items, setItems] = useState11(initialItems);
9054
9181
  useEffect8(() => {
9055
9182
  const refresh = throttle2(
@@ -9081,7 +9208,7 @@ function Toolbar() {
9081
9208
  window.removeEventListener("resize", refresh);
9082
9209
  };
9083
9210
  }, []);
9084
- return /* @__PURE__ */ jsx62($ToolbarContainer, { ref, children: /* @__PURE__ */ jsx62($Toolbar, { children: items.map((item, index) => /* @__PURE__ */ jsx62(
9211
+ return /* @__PURE__ */ jsx64($ToolbarContainer, { ref, children: /* @__PURE__ */ jsx64($Toolbar, { children: items.map((item, index) => /* @__PURE__ */ jsx64(
9085
9212
  ToolbarItem,
9086
9213
  {
9087
9214
  item
@@ -9091,21 +9218,21 @@ function Toolbar() {
9091
9218
  }
9092
9219
 
9093
9220
  // src/toolbar-plugin/render-editable/index.tsx
9094
- import { jsx as jsx63, jsxs as jsxs32 } from "react/jsx-runtime";
9221
+ import { jsx as jsx65, jsxs as jsxs32 } from "react/jsx-runtime";
9095
9222
  function renderEditable({ attributes, Editable: Editable3 }) {
9096
- const outerContainerRef = useRef11(null);
9097
- const editor = useSlateStatic22();
9223
+ const outerContainerRef = useRef13(null);
9224
+ const editor = useSlateStatic21();
9098
9225
  const focused = useFocused();
9099
- const onClickOuterContainer = useCallback15(
9226
+ const onClickOuterContainer = useCallback17(
9100
9227
  (e) => {
9101
9228
  if (e.target !== e.currentTarget)
9102
9229
  return;
9103
- Transforms45.select(editor, Editor62.end(editor, []));
9230
+ Transforms44.select(editor, Editor62.end(editor, []));
9104
9231
  ReactEditor16.focus(editor);
9105
9232
  },
9106
9233
  [editor]
9107
9234
  );
9108
- return /* @__PURE__ */ jsx63(Layers, { children: /* @__PURE__ */ jsxs32(
9235
+ return /* @__PURE__ */ jsx65(Layers, { children: /* @__PURE__ */ jsxs32(
9109
9236
  $OuterContainer,
9110
9237
  {
9111
9238
  ref: outerContainerRef,
@@ -9117,8 +9244,8 @@ function renderEditable({ attributes, Editable: Editable3 }) {
9117
9244
  },
9118
9245
  onClick: onClickOuterContainer,
9119
9246
  children: [
9120
- /* @__PURE__ */ jsx63(Toolbar, {}),
9121
- /* @__PURE__ */ jsx63(
9247
+ /* @__PURE__ */ jsx65(Toolbar, {}),
9248
+ /* @__PURE__ */ jsx65(
9122
9249
  Editable3,
9123
9250
  {
9124
9251
  as: $Editable,
@@ -9150,7 +9277,7 @@ var ToolbarPlugin = createPlugin(
9150
9277
  );
9151
9278
 
9152
9279
  // src/trailing-block-plugin/index.tsx
9153
- import { Editor as Editor63, Node as Node15, Path as Path16, Transforms as Transforms46 } from "slate";
9280
+ import { Editor as Editor63, Node as Node15, Path as Path16, Transforms as Transforms45 } from "slate";
9154
9281
  var TrailingBlockPlugin = createPlugin(
9155
9282
  (editor) => {
9156
9283
  editor.allowTrailingBlock = true;
@@ -9166,7 +9293,7 @@ var TrailingBlockPlugin = createPlugin(
9166
9293
  editor.children.length - 1
9167
9294
  );
9168
9295
  if (Editor63.hasBlocks(editor, lastElement) || Editor63.isVoid(editor, lastElement)) {
9169
- Transforms46.insertNodes(
9296
+ Transforms45.insertNodes(
9170
9297
  editor,
9171
9298
  { type: "paragraph", children: [{ text: "" }] },
9172
9299
  {
@@ -9182,11 +9309,11 @@ var TrailingBlockPlugin = createPlugin(
9182
9309
  );
9183
9310
 
9184
9311
  // src/paste-markdown-plugin/methods/index.ts
9185
- import { Transforms as Transforms47 } from "slate";
9312
+ import { Transforms as Transforms46 } from "slate";
9186
9313
  function pasteMarkdown(editor, markdown) {
9187
9314
  const escapedMarkdown = escapeUrlSlashes(markdown);
9188
9315
  const fragment = parse(escapedMarkdown);
9189
- Transforms47.insertNodes(editor, fragment);
9316
+ Transforms46.insertNodes(editor, fragment);
9190
9317
  }
9191
9318
  function createPasteMarkdownMethods(editor) {
9192
9319
  return {
@@ -9218,7 +9345,7 @@ var PasteMarkdownPlugin = createPlugin(
9218
9345
  );
9219
9346
 
9220
9347
  // src/placeholder-plugin/index.tsx
9221
- import { jsx as jsx64 } from "react/jsx-runtime";
9348
+ import { jsx as jsx66 } from "react/jsx-runtime";
9222
9349
  function renderPlaceholder(props) {
9223
9350
  const nextAttributes = {
9224
9351
  ...props.attributes,
@@ -9228,7 +9355,7 @@ function renderPlaceholder(props) {
9228
9355
  maxWidth: void 0
9229
9356
  }
9230
9357
  };
9231
- return /* @__PURE__ */ jsx64("span", { ...nextAttributes, children: props.children });
9358
+ return /* @__PURE__ */ jsx66("span", { ...nextAttributes, children: props.children });
9232
9359
  }
9233
9360
  var PlaceholderPlugin = createPlugin(
9234
9361
  (editor, _options, { createPolicy }) => {
@@ -9243,7 +9370,7 @@ var PlaceholderPlugin = createPlugin(
9243
9370
  );
9244
9371
 
9245
9372
  // src/entry/plugins.ts
9246
- var defaultPlugins = [
9373
+ var plugins = [
9247
9374
  PasteMarkdownPlugin,
9248
9375
  ConvertElementPlugin,
9249
9376
  AnchorPlugin,
@@ -9267,11 +9394,12 @@ var defaultPlugins = [
9267
9394
  ];
9268
9395
 
9269
9396
  // src/entry/SinkEditable.tsx
9270
- var { withSink, SinkEditable: SinkEditable2 } = createSink(defaultPlugins);
9397
+ var Sink = createSink(plugins);
9398
+ var { withSink, SinkEditable: SinkEditable2 } = Sink;
9271
9399
 
9272
9400
  // src/entry/useEditor.tsx
9273
9401
  import { useState as useState12 } from "react";
9274
- import { createEditor, Editor as Editor65, Transforms as Transforms48 } from "slate";
9402
+ import { createEditor, Editor as Editor65, Transforms as Transforms47 } from "slate";
9275
9403
  import { withHistory } from "slate-history";
9276
9404
  import { withReact } from "slate-react";
9277
9405
  function useEditor({
@@ -9317,7 +9445,7 @@ function useEditor({
9317
9445
  const documentValue = parse(escapedMarkdown);
9318
9446
  editor2.children = documentValue;
9319
9447
  editor2.selection = null;
9320
- Transforms48.select(editor2, Editor65.start(editor2, [0]));
9448
+ Transforms47.select(editor2, Editor65.start(editor2, [0]));
9321
9449
  };
9322
9450
  return nextEditor;
9323
9451
  });
@@ -9325,9 +9453,9 @@ function useEditor({
9325
9453
  }
9326
9454
 
9327
9455
  // src/entry/index.tsx
9328
- import { jsx as jsx65, jsxs as jsxs33 } from "react/jsx-runtime";
9456
+ import { jsx as jsx67, jsxs as jsxs33 } from "react/jsx-runtime";
9329
9457
  function renderLeaf({ children, attributes }) {
9330
- return /* @__PURE__ */ jsx65("span", { ...attributes, children });
9458
+ return /* @__PURE__ */ jsx67("span", { ...attributes, children });
9331
9459
  }
9332
9460
  function Editable2({
9333
9461
  editor,
@@ -9341,19 +9469,18 @@ function Editable2({
9341
9469
  }) {
9342
9470
  const [isRawMode, setIsRawMode] = useState13(false);
9343
9471
  const [rawText, setRawText] = useState13(value);
9344
- const ignoreNextChangeRef = useRef12(false);
9345
- const initialValueRef = useRef12(void 0);
9346
- const prevValueRef = useRef12(void 0);
9347
- const lastEmittedValueRef = useRef12(void 0);
9348
- const onThrottledSlateChange = useCallback16(
9472
+ const ignoreNextChangeRef = useRef14(false);
9473
+ const initialValueRef = useRef14(void 0);
9474
+ const prevValueRef = useRef14(void 0);
9475
+ const pendingRawTextRef = useRef14(null);
9476
+ const onThrottledSlateChange = useCallback18(
9349
9477
  throttle3(
9350
9478
  () => {
9351
- const markdown = unescapeUrlSlashes(serialize(editor.children));
9479
+ const markdown = serialize(editor.children);
9352
9480
  editor.wysimark.prevValue = {
9353
9481
  markdown,
9354
9482
  children: editor.children
9355
9483
  };
9356
- lastEmittedValueRef.current = markdown;
9357
9484
  onChange(markdown);
9358
9485
  },
9359
9486
  throttleInMs,
@@ -9361,53 +9488,45 @@ function Editable2({
9361
9488
  ),
9362
9489
  [editor, onChange, throttleInMs]
9363
9490
  );
9364
- const onSlateChange = useCallback16(
9365
- (nextValue) => {
9366
- if (ignoreNextChangeRef.current) {
9367
- ignoreNextChangeRef.current = false;
9368
- prevValueRef.current = nextValue;
9369
- return;
9370
- }
9371
- prevValueRef.current = nextValue;
9372
- onThrottledSlateChange();
9373
- },
9374
- [onThrottledSlateChange]
9375
- );
9376
- if (editor.wysimark.prevValue == null || initialValueRef.current == null) {
9377
- ignoreNextChangeRef.current = true;
9378
- const valueToProcess = isRawMode ? value : escapeUrlSlashes(value);
9379
- const children = parse(valueToProcess);
9380
- editor.children = children;
9381
- prevValueRef.current = initialValueRef.current = children;
9382
- editor.wysimark.prevValue = {
9383
- markdown: value,
9384
- // Store the original unescaped value
9385
- children
9386
- };
9387
- lastEmittedValueRef.current = value;
9388
- } else {
9389
- if (isRawMode) {
9390
- editor.wysimark.prevValue.markdown = value;
9391
- lastEmittedValueRef.current = value;
9491
+ const onSlateChange = useCallback18(() => {
9492
+ if (prevValueRef.current === editor.children) {
9493
+ return;
9494
+ }
9495
+ prevValueRef.current = editor.children;
9496
+ onThrottledSlateChange();
9497
+ }, [onThrottledSlateChange]);
9498
+ if (!isRawMode) {
9499
+ const markdownToUse = pendingRawTextRef.current ?? value;
9500
+ if (pendingRawTextRef.current !== null) {
9501
+ pendingRawTextRef.current = null;
9502
+ }
9503
+ if (editor.wysimark.prevValue == null || initialValueRef.current == null) {
9504
+ ignoreNextChangeRef.current = true;
9505
+ const valueToProcess = escapeUrlSlashes(markdownToUse);
9506
+ const children = parse(valueToProcess);
9507
+ editor.children = children;
9508
+ prevValueRef.current = initialValueRef.current = children;
9509
+ editor.wysimark.prevValue = {
9510
+ markdown: markdownToUse,
9511
+ children
9512
+ };
9392
9513
  } else {
9393
- const diffFromPrevValue = value !== editor.wysimark.prevValue.markdown;
9394
- const diffFromLastEmitted = value !== lastEmittedValueRef.current;
9395
- if (diffFromPrevValue && diffFromLastEmitted) {
9514
+ if (markdownToUse !== editor.wysimark.prevValue.markdown) {
9396
9515
  ignoreNextChangeRef.current = true;
9397
- const valueToProcess = escapeUrlSlashes(value);
9516
+ const valueToProcess = escapeUrlSlashes(markdownToUse);
9398
9517
  const documentValue = parse(valueToProcess);
9399
9518
  editor.children = documentValue;
9400
9519
  editor.selection = null;
9401
- Transforms49.select(editor, Editor66.start(editor, [0]));
9520
+ Transforms48.select(editor, Editor66.start(editor, [0]));
9402
9521
  }
9403
9522
  }
9404
9523
  }
9405
- const onSinkeEditableMouseDown = useCallback16(() => {
9524
+ const onSinkeEditableMouseDown = useCallback18(() => {
9406
9525
  if (navigator.userAgent.toLowerCase().includes("firefox")) {
9407
9526
  ReactEditor18.focus(editor);
9408
9527
  }
9409
9528
  }, [editor]);
9410
- const onBlur = useCallback16(() => {
9529
+ const onBlur = useCallback18(() => {
9411
9530
  onThrottledSlateChange.flush();
9412
9531
  }, [onThrottledSlateChange]);
9413
9532
  const handleRawTextChange = (e) => {
@@ -9415,46 +9534,43 @@ function Editable2({
9415
9534
  setRawText(newText);
9416
9535
  onChange(newText);
9417
9536
  };
9418
- const applyRawTextToEditor = useCallback16(() => {
9419
- if (rawText !== editor.getMarkdown()) {
9420
- editor.setMarkdown(rawText);
9421
- }
9422
- }, [editor, rawText]);
9423
- const updateRawTextFromEditor = useCallback16(() => {
9424
- setRawText(value);
9425
- }, [value]);
9426
- const handleRawModeToggle = useCallback16(() => {
9537
+ const updateRawTextFromEditor = useCallback18(() => {
9538
+ const currentMarkdown = editor.getMarkdown();
9539
+ setRawText(currentMarkdown);
9540
+ }, [editor]);
9541
+ const handleRawModeToggle = () => {
9427
9542
  if (isRawMode) {
9428
- applyRawTextToEditor();
9543
+ pendingRawTextRef.current = rawText;
9544
+ editor.wysimark.prevValue = void 0;
9545
+ initialValueRef.current = void 0;
9546
+ prevValueRef.current = void 0;
9429
9547
  } else {
9430
9548
  updateRawTextFromEditor();
9431
9549
  }
9432
9550
  setIsRawMode(!isRawMode);
9433
- }, [isRawMode, applyRawTextToEditor, updateRawTextFromEditor]);
9434
- editor.wysimark.isRawMode = isRawMode;
9435
- if (!editor.wysimark.disableRawMode) {
9436
- editor.wysimark.toggleRawMode = handleRawModeToggle;
9437
- }
9551
+ };
9438
9552
  editor.wysimark.onImageChange = onImageChange;
9553
+ editor.wysimark.onChange = onChange;
9554
+ const disableRawMode = editor.wysimark.disableRawMode;
9439
9555
  return /* @__PURE__ */ jsxs33("div", { style: { position: "relative" }, children: [
9440
- isRawMode && /* @__PURE__ */ jsx65("div", { style: { position: "absolute", top: "5px", right: "25px", zIndex: 10 }, children: /* @__PURE__ */ jsx65(
9556
+ !disableRawMode && /* @__PURE__ */ jsx67("div", { style: { position: "absolute", top: "5px", right: "25px", zIndex: 10 }, children: /* @__PURE__ */ jsx67(
9441
9557
  "div",
9442
9558
  {
9443
9559
  onClick: handleRawModeToggle,
9444
9560
  style: {
9445
9561
  background: "none",
9446
- border: "1px solid #4a90e2",
9562
+ border: isRawMode ? "1px solid #4a90e2" : "1px solid transparent",
9447
9563
  cursor: "pointer",
9448
9564
  padding: "6px",
9449
9565
  borderRadius: "4px",
9450
- backgroundColor: "rgba(74, 144, 226, 0.1)",
9451
- boxShadow: "0 1px 3px rgba(0, 0, 0, 0.1)",
9566
+ backgroundColor: isRawMode ? "rgba(74, 144, 226, 0.1)" : "transparent",
9567
+ boxShadow: isRawMode ? "0 1px 3px rgba(0, 0, 0, 0.1)" : "none",
9452
9568
  transition: "all 0.2s ease-in-out",
9453
9569
  display: "flex",
9454
9570
  alignItems: "center",
9455
9571
  justifyContent: "center"
9456
9572
  },
9457
- title: t("switchToVisualEditor"),
9573
+ title: isRawMode ? t("switchToVisualEditor") : t("switchToRawMarkdown"),
9458
9574
  role: "button",
9459
9575
  tabIndex: 0,
9460
9576
  onKeyDown: (e) => {
@@ -9463,10 +9579,54 @@ function Editable2({
9463
9579
  e.preventDefault();
9464
9580
  }
9465
9581
  },
9466
- children: /* @__PURE__ */ jsx65("span", { style: { color: "#4a90e2", fontSize: "1.25em" }, children: /* @__PURE__ */ jsx65(VisualEditor, {}) })
9582
+ children: /* @__PURE__ */ jsxs33("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
9583
+ /* @__PURE__ */ jsx67(
9584
+ "rect",
9585
+ {
9586
+ x: "3",
9587
+ y: "3",
9588
+ width: "18",
9589
+ height: "18",
9590
+ rx: "2",
9591
+ stroke: isRawMode ? "#4a90e2" : "currentColor",
9592
+ strokeWidth: "1.5",
9593
+ fill: isRawMode ? "rgba(74, 144, 226, 0.05)" : "transparent"
9594
+ }
9595
+ ),
9596
+ /* @__PURE__ */ jsx67(
9597
+ "path",
9598
+ {
9599
+ d: "M7 15V9L10 12L13 9V15",
9600
+ stroke: isRawMode ? "#4a90e2" : "currentColor",
9601
+ strokeWidth: "1.5",
9602
+ strokeLinecap: "round",
9603
+ strokeLinejoin: "round"
9604
+ }
9605
+ ),
9606
+ /* @__PURE__ */ jsx67(
9607
+ "path",
9608
+ {
9609
+ d: "M16 9H18V15",
9610
+ stroke: isRawMode ? "#4a90e2" : "currentColor",
9611
+ strokeWidth: "1.5",
9612
+ strokeLinecap: "round",
9613
+ strokeLinejoin: "round"
9614
+ }
9615
+ ),
9616
+ /* @__PURE__ */ jsx67(
9617
+ "path",
9618
+ {
9619
+ d: "M16 12H18",
9620
+ stroke: isRawMode ? "#4a90e2" : "currentColor",
9621
+ strokeWidth: "1.5",
9622
+ strokeLinecap: "round",
9623
+ strokeLinejoin: "round"
9624
+ }
9625
+ )
9626
+ ] })
9467
9627
  }
9468
9628
  ) }),
9469
- /* @__PURE__ */ jsx65("div", { style: { display: isRawMode ? "block" : "none", textAlign: "center" }, children: /* @__PURE__ */ jsx65(
9629
+ /* @__PURE__ */ jsx67("div", { style: { display: isRawMode ? "block" : "none", textAlign: "center" }, children: /* @__PURE__ */ jsx67(
9470
9630
  "textarea",
9471
9631
  {
9472
9632
  value: unescapeUrlSlashes(rawText).replace(/&nbsp;/g, ""),
@@ -9475,9 +9635,7 @@ function Editable2({
9475
9635
  className,
9476
9636
  style: {
9477
9637
  width: "calc(100% - 60px)",
9478
- /* Full width minus 200px on each side */
9479
9638
  margin: "0 auto",
9480
- /* Center the textarea */
9481
9639
  minHeight: "200px",
9482
9640
  padding: "20px",
9483
9641
  fontFamily: "monospace",
@@ -9491,13 +9649,13 @@ function Editable2({
9491
9649
  }
9492
9650
  }
9493
9651
  ) }),
9494
- /* @__PURE__ */ jsx65("div", { style: { display: isRawMode ? "none" : "block" }, children: /* @__PURE__ */ jsx65(
9652
+ /* @__PURE__ */ jsx67("div", { style: { display: isRawMode ? "none" : "block" }, children: /* @__PURE__ */ jsx67(
9495
9653
  Slate2,
9496
9654
  {
9497
9655
  editor,
9498
- initialValue: initialValueRef.current ?? editor.children,
9656
+ initialValue: initialValueRef.current,
9499
9657
  onChange: onSlateChange,
9500
- children: /* @__PURE__ */ jsx65(
9658
+ children: /* @__PURE__ */ jsx67(
9501
9659
  SinkEditable2,
9502
9660
  {
9503
9661
  renderLeaf,
@@ -9514,13 +9672,13 @@ function Editable2({
9514
9672
  }
9515
9673
 
9516
9674
  // src/index.tsx
9517
- import { jsx as jsx66 } from "react/jsx-runtime";
9675
+ import { jsx as jsx68 } from "react/jsx-runtime";
9518
9676
  function StandaloneEditor({
9519
9677
  standaloneOptions: { onChange, placeholder, className, ...options },
9520
9678
  standaloneMethodsRef
9521
9679
  }) {
9522
9680
  const [markdown, setMarkdown] = useState14(options.initialMarkdown || "");
9523
- const markdownRef = useRef13(markdown);
9681
+ const markdownRef = useRef15(markdown);
9524
9682
  const editor = useEditor(options);
9525
9683
  markdownRef.current = markdown;
9526
9684
  useImperativeHandle(
@@ -9538,7 +9696,7 @@ function StandaloneEditor({
9538
9696
  },
9539
9697
  [markdownRef, setMarkdown]
9540
9698
  );
9541
- const onChangeEditable = useCallback17(
9699
+ const onChangeEditable = useCallback19(
9542
9700
  (markdown2) => {
9543
9701
  markdownRef.current = markdown2;
9544
9702
  setMarkdown(markdown2);
@@ -9546,7 +9704,7 @@ function StandaloneEditor({
9546
9704
  },
9547
9705
  [editor]
9548
9706
  );
9549
- return /* @__PURE__ */ jsx66(
9707
+ return /* @__PURE__ */ jsx68(
9550
9708
  Editable2,
9551
9709
  {
9552
9710
  editor,
@@ -9561,7 +9719,7 @@ function createWysimark(containerElement, options) {
9561
9719
  const standaloneMethodsRef = createRef();
9562
9720
  const root = createRoot(containerElement);
9563
9721
  root.render(
9564
- /* @__PURE__ */ jsx66(
9722
+ /* @__PURE__ */ jsx68(
9565
9723
  StandaloneEditor,
9566
9724
  {
9567
9725
  standaloneMethodsRef,
@@ -9573,7 +9731,7 @@ function createWysimark(containerElement, options) {
9573
9731
  unmount() {
9574
9732
  try {
9575
9733
  root.unmount();
9576
- } catch (e) {
9734
+ } catch {
9577
9735
  }
9578
9736
  },
9579
9737
  getMarkdown() {