wysimark-lite 0.16.3 → 0.17.0

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
@@ -1,17 +1,17 @@
1
1
  // src/index.tsx
2
2
  import {
3
3
  createRef,
4
- useCallback as useCallback16,
4
+ useCallback as useCallback17,
5
5
  useImperativeHandle,
6
- useRef as useRef13,
6
+ useRef as useRef14,
7
7
  useState as useState13
8
8
  } from "react";
9
9
  import { createRoot } from "react-dom/client";
10
10
 
11
11
  // src/entry/index.tsx
12
12
  import throttle3 from "lodash.throttle";
13
- import { useCallback as useCallback15, useRef as useRef12, useState as useState12 } from "react";
14
- import { Editor as Editor59, Transforms as Transforms41 } from "slate";
13
+ import { useCallback as useCallback16, useRef as useRef13, useState as useState12 } from "react";
14
+ import { Editor as Editor63, Transforms as Transforms45 } from "slate";
15
15
  import { ReactEditor as ReactEditor17, Slate as Slate2 } from "slate-react";
16
16
 
17
17
  // src/convert/parse/index.ts
@@ -183,6 +183,21 @@ function parseBlockquote(content) {
183
183
  return [{ type: "block-quote", children: parseContents(content.children) }];
184
184
  }
185
185
 
186
+ // src/convert/parse/parse-code-block.ts
187
+ function parseCodeBlock(content) {
188
+ const codeLines = content.value.split("\n");
189
+ return [
190
+ {
191
+ type: "code-block",
192
+ language: content.lang || "text",
193
+ children: codeLines.map((codeLine) => ({
194
+ type: "code-block-line",
195
+ children: [{ text: codeLine }]
196
+ }))
197
+ }
198
+ ];
199
+ }
200
+
186
201
  // src/convert/parse/parse-footnote-definition.ts
187
202
  function parseFootnoteDefinition(footnote) {
188
203
  return [
@@ -618,8 +633,12 @@ function parseHeading(content) {
618
633
  function parseHTML(content) {
619
634
  return [
620
635
  {
621
- type: "paragraph",
622
- children: [{ text: content.value }]
636
+ type: "code-block",
637
+ language: "html",
638
+ children: content.value.split("\n").map((line) => ({
639
+ type: "code-block-line",
640
+ children: [{ text: line }]
641
+ }))
623
642
  }
624
643
  ];
625
644
  }
@@ -789,7 +808,7 @@ function parseContent(content) {
789
808
  case "blockquote":
790
809
  return parseBlockquote(content);
791
810
  case "code":
792
- return [];
811
+ return parseCodeBlock(content);
793
812
  case "definition":
794
813
  throw new Error(`The type "definition" should not exist. See comments`);
795
814
  case "footnoteDefinition":
@@ -876,6 +895,37 @@ function normalizeElementListDepths(elements) {
876
895
  return normalizedElements;
877
896
  }
878
897
 
898
+ // src/convert/serialize/serialize-code-block/serialize-code-line.ts
899
+ function serializeCodeLine(codeLine) {
900
+ if (codeLine.type !== "code-block-line")
901
+ throw new Error(
902
+ `Expected all children of code-block to be a codeline but is ${JSON.stringify(
903
+ codeLine,
904
+ null,
905
+ 2
906
+ )}`
907
+ );
908
+ return codeLine.children.map((segment) => segment.text).join("");
909
+ }
910
+
911
+ // src/convert/serialize/serialize-code-block/index.ts
912
+ function serializeCodeBlock(codeBlock) {
913
+ const lines = [];
914
+ let backticks = 3;
915
+ for (const codeLine of codeBlock.children) {
916
+ const lineOfCode = serializeCodeLine(codeLine);
917
+ const match = lineOfCode.match(/^([`]+)/);
918
+ if (match)
919
+ backticks = Math.max(backticks, match[1].length + 1);
920
+ lines.push(lineOfCode);
921
+ }
922
+ lines.unshift(`${"`".repeat(backticks)}${codeBlock.language}`);
923
+ lines.push(`${"`".repeat(backticks)}`);
924
+ return `${lines.join("\n")}
925
+
926
+ `;
927
+ }
928
+
879
929
  // src/convert/serialize/serialize-image-shared/serialize-generic-image-url.ts
880
930
  function serializeGenericImageUrl(image) {
881
931
  return image.url;
@@ -1442,6 +1492,12 @@ function serializeElement(element, orders) {
1442
1492
  }
1443
1493
  case "image-block":
1444
1494
  return serializeImageBlock(element);
1495
+ case "code-block":
1496
+ return serializeCodeBlock(element);
1497
+ case "code-block-line":
1498
+ throw new Error(
1499
+ `Code block line elements should only be present as children of code-block which should be handled by serializeCodeBlock. Got code-block-line may indicate an error in normalization.`
1500
+ );
1445
1501
  }
1446
1502
  assertUnreachable(element);
1447
1503
  }
@@ -1514,19 +1570,22 @@ var translations = {
1514
1570
  tooltipHint: "\u30DE\u30A6\u30B9\u30DB\u30D0\u30FC\u6642\u306B\u8868\u793A\u3055\u308C\u308B\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",
1515
1571
  apply: "\u9069\u7528",
1516
1572
  cancel: "\u30AD\u30E3\u30F3\u30BB\u30EB",
1517
- insertLink: "\u30EA\u30F3\u30AF\u306E\u633F\u5165",
1573
+ insertLink: "\u30EA\u30F3\u30AF",
1518
1574
  quote: "\u5F15\u7528",
1519
- insertTable: "\u8868\u306E\u633F\u5165",
1520
- insertImage: "\u753B\u50CF\u306E\u633F\u5165",
1521
- insertImageFromUrl: "URL\u304B\u3089\u753B\u50CF\u3092\u633F\u5165",
1575
+ insertTable: "\u8868",
1576
+ insertImage: "\u753B\u50CF",
1577
+ insertImageFromUrl: "\u753B\u50CF",
1522
1578
  insert: "\u633F\u5165",
1579
+ format: "\u66F8\u5F0F",
1523
1580
  imageUrlRequired: "\u753B\u50CFURL\uFF08\u5FC5\u9808\uFF09\uFF1A",
1524
1581
  altText: "\u4EE3\u66FF\u30C6\u30AD\u30B9\u30C8\uFF1A",
1525
- title: "\u30BF\u30A4\u30C8\u30EB\uFF1A",
1582
+ title: "\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\uFF1A",
1526
1583
  imageDescription: "\u753B\u50CF\u306E\u8AAC\u660E",
1527
- imageTitle: "\u753B\u50CF\u306E\u30BF\u30A4\u30C8\u30EB",
1584
+ imageTitle: "\u753B\u50CF\u306E\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",
1528
1585
  switchToVisualEditor: "\u30D3\u30B8\u30E5\u30A2\u30EB\u30A8\u30C7\u30A3\u30BF\u306B\u5207\u308A\u66FF\u3048",
1529
- switchToRawMarkdown: "\u30DE\u30FC\u30AF\u30C0\u30A6\u30F3\u8868\u793A\u306B\u5207\u308A\u66FF\u3048"
1586
+ switchToRawMarkdown: "\u30DE\u30FC\u30AF\u30C0\u30A6\u30F3\u8868\u793A\u306B\u5207\u308A\u66FF\u3048",
1587
+ codeBlock: "\u30B3\u30FC\u30C9\u30D6\u30ED\u30C3\u30AF",
1588
+ increaseQuoteDepth: "\u5F15\u7528\u3092\u91CD\u306D\u308B"
1530
1589
  },
1531
1590
  en: {
1532
1591
  bold: "Bold",
@@ -1551,19 +1610,22 @@ var translations = {
1551
1610
  tooltipHint: "Tooltip shown on mouse hover",
1552
1611
  apply: "Apply",
1553
1612
  cancel: "Cancel",
1554
- insertLink: "Insert Link",
1613
+ insertLink: "Link",
1555
1614
  quote: "Quote",
1556
- insertTable: "Insert Table",
1557
- insertImage: "Insert Image",
1558
- insertImageFromUrl: "Insert Image from URL",
1615
+ insertTable: "Table",
1616
+ insertImage: "Image",
1617
+ insertImageFromUrl: "Image",
1559
1618
  insert: "Insert",
1619
+ format: "Format",
1560
1620
  imageUrlRequired: "Image URL (required):",
1561
1621
  altText: "Alt Text:",
1562
- title: "Title:",
1622
+ title: "tooltip:",
1563
1623
  imageDescription: "Description of the image",
1564
- imageTitle: "Image title",
1624
+ imageTitle: "tooltip",
1565
1625
  switchToVisualEditor: "Switch to visual editor",
1566
- switchToRawMarkdown: "Switch to raw markdown"
1626
+ switchToRawMarkdown: "Switch to raw markdown",
1627
+ codeBlock: "Code Block",
1628
+ increaseQuoteDepth: "Increase Quote Depth"
1567
1629
  }
1568
1630
  };
1569
1631
  var getLanguage = () => {
@@ -1674,7 +1736,7 @@ var createOnDrop = (originalFn, plugins2) => {
1674
1736
  // src/sink/editable/create-render-element.ts
1675
1737
  function createRenderElement(originalFn, plugins2) {
1676
1738
  const fns = plugins2.map((plugin) => plugin.editableProps?.renderElement).filter(defined);
1677
- return function renderElement4(renderElementProps) {
1739
+ return function renderElement5(renderElementProps) {
1678
1740
  for (const fn of fns) {
1679
1741
  const result = fn(renderElementProps);
1680
1742
  if (result)
@@ -4613,8 +4675,9 @@ function matchBlockQuoteSafe(node) {
4613
4675
  * Element.isElement(node) && !Element.isInline(node) &&
4614
4676
  * !Element.isDependant(node)
4615
4677
  */
4616
- (node.type === "paragraph" || node.type === "table" || node.type === "horizontal-rule" || node.type === "task-list-item" || node.type === "unordered-list-item" || node.type === "ordered-list-item" || node.type === "heading");
4678
+ (node.type === "paragraph" || node.type === "code-block" || node.type === "table" || node.type === "horizontal-rule" || node.type === "task-list-item" || node.type === "unordered-list-item" || node.type === "ordered-list-item" || node.type === "heading");
4617
4679
  }
4680
+ var MAX_DEPTH = 2;
4618
4681
  var BlockQuotePlugin = createPlugin(
4619
4682
  (editor) => {
4620
4683
  editor.supportsBlockQuote = true;
@@ -4636,6 +4699,64 @@ var BlockQuotePlugin = createPlugin(
4636
4699
  match: (n) => Element11.isElement(n) && n.type === "block-quote"
4637
4700
  });
4638
4701
  return !!match;
4702
+ },
4703
+ increaseDepth: () => {
4704
+ const [match] = Editor24.nodes(editor, {
4705
+ match: (n) => Element11.isElement(n) && n.type === "block-quote"
4706
+ });
4707
+ if (!match)
4708
+ return;
4709
+ if (!editor.blockQuotePlugin.canIncreaseDepth())
4710
+ return;
4711
+ const [, path] = match;
4712
+ Transforms17.select(editor, path);
4713
+ Transforms17.wrapNodes(
4714
+ editor,
4715
+ { type: "block-quote", children: [] },
4716
+ { at: path, split: false }
4717
+ );
4718
+ },
4719
+ decreaseDepth: () => {
4720
+ const [match] = Editor24.nodes(editor, {
4721
+ match: (n) => Element11.isElement(n) && n.type === "block-quote"
4722
+ });
4723
+ if (!match)
4724
+ return;
4725
+ if (!editor.blockQuotePlugin.canDecreaseDepth())
4726
+ return;
4727
+ const [node, path] = match;
4728
+ const children = node.children;
4729
+ if (children.length === 1 && Element11.isElement(children[0]) && children[0].type === "block-quote") {
4730
+ Transforms17.unwrapNodes(editor, {
4731
+ at: [...path, 0],
4732
+ // Path to the nested block-quote
4733
+ match: (n) => Element11.isElement(n) && n.type === "block-quote"
4734
+ });
4735
+ }
4736
+ },
4737
+ canIncreaseDepth: () => {
4738
+ const [match] = Editor24.nodes(editor, {
4739
+ match: (n) => Element11.isElement(n) && n.type === "block-quote"
4740
+ });
4741
+ if (!match)
4742
+ return false;
4743
+ const [node] = match;
4744
+ let depth = 0;
4745
+ let current = node;
4746
+ while (current.children.length === 1 && Element11.isElement(current.children[0]) && current.children[0] && current.children[0] && current.children[0].type === "block-quote") {
4747
+ depth++;
4748
+ current = current.children[0];
4749
+ }
4750
+ return depth < MAX_DEPTH;
4751
+ },
4752
+ canDecreaseDepth: () => {
4753
+ const [match] = Editor24.nodes(editor, {
4754
+ match: (n) => Element11.isElement(n) && n.type === "block-quote"
4755
+ });
4756
+ if (!match)
4757
+ return false;
4758
+ const [node] = match;
4759
+ return node.children.length === 1 && Element11.isElement(node.children[0]) && node.children[0] && node.children[0].type === "block-quote";
4639
4760
  }
4640
4761
  };
4641
4762
  return {
@@ -4670,23 +4791,435 @@ var BlockQuotePlugin = createPlugin(
4670
4791
  }
4671
4792
  );
4672
4793
 
4794
+ // src/code-block-plugin/index.tsx
4795
+ import { Editor as Editor27, Element as Element15, Transforms as Transforms20 } from "slate";
4796
+
4797
+ // src/code-block-plugin/decorate.tsx
4798
+ import { languages, tokenize } from "prismjs";
4799
+ import { Element as Element12, Node as Node6 } from "slate";
4800
+ function getLineOffsets(lines) {
4801
+ let offset = 0;
4802
+ const lineOffsets = [];
4803
+ for (const line of lines) {
4804
+ lineOffsets.push(offset);
4805
+ offset = offset + line.length;
4806
+ }
4807
+ return lineOffsets;
4808
+ }
4809
+ function decorate(nodeEntry) {
4810
+ const [node, path] = nodeEntry;
4811
+ if (!Element12.isElement(node))
4812
+ return [];
4813
+ if (node.type !== "code-block")
4814
+ return [];
4815
+ const lang = languages[node.language];
4816
+ if (lang === void 0)
4817
+ return [];
4818
+ const codeLineElements = node.children;
4819
+ const textLines = codeLineElements.map((node2) => `${Node6.string(node2)}
4820
+ `);
4821
+ const text = textLines.join("");
4822
+ const lineOffsets = getLineOffsets(textLines);
4823
+ function getPointFromOffset(offset2) {
4824
+ for (let i = lineOffsets.length; i >= 0; i--) {
4825
+ const lineOffset = lineOffsets[i];
4826
+ if (lineOffset <= offset2) {
4827
+ return {
4828
+ path: [...path, i],
4829
+ offset: offset2 - lineOffset
4830
+ };
4831
+ }
4832
+ }
4833
+ throw new Error("This shouldn't happen and indicates a bug in the logic");
4834
+ }
4835
+ const ranges = [];
4836
+ const tokens = tokenize(text, lang);
4837
+ let offset = 0;
4838
+ for (const token of tokens) {
4839
+ if (typeof token === "string") {
4840
+ offset += token.length;
4841
+ } else {
4842
+ const anchor = getPointFromOffset(offset);
4843
+ const focus = getPointFromOffset(offset + token.length);
4844
+ ranges.push({
4845
+ anchor,
4846
+ focus,
4847
+ prismToken: token.type
4848
+ });
4849
+ offset += token.length;
4850
+ }
4851
+ }
4852
+ return ranges;
4853
+ }
4854
+
4855
+ // src/code-block-plugin/methods/createCodeBlock.ts
4856
+ function createCodeBlock(editor, { language }) {
4857
+ insertRootElement(editor, {
4858
+ type: "code-block",
4859
+ language,
4860
+ children: [{ type: "code-block-line", children: [{ text: "" }] }]
4861
+ });
4862
+ }
4863
+
4864
+ // src/code-block-plugin/methods/setCodeBlockLanguage.ts
4865
+ import { Element as Element13, Transforms as Transforms18 } from "slate";
4866
+ function setCodeBlockLanguage(editor, language, options = {}) {
4867
+ const entry = findElementUp(
4868
+ editor,
4869
+ (el) => Element13.isElement(el) && el.type === "code-block",
4870
+ { at: options.at }
4871
+ );
4872
+ if (!entry)
4873
+ return false;
4874
+ Transforms18.setNodes(editor, { language }, { at: entry[1] });
4875
+ return true;
4876
+ }
4877
+
4878
+ // src/code-block-plugin/methods/index.ts
4879
+ function createCodeBlockMethods(editor) {
4880
+ return {
4881
+ createCodeBlock: curryOne(createCodeBlock, editor),
4882
+ setCodeBlockLanguage: curryOne(setCodeBlockLanguage, editor)
4883
+ };
4884
+ }
4885
+
4886
+ // src/code-block-plugin/prism-theme.ts
4887
+ var commentStyle = { color: "#999988", fontStyle: "italic" };
4888
+ var dimStyle = { opacity: "0.7" };
4889
+ var stringStyle = { color: "#e3116c" };
4890
+ var operatorStyle = { color: "#393a34" };
4891
+ var valueStyle = { color: "#36acaa" };
4892
+ var keywordStyle = { color: "#00a4db" };
4893
+ var functionStyle = { color: "#9a050f" };
4894
+ var tagStyle = { color: "#00009f" };
4895
+ var boldStyle = { fontWeight: "bold" };
4896
+ var italicStyle = { fontStyle: "italic" };
4897
+ var tokenStyles = {
4898
+ comment: commentStyle,
4899
+ prolog: commentStyle,
4900
+ doctype: commentStyle,
4901
+ cdata: commentStyle,
4902
+ namespace: dimStyle,
4903
+ string: stringStyle,
4904
+ "attr-value": stringStyle,
4905
+ puncutation: operatorStyle,
4906
+ operator: operatorStyle,
4907
+ entity: valueStyle,
4908
+ url: valueStyle,
4909
+ symbol: valueStyle,
4910
+ number: valueStyle,
4911
+ boolean: valueStyle,
4912
+ variable: valueStyle,
4913
+ constant: valueStyle,
4914
+ property: valueStyle,
4915
+ regex: valueStyle,
4916
+ insert: valueStyle,
4917
+ atrule: keywordStyle,
4918
+ keyword: keywordStyle,
4919
+ "attr-name": keywordStyle,
4920
+ function: { ...functionStyle, ...boldStyle },
4921
+ delete: functionStyle,
4922
+ tag: tagStyle,
4923
+ selector: tagStyle,
4924
+ important: boldStyle,
4925
+ bold: boldStyle,
4926
+ italic: italicStyle
4927
+ };
4928
+
4929
+ // src/code-block-plugin/types.tsx
4930
+ var LanguageList = [
4931
+ "text",
4932
+ "html",
4933
+ "css",
4934
+ "svg",
4935
+ "javascript",
4936
+ "java",
4937
+ "c"
4938
+ ];
4939
+
4940
+ // src/code-block-plugin/normalizeNode.tsx
4941
+ import { Element as Element14, Node as Node7, Transforms as Transforms19 } from "slate";
4942
+ function normalizeNode3(editor, entry) {
4943
+ if (!Element14.isElement(entry[0]))
4944
+ return false;
4945
+ if (entry[0].type === "code-block-line") {
4946
+ for (const [child, path] of Node7.children(editor, entry[1])) {
4947
+ if (!Element14.isElement(child))
4948
+ continue;
4949
+ if (editor.isVoid(child)) {
4950
+ Transforms19.removeNodes(editor, { at: path });
4951
+ return true;
4952
+ } else {
4953
+ Transforms19.unwrapNodes(editor, { at: path });
4954
+ return true;
4955
+ }
4956
+ }
4957
+ }
4958
+ if (entry[0].type === "code-block") {
4959
+ for (const [child, path] of Node7.children(editor, entry[1])) {
4960
+ if (!Element14.isElement(child))
4961
+ continue;
4962
+ if (child.type === "code-block-line")
4963
+ continue;
4964
+ if (child.type === "code-block") {
4965
+ Transforms19.unwrapNodes(editor, { at: path });
4966
+ return true;
4967
+ } else if (editor.isVoid(child)) {
4968
+ Transforms19.removeNodes(editor, { at: path });
4969
+ return true;
4970
+ } else {
4971
+ Transforms19.removeNodes(editor, { at: path });
4972
+ Transforms19.insertNodes(editor, {
4973
+ type: "code-block-line",
4974
+ children: [{ text: Node7.string(child) }]
4975
+ });
4976
+ return true;
4977
+ }
4978
+ }
4979
+ }
4980
+ return false;
4981
+ }
4982
+
4983
+ // src/code-block-plugin/render-element/CodeBlock.tsx
4984
+ import { useCallback as useCallback9, useRef as useRef5 } from "react";
4985
+ import { useSelected as useSelected3 } from "slate-react";
4986
+
4987
+ // src/code-block-plugin/icons/ChevronDownIcon.tsx
4988
+ import { jsx as jsx29 } from "react/jsx-runtime";
4989
+ var ChevronDownIcon = (props) => /* @__PURE__ */ jsx29(TablerIcon, { ...props, children: /* @__PURE__ */ jsx29("path", { d: "m6 9 6 6 6-6" }) });
4990
+
4991
+ // src/code-block-plugin/styles.ts
4992
+ import styled23 from "@emotion/styled";
4993
+ var $CodeBlock = styled23("div")`
4994
+ position: relative;
4995
+ background: var(--code-block-bgcolor);
4996
+ margin: 1em 0;
4997
+ border-radius: 0.5em;
4998
+ border: 1px solid var(--code-block-border-color);
4999
+ /**
5000
+ * DO NOT REMOVE: Code for adding line numbering if enabled. See $CodeBlockLine
5001
+ * for more details.
5002
+ * counter-reset: line;
5003
+ */
5004
+ &.--selected {
5005
+ outline: 2px solid var(--select-color);
5006
+ }
5007
+ /**
5008
+ * NOTE: Required to make the border radius work on the first and last lines.
5009
+ * Otherwise they will be square.
5010
+ */
5011
+ overflow-x: hidden;
5012
+ `;
5013
+ var $CodeBlockScroller = styled23("div")`
5014
+ padding: 2.25em 1em 1.5em 1em;
5015
+ border-radius: 0.5em;
5016
+ overflow-x: auto;
5017
+ `;
5018
+ var $CodeBlockLanguage = styled23("span")`
5019
+ cursor: pointer;
5020
+ position: absolute;
5021
+ top: 0.25em;
5022
+ right: 0.25em;
5023
+ width: 8em;
5024
+ display: flex;
5025
+ font-size: 0.75em;
5026
+ color: var(--shade-700);
5027
+ background: var(--shade-200);
5028
+ padding: 0.25em 0.5em;
5029
+ border-radius: 0.5em;
5030
+ align-items: center;
5031
+ gap: 0.25em;
5032
+ span {
5033
+ text-align: right;
5034
+ flex: 1 1 auto;
5035
+ }
5036
+ svg {
5037
+ flex: 0 0 auto;
5038
+ position: relative;
5039
+ }
5040
+ &:hover {
5041
+ color: var(--shade-800);
5042
+ background: var(--shade-300);
5043
+ }
5044
+ `;
5045
+ var $CodeBlockLine = styled23("div")`
5046
+ white-space: pre;
5047
+ line-height: 1.5em;
5048
+ counter-increment: line;
5049
+ font-family: "andale mono", AndaleMono, monospace;
5050
+ font-size: 0.875em;
5051
+ &.--selected {
5052
+ background-color: var(--shade-100);
5053
+ }
5054
+ /*
5055
+ DO NOT REMOVE: Code for adding line numbering.
5056
+ TODO: Make optional in future.
5057
+ */
5058
+ /* &:before {
5059
+ content: counter(line);
5060
+ color: rgba(0, 0, 0, 0.25);
5061
+ border-right: 1px solid rgba(0, 0, 0, 0.05);
5062
+ margin-right: 1em;
5063
+ padding: 0em 1em 0 0;
5064
+ text-align: right;
5065
+ display: inline-block;
5066
+ width: 2em;
5067
+ } */
5068
+ `;
5069
+
5070
+ // src/code-block-plugin/render-element/CodeBlock.tsx
5071
+ import { jsx as jsx30, jsxs as jsxs16 } from "react/jsx-runtime";
5072
+ function CodeBlock({
5073
+ element,
5074
+ attributes,
5075
+ children
5076
+ }) {
5077
+ const ref = useRef5(null);
5078
+ const selected = useSelected3();
5079
+ const dropdown = useLayer("code-block-dropdown");
5080
+ const onClick = useCallback9(() => {
5081
+ if (dropdown.layer)
5082
+ dropdown.close();
5083
+ const dest = ref.current;
5084
+ if (dest === null)
5085
+ return;
5086
+ const items = LanguageList.map((language) => {
5087
+ return {
5088
+ icon: () => /* @__PURE__ */ jsx30("span", {}),
5089
+ title: language,
5090
+ action: (editor) => {
5091
+ editor.codeBlock.setCodeBlockLanguage(language, { at: element });
5092
+ }
5093
+ };
5094
+ });
5095
+ dropdown.open(() => /* @__PURE__ */ jsx30(Menu, { dest, items, close: dropdown.close }));
5096
+ }, [element]);
5097
+ return /* @__PURE__ */ jsxs16($CodeBlock, { className: selected ? "--selected" : "", ...attributes, children: [
5098
+ /* @__PURE__ */ jsxs16($CodeBlockLanguage, { contentEditable: false, onClick, ref, children: [
5099
+ /* @__PURE__ */ jsx30("span", { children: element.language }),
5100
+ /* @__PURE__ */ jsx30(ChevronDownIcon, {})
5101
+ ] }),
5102
+ /* @__PURE__ */ jsx30($CodeBlockScroller, { children })
5103
+ ] });
5104
+ }
5105
+
5106
+ // src/code-block-plugin/render-element/CodeBlockLine.tsx
5107
+ import { useSelected as useSelected4 } from "slate-react";
5108
+ import { jsx as jsx31 } from "react/jsx-runtime";
5109
+ function CodeBlockLine({
5110
+ attributes,
5111
+ children
5112
+ }) {
5113
+ const selected = useSelected4();
5114
+ return /* @__PURE__ */ jsx31(
5115
+ $CodeBlockLine,
5116
+ {
5117
+ className: selected ? "--selected" : "",
5118
+ ...attributes,
5119
+ spellCheck: "false",
5120
+ children
5121
+ }
5122
+ );
5123
+ }
5124
+
5125
+ // src/code-block-plugin/render-element/index.tsx
5126
+ import { jsx as jsx32 } from "react/jsx-runtime";
5127
+ function renderElement2({
5128
+ element,
5129
+ attributes,
5130
+ children
5131
+ }) {
5132
+ if (element.type === "code-block") {
5133
+ return /* @__PURE__ */ jsx32(CodeBlock, { element, attributes, children });
5134
+ } else if (element.type === "code-block-line") {
5135
+ return /* @__PURE__ */ jsx32(CodeBlockLine, { element, attributes, children });
5136
+ }
5137
+ }
5138
+
5139
+ // src/code-block-plugin/index.tsx
5140
+ import { jsx as jsx33 } from "react/jsx-runtime";
5141
+ var CodeBlockPlugin = createPlugin(
5142
+ (editor, _options, { createPolicy }) => {
5143
+ editor.codeBlock = createCodeBlockMethods(editor);
5144
+ function onDelete() {
5145
+ const { selection } = editor;
5146
+ if (!isCollapsed(selection))
5147
+ return false;
5148
+ const codeBlockEntry = findElementUp(editor, "code-block");
5149
+ if (codeBlockEntry == null)
5150
+ return false;
5151
+ const codeBlockText = Editor27.string(editor, codeBlockEntry[1]);
5152
+ if (codeBlockText === "") {
5153
+ Transforms20.removeNodes(editor, { at: codeBlockEntry[1] });
5154
+ return true;
5155
+ }
5156
+ return false;
5157
+ }
5158
+ return createPolicy({
5159
+ name: "code-block",
5160
+ editor: {
5161
+ deleteBackward: onDelete,
5162
+ deleteForward: onDelete,
5163
+ isInline(element) {
5164
+ if (element.type === "code-block" || element.type === "code-block-line")
5165
+ return false;
5166
+ },
5167
+ isVoid(element) {
5168
+ if (element.type === "code-block" || element.type == "code-block-line")
5169
+ return false;
5170
+ },
5171
+ isMaster(element) {
5172
+ if (element.type === "code-block")
5173
+ return true;
5174
+ },
5175
+ normalizeNode: curryOne(normalizeNode3, editor)
5176
+ },
5177
+ editableProps: {
5178
+ decorate,
5179
+ onKeyDown: createHotkeyHandler({
5180
+ "super+`": () => editor.codeBlock.createCodeBlock({ language: "text" }),
5181
+ "mod+a": () => {
5182
+ const entry = findElementUp(
5183
+ editor,
5184
+ (el) => Element15.isElement(el) && el.type === "code-block"
5185
+ );
5186
+ if (!entry)
5187
+ return false;
5188
+ Transforms20.select(editor, entry[1]);
5189
+ return true;
5190
+ }
5191
+ }),
5192
+ renderElement: renderElement2,
5193
+ renderLeaf: ({ leaf, children }) => {
5194
+ const style = leaf.prismToken ? tokenStyles[leaf.prismToken] || null : null;
5195
+ if (style === null) {
5196
+ return children;
5197
+ } else {
5198
+ return /* @__PURE__ */ jsx33("span", { style, children });
5199
+ }
5200
+ }
5201
+ }
5202
+ });
5203
+ }
5204
+ );
5205
+
4673
5206
  // src/collapsible-paragraph-plugin/index.tsx
4674
- import { Editor as Editor28 } from "slate";
5207
+ import { Editor as Editor31 } from "slate";
4675
5208
 
4676
5209
  // src/collapsible-paragraph-plugin/normalize-node/index.ts
4677
- import { Element as Element14 } from "slate";
5210
+ import { Element as Element18 } from "slate";
4678
5211
 
4679
5212
  // src/collapsible-paragraph-plugin/normalize-node/normalize-sibling-paragraphs.ts
4680
- import { Element as Element12, Transforms as Transforms18 } from "slate";
5213
+ import { Element as Element16, Transforms as Transforms21 } from "slate";
4681
5214
  function isParagraph(node) {
4682
- return Element12.isElement(node) && node.type === "paragraph";
5215
+ return Element16.isElement(node) && node.type === "paragraph";
4683
5216
  }
4684
5217
  function normalizeSiblingParagraphs(editor, entry) {
4685
5218
  return normalizeSiblings(editor, entry, (a, b) => {
4686
5219
  if (!isParagraph(a[0]) || !isParagraph(b[0]))
4687
5220
  return false;
4688
5221
  if (a[0].__collapsible && b[0].__collapsible) {
4689
- Transforms18.removeNodes(editor, { at: a[1] });
5222
+ Transforms21.removeNodes(editor, { at: a[1] });
4690
5223
  return true;
4691
5224
  }
4692
5225
  return false;
@@ -4694,9 +5227,9 @@ function normalizeSiblingParagraphs(editor, entry) {
4694
5227
  }
4695
5228
 
4696
5229
  // src/collapsible-paragraph-plugin/normalize-node/normalize-sibling-walls.ts
4697
- import { Element as Element13, Transforms as Transforms19 } from "slate";
5230
+ import { Element as Element17, Transforms as Transforms22 } from "slate";
4698
5231
  function isWall(editor, node) {
4699
- if (!Element13.isElement(node))
5232
+ if (!Element17.isElement(node))
4700
5233
  return false;
4701
5234
  return editor.isVoid(node) || editor.isMaster(node);
4702
5235
  }
@@ -4706,7 +5239,7 @@ function normalizeSiblingWalls(editor, entry) {
4706
5239
  return normalizeSiblings(editor, entry, (a, b) => {
4707
5240
  if (!isWall(editor, a[0]) || !isWall(editor, b[0]))
4708
5241
  return false;
4709
- Transforms19.insertNodes(
5242
+ Transforms22.insertNodes(
4710
5243
  editor,
4711
5244
  {
4712
5245
  type: "paragraph",
@@ -4720,9 +5253,9 @@ function normalizeSiblingWalls(editor, entry) {
4720
5253
  }
4721
5254
 
4722
5255
  // src/collapsible-paragraph-plugin/normalize-node/index.ts
4723
- function normalizeNode3(editor, entry) {
5256
+ function normalizeNode4(editor, entry) {
4724
5257
  const [node, path] = entry;
4725
- if (!Element14.isElement(node))
5258
+ if (!Element18.isElement(node))
4726
5259
  return false;
4727
5260
  if (normalizeSiblingWalls(editor, [node, path]))
4728
5261
  return true;
@@ -4733,11 +5266,11 @@ function normalizeNode3(editor, entry) {
4733
5266
 
4734
5267
  // src/collapsible-paragraph-plugin/render-element/paragraph.tsx
4735
5268
  import { clsx as clsx5 } from "clsx";
4736
- import { useSelected as useSelected3 } from "slate-react";
5269
+ import { useSelected as useSelected5 } from "slate-react";
4737
5270
 
4738
5271
  // src/collapsible-paragraph-plugin/render-element/styles.ts
4739
- import styled23 from "@emotion/styled";
4740
- var $Paragraph = styled23("p")`
5272
+ import styled24 from "@emotion/styled";
5273
+ var $Paragraph = styled24("p")`
4741
5274
  padding: 0;
4742
5275
  margin: 1em 0;
4743
5276
  &:first-child {
@@ -4770,21 +5303,21 @@ var $Paragraph = styled23("p")`
4770
5303
  `;
4771
5304
 
4772
5305
  // src/collapsible-paragraph-plugin/render-element/utils.ts
4773
- import { Node as Node8 } from "slate";
5306
+ import { Node as Node10 } from "slate";
4774
5307
  function getIsEmpty(element) {
4775
- return element.children.length === 1 && Node8.string(element.children[0]).length === 0;
5308
+ return element.children.length === 1 && Node10.string(element.children[0]).length === 0;
4776
5309
  }
4777
5310
 
4778
5311
  // src/collapsible-paragraph-plugin/render-element/paragraph.tsx
4779
- import { jsx as jsx29 } from "react/jsx-runtime";
5312
+ import { jsx as jsx34 } from "react/jsx-runtime";
4780
5313
  function Paragraph({
4781
5314
  element,
4782
5315
  attributes,
4783
5316
  children
4784
5317
  }) {
4785
- const selected = useSelected3();
5318
+ const selected = useSelected5();
4786
5319
  const isEmpty = getIsEmpty(element);
4787
- return /* @__PURE__ */ jsx29(
5320
+ return /* @__PURE__ */ jsx34(
4788
5321
  $Paragraph,
4789
5322
  {
4790
5323
  ...attributes,
@@ -4799,13 +5332,13 @@ function Paragraph({
4799
5332
  }
4800
5333
 
4801
5334
  // src/collapsible-paragraph-plugin/index.tsx
4802
- import { jsx as jsx30 } from "react/jsx-runtime";
5335
+ import { jsx as jsx35 } from "react/jsx-runtime";
4803
5336
  var CollapsibleParagraphPlugin = createPlugin((editor) => {
4804
5337
  const { insertBreak: insertBreak3 } = editor;
4805
5338
  editor.insertBreak = () => {
4806
5339
  const { selection } = editor;
4807
5340
  if (selection && selection.anchor.path[0] === selection.focus.path[0]) {
4808
- const text = Editor28.string(editor, [selection.anchor.path[0]]);
5341
+ const text = Editor31.string(editor, [selection.anchor.path[0]]);
4809
5342
  if (text.match(/\n$/) || text.match(/\n\n/)) {
4810
5343
  insertBreak3();
4811
5344
  } else {
@@ -4835,13 +5368,13 @@ var CollapsibleParagraphPlugin = createPlugin((editor) => {
4835
5368
  return {
4836
5369
  name: "collapsible-paragraph",
4837
5370
  editor: {
4838
- normalizeNode: curryOne(normalizeNode3, editor)
5371
+ normalizeNode: curryOne(normalizeNode4, editor)
4839
5372
  },
4840
5373
  editableProps: {
4841
5374
  renderElement: ({ element, attributes, children }) => {
4842
5375
  switch (element.type) {
4843
5376
  case "paragraph": {
4844
- return /* @__PURE__ */ jsx30(Paragraph, { element, attributes, children });
5377
+ return /* @__PURE__ */ jsx35(Paragraph, { element, attributes, children });
4845
5378
  }
4846
5379
  }
4847
5380
  },
@@ -4862,24 +5395,24 @@ function addConvertElementType(editor, type) {
4862
5395
  }
4863
5396
 
4864
5397
  // src/convert-element-plugin/methods/convert-elements.ts
4865
- import { Editor as Editor29, Element as Element16 } from "slate";
5398
+ import { Editor as Editor32, Element as Element20 } from "slate";
4866
5399
  function convertElements(editor, matchForToggle, targetElement, allowToggle) {
4867
5400
  const entries = Array.from(
4868
- Editor29.nodes(editor, {
4869
- match: (node) => Element16.isElement(node) && editor.convertElement.isConvertibleElement(node)
5401
+ Editor32.nodes(editor, {
5402
+ match: (node) => Element20.isElement(node) && editor.convertElement.isConvertibleElement(node)
4870
5403
  })
4871
5404
  );
4872
5405
  if (entries.length === 0)
4873
5406
  return false;
4874
5407
  const shouldToggle = allowToggle && entries.every((entry) => matchForToggle(entry[0]));
4875
5408
  if (shouldToggle) {
4876
- Editor29.withoutNormalizing(editor, () => {
5409
+ Editor32.withoutNormalizing(editor, () => {
4877
5410
  for (const entry of entries) {
4878
5411
  rewrapElement(editor, { type: "paragraph" }, entry[1]);
4879
5412
  }
4880
5413
  });
4881
5414
  } else {
4882
- Editor29.withoutNormalizing(editor, () => {
5415
+ Editor32.withoutNormalizing(editor, () => {
4883
5416
  for (const entry of entries) {
4884
5417
  rewrapElement(editor, targetElement, entry[1]);
4885
5418
  }
@@ -4915,32 +5448,32 @@ var ConvertElementPlugin = createPlugin((editor) => {
4915
5448
  });
4916
5449
 
4917
5450
  // src/heading-plugin/insert-break.ts
4918
- import { Editor as Editor30, Path as Path7, Range as Range4, Transforms as Transforms20 } from "slate";
5451
+ import { Editor as Editor33, Path as Path8, Range as Range5, Transforms as Transforms23 } from "slate";
4919
5452
  function insertBreak(editor) {
4920
5453
  const entry = findElementUp(editor, "heading");
4921
5454
  if (!entry)
4922
5455
  return false;
4923
5456
  if (!editor.selection)
4924
5457
  return false;
4925
- if (Range4.isExpanded(editor.selection))
5458
+ if (Range5.isExpanded(editor.selection))
4926
5459
  return false;
4927
- if (!Editor30.isEnd(editor, editor.selection.anchor, entry[1]))
5460
+ if (!Editor33.isEnd(editor, editor.selection.anchor, entry[1]))
4928
5461
  return false;
4929
- const nextPath = Path7.next(entry[1]);
4930
- Transforms20.insertNodes(
5462
+ const nextPath = Path8.next(entry[1]);
5463
+ Transforms23.insertNodes(
4931
5464
  editor,
4932
5465
  { type: "paragraph", children: [{ text: "" }] },
4933
5466
  { at: nextPath }
4934
5467
  );
4935
- Transforms20.select(editor, {
4936
- anchor: Editor30.start(editor, nextPath),
4937
- focus: Editor30.start(editor, nextPath)
5468
+ Transforms23.select(editor, {
5469
+ anchor: Editor33.start(editor, nextPath),
5470
+ focus: Editor33.start(editor, nextPath)
4938
5471
  });
4939
5472
  return true;
4940
5473
  }
4941
5474
 
4942
5475
  // src/heading-plugin/methods/index.ts
4943
- import { Editor as Editor31 } from "slate";
5476
+ import { Editor as Editor34 } from "slate";
4944
5477
  function convertHeading(editor, level, allowToggle) {
4945
5478
  editor.convertElement.convertElements(
4946
5479
  (element) => element.type === "heading" && element.level == level,
@@ -4949,7 +5482,7 @@ function convertHeading(editor, level, allowToggle) {
4949
5482
  );
4950
5483
  }
4951
5484
  function isHeadingActive(editor, level) {
4952
- const [match] = Editor31.nodes(editor, {
5485
+ const [match] = Editor34.nodes(editor, {
4953
5486
  match: (n) => {
4954
5487
  return "type" in n && "level" in n && n.type === "heading" && n.level === level;
4955
5488
  }
@@ -4965,7 +5498,7 @@ function createHeadingMethods(editor) {
4965
5498
 
4966
5499
  // src/heading-plugin/styles.ts
4967
5500
  import { css } from "@emotion/react";
4968
- import styled24 from "@emotion/styled";
5501
+ import styled25 from "@emotion/styled";
4969
5502
  var headingStyles = css`
4970
5503
  margin-top: 1em;
4971
5504
  &:first-child {
@@ -4973,34 +5506,34 @@ var headingStyles = css`
4973
5506
  }
4974
5507
  font-weight: bold;
4975
5508
  `;
4976
- var $H1 = styled24("h1")`
5509
+ var $H1 = styled25("h1")`
4977
5510
  ${headingStyles}
4978
5511
  font-size: 2.25em;
4979
5512
  letter-spacing: -0.01em;
4980
5513
  `;
4981
- var $H2 = styled24("h2")`
5514
+ var $H2 = styled25("h2")`
4982
5515
  ${headingStyles}
4983
5516
  font-size: 1.5em;
4984
5517
  `;
4985
- var $H3 = styled24("h3")`
5518
+ var $H3 = styled25("h3")`
4986
5519
  ${headingStyles}
4987
5520
  font-size: 1.25em;
4988
5521
  `;
4989
- var $H4 = styled24("h4")`
5522
+ var $H4 = styled25("h4")`
4990
5523
  ${headingStyles}
4991
5524
  font-size: 1em;
4992
5525
  `;
4993
- var $H5 = styled24("h5")`
5526
+ var $H5 = styled25("h5")`
4994
5527
  ${headingStyles}
4995
5528
  font-size: 1em;
4996
5529
  `;
4997
- var $H6 = styled24("h6")`
5530
+ var $H6 = styled25("h6")`
4998
5531
  ${headingStyles}
4999
5532
  font-size: 1em;
5000
5533
  `;
5001
5534
 
5002
5535
  // src/heading-plugin/index.tsx
5003
- import { jsx as jsx31 } from "react/jsx-runtime";
5536
+ import { jsx as jsx36 } from "react/jsx-runtime";
5004
5537
  var HeadingPlugin = createPlugin(
5005
5538
  (editor) => {
5006
5539
  editor.convertElement.addConvertElementType("heading");
@@ -5031,17 +5564,17 @@ var HeadingPlugin = createPlugin(
5031
5564
  if (element.type === "heading") {
5032
5565
  switch (element.level) {
5033
5566
  case 1:
5034
- return /* @__PURE__ */ jsx31($H1, { ...attributes, children });
5567
+ return /* @__PURE__ */ jsx36($H1, { ...attributes, children });
5035
5568
  case 2:
5036
- return /* @__PURE__ */ jsx31($H2, { ...attributes, children });
5569
+ return /* @__PURE__ */ jsx36($H2, { ...attributes, children });
5037
5570
  case 3:
5038
- return /* @__PURE__ */ jsx31($H3, { ...attributes, children });
5571
+ return /* @__PURE__ */ jsx36($H3, { ...attributes, children });
5039
5572
  case 4:
5040
- return /* @__PURE__ */ jsx31($H4, { ...attributes, children });
5573
+ return /* @__PURE__ */ jsx36($H4, { ...attributes, children });
5041
5574
  case 5:
5042
- return /* @__PURE__ */ jsx31($H5, { ...attributes, children });
5575
+ return /* @__PURE__ */ jsx36($H5, { ...attributes, children });
5043
5576
  case 6:
5044
- return /* @__PURE__ */ jsx31($H6, { ...attributes, children });
5577
+ return /* @__PURE__ */ jsx36($H6, { ...attributes, children });
5045
5578
  default:
5046
5579
  throw new Error(
5047
5580
  `Expected element.level to be 1-6 but got ${element.level}`
@@ -5062,11 +5595,11 @@ var HeadingPlugin = createPlugin(
5062
5595
  );
5063
5596
 
5064
5597
  // src/horizontal-rule-plugin/horizontal-rule.tsx
5065
- import { useSelected as useSelected4 } from "slate-react";
5598
+ import { useSelected as useSelected6 } from "slate-react";
5066
5599
 
5067
5600
  // src/horizontal-rule-plugin/styles.tsx
5068
- import styled25 from "@emotion/styled";
5069
- var $HorizontalRule = styled25("hr")`
5601
+ import styled26 from "@emotion/styled";
5602
+ var $HorizontalRule = styled26("hr")`
5070
5603
  position: relative;
5071
5604
  height: 1em;
5072
5605
  /* background-color: var(--hr-color); */
@@ -5099,15 +5632,15 @@ var $HorizontalRule = styled25("hr")`
5099
5632
  `;
5100
5633
 
5101
5634
  // src/horizontal-rule-plugin/horizontal-rule.tsx
5102
- import { jsx as jsx32, jsxs as jsxs16 } from "react/jsx-runtime";
5635
+ import { jsx as jsx37, jsxs as jsxs17 } from "react/jsx-runtime";
5103
5636
  function HorizontalRule({
5104
5637
  attributes,
5105
5638
  children
5106
5639
  }) {
5107
- const selected = useSelected4();
5108
- return /* @__PURE__ */ jsxs16("div", { ...attributes, draggable: true, children: [
5640
+ const selected = useSelected6();
5641
+ return /* @__PURE__ */ jsxs17("div", { ...attributes, draggable: true, children: [
5109
5642
  children,
5110
- /* @__PURE__ */ jsx32("div", { contentEditable: false, children: /* @__PURE__ */ jsx32($HorizontalRule, { className: selected ? "--selected" : "" }) })
5643
+ /* @__PURE__ */ jsx37("div", { contentEditable: false, children: /* @__PURE__ */ jsx37($HorizontalRule, { className: selected ? "--selected" : "" }) })
5111
5644
  ] });
5112
5645
  }
5113
5646
 
@@ -5125,7 +5658,7 @@ function createHorizontalRuleMethods(editor) {
5125
5658
  }
5126
5659
 
5127
5660
  // src/horizontal-rule-plugin/index.tsx
5128
- import { jsx as jsx33 } from "react/jsx-runtime";
5661
+ import { jsx as jsx38 } from "react/jsx-runtime";
5129
5662
  var HorizontalRulePlugin = createPlugin(
5130
5663
  (editor, _options, { createPolicy }) => {
5131
5664
  editor.horizontalRule = createHorizontalRuleMethods(editor);
@@ -5140,7 +5673,7 @@ var HorizontalRulePlugin = createPlugin(
5140
5673
  editableProps: {
5141
5674
  renderElement: (props) => {
5142
5675
  if (props.element.type === "horizontal-rule") {
5143
- return /* @__PURE__ */ jsx33(HorizontalRule, { ...props });
5676
+ return /* @__PURE__ */ jsx38(HorizontalRule, { ...props });
5144
5677
  }
5145
5678
  },
5146
5679
  onKeyDown: createHotkeyHandler({
@@ -5152,8 +5685,8 @@ var HorizontalRulePlugin = createPlugin(
5152
5685
  );
5153
5686
 
5154
5687
  // src/inline-code-plugin/styles.ts
5155
- import styled26 from "@emotion/styled";
5156
- var $InlineCode = styled26("code")`
5688
+ import styled27 from "@emotion/styled";
5689
+ var $InlineCode = styled27("code")`
5157
5690
  color: var(--shade-600);
5158
5691
  background-color: var(--inline-code-bgcolor);
5159
5692
  border: 1px solid var(--inline-code-border-color);
@@ -5175,7 +5708,7 @@ var $InlineCode = styled26("code")`
5175
5708
  font-size: 0.75em;
5176
5709
  vertical-align: baseline;
5177
5710
  `;
5178
- var $InvisibleSpan = styled26("span")`
5711
+ var $InvisibleSpan = styled27("span")`
5179
5712
  display: inline-block;
5180
5713
  opacity: 0;
5181
5714
  width: 1px;
@@ -5183,7 +5716,7 @@ var $InvisibleSpan = styled26("span")`
5183
5716
  `;
5184
5717
 
5185
5718
  // src/inline-code-plugin/index.tsx
5186
- import { jsx as jsx34, jsxs as jsxs17 } from "react/jsx-runtime";
5719
+ import { jsx as jsx39, jsxs as jsxs18 } from "react/jsx-runtime";
5187
5720
  var InlineCodePlugin = createPlugin(
5188
5721
  (editor) => {
5189
5722
  if (!editor.marksPlugin)
@@ -5202,10 +5735,10 @@ var InlineCodePlugin = createPlugin(
5202
5735
  /**
5203
5736
  * Disable spellCheck because it's computer code usually.
5204
5737
  */
5205
- /* @__PURE__ */ jsxs17($InlineCode, { spellCheck: false, children: [
5206
- /* @__PURE__ */ jsx34($InvisibleSpan, { contentEditable: false, children: "|" }),
5738
+ /* @__PURE__ */ jsxs18($InlineCode, { spellCheck: false, children: [
5739
+ /* @__PURE__ */ jsx39($InvisibleSpan, { contentEditable: false, children: "|" }),
5207
5740
  children,
5208
- /* @__PURE__ */ jsx34($InvisibleSpan, { contentEditable: false, children: "|" })
5741
+ /* @__PURE__ */ jsx39($InvisibleSpan, { contentEditable: false, children: "|" })
5209
5742
  ] })
5210
5743
  );
5211
5744
  } else {
@@ -5221,7 +5754,7 @@ var InlineCodePlugin = createPlugin(
5221
5754
  );
5222
5755
 
5223
5756
  // src/list-plugin/index.tsx
5224
- import { Editor as Editor36, Path as Path8 } from "slate";
5757
+ import { Editor as Editor39, Path as Path9 } from "slate";
5225
5758
 
5226
5759
  // src/list-plugin/methods/convert-list-item.ts
5227
5760
  function convertOrderedList(editor, allowToggle) {
@@ -5263,7 +5796,7 @@ function convertUnorderedList(editor, allowToggle) {
5263
5796
  }
5264
5797
 
5265
5798
  // src/list-plugin/methods/depth.ts
5266
- var MAX_DEPTH = 2;
5799
+ var MAX_DEPTH2 = 2;
5267
5800
  function getListDepth(editor) {
5268
5801
  const listItem = findElementUp(editor, isListItem);
5269
5802
  if (!listItem)
@@ -5274,7 +5807,7 @@ function canIncreaseDepth(editor) {
5274
5807
  if (!isStartOfElement(editor, isListItem))
5275
5808
  return false;
5276
5809
  const depth = getListDepth(editor);
5277
- return depth < MAX_DEPTH;
5810
+ return depth < MAX_DEPTH2;
5278
5811
  }
5279
5812
  function canDecreaseDepth(editor) {
5280
5813
  if (!isStartOfElement(editor, isListItem))
@@ -5305,36 +5838,36 @@ function indent(editor) {
5305
5838
  }
5306
5839
 
5307
5840
  // src/list-plugin/methods/insert-break.ts
5308
- import { Editor as Editor32, Transforms as Transforms21 } from "slate";
5841
+ import { Editor as Editor35, Transforms as Transforms24 } from "slate";
5309
5842
  function insertBreak2(editor) {
5310
5843
  const entry = findElementUp(editor, isListItem);
5311
5844
  if (!entry)
5312
5845
  return false;
5313
5846
  const [element, path] = entry;
5314
- if (Editor32.isEmpty(editor, element)) {
5847
+ if (Editor35.isEmpty(editor, element)) {
5315
5848
  if (element.depth > 0) {
5316
- Transforms21.setNodes(editor, { depth: element.depth - 1 }, { at: path });
5849
+ Transforms24.setNodes(editor, { depth: element.depth - 1 }, { at: path });
5317
5850
  return true;
5318
5851
  } else {
5319
5852
  rewrapElement(editor, { type: "paragraph" }, path);
5320
5853
  return true;
5321
5854
  }
5322
5855
  }
5323
- Transforms21.splitNodes(editor, { always: true });
5856
+ Transforms24.splitNodes(editor, { always: true });
5324
5857
  const nextEntry = findElementUp(editor, isListItem);
5325
5858
  if (!nextEntry)
5326
5859
  return true;
5327
5860
  if (nextEntry[0].type === "task-list-item" && nextEntry[0].checked === true) {
5328
- Transforms21.setNodes(editor, { checked: false }, { at: nextEntry[1] });
5861
+ Transforms24.setNodes(editor, { checked: false }, { at: nextEntry[1] });
5329
5862
  }
5330
5863
  return true;
5331
5864
  }
5332
5865
 
5333
5866
  // src/list-plugin/methods/outdent.ts
5334
- import { Editor as Editor33 } from "slate";
5867
+ import { Editor as Editor36 } from "slate";
5335
5868
  function outdent(editor) {
5336
5869
  const entries = Array.from(
5337
- Editor33.nodes(editor, {
5870
+ Editor36.nodes(editor, {
5338
5871
  match: isListItem
5339
5872
  })
5340
5873
  );
@@ -5352,7 +5885,7 @@ function outdent(editor) {
5352
5885
  }
5353
5886
 
5354
5887
  // src/list-plugin/methods/toggleTaskListItem.ts
5355
- import { Transforms as Transforms22 } from "slate";
5888
+ import { Transforms as Transforms25 } from "slate";
5356
5889
  function toggleTaskListItem(editor, { at = editor.selection } = {}) {
5357
5890
  const taskListItem = findElementUp(
5358
5891
  editor,
@@ -5362,7 +5895,7 @@ function toggleTaskListItem(editor, { at = editor.selection } = {}) {
5362
5895
  if (!taskListItem)
5363
5896
  return false;
5364
5897
  const nextChecked = !taskListItem[0].checked;
5365
- Transforms22.setNodes(
5898
+ Transforms25.setNodes(
5366
5899
  editor,
5367
5900
  { checked: nextChecked },
5368
5901
  { at: taskListItem[1] }
@@ -5388,20 +5921,20 @@ function createListMethods(editor) {
5388
5921
  }
5389
5922
 
5390
5923
  // src/list-plugin/normalize-node/normalize-ordered-first-at-depth.ts
5391
- import { Element as Element17, Transforms as Transforms23 } from "slate";
5924
+ import { Element as Element21, Transforms as Transforms26 } from "slate";
5392
5925
  var isOrderedListItem = createIsElementType([
5393
5926
  "ordered-list-item"
5394
5927
  ]);
5395
5928
  function normalizeOrderedFirstAtDepth(editor, entry) {
5396
5929
  const [node, path] = entry;
5397
- if (!Element17.isElement(node))
5930
+ if (!Element21.isElement(node))
5398
5931
  return false;
5399
5932
  return normalizeSiblings(editor, [node, path], (a, b) => {
5400
5933
  if (!isOrderedListItem(b[0]))
5401
5934
  return false;
5402
5935
  const __firstAtDepth = isOrderedListItem(a[0]) ? b[0].depth > a[0].depth : isListItem(a[0]) ? b[0].depth > a[0].depth : true;
5403
5936
  if (b[0].__firstAtDepth !== __firstAtDepth) {
5404
- Transforms23.setNodes(editor, { __firstAtDepth }, { at: b[1] });
5937
+ Transforms26.setNodes(editor, { __firstAtDepth }, { at: b[1] });
5405
5938
  return true;
5406
5939
  }
5407
5940
  return false;
@@ -5409,7 +5942,7 @@ function normalizeOrderedFirstAtDepth(editor, entry) {
5409
5942
  }
5410
5943
 
5411
5944
  // src/list-plugin/normalize-node/index.ts
5412
- function normalizeNode4(editor, entry) {
5945
+ function normalizeNode5(editor, entry) {
5413
5946
  const [node] = entry;
5414
5947
  if (!isListItem(node))
5415
5948
  return false;
@@ -5422,14 +5955,14 @@ import { useEffect as useEffect5 } from "react";
5422
5955
  import { ReactEditor as ReactEditor9, useSlateStatic as useSlateStatic11 } from "slate-react";
5423
5956
 
5424
5957
  // src/list-plugin/render-element/styles.ts
5425
- import styled27 from "@emotion/styled";
5426
- var $ListItem = styled27("li")`
5958
+ import styled28 from "@emotion/styled";
5959
+ var $ListItem = styled28("li")`
5427
5960
  margin-top: 0.5em;
5428
5961
  margin-bottom: 0.5em;
5429
5962
  list-style-position: outside;
5430
5963
  margin-left: calc(2em + var(--list-item-depth) * 2em);
5431
5964
  `;
5432
- var $UnorderedListItem = styled27($ListItem)`
5965
+ var $UnorderedListItem = styled28($ListItem)`
5433
5966
  position: relative;
5434
5967
  list-style-type: none;
5435
5968
  .--list-item-icon {
@@ -5440,7 +5973,7 @@ var $UnorderedListItem = styled27($ListItem)`
5440
5973
  color: var(--shade-600);
5441
5974
  }
5442
5975
  `;
5443
- var $OrderedListItem = styled27($ListItem)`
5976
+ var $OrderedListItem = styled28($ListItem)`
5444
5977
  position: relative;
5445
5978
  list-style-type: none;
5446
5979
  counter-increment: var(--list-item-var);
@@ -5466,7 +5999,7 @@ var $OrderedListItem = styled27($ListItem)`
5466
5999
  font-variant-numeric: tabular-nums;
5467
6000
  }
5468
6001
  `;
5469
- var $TaskListItem = styled27($ListItem)`
6002
+ var $TaskListItem = styled28($ListItem)`
5470
6003
  position: relative;
5471
6004
  list-style-type: none;
5472
6005
  .--list-item-icon {
@@ -5483,7 +6016,7 @@ var $TaskListItem = styled27($ListItem)`
5483
6016
  `;
5484
6017
 
5485
6018
  // src/list-plugin/render-element/ordered-list-item.tsx
5486
- import { jsx as jsx35 } from "react/jsx-runtime";
6019
+ import { jsx as jsx40 } from "react/jsx-runtime";
5487
6020
  function OrderedListItem({
5488
6021
  element,
5489
6022
  attributes,
@@ -5499,16 +6032,16 @@ function OrderedListItem({
5499
6032
  "--list-item-var": `list-item-depth-${element.depth}`
5500
6033
  };
5501
6034
  const className = clsx6({ "--first-at-depth": element.__firstAtDepth });
5502
- return /* @__PURE__ */ jsx35($OrderedListItem, { ...attributes, className, style, children });
6035
+ return /* @__PURE__ */ jsx40($OrderedListItem, { ...attributes, className, style, children });
5503
6036
  }
5504
6037
 
5505
6038
  // src/list-plugin/render-element/task-list-item.tsx
5506
- import { useCallback as useCallback9 } from "react";
6039
+ import { useCallback as useCallback10 } from "react";
5507
6040
  import { useSlateStatic as useSlateStatic12 } from "slate-react";
5508
6041
 
5509
6042
  // src/list-plugin/render-element/list-icons.tsx
5510
- import { jsx as jsx36, jsxs as jsxs18 } from "react/jsx-runtime";
5511
- var UncheckedIcon = (props) => /* @__PURE__ */ jsxs18(
6043
+ import { jsx as jsx41, jsxs as jsxs19 } from "react/jsx-runtime";
6044
+ var UncheckedIcon = (props) => /* @__PURE__ */ jsxs19(
5512
6045
  "svg",
5513
6046
  {
5514
6047
  xmlns: "http://www.w3.org/2000/svg",
@@ -5522,12 +6055,12 @@ var UncheckedIcon = (props) => /* @__PURE__ */ jsxs18(
5522
6055
  viewBox: "0 0 24 24",
5523
6056
  ...props,
5524
6057
  children: [
5525
- /* @__PURE__ */ jsx36("path", { d: "M0 0h24v24H0z", stroke: "none" }),
5526
- /* @__PURE__ */ jsx36("rect", { x: 4, y: 4, width: 16, height: 16, rx: 2 })
6058
+ /* @__PURE__ */ jsx41("path", { d: "M0 0h24v24H0z", stroke: "none" }),
6059
+ /* @__PURE__ */ jsx41("rect", { x: 4, y: 4, width: 16, height: 16, rx: 2 })
5527
6060
  ]
5528
6061
  }
5529
6062
  );
5530
- var CheckedIcon = (props) => /* @__PURE__ */ jsxs18(
6063
+ var CheckedIcon = (props) => /* @__PURE__ */ jsxs19(
5531
6064
  "svg",
5532
6065
  {
5533
6066
  xmlns: "http://www.w3.org/2000/svg",
@@ -5542,13 +6075,13 @@ var CheckedIcon = (props) => /* @__PURE__ */ jsxs18(
5542
6075
  viewBox: "0 0 24 24",
5543
6076
  ...props,
5544
6077
  children: [
5545
- /* @__PURE__ */ jsx36("path", { d: "M0 0h24v24H0z", stroke: "none" }),
5546
- /* @__PURE__ */ jsx36("path", { d: "m9 11 3 3 8-8", className: "--checkmark" }),
5547
- /* @__PURE__ */ jsx36("path", { d: "M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9" })
6078
+ /* @__PURE__ */ jsx41("path", { d: "M0 0h24v24H0z", stroke: "none" }),
6079
+ /* @__PURE__ */ jsx41("path", { d: "m9 11 3 3 8-8", className: "--checkmark" }),
6080
+ /* @__PURE__ */ jsx41("path", { d: "M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9" })
5548
6081
  ]
5549
6082
  }
5550
6083
  );
5551
- var BulletIcon = (props) => /* @__PURE__ */ jsx36(
6084
+ var BulletIcon = (props) => /* @__PURE__ */ jsx41(
5552
6085
  "svg",
5553
6086
  {
5554
6087
  xmlns: "http://www.w3.org/2000/svg",
@@ -5557,56 +6090,56 @@ var BulletIcon = (props) => /* @__PURE__ */ jsx36(
5557
6090
  width: "1em",
5558
6091
  height: "1em",
5559
6092
  ...props,
5560
- children: /* @__PURE__ */ jsx36("path", { d: "M12 8.25a3.75 3.75 0 1 0 0 7.5 3.75 3.75 0 0 0 0-7.5z" })
6093
+ children: /* @__PURE__ */ jsx41("path", { d: "M12 8.25a3.75 3.75 0 1 0 0 7.5 3.75 3.75 0 0 0 0-7.5z" })
5561
6094
  }
5562
6095
  );
5563
6096
 
5564
6097
  // src/list-plugin/render-element/task-list-item.tsx
5565
- import { jsx as jsx37, jsxs as jsxs19 } from "react/jsx-runtime";
6098
+ import { jsx as jsx42, jsxs as jsxs20 } from "react/jsx-runtime";
5566
6099
  function TaskListItem({
5567
6100
  element,
5568
6101
  attributes,
5569
6102
  children
5570
6103
  }) {
5571
6104
  const editor = useSlateStatic12();
5572
- const toggle = useCallback9(() => {
6105
+ const toggle = useCallback10(() => {
5573
6106
  editor.list.toggleTaskListItem({ at: element });
5574
6107
  }, [editor, element]);
5575
6108
  const style = { "--list-item-depth": element.depth };
5576
- return /* @__PURE__ */ jsxs19($TaskListItem, { ...attributes, style, children: [
5577
- /* @__PURE__ */ jsx37("div", { className: "--list-item-icon", contentEditable: false, children: element.checked ? /* @__PURE__ */ jsx37(CheckedIcon, { onClick: toggle, style: { cursor: "pointer" } }) : /* @__PURE__ */ jsx37(UncheckedIcon, { onClick: toggle, style: { cursor: "pointer" } }) }),
6109
+ return /* @__PURE__ */ jsxs20($TaskListItem, { ...attributes, style, children: [
6110
+ /* @__PURE__ */ jsx42("div", { className: "--list-item-icon", contentEditable: false, children: element.checked ? /* @__PURE__ */ jsx42(CheckedIcon, { onClick: toggle, style: { cursor: "pointer" } }) : /* @__PURE__ */ jsx42(UncheckedIcon, { onClick: toggle, style: { cursor: "pointer" } }) }),
5578
6111
  children
5579
6112
  ] });
5580
6113
  }
5581
6114
 
5582
6115
  // src/list-plugin/render-element/unordered-list-item.tsx
5583
- import { jsx as jsx38, jsxs as jsxs20 } from "react/jsx-runtime";
6116
+ import { jsx as jsx43, jsxs as jsxs21 } from "react/jsx-runtime";
5584
6117
  function UnorderedListItem({
5585
6118
  element,
5586
6119
  attributes,
5587
6120
  children
5588
6121
  }) {
5589
6122
  const style = { "--list-item-depth": element.depth };
5590
- return /* @__PURE__ */ jsxs20($UnorderedListItem, { ...attributes, style, children: [
5591
- /* @__PURE__ */ jsx38("div", { className: "--list-item-icon", contentEditable: false, children: /* @__PURE__ */ jsx38(BulletIcon, {}) }),
6123
+ return /* @__PURE__ */ jsxs21($UnorderedListItem, { ...attributes, style, children: [
6124
+ /* @__PURE__ */ jsx43("div", { className: "--list-item-icon", contentEditable: false, children: /* @__PURE__ */ jsx43(BulletIcon, {}) }),
5592
6125
  children
5593
6126
  ] });
5594
6127
  }
5595
6128
 
5596
6129
  // src/list-plugin/render-element/index.tsx
5597
- import { jsx as jsx39 } from "react/jsx-runtime";
5598
- function renderElement2({
6130
+ import { jsx as jsx44 } from "react/jsx-runtime";
6131
+ function renderElement3({
5599
6132
  element,
5600
6133
  attributes,
5601
6134
  children
5602
6135
  }) {
5603
6136
  switch (element.type) {
5604
6137
  case "ordered-list-item":
5605
- return /* @__PURE__ */ jsx39(OrderedListItem, { element, attributes, children });
6138
+ return /* @__PURE__ */ jsx44(OrderedListItem, { element, attributes, children });
5606
6139
  case "unordered-list-item":
5607
- return /* @__PURE__ */ jsx39(UnorderedListItem, { element, attributes, children });
6140
+ return /* @__PURE__ */ jsx44(UnorderedListItem, { element, attributes, children });
5608
6141
  case "task-list-item":
5609
- return /* @__PURE__ */ jsx39(TaskListItem, { element, attributes, children });
6142
+ return /* @__PURE__ */ jsx44(TaskListItem, { element, attributes, children });
5610
6143
  }
5611
6144
  }
5612
6145
 
@@ -5631,7 +6164,7 @@ var ListPlugin = createPlugin(
5631
6164
  return createPolicy({
5632
6165
  name: "list",
5633
6166
  editor: {
5634
- normalizeNode: (entry) => normalizeNode4(editor, entry),
6167
+ normalizeNode: (entry) => normalizeNode5(editor, entry),
5635
6168
  insertBreak: list.insertBreak,
5636
6169
  deleteBackward: (unit) => {
5637
6170
  if (unit !== "character")
@@ -5642,12 +6175,12 @@ var ListPlugin = createPlugin(
5642
6175
  if (!listItem)
5643
6176
  return false;
5644
6177
  const listItemPath = listItem[1];
5645
- if (!Path8.hasPrevious(listItemPath)) {
6178
+ if (!Path9.hasPrevious(listItemPath)) {
5646
6179
  editor.collapsibleParagraph.convertParagraph();
5647
6180
  return true;
5648
6181
  }
5649
- const prevElementPath = Path8.previous(listItemPath);
5650
- const prevElementEntry = Editor36.node(editor, prevElementPath);
6182
+ const prevElementPath = Path9.previous(listItemPath);
6183
+ const prevElementEntry = Editor39.node(editor, prevElementPath);
5651
6184
  if (isListItem(prevElementEntry[0]))
5652
6185
  return false;
5653
6186
  editor.collapsibleParagraph.convertParagraph();
@@ -5655,9 +6188,9 @@ var ListPlugin = createPlugin(
5655
6188
  }
5656
6189
  },
5657
6190
  editableProps: {
5658
- renderElement: renderElement2,
6191
+ renderElement: renderElement3,
5659
6192
  onKeyDown(e) {
5660
- if (!Editor36.nodes(editor, { match: isListItem }))
6193
+ if (!Editor39.nodes(editor, { match: isListItem }))
5661
6194
  return false;
5662
6195
  return hotkeyHandler(e);
5663
6196
  }
@@ -5668,15 +6201,15 @@ var ListPlugin = createPlugin(
5668
6201
 
5669
6202
  // src/marks-plugin/index.tsx
5670
6203
  import { clsx as clsx7 } from "clsx";
5671
- import { Editor as Editor39, Point as Point2, Range as Range6 } from "slate";
6204
+ import { Editor as Editor42, Point as Point2, Range as Range7 } from "slate";
5672
6205
 
5673
6206
  // src/marks-plugin/methods/removeMarks.ts
5674
- import { Editor as Editor37, Text as Text4, Transforms as Transforms24 } from "slate";
6207
+ import { Editor as Editor40, Text as Text4, Transforms as Transforms27 } from "slate";
5675
6208
  function removeMarks(editor, { at = editor.selection } = {}) {
5676
6209
  if (at == null)
5677
6210
  return;
5678
6211
  const nodeEntries = [
5679
- ...Editor37.nodes(editor, {
6212
+ ...Editor40.nodes(editor, {
5680
6213
  match: (n) => Text4.isText(n),
5681
6214
  at
5682
6215
  })
@@ -5689,7 +6222,7 @@ function removeMarks(editor, { at = editor.selection } = {}) {
5689
6222
  setter[key2] = null;
5690
6223
  }
5691
6224
  }
5692
- Transforms24.setNodes(editor, setter, {
6225
+ Transforms27.setNodes(editor, setter, {
5693
6226
  match: (n) => Text4.isText(n),
5694
6227
  split: true,
5695
6228
  at
@@ -5697,14 +6230,14 @@ function removeMarks(editor, { at = editor.selection } = {}) {
5697
6230
  }
5698
6231
 
5699
6232
  // src/marks-plugin/methods/toggle-mark.ts
5700
- import { Editor as Editor38, Point, Range as Range5 } from "slate";
6233
+ import { Editor as Editor41, Point, Range as Range6 } from "slate";
5701
6234
  function toggleMark(editor, markKey, unsetKey, { at = editor.selection } = {}) {
5702
6235
  if (at == null)
5703
6236
  return;
5704
- const point = Range5.isRange(at) ? at.focus : at;
5705
- const isAtLineEnd = Point.isPoint(point) && (Editor38.after(editor, point) === null || Editor38.isEnd(editor, point, Editor38.end(editor, [])));
6237
+ const point = Range6.isRange(at) ? at.focus : at;
6238
+ const isAtLineEnd = Point.isPoint(point) && (Editor41.after(editor, point) === null || Editor41.isEnd(editor, point, Editor41.end(editor, [])));
5706
6239
  const validMarkKey = markKey;
5707
- const marks = Editor38.marks(editor) || {};
6240
+ const marks = Editor41.marks(editor) || {};
5708
6241
  const isActive = marks[validMarkKey] === true;
5709
6242
  if (isAtLineEnd) {
5710
6243
  if (!isActive) {
@@ -5718,12 +6251,12 @@ function toggleMark(editor, markKey, unsetKey, { at = editor.selection } = {}) {
5718
6251
  }
5719
6252
  }
5720
6253
  if (isActive) {
5721
- Editor38.removeMark(editor, validMarkKey);
6254
+ Editor41.removeMark(editor, validMarkKey);
5722
6255
  } else {
5723
- Editor38.addMark(editor, validMarkKey, true);
6256
+ Editor41.addMark(editor, validMarkKey, true);
5724
6257
  }
5725
6258
  if (typeof unsetKey === "string") {
5726
- Editor38.removeMark(editor, unsetKey);
6259
+ Editor41.removeMark(editor, unsetKey);
5727
6260
  }
5728
6261
  }
5729
6262
 
@@ -5740,8 +6273,8 @@ function createMarksMethods(editor) {
5740
6273
  }
5741
6274
 
5742
6275
  // src/marks-plugin/styles.tsx
5743
- import styled28 from "@emotion/styled";
5744
- var $MarksSpan = styled28("span")`
6276
+ import styled29 from "@emotion/styled";
6277
+ var $MarksSpan = styled29("span")`
5745
6278
  &.--bold {
5746
6279
  font-weight: bold;
5747
6280
  }
@@ -5764,7 +6297,7 @@ var $MarksSpan = styled28("span")`
5764
6297
  `;
5765
6298
 
5766
6299
  // src/marks-plugin/index.tsx
5767
- import { jsx as jsx40 } from "react/jsx-runtime";
6300
+ import { jsx as jsx45 } from "react/jsx-runtime";
5768
6301
  var MarksPlugin = createPlugin((editor) => {
5769
6302
  editor.marksPlugin = createMarksMethods(editor);
5770
6303
  editor.activeMarks = {};
@@ -5791,9 +6324,9 @@ var MarksPlugin = createPlugin((editor) => {
5791
6324
  editor.marksPlugin.removeMarks = () => {
5792
6325
  removeMarks2();
5793
6326
  if (editor.selection) {
5794
- const point = Range6.isRange(editor.selection) ? editor.selection.focus : editor.selection;
6327
+ const point = Range7.isRange(editor.selection) ? editor.selection.focus : editor.selection;
5795
6328
  if (Point2.isPoint(point)) {
5796
- const isAtLineEnd = Editor39.after(editor, point) === null || Editor39.isEnd(editor, point, Editor39.end(editor, []));
6329
+ const isAtLineEnd = Editor42.after(editor, point) === null || Editor42.isEnd(editor, point, Editor42.end(editor, []));
5797
6330
  if (isAtLineEnd) {
5798
6331
  editor.activeMarks = {};
5799
6332
  }
@@ -5804,7 +6337,7 @@ var MarksPlugin = createPlugin((editor) => {
5804
6337
  name: "marks",
5805
6338
  editableProps: {
5806
6339
  renderLeaf: ({ leaf, children }) => {
5807
- return /* @__PURE__ */ jsx40(
6340
+ return /* @__PURE__ */ jsx45(
5808
6341
  $MarksSpan,
5809
6342
  {
5810
6343
  className: clsx7({
@@ -5827,11 +6360,11 @@ var MarksPlugin = createPlugin((editor) => {
5827
6360
  });
5828
6361
 
5829
6362
  // src/normalize-after-delete-plugin/index.tsx
5830
- import { Editor as Editor40, Point as Point3 } from "slate";
6363
+ import { Editor as Editor43, Point as Point3 } from "slate";
5831
6364
  function forceNormalizeNearestElement(editor) {
5832
6365
  if (!editor.selection)
5833
6366
  return;
5834
- const entry = Editor40.parent(editor, editor.selection);
6367
+ const entry = Editor43.parent(editor, editor.selection);
5835
6368
  forceNormalizePath(editor, entry[1]);
5836
6369
  }
5837
6370
  var NormalizeAfterDeletePlugin = createPlugin((editor) => {
@@ -5842,9 +6375,9 @@ var NormalizeAfterDeletePlugin = createPlugin((editor) => {
5842
6375
  deleteBackward() {
5843
6376
  if (!editor.selection)
5844
6377
  return false;
5845
- const entry = Editor40.parent(editor, editor.selection);
6378
+ const entry = Editor43.parent(editor, editor.selection);
5846
6379
  const isStart = Point3.equals(
5847
- Editor40.start(editor, entry[1]),
6380
+ Editor43.start(editor, entry[1]),
5848
6381
  editor.selection.anchor
5849
6382
  );
5850
6383
  if (!isStart)
@@ -5856,9 +6389,9 @@ var NormalizeAfterDeletePlugin = createPlugin((editor) => {
5856
6389
  deleteForward() {
5857
6390
  if (!editor.selection)
5858
6391
  return false;
5859
- const entry = Editor40.parent(editor, editor.selection);
6392
+ const entry = Editor43.parent(editor, editor.selection);
5860
6393
  const isEnd = Point3.equals(
5861
- Editor40.end(editor, entry[1]),
6394
+ Editor43.end(editor, entry[1]),
5862
6395
  editor.selection.anchor
5863
6396
  );
5864
6397
  if (!isEnd)
@@ -5873,15 +6406,15 @@ var NormalizeAfterDeletePlugin = createPlugin((editor) => {
5873
6406
  });
5874
6407
 
5875
6408
  // src/table-plugin/index.tsx
5876
- import { Element as Element19 } from "slate";
6409
+ import { Element as Element23 } from "slate";
5877
6410
 
5878
6411
  // src/table-plugin/delete-fragment/index.ts
5879
- import { Editor as Editor42, Path as Path10, Transforms as Transforms26 } from "slate";
6412
+ import { Editor as Editor45, Path as Path11, Transforms as Transforms29 } from "slate";
5880
6413
 
5881
6414
  // src/table-plugin/delete-fragment/get-reversed-delete-safe-ranges.ts
5882
- import { Editor as Editor41, Path as Path9 } from "slate";
6415
+ import { Editor as Editor44, Path as Path10 } from "slate";
5883
6416
  function getReversedDeleteSafeRanges(editor, deleteRange, protectedTypes) {
5884
- const positions = [...Editor41.positions(editor, { at: deleteRange })];
6417
+ const positions = [...Editor44.positions(editor, { at: deleteRange })];
5885
6418
  const deleteSafeRanges = [];
5886
6419
  let startPos, prevPos, startTdPath;
5887
6420
  startPos = prevPos = positions[0];
@@ -5892,7 +6425,7 @@ function getReversedDeleteSafeRanges(editor, deleteRange, protectedTypes) {
5892
6425
  const tdPath = findElementUpPath(editor, protectedTypes, {
5893
6426
  at: pos
5894
6427
  });
5895
- if (startTdPath && tdPath && Path9.equals(startTdPath, tdPath) || startTdPath == void 0 && tdPath == void 0) {
6428
+ if (startTdPath && tdPath && Path10.equals(startTdPath, tdPath) || startTdPath == void 0 && tdPath == void 0) {
5896
6429
  prevPos = pos;
5897
6430
  } else {
5898
6431
  const range2 = { anchor: startPos, focus: prevPos };
@@ -5911,7 +6444,7 @@ function getReversedDeleteSafeRanges(editor, deleteRange, protectedTypes) {
5911
6444
  function deleteFragmentWithProtectedTypes(editor, protectedTypes) {
5912
6445
  if (editor.selection == null)
5913
6446
  return false;
5914
- const [start, end] = Editor42.edges(editor, editor.selection);
6447
+ const [start, end] = Editor45.edges(editor, editor.selection);
5915
6448
  const startProtectedPath = findElementUpPath(editor, protectedTypes, {
5916
6449
  at: start
5917
6450
  });
@@ -5921,7 +6454,7 @@ function deleteFragmentWithProtectedTypes(editor, protectedTypes) {
5921
6454
  if (!startProtectedPath && !endProtectedPath) {
5922
6455
  return false;
5923
6456
  }
5924
- if (startProtectedPath && endProtectedPath && Path10.equals(startProtectedPath, endProtectedPath)) {
6457
+ if (startProtectedPath && endProtectedPath && Path11.equals(startProtectedPath, endProtectedPath)) {
5925
6458
  return false;
5926
6459
  }
5927
6460
  const reversedRanges = getReversedDeleteSafeRanges(
@@ -5929,17 +6462,17 @@ function deleteFragmentWithProtectedTypes(editor, protectedTypes) {
5929
6462
  editor.selection,
5930
6463
  protectedTypes
5931
6464
  );
5932
- Editor42.withoutNormalizing(editor, () => {
6465
+ Editor45.withoutNormalizing(editor, () => {
5933
6466
  for (const range of reversedRanges) {
5934
- Transforms26.delete(editor, { at: range });
6467
+ Transforms29.delete(editor, { at: range });
5935
6468
  }
5936
- Transforms26.collapse(editor, { edge: "start" });
6469
+ Transforms29.collapse(editor, { edge: "start" });
5937
6470
  });
5938
6471
  return true;
5939
6472
  }
5940
6473
 
5941
6474
  // src/table-plugin/methods/index.ts
5942
- import { Transforms as Transforms34 } from "slate";
6475
+ import { Transforms as Transforms37 } from "slate";
5943
6476
 
5944
6477
  // src/table-plugin/methods/get-table-info.ts
5945
6478
  function getTableInfo(editor, { at = editor.selection } = {}) {
@@ -5977,7 +6510,7 @@ function getTableInfo(editor, { at = editor.selection } = {}) {
5977
6510
  }
5978
6511
 
5979
6512
  // src/table-plugin/methods/insert-column.ts
5980
- import { Editor as Editor43, Transforms as Transforms27 } from "slate";
6513
+ import { Editor as Editor46, Transforms as Transforms30 } from "slate";
5981
6514
 
5982
6515
  // src/table-plugin/methods/utils.ts
5983
6516
  function createCell(index, children = [
@@ -5999,13 +6532,13 @@ function insertColumn(editor, { offset = 0, at = editor.selection } = {}) {
5999
6532
  return false;
6000
6533
  const { tableElement, tablePath, cellIndex } = t2;
6001
6534
  const nextCellIndex = cellIndex + offset;
6002
- Editor43.withoutNormalizing(editor, () => {
6535
+ Editor46.withoutNormalizing(editor, () => {
6003
6536
  const { columns } = tableElement;
6004
6537
  const nextColumns = [...columns];
6005
6538
  nextColumns.splice(nextCellIndex, 0, columns[nextCellIndex]);
6006
- Transforms27.setNodes(editor, { columns: nextColumns }, { at: tablePath });
6539
+ Transforms30.setNodes(editor, { columns: nextColumns }, { at: tablePath });
6007
6540
  tableElement.children.forEach((rowElement, i) => {
6008
- Transforms27.insertNodes(editor, createCell(nextCellIndex), {
6541
+ Transforms30.insertNodes(editor, createCell(nextCellIndex), {
6009
6542
  at: [...tablePath, i, nextCellIndex]
6010
6543
  });
6011
6544
  });
@@ -6014,7 +6547,7 @@ function insertColumn(editor, { offset = 0, at = editor.selection } = {}) {
6014
6547
  }
6015
6548
 
6016
6549
  // src/table-plugin/methods/insert-row.ts
6017
- import { Transforms as Transforms28 } from "slate";
6550
+ import { Transforms as Transforms31 } from "slate";
6018
6551
  function createRow(columnCount) {
6019
6552
  return {
6020
6553
  type: "table-row",
@@ -6026,7 +6559,7 @@ function insertRow(editor, { at = editor.selection, offset = 0 } = {}) {
6026
6559
  if (!t2)
6027
6560
  return false;
6028
6561
  const nextRowElement = createRow(t2.tableElement.columns.length);
6029
- Transforms28.insertNodes(editor, nextRowElement, {
6562
+ Transforms31.insertNodes(editor, nextRowElement, {
6030
6563
  at: [...t2.tablePath, t2.rowIndex + offset]
6031
6564
  });
6032
6565
  return true;
@@ -6036,7 +6569,7 @@ function insertRowBelow(editor, { at } = {}) {
6036
6569
  }
6037
6570
 
6038
6571
  // src/table-plugin/methods/insert-table.ts
6039
- import { Editor as Editor45, Element as Element18, Path as Path11, Transforms as Transforms29 } from "slate";
6572
+ import { Editor as Editor48, Element as Element22, Path as Path12, Transforms as Transforms32 } from "slate";
6040
6573
  function createRange(size) {
6041
6574
  return [...Array(size).keys()];
6042
6575
  }
@@ -6065,29 +6598,29 @@ function insertRootElement2(editor, element, { at = editor.selection } = {}) {
6065
6598
  return false;
6066
6599
  const entry = findElementUp(
6067
6600
  editor,
6068
- (node) => Element18.isElement(node) && editor.isMaster(node)
6601
+ (node) => Element22.isElement(node) && editor.isMaster(node)
6069
6602
  );
6070
6603
  if (entry == null) {
6071
6604
  const selection = editor.selection;
6072
- Editor45.withoutNormalizing(editor, () => {
6073
- Transforms29.insertNodes(editor, element, { at });
6605
+ Editor48.withoutNormalizing(editor, () => {
6606
+ Transforms32.insertNodes(editor, element, { at });
6074
6607
  if (selection) {
6075
- Transforms29.select(editor, selection);
6076
- Transforms29.move(editor);
6608
+ Transforms32.select(editor, selection);
6609
+ Transforms32.move(editor);
6077
6610
  }
6078
6611
  });
6079
6612
  } else {
6080
- const nextPath = Path11.next(entry[1]);
6081
- Editor45.withoutNormalizing(editor, () => {
6082
- Transforms29.insertNodes(editor, element, { at: nextPath });
6083
- Transforms29.select(editor, Editor45.start(editor, nextPath));
6613
+ const nextPath = Path12.next(entry[1]);
6614
+ Editor48.withoutNormalizing(editor, () => {
6615
+ Transforms32.insertNodes(editor, element, { at: nextPath });
6616
+ Transforms32.select(editor, Editor48.start(editor, nextPath));
6084
6617
  });
6085
6618
  }
6086
6619
  return true;
6087
6620
  }
6088
6621
 
6089
6622
  // src/table-plugin/methods/navigation/select-element.ts
6090
- import { Path as Path12 } from "slate";
6623
+ import { Path as Path13 } from "slate";
6091
6624
  function selectElementBelow(editor, t2) {
6092
6625
  const { cellIndex, rowIndex, rowCount, tablePath } = t2;
6093
6626
  if (rowIndex < rowCount - 1) {
@@ -6095,7 +6628,7 @@ function selectElementBelow(editor, t2) {
6095
6628
  return true;
6096
6629
  }
6097
6630
  try {
6098
- selectStartOfElement(editor, Path12.next(tablePath));
6631
+ selectStartOfElement(editor, Path13.next(tablePath));
6099
6632
  return true;
6100
6633
  } catch (e) {
6101
6634
  return false;
@@ -6108,7 +6641,7 @@ function selectElementAbove(editor, t2) {
6108
6641
  return true;
6109
6642
  }
6110
6643
  try {
6111
- selectEndOfElement(editor, Path12.previous(tablePath));
6644
+ selectEndOfElement(editor, Path13.previous(tablePath));
6112
6645
  return true;
6113
6646
  } catch (e) {
6114
6647
  return false;
@@ -6160,15 +6693,15 @@ function up(editor) {
6160
6693
  }
6161
6694
 
6162
6695
  // src/table-plugin/methods/remove-column.ts
6163
- import { Editor as Editor48, Transforms as Transforms31 } from "slate";
6696
+ import { Editor as Editor51, Transforms as Transforms34 } from "slate";
6164
6697
 
6165
6698
  // src/table-plugin/methods/remove-table.ts
6166
- import { Transforms as Transforms30 } from "slate";
6699
+ import { Transforms as Transforms33 } from "slate";
6167
6700
  function removeTable(editor) {
6168
6701
  const t2 = editor.tablePlugin.getTableInfo();
6169
6702
  if (t2 === void 0)
6170
6703
  return false;
6171
- Transforms30.removeNodes(editor, { at: t2.tablePath });
6704
+ Transforms33.removeNodes(editor, { at: t2.tablePath });
6172
6705
  return true;
6173
6706
  }
6174
6707
 
@@ -6181,26 +6714,26 @@ function removeColumn(editor, { at = editor.selection } = {}) {
6181
6714
  if (cellCount === 1) {
6182
6715
  return removeTable(editor);
6183
6716
  }
6184
- Editor48.withoutNormalizing(editor, () => {
6717
+ Editor51.withoutNormalizing(editor, () => {
6185
6718
  const columns = [...tableElement.columns];
6186
6719
  columns.splice(cellIndex, 1);
6187
- Transforms31.setNodes(editor, { columns }, { at: tablePath });
6720
+ Transforms34.setNodes(editor, { columns }, { at: tablePath });
6188
6721
  tableElement.children.forEach((rowElement, rowIndex2) => {
6189
- Transforms31.removeNodes(editor, {
6722
+ Transforms34.removeNodes(editor, {
6190
6723
  at: [...tablePath, rowIndex2, cellIndex]
6191
6724
  });
6192
6725
  });
6193
- const selection = Editor48.start(editor, [
6726
+ const selection = Editor51.start(editor, [
6194
6727
  ...tablePath,
6195
6728
  rowIndex,
6196
6729
  Math.min(cellIndex, cellCount - 2)
6197
6730
  ]);
6198
- Transforms31.select(editor, selection);
6731
+ Transforms34.select(editor, selection);
6199
6732
  });
6200
6733
  }
6201
6734
 
6202
6735
  // src/table-plugin/methods/remove-row.ts
6203
- import { Editor as Editor49, Transforms as Transforms32 } from "slate";
6736
+ import { Editor as Editor52, Transforms as Transforms35 } from "slate";
6204
6737
  function removeRow(editor, { at = editor.selection } = {}) {
6205
6738
  const t2 = getTableInfo(editor, { at });
6206
6739
  if (t2 === void 0)
@@ -6209,11 +6742,11 @@ function removeRow(editor, { at = editor.selection } = {}) {
6209
6742
  removeTable(editor);
6210
6743
  return true;
6211
6744
  }
6212
- Editor49.withoutNormalizing(editor, () => {
6213
- Transforms32.removeNodes(editor, { at: t2.rowPath });
6214
- Transforms32.select(
6745
+ Editor52.withoutNormalizing(editor, () => {
6746
+ Transforms35.removeNodes(editor, { at: t2.rowPath });
6747
+ Transforms35.select(
6215
6748
  editor,
6216
- Editor49.start(editor, [
6749
+ Editor52.start(editor, [
6217
6750
  ...t2.tablePath,
6218
6751
  Math.min(t2.rowIndex, t2.rowCount - 2),
6219
6752
  t2.cellIndex
@@ -6224,7 +6757,7 @@ function removeRow(editor, { at = editor.selection } = {}) {
6224
6757
  }
6225
6758
 
6226
6759
  // src/table-plugin/methods/setTableColumnAlign.ts
6227
- import { Transforms as Transforms33 } from "slate";
6760
+ import { Transforms as Transforms36 } from "slate";
6228
6761
  function setTableColumnAlign(editor, options) {
6229
6762
  const t2 = getTableInfo(editor);
6230
6763
  if (t2 === void 0)
@@ -6232,7 +6765,7 @@ function setTableColumnAlign(editor, options) {
6232
6765
  const { tableElement, tablePath, cellIndex } = t2;
6233
6766
  const nextColumns = tableElement.columns.slice();
6234
6767
  nextColumns.splice(cellIndex, 1, { align: options.align });
6235
- Transforms33.setNodes(editor, { columns: nextColumns }, { at: tablePath });
6768
+ Transforms36.setNodes(editor, { columns: nextColumns }, { at: tablePath });
6236
6769
  return true;
6237
6770
  }
6238
6771
 
@@ -6292,12 +6825,12 @@ function selectCell(editor, { at = editor.selection } = {}) {
6292
6825
  if (t2 === void 0)
6293
6826
  return false;
6294
6827
  const { cellPath } = t2;
6295
- Transforms34.select(editor, cellPath);
6828
+ Transforms37.select(editor, cellPath);
6296
6829
  return true;
6297
6830
  }
6298
6831
 
6299
6832
  // src/table-plugin/normalize/normalize-table.ts
6300
- import { Transforms as Transforms35 } from "slate";
6833
+ import { Transforms as Transforms38 } from "slate";
6301
6834
  function normalizeTableIndexes(editor, entry) {
6302
6835
  let isTransformed = false;
6303
6836
  const rowElements = entry[0].children;
@@ -6305,7 +6838,7 @@ function normalizeTableIndexes(editor, entry) {
6305
6838
  const cellElements = rowElement.children;
6306
6839
  cellElements.forEach((cellElement, x) => {
6307
6840
  if (cellElement.x !== x || cellElement.y !== y) {
6308
- Transforms35.setNodes(editor, { x, y }, { at: [...entry[1], y, x] });
6841
+ Transforms38.setNodes(editor, { x, y }, { at: [...entry[1], y, x] });
6309
6842
  isTransformed = true;
6310
6843
  }
6311
6844
  });
@@ -6314,14 +6847,14 @@ function normalizeTableIndexes(editor, entry) {
6314
6847
  }
6315
6848
 
6316
6849
  // src/table-plugin/normalize/normalize-table-cell.ts
6317
- import { Editor as Editor53, Transforms as Transforms36 } from "slate";
6850
+ import { Editor as Editor56, Transforms as Transforms39 } from "slate";
6318
6851
  function normalizeTableCell(editor, entry) {
6319
6852
  const [node, path] = entry;
6320
6853
  if (node.children.length === 1 && node.children[0].type === "table-content") {
6321
6854
  return false;
6322
6855
  }
6323
- Editor53.withoutNormalizing(editor, () => {
6324
- Transforms36.insertNodes(
6856
+ Editor56.withoutNormalizing(editor, () => {
6857
+ Transforms39.insertNodes(
6325
6858
  editor,
6326
6859
  {
6327
6860
  type: "table-content",
@@ -6330,9 +6863,9 @@ function normalizeTableCell(editor, entry) {
6330
6863
  { at: [...entry[1], 0] }
6331
6864
  );
6332
6865
  for (let i = node.children.length; i >= 0; i--) {
6333
- Transforms36.mergeNodes(editor, { at: [...path, i] });
6866
+ Transforms39.mergeNodes(editor, { at: [...path, i] });
6334
6867
  }
6335
- Transforms36.delete(editor, {
6868
+ Transforms39.delete(editor, {
6336
6869
  at: { path: [...path, 0, 0], offset: 0 },
6337
6870
  unit: "character"
6338
6871
  });
@@ -6342,14 +6875,14 @@ function normalizeTableCell(editor, entry) {
6342
6875
 
6343
6876
  // src/table-plugin/render-element/table.tsx
6344
6877
  import { useEffect as useEffect6 } from "react";
6345
- import { ReactEditor as ReactEditor11, useSelected as useSelected5, useSlateStatic as useSlateStatic13 } from "slate-react";
6878
+ import { ReactEditor as ReactEditor11, useSelected as useSelected7, useSlateStatic as useSlateStatic13 } from "slate-react";
6346
6879
 
6347
6880
  // src/table-plugin/render-element/styles/index.ts
6348
- import styled30 from "@emotion/styled";
6881
+ import styled31 from "@emotion/styled";
6349
6882
 
6350
6883
  // src/table-plugin/render-element/styles/table-menu-styles.ts
6351
- import styled29 from "@emotion/styled";
6352
- var $BaseMenu = styled29("div")`
6884
+ import styled30 from "@emotion/styled";
6885
+ var $BaseMenu = styled30("div")`
6353
6886
  position: absolute;
6354
6887
  /**
6355
6888
  * very slightly shaded
@@ -6374,7 +6907,7 @@ var $BaseMenu = styled29("div")`
6374
6907
  }
6375
6908
  }
6376
6909
  `;
6377
- var $ColumnMenu = styled29($BaseMenu)`
6910
+ var $ColumnMenu = styled30($BaseMenu)`
6378
6911
  cursor: pointer;
6379
6912
  /**
6380
6913
  * hangs out on top
@@ -6385,7 +6918,7 @@ var $ColumnMenu = styled29($BaseMenu)`
6385
6918
  height: 3em;
6386
6919
  top: -3em;
6387
6920
  `;
6388
- var $RowMenu = styled29($BaseMenu)`
6921
+ var $RowMenu = styled30($BaseMenu)`
6389
6922
  /**
6390
6923
  * hangs out on left
6391
6924
  */
@@ -6394,7 +6927,7 @@ var $RowMenu = styled29($BaseMenu)`
6394
6927
  width: 3em;
6395
6928
  left: -3em;
6396
6929
  `;
6397
- var $MenuTile = styled29("div")`
6930
+ var $MenuTile = styled30("div")`
6398
6931
  position: absolute;
6399
6932
  background: rgba(0, 0, 0, 0.05);
6400
6933
  border: 1px solid rgba(0, 0, 0, 0.05);
@@ -6407,7 +6940,7 @@ var $MenuTile = styled29("div")`
6407
6940
  right: 0;
6408
6941
  bottom: 0;
6409
6942
  `;
6410
- var $ColumnMenuTile = styled29($MenuTile)`
6943
+ var $ColumnMenuTile = styled30($MenuTile)`
6411
6944
  top: 50%;
6412
6945
  border-bottom: none;
6413
6946
  border-right: none;
@@ -6434,7 +6967,7 @@ var $ColumnMenuTile = styled29($MenuTile)`
6434
6967
  /* border-top-left-radius: 0.5em;
6435
6968
  border-top-right-radius: 0.5em; */
6436
6969
  `;
6437
- var $RowMenuTile = styled29($MenuTile)`
6970
+ var $RowMenuTile = styled30($MenuTile)`
6438
6971
  left: 50%;
6439
6972
  border-right: none;
6440
6973
  border-bottom: none;
@@ -6461,7 +6994,7 @@ var $RowMenuTile = styled29($MenuTile)`
6461
6994
  /* border-top-left-radius: 0.5em;
6462
6995
  border-bottom-left-radius: 0.5em; */
6463
6996
  `;
6464
- var $MenuButton = styled29("div")`
6997
+ var $MenuButton = styled30("div")`
6465
6998
  position: absolute;
6466
6999
  font-size: 1.5em;
6467
7000
  background: white;
@@ -6471,13 +7004,13 @@ var $MenuButton = styled29("div")`
6471
7004
  display: block;
6472
7005
  }
6473
7006
  `;
6474
- var $AddMenuButton = styled29($MenuButton)`
7007
+ var $AddMenuButton = styled30($MenuButton)`
6475
7008
  color: #c0c0c0;
6476
7009
  &:hover {
6477
7010
  color: royalblue;
6478
7011
  }
6479
7012
  `;
6480
- var $RemoveMenuButton = styled29($MenuButton)`
7013
+ var $RemoveMenuButton = styled30($MenuButton)`
6481
7014
  color: #c0c0c0;
6482
7015
  &:hover {
6483
7016
  color: firebrick;
@@ -6485,20 +7018,20 @@ var $RemoveMenuButton = styled29($MenuButton)`
6485
7018
  `;
6486
7019
 
6487
7020
  // src/table-plugin/render-element/styles/index.ts
6488
- var $Table = styled30("table")`
7021
+ var $Table = styled31("table")`
6489
7022
  border-collapse: collapse;
6490
7023
  margin: 1em 0;
6491
7024
  ${({ columns }) => columns.map(
6492
7025
  (column, index) => `td:nth-of-type(${index + 1}) { text-align: ${column.align}; }`
6493
7026
  ).join("\n")}
6494
7027
  `;
6495
- var $TableRow = styled30("tr")`
7028
+ var $TableRow = styled31("tr")`
6496
7029
  position: relative;
6497
7030
  &:first-of-type {
6498
7031
  background: var(--table-head-bgcolor);
6499
7032
  }
6500
7033
  `;
6501
- var $TableCell = styled30("td")`
7034
+ var $TableCell = styled31("td")`
6502
7035
  position: relative;
6503
7036
  border-width: 1px;
6504
7037
  border-style: solid;
@@ -6519,7 +7052,7 @@ var $TableCell = styled30("td")`
6519
7052
  border-right-color: var(--table-border-color);
6520
7053
  }
6521
7054
  `;
6522
- var $TableContent = styled30("div")`
7055
+ var $TableContent = styled31("div")`
6523
7056
  /**
6524
7057
  * Smaller font inside a table than outside of it
6525
7058
  */
@@ -6540,32 +7073,32 @@ var TableContext = createContext2({
6540
7073
  });
6541
7074
 
6542
7075
  // src/table-plugin/render-element/table.tsx
6543
- import { jsx as jsx41 } from "react/jsx-runtime";
7076
+ import { jsx as jsx46 } from "react/jsx-runtime";
6544
7077
  function Table({
6545
7078
  element,
6546
7079
  attributes,
6547
7080
  children
6548
7081
  }) {
6549
7082
  const editor = useSlateStatic13();
6550
- const isSelected = useSelected5();
7083
+ const isSelected = useSelected7();
6551
7084
  useEffect6(() => {
6552
7085
  const path = ReactEditor11.findPath(editor, element);
6553
7086
  normalizeTableIndexes(editor, [element, path]);
6554
7087
  }, []);
6555
- return /* @__PURE__ */ jsx41(TableContext.Provider, { value: { isSelected }, children: /* @__PURE__ */ jsx41($Table, { ...attributes, columns: element.columns, children: /* @__PURE__ */ jsx41("tbody", { children }) }) });
7088
+ return /* @__PURE__ */ jsx46(TableContext.Provider, { value: { isSelected }, children: /* @__PURE__ */ jsx46($Table, { ...attributes, columns: element.columns, children: /* @__PURE__ */ jsx46("tbody", { children }) }) });
6556
7089
  }
6557
7090
 
6558
7091
  // src/table-plugin/render-element/table-cell/index.tsx
6559
7092
  import { useContext as useContext2 } from "react";
6560
- import { useSelected as useSelected6 } from "slate-react";
7093
+ import { useSelected as useSelected8 } from "slate-react";
6561
7094
 
6562
7095
  // src/table-plugin/render-element/table-cell/column-menu/index.tsx
6563
- import { useCallback as useCallback10, useRef as useRef5, useState as useState5 } from "react";
7096
+ import { useCallback as useCallback11, useRef as useRef6, useState as useState5 } from "react";
6564
7097
  import { useSlateStatic as useSlateStatic14 } from "slate-react";
6565
7098
 
6566
7099
  // src/table-plugin/icons.tsx
6567
- import { jsx as jsx42 } from "react/jsx-runtime";
6568
- var PlusIcon = (props) => /* @__PURE__ */ jsx42(
7100
+ import { jsx as jsx47 } from "react/jsx-runtime";
7101
+ var PlusIcon = (props) => /* @__PURE__ */ jsx47(
6569
7102
  "svg",
6570
7103
  {
6571
7104
  xmlns: "http://www.w3.org/2000/svg",
@@ -6574,7 +7107,7 @@ var PlusIcon = (props) => /* @__PURE__ */ jsx42(
6574
7107
  width: "1em",
6575
7108
  height: "1em",
6576
7109
  ...props,
6577
- children: /* @__PURE__ */ jsx42(
7110
+ children: /* @__PURE__ */ jsx47(
6578
7111
  "path",
6579
7112
  {
6580
7113
  fillRule: "evenodd",
@@ -6584,7 +7117,7 @@ var PlusIcon = (props) => /* @__PURE__ */ jsx42(
6584
7117
  )
6585
7118
  }
6586
7119
  );
6587
- var MinusIcon = (props) => /* @__PURE__ */ jsx42(
7120
+ var MinusIcon = (props) => /* @__PURE__ */ jsx47(
6588
7121
  "svg",
6589
7122
  {
6590
7123
  xmlns: "http://www.w3.org/2000/svg",
@@ -6593,7 +7126,7 @@ var MinusIcon = (props) => /* @__PURE__ */ jsx42(
6593
7126
  width: "1em",
6594
7127
  height: "1em",
6595
7128
  ...props,
6596
- children: /* @__PURE__ */ jsx42(
7129
+ children: /* @__PURE__ */ jsx47(
6597
7130
  "path",
6598
7131
  {
6599
7132
  fillRule: "evenodd",
@@ -6603,25 +7136,25 @@ var MinusIcon = (props) => /* @__PURE__ */ jsx42(
6603
7136
  )
6604
7137
  }
6605
7138
  );
6606
- var BarsIcon = () => /* @__PURE__ */ jsx42(TablerIcon, { children: /* @__PURE__ */ jsx42("path", { d: "M4 6h16M4 12h16M4 18h16" }) });
6607
- var AlignLeft = () => /* @__PURE__ */ jsx42(TablerIcon, { children: /* @__PURE__ */ jsx42("path", { d: "M4 6h16M4 12h10M4 18h14" }) });
6608
- var AlignCenter = () => /* @__PURE__ */ jsx42(TablerIcon, { children: /* @__PURE__ */ jsx42("path", { d: "M4 6h16M8 12h8M6 18h12" }) });
6609
- var AlignRight = () => /* @__PURE__ */ jsx42(TablerIcon, { children: /* @__PURE__ */ jsx42("path", { d: "M4 6h16M10 12h10M6 18h14" }) });
7139
+ var BarsIcon = () => /* @__PURE__ */ jsx47(TablerIcon, { children: /* @__PURE__ */ jsx47("path", { d: "M4 6h16M4 12h16M4 18h16" }) });
7140
+ var AlignLeft = () => /* @__PURE__ */ jsx47(TablerIcon, { children: /* @__PURE__ */ jsx47("path", { d: "M4 6h16M4 12h10M4 18h14" }) });
7141
+ var AlignCenter = () => /* @__PURE__ */ jsx47(TablerIcon, { children: /* @__PURE__ */ jsx47("path", { d: "M4 6h16M8 12h8M6 18h12" }) });
7142
+ var AlignRight = () => /* @__PURE__ */ jsx47(TablerIcon, { children: /* @__PURE__ */ jsx47("path", { d: "M4 6h16M10 12h10M6 18h14" }) });
6610
7143
 
6611
7144
  // src/table-plugin/render-element/table-cell/column-menu/index.tsx
6612
- import { Fragment as Fragment4, jsx as jsx43, jsxs as jsxs21 } from "react/jsx-runtime";
7145
+ import { Fragment as Fragment4, jsx as jsx48, jsxs as jsxs22 } from "react/jsx-runtime";
6613
7146
  function ColumnMenu({ cellElement }) {
6614
7147
  const editor = useSlateStatic14();
6615
7148
  const menu = useLayer("column-menu");
6616
- const buttonRef = useRef5(null);
7149
+ const buttonRef = useRef6(null);
6617
7150
  const [hover, setHover] = useState5(false);
6618
- const onMouseEnter = useCallback10(() => {
7151
+ const onMouseEnter = useCallback11(() => {
6619
7152
  setHover(true);
6620
7153
  }, []);
6621
- const onMouseLeave = useCallback10(() => {
7154
+ const onMouseLeave = useCallback11(() => {
6622
7155
  setHover(false);
6623
7156
  }, []);
6624
- const onClick = useCallback10(() => {
7157
+ const onClick = useCallback11(() => {
6625
7158
  if (menu.layer)
6626
7159
  menu.close();
6627
7160
  const dest = buttonRef.current;
@@ -6650,9 +7183,9 @@ function ColumnMenu({ cellElement }) {
6650
7183
  }
6651
7184
  }
6652
7185
  ];
6653
- menu.open(() => /* @__PURE__ */ jsx43(Menu, { dest, items, close: menu.close }));
7186
+ menu.open(() => /* @__PURE__ */ jsx48(Menu, { dest, items, close: menu.close }));
6654
7187
  }, []);
6655
- return /* @__PURE__ */ jsxs21(
7188
+ return /* @__PURE__ */ jsxs22(
6656
7189
  $ColumnMenu,
6657
7190
  {
6658
7191
  ref: buttonRef,
@@ -6661,9 +7194,9 @@ function ColumnMenu({ cellElement }) {
6661
7194
  onMouseEnter,
6662
7195
  onMouseLeave,
6663
7196
  children: [
6664
- /* @__PURE__ */ jsx43($ColumnMenuTile, { className: "--tile", children: /* @__PURE__ */ jsx43(BarsIcon, {}) }),
6665
- hover ? /* @__PURE__ */ jsxs21(Fragment4, { children: [
6666
- /* @__PURE__ */ jsx43(
7197
+ /* @__PURE__ */ jsx48($ColumnMenuTile, { className: "--tile", children: /* @__PURE__ */ jsx48(BarsIcon, {}) }),
7198
+ hover ? /* @__PURE__ */ jsxs22(Fragment4, { children: [
7199
+ /* @__PURE__ */ jsx48(
6667
7200
  $RemoveMenuButton,
6668
7201
  {
6669
7202
  style: {
@@ -6672,23 +7205,23 @@ function ColumnMenu({ cellElement }) {
6672
7205
  marginLeft: "-0.5em"
6673
7206
  },
6674
7207
  onMouseDown: () => editor.tablePlugin.removeColumn({ at: cellElement }),
6675
- children: /* @__PURE__ */ jsx43(MinusIcon, {})
7208
+ children: /* @__PURE__ */ jsx48(MinusIcon, {})
6676
7209
  }
6677
7210
  ),
6678
- /* @__PURE__ */ jsx43(
7211
+ /* @__PURE__ */ jsx48(
6679
7212
  $AddMenuButton,
6680
7213
  {
6681
7214
  style: { left: "-0.5em", top: 0 },
6682
7215
  onMouseDown: () => editor.tablePlugin.insertColumn({ at: cellElement }),
6683
- children: /* @__PURE__ */ jsx43(PlusIcon, {})
7216
+ children: /* @__PURE__ */ jsx48(PlusIcon, {})
6684
7217
  }
6685
7218
  ),
6686
- /* @__PURE__ */ jsx43(
7219
+ /* @__PURE__ */ jsx48(
6687
7220
  $AddMenuButton,
6688
7221
  {
6689
7222
  style: { right: "-0.5em", top: 0 },
6690
7223
  onMouseDown: () => editor.tablePlugin.insertColumn({ at: cellElement, offset: 1 }),
6691
- children: /* @__PURE__ */ jsx43(PlusIcon, {})
7224
+ children: /* @__PURE__ */ jsx48(PlusIcon, {})
6692
7225
  }
6693
7226
  )
6694
7227
  ] }) : null
@@ -6700,20 +7233,20 @@ function ColumnMenu({ cellElement }) {
6700
7233
  // src/table-plugin/render-element/table-cell/row-menu/index.tsx
6701
7234
  import { useState as useState6 } from "react";
6702
7235
  import { useSlateStatic as useSlateStatic15 } from "slate-react";
6703
- import { Fragment as Fragment5, jsx as jsx44, jsxs as jsxs22 } from "react/jsx-runtime";
7236
+ import { Fragment as Fragment5, jsx as jsx49, jsxs as jsxs23 } from "react/jsx-runtime";
6704
7237
  function RowMenu({ cellElement }) {
6705
7238
  const editor = useSlateStatic15();
6706
7239
  const [hover, setHover] = useState6(false);
6707
- return /* @__PURE__ */ jsxs22(
7240
+ return /* @__PURE__ */ jsxs23(
6708
7241
  $RowMenu,
6709
7242
  {
6710
7243
  contentEditable: false,
6711
7244
  onMouseEnter: () => setHover(true),
6712
7245
  onMouseLeave: () => setHover(false),
6713
7246
  children: [
6714
- /* @__PURE__ */ jsx44($RowMenuTile, { className: "--tile", children: /* @__PURE__ */ jsx44(BarsIcon, {}) }),
6715
- hover ? /* @__PURE__ */ jsxs22(Fragment5, { children: [
6716
- /* @__PURE__ */ jsx44(
7247
+ /* @__PURE__ */ jsx49($RowMenuTile, { className: "--tile", children: /* @__PURE__ */ jsx49(BarsIcon, {}) }),
7248
+ hover ? /* @__PURE__ */ jsxs23(Fragment5, { children: [
7249
+ /* @__PURE__ */ jsx49(
6717
7250
  $RemoveMenuButton,
6718
7251
  {
6719
7252
  style: {
@@ -6722,23 +7255,23 @@ function RowMenu({ cellElement }) {
6722
7255
  marginTop: "-0.5em"
6723
7256
  },
6724
7257
  onMouseDown: () => editor.tablePlugin.removeRow({ at: cellElement }),
6725
- children: /* @__PURE__ */ jsx44(MinusIcon, {})
7258
+ children: /* @__PURE__ */ jsx49(MinusIcon, {})
6726
7259
  }
6727
7260
  ),
6728
- /* @__PURE__ */ jsx44(
7261
+ /* @__PURE__ */ jsx49(
6729
7262
  $AddMenuButton,
6730
7263
  {
6731
7264
  style: { top: "-0.5em", left: "0.5em" },
6732
7265
  onMouseDown: () => editor.tablePlugin.insertRow({ at: cellElement }),
6733
- children: /* @__PURE__ */ jsx44(PlusIcon, {})
7266
+ children: /* @__PURE__ */ jsx49(PlusIcon, {})
6734
7267
  }
6735
7268
  ),
6736
- /* @__PURE__ */ jsx44(
7269
+ /* @__PURE__ */ jsx49(
6737
7270
  $AddMenuButton,
6738
7271
  {
6739
7272
  style: { bottom: "-0.5em", left: "0.5em" },
6740
7273
  onMouseDown: () => editor.tablePlugin.insertRow({ at: cellElement, offset: 1 }),
6741
- children: /* @__PURE__ */ jsx44(PlusIcon, {})
7274
+ children: /* @__PURE__ */ jsx49(PlusIcon, {})
6742
7275
  }
6743
7276
  )
6744
7277
  ] }) : null
@@ -6748,8 +7281,8 @@ function RowMenu({ cellElement }) {
6748
7281
  }
6749
7282
 
6750
7283
  // src/table-plugin/render-element/table-cell/table-menu/$table-menu.tsx
6751
- import styled31 from "@emotion/styled";
6752
- var $TableMenu = styled31("div")`
7284
+ import styled32 from "@emotion/styled";
7285
+ var $TableMenu = styled32("div")`
6753
7286
  position: absolute;
6754
7287
  /**
6755
7288
  * very slightly shaded
@@ -6782,7 +7315,7 @@ var $TableMenu = styled31("div")`
6782
7315
  }
6783
7316
  }
6784
7317
  `;
6785
- var $TableMenuTile = styled31("div")`
7318
+ var $TableMenuTile = styled32("div")`
6786
7319
  position: absolute;
6787
7320
  left: 0;
6788
7321
  top: 0;
@@ -6793,24 +7326,24 @@ var $TableMenuTile = styled31("div")`
6793
7326
  `;
6794
7327
 
6795
7328
  // src/table-plugin/render-element/table-cell/table-menu/index.tsx
6796
- import { jsx as jsx45 } from "react/jsx-runtime";
7329
+ import { jsx as jsx50 } from "react/jsx-runtime";
6797
7330
  function TableMenu() {
6798
- return /* @__PURE__ */ jsx45($TableMenu, { contentEditable: false, children: /* @__PURE__ */ jsx45($TableMenuTile, { className: "--table-menu-tile" }) });
7331
+ return /* @__PURE__ */ jsx50($TableMenu, { contentEditable: false, children: /* @__PURE__ */ jsx50($TableMenuTile, { className: "--table-menu-tile" }) });
6799
7332
  }
6800
7333
 
6801
7334
  // src/table-plugin/render-element/table-cell/index.tsx
6802
- import { jsx as jsx46, jsxs as jsxs23 } from "react/jsx-runtime";
7335
+ import { jsx as jsx51, jsxs as jsxs24 } from "react/jsx-runtime";
6803
7336
  function TableCell({
6804
7337
  element,
6805
7338
  attributes,
6806
7339
  children
6807
7340
  }) {
6808
7341
  const tableContext = useContext2(TableContext);
6809
- const selected = useSelected6();
7342
+ const selected = useSelected8();
6810
7343
  const showTableMenu = tableContext.isSelected && element.x === 0 && element.y === 0;
6811
7344
  const showRowMenu = tableContext.isSelected && element.x === 0;
6812
7345
  const showColumnMenu = tableContext.isSelected && element.y === 0;
6813
- return /* @__PURE__ */ jsxs23(
7346
+ return /* @__PURE__ */ jsxs24(
6814
7347
  $TableCell,
6815
7348
  {
6816
7349
  className: selected ? "--selected" : "",
@@ -6819,48 +7352,48 @@ function TableCell({
6819
7352
  "data-y": element.y,
6820
7353
  children: [
6821
7354
  children,
6822
- showTableMenu ? /* @__PURE__ */ jsx46(TableMenu, {}) : null,
6823
- showRowMenu ? /* @__PURE__ */ jsx46(RowMenu, { cellElement: element }) : null,
6824
- showColumnMenu ? /* @__PURE__ */ jsx46(ColumnMenu, { cellElement: element }) : null
7355
+ showTableMenu ? /* @__PURE__ */ jsx51(TableMenu, {}) : null,
7356
+ showRowMenu ? /* @__PURE__ */ jsx51(RowMenu, { cellElement: element }) : null,
7357
+ showColumnMenu ? /* @__PURE__ */ jsx51(ColumnMenu, { cellElement: element }) : null
6825
7358
  ]
6826
7359
  }
6827
7360
  );
6828
7361
  }
6829
7362
 
6830
7363
  // src/table-plugin/render-element/table-content.tsx
6831
- import { jsx as jsx47 } from "react/jsx-runtime";
7364
+ import { jsx as jsx52 } from "react/jsx-runtime";
6832
7365
  function TableContent({
6833
7366
  attributes,
6834
7367
  children
6835
7368
  }) {
6836
- return /* @__PURE__ */ jsx47($TableContent, { ...attributes, children });
7369
+ return /* @__PURE__ */ jsx52($TableContent, { ...attributes, children });
6837
7370
  }
6838
7371
 
6839
7372
  // src/table-plugin/render-element/table-row.tsx
6840
- import { jsx as jsx48 } from "react/jsx-runtime";
7373
+ import { jsx as jsx53 } from "react/jsx-runtime";
6841
7374
  function TableRow({
6842
7375
  attributes,
6843
7376
  children
6844
7377
  }) {
6845
- return /* @__PURE__ */ jsx48($TableRow, { ...attributes, children });
7378
+ return /* @__PURE__ */ jsx53($TableRow, { ...attributes, children });
6846
7379
  }
6847
7380
 
6848
7381
  // src/table-plugin/render-element/index.tsx
6849
- import { jsx as jsx49 } from "react/jsx-runtime";
6850
- function renderElement3({
7382
+ import { jsx as jsx54 } from "react/jsx-runtime";
7383
+ function renderElement4({
6851
7384
  element,
6852
7385
  attributes,
6853
7386
  children
6854
7387
  }) {
6855
7388
  switch (element.type) {
6856
7389
  case "table":
6857
- return /* @__PURE__ */ jsx49(Table, { element, attributes, children });
7390
+ return /* @__PURE__ */ jsx54(Table, { element, attributes, children });
6858
7391
  case "table-row":
6859
- return /* @__PURE__ */ jsx49(TableRow, { element, attributes, children });
7392
+ return /* @__PURE__ */ jsx54(TableRow, { element, attributes, children });
6860
7393
  case "table-cell":
6861
- return /* @__PURE__ */ jsx49(TableCell, { element, attributes, children });
7394
+ return /* @__PURE__ */ jsx54(TableCell, { element, attributes, children });
6862
7395
  case "table-content":
6863
- return /* @__PURE__ */ jsx49(TableContent, { element, attributes, children });
7396
+ return /* @__PURE__ */ jsx54(TableContent, { element, attributes, children });
6864
7397
  }
6865
7398
  }
6866
7399
 
@@ -6889,7 +7422,7 @@ var TablePlugin = createPlugin(
6889
7422
  },
6890
7423
  normalizeNode: (entry) => {
6891
7424
  const [node] = entry;
6892
- if (!Element19.isElement(node))
7425
+ if (!Element23.isElement(node))
6893
7426
  return false;
6894
7427
  switch (node.type) {
6895
7428
  case "table":
@@ -6908,7 +7441,7 @@ var TablePlugin = createPlugin(
6908
7441
  }
6909
7442
  },
6910
7443
  editableProps: {
6911
- renderElement: renderElement3,
7444
+ renderElement: renderElement4,
6912
7445
  onKeyDown: createHotkeyHandler({
6913
7446
  /**
6914
7447
  * navigation
@@ -6999,16 +7532,16 @@ var globalStyles = css2`
6999
7532
  `;
7000
7533
 
7001
7534
  // src/theme-plugin/index.tsx
7002
- import { Fragment as Fragment6, jsx as jsx50, jsxs as jsxs24 } from "react/jsx-runtime";
7535
+ import { Fragment as Fragment6, jsx as jsx55, jsxs as jsxs25 } from "react/jsx-runtime";
7003
7536
  var ThemePlugin = createPlugin((editor) => {
7004
7537
  editor.theme = true;
7005
7538
  return {
7006
7539
  name: "theme",
7007
7540
  editor: {},
7008
7541
  renderEditable: ({ attributes, Editable: Editable3 }) => {
7009
- return /* @__PURE__ */ jsxs24(Fragment6, { children: [
7010
- /* @__PURE__ */ jsx50(Global, { styles: globalStyles }),
7011
- /* @__PURE__ */ jsx50(Editable3, { ...attributes })
7542
+ return /* @__PURE__ */ jsxs25(Fragment6, { children: [
7543
+ /* @__PURE__ */ jsx55(Global, { styles: globalStyles }),
7544
+ /* @__PURE__ */ jsx55(Editable3, { ...attributes })
7012
7545
  ] });
7013
7546
  },
7014
7547
  editableProps: {}
@@ -7017,27 +7550,27 @@ var ThemePlugin = createPlugin((editor) => {
7017
7550
 
7018
7551
  // src/toolbar-plugin/render-editable/index.tsx
7019
7552
  import { clsx as clsx10 } from "clsx";
7020
- import { useCallback as useCallback14, useRef as useRef11 } from "react";
7021
- import { Editor as Editor55, Transforms as Transforms37 } from "slate";
7553
+ import { useCallback as useCallback15, useRef as useRef12 } from "react";
7554
+ import { Editor as Editor59, Transforms as Transforms41 } from "slate";
7022
7555
  import { ReactEditor as ReactEditor15, useFocused, useSlateStatic as useSlateStatic21 } from "slate-react";
7023
7556
 
7024
7557
  // src/toolbar-plugin/components/dialog/table-dialog.tsx
7025
7558
  import { clsx as clsx8 } from "clsx";
7026
- import { useCallback as useCallback11, useRef as useRef6, useState as useState7 } from "react";
7559
+ import { useCallback as useCallback12, useRef as useRef7, useState as useState7 } from "react";
7027
7560
  import { ReactEditor as ReactEditor12, useSlateStatic as useSlateStatic16 } from "slate-react";
7028
7561
 
7029
7562
  // src/toolbar-plugin/styles/table-styles.ts
7030
- import styled32 from "@emotion/styled";
7031
- var $TableDialog = styled32($Panel)`
7563
+ import styled33 from "@emotion/styled";
7564
+ var $TableDialog = styled33($Panel)`
7032
7565
  padding: 0.5em;
7033
7566
  `;
7034
- var $TableDialogGrid = styled32("div")`
7567
+ var $TableDialogGrid = styled33("div")`
7035
7568
  display: grid;
7036
7569
  grid-template-columns: repeat(5, 1.75em);
7037
7570
  grid-template-rows: 1.5em;
7038
7571
  /* grid-gap: 1px; */
7039
7572
  `;
7040
- var $TableDialogGridCell = styled32("div")`
7573
+ var $TableDialogGridCell = styled33("div")`
7041
7574
  background: var(--shade-100);
7042
7575
  height: 1.5em;
7043
7576
  border-radius: 0.125em;
@@ -7050,7 +7583,7 @@ var $TableDialogGridCell = styled32("div")`
7050
7583
  `;
7051
7584
 
7052
7585
  // src/toolbar-plugin/components/dialog/table-dialog.tsx
7053
- import { Fragment as Fragment7, jsx as jsx51, jsxs as jsxs25 } from "react/jsx-runtime";
7586
+ import { Fragment as Fragment7, jsx as jsx56, jsxs as jsxs26 } from "react/jsx-runtime";
7054
7587
  function createRange2(size) {
7055
7588
  return [...Array(size).keys()];
7056
7589
  }
@@ -7060,19 +7593,19 @@ function TableDialog({
7060
7593
  }) {
7061
7594
  const [hover, setHover] = useState7({ x: 0, y: 0 });
7062
7595
  const editor = useSlateStatic16();
7063
- const ref = useRef6(null);
7596
+ const ref = useRef7(null);
7064
7597
  const style = useAbsoluteReposition({ src: ref, dest }, ({ dest: dest2 }) => {
7065
7598
  return { left: dest2.left - 8, top: dest2.top + dest2.height };
7066
7599
  });
7067
7600
  const rows = createRange2(5).map((i) => i + 1);
7068
7601
  const cols = createRange2(5).map((i) => i + 1);
7069
- const hoverCell = useCallback11(
7602
+ const hoverCell = useCallback12(
7070
7603
  (x, y) => {
7071
7604
  setHover({ x, y });
7072
7605
  },
7073
7606
  [setHover]
7074
7607
  );
7075
- const createTable2 = useCallback11(
7608
+ const createTable2 = useCallback12(
7076
7609
  (x, y) => {
7077
7610
  editor.tablePlugin.insertTable(x, y);
7078
7611
  ReactEditor12.focus(editor);
@@ -7080,12 +7613,12 @@ function TableDialog({
7080
7613
  },
7081
7614
  [editor]
7082
7615
  );
7083
- return /* @__PURE__ */ jsxs25(Fragment7, { children: [
7084
- /* @__PURE__ */ jsx51(CloseMask, { close }),
7085
- /* @__PURE__ */ jsx51($TableDialog, { ref, style, children: /* @__PURE__ */ jsx51($TableDialogGrid, { onMouseLeave: () => hoverCell(0, 0), children: rows.map((y) => {
7616
+ return /* @__PURE__ */ jsxs26(Fragment7, { children: [
7617
+ /* @__PURE__ */ jsx56(CloseMask, { close }),
7618
+ /* @__PURE__ */ jsx56($TableDialog, { ref, style, children: /* @__PURE__ */ jsx56($TableDialogGrid, { onMouseLeave: () => hoverCell(0, 0), children: rows.map((y) => {
7086
7619
  return cols.map((x) => {
7087
7620
  const selected = x <= hover.x && y <= hover.y;
7088
- return /* @__PURE__ */ jsx51(
7621
+ return /* @__PURE__ */ jsx56(
7089
7622
  $TableDialogGridCell,
7090
7623
  {
7091
7624
  className: clsx8({ "--selected": selected }),
@@ -7101,53 +7634,67 @@ function TableDialog({
7101
7634
 
7102
7635
  // src/toolbar-plugin/components/toolbar/toolbar.tsx
7103
7636
  import throttle2 from "lodash.throttle";
7104
- import { useEffect as useEffect7, useRef as useRef10, useState as useState10 } from "react";
7637
+ import { useEffect as useEffect7, useRef as useRef11, useState as useState10 } from "react";
7105
7638
  import { useSlateStatic as useSlateStatic20 } from "slate-react";
7106
7639
 
7107
7640
  // src/toolbar-plugin/icons.tsx
7108
- import { jsx as jsx52, jsxs as jsxs26 } from "react/jsx-runtime";
7109
- var H = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("path", { d: "M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4" }) });
7110
- var More = () => /* @__PURE__ */ jsx52(TablerIcon, { className: "--more-icon", width: "0.5em", viewBox: "0 0 12 24", children: /* @__PURE__ */ jsx52("path", { d: "m2 12 4 4 4-4" }) });
7111
- var LinkPlus = () => /* @__PURE__ */ jsx52(TablerIcon, { width: "0.5em", viewBox: "6 0 12 24", children: /* @__PURE__ */ jsx52("path", { d: "M9 12h6M12 9v6" }) });
7112
- var H1 = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("path", { d: "M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2" }) });
7113
- var H2 = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("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" }) });
7114
- var H3 = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("path", { d: "M19 14a2 2 0 1 0-2-2M17 16a2 2 0 1 0 2-2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2" }) });
7115
- var Normal = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("path", { d: "M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z" }) });
7116
- var Bold = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("path", { d: "M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7" }) });
7117
- var Italic = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("path", { d: "M11 5h6M7 19h6M14 5l-4 14" }) });
7118
- var Link = () => /* @__PURE__ */ jsxs26(TablerIcon, { children: [
7119
- /* @__PURE__ */ jsx52("path", { d: "M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5" }),
7120
- /* @__PURE__ */ jsx52("path", { d: "M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5" })
7641
+ import { jsx as jsx57, jsxs as jsxs27 } from "react/jsx-runtime";
7642
+ var H = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4" }) });
7643
+ var More = () => /* @__PURE__ */ jsx57(TablerIcon, { className: "--more-icon", width: "0.5em", viewBox: "0 0 12 24", children: /* @__PURE__ */ jsx57("path", { d: "m2 12 4 4 4-4" }) });
7644
+ var LinkPlus = () => /* @__PURE__ */ jsx57(TablerIcon, { width: "0.5em", viewBox: "6 0 12 24", children: /* @__PURE__ */ jsx57("path", { d: "M9 12h6M12 9v6" }) });
7645
+ var H1 = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2" }) });
7646
+ var H2 = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("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" }) });
7647
+ var H3 = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "M19 14a2 2 0 1 0-2-2M17 16a2 2 0 1 0 2-2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2" }) });
7648
+ var Normal = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z" }) });
7649
+ var Bold = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7" }) });
7650
+ var Italic = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "M11 5h6M7 19h6M14 5l-4 14" }) });
7651
+ var Link = () => /* @__PURE__ */ jsxs27(TablerIcon, { children: [
7652
+ /* @__PURE__ */ jsx57("path", { d: "M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5" }),
7653
+ /* @__PURE__ */ jsx57("path", { d: "M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5" })
7654
+ ] });
7655
+ var Quote = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("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" }) });
7656
+ var DoubleQuote = () => /* @__PURE__ */ jsxs27(TablerIcon, { children: [
7657
+ /* @__PURE__ */ jsx57("path", { d: "M10 9l4 3-4 3" }),
7658
+ /* @__PURE__ */ jsx57("path", { d: "M16 9l4 3-4 3" })
7121
7659
  ] });
7122
- var Quote = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("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" }) });
7123
- var BulletList = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("path", { d: "M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01" }) });
7124
- var Table2 = () => /* @__PURE__ */ jsxs26(TablerIcon, { children: [
7125
- /* @__PURE__ */ jsx52("rect", { x: 4, y: 4, width: 16, height: 16, rx: 2 }),
7126
- /* @__PURE__ */ jsx52("path", { d: "M4 10h16M10 4v16" })
7660
+ var BulletList = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01" }) });
7661
+ var Table2 = () => /* @__PURE__ */ jsxs27(TablerIcon, { children: [
7662
+ /* @__PURE__ */ jsx57("rect", { x: 4, y: 4, width: 16, height: 16, rx: 2 }),
7663
+ /* @__PURE__ */ jsx57("path", { d: "M4 10h16M10 4v16" })
7127
7664
  ] });
7128
- var Code = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("path", { d: "m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16" }) });
7129
- var Image = () => /* @__PURE__ */ jsxs26(TablerIcon, { children: [
7130
- /* @__PURE__ */ jsx52("path", { d: "M15 8h.01" }),
7131
- /* @__PURE__ */ jsx52("rect", { x: 4, y: 4, width: 16, height: 16, rx: 3 }),
7132
- /* @__PURE__ */ jsx52("path", { d: "m4 15 4-4a3 5 0 0 1 3 0l5 5" }),
7133
- /* @__PURE__ */ jsx52("path", { d: "m14 14 1-1a3 5 0 0 1 3 0l2 2" })
7665
+ var Code = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16" }) });
7666
+ var CodeBlock2 = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "M9 8L5 12L9 16M15 8L19 12L15 16" }) });
7667
+ var Image = () => /* @__PURE__ */ jsxs27(TablerIcon, { children: [
7668
+ /* @__PURE__ */ jsx57("path", { d: "M15 8h.01" }),
7669
+ /* @__PURE__ */ jsx57("rect", { x: 4, y: 4, width: 16, height: 16, rx: 3 }),
7670
+ /* @__PURE__ */ jsx57("path", { d: "m4 15 4-4a3 5 0 0 1 3 0l5 5" }),
7671
+ /* @__PURE__ */ jsx57("path", { d: "m14 14 1-1a3 5 0 0 1 3 0l2 2" })
7134
7672
  ] });
7135
- var PhotoUp = () => /* @__PURE__ */ jsxs26(TablerIcon, { children: [
7136
- /* @__PURE__ */ jsx52("path", { stroke: "none", d: "M0 0h24v24H0z" }),
7137
- /* @__PURE__ */ jsx52("path", { d: "M15 8h.01M12.5 21H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v6.5" }),
7138
- /* @__PURE__ */ jsx52("path", { d: "m3 16 5-5c.928-.893 2.072-.893 3 0l3.5 3.5" }),
7139
- /* @__PURE__ */ jsx52("path", { d: "m14 14 1-1c.679-.653 1.473-.829 2.214-.526M19 22v-6M22 19l-3-3-3 3" })
7673
+ var PhotoUp = () => /* @__PURE__ */ jsxs27(TablerIcon, { children: [
7674
+ /* @__PURE__ */ jsx57("path", { stroke: "none", d: "M0 0h24v24H0z" }),
7675
+ /* @__PURE__ */ jsx57("path", { d: "M15 8h.01M12.5 21H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v6.5" }),
7676
+ /* @__PURE__ */ jsx57("path", { d: "m3 16 5-5c.928-.893 2.072-.893 3 0l3.5 3.5" }),
7677
+ /* @__PURE__ */ jsx57("path", { d: "m14 14 1-1c.679-.653 1.473-.829 2.214-.526M19 22v-6M22 19l-3-3-3 3" })
7140
7678
  ] });
7141
- var Plus = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("path", { d: "M12 5v14M5 12h14" }) });
7142
- var Strikethrough = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("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" }) });
7143
- var Underline = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("path", { d: "M7 5v5a5 5 0 0 0 10 0V5M5 19h14" }) });
7144
- var ListCheck = () => /* @__PURE__ */ jsxs26(TablerIcon, { children: [
7145
- /* @__PURE__ */ jsx52("path", { d: "m9 11 3 3 8-8" }),
7146
- /* @__PURE__ */ jsx52("path", { d: "M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9" })
7679
+ var Plus = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "M12 5v14M5 12h14" }) });
7680
+ var Strikethrough = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("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" }) });
7681
+ var Underline = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "M7 5v5a5 5 0 0 0 10 0V5M5 19h14" }) });
7682
+ var ListCheck = () => /* @__PURE__ */ jsxs27(TablerIcon, { children: [
7683
+ /* @__PURE__ */ jsx57("path", { d: "m9 11 3 3 8-8" }),
7684
+ /* @__PURE__ */ jsx57("path", { d: "M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9" })
7685
+ ] });
7686
+ var ListNumbers = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6" }) });
7687
+ var IncreaseDepth = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3" }) });
7688
+ var DecreaseDepth = () => /* @__PURE__ */ jsx57(TablerIcon, { children: /* @__PURE__ */ jsx57("path", { d: "M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3" }) });
7689
+ var Markdown = () => /* @__PURE__ */ jsxs27(TablerIcon, { children: [
7690
+ /* @__PURE__ */ jsx57("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" }),
7691
+ /* @__PURE__ */ jsx57("path", { d: "M7 15V9l2 2 2-2v6M14 9v6h4M14 13h2" })
7692
+ ] });
7693
+ var VisualEditor = () => /* @__PURE__ */ jsxs27(TablerIcon, { children: [
7694
+ /* @__PURE__ */ jsx57("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" }),
7695
+ /* @__PURE__ */ jsx57("path", { d: "M8 8h8M8 12h8M8 16h5" }),
7696
+ /* @__PURE__ */ jsx57("path", { d: "M16 16h1" })
7147
7697
  ] });
7148
- var ListNumbers = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("path", { d: "M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6" }) });
7149
- var IncreaseDepth = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("path", { d: "M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3" }) });
7150
- var DecreaseDepth = () => /* @__PURE__ */ jsx52(TablerIcon, { children: /* @__PURE__ */ jsx52("path", { d: "M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3" }) });
7151
7698
 
7152
7699
  // src/toolbar-plugin/items/block-items.tsx
7153
7700
  var listDepthItems = [
@@ -7197,37 +7744,35 @@ var blockItems = [
7197
7744
  active: (editor) => editor.heading.isHeadingActive(3)
7198
7745
  }
7199
7746
  ];
7200
- var expandedBlockItems = [...blockItems, "divider", ...listDepthItems];
7747
+ var expandedBlockItems = [...blockItems];
7201
7748
  var compactBlockItems = [
7202
7749
  {
7203
7750
  icon: H,
7204
7751
  title: t("paragraphStyle"),
7205
7752
  more: true,
7206
7753
  children: blockItems
7207
- },
7208
- "divider",
7209
- ...listDepthItems
7754
+ }
7210
7755
  ];
7211
7756
 
7212
7757
  // src/toolbar-plugin/components/dialog/image-url-dialog.tsx
7213
- import { useState as useState8, useRef as useRef7 } from "react";
7758
+ import { useState as useState8, useRef as useRef8 } from "react";
7214
7759
  import { useSlateStatic as useSlateStatic17 } from "slate-react";
7215
7760
 
7216
7761
  // src/toolbar-plugin/styles/file-dialog-styles.ts
7217
- import styled33 from "@emotion/styled";
7218
- var $FileDialog = styled33($Panel)`
7762
+ import styled34 from "@emotion/styled";
7763
+ var $FileDialog = styled34($Panel)`
7219
7764
  padding: 1em;
7220
7765
  width: 18em;
7221
7766
  `;
7222
7767
 
7223
7768
  // src/toolbar-plugin/components/dialog/image-url-dialog.tsx
7224
- import { Fragment as Fragment8, jsx as jsx53, jsxs as jsxs27 } from "react/jsx-runtime";
7769
+ import { Fragment as Fragment8, jsx as jsx58, jsxs as jsxs28 } from "react/jsx-runtime";
7225
7770
  function ImageUrlDialog({
7226
7771
  dest,
7227
7772
  close
7228
7773
  }) {
7229
7774
  const editor = useSlateStatic17();
7230
- const ref = useRef7(void 0);
7775
+ const ref = useRef8(void 0);
7231
7776
  const [url, setUrl] = useState8("");
7232
7777
  const [alt, setAlt] = useState8("");
7233
7778
  const [title, setTitle] = useState8("");
@@ -7252,12 +7797,12 @@ function ImageUrlDialog({
7252
7797
  editor.image.insertImageFromUrl(url, alt, title);
7253
7798
  close();
7254
7799
  }
7255
- return /* @__PURE__ */ jsxs27(Fragment8, { children: [
7256
- /* @__PURE__ */ jsx53(CloseMask, { close }),
7257
- /* @__PURE__ */ jsx53($FileDialog, { ref, style, children: /* @__PURE__ */ jsxs27("form", { onSubmit: handleSubmit, style: { padding: "8px" }, children: [
7258
- /* @__PURE__ */ jsxs27("div", { style: { marginBottom: "8px" }, children: [
7259
- /* @__PURE__ */ jsx53("label", { style: { display: "block", marginBottom: "4px" }, children: t("imageUrlRequired") }),
7260
- /* @__PURE__ */ jsx53(
7800
+ return /* @__PURE__ */ jsxs28(Fragment8, { children: [
7801
+ /* @__PURE__ */ jsx58(CloseMask, { close }),
7802
+ /* @__PURE__ */ jsx58($FileDialog, { ref, style, children: /* @__PURE__ */ jsxs28("form", { onSubmit: handleSubmit, style: { padding: "8px" }, children: [
7803
+ /* @__PURE__ */ jsxs28("div", { style: { marginBottom: "8px" }, children: [
7804
+ /* @__PURE__ */ jsx58("label", { style: { display: "block", marginBottom: "4px" }, children: t("imageUrlRequired") }),
7805
+ /* @__PURE__ */ jsx58(
7261
7806
  "input",
7262
7807
  {
7263
7808
  type: "text",
@@ -7275,9 +7820,9 @@ function ImageUrlDialog({
7275
7820
  }
7276
7821
  )
7277
7822
  ] }),
7278
- /* @__PURE__ */ jsxs27("div", { style: { marginBottom: "8px" }, children: [
7279
- /* @__PURE__ */ jsx53("label", { style: { display: "block", marginBottom: "4px" }, children: t("altText") }),
7280
- /* @__PURE__ */ jsx53(
7823
+ /* @__PURE__ */ jsxs28("div", { style: { marginBottom: "8px" }, children: [
7824
+ /* @__PURE__ */ jsx58("label", { style: { display: "block", marginBottom: "4px" }, children: t("altText") }),
7825
+ /* @__PURE__ */ jsx58(
7281
7826
  "input",
7282
7827
  {
7283
7828
  type: "text",
@@ -7294,9 +7839,9 @@ function ImageUrlDialog({
7294
7839
  }
7295
7840
  )
7296
7841
  ] }),
7297
- /* @__PURE__ */ jsxs27("div", { style: { marginBottom: "8px" }, children: [
7298
- /* @__PURE__ */ jsx53("label", { style: { display: "block", marginBottom: "4px" }, children: t("title") }),
7299
- /* @__PURE__ */ jsx53(
7842
+ /* @__PURE__ */ jsxs28("div", { style: { marginBottom: "8px" }, children: [
7843
+ /* @__PURE__ */ jsx58("label", { style: { display: "block", marginBottom: "4px" }, children: t("title") }),
7844
+ /* @__PURE__ */ jsx58(
7300
7845
  "input",
7301
7846
  {
7302
7847
  type: "text",
@@ -7313,7 +7858,7 @@ function ImageUrlDialog({
7313
7858
  }
7314
7859
  )
7315
7860
  ] }),
7316
- /* @__PURE__ */ jsxs27(
7861
+ /* @__PURE__ */ jsxs28(
7317
7862
  "button",
7318
7863
  {
7319
7864
  type: "submit",
@@ -7329,7 +7874,7 @@ function ImageUrlDialog({
7329
7874
  fontWeight: "bold"
7330
7875
  },
7331
7876
  children: [
7332
- /* @__PURE__ */ jsx53("span", { style: { marginRight: "8px" }, children: /* @__PURE__ */ jsx53(PhotoUp, {}) }),
7877
+ /* @__PURE__ */ jsx58("span", { style: { marginRight: "8px" }, children: /* @__PURE__ */ jsx58(PhotoUp, {}) }),
7333
7878
  t("insertImage")
7334
7879
  ]
7335
7880
  }
@@ -7338,46 +7883,18 @@ function ImageUrlDialog({
7338
7883
  ] });
7339
7884
  }
7340
7885
 
7341
- // src/toolbar-plugin/items/dialogItems.tsx
7342
- var dialogItems = [
7343
- {
7344
- icon: Table2,
7345
- title: t("insertTable"),
7346
- more: true,
7347
- Component: TableDialog
7348
- },
7349
- {
7350
- icon: Image,
7351
- title: t("insertImageFromUrl"),
7352
- more: true,
7353
- Component: ImageUrlDialog
7354
- }
7355
- ];
7356
- var expandedDialogItems = dialogItems;
7357
- var compactDialogItems = [
7358
- {
7359
- icon: Plus,
7360
- title: t("insert"),
7361
- more: true,
7362
- children: dialogItems
7363
- }
7364
- ];
7365
-
7366
- // src/toolbar-plugin/items/dropdownItems.tsx
7367
- var dropdownItems = [];
7368
-
7369
7886
  // src/toolbar-plugin/components/dialog/anchor-dialog.tsx
7370
7887
  import { isHotkey as isHotkey3 } from "is-hotkey";
7371
7888
  import {
7372
- useCallback as useCallback12,
7373
- useRef as useRef8,
7889
+ useCallback as useCallback13,
7890
+ useRef as useRef9,
7374
7891
  useState as useState9
7375
7892
  } from "react";
7376
7893
  import { ReactEditor as ReactEditor13, useSlateStatic as useSlateStatic18 } from "slate-react";
7377
7894
 
7378
7895
  // src/toolbar-plugin/styles/dialog-shared-styles.ts
7379
- import styled34 from "@emotion/styled";
7380
- var $DialogButton = styled34("div")`
7896
+ import styled35 from "@emotion/styled";
7897
+ var $DialogButton = styled35("div")`
7381
7898
  /* Center vertically and horizontally */
7382
7899
  display: flex;
7383
7900
  align-items: center;
@@ -7402,7 +7919,7 @@ var $DialogButton = styled34("div")`
7402
7919
  stroke-width: 2px;
7403
7920
  }
7404
7921
  `;
7405
- var $DialogHint = styled34("div")`
7922
+ var $DialogHint = styled35("div")`
7406
7923
  font-size: 0.875em;
7407
7924
  margin-top: 0.5em;
7408
7925
  color: var(--shade-500);
@@ -7410,14 +7927,14 @@ var $DialogHint = styled34("div")`
7410
7927
  `;
7411
7928
 
7412
7929
  // src/toolbar-plugin/components/dialog/anchor-dialog.tsx
7413
- import { Fragment as Fragment9, jsx as jsx54, jsxs as jsxs28 } from "react/jsx-runtime";
7930
+ import { Fragment as Fragment9, jsx as jsx59, jsxs as jsxs29 } from "react/jsx-runtime";
7414
7931
  var isEnter = isHotkey3("enter");
7415
7932
  function AnchorDialog2({
7416
7933
  dest,
7417
7934
  close
7418
7935
  }) {
7419
7936
  const editor = useSlateStatic18();
7420
- const ref = useRef8(null);
7937
+ const ref = useRef9(null);
7421
7938
  const style = useAbsoluteReposition(
7422
7939
  { src: ref, dest },
7423
7940
  ({ src, dest: dest2 }, viewport) => {
@@ -7438,7 +7955,7 @@ function AnchorDialog2({
7438
7955
  ReactEditor13.focus(editor);
7439
7956
  close();
7440
7957
  };
7441
- const onChangeInput = useCallback12(
7958
+ const onChangeInput = useCallback13(
7442
7959
  (e) => {
7443
7960
  setUrl(e.currentTarget.value);
7444
7961
  },
@@ -7451,11 +7968,11 @@ function AnchorDialog2({
7451
7968
  e.stopPropagation();
7452
7969
  insertLink2();
7453
7970
  };
7454
- return /* @__PURE__ */ jsxs28(Fragment9, { children: [
7455
- /* @__PURE__ */ jsx54(CloseMask, { close }),
7456
- /* @__PURE__ */ jsxs28($AnchorDialog, { ref, style, children: [
7457
- /* @__PURE__ */ jsxs28($AnchorDialogInputLine, { children: [
7458
- /* @__PURE__ */ jsx54(
7971
+ return /* @__PURE__ */ jsxs29(Fragment9, { children: [
7972
+ /* @__PURE__ */ jsx59(CloseMask, { close }),
7973
+ /* @__PURE__ */ jsxs29($AnchorDialog, { ref, style, children: [
7974
+ /* @__PURE__ */ jsxs29($AnchorDialogInputLine, { children: [
7975
+ /* @__PURE__ */ jsx59(
7459
7976
  $AnchorDialogInput,
7460
7977
  {
7461
7978
  type: "text",
@@ -7465,29 +7982,52 @@ function AnchorDialog2({
7465
7982
  onKeyDown
7466
7983
  }
7467
7984
  ),
7468
- /* @__PURE__ */ jsxs28($DialogButton, { onClick: insertLink2, children: [
7469
- /* @__PURE__ */ jsx54(Link, {}),
7470
- /* @__PURE__ */ jsx54(LinkPlus, {})
7985
+ /* @__PURE__ */ jsxs29($DialogButton, { onClick: insertLink2, children: [
7986
+ /* @__PURE__ */ jsx59(Link, {}),
7987
+ /* @__PURE__ */ jsx59(LinkPlus, {})
7471
7988
  ] })
7472
7989
  ] }),
7473
- /* @__PURE__ */ jsx54($DialogHint, { children: "Enter URL of link" })
7990
+ /* @__PURE__ */ jsx59($DialogHint, { children: "Enter URL of link" })
7474
7991
  ] })
7475
7992
  ] });
7476
7993
  }
7477
7994
 
7478
- // src/toolbar-plugin/items/linkItem.tsx
7479
- var linkItem = {
7480
- icon: Link,
7481
- title: t("insertLink"),
7482
- more: true,
7483
- hotkey: "mod+k",
7484
- Component: AnchorDialog2
7485
- };
7995
+ // src/toolbar-plugin/items/dialogItems.tsx
7996
+ var dialogItems = [
7997
+ {
7998
+ icon: Link,
7999
+ title: t("insertLink"),
8000
+ more: true,
8001
+ hotkey: "mod+k",
8002
+ Component: AnchorDialog2
8003
+ },
8004
+ {
8005
+ icon: Table2,
8006
+ title: t("insertTable"),
8007
+ more: true,
8008
+ Component: TableDialog
8009
+ },
8010
+ {
8011
+ icon: Image,
8012
+ title: t("insertImageFromUrl"),
8013
+ more: true,
8014
+ Component: ImageUrlDialog
8015
+ }
8016
+ ];
8017
+ var expandedDialogItems = dialogItems;
8018
+ var compactDialogItems = [
8019
+ {
8020
+ icon: Plus,
8021
+ title: t("insert"),
8022
+ more: true,
8023
+ children: dialogItems
8024
+ }
8025
+ ];
7486
8026
 
7487
8027
  // src/toolbar-plugin/items/mark-items.tsx
7488
- import { Editor as Editor54 } from "slate";
8028
+ import { Editor as Editor57 } from "slate";
7489
8029
  function getMarks(editor) {
7490
- const marks = Editor54.marks(editor);
8030
+ const marks = Editor57.marks(editor);
7491
8031
  return {
7492
8032
  bold: marks?.bold || false,
7493
8033
  italic: marks?.italic || false,
@@ -7534,7 +8074,14 @@ var primaryMarkItems = [
7534
8074
  }
7535
8075
  ];
7536
8076
  var expandedMarkItems = primaryMarkItems;
7537
- var compactMarkItems = primaryMarkItems;
8077
+ var compactMarkItems = [
8078
+ {
8079
+ icon: Bold,
8080
+ title: t("format"),
8081
+ more: true,
8082
+ children: primaryMarkItems
8083
+ }
8084
+ ];
7538
8085
 
7539
8086
  // src/toolbar-plugin/items/list-items.tsx
7540
8087
  var listItems = [
@@ -7557,18 +8104,19 @@ var listItems = [
7557
8104
  action: (editor) => editor.list.convertTaskList(true)
7558
8105
  }
7559
8106
  ];
7560
- var expandedListItems = listItems;
8107
+ var expandedListItems = [...listItems, "divider", ...listDepthItems];
7561
8108
  var compactListItems = [
7562
8109
  {
7563
8110
  icon: ListNumbers,
7564
8111
  title: t("list"),
7565
8112
  more: true,
7566
- children: listItems
8113
+ children: [...listItems, "divider", ...listDepthItems]
7567
8114
  }
7568
8115
  ];
7569
8116
 
7570
8117
  // src/toolbar-plugin/items/quote-items.tsx
7571
- var quoteItems = [
8118
+ import { Editor as Editor58, Transforms as Transforms40 } from "slate";
8119
+ var quoteItemsList = [
7572
8120
  {
7573
8121
  icon: Quote,
7574
8122
  title: t("quote"),
@@ -7581,9 +8129,102 @@ var quoteItems = [
7581
8129
  }
7582
8130
  },
7583
8131
  active: (editor) => editor.blockQuotePlugin.isActive()
8132
+ },
8133
+ {
8134
+ icon: DoubleQuote,
8135
+ title: t("increaseQuoteDepth"),
8136
+ action: (editor) => editor.blockQuotePlugin.increaseDepth(),
8137
+ active: (editor) => editor.blockQuotePlugin.canIncreaseDepth()
8138
+ },
8139
+ {
8140
+ icon: CodeBlock2,
8141
+ title: t("codeBlock"),
8142
+ action: (editor) => {
8143
+ const { selection } = editor;
8144
+ const codeBlockEntry = findElementUp(editor, "code-block");
8145
+ if (codeBlockEntry) {
8146
+ const [codeBlock, path] = codeBlockEntry;
8147
+ const textContent = Editor58.string(editor, path);
8148
+ Transforms40.removeNodes(editor, { at: path });
8149
+ Transforms40.insertNodes(
8150
+ editor,
8151
+ {
8152
+ type: "paragraph",
8153
+ children: [{ text: textContent }]
8154
+ },
8155
+ { at: path }
8156
+ );
8157
+ return;
8158
+ }
8159
+ if (selection && JSON.stringify(selection.anchor.path) !== JSON.stringify(selection.focus.path)) {
8160
+ editor.codeBlock.createCodeBlock({ language: "text" });
8161
+ return;
8162
+ }
8163
+ if (selection && (selection.anchor.offset !== selection.focus.offset || JSON.stringify(selection.anchor.path) !== JSON.stringify(selection.focus.path))) {
8164
+ const selectedText = Editor58.string(editor, selection);
8165
+ Transforms40.delete(editor);
8166
+ Transforms40.insertNodes(
8167
+ editor,
8168
+ {
8169
+ type: "code-block",
8170
+ language: "text",
8171
+ children: [
8172
+ {
8173
+ type: "code-block-line",
8174
+ children: [{ text: selectedText }]
8175
+ }
8176
+ ]
8177
+ }
8178
+ );
8179
+ return;
8180
+ }
8181
+ editor.codeBlock.createCodeBlock({ language: "text" });
8182
+ },
8183
+ active: (editor) => !!findElementUp(editor, "code-block")
8184
+ }
8185
+ ];
8186
+ var expandedQuoteItems = quoteItemsList;
8187
+ var compactQuoteItems = [
8188
+ {
8189
+ icon: Quote,
8190
+ title: t("quote"),
8191
+ more: true,
8192
+ children: quoteItemsList
7584
8193
  }
7585
8194
  ];
7586
8195
 
8196
+ // src/toolbar-plugin/items/raw-mode-item.tsx
8197
+ var rawModeItem = {
8198
+ icon: Markdown,
8199
+ title: t("switchToRawMarkdown"),
8200
+ action: (editor) => {
8201
+ if (editor.wysimark && typeof editor.wysimark.toggleRawMode === "function") {
8202
+ editor.wysimark.toggleRawMode();
8203
+ }
8204
+ },
8205
+ // Only show in the toolbar when not in Raw mode
8206
+ show: (editor) => {
8207
+ return editor.wysimark && !editor.wysimark.isRawMode;
8208
+ },
8209
+ active: () => false
8210
+ // Never show as active in the toolbar
8211
+ };
8212
+ var visualModeItem = {
8213
+ icon: VisualEditor,
8214
+ title: t("switchToVisualEditor"),
8215
+ action: (editor) => {
8216
+ if (editor.wysimark && typeof editor.wysimark.toggleRawMode === "function") {
8217
+ editor.wysimark.toggleRawMode();
8218
+ }
8219
+ },
8220
+ // Only show in the toolbar when in Raw mode
8221
+ show: (editor) => {
8222
+ return !!(editor.wysimark && editor.wysimark.isRawMode);
8223
+ },
8224
+ active: () => false
8225
+ // Never show as active in the toolbar
8226
+ };
8227
+
7587
8228
  // src/toolbar-plugin/items/index.tsx
7588
8229
  var largeItems = [
7589
8230
  ...expandedBlockItems,
@@ -7592,11 +8233,12 @@ var largeItems = [
7592
8233
  "divider",
7593
8234
  ...expandedMarkItems,
7594
8235
  "divider",
7595
- linkItem,
7596
- ...quoteItems,
7597
- ...dropdownItems,
8236
+ ...expandedQuoteItems,
8237
+ "divider",
8238
+ ...expandedDialogItems,
7598
8239
  "divider",
7599
- ...expandedDialogItems
8240
+ rawModeItem,
8241
+ visualModeItem
7600
8242
  ];
7601
8243
  var mediumItems = [
7602
8244
  ...compactBlockItems,
@@ -7605,11 +8247,12 @@ var mediumItems = [
7605
8247
  "divider",
7606
8248
  ...expandedMarkItems,
7607
8249
  "divider",
7608
- linkItem,
7609
- ...quoteItems,
7610
- ...dropdownItems,
8250
+ ...expandedQuoteItems,
8251
+ "divider",
8252
+ ...compactDialogItems,
7611
8253
  "divider",
7612
- ...compactDialogItems
8254
+ rawModeItem,
8255
+ visualModeItem
7613
8256
  ];
7614
8257
  var smallItems = [
7615
8258
  ...compactBlockItems,
@@ -7618,45 +8261,46 @@ var smallItems = [
7618
8261
  "divider",
7619
8262
  ...compactMarkItems,
7620
8263
  "divider",
7621
- linkItem,
7622
- ...quoteItems,
7623
- ...dropdownItems,
8264
+ ...compactQuoteItems,
7624
8265
  "divider",
7625
- ...compactDialogItems
8266
+ ...compactDialogItems,
8267
+ "divider",
8268
+ rawModeItem,
8269
+ visualModeItem
7626
8270
  ];
7627
8271
  var initialItems = [...expandedBlockItems, "divider"];
7628
8272
  var itemSets = [largeItems, mediumItems, smallItems];
7629
8273
 
7630
8274
  // src/toolbar-plugin/components/toolbar/toolbar-button.tsx
7631
8275
  import { clsx as clsx9 } from "clsx";
7632
- import { useCallback as useCallback13, useRef as useRef9 } from "react";
8276
+ import { useCallback as useCallback14, useRef as useRef10 } from "react";
7633
8277
  import { ReactEditor as ReactEditor14, useSlate as useSlate2, useSlateStatic as useSlateStatic19 } from "slate-react";
7634
- import { jsx as jsx55, jsxs as jsxs29 } from "react/jsx-runtime";
8278
+ import { jsx as jsx60, jsxs as jsxs30 } from "react/jsx-runtime";
7635
8279
  function ToolbarButton({
7636
8280
  item
7637
8281
  }) {
7638
8282
  const staticEditor = useSlateStatic19();
7639
8283
  const editor = useSlate2();
7640
8284
  const isActive = item.active ? item.active(editor) : false;
7641
- const ref = useRef9(null);
8285
+ const ref = useRef10(null);
7642
8286
  const tooltip = useTooltip({
7643
8287
  title: item.title,
7644
8288
  hotkey: () => item.hotkey ? formatHotkey(item.hotkey) : void 0
7645
8289
  });
7646
8290
  const menuLayer = useLayer("menu");
7647
- const openMenu = useCallback13(() => {
8291
+ const openMenu = useCallback14(() => {
7648
8292
  const dest = ref.current;
7649
8293
  const items = item.children;
7650
8294
  const Component = item.Component;
7651
8295
  if (!dest)
7652
8296
  return;
7653
8297
  if (items) {
7654
- menuLayer.open(() => /* @__PURE__ */ jsx55(Menu, { dest, items, close: menuLayer.close }));
8298
+ menuLayer.open(() => /* @__PURE__ */ jsx60(Menu, { dest, items, close: menuLayer.close }));
7655
8299
  } else if (Component) {
7656
- menuLayer.open(() => /* @__PURE__ */ jsx55(Component, { dest, close: menuLayer.close }));
8300
+ menuLayer.open(() => /* @__PURE__ */ jsx60(Component, { dest, close: menuLayer.close }));
7657
8301
  }
7658
8302
  }, [item]);
7659
- const onClick = useCallback13(() => {
8303
+ const onClick = useCallback14(() => {
7660
8304
  if (item.action) {
7661
8305
  item.action(staticEditor);
7662
8306
  ReactEditor14.focus(staticEditor);
@@ -7668,7 +8312,7 @@ function ToolbarButton({
7668
8312
  openMenu();
7669
8313
  }
7670
8314
  }, [menuLayer.layer, item]);
7671
- const onMouseEnter = useCallback13(
8315
+ const onMouseEnter = useCallback14(
7672
8316
  (e) => {
7673
8317
  tooltip.onMouseEnter(e);
7674
8318
  if (menuLayer.layer)
@@ -7676,7 +8320,7 @@ function ToolbarButton({
7676
8320
  },
7677
8321
  [menuLayer.layer]
7678
8322
  );
7679
- return /* @__PURE__ */ jsxs29(
8323
+ return /* @__PURE__ */ jsxs30(
7680
8324
  $ToolbarButton,
7681
8325
  {
7682
8326
  "data-item-type": "button",
@@ -7690,24 +8334,24 @@ function ToolbarButton({
7690
8334
  "--disabled": !isActive && r(item?.title)?.includes("Depth")
7691
8335
  }),
7692
8336
  children: [
7693
- /* @__PURE__ */ jsx55(item.icon, {}),
7694
- item.more ? /* @__PURE__ */ jsx55(More, {}) : null
8337
+ /* @__PURE__ */ jsx60(item.icon, {}),
8338
+ item.more ? /* @__PURE__ */ jsx60(More, {}) : null
7695
8339
  ]
7696
8340
  }
7697
8341
  );
7698
8342
  }
7699
8343
 
7700
8344
  // src/toolbar-plugin/components/toolbar/toolbar.tsx
7701
- import { jsx as jsx56 } from "react/jsx-runtime";
8345
+ import { jsx as jsx61 } from "react/jsx-runtime";
7702
8346
  function ToolbarItem({ item }) {
7703
8347
  const editor = useSlateStatic20();
7704
8348
  if (item === "divider") {
7705
- return /* @__PURE__ */ jsx56($ToolbarDividerContainer, { "data-item-type": "divider", children: /* @__PURE__ */ jsx56($ToolbarDivider, {}) });
8349
+ return /* @__PURE__ */ jsx61($ToolbarDividerContainer, { "data-item-type": "divider", children: /* @__PURE__ */ jsx61($ToolbarDivider, {}) });
7706
8350
  }
7707
8351
  const show = item.show === void 0 ? true : item.show(editor);
7708
8352
  if (!show)
7709
8353
  return null;
7710
- return /* @__PURE__ */ jsx56(ToolbarButton, { item });
8354
+ return /* @__PURE__ */ jsx61(ToolbarButton, { item });
7711
8355
  }
7712
8356
  function getWidths(toolbar) {
7713
8357
  const button = toolbar.querySelector(
@@ -7732,7 +8376,7 @@ function measureItemSetWidth(items, buttonWidth, dividerWidth) {
7732
8376
  return width;
7733
8377
  }
7734
8378
  function Toolbar() {
7735
- const ref = useRef10(null);
8379
+ const ref = useRef11(null);
7736
8380
  const [items, setItems] = useState10(initialItems);
7737
8381
  useEffect7(() => {
7738
8382
  const refresh = throttle2(
@@ -7763,7 +8407,7 @@ function Toolbar() {
7763
8407
  window.removeEventListener("resize", refresh);
7764
8408
  };
7765
8409
  }, []);
7766
- return /* @__PURE__ */ jsx56($ToolbarContainer, { ref, children: /* @__PURE__ */ jsx56($Toolbar, { children: items.map((item, index) => /* @__PURE__ */ jsx56(
8410
+ return /* @__PURE__ */ jsx61($ToolbarContainer, { ref, children: /* @__PURE__ */ jsx61($Toolbar, { children: items.map((item, index) => /* @__PURE__ */ jsx61(
7767
8411
  ToolbarItem,
7768
8412
  {
7769
8413
  item
@@ -7773,21 +8417,21 @@ function Toolbar() {
7773
8417
  }
7774
8418
 
7775
8419
  // src/toolbar-plugin/render-editable/index.tsx
7776
- import { jsx as jsx57, jsxs as jsxs30 } from "react/jsx-runtime";
8420
+ import { jsx as jsx62, jsxs as jsxs31 } from "react/jsx-runtime";
7777
8421
  function renderEditable({ attributes, Editable: Editable3 }) {
7778
- const outerContainerRef = useRef11(null);
8422
+ const outerContainerRef = useRef12(null);
7779
8423
  const editor = useSlateStatic21();
7780
8424
  const focused = useFocused();
7781
- const onClickOuterContainer = useCallback14(
8425
+ const onClickOuterContainer = useCallback15(
7782
8426
  (e) => {
7783
8427
  if (e.target !== e.currentTarget)
7784
8428
  return;
7785
- Transforms37.select(editor, Editor55.end(editor, []));
8429
+ Transforms41.select(editor, Editor59.end(editor, []));
7786
8430
  ReactEditor15.focus(editor);
7787
8431
  },
7788
8432
  [editor]
7789
8433
  );
7790
- return /* @__PURE__ */ jsx57(Layers, { children: /* @__PURE__ */ jsxs30(
8434
+ return /* @__PURE__ */ jsx62(Layers, { children: /* @__PURE__ */ jsxs31(
7791
8435
  $OuterContainer,
7792
8436
  {
7793
8437
  ref: outerContainerRef,
@@ -7799,8 +8443,8 @@ function renderEditable({ attributes, Editable: Editable3 }) {
7799
8443
  },
7800
8444
  onClick: onClickOuterContainer,
7801
8445
  children: [
7802
- /* @__PURE__ */ jsx57(Toolbar, {}),
7803
- /* @__PURE__ */ jsx57(
8446
+ /* @__PURE__ */ jsx62(Toolbar, {}),
8447
+ /* @__PURE__ */ jsx62(
7804
8448
  Editable3,
7805
8449
  {
7806
8450
  as: $Editable,
@@ -7832,7 +8476,7 @@ var ToolbarPlugin = createPlugin(
7832
8476
  );
7833
8477
 
7834
8478
  // src/trailing-block-plugin/index.tsx
7835
- import { Editor as Editor56, Node as Node10, Path as Path13, Transforms as Transforms38 } from "slate";
8479
+ import { Editor as Editor60, Node as Node12, Path as Path14, Transforms as Transforms42 } from "slate";
7836
8480
  var TrailingBlockPlugin = createPlugin(
7837
8481
  (editor) => {
7838
8482
  editor.allowTrailingBlock = true;
@@ -7840,19 +8484,19 @@ var TrailingBlockPlugin = createPlugin(
7840
8484
  name: "trailing-block",
7841
8485
  editor: {
7842
8486
  normalizeNode: (entry) => {
7843
- if (!Editor56.isEditor(entry[0]))
8487
+ if (!Editor60.isEditor(entry[0]))
7844
8488
  return false;
7845
8489
  const lastPath = [editor.children.length - 1];
7846
- const lastElement = Node10.child(
8490
+ const lastElement = Node12.child(
7847
8491
  editor,
7848
8492
  editor.children.length - 1
7849
8493
  );
7850
- if (Editor56.hasBlocks(editor, lastElement) || Editor56.isVoid(editor, lastElement)) {
7851
- Transforms38.insertNodes(
8494
+ if (Editor60.hasBlocks(editor, lastElement) || Editor60.isVoid(editor, lastElement)) {
8495
+ Transforms42.insertNodes(
7852
8496
  editor,
7853
8497
  { type: "paragraph", children: [{ text: "" }] },
7854
8498
  {
7855
- at: Path13.next(lastPath)
8499
+ at: Path14.next(lastPath)
7856
8500
  }
7857
8501
  );
7858
8502
  }
@@ -7864,11 +8508,11 @@ var TrailingBlockPlugin = createPlugin(
7864
8508
  );
7865
8509
 
7866
8510
  // src/paste-markdown-plugin/methods/index.ts
7867
- import { Transforms as Transforms39 } from "slate";
8511
+ import { Transforms as Transforms43 } from "slate";
7868
8512
  function pasteMarkdown(editor, markdown) {
7869
8513
  const escapedMarkdown = escapeUrlSlashes(markdown);
7870
8514
  const fragment = parse(escapedMarkdown);
7871
- Transforms39.insertNodes(editor, fragment);
8515
+ Transforms43.insertNodes(editor, fragment);
7872
8516
  }
7873
8517
  function createPasteMarkdownMethods(editor) {
7874
8518
  return {
@@ -7900,7 +8544,7 @@ var PasteMarkdownPlugin = createPlugin(
7900
8544
  );
7901
8545
 
7902
8546
  // src/placeholder-plugin/index.tsx
7903
- import { jsx as jsx58 } from "react/jsx-runtime";
8547
+ import { jsx as jsx63 } from "react/jsx-runtime";
7904
8548
  function renderPlaceholder(props) {
7905
8549
  const nextAttributes = {
7906
8550
  ...props.attributes,
@@ -7910,7 +8554,7 @@ function renderPlaceholder(props) {
7910
8554
  maxWidth: void 0
7911
8555
  }
7912
8556
  };
7913
- return /* @__PURE__ */ jsx58("span", { ...nextAttributes, children: props.children });
8557
+ return /* @__PURE__ */ jsx63("span", { ...nextAttributes, children: props.children });
7914
8558
  }
7915
8559
  var PlaceholderPlugin = createPlugin(
7916
8560
  (editor, _options, { createPolicy }) => {
@@ -7933,6 +8577,7 @@ var plugins = [
7933
8577
  MarksPlugin,
7934
8578
  InlineCodePlugin,
7935
8579
  BlockQuotePlugin,
8580
+ CodeBlockPlugin,
7936
8581
  TablePlugin,
7937
8582
  HorizontalRulePlugin,
7938
8583
  TrailingBlockPlugin,
@@ -7952,7 +8597,7 @@ var { withSink, SinkEditable: SinkEditable2 } = Sink;
7952
8597
 
7953
8598
  // src/entry/useEditor.tsx
7954
8599
  import { useState as useState11 } from "react";
7955
- import { createEditor, Editor as Editor58, Transforms as Transforms40 } from "slate";
8600
+ import { createEditor, Editor as Editor62, Transforms as Transforms44 } from "slate";
7956
8601
  import { withHistory } from "slate-history";
7957
8602
  import { withReact } from "slate-react";
7958
8603
  function useEditor({
@@ -7988,7 +8633,7 @@ function useEditor({
7988
8633
  const documentValue = parse(escapedMarkdown);
7989
8634
  editor2.children = documentValue;
7990
8635
  editor2.selection = null;
7991
- Transforms40.select(editor2, Editor58.start(editor2, [0]));
8636
+ Transforms44.select(editor2, Editor62.start(editor2, [0]));
7992
8637
  };
7993
8638
  return nextEditor;
7994
8639
  });
@@ -7996,9 +8641,9 @@ function useEditor({
7996
8641
  }
7997
8642
 
7998
8643
  // src/entry/index.tsx
7999
- import { jsx as jsx59, jsxs as jsxs31 } from "react/jsx-runtime";
8644
+ import { jsx as jsx64, jsxs as jsxs32 } from "react/jsx-runtime";
8000
8645
  function renderLeaf({ children, attributes }) {
8001
- return /* @__PURE__ */ jsx59("span", { ...attributes, children });
8646
+ return /* @__PURE__ */ jsx64("span", { ...attributes, children });
8002
8647
  }
8003
8648
  function Editable2({
8004
8649
  editor,
@@ -8011,10 +8656,10 @@ function Editable2({
8011
8656
  }) {
8012
8657
  const [isRawMode, setIsRawMode] = useState12(false);
8013
8658
  const [rawText, setRawText] = useState12(value);
8014
- const ignoreNextChangeRef = useRef12(false);
8015
- const initialValueRef = useRef12(void 0);
8016
- const prevValueRef = useRef12(void 0);
8017
- const onThrottledSlateChange = useCallback15(
8659
+ const ignoreNextChangeRef = useRef13(false);
8660
+ const initialValueRef = useRef13(void 0);
8661
+ const prevValueRef = useRef13(void 0);
8662
+ const onThrottledSlateChange = useCallback16(
8018
8663
  throttle3(
8019
8664
  () => {
8020
8665
  const markdown = serialize(editor.children);
@@ -8029,7 +8674,7 @@ function Editable2({
8029
8674
  ),
8030
8675
  [editor, onChange, throttleInMs]
8031
8676
  );
8032
- const onSlateChange = useCallback15(() => {
8677
+ const onSlateChange = useCallback16(() => {
8033
8678
  if (prevValueRef.current === editor.children) {
8034
8679
  return;
8035
8680
  }
@@ -8053,15 +8698,15 @@ function Editable2({
8053
8698
  const documentValue = parse(valueToProcess);
8054
8699
  editor.children = documentValue;
8055
8700
  editor.selection = null;
8056
- Transforms41.select(editor, Editor59.start(editor, [0]));
8701
+ Transforms45.select(editor, Editor63.start(editor, [0]));
8057
8702
  }
8058
8703
  }
8059
- const onSinkeEditableMouseDown = useCallback15(() => {
8704
+ const onSinkeEditableMouseDown = useCallback16(() => {
8060
8705
  if (navigator.userAgent.toLowerCase().includes("firefox")) {
8061
8706
  ReactEditor17.focus(editor);
8062
8707
  }
8063
8708
  }, [editor]);
8064
- const onBlur = useCallback15(() => {
8709
+ const onBlur = useCallback16(() => {
8065
8710
  onThrottledSlateChange.flush();
8066
8711
  }, [onThrottledSlateChange]);
8067
8712
  const handleRawTextChange = (e) => {
@@ -8069,42 +8714,44 @@ function Editable2({
8069
8714
  setRawText(newText);
8070
8715
  onChange(newText);
8071
8716
  };
8072
- const applyRawTextToEditor = useCallback15(() => {
8717
+ const applyRawTextToEditor = useCallback16(() => {
8073
8718
  if (rawText !== editor.getMarkdown()) {
8074
8719
  editor.setMarkdown(rawText);
8075
8720
  }
8076
8721
  }, [editor, rawText]);
8077
- const updateRawTextFromEditor = useCallback15(() => {
8722
+ const updateRawTextFromEditor = useCallback16(() => {
8078
8723
  const currentMarkdown = editor.getMarkdown();
8079
8724
  setRawText(currentMarkdown);
8080
8725
  }, [editor]);
8081
- const handleRawModeToggle = () => {
8726
+ const handleRawModeToggle = useCallback16(() => {
8082
8727
  if (isRawMode) {
8083
8728
  applyRawTextToEditor();
8084
8729
  } else {
8085
8730
  updateRawTextFromEditor();
8086
8731
  }
8087
8732
  setIsRawMode(!isRawMode);
8088
- };
8089
- return /* @__PURE__ */ jsxs31("div", { style: { position: "relative" }, children: [
8090
- /* @__PURE__ */ jsx59("div", { style: { position: "absolute", top: "5px", right: "25px", zIndex: 10 }, children: /* @__PURE__ */ jsx59(
8733
+ }, [isRawMode, applyRawTextToEditor, updateRawTextFromEditor]);
8734
+ editor.wysimark.isRawMode = isRawMode;
8735
+ editor.wysimark.toggleRawMode = handleRawModeToggle;
8736
+ return /* @__PURE__ */ jsxs32("div", { style: { position: "relative" }, children: [
8737
+ isRawMode && /* @__PURE__ */ jsx64("div", { style: { position: "absolute", top: "5px", right: "25px", zIndex: 10 }, children: /* @__PURE__ */ jsx64(
8091
8738
  "div",
8092
8739
  {
8093
8740
  onClick: handleRawModeToggle,
8094
8741
  style: {
8095
8742
  background: "none",
8096
- border: isRawMode ? "1px solid #4a90e2" : "1px solid transparent",
8743
+ border: "1px solid #4a90e2",
8097
8744
  cursor: "pointer",
8098
8745
  padding: "6px",
8099
8746
  borderRadius: "4px",
8100
- backgroundColor: isRawMode ? "rgba(74, 144, 226, 0.1)" : "transparent",
8101
- boxShadow: isRawMode ? "0 1px 3px rgba(0, 0, 0, 0.1)" : "none",
8747
+ backgroundColor: "rgba(74, 144, 226, 0.1)",
8748
+ boxShadow: "0 1px 3px rgba(0, 0, 0, 0.1)",
8102
8749
  transition: "all 0.2s ease-in-out",
8103
8750
  display: "flex",
8104
8751
  alignItems: "center",
8105
8752
  justifyContent: "center"
8106
8753
  },
8107
- title: isRawMode ? t("switchToVisualEditor") : t("switchToRawMarkdown"),
8754
+ title: t("switchToVisualEditor"),
8108
8755
  role: "button",
8109
8756
  tabIndex: 0,
8110
8757
  onKeyDown: (e) => {
@@ -8113,54 +8760,10 @@ function Editable2({
8113
8760
  e.preventDefault();
8114
8761
  }
8115
8762
  },
8116
- children: /* @__PURE__ */ jsxs31("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
8117
- /* @__PURE__ */ jsx59(
8118
- "rect",
8119
- {
8120
- x: "3",
8121
- y: "3",
8122
- width: "18",
8123
- height: "18",
8124
- rx: "2",
8125
- stroke: isRawMode ? "#4a90e2" : "currentColor",
8126
- strokeWidth: "1.5",
8127
- fill: isRawMode ? "rgba(74, 144, 226, 0.05)" : "transparent"
8128
- }
8129
- ),
8130
- /* @__PURE__ */ jsx59(
8131
- "path",
8132
- {
8133
- d: "M7 15V9L10 12L13 9V15",
8134
- stroke: isRawMode ? "#4a90e2" : "currentColor",
8135
- strokeWidth: "1.5",
8136
- strokeLinecap: "round",
8137
- strokeLinejoin: "round"
8138
- }
8139
- ),
8140
- /* @__PURE__ */ jsx59(
8141
- "path",
8142
- {
8143
- d: "M16 9H18V15",
8144
- stroke: isRawMode ? "#4a90e2" : "currentColor",
8145
- strokeWidth: "1.5",
8146
- strokeLinecap: "round",
8147
- strokeLinejoin: "round"
8148
- }
8149
- ),
8150
- /* @__PURE__ */ jsx59(
8151
- "path",
8152
- {
8153
- d: "M16 12H18",
8154
- stroke: isRawMode ? "#4a90e2" : "currentColor",
8155
- strokeWidth: "1.5",
8156
- strokeLinecap: "round",
8157
- strokeLinejoin: "round"
8158
- }
8159
- )
8160
- ] })
8763
+ children: /* @__PURE__ */ jsx64("span", { style: { color: "#4a90e2", fontSize: "1.25em" }, children: /* @__PURE__ */ jsx64(VisualEditor, {}) })
8161
8764
  }
8162
8765
  ) }),
8163
- /* @__PURE__ */ jsx59("div", { style: { display: isRawMode ? "block" : "none", textAlign: "center" }, children: /* @__PURE__ */ jsx59(
8766
+ /* @__PURE__ */ jsx64("div", { style: { display: isRawMode ? "block" : "none", textAlign: "center" }, children: /* @__PURE__ */ jsx64(
8164
8767
  "textarea",
8165
8768
  {
8166
8769
  value: unescapeUrlSlashes(rawText).replace(/&nbsp;/g, ""),
@@ -8185,13 +8788,13 @@ function Editable2({
8185
8788
  }
8186
8789
  }
8187
8790
  ) }),
8188
- /* @__PURE__ */ jsx59("div", { style: { display: isRawMode ? "none" : "block" }, children: /* @__PURE__ */ jsx59(
8791
+ /* @__PURE__ */ jsx64("div", { style: { display: isRawMode ? "none" : "block" }, children: /* @__PURE__ */ jsx64(
8189
8792
  Slate2,
8190
8793
  {
8191
8794
  editor,
8192
8795
  value: initialValueRef.current,
8193
8796
  onChange: onSlateChange,
8194
- children: /* @__PURE__ */ jsx59(
8797
+ children: /* @__PURE__ */ jsx64(
8195
8798
  SinkEditable2,
8196
8799
  {
8197
8800
  renderLeaf,
@@ -8208,13 +8811,13 @@ function Editable2({
8208
8811
  }
8209
8812
 
8210
8813
  // src/index.tsx
8211
- import { jsx as jsx60 } from "react/jsx-runtime";
8814
+ import { jsx as jsx65 } from "react/jsx-runtime";
8212
8815
  function StandaloneEditor({
8213
8816
  standaloneOptions: { onChange, placeholder, className, ...options },
8214
8817
  standaloneMethodsRef
8215
8818
  }) {
8216
8819
  const [markdown, setMarkdown] = useState13(options.initialMarkdown || "");
8217
- const markdownRef = useRef13(markdown);
8820
+ const markdownRef = useRef14(markdown);
8218
8821
  const editor = useEditor(options);
8219
8822
  markdownRef.current = markdown;
8220
8823
  useImperativeHandle(
@@ -8232,7 +8835,7 @@ function StandaloneEditor({
8232
8835
  },
8233
8836
  [markdownRef, setMarkdown]
8234
8837
  );
8235
- const onChangeEditable = useCallback16(
8838
+ const onChangeEditable = useCallback17(
8236
8839
  (markdown2) => {
8237
8840
  markdownRef.current = markdown2;
8238
8841
  setMarkdown(markdown2);
@@ -8240,7 +8843,7 @@ function StandaloneEditor({
8240
8843
  },
8241
8844
  [editor]
8242
8845
  );
8243
- return /* @__PURE__ */ jsx60(
8846
+ return /* @__PURE__ */ jsx65(
8244
8847
  Editable2,
8245
8848
  {
8246
8849
  editor,
@@ -8255,7 +8858,7 @@ function createWysimark(containerElement, options) {
8255
8858
  const standaloneMethodsRef = createRef();
8256
8859
  const root = createRoot(containerElement);
8257
8860
  root.render(
8258
- /* @__PURE__ */ jsx60(
8861
+ /* @__PURE__ */ jsx65(
8259
8862
  StandaloneEditor,
8260
8863
  {
8261
8864
  standaloneMethodsRef,