wysimark-lite 0.23.0 → 0.24.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.d.ts +21 -4
- package/dist/index.js +135 -108
- package/dist/index.mjs +439 -346
- package/dist/index.mjs.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { createRoot } from "react-dom/client";
|
|
|
13
13
|
// src/entry/index.tsx
|
|
14
14
|
import throttle3 from "lodash.throttle";
|
|
15
15
|
import { useCallback as useCallback16, useRef as useRef12, useState as useState13 } from "react";
|
|
16
|
-
import { Editor as Editor66, Transforms as
|
|
16
|
+
import { Editor as Editor66, Transforms as Transforms49 } from "slate";
|
|
17
17
|
import { ReactEditor as ReactEditor18, Slate as Slate2 } from "slate-react";
|
|
18
18
|
|
|
19
19
|
// src/convert/parse/index.ts
|
|
@@ -642,12 +642,9 @@ function parseHeading(content) {
|
|
|
642
642
|
function parseHTML(content) {
|
|
643
643
|
return [
|
|
644
644
|
{
|
|
645
|
-
type: "
|
|
646
|
-
|
|
647
|
-
children:
|
|
648
|
-
type: "code-block-line",
|
|
649
|
-
children: [{ text: line }]
|
|
650
|
-
}))
|
|
645
|
+
type: "html-block",
|
|
646
|
+
html: content.value,
|
|
647
|
+
children: [{ text: "" }]
|
|
651
648
|
}
|
|
652
649
|
];
|
|
653
650
|
}
|
|
@@ -1516,6 +1513,10 @@ function serializeElement(element, orders) {
|
|
|
1516
1513
|
throw new Error(
|
|
1517
1514
|
`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.`
|
|
1518
1515
|
);
|
|
1516
|
+
case "html-block":
|
|
1517
|
+
return `${element.html}
|
|
1518
|
+
|
|
1519
|
+
`;
|
|
1519
1520
|
}
|
|
1520
1521
|
assertUnreachable(element);
|
|
1521
1522
|
}
|
|
@@ -5315,6 +5316,97 @@ var CodeBlockPlugin = createPlugin(
|
|
|
5315
5316
|
}
|
|
5316
5317
|
);
|
|
5317
5318
|
|
|
5319
|
+
// src/html-block-plugin/index.tsx
|
|
5320
|
+
import { Transforms as Transforms22 } from "slate";
|
|
5321
|
+
|
|
5322
|
+
// src/html-block-plugin/styles.ts
|
|
5323
|
+
import styled24 from "@emotion/styled";
|
|
5324
|
+
var $HtmlBlock = styled24("div")`
|
|
5325
|
+
position: relative;
|
|
5326
|
+
background-color: var(--shade-100);
|
|
5327
|
+
border: 1px solid var(--shade-300);
|
|
5328
|
+
border-radius: 0.5em;
|
|
5329
|
+
padding: 2em 1em 1em 1em;
|
|
5330
|
+
margin: 1em 0;
|
|
5331
|
+
font-family: "andale mono", AndaleMono, monospace;
|
|
5332
|
+
font-size: 0.875em;
|
|
5333
|
+
line-height: 1.5;
|
|
5334
|
+
white-space: pre-wrap;
|
|
5335
|
+
word-break: break-word;
|
|
5336
|
+
color: var(--shade-700);
|
|
5337
|
+
overflow-x: auto;
|
|
5338
|
+
|
|
5339
|
+
&.--selected {
|
|
5340
|
+
outline: 2px solid var(--select-color);
|
|
5341
|
+
}
|
|
5342
|
+
`;
|
|
5343
|
+
var $HtmlBlockLabel = styled24("span")`
|
|
5344
|
+
position: absolute;
|
|
5345
|
+
top: 0.25em;
|
|
5346
|
+
right: 0.5em;
|
|
5347
|
+
font-size: 0.625em;
|
|
5348
|
+
color: var(--shade-500);
|
|
5349
|
+
text-transform: uppercase;
|
|
5350
|
+
letter-spacing: 0.5px;
|
|
5351
|
+
`;
|
|
5352
|
+
|
|
5353
|
+
// src/html-block-plugin/render-element.tsx
|
|
5354
|
+
import { jsx as jsx33, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5355
|
+
function HtmlBlock({
|
|
5356
|
+
attributes,
|
|
5357
|
+
children,
|
|
5358
|
+
element
|
|
5359
|
+
}) {
|
|
5360
|
+
return /* @__PURE__ */ jsxs17($HtmlBlock, { ...attributes, contentEditable: false, children: [
|
|
5361
|
+
/* @__PURE__ */ jsx33($HtmlBlockLabel, { children: "HTML" }),
|
|
5362
|
+
/* @__PURE__ */ jsx33("div", { children: unescapeUrlSlashes(element.html) }),
|
|
5363
|
+
children
|
|
5364
|
+
] });
|
|
5365
|
+
}
|
|
5366
|
+
|
|
5367
|
+
// src/html-block-plugin/index.tsx
|
|
5368
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5369
|
+
var HtmlBlockPlugin = createPlugin(
|
|
5370
|
+
(editor, _options, { createPolicy }) => {
|
|
5371
|
+
function onDelete() {
|
|
5372
|
+
const { selection } = editor;
|
|
5373
|
+
if (!isCollapsed(selection))
|
|
5374
|
+
return false;
|
|
5375
|
+
const htmlBlockEntry = findElementUp(editor, "html-block");
|
|
5376
|
+
if (htmlBlockEntry == null)
|
|
5377
|
+
return false;
|
|
5378
|
+
Transforms22.removeNodes(editor, { at: htmlBlockEntry[1] });
|
|
5379
|
+
return true;
|
|
5380
|
+
}
|
|
5381
|
+
return createPolicy({
|
|
5382
|
+
name: "html-block",
|
|
5383
|
+
editor: {
|
|
5384
|
+
deleteBackward: onDelete,
|
|
5385
|
+
deleteForward: onDelete,
|
|
5386
|
+
isInline(element) {
|
|
5387
|
+
if (element.type === "html-block")
|
|
5388
|
+
return false;
|
|
5389
|
+
},
|
|
5390
|
+
isVoid(element) {
|
|
5391
|
+
if (element.type === "html-block")
|
|
5392
|
+
return true;
|
|
5393
|
+
},
|
|
5394
|
+
isMaster(element) {
|
|
5395
|
+
if (element.type === "html-block")
|
|
5396
|
+
return true;
|
|
5397
|
+
}
|
|
5398
|
+
},
|
|
5399
|
+
editableProps: {
|
|
5400
|
+
renderElement: ({ element, attributes, children }) => {
|
|
5401
|
+
if (element.type === "html-block") {
|
|
5402
|
+
return /* @__PURE__ */ jsx34(HtmlBlock, { element, attributes, children });
|
|
5403
|
+
}
|
|
5404
|
+
}
|
|
5405
|
+
}
|
|
5406
|
+
});
|
|
5407
|
+
}
|
|
5408
|
+
);
|
|
5409
|
+
|
|
5318
5410
|
// src/collapsible-paragraph-plugin/index.tsx
|
|
5319
5411
|
import { Editor as Editor32 } from "slate";
|
|
5320
5412
|
|
|
@@ -5322,7 +5414,7 @@ import { Editor as Editor32 } from "slate";
|
|
|
5322
5414
|
import { Element as Element18 } from "slate";
|
|
5323
5415
|
|
|
5324
5416
|
// src/collapsible-paragraph-plugin/normalize-node/normalize-sibling-paragraphs.ts
|
|
5325
|
-
import { Element as Element16, Transforms as
|
|
5417
|
+
import { Element as Element16, Transforms as Transforms23 } from "slate";
|
|
5326
5418
|
function isParagraph(node) {
|
|
5327
5419
|
return Element16.isElement(node) && node.type === "paragraph";
|
|
5328
5420
|
}
|
|
@@ -5331,7 +5423,7 @@ function normalizeSiblingParagraphs(editor, entry) {
|
|
|
5331
5423
|
if (!isParagraph(a[0]) || !isParagraph(b[0]))
|
|
5332
5424
|
return false;
|
|
5333
5425
|
if (a[0].__collapsible && b[0].__collapsible) {
|
|
5334
|
-
|
|
5426
|
+
Transforms23.removeNodes(editor, { at: a[1] });
|
|
5335
5427
|
return true;
|
|
5336
5428
|
}
|
|
5337
5429
|
return false;
|
|
@@ -5339,7 +5431,7 @@ function normalizeSiblingParagraphs(editor, entry) {
|
|
|
5339
5431
|
}
|
|
5340
5432
|
|
|
5341
5433
|
// src/collapsible-paragraph-plugin/normalize-node/normalize-sibling-walls.ts
|
|
5342
|
-
import { Element as Element17, Transforms as
|
|
5434
|
+
import { Element as Element17, Transforms as Transforms24 } from "slate";
|
|
5343
5435
|
function isWall(editor, node) {
|
|
5344
5436
|
if (!Element17.isElement(node))
|
|
5345
5437
|
return false;
|
|
@@ -5351,7 +5443,7 @@ function normalizeSiblingWalls(editor, entry) {
|
|
|
5351
5443
|
return normalizeSiblings(editor, entry, (a, b) => {
|
|
5352
5444
|
if (!isWall(editor, a[0]) || !isWall(editor, b[0]))
|
|
5353
5445
|
return false;
|
|
5354
|
-
|
|
5446
|
+
Transforms24.insertNodes(
|
|
5355
5447
|
editor,
|
|
5356
5448
|
{
|
|
5357
5449
|
type: "paragraph",
|
|
@@ -5381,8 +5473,8 @@ import { clsx as clsx5 } from "clsx";
|
|
|
5381
5473
|
import { useSelected as useSelected5 } from "slate-react";
|
|
5382
5474
|
|
|
5383
5475
|
// src/collapsible-paragraph-plugin/render-element/styles.ts
|
|
5384
|
-
import
|
|
5385
|
-
var $Paragraph =
|
|
5476
|
+
import styled25 from "@emotion/styled";
|
|
5477
|
+
var $Paragraph = styled25("p")`
|
|
5386
5478
|
padding: 0;
|
|
5387
5479
|
margin: 0;
|
|
5388
5480
|
&:first-child {
|
|
@@ -5421,7 +5513,7 @@ function getIsEmpty(element) {
|
|
|
5421
5513
|
}
|
|
5422
5514
|
|
|
5423
5515
|
// src/collapsible-paragraph-plugin/render-element/paragraph.tsx
|
|
5424
|
-
import { jsx as
|
|
5516
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
5425
5517
|
function Paragraph({
|
|
5426
5518
|
element,
|
|
5427
5519
|
attributes,
|
|
@@ -5429,7 +5521,7 @@ function Paragraph({
|
|
|
5429
5521
|
}) {
|
|
5430
5522
|
const selected = useSelected5();
|
|
5431
5523
|
const isEmpty = getIsEmpty(element);
|
|
5432
|
-
return /* @__PURE__ */
|
|
5524
|
+
return /* @__PURE__ */ jsx35(
|
|
5433
5525
|
$Paragraph,
|
|
5434
5526
|
{
|
|
5435
5527
|
...attributes,
|
|
@@ -5444,7 +5536,7 @@ function Paragraph({
|
|
|
5444
5536
|
}
|
|
5445
5537
|
|
|
5446
5538
|
// src/collapsible-paragraph-plugin/index.tsx
|
|
5447
|
-
import { jsx as
|
|
5539
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
5448
5540
|
var CollapsibleParagraphPlugin = createPlugin((editor) => {
|
|
5449
5541
|
const { insertBreak: insertBreak3 } = editor;
|
|
5450
5542
|
editor.insertBreak = () => {
|
|
@@ -5491,7 +5583,7 @@ var CollapsibleParagraphPlugin = createPlugin((editor) => {
|
|
|
5491
5583
|
renderElement: ({ element, attributes, children }) => {
|
|
5492
5584
|
switch (element.type) {
|
|
5493
5585
|
case "paragraph": {
|
|
5494
|
-
return /* @__PURE__ */
|
|
5586
|
+
return /* @__PURE__ */ jsx36(Paragraph, { element, attributes, children });
|
|
5495
5587
|
}
|
|
5496
5588
|
}
|
|
5497
5589
|
},
|
|
@@ -5512,7 +5604,7 @@ function addConvertElementType(editor, type) {
|
|
|
5512
5604
|
}
|
|
5513
5605
|
|
|
5514
5606
|
// src/convert-element-plugin/methods/convert-elements.ts
|
|
5515
|
-
import { Editor as Editor33, Element as Element20, Node as Node13, Point, Range as Range5, Transforms as
|
|
5607
|
+
import { Editor as Editor33, Element as Element20, Node as Node13, Point, Range as Range5, Transforms as Transforms25 } from "slate";
|
|
5516
5608
|
function getOffsetInElement(editor, point, elementPath) {
|
|
5517
5609
|
try {
|
|
5518
5610
|
const elementStart = Editor33.start(editor, elementPath);
|
|
@@ -5547,7 +5639,7 @@ function restoreSelectionInElement(editor, elementPath, offset) {
|
|
|
5547
5639
|
currentOffset += nodeLength;
|
|
5548
5640
|
}
|
|
5549
5641
|
const point = { path: targetPath, offset: targetOffset };
|
|
5550
|
-
|
|
5642
|
+
Transforms25.select(editor, { anchor: point, focus: point });
|
|
5551
5643
|
} catch {
|
|
5552
5644
|
}
|
|
5553
5645
|
}
|
|
@@ -5618,16 +5710,16 @@ function splitElementAtSelectedLines(editor, element, path, selection) {
|
|
|
5618
5710
|
...element,
|
|
5619
5711
|
children: [{ text: afterText }]
|
|
5620
5712
|
};
|
|
5621
|
-
|
|
5713
|
+
Transforms25.insertNodes(editor, afterElement, {
|
|
5622
5714
|
at: [...basePath, baseIndex + 1]
|
|
5623
5715
|
});
|
|
5624
5716
|
}
|
|
5625
5717
|
const childrenCount = element.children.length;
|
|
5626
5718
|
for (let j = childrenCount - 1; j >= 0; j--) {
|
|
5627
|
-
|
|
5719
|
+
Transforms25.removeNodes(editor, { at: [...path, j] });
|
|
5628
5720
|
}
|
|
5629
5721
|
if (beforeLines.length > 0) {
|
|
5630
|
-
|
|
5722
|
+
Transforms25.insertNodes(
|
|
5631
5723
|
editor,
|
|
5632
5724
|
{ text: beforeLines.join("\n") },
|
|
5633
5725
|
{ at: [...path, 0] }
|
|
@@ -5637,11 +5729,11 @@ function splitElementAtSelectedLines(editor, element, path, selection) {
|
|
|
5637
5729
|
type: "paragraph",
|
|
5638
5730
|
children: [{ text: selectedText }]
|
|
5639
5731
|
};
|
|
5640
|
-
|
|
5732
|
+
Transforms25.insertNodes(editor, selectedElement, {
|
|
5641
5733
|
at: [...basePath, baseIndex + 1]
|
|
5642
5734
|
});
|
|
5643
5735
|
} else {
|
|
5644
|
-
|
|
5736
|
+
Transforms25.insertNodes(
|
|
5645
5737
|
editor,
|
|
5646
5738
|
{ text: selectedLines.join("\n") },
|
|
5647
5739
|
{ at: [...path, 0] }
|
|
@@ -5752,7 +5844,7 @@ function convertElements(editor, matchForToggle, targetElement, allowToggle) {
|
|
|
5752
5844
|
}
|
|
5753
5845
|
currentOffset += nodeLength;
|
|
5754
5846
|
}
|
|
5755
|
-
|
|
5847
|
+
Transforms25.select(editor, {
|
|
5756
5848
|
anchor: { path: anchorPath, offset: anchorOffset },
|
|
5757
5849
|
focus: { path: focusPath, offset: focusOffset }
|
|
5758
5850
|
});
|
|
@@ -5792,7 +5884,7 @@ var ConvertElementPlugin = createPlugin((editor) => {
|
|
|
5792
5884
|
});
|
|
5793
5885
|
|
|
5794
5886
|
// src/heading-plugin/insert-break.ts
|
|
5795
|
-
import { Editor as Editor34, Path as Path9, Range as Range6, Transforms as
|
|
5887
|
+
import { Editor as Editor34, Path as Path9, Range as Range6, Transforms as Transforms26 } from "slate";
|
|
5796
5888
|
function insertBreak(editor) {
|
|
5797
5889
|
const entry = findElementUp(editor, "heading");
|
|
5798
5890
|
if (!entry)
|
|
@@ -5804,12 +5896,12 @@ function insertBreak(editor) {
|
|
|
5804
5896
|
if (!Editor34.isEnd(editor, editor.selection.anchor, entry[1]))
|
|
5805
5897
|
return false;
|
|
5806
5898
|
const nextPath = Path9.next(entry[1]);
|
|
5807
|
-
|
|
5899
|
+
Transforms26.insertNodes(
|
|
5808
5900
|
editor,
|
|
5809
5901
|
{ type: "paragraph", children: [{ text: "" }] },
|
|
5810
5902
|
{ at: nextPath }
|
|
5811
5903
|
);
|
|
5812
|
-
|
|
5904
|
+
Transforms26.select(editor, {
|
|
5813
5905
|
anchor: Editor34.start(editor, nextPath),
|
|
5814
5906
|
focus: Editor34.start(editor, nextPath)
|
|
5815
5907
|
});
|
|
@@ -5842,7 +5934,7 @@ function createHeadingMethods(editor) {
|
|
|
5842
5934
|
|
|
5843
5935
|
// src/heading-plugin/styles.ts
|
|
5844
5936
|
import { css } from "@emotion/react";
|
|
5845
|
-
import
|
|
5937
|
+
import styled26 from "@emotion/styled";
|
|
5846
5938
|
var headingStyles = css`
|
|
5847
5939
|
margin-top: 1em;
|
|
5848
5940
|
&:first-child {
|
|
@@ -5850,34 +5942,34 @@ var headingStyles = css`
|
|
|
5850
5942
|
}
|
|
5851
5943
|
font-weight: bold;
|
|
5852
5944
|
`;
|
|
5853
|
-
var $H1 =
|
|
5945
|
+
var $H1 = styled26("h1")`
|
|
5854
5946
|
${headingStyles}
|
|
5855
5947
|
font-size: 2.25em;
|
|
5856
5948
|
letter-spacing: -0.01em;
|
|
5857
5949
|
`;
|
|
5858
|
-
var $H2 =
|
|
5950
|
+
var $H2 = styled26("h2")`
|
|
5859
5951
|
${headingStyles}
|
|
5860
5952
|
font-size: 1.5em;
|
|
5861
5953
|
`;
|
|
5862
|
-
var $H3 =
|
|
5954
|
+
var $H3 = styled26("h3")`
|
|
5863
5955
|
${headingStyles}
|
|
5864
5956
|
font-size: 1.25em;
|
|
5865
5957
|
`;
|
|
5866
|
-
var $H4 =
|
|
5958
|
+
var $H4 = styled26("h4")`
|
|
5867
5959
|
${headingStyles}
|
|
5868
5960
|
font-size: 1em;
|
|
5869
5961
|
`;
|
|
5870
|
-
var $H5 =
|
|
5962
|
+
var $H5 = styled26("h5")`
|
|
5871
5963
|
${headingStyles}
|
|
5872
5964
|
font-size: 1em;
|
|
5873
5965
|
`;
|
|
5874
|
-
var $H6 =
|
|
5966
|
+
var $H6 = styled26("h6")`
|
|
5875
5967
|
${headingStyles}
|
|
5876
5968
|
font-size: 1em;
|
|
5877
5969
|
`;
|
|
5878
5970
|
|
|
5879
5971
|
// src/heading-plugin/index.tsx
|
|
5880
|
-
import { jsx as
|
|
5972
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
5881
5973
|
var HeadingPlugin = createPlugin(
|
|
5882
5974
|
(editor) => {
|
|
5883
5975
|
editor.convertElement.addConvertElementType("heading");
|
|
@@ -5908,17 +6000,17 @@ var HeadingPlugin = createPlugin(
|
|
|
5908
6000
|
if (element.type === "heading") {
|
|
5909
6001
|
switch (element.level) {
|
|
5910
6002
|
case 1:
|
|
5911
|
-
return /* @__PURE__ */
|
|
6003
|
+
return /* @__PURE__ */ jsx37($H1, { ...attributes, children });
|
|
5912
6004
|
case 2:
|
|
5913
|
-
return /* @__PURE__ */
|
|
6005
|
+
return /* @__PURE__ */ jsx37($H2, { ...attributes, children });
|
|
5914
6006
|
case 3:
|
|
5915
|
-
return /* @__PURE__ */
|
|
6007
|
+
return /* @__PURE__ */ jsx37($H3, { ...attributes, children });
|
|
5916
6008
|
case 4:
|
|
5917
|
-
return /* @__PURE__ */
|
|
6009
|
+
return /* @__PURE__ */ jsx37($H4, { ...attributes, children });
|
|
5918
6010
|
case 5:
|
|
5919
|
-
return /* @__PURE__ */
|
|
6011
|
+
return /* @__PURE__ */ jsx37($H5, { ...attributes, children });
|
|
5920
6012
|
case 6:
|
|
5921
|
-
return /* @__PURE__ */
|
|
6013
|
+
return /* @__PURE__ */ jsx37($H6, { ...attributes, children });
|
|
5922
6014
|
default: {
|
|
5923
6015
|
const exhaustiveCheck = element.level;
|
|
5924
6016
|
throw new Error(
|
|
@@ -5944,8 +6036,8 @@ var HeadingPlugin = createPlugin(
|
|
|
5944
6036
|
import { useSelected as useSelected6 } from "slate-react";
|
|
5945
6037
|
|
|
5946
6038
|
// src/horizontal-rule-plugin/styles.tsx
|
|
5947
|
-
import
|
|
5948
|
-
var $HorizontalRule =
|
|
6039
|
+
import styled27 from "@emotion/styled";
|
|
6040
|
+
var $HorizontalRule = styled27("hr")`
|
|
5949
6041
|
position: relative;
|
|
5950
6042
|
height: 1em;
|
|
5951
6043
|
/* background-color: var(--hr-color); */
|
|
@@ -5978,15 +6070,15 @@ var $HorizontalRule = styled26("hr")`
|
|
|
5978
6070
|
`;
|
|
5979
6071
|
|
|
5980
6072
|
// src/horizontal-rule-plugin/horizontal-rule.tsx
|
|
5981
|
-
import { jsx as
|
|
6073
|
+
import { jsx as jsx38, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5982
6074
|
function HorizontalRule({
|
|
5983
6075
|
attributes,
|
|
5984
6076
|
children
|
|
5985
6077
|
}) {
|
|
5986
6078
|
const selected = useSelected6();
|
|
5987
|
-
return /* @__PURE__ */
|
|
6079
|
+
return /* @__PURE__ */ jsxs18("div", { ...attributes, draggable: true, children: [
|
|
5988
6080
|
children,
|
|
5989
|
-
/* @__PURE__ */
|
|
6081
|
+
/* @__PURE__ */ jsx38("div", { contentEditable: false, children: /* @__PURE__ */ jsx38($HorizontalRule, { className: selected ? "--selected" : "" }) })
|
|
5990
6082
|
] });
|
|
5991
6083
|
}
|
|
5992
6084
|
|
|
@@ -6004,7 +6096,7 @@ function createHorizontalRuleMethods(editor) {
|
|
|
6004
6096
|
}
|
|
6005
6097
|
|
|
6006
6098
|
// src/horizontal-rule-plugin/index.tsx
|
|
6007
|
-
import { jsx as
|
|
6099
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
6008
6100
|
var HorizontalRulePlugin = createPlugin(
|
|
6009
6101
|
(editor, _options, { createPolicy }) => {
|
|
6010
6102
|
editor.horizontalRule = createHorizontalRuleMethods(editor);
|
|
@@ -6019,7 +6111,7 @@ var HorizontalRulePlugin = createPlugin(
|
|
|
6019
6111
|
editableProps: {
|
|
6020
6112
|
renderElement: (props) => {
|
|
6021
6113
|
if (props.element.type === "horizontal-rule") {
|
|
6022
|
-
return /* @__PURE__ */
|
|
6114
|
+
return /* @__PURE__ */ jsx39(HorizontalRule, { ...props });
|
|
6023
6115
|
}
|
|
6024
6116
|
},
|
|
6025
6117
|
onKeyDown: createHotkeyHandler({
|
|
@@ -6031,8 +6123,8 @@ var HorizontalRulePlugin = createPlugin(
|
|
|
6031
6123
|
);
|
|
6032
6124
|
|
|
6033
6125
|
// src/inline-code-plugin/styles.ts
|
|
6034
|
-
import
|
|
6035
|
-
var $InlineCode =
|
|
6126
|
+
import styled28 from "@emotion/styled";
|
|
6127
|
+
var $InlineCode = styled28("code")`
|
|
6036
6128
|
color: var(--shade-600);
|
|
6037
6129
|
background-color: var(--inline-code-bgcolor);
|
|
6038
6130
|
border: 1px solid var(--inline-code-border-color);
|
|
@@ -6054,7 +6146,7 @@ var $InlineCode = styled27("code")`
|
|
|
6054
6146
|
font-size: 0.75em;
|
|
6055
6147
|
vertical-align: baseline;
|
|
6056
6148
|
`;
|
|
6057
|
-
var $InvisibleSpan =
|
|
6149
|
+
var $InvisibleSpan = styled28("span")`
|
|
6058
6150
|
display: inline-block;
|
|
6059
6151
|
opacity: 0;
|
|
6060
6152
|
width: 1px;
|
|
@@ -6062,7 +6154,7 @@ var $InvisibleSpan = styled27("span")`
|
|
|
6062
6154
|
`;
|
|
6063
6155
|
|
|
6064
6156
|
// src/inline-code-plugin/index.tsx
|
|
6065
|
-
import { jsx as
|
|
6157
|
+
import { jsx as jsx40, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6066
6158
|
var InlineCodePlugin = createPlugin(
|
|
6067
6159
|
(editor) => {
|
|
6068
6160
|
if (!editor.marksPlugin)
|
|
@@ -6081,10 +6173,10 @@ var InlineCodePlugin = createPlugin(
|
|
|
6081
6173
|
/**
|
|
6082
6174
|
* Disable spellCheck because it's computer code usually.
|
|
6083
6175
|
*/
|
|
6084
|
-
/* @__PURE__ */
|
|
6085
|
-
/* @__PURE__ */
|
|
6176
|
+
/* @__PURE__ */ jsxs19($InlineCode, { spellCheck: false, children: [
|
|
6177
|
+
/* @__PURE__ */ jsx40($InvisibleSpan, { contentEditable: false, children: "|" }),
|
|
6086
6178
|
children,
|
|
6087
|
-
/* @__PURE__ */
|
|
6179
|
+
/* @__PURE__ */ jsx40($InvisibleSpan, { contentEditable: false, children: "|" })
|
|
6088
6180
|
] })
|
|
6089
6181
|
);
|
|
6090
6182
|
} else {
|
|
@@ -6184,7 +6276,7 @@ function indent(editor) {
|
|
|
6184
6276
|
}
|
|
6185
6277
|
|
|
6186
6278
|
// src/list-plugin/methods/insert-break.ts
|
|
6187
|
-
import { Editor as Editor36, Transforms as
|
|
6279
|
+
import { Editor as Editor36, Transforms as Transforms27 } from "slate";
|
|
6188
6280
|
function insertBreak2(editor) {
|
|
6189
6281
|
const entry = findElementUp(editor, isListItem);
|
|
6190
6282
|
if (!entry)
|
|
@@ -6192,19 +6284,19 @@ function insertBreak2(editor) {
|
|
|
6192
6284
|
const [element, path] = entry;
|
|
6193
6285
|
if (Editor36.isEmpty(editor, element)) {
|
|
6194
6286
|
if (element.depth > 0) {
|
|
6195
|
-
|
|
6287
|
+
Transforms27.setNodes(editor, { depth: element.depth - 1 }, { at: path });
|
|
6196
6288
|
return true;
|
|
6197
6289
|
} else {
|
|
6198
6290
|
rewrapElement(editor, { type: "paragraph" }, path);
|
|
6199
6291
|
return true;
|
|
6200
6292
|
}
|
|
6201
6293
|
}
|
|
6202
|
-
|
|
6294
|
+
Transforms27.splitNodes(editor, { always: true });
|
|
6203
6295
|
const nextEntry = findElementUp(editor, isListItem);
|
|
6204
6296
|
if (!nextEntry)
|
|
6205
6297
|
return true;
|
|
6206
6298
|
if (nextEntry[0].type === "task-list-item" && nextEntry[0].checked === true) {
|
|
6207
|
-
|
|
6299
|
+
Transforms27.setNodes(editor, { checked: false }, { at: nextEntry[1] });
|
|
6208
6300
|
}
|
|
6209
6301
|
return true;
|
|
6210
6302
|
}
|
|
@@ -6231,7 +6323,7 @@ function outdent(editor) {
|
|
|
6231
6323
|
}
|
|
6232
6324
|
|
|
6233
6325
|
// src/list-plugin/methods/toggleTaskListItem.ts
|
|
6234
|
-
import { Transforms as
|
|
6326
|
+
import { Transforms as Transforms28 } from "slate";
|
|
6235
6327
|
function toggleTaskListItem(editor, { at = editor.selection } = {}) {
|
|
6236
6328
|
const taskListItem = findElementUp(
|
|
6237
6329
|
editor,
|
|
@@ -6241,7 +6333,7 @@ function toggleTaskListItem(editor, { at = editor.selection } = {}) {
|
|
|
6241
6333
|
if (!taskListItem)
|
|
6242
6334
|
return false;
|
|
6243
6335
|
const nextChecked = !taskListItem[0].checked;
|
|
6244
|
-
|
|
6336
|
+
Transforms28.setNodes(
|
|
6245
6337
|
editor,
|
|
6246
6338
|
{ checked: nextChecked },
|
|
6247
6339
|
{ at: taskListItem[1] }
|
|
@@ -6267,7 +6359,7 @@ function createListMethods(editor) {
|
|
|
6267
6359
|
}
|
|
6268
6360
|
|
|
6269
6361
|
// src/list-plugin/normalize-node/normalize-ordered-first-at-depth.ts
|
|
6270
|
-
import { Element as Element21, Transforms as
|
|
6362
|
+
import { Element as Element21, Transforms as Transforms29 } from "slate";
|
|
6271
6363
|
var isOrderedListItem = createIsElementType([
|
|
6272
6364
|
"ordered-list-item"
|
|
6273
6365
|
]);
|
|
@@ -6280,7 +6372,7 @@ function normalizeOrderedFirstAtDepth(editor, entry) {
|
|
|
6280
6372
|
return false;
|
|
6281
6373
|
const __firstAtDepth = isOrderedListItem(a[0]) ? b[0].depth > a[0].depth : isListItem(a[0]) ? b[0].depth > a[0].depth : true;
|
|
6282
6374
|
if (b[0].__firstAtDepth !== __firstAtDepth) {
|
|
6283
|
-
|
|
6375
|
+
Transforms29.setNodes(editor, { __firstAtDepth }, { at: b[1] });
|
|
6284
6376
|
return true;
|
|
6285
6377
|
}
|
|
6286
6378
|
return false;
|
|
@@ -6301,13 +6393,13 @@ import { useEffect as useEffect5 } from "react";
|
|
|
6301
6393
|
import { ReactEditor as ReactEditor10, useSlateStatic as useSlateStatic12 } from "slate-react";
|
|
6302
6394
|
|
|
6303
6395
|
// src/list-plugin/render-element/styles.ts
|
|
6304
|
-
import
|
|
6305
|
-
var $ListItem =
|
|
6396
|
+
import styled29 from "@emotion/styled";
|
|
6397
|
+
var $ListItem = styled29("li")`
|
|
6306
6398
|
margin-top: 0.5em;
|
|
6307
6399
|
margin-bottom: 0.5em;
|
|
6308
6400
|
list-style-position: outside;
|
|
6309
6401
|
`;
|
|
6310
|
-
var $UnorderedListItem =
|
|
6402
|
+
var $UnorderedListItem = styled29($ListItem)`
|
|
6311
6403
|
position: relative;
|
|
6312
6404
|
list-style-type: none;
|
|
6313
6405
|
.--list-item-icon {
|
|
@@ -6318,7 +6410,7 @@ var $UnorderedListItem = styled28($ListItem)`
|
|
|
6318
6410
|
color: var(--shade-600);
|
|
6319
6411
|
}
|
|
6320
6412
|
`;
|
|
6321
|
-
var $OrderedListItem =
|
|
6413
|
+
var $OrderedListItem = styled29($ListItem)`
|
|
6322
6414
|
position: relative;
|
|
6323
6415
|
list-style-type: none;
|
|
6324
6416
|
counter-increment: var(--list-item-var);
|
|
@@ -6344,7 +6436,7 @@ var $OrderedListItem = styled28($ListItem)`
|
|
|
6344
6436
|
font-variant-numeric: tabular-nums;
|
|
6345
6437
|
}
|
|
6346
6438
|
`;
|
|
6347
|
-
var $TaskListItem =
|
|
6439
|
+
var $TaskListItem = styled29($ListItem)`
|
|
6348
6440
|
position: relative;
|
|
6349
6441
|
list-style-type: none;
|
|
6350
6442
|
.--list-item-icon {
|
|
@@ -6361,7 +6453,7 @@ var $TaskListItem = styled28($ListItem)`
|
|
|
6361
6453
|
`;
|
|
6362
6454
|
|
|
6363
6455
|
// src/list-plugin/render-element/ordered-list-item.tsx
|
|
6364
|
-
import { jsx as
|
|
6456
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
6365
6457
|
function OrderedListItem({
|
|
6366
6458
|
element,
|
|
6367
6459
|
attributes,
|
|
@@ -6377,7 +6469,7 @@ function OrderedListItem({
|
|
|
6377
6469
|
"--list-item-var": `list-item-depth-${element.depth}`
|
|
6378
6470
|
};
|
|
6379
6471
|
const className = clsx6({ "--first-at-depth": element.__firstAtDepth });
|
|
6380
|
-
return /* @__PURE__ */
|
|
6472
|
+
return /* @__PURE__ */ jsx41($OrderedListItem, { ...attributes, className, style, children });
|
|
6381
6473
|
}
|
|
6382
6474
|
|
|
6383
6475
|
// src/list-plugin/render-element/task-list-item.tsx
|
|
@@ -6385,8 +6477,8 @@ import { useCallback as useCallback10 } from "react";
|
|
|
6385
6477
|
import { useSlateStatic as useSlateStatic13 } from "slate-react";
|
|
6386
6478
|
|
|
6387
6479
|
// src/list-plugin/render-element/list-icons.tsx
|
|
6388
|
-
import { jsx as
|
|
6389
|
-
var UncheckedIcon = (props) => /* @__PURE__ */
|
|
6480
|
+
import { jsx as jsx42, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6481
|
+
var UncheckedIcon = (props) => /* @__PURE__ */ jsxs20(
|
|
6390
6482
|
"svg",
|
|
6391
6483
|
{
|
|
6392
6484
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6400,12 +6492,12 @@ var UncheckedIcon = (props) => /* @__PURE__ */ jsxs19(
|
|
|
6400
6492
|
viewBox: "0 0 24 24",
|
|
6401
6493
|
...props,
|
|
6402
6494
|
children: [
|
|
6403
|
-
/* @__PURE__ */
|
|
6404
|
-
/* @__PURE__ */
|
|
6495
|
+
/* @__PURE__ */ jsx42("path", { d: "M0 0h24v24H0z", stroke: "none" }),
|
|
6496
|
+
/* @__PURE__ */ jsx42("rect", { x: 4, y: 4, width: 16, height: 16, rx: 2 })
|
|
6405
6497
|
]
|
|
6406
6498
|
}
|
|
6407
6499
|
);
|
|
6408
|
-
var CheckedIcon = (props) => /* @__PURE__ */
|
|
6500
|
+
var CheckedIcon = (props) => /* @__PURE__ */ jsxs20(
|
|
6409
6501
|
"svg",
|
|
6410
6502
|
{
|
|
6411
6503
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6420,13 +6512,13 @@ var CheckedIcon = (props) => /* @__PURE__ */ jsxs19(
|
|
|
6420
6512
|
viewBox: "0 0 24 24",
|
|
6421
6513
|
...props,
|
|
6422
6514
|
children: [
|
|
6423
|
-
/* @__PURE__ */
|
|
6424
|
-
/* @__PURE__ */
|
|
6425
|
-
/* @__PURE__ */
|
|
6515
|
+
/* @__PURE__ */ jsx42("path", { d: "M0 0h24v24H0z", stroke: "none" }),
|
|
6516
|
+
/* @__PURE__ */ jsx42("path", { d: "m9 11 3 3 8-8", className: "--checkmark" }),
|
|
6517
|
+
/* @__PURE__ */ jsx42("path", { d: "M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9" })
|
|
6426
6518
|
]
|
|
6427
6519
|
}
|
|
6428
6520
|
);
|
|
6429
|
-
var BulletIcon = (props) => /* @__PURE__ */
|
|
6521
|
+
var BulletIcon = (props) => /* @__PURE__ */ jsx42(
|
|
6430
6522
|
"svg",
|
|
6431
6523
|
{
|
|
6432
6524
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6435,12 +6527,12 @@ var BulletIcon = (props) => /* @__PURE__ */ jsx40(
|
|
|
6435
6527
|
width: "1em",
|
|
6436
6528
|
height: "1em",
|
|
6437
6529
|
...props,
|
|
6438
|
-
children: /* @__PURE__ */
|
|
6530
|
+
children: /* @__PURE__ */ jsx42("path", { d: "M12 8.25a3.75 3.75 0 1 0 0 7.5 3.75 3.75 0 0 0 0-7.5z" })
|
|
6439
6531
|
}
|
|
6440
6532
|
);
|
|
6441
6533
|
|
|
6442
6534
|
// src/list-plugin/render-element/task-list-item.tsx
|
|
6443
|
-
import { jsx as
|
|
6535
|
+
import { jsx as jsx43, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6444
6536
|
function TaskListItem({
|
|
6445
6537
|
element,
|
|
6446
6538
|
attributes,
|
|
@@ -6451,28 +6543,28 @@ function TaskListItem({
|
|
|
6451
6543
|
editor.list.toggleTaskListItem({ at: element });
|
|
6452
6544
|
}, [editor, element]);
|
|
6453
6545
|
const marginLeft = `${2 + element.depth * 2}em`;
|
|
6454
|
-
return /* @__PURE__ */
|
|
6455
|
-
/* @__PURE__ */
|
|
6546
|
+
return /* @__PURE__ */ jsxs21($TaskListItem, { ...attributes, style: { marginLeft }, children: [
|
|
6547
|
+
/* @__PURE__ */ jsx43("div", { className: "--list-item-icon", contentEditable: false, children: element.checked ? /* @__PURE__ */ jsx43(CheckedIcon, { onClick: toggle, style: { cursor: "pointer" } }) : /* @__PURE__ */ jsx43(UncheckedIcon, { onClick: toggle, style: { cursor: "pointer" } }) }),
|
|
6456
6548
|
children
|
|
6457
6549
|
] });
|
|
6458
6550
|
}
|
|
6459
6551
|
|
|
6460
6552
|
// src/list-plugin/render-element/unordered-list-item.tsx
|
|
6461
|
-
import { jsx as
|
|
6553
|
+
import { jsx as jsx44, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6462
6554
|
function UnorderedListItem({
|
|
6463
6555
|
element,
|
|
6464
6556
|
attributes,
|
|
6465
6557
|
children
|
|
6466
6558
|
}) {
|
|
6467
6559
|
const marginLeft = `${2 + element.depth * 2}em`;
|
|
6468
|
-
return /* @__PURE__ */
|
|
6469
|
-
/* @__PURE__ */
|
|
6560
|
+
return /* @__PURE__ */ jsxs22($UnorderedListItem, { ...attributes, style: { marginLeft }, children: [
|
|
6561
|
+
/* @__PURE__ */ jsx44("div", { className: "--list-item-icon", contentEditable: false, children: /* @__PURE__ */ jsx44(BulletIcon, {}) }),
|
|
6470
6562
|
children
|
|
6471
6563
|
] });
|
|
6472
6564
|
}
|
|
6473
6565
|
|
|
6474
6566
|
// src/list-plugin/render-element/index.tsx
|
|
6475
|
-
import { jsx as
|
|
6567
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
6476
6568
|
function renderElement3({
|
|
6477
6569
|
element,
|
|
6478
6570
|
attributes,
|
|
@@ -6480,11 +6572,11 @@ function renderElement3({
|
|
|
6480
6572
|
}) {
|
|
6481
6573
|
switch (element.type) {
|
|
6482
6574
|
case "ordered-list-item":
|
|
6483
|
-
return /* @__PURE__ */
|
|
6575
|
+
return /* @__PURE__ */ jsx45(OrderedListItem, { element, attributes, children });
|
|
6484
6576
|
case "unordered-list-item":
|
|
6485
|
-
return /* @__PURE__ */
|
|
6577
|
+
return /* @__PURE__ */ jsx45(UnorderedListItem, { element, attributes, children });
|
|
6486
6578
|
case "task-list-item":
|
|
6487
|
-
return /* @__PURE__ */
|
|
6579
|
+
return /* @__PURE__ */ jsx45(TaskListItem, { element, attributes, children });
|
|
6488
6580
|
}
|
|
6489
6581
|
}
|
|
6490
6582
|
|
|
@@ -6549,7 +6641,7 @@ import { clsx as clsx7 } from "clsx";
|
|
|
6549
6641
|
import { Editor as Editor43, Point as Point3, Range as Range8 } from "slate";
|
|
6550
6642
|
|
|
6551
6643
|
// src/marks-plugin/methods/removeMarks.ts
|
|
6552
|
-
import { Editor as Editor41, Text as Text4, Transforms as
|
|
6644
|
+
import { Editor as Editor41, Text as Text4, Transforms as Transforms30 } from "slate";
|
|
6553
6645
|
function removeMarks(editor, { at = editor.selection } = {}) {
|
|
6554
6646
|
if (at == null)
|
|
6555
6647
|
return;
|
|
@@ -6567,7 +6659,7 @@ function removeMarks(editor, { at = editor.selection } = {}) {
|
|
|
6567
6659
|
setter[key2] = null;
|
|
6568
6660
|
}
|
|
6569
6661
|
}
|
|
6570
|
-
|
|
6662
|
+
Transforms30.setNodes(editor, setter, {
|
|
6571
6663
|
match: (n) => Text4.isText(n),
|
|
6572
6664
|
split: true,
|
|
6573
6665
|
at
|
|
@@ -6619,8 +6711,8 @@ function createMarksMethods(editor) {
|
|
|
6619
6711
|
}
|
|
6620
6712
|
|
|
6621
6713
|
// src/marks-plugin/styles.tsx
|
|
6622
|
-
import
|
|
6623
|
-
var $MarksSpan =
|
|
6714
|
+
import styled30 from "@emotion/styled";
|
|
6715
|
+
var $MarksSpan = styled30("span")`
|
|
6624
6716
|
&.--bold {
|
|
6625
6717
|
font-weight: bold;
|
|
6626
6718
|
}
|
|
@@ -6646,7 +6738,7 @@ var $MarksSpan = styled29("span")`
|
|
|
6646
6738
|
`;
|
|
6647
6739
|
|
|
6648
6740
|
// src/marks-plugin/index.tsx
|
|
6649
|
-
import { jsx as
|
|
6741
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
6650
6742
|
var MarksPlugin = createPlugin((editor) => {
|
|
6651
6743
|
editor.marksPlugin = createMarksMethods(editor);
|
|
6652
6744
|
editor.activeMarks = {};
|
|
@@ -6686,7 +6778,7 @@ var MarksPlugin = createPlugin((editor) => {
|
|
|
6686
6778
|
name: "marks",
|
|
6687
6779
|
editableProps: {
|
|
6688
6780
|
renderLeaf: ({ leaf, children }) => {
|
|
6689
|
-
return /* @__PURE__ */
|
|
6781
|
+
return /* @__PURE__ */ jsx46(
|
|
6690
6782
|
$MarksSpan,
|
|
6691
6783
|
{
|
|
6692
6784
|
className: clsx7({
|
|
@@ -6759,7 +6851,7 @@ var NormalizeAfterDeletePlugin = createPlugin((editor) => {
|
|
|
6759
6851
|
import { Element as Element23 } from "slate";
|
|
6760
6852
|
|
|
6761
6853
|
// src/table-plugin/delete-fragment/index.ts
|
|
6762
|
-
import { Editor as Editor46, Path as Path12, Transforms as
|
|
6854
|
+
import { Editor as Editor46, Path as Path12, Transforms as Transforms32 } from "slate";
|
|
6763
6855
|
|
|
6764
6856
|
// src/table-plugin/delete-fragment/get-reversed-delete-safe-ranges.ts
|
|
6765
6857
|
import { Editor as Editor45, Path as Path11 } from "slate";
|
|
@@ -6814,15 +6906,15 @@ function deleteFragmentWithProtectedTypes(editor, protectedTypes) {
|
|
|
6814
6906
|
);
|
|
6815
6907
|
Editor46.withoutNormalizing(editor, () => {
|
|
6816
6908
|
for (const range of reversedRanges) {
|
|
6817
|
-
|
|
6909
|
+
Transforms32.delete(editor, { at: range });
|
|
6818
6910
|
}
|
|
6819
|
-
|
|
6911
|
+
Transforms32.collapse(editor, { edge: "start" });
|
|
6820
6912
|
});
|
|
6821
6913
|
return true;
|
|
6822
6914
|
}
|
|
6823
6915
|
|
|
6824
6916
|
// src/table-plugin/methods/index.ts
|
|
6825
|
-
import { Transforms as
|
|
6917
|
+
import { Transforms as Transforms41 } from "slate";
|
|
6826
6918
|
|
|
6827
6919
|
// src/table-plugin/methods/get-table-info.ts
|
|
6828
6920
|
function getTableInfo(editor, { at = editor.selection } = {}) {
|
|
@@ -6860,7 +6952,7 @@ function getTableInfo(editor, { at = editor.selection } = {}) {
|
|
|
6860
6952
|
}
|
|
6861
6953
|
|
|
6862
6954
|
// src/table-plugin/methods/insert-column.ts
|
|
6863
|
-
import { Editor as Editor47, Transforms as
|
|
6955
|
+
import { Editor as Editor47, Transforms as Transforms33 } from "slate";
|
|
6864
6956
|
|
|
6865
6957
|
// src/table-plugin/methods/utils.ts
|
|
6866
6958
|
function createCell(index, children = [
|
|
@@ -6886,9 +6978,9 @@ function insertColumn(editor, { offset = 0, at = editor.selection } = {}) {
|
|
|
6886
6978
|
const { columns } = tableElement;
|
|
6887
6979
|
const nextColumns = [...columns];
|
|
6888
6980
|
nextColumns.splice(nextCellIndex, 0, columns[nextCellIndex]);
|
|
6889
|
-
|
|
6981
|
+
Transforms33.setNodes(editor, { columns: nextColumns }, { at: tablePath });
|
|
6890
6982
|
tableElement.children.forEach((rowElement, i) => {
|
|
6891
|
-
|
|
6983
|
+
Transforms33.insertNodes(editor, createCell(nextCellIndex), {
|
|
6892
6984
|
at: [...tablePath, i, nextCellIndex]
|
|
6893
6985
|
});
|
|
6894
6986
|
});
|
|
@@ -6897,7 +6989,7 @@ function insertColumn(editor, { offset = 0, at = editor.selection } = {}) {
|
|
|
6897
6989
|
}
|
|
6898
6990
|
|
|
6899
6991
|
// src/table-plugin/methods/insert-row.ts
|
|
6900
|
-
import { Transforms as
|
|
6992
|
+
import { Transforms as Transforms34 } from "slate";
|
|
6901
6993
|
function createRow(columnCount) {
|
|
6902
6994
|
return {
|
|
6903
6995
|
type: "table-row",
|
|
@@ -6909,7 +7001,7 @@ function insertRow(editor, { at = editor.selection, offset = 0 } = {}) {
|
|
|
6909
7001
|
if (!t2)
|
|
6910
7002
|
return false;
|
|
6911
7003
|
const nextRowElement = createRow(t2.tableElement.columns.length);
|
|
6912
|
-
|
|
7004
|
+
Transforms34.insertNodes(editor, nextRowElement, {
|
|
6913
7005
|
at: [...t2.tablePath, t2.rowIndex + offset]
|
|
6914
7006
|
});
|
|
6915
7007
|
return true;
|
|
@@ -6919,7 +7011,7 @@ function insertRowBelow(editor, { at } = {}) {
|
|
|
6919
7011
|
}
|
|
6920
7012
|
|
|
6921
7013
|
// src/table-plugin/methods/insert-table.ts
|
|
6922
|
-
import { Editor as Editor49, Element as Element22, Path as Path13, Transforms as
|
|
7014
|
+
import { Editor as Editor49, Element as Element22, Path as Path13, Transforms as Transforms35 } from "slate";
|
|
6923
7015
|
function createRange(size) {
|
|
6924
7016
|
return [...Array(size).keys()];
|
|
6925
7017
|
}
|
|
@@ -6953,17 +7045,17 @@ function insertRootElement2(editor, element, { at = editor.selection } = {}) {
|
|
|
6953
7045
|
if (entry == null) {
|
|
6954
7046
|
const selection = editor.selection;
|
|
6955
7047
|
Editor49.withoutNormalizing(editor, () => {
|
|
6956
|
-
|
|
7048
|
+
Transforms35.insertNodes(editor, element, { at });
|
|
6957
7049
|
if (selection) {
|
|
6958
|
-
|
|
6959
|
-
|
|
7050
|
+
Transforms35.select(editor, selection);
|
|
7051
|
+
Transforms35.move(editor);
|
|
6960
7052
|
}
|
|
6961
7053
|
});
|
|
6962
7054
|
} else {
|
|
6963
7055
|
const nextPath = Path13.next(entry[1]);
|
|
6964
7056
|
Editor49.withoutNormalizing(editor, () => {
|
|
6965
|
-
|
|
6966
|
-
|
|
7057
|
+
Transforms35.insertNodes(editor, element, { at: nextPath });
|
|
7058
|
+
Transforms35.select(editor, Editor49.start(editor, nextPath));
|
|
6967
7059
|
});
|
|
6968
7060
|
}
|
|
6969
7061
|
return true;
|
|
@@ -7043,15 +7135,15 @@ function up(editor) {
|
|
|
7043
7135
|
}
|
|
7044
7136
|
|
|
7045
7137
|
// src/table-plugin/methods/remove-column.ts
|
|
7046
|
-
import { Editor as Editor52, Transforms as
|
|
7138
|
+
import { Editor as Editor52, Transforms as Transforms37 } from "slate";
|
|
7047
7139
|
|
|
7048
7140
|
// src/table-plugin/methods/remove-table.ts
|
|
7049
|
-
import { Transforms as
|
|
7141
|
+
import { Transforms as Transforms36 } from "slate";
|
|
7050
7142
|
function removeTable(editor) {
|
|
7051
7143
|
const t2 = editor.tablePlugin.getTableInfo();
|
|
7052
7144
|
if (t2 === void 0)
|
|
7053
7145
|
return false;
|
|
7054
|
-
|
|
7146
|
+
Transforms36.removeNodes(editor, { at: t2.tablePath });
|
|
7055
7147
|
return true;
|
|
7056
7148
|
}
|
|
7057
7149
|
|
|
@@ -7067,9 +7159,9 @@ function removeColumn(editor, { at = editor.selection } = {}) {
|
|
|
7067
7159
|
Editor52.withoutNormalizing(editor, () => {
|
|
7068
7160
|
const columns = [...tableElement.columns];
|
|
7069
7161
|
columns.splice(cellIndex, 1);
|
|
7070
|
-
|
|
7162
|
+
Transforms37.setNodes(editor, { columns }, { at: tablePath });
|
|
7071
7163
|
tableElement.children.forEach((rowElement, rowIndex2) => {
|
|
7072
|
-
|
|
7164
|
+
Transforms37.removeNodes(editor, {
|
|
7073
7165
|
at: [...tablePath, rowIndex2, cellIndex]
|
|
7074
7166
|
});
|
|
7075
7167
|
});
|
|
@@ -7078,12 +7170,12 @@ function removeColumn(editor, { at = editor.selection } = {}) {
|
|
|
7078
7170
|
rowIndex,
|
|
7079
7171
|
Math.min(cellIndex, cellCount - 2)
|
|
7080
7172
|
]);
|
|
7081
|
-
|
|
7173
|
+
Transforms37.select(editor, selection);
|
|
7082
7174
|
});
|
|
7083
7175
|
}
|
|
7084
7176
|
|
|
7085
7177
|
// src/table-plugin/methods/remove-row.ts
|
|
7086
|
-
import { Editor as Editor53, Transforms as
|
|
7178
|
+
import { Editor as Editor53, Transforms as Transforms38 } from "slate";
|
|
7087
7179
|
function removeRow(editor, { at = editor.selection } = {}) {
|
|
7088
7180
|
const t2 = getTableInfo(editor, { at });
|
|
7089
7181
|
if (t2 === void 0)
|
|
@@ -7093,8 +7185,8 @@ function removeRow(editor, { at = editor.selection } = {}) {
|
|
|
7093
7185
|
return true;
|
|
7094
7186
|
}
|
|
7095
7187
|
Editor53.withoutNormalizing(editor, () => {
|
|
7096
|
-
|
|
7097
|
-
|
|
7188
|
+
Transforms38.removeNodes(editor, { at: t2.rowPath });
|
|
7189
|
+
Transforms38.select(
|
|
7098
7190
|
editor,
|
|
7099
7191
|
Editor53.start(editor, [
|
|
7100
7192
|
...t2.tablePath,
|
|
@@ -7107,7 +7199,7 @@ function removeRow(editor, { at = editor.selection } = {}) {
|
|
|
7107
7199
|
}
|
|
7108
7200
|
|
|
7109
7201
|
// src/table-plugin/methods/setTableColumnAlign.ts
|
|
7110
|
-
import { Transforms as
|
|
7202
|
+
import { Transforms as Transforms39 } from "slate";
|
|
7111
7203
|
function setTableColumnAlign(editor, options) {
|
|
7112
7204
|
const t2 = getTableInfo(editor);
|
|
7113
7205
|
if (t2 === void 0)
|
|
@@ -7115,12 +7207,12 @@ function setTableColumnAlign(editor, options) {
|
|
|
7115
7207
|
const { tableElement, tablePath, cellIndex } = t2;
|
|
7116
7208
|
const nextColumns = tableElement.columns.slice();
|
|
7117
7209
|
nextColumns.splice(cellIndex, 1, { align: options.align });
|
|
7118
|
-
|
|
7210
|
+
Transforms39.setNodes(editor, { columns: nextColumns }, { at: tablePath });
|
|
7119
7211
|
return true;
|
|
7120
7212
|
}
|
|
7121
7213
|
|
|
7122
7214
|
// src/table-plugin/methods/tab.ts
|
|
7123
|
-
import { Path as Path15, Transforms as
|
|
7215
|
+
import { Path as Path15, Transforms as Transforms40 } from "slate";
|
|
7124
7216
|
function tabForward(editor) {
|
|
7125
7217
|
const t2 = getTableInfo(editor);
|
|
7126
7218
|
if (!t2)
|
|
@@ -7135,7 +7227,7 @@ function tabForward(editor) {
|
|
|
7135
7227
|
return true;
|
|
7136
7228
|
}
|
|
7137
7229
|
const nextPath = Path15.next(tablePath);
|
|
7138
|
-
|
|
7230
|
+
Transforms40.insertNodes(
|
|
7139
7231
|
editor,
|
|
7140
7232
|
{ type: "paragraph", children: [{ text: "" }] },
|
|
7141
7233
|
{ at: nextPath }
|
|
@@ -7199,12 +7291,12 @@ function selectCell(editor, { at = editor.selection } = {}) {
|
|
|
7199
7291
|
if (t2 === void 0)
|
|
7200
7292
|
return false;
|
|
7201
7293
|
const { cellPath } = t2;
|
|
7202
|
-
|
|
7294
|
+
Transforms41.select(editor, cellPath);
|
|
7203
7295
|
return true;
|
|
7204
7296
|
}
|
|
7205
7297
|
|
|
7206
7298
|
// src/table-plugin/normalize/normalize-table.ts
|
|
7207
|
-
import { Transforms as
|
|
7299
|
+
import { Transforms as Transforms42 } from "slate";
|
|
7208
7300
|
function normalizeTableIndexes(editor, entry) {
|
|
7209
7301
|
let isTransformed = false;
|
|
7210
7302
|
const rowElements = entry[0].children;
|
|
@@ -7212,7 +7304,7 @@ function normalizeTableIndexes(editor, entry) {
|
|
|
7212
7304
|
const cellElements = rowElement.children;
|
|
7213
7305
|
cellElements.forEach((cellElement, x) => {
|
|
7214
7306
|
if (cellElement.x !== x || cellElement.y !== y) {
|
|
7215
|
-
|
|
7307
|
+
Transforms42.setNodes(editor, { x, y }, { at: [...entry[1], y, x] });
|
|
7216
7308
|
isTransformed = true;
|
|
7217
7309
|
}
|
|
7218
7310
|
});
|
|
@@ -7221,14 +7313,14 @@ function normalizeTableIndexes(editor, entry) {
|
|
|
7221
7313
|
}
|
|
7222
7314
|
|
|
7223
7315
|
// src/table-plugin/normalize/normalize-table-cell.ts
|
|
7224
|
-
import { Editor as Editor58, Transforms as
|
|
7316
|
+
import { Editor as Editor58, Transforms as Transforms43 } from "slate";
|
|
7225
7317
|
function normalizeTableCell(editor, entry) {
|
|
7226
7318
|
const [node, path] = entry;
|
|
7227
7319
|
if (node.children.length === 1 && node.children[0].type === "table-content") {
|
|
7228
7320
|
return false;
|
|
7229
7321
|
}
|
|
7230
7322
|
Editor58.withoutNormalizing(editor, () => {
|
|
7231
|
-
|
|
7323
|
+
Transforms43.insertNodes(
|
|
7232
7324
|
editor,
|
|
7233
7325
|
{
|
|
7234
7326
|
type: "table-content",
|
|
@@ -7237,9 +7329,9 @@ function normalizeTableCell(editor, entry) {
|
|
|
7237
7329
|
{ at: [...entry[1], 0] }
|
|
7238
7330
|
);
|
|
7239
7331
|
for (let i = node.children.length; i >= 0; i--) {
|
|
7240
|
-
|
|
7332
|
+
Transforms43.mergeNodes(editor, { at: [...path, i] });
|
|
7241
7333
|
}
|
|
7242
|
-
|
|
7334
|
+
Transforms43.delete(editor, {
|
|
7243
7335
|
at: { path: [...path, 0, 0], offset: 0 },
|
|
7244
7336
|
unit: "character"
|
|
7245
7337
|
});
|
|
@@ -7252,11 +7344,11 @@ import { useEffect as useEffect6 } from "react";
|
|
|
7252
7344
|
import { ReactEditor as ReactEditor12, useSelected as useSelected7, useSlateStatic as useSlateStatic14 } from "slate-react";
|
|
7253
7345
|
|
|
7254
7346
|
// src/table-plugin/render-element/styles/index.ts
|
|
7255
|
-
import
|
|
7347
|
+
import styled32 from "@emotion/styled";
|
|
7256
7348
|
|
|
7257
7349
|
// src/table-plugin/render-element/styles/table-menu-styles.ts
|
|
7258
|
-
import
|
|
7259
|
-
var $BaseMenu =
|
|
7350
|
+
import styled31 from "@emotion/styled";
|
|
7351
|
+
var $BaseMenu = styled31("div")`
|
|
7260
7352
|
position: absolute;
|
|
7261
7353
|
/**
|
|
7262
7354
|
* very slightly shaded
|
|
@@ -7281,7 +7373,7 @@ var $BaseMenu = styled30("div")`
|
|
|
7281
7373
|
}
|
|
7282
7374
|
}
|
|
7283
7375
|
`;
|
|
7284
|
-
var $ColumnMenu =
|
|
7376
|
+
var $ColumnMenu = styled31($BaseMenu)`
|
|
7285
7377
|
cursor: pointer;
|
|
7286
7378
|
/**
|
|
7287
7379
|
* hangs out on top
|
|
@@ -7292,7 +7384,7 @@ var $ColumnMenu = styled30($BaseMenu)`
|
|
|
7292
7384
|
height: 3em;
|
|
7293
7385
|
top: -3em;
|
|
7294
7386
|
`;
|
|
7295
|
-
var $RowMenu =
|
|
7387
|
+
var $RowMenu = styled31($BaseMenu)`
|
|
7296
7388
|
/**
|
|
7297
7389
|
* hangs out on left
|
|
7298
7390
|
*/
|
|
@@ -7301,7 +7393,7 @@ var $RowMenu = styled30($BaseMenu)`
|
|
|
7301
7393
|
width: 3em;
|
|
7302
7394
|
left: -3em;
|
|
7303
7395
|
`;
|
|
7304
|
-
var $MenuTile =
|
|
7396
|
+
var $MenuTile = styled31("div")`
|
|
7305
7397
|
position: absolute;
|
|
7306
7398
|
background: rgba(0, 0, 0, 0.05);
|
|
7307
7399
|
border: 1px solid rgba(0, 0, 0, 0.05);
|
|
@@ -7314,7 +7406,7 @@ var $MenuTile = styled30("div")`
|
|
|
7314
7406
|
right: 0;
|
|
7315
7407
|
bottom: 0;
|
|
7316
7408
|
`;
|
|
7317
|
-
var $ColumnMenuTile =
|
|
7409
|
+
var $ColumnMenuTile = styled31($MenuTile)`
|
|
7318
7410
|
top: 50%;
|
|
7319
7411
|
border-bottom: none;
|
|
7320
7412
|
border-right: none;
|
|
@@ -7341,7 +7433,7 @@ var $ColumnMenuTile = styled30($MenuTile)`
|
|
|
7341
7433
|
/* border-top-left-radius: 0.5em;
|
|
7342
7434
|
border-top-right-radius: 0.5em; */
|
|
7343
7435
|
`;
|
|
7344
|
-
var $RowMenuTile =
|
|
7436
|
+
var $RowMenuTile = styled31($MenuTile)`
|
|
7345
7437
|
left: 50%;
|
|
7346
7438
|
border-right: none;
|
|
7347
7439
|
border-bottom: none;
|
|
@@ -7368,7 +7460,7 @@ var $RowMenuTile = styled30($MenuTile)`
|
|
|
7368
7460
|
/* border-top-left-radius: 0.5em;
|
|
7369
7461
|
border-bottom-left-radius: 0.5em; */
|
|
7370
7462
|
`;
|
|
7371
|
-
var $MenuButton =
|
|
7463
|
+
var $MenuButton = styled31("div")`
|
|
7372
7464
|
position: absolute;
|
|
7373
7465
|
font-size: 1.5em;
|
|
7374
7466
|
background: white;
|
|
@@ -7378,13 +7470,13 @@ var $MenuButton = styled30("div")`
|
|
|
7378
7470
|
display: block;
|
|
7379
7471
|
}
|
|
7380
7472
|
`;
|
|
7381
|
-
var $AddMenuButton =
|
|
7473
|
+
var $AddMenuButton = styled31($MenuButton)`
|
|
7382
7474
|
color: #c0c0c0;
|
|
7383
7475
|
&:hover {
|
|
7384
7476
|
color: royalblue;
|
|
7385
7477
|
}
|
|
7386
7478
|
`;
|
|
7387
|
-
var $RemoveMenuButton =
|
|
7479
|
+
var $RemoveMenuButton = styled31($MenuButton)`
|
|
7388
7480
|
color: #c0c0c0;
|
|
7389
7481
|
&:hover {
|
|
7390
7482
|
color: firebrick;
|
|
@@ -7392,20 +7484,20 @@ var $RemoveMenuButton = styled30($MenuButton)`
|
|
|
7392
7484
|
`;
|
|
7393
7485
|
|
|
7394
7486
|
// src/table-plugin/render-element/styles/index.ts
|
|
7395
|
-
var $Table =
|
|
7487
|
+
var $Table = styled32("table")`
|
|
7396
7488
|
border-collapse: collapse;
|
|
7397
7489
|
margin: 1em 0;
|
|
7398
7490
|
${({ columns }) => columns.map(
|
|
7399
7491
|
(column, index) => `td:nth-of-type(${index + 1}) { text-align: ${column.align}; }`
|
|
7400
7492
|
).join("\n")}
|
|
7401
7493
|
`;
|
|
7402
|
-
var $TableRow =
|
|
7494
|
+
var $TableRow = styled32("tr")`
|
|
7403
7495
|
position: relative;
|
|
7404
7496
|
&:first-of-type {
|
|
7405
7497
|
background: var(--table-head-bgcolor);
|
|
7406
7498
|
}
|
|
7407
7499
|
`;
|
|
7408
|
-
var $TableCell =
|
|
7500
|
+
var $TableCell = styled32("td")`
|
|
7409
7501
|
position: relative;
|
|
7410
7502
|
border-width: 1px;
|
|
7411
7503
|
border-style: solid;
|
|
@@ -7426,7 +7518,7 @@ var $TableCell = styled31("td")`
|
|
|
7426
7518
|
border-right-color: var(--table-border-color);
|
|
7427
7519
|
}
|
|
7428
7520
|
`;
|
|
7429
|
-
var $TableContent =
|
|
7521
|
+
var $TableContent = styled32("div")`
|
|
7430
7522
|
/**
|
|
7431
7523
|
* Smaller font inside a table than outside of it
|
|
7432
7524
|
*/
|
|
@@ -7447,7 +7539,7 @@ var TableContext = createContext2({
|
|
|
7447
7539
|
});
|
|
7448
7540
|
|
|
7449
7541
|
// src/table-plugin/render-element/table.tsx
|
|
7450
|
-
import { jsx as
|
|
7542
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
7451
7543
|
function Table({
|
|
7452
7544
|
element,
|
|
7453
7545
|
attributes,
|
|
@@ -7459,7 +7551,7 @@ function Table({
|
|
|
7459
7551
|
const path = ReactEditor12.findPath(editor, element);
|
|
7460
7552
|
normalizeTableIndexes(editor, [element, path]);
|
|
7461
7553
|
}, []);
|
|
7462
|
-
return /* @__PURE__ */
|
|
7554
|
+
return /* @__PURE__ */ jsx47(TableContext.Provider, { value: { isSelected }, children: /* @__PURE__ */ jsx47($Table, { ...attributes, columns: element.columns, children: /* @__PURE__ */ jsx47("tbody", { children }) }) });
|
|
7463
7555
|
}
|
|
7464
7556
|
|
|
7465
7557
|
// src/table-plugin/render-element/table-cell/index.tsx
|
|
@@ -7471,8 +7563,8 @@ import { useCallback as useCallback11, useRef as useRef5, useState as useState6
|
|
|
7471
7563
|
import { useSlateStatic as useSlateStatic15 } from "slate-react";
|
|
7472
7564
|
|
|
7473
7565
|
// src/table-plugin/icons.tsx
|
|
7474
|
-
import { jsx as
|
|
7475
|
-
var PlusIcon = (props) => /* @__PURE__ */
|
|
7566
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
7567
|
+
var PlusIcon = (props) => /* @__PURE__ */ jsx48(
|
|
7476
7568
|
"svg",
|
|
7477
7569
|
{
|
|
7478
7570
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7481,7 +7573,7 @@ var PlusIcon = (props) => /* @__PURE__ */ jsx46(
|
|
|
7481
7573
|
width: "1em",
|
|
7482
7574
|
height: "1em",
|
|
7483
7575
|
...props,
|
|
7484
|
-
children: /* @__PURE__ */
|
|
7576
|
+
children: /* @__PURE__ */ jsx48(
|
|
7485
7577
|
"path",
|
|
7486
7578
|
{
|
|
7487
7579
|
fillRule: "evenodd",
|
|
@@ -7491,7 +7583,7 @@ var PlusIcon = (props) => /* @__PURE__ */ jsx46(
|
|
|
7491
7583
|
)
|
|
7492
7584
|
}
|
|
7493
7585
|
);
|
|
7494
|
-
var MinusIcon = (props) => /* @__PURE__ */
|
|
7586
|
+
var MinusIcon = (props) => /* @__PURE__ */ jsx48(
|
|
7495
7587
|
"svg",
|
|
7496
7588
|
{
|
|
7497
7589
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7500,7 +7592,7 @@ var MinusIcon = (props) => /* @__PURE__ */ jsx46(
|
|
|
7500
7592
|
width: "1em",
|
|
7501
7593
|
height: "1em",
|
|
7502
7594
|
...props,
|
|
7503
|
-
children: /* @__PURE__ */
|
|
7595
|
+
children: /* @__PURE__ */ jsx48(
|
|
7504
7596
|
"path",
|
|
7505
7597
|
{
|
|
7506
7598
|
fillRule: "evenodd",
|
|
@@ -7510,13 +7602,13 @@ var MinusIcon = (props) => /* @__PURE__ */ jsx46(
|
|
|
7510
7602
|
)
|
|
7511
7603
|
}
|
|
7512
7604
|
);
|
|
7513
|
-
var BarsIcon = () => /* @__PURE__ */
|
|
7514
|
-
var AlignLeft = () => /* @__PURE__ */
|
|
7515
|
-
var AlignCenter = () => /* @__PURE__ */
|
|
7516
|
-
var AlignRight = () => /* @__PURE__ */
|
|
7605
|
+
var BarsIcon = () => /* @__PURE__ */ jsx48(TablerIcon, { children: /* @__PURE__ */ jsx48("path", { d: "M4 6h16M4 12h16M4 18h16" }) });
|
|
7606
|
+
var AlignLeft = () => /* @__PURE__ */ jsx48(TablerIcon, { children: /* @__PURE__ */ jsx48("path", { d: "M4 6h16M4 12h10M4 18h14" }) });
|
|
7607
|
+
var AlignCenter = () => /* @__PURE__ */ jsx48(TablerIcon, { children: /* @__PURE__ */ jsx48("path", { d: "M4 6h16M8 12h8M6 18h12" }) });
|
|
7608
|
+
var AlignRight = () => /* @__PURE__ */ jsx48(TablerIcon, { children: /* @__PURE__ */ jsx48("path", { d: "M4 6h16M10 12h10M6 18h14" }) });
|
|
7517
7609
|
|
|
7518
7610
|
// src/table-plugin/render-element/table-cell/column-menu/index.tsx
|
|
7519
|
-
import { Fragment as Fragment4, jsx as
|
|
7611
|
+
import { Fragment as Fragment4, jsx as jsx49, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7520
7612
|
function ColumnMenu({ cellElement }) {
|
|
7521
7613
|
const editor = useSlateStatic15();
|
|
7522
7614
|
const menu = useLayer("column-menu");
|
|
@@ -7557,9 +7649,9 @@ function ColumnMenu({ cellElement }) {
|
|
|
7557
7649
|
}
|
|
7558
7650
|
}
|
|
7559
7651
|
];
|
|
7560
|
-
menu.open(() => /* @__PURE__ */
|
|
7652
|
+
menu.open(() => /* @__PURE__ */ jsx49(Menu, { dest, items, close: menu.close }));
|
|
7561
7653
|
}, []);
|
|
7562
|
-
return /* @__PURE__ */
|
|
7654
|
+
return /* @__PURE__ */ jsxs23(
|
|
7563
7655
|
$ColumnMenu,
|
|
7564
7656
|
{
|
|
7565
7657
|
ref: buttonRef,
|
|
@@ -7568,9 +7660,9 @@ function ColumnMenu({ cellElement }) {
|
|
|
7568
7660
|
onMouseEnter,
|
|
7569
7661
|
onMouseLeave,
|
|
7570
7662
|
children: [
|
|
7571
|
-
/* @__PURE__ */
|
|
7572
|
-
hover ? /* @__PURE__ */
|
|
7573
|
-
/* @__PURE__ */
|
|
7663
|
+
/* @__PURE__ */ jsx49($ColumnMenuTile, { className: "--tile", children: /* @__PURE__ */ jsx49(BarsIcon, {}) }),
|
|
7664
|
+
hover ? /* @__PURE__ */ jsxs23(Fragment4, { children: [
|
|
7665
|
+
/* @__PURE__ */ jsx49(
|
|
7574
7666
|
$RemoveMenuButton,
|
|
7575
7667
|
{
|
|
7576
7668
|
style: {
|
|
@@ -7579,23 +7671,23 @@ function ColumnMenu({ cellElement }) {
|
|
|
7579
7671
|
marginLeft: "-0.5em"
|
|
7580
7672
|
},
|
|
7581
7673
|
onMouseDown: () => editor.tablePlugin.removeColumn({ at: cellElement }),
|
|
7582
|
-
children: /* @__PURE__ */
|
|
7674
|
+
children: /* @__PURE__ */ jsx49(MinusIcon, {})
|
|
7583
7675
|
}
|
|
7584
7676
|
),
|
|
7585
|
-
/* @__PURE__ */
|
|
7677
|
+
/* @__PURE__ */ jsx49(
|
|
7586
7678
|
$AddMenuButton,
|
|
7587
7679
|
{
|
|
7588
7680
|
style: { left: "-0.5em", top: 0 },
|
|
7589
7681
|
onMouseDown: () => editor.tablePlugin.insertColumn({ at: cellElement }),
|
|
7590
|
-
children: /* @__PURE__ */
|
|
7682
|
+
children: /* @__PURE__ */ jsx49(PlusIcon, {})
|
|
7591
7683
|
}
|
|
7592
7684
|
),
|
|
7593
|
-
/* @__PURE__ */
|
|
7685
|
+
/* @__PURE__ */ jsx49(
|
|
7594
7686
|
$AddMenuButton,
|
|
7595
7687
|
{
|
|
7596
7688
|
style: { right: "-0.5em", top: 0 },
|
|
7597
7689
|
onMouseDown: () => editor.tablePlugin.insertColumn({ at: cellElement, offset: 1 }),
|
|
7598
|
-
children: /* @__PURE__ */
|
|
7690
|
+
children: /* @__PURE__ */ jsx49(PlusIcon, {})
|
|
7599
7691
|
}
|
|
7600
7692
|
)
|
|
7601
7693
|
] }) : null
|
|
@@ -7607,20 +7699,20 @@ function ColumnMenu({ cellElement }) {
|
|
|
7607
7699
|
// src/table-plugin/render-element/table-cell/row-menu/index.tsx
|
|
7608
7700
|
import { useState as useState7 } from "react";
|
|
7609
7701
|
import { useSlateStatic as useSlateStatic16 } from "slate-react";
|
|
7610
|
-
import { Fragment as Fragment5, jsx as
|
|
7702
|
+
import { Fragment as Fragment5, jsx as jsx50, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7611
7703
|
function RowMenu({ cellElement }) {
|
|
7612
7704
|
const editor = useSlateStatic16();
|
|
7613
7705
|
const [hover, setHover] = useState7(false);
|
|
7614
|
-
return /* @__PURE__ */
|
|
7706
|
+
return /* @__PURE__ */ jsxs24(
|
|
7615
7707
|
$RowMenu,
|
|
7616
7708
|
{
|
|
7617
7709
|
contentEditable: false,
|
|
7618
7710
|
onMouseEnter: () => setHover(true),
|
|
7619
7711
|
onMouseLeave: () => setHover(false),
|
|
7620
7712
|
children: [
|
|
7621
|
-
/* @__PURE__ */
|
|
7622
|
-
hover ? /* @__PURE__ */
|
|
7623
|
-
/* @__PURE__ */
|
|
7713
|
+
/* @__PURE__ */ jsx50($RowMenuTile, { className: "--tile", children: /* @__PURE__ */ jsx50(BarsIcon, {}) }),
|
|
7714
|
+
hover ? /* @__PURE__ */ jsxs24(Fragment5, { children: [
|
|
7715
|
+
/* @__PURE__ */ jsx50(
|
|
7624
7716
|
$RemoveMenuButton,
|
|
7625
7717
|
{
|
|
7626
7718
|
style: {
|
|
@@ -7629,23 +7721,23 @@ function RowMenu({ cellElement }) {
|
|
|
7629
7721
|
marginTop: "-0.5em"
|
|
7630
7722
|
},
|
|
7631
7723
|
onMouseDown: () => editor.tablePlugin.removeRow({ at: cellElement }),
|
|
7632
|
-
children: /* @__PURE__ */
|
|
7724
|
+
children: /* @__PURE__ */ jsx50(MinusIcon, {})
|
|
7633
7725
|
}
|
|
7634
7726
|
),
|
|
7635
|
-
/* @__PURE__ */
|
|
7727
|
+
/* @__PURE__ */ jsx50(
|
|
7636
7728
|
$AddMenuButton,
|
|
7637
7729
|
{
|
|
7638
7730
|
style: { top: "-0.5em", left: "0.5em" },
|
|
7639
7731
|
onMouseDown: () => editor.tablePlugin.insertRow({ at: cellElement }),
|
|
7640
|
-
children: /* @__PURE__ */
|
|
7732
|
+
children: /* @__PURE__ */ jsx50(PlusIcon, {})
|
|
7641
7733
|
}
|
|
7642
7734
|
),
|
|
7643
|
-
/* @__PURE__ */
|
|
7735
|
+
/* @__PURE__ */ jsx50(
|
|
7644
7736
|
$AddMenuButton,
|
|
7645
7737
|
{
|
|
7646
7738
|
style: { bottom: "-0.5em", left: "0.5em" },
|
|
7647
7739
|
onMouseDown: () => editor.tablePlugin.insertRow({ at: cellElement, offset: 1 }),
|
|
7648
|
-
children: /* @__PURE__ */
|
|
7740
|
+
children: /* @__PURE__ */ jsx50(PlusIcon, {})
|
|
7649
7741
|
}
|
|
7650
7742
|
)
|
|
7651
7743
|
] }) : null
|
|
@@ -7655,8 +7747,8 @@ function RowMenu({ cellElement }) {
|
|
|
7655
7747
|
}
|
|
7656
7748
|
|
|
7657
7749
|
// src/table-plugin/render-element/table-cell/table-menu/$table-menu.tsx
|
|
7658
|
-
import
|
|
7659
|
-
var $TableMenu =
|
|
7750
|
+
import styled33 from "@emotion/styled";
|
|
7751
|
+
var $TableMenu = styled33("div")`
|
|
7660
7752
|
position: absolute;
|
|
7661
7753
|
/**
|
|
7662
7754
|
* very slightly shaded
|
|
@@ -7689,7 +7781,7 @@ var $TableMenu = styled32("div")`
|
|
|
7689
7781
|
}
|
|
7690
7782
|
}
|
|
7691
7783
|
`;
|
|
7692
|
-
var $TableMenuTile =
|
|
7784
|
+
var $TableMenuTile = styled33("div")`
|
|
7693
7785
|
position: absolute;
|
|
7694
7786
|
left: 0;
|
|
7695
7787
|
top: 0;
|
|
@@ -7700,13 +7792,13 @@ var $TableMenuTile = styled32("div")`
|
|
|
7700
7792
|
`;
|
|
7701
7793
|
|
|
7702
7794
|
// src/table-plugin/render-element/table-cell/table-menu/index.tsx
|
|
7703
|
-
import { jsx as
|
|
7795
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
7704
7796
|
function TableMenu() {
|
|
7705
|
-
return /* @__PURE__ */
|
|
7797
|
+
return /* @__PURE__ */ jsx51($TableMenu, { contentEditable: false, children: /* @__PURE__ */ jsx51($TableMenuTile, { className: "--table-menu-tile" }) });
|
|
7706
7798
|
}
|
|
7707
7799
|
|
|
7708
7800
|
// src/table-plugin/render-element/table-cell/index.tsx
|
|
7709
|
-
import { jsx as
|
|
7801
|
+
import { jsx as jsx52, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7710
7802
|
function TableCell({
|
|
7711
7803
|
element,
|
|
7712
7804
|
attributes,
|
|
@@ -7717,7 +7809,7 @@ function TableCell({
|
|
|
7717
7809
|
const showTableMenu = tableContext.isSelected && element.x === 0 && element.y === 0;
|
|
7718
7810
|
const showRowMenu = tableContext.isSelected && element.x === 0;
|
|
7719
7811
|
const showColumnMenu = tableContext.isSelected && element.y === 0;
|
|
7720
|
-
return /* @__PURE__ */
|
|
7812
|
+
return /* @__PURE__ */ jsxs25(
|
|
7721
7813
|
$TableCell,
|
|
7722
7814
|
{
|
|
7723
7815
|
className: selected ? "--selected" : "",
|
|
@@ -7726,34 +7818,34 @@ function TableCell({
|
|
|
7726
7818
|
"data-y": element.y,
|
|
7727
7819
|
children: [
|
|
7728
7820
|
children,
|
|
7729
|
-
showTableMenu ? /* @__PURE__ */
|
|
7730
|
-
showRowMenu ? /* @__PURE__ */
|
|
7731
|
-
showColumnMenu ? /* @__PURE__ */
|
|
7821
|
+
showTableMenu ? /* @__PURE__ */ jsx52(TableMenu, {}) : null,
|
|
7822
|
+
showRowMenu ? /* @__PURE__ */ jsx52(RowMenu, { cellElement: element }) : null,
|
|
7823
|
+
showColumnMenu ? /* @__PURE__ */ jsx52(ColumnMenu, { cellElement: element }) : null
|
|
7732
7824
|
]
|
|
7733
7825
|
}
|
|
7734
7826
|
);
|
|
7735
7827
|
}
|
|
7736
7828
|
|
|
7737
7829
|
// src/table-plugin/render-element/table-content.tsx
|
|
7738
|
-
import { jsx as
|
|
7830
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
7739
7831
|
function TableContent({
|
|
7740
7832
|
attributes,
|
|
7741
7833
|
children
|
|
7742
7834
|
}) {
|
|
7743
|
-
return /* @__PURE__ */
|
|
7835
|
+
return /* @__PURE__ */ jsx53($TableContent, { ...attributes, children });
|
|
7744
7836
|
}
|
|
7745
7837
|
|
|
7746
7838
|
// src/table-plugin/render-element/table-row.tsx
|
|
7747
|
-
import { jsx as
|
|
7839
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
7748
7840
|
function TableRow({
|
|
7749
7841
|
attributes,
|
|
7750
7842
|
children
|
|
7751
7843
|
}) {
|
|
7752
|
-
return /* @__PURE__ */
|
|
7844
|
+
return /* @__PURE__ */ jsx54($TableRow, { ...attributes, children });
|
|
7753
7845
|
}
|
|
7754
7846
|
|
|
7755
7847
|
// src/table-plugin/render-element/index.tsx
|
|
7756
|
-
import { jsx as
|
|
7848
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
7757
7849
|
function renderElement4({
|
|
7758
7850
|
element,
|
|
7759
7851
|
attributes,
|
|
@@ -7761,13 +7853,13 @@ function renderElement4({
|
|
|
7761
7853
|
}) {
|
|
7762
7854
|
switch (element.type) {
|
|
7763
7855
|
case "table":
|
|
7764
|
-
return /* @__PURE__ */
|
|
7856
|
+
return /* @__PURE__ */ jsx55(Table, { element, attributes, children });
|
|
7765
7857
|
case "table-row":
|
|
7766
|
-
return /* @__PURE__ */
|
|
7858
|
+
return /* @__PURE__ */ jsx55(TableRow, { element, attributes, children });
|
|
7767
7859
|
case "table-cell":
|
|
7768
|
-
return /* @__PURE__ */
|
|
7860
|
+
return /* @__PURE__ */ jsx55(TableCell, { element, attributes, children });
|
|
7769
7861
|
case "table-content":
|
|
7770
|
-
return /* @__PURE__ */
|
|
7862
|
+
return /* @__PURE__ */ jsx55(TableContent, { element, attributes, children });
|
|
7771
7863
|
}
|
|
7772
7864
|
}
|
|
7773
7865
|
|
|
@@ -7911,16 +8003,16 @@ var globalStyles = css2`
|
|
|
7911
8003
|
`;
|
|
7912
8004
|
|
|
7913
8005
|
// src/theme-plugin/index.tsx
|
|
7914
|
-
import { Fragment as Fragment6, jsx as
|
|
8006
|
+
import { Fragment as Fragment6, jsx as jsx56, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
7915
8007
|
var ThemePlugin = createPlugin((editor) => {
|
|
7916
8008
|
editor.theme = true;
|
|
7917
8009
|
return {
|
|
7918
8010
|
name: "theme",
|
|
7919
8011
|
editor: {},
|
|
7920
8012
|
renderEditable: ({ attributes, Editable: Editable3 }) => {
|
|
7921
|
-
return /* @__PURE__ */
|
|
7922
|
-
/* @__PURE__ */
|
|
7923
|
-
/* @__PURE__ */
|
|
8013
|
+
return /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
8014
|
+
/* @__PURE__ */ jsx56(Global, { styles: globalStyles }),
|
|
8015
|
+
/* @__PURE__ */ jsx56(Editable3, { ...attributes })
|
|
7924
8016
|
] });
|
|
7925
8017
|
},
|
|
7926
8018
|
editableProps: {}
|
|
@@ -7930,7 +8022,7 @@ var ThemePlugin = createPlugin((editor) => {
|
|
|
7930
8022
|
// src/toolbar-plugin/render-editable/index.tsx
|
|
7931
8023
|
import { clsx as clsx10 } from "clsx";
|
|
7932
8024
|
import { useCallback as useCallback15, useRef as useRef11 } from "react";
|
|
7933
|
-
import { Editor as Editor62, Transforms as
|
|
8025
|
+
import { Editor as Editor62, Transforms as Transforms45 } from "slate";
|
|
7934
8026
|
import { ReactEditor as ReactEditor16, useFocused, useSlateStatic as useSlateStatic22 } from "slate-react";
|
|
7935
8027
|
|
|
7936
8028
|
// src/toolbar-plugin/components/dialog/table-dialog.tsx
|
|
@@ -7939,17 +8031,17 @@ import { useCallback as useCallback12, useRef as useRef6, useState as useState8
|
|
|
7939
8031
|
import { ReactEditor as ReactEditor13, useSlateStatic as useSlateStatic17 } from "slate-react";
|
|
7940
8032
|
|
|
7941
8033
|
// src/toolbar-plugin/styles/table-styles.ts
|
|
7942
|
-
import
|
|
7943
|
-
var $TableDialog =
|
|
8034
|
+
import styled34 from "@emotion/styled";
|
|
8035
|
+
var $TableDialog = styled34($Panel)`
|
|
7944
8036
|
padding: 0.5em;
|
|
7945
8037
|
`;
|
|
7946
|
-
var $TableDialogGrid =
|
|
8038
|
+
var $TableDialogGrid = styled34("div")`
|
|
7947
8039
|
display: grid;
|
|
7948
8040
|
grid-template-columns: repeat(5, 1.75em);
|
|
7949
8041
|
grid-template-rows: 1.5em;
|
|
7950
8042
|
/* grid-gap: 1px; */
|
|
7951
8043
|
`;
|
|
7952
|
-
var $TableDialogGridCell =
|
|
8044
|
+
var $TableDialogGridCell = styled34("div")`
|
|
7953
8045
|
background: var(--shade-100);
|
|
7954
8046
|
height: 1.5em;
|
|
7955
8047
|
border-radius: 0.125em;
|
|
@@ -7962,7 +8054,7 @@ var $TableDialogGridCell = styled33("div")`
|
|
|
7962
8054
|
`;
|
|
7963
8055
|
|
|
7964
8056
|
// src/toolbar-plugin/components/dialog/table-dialog.tsx
|
|
7965
|
-
import { Fragment as Fragment7, jsx as
|
|
8057
|
+
import { Fragment as Fragment7, jsx as jsx57, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7966
8058
|
function createRange2(size) {
|
|
7967
8059
|
return [...Array(size).keys()];
|
|
7968
8060
|
}
|
|
@@ -7992,12 +8084,12 @@ function TableDialog({
|
|
|
7992
8084
|
},
|
|
7993
8085
|
[editor]
|
|
7994
8086
|
);
|
|
7995
|
-
return /* @__PURE__ */
|
|
7996
|
-
/* @__PURE__ */
|
|
7997
|
-
/* @__PURE__ */
|
|
8087
|
+
return /* @__PURE__ */ jsxs27(Fragment7, { children: [
|
|
8088
|
+
/* @__PURE__ */ jsx57(CloseMask, { close }),
|
|
8089
|
+
/* @__PURE__ */ jsx57($TableDialog, { ref, style, children: /* @__PURE__ */ jsx57($TableDialogGrid, { onMouseLeave: () => hoverCell(0, 0), children: rows.map((y) => {
|
|
7998
8090
|
return cols.map((x) => {
|
|
7999
8091
|
const selected = x <= hover.x && y <= hover.y;
|
|
8000
|
-
return /* @__PURE__ */
|
|
8092
|
+
return /* @__PURE__ */ jsx57(
|
|
8001
8093
|
$TableDialogGridCell,
|
|
8002
8094
|
{
|
|
8003
8095
|
className: clsx8({ "--selected": selected }),
|
|
@@ -8017,62 +8109,62 @@ import { useEffect as useEffect8, useRef as useRef10, useState as useState11 } f
|
|
|
8017
8109
|
import { useSlateStatic as useSlateStatic21 } from "slate-react";
|
|
8018
8110
|
|
|
8019
8111
|
// src/toolbar-plugin/icons.tsx
|
|
8020
|
-
import { jsx as
|
|
8021
|
-
var H = () => /* @__PURE__ */
|
|
8022
|
-
var More = () => /* @__PURE__ */
|
|
8023
|
-
var LinkPlus = () => /* @__PURE__ */
|
|
8024
|
-
var H1 = () => /* @__PURE__ */
|
|
8025
|
-
var H2 = () => /* @__PURE__ */
|
|
8026
|
-
var H3 = () => /* @__PURE__ */
|
|
8027
|
-
var Normal = () => /* @__PURE__ */
|
|
8028
|
-
var Bold = () => /* @__PURE__ */
|
|
8029
|
-
var Italic = () => /* @__PURE__ */
|
|
8030
|
-
var Link = () => /* @__PURE__ */
|
|
8031
|
-
/* @__PURE__ */
|
|
8032
|
-
/* @__PURE__ */
|
|
8112
|
+
import { jsx as jsx58, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
8113
|
+
var H = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M7 12h10M7 5v14M17 5v14M15 19h4M15 5h4M5 19h4M5 5h4" }) });
|
|
8114
|
+
var More = () => /* @__PURE__ */ jsx58(TablerIcon, { className: "--more-icon", width: "0.5em", viewBox: "0 0 12 24", children: /* @__PURE__ */ jsx58("path", { d: "m2 12 4 4 4-4" }) });
|
|
8115
|
+
var LinkPlus = () => /* @__PURE__ */ jsx58(TablerIcon, { width: "0.5em", viewBox: "6 0 12 24", children: /* @__PURE__ */ jsx58("path", { d: "M9 12h6M12 9v6" }) });
|
|
8116
|
+
var H1 = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M19 18v-8l-2 2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2" }) });
|
|
8117
|
+
var H2 = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M17 12a2 2 0 1 1 4 0c0 .591-.417 1.318-.816 1.858L17 18.001h4M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2" }) });
|
|
8118
|
+
var H3 = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M19 14a2 2 0 1 0-2-2M17 16a2 2 0 1 0 2-2M4 6v12M12 6v12M11 18h2M3 18h2M4 12h8M3 6h2M11 6h2" }) });
|
|
8119
|
+
var Normal = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M8 18V6h2l6 9V6h2v12h-2l-6-9v9H8z" }) });
|
|
8120
|
+
var Bold = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M7 5h6a3.5 3.5 0 0 1 0 7H7zM13 12h1a3.5 3.5 0 0 1 0 7H7v-7" }) });
|
|
8121
|
+
var Italic = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M11 5h6M7 19h6M14 5l-4 14" }) });
|
|
8122
|
+
var Link = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
|
|
8123
|
+
/* @__PURE__ */ jsx58("path", { d: "M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5" }),
|
|
8124
|
+
/* @__PURE__ */ jsx58("path", { d: "M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5" })
|
|
8033
8125
|
] });
|
|
8034
|
-
var Quote = () => /* @__PURE__ */
|
|
8035
|
-
var DoubleQuote = () => /* @__PURE__ */
|
|
8036
|
-
/* @__PURE__ */
|
|
8037
|
-
/* @__PURE__ */
|
|
8126
|
+
var Quote = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M10 11H6a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5M19 11h-4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v6c0 2.667-1.333 4.333-4 5" }) });
|
|
8127
|
+
var DoubleQuote = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
|
|
8128
|
+
/* @__PURE__ */ jsx58("path", { d: "M10 9l4 3-4 3" }),
|
|
8129
|
+
/* @__PURE__ */ jsx58("path", { d: "M16 9l4 3-4 3" })
|
|
8038
8130
|
] });
|
|
8039
|
-
var BulletList = () => /* @__PURE__ */
|
|
8040
|
-
var Table2 = () => /* @__PURE__ */
|
|
8041
|
-
/* @__PURE__ */
|
|
8042
|
-
/* @__PURE__ */
|
|
8131
|
+
var BulletList = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01" }) });
|
|
8132
|
+
var Table2 = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
|
|
8133
|
+
/* @__PURE__ */ jsx58("rect", { x: 4, y: 4, width: 16, height: 16, rx: 2 }),
|
|
8134
|
+
/* @__PURE__ */ jsx58("path", { d: "M4 10h16M10 4v16" })
|
|
8043
8135
|
] });
|
|
8044
|
-
var Code = () => /* @__PURE__ */
|
|
8045
|
-
var CodeBlock2 = () => /* @__PURE__ */
|
|
8046
|
-
var Image = () => /* @__PURE__ */
|
|
8047
|
-
/* @__PURE__ */
|
|
8048
|
-
/* @__PURE__ */
|
|
8049
|
-
/* @__PURE__ */
|
|
8050
|
-
/* @__PURE__ */
|
|
8136
|
+
var Code = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "m7 8-4 4 4 4M17 8l4 4-4 4M14 4l-4 16" }) });
|
|
8137
|
+
var CodeBlock2 = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M9 8L5 12L9 16M15 8L19 12L15 16" }) });
|
|
8138
|
+
var Image = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
|
|
8139
|
+
/* @__PURE__ */ jsx58("path", { d: "M15 8h.01" }),
|
|
8140
|
+
/* @__PURE__ */ jsx58("rect", { x: 4, y: 4, width: 16, height: 16, rx: 3 }),
|
|
8141
|
+
/* @__PURE__ */ jsx58("path", { d: "m4 15 4-4a3 5 0 0 1 3 0l5 5" }),
|
|
8142
|
+
/* @__PURE__ */ jsx58("path", { d: "m14 14 1-1a3 5 0 0 1 3 0l2 2" })
|
|
8051
8143
|
] });
|
|
8052
|
-
var Plus = () => /* @__PURE__ */
|
|
8053
|
-
var Strikethrough = () => /* @__PURE__ */
|
|
8054
|
-
var Underline = () => /* @__PURE__ */
|
|
8055
|
-
var ListCheck = () => /* @__PURE__ */
|
|
8056
|
-
/* @__PURE__ */
|
|
8057
|
-
/* @__PURE__ */
|
|
8144
|
+
var Plus = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M12 5v14M5 12h14" }) });
|
|
8145
|
+
var Strikethrough = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M5 12h14M16 6.5A4 2 0 0 0 12 5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1-4-1.5" }) });
|
|
8146
|
+
var Underline = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M7 5v5a5 5 0 0 0 10 0V5M5 19h14" }) });
|
|
8147
|
+
var ListCheck = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
|
|
8148
|
+
/* @__PURE__ */ jsx58("path", { d: "m9 11 3 3 8-8" }),
|
|
8149
|
+
/* @__PURE__ */ jsx58("path", { d: "M20 12v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h9" })
|
|
8058
8150
|
] });
|
|
8059
|
-
var ListNumbers = () => /* @__PURE__ */
|
|
8060
|
-
var IncreaseDepth = () => /* @__PURE__ */
|
|
8061
|
-
var DecreaseDepth = () => /* @__PURE__ */
|
|
8062
|
-
var Markdown = () => /* @__PURE__ */
|
|
8063
|
-
/* @__PURE__ */
|
|
8064
|
-
/* @__PURE__ */
|
|
8151
|
+
var ListNumbers = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M11 6h9M11 12h9M12 18h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6" }) });
|
|
8152
|
+
var IncreaseDepth = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M4 6h16M8 12h12M12 18h8M7 12l-3-3M7 12l-3 3" }) });
|
|
8153
|
+
var DecreaseDepth = () => /* @__PURE__ */ jsx58(TablerIcon, { children: /* @__PURE__ */ jsx58("path", { d: "M4 6h16M8 12h12M12 18h8M4 12l3-3M4 12l3 3" }) });
|
|
8154
|
+
var Markdown = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
|
|
8155
|
+
/* @__PURE__ */ jsx58("path", { d: "M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z" }),
|
|
8156
|
+
/* @__PURE__ */ jsx58("path", { d: "M7 15V9l2 2 2-2v6M14 9v6h4M14 13h2" })
|
|
8065
8157
|
] });
|
|
8066
|
-
var VisualEditor = () => /* @__PURE__ */
|
|
8067
|
-
/* @__PURE__ */
|
|
8068
|
-
/* @__PURE__ */
|
|
8069
|
-
/* @__PURE__ */
|
|
8158
|
+
var VisualEditor = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
|
|
8159
|
+
/* @__PURE__ */ jsx58("path", { d: "M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z" }),
|
|
8160
|
+
/* @__PURE__ */ jsx58("path", { d: "M8 8h8M8 12h8M8 16h5" }),
|
|
8161
|
+
/* @__PURE__ */ jsx58("path", { d: "M16 16h1" })
|
|
8070
8162
|
] });
|
|
8071
|
-
var Highlight = () => /* @__PURE__ */
|
|
8072
|
-
/* @__PURE__ */
|
|
8073
|
-
/* @__PURE__ */
|
|
8074
|
-
/* @__PURE__ */
|
|
8075
|
-
/* @__PURE__ */
|
|
8163
|
+
var Highlight = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
|
|
8164
|
+
/* @__PURE__ */ jsx58("path", { d: "M3 19h4L17.5 8.5a2.828 2.828 0 1 0-4-4L3 15v4" }),
|
|
8165
|
+
/* @__PURE__ */ jsx58("path", { d: "m12.5 5.5 4 4" }),
|
|
8166
|
+
/* @__PURE__ */ jsx58("path", { d: "M3 21h7" }),
|
|
8167
|
+
/* @__PURE__ */ jsx58("path", { d: "M18 19h3M19.5 17.5v3" })
|
|
8076
8168
|
] });
|
|
8077
8169
|
|
|
8078
8170
|
// src/toolbar-plugin/items/block-items.tsx
|
|
@@ -8140,14 +8232,14 @@ import { useState as useState9, useRef as useRef7, useEffect as useEffect7 } fro
|
|
|
8140
8232
|
import { useSlateStatic as useSlateStatic18 } from "slate-react";
|
|
8141
8233
|
|
|
8142
8234
|
// src/toolbar-plugin/styles/file-dialog-styles.ts
|
|
8143
|
-
import
|
|
8144
|
-
var $FileDialog =
|
|
8235
|
+
import styled35 from "@emotion/styled";
|
|
8236
|
+
var $FileDialog = styled35($Panel)`
|
|
8145
8237
|
padding: 1em;
|
|
8146
8238
|
width: 18em;
|
|
8147
8239
|
`;
|
|
8148
8240
|
|
|
8149
8241
|
// src/toolbar-plugin/components/dialog/image-url-dialog.tsx
|
|
8150
|
-
import { Fragment as Fragment8, jsx as
|
|
8242
|
+
import { Fragment as Fragment8, jsx as jsx59, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
8151
8243
|
function ImageUrlDialog({
|
|
8152
8244
|
dest,
|
|
8153
8245
|
close
|
|
@@ -8218,12 +8310,12 @@ function ImageUrlDialog({
|
|
|
8218
8310
|
fileInputRef.current?.click();
|
|
8219
8311
|
}
|
|
8220
8312
|
const isSubmitDisabled = imageSource === "file" ? uploadedUrl.trim() === "" || isUploading : url.trim() === "";
|
|
8221
|
-
return /* @__PURE__ */
|
|
8222
|
-
/* @__PURE__ */
|
|
8223
|
-
/* @__PURE__ */
|
|
8224
|
-
hasOnImageChange && /* @__PURE__ */
|
|
8225
|
-
/* @__PURE__ */
|
|
8226
|
-
/* @__PURE__ */
|
|
8313
|
+
return /* @__PURE__ */ jsxs29(Fragment8, { children: [
|
|
8314
|
+
/* @__PURE__ */ jsx59(CloseMask, { close }),
|
|
8315
|
+
/* @__PURE__ */ jsx59($FileDialog, { ref, style, children: /* @__PURE__ */ jsxs29("form", { onSubmit: handleSubmit, style: { padding: "8px" }, children: [
|
|
8316
|
+
hasOnImageChange && /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "12px" }, children: [
|
|
8317
|
+
/* @__PURE__ */ jsxs29("label", { style: { display: "inline-flex", alignItems: "center", marginRight: "16px", cursor: "pointer" }, children: [
|
|
8318
|
+
/* @__PURE__ */ jsx59(
|
|
8227
8319
|
"input",
|
|
8228
8320
|
{
|
|
8229
8321
|
type: "radio",
|
|
@@ -8236,8 +8328,8 @@ function ImageUrlDialog({
|
|
|
8236
8328
|
),
|
|
8237
8329
|
t("imageSourceFile")
|
|
8238
8330
|
] }),
|
|
8239
|
-
/* @__PURE__ */
|
|
8240
|
-
/* @__PURE__ */
|
|
8331
|
+
/* @__PURE__ */ jsxs29("label", { style: { display: "inline-flex", alignItems: "center", cursor: "pointer" }, children: [
|
|
8332
|
+
/* @__PURE__ */ jsx59(
|
|
8241
8333
|
"input",
|
|
8242
8334
|
{
|
|
8243
8335
|
type: "radio",
|
|
@@ -8251,9 +8343,9 @@ function ImageUrlDialog({
|
|
|
8251
8343
|
t("imageSourceUrl")
|
|
8252
8344
|
] })
|
|
8253
8345
|
] }),
|
|
8254
|
-
imageSource === "url" ? /* @__PURE__ */
|
|
8255
|
-
/* @__PURE__ */
|
|
8256
|
-
/* @__PURE__ */
|
|
8346
|
+
imageSource === "url" ? /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
|
|
8347
|
+
/* @__PURE__ */ jsx59("label", { style: { display: "block", marginBottom: "4px" }, children: t("imageUrlRequired") }),
|
|
8348
|
+
/* @__PURE__ */ jsx59(
|
|
8257
8349
|
"input",
|
|
8258
8350
|
{
|
|
8259
8351
|
type: "text",
|
|
@@ -8269,8 +8361,8 @@ function ImageUrlDialog({
|
|
|
8269
8361
|
placeholder: "https://example.com/image.jpg"
|
|
8270
8362
|
}
|
|
8271
8363
|
)
|
|
8272
|
-
] }) : /* @__PURE__ */
|
|
8273
|
-
/* @__PURE__ */
|
|
8364
|
+
] }) : /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
|
|
8365
|
+
/* @__PURE__ */ jsx59(
|
|
8274
8366
|
"input",
|
|
8275
8367
|
{
|
|
8276
8368
|
ref: fileInputRef,
|
|
@@ -8280,7 +8372,7 @@ function ImageUrlDialog({
|
|
|
8280
8372
|
style: { display: "none" }
|
|
8281
8373
|
}
|
|
8282
8374
|
),
|
|
8283
|
-
/* @__PURE__ */
|
|
8375
|
+
/* @__PURE__ */ jsx59(
|
|
8284
8376
|
"button",
|
|
8285
8377
|
{
|
|
8286
8378
|
type: "button",
|
|
@@ -8297,9 +8389,9 @@ function ImageUrlDialog({
|
|
|
8297
8389
|
children: isUploading ? t("uploading") : t("selectFile")
|
|
8298
8390
|
}
|
|
8299
8391
|
),
|
|
8300
|
-
uploadedUrl && /* @__PURE__ */
|
|
8301
|
-
/* @__PURE__ */
|
|
8302
|
-
/* @__PURE__ */
|
|
8392
|
+
uploadedUrl && /* @__PURE__ */ jsxs29("div", { style: { marginTop: "8px" }, children: [
|
|
8393
|
+
/* @__PURE__ */ jsx59("label", { style: { display: "block", marginBottom: "4px" }, children: t("imageUrlRequired") }),
|
|
8394
|
+
/* @__PURE__ */ jsx59(
|
|
8303
8395
|
"input",
|
|
8304
8396
|
{
|
|
8305
8397
|
type: "text",
|
|
@@ -8318,9 +8410,9 @@ function ImageUrlDialog({
|
|
|
8318
8410
|
)
|
|
8319
8411
|
] })
|
|
8320
8412
|
] }),
|
|
8321
|
-
/* @__PURE__ */
|
|
8322
|
-
/* @__PURE__ */
|
|
8323
|
-
/* @__PURE__ */
|
|
8413
|
+
/* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
|
|
8414
|
+
/* @__PURE__ */ jsx59("label", { style: { display: "block", marginBottom: "4px" }, children: t("altText") }),
|
|
8415
|
+
/* @__PURE__ */ jsx59(
|
|
8324
8416
|
"input",
|
|
8325
8417
|
{
|
|
8326
8418
|
type: "text",
|
|
@@ -8337,9 +8429,9 @@ function ImageUrlDialog({
|
|
|
8337
8429
|
}
|
|
8338
8430
|
)
|
|
8339
8431
|
] }),
|
|
8340
|
-
/* @__PURE__ */
|
|
8341
|
-
/* @__PURE__ */
|
|
8342
|
-
/* @__PURE__ */
|
|
8432
|
+
/* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
|
|
8433
|
+
/* @__PURE__ */ jsx59("label", { style: { display: "block", marginBottom: "4px" }, children: t("title") }),
|
|
8434
|
+
/* @__PURE__ */ jsx59(
|
|
8343
8435
|
"input",
|
|
8344
8436
|
{
|
|
8345
8437
|
type: "text",
|
|
@@ -8356,8 +8448,8 @@ function ImageUrlDialog({
|
|
|
8356
8448
|
}
|
|
8357
8449
|
)
|
|
8358
8450
|
] }),
|
|
8359
|
-
/* @__PURE__ */
|
|
8360
|
-
/* @__PURE__ */
|
|
8451
|
+
/* @__PURE__ */ jsxs29("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
8452
|
+
/* @__PURE__ */ jsx59(
|
|
8361
8453
|
"button",
|
|
8362
8454
|
{
|
|
8363
8455
|
type: "submit",
|
|
@@ -8376,7 +8468,7 @@ function ImageUrlDialog({
|
|
|
8376
8468
|
children: t("register")
|
|
8377
8469
|
}
|
|
8378
8470
|
),
|
|
8379
|
-
/* @__PURE__ */
|
|
8471
|
+
/* @__PURE__ */ jsx59(
|
|
8380
8472
|
"button",
|
|
8381
8473
|
{
|
|
8382
8474
|
type: "button",
|
|
@@ -8409,8 +8501,8 @@ import { Editor as Editor59, Range as Range10 } from "slate";
|
|
|
8409
8501
|
import { ReactEditor as ReactEditor14, useSlateStatic as useSlateStatic19 } from "slate-react";
|
|
8410
8502
|
|
|
8411
8503
|
// src/toolbar-plugin/styles/dialog-shared-styles.ts
|
|
8412
|
-
import
|
|
8413
|
-
var $DialogButton =
|
|
8504
|
+
import styled36 from "@emotion/styled";
|
|
8505
|
+
var $DialogButton = styled36("div")`
|
|
8414
8506
|
/* Center vertically and horizontally */
|
|
8415
8507
|
display: flex;
|
|
8416
8508
|
align-items: center;
|
|
@@ -8435,7 +8527,7 @@ var $DialogButton = styled35("div")`
|
|
|
8435
8527
|
stroke-width: 2px;
|
|
8436
8528
|
}
|
|
8437
8529
|
`;
|
|
8438
|
-
var $DialogHint =
|
|
8530
|
+
var $DialogHint = styled36("div")`
|
|
8439
8531
|
font-size: 0.875em;
|
|
8440
8532
|
margin-top: 0.5em;
|
|
8441
8533
|
color: var(--shade-500);
|
|
@@ -8443,7 +8535,7 @@ var $DialogHint = styled35("div")`
|
|
|
8443
8535
|
`;
|
|
8444
8536
|
|
|
8445
8537
|
// src/toolbar-plugin/components/dialog/anchor-dialog.tsx
|
|
8446
|
-
import { Fragment as Fragment9, jsx as
|
|
8538
|
+
import { Fragment as Fragment9, jsx as jsx60, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8447
8539
|
var isEnter = isHotkey3("enter");
|
|
8448
8540
|
function AnchorDialog2({
|
|
8449
8541
|
dest,
|
|
@@ -8513,10 +8605,10 @@ function AnchorDialog2({
|
|
|
8513
8605
|
e.stopPropagation();
|
|
8514
8606
|
insertLink2();
|
|
8515
8607
|
};
|
|
8516
|
-
return /* @__PURE__ */
|
|
8517
|
-
/* @__PURE__ */
|
|
8518
|
-
/* @__PURE__ */
|
|
8519
|
-
/* @__PURE__ */
|
|
8608
|
+
return /* @__PURE__ */ jsxs30(Fragment9, { children: [
|
|
8609
|
+
/* @__PURE__ */ jsx60(CloseMask, { close }),
|
|
8610
|
+
/* @__PURE__ */ jsxs30($AnchorDialog, { ref, style, children: [
|
|
8611
|
+
/* @__PURE__ */ jsx60($AnchorDialogInputLine, { children: /* @__PURE__ */ jsx60(
|
|
8520
8612
|
$AnchorDialogInput,
|
|
8521
8613
|
{
|
|
8522
8614
|
type: "text",
|
|
@@ -8527,7 +8619,7 @@ function AnchorDialog2({
|
|
|
8527
8619
|
onKeyDown
|
|
8528
8620
|
}
|
|
8529
8621
|
) }),
|
|
8530
|
-
/* @__PURE__ */
|
|
8622
|
+
/* @__PURE__ */ jsx60($AnchorDialogInputLine, { style: { marginTop: "0.5em" }, children: /* @__PURE__ */ jsx60(
|
|
8531
8623
|
$AnchorDialogInput,
|
|
8532
8624
|
{
|
|
8533
8625
|
type: "text",
|
|
@@ -8537,8 +8629,8 @@ function AnchorDialog2({
|
|
|
8537
8629
|
onKeyDown
|
|
8538
8630
|
}
|
|
8539
8631
|
) }),
|
|
8540
|
-
/* @__PURE__ */
|
|
8541
|
-
/* @__PURE__ */
|
|
8632
|
+
/* @__PURE__ */ jsxs30($AnchorDialogInputLine, { style: { marginTop: "0.5em" }, children: [
|
|
8633
|
+
/* @__PURE__ */ jsx60(
|
|
8542
8634
|
$AnchorDialogInput,
|
|
8543
8635
|
{
|
|
8544
8636
|
type: "text",
|
|
@@ -8548,12 +8640,12 @@ function AnchorDialog2({
|
|
|
8548
8640
|
onKeyDown
|
|
8549
8641
|
}
|
|
8550
8642
|
),
|
|
8551
|
-
/* @__PURE__ */
|
|
8552
|
-
/* @__PURE__ */
|
|
8553
|
-
/* @__PURE__ */
|
|
8643
|
+
/* @__PURE__ */ jsxs30($DialogButton, { onClick: insertLink2, children: [
|
|
8644
|
+
/* @__PURE__ */ jsx60(Link, {}),
|
|
8645
|
+
/* @__PURE__ */ jsx60(LinkPlus, {})
|
|
8554
8646
|
] })
|
|
8555
8647
|
] }),
|
|
8556
|
-
/* @__PURE__ */
|
|
8648
|
+
/* @__PURE__ */ jsx60($DialogHint, { children: t("tooltipHint") })
|
|
8557
8649
|
] })
|
|
8558
8650
|
] });
|
|
8559
8651
|
}
|
|
@@ -8694,7 +8786,7 @@ var compactListItems = [
|
|
|
8694
8786
|
];
|
|
8695
8787
|
|
|
8696
8788
|
// src/toolbar-plugin/items/quote-items.tsx
|
|
8697
|
-
import { Editor as Editor61, Transforms as
|
|
8789
|
+
import { Editor as Editor61, Transforms as Transforms44 } from "slate";
|
|
8698
8790
|
var quoteItemsList = [
|
|
8699
8791
|
{
|
|
8700
8792
|
icon: Quote,
|
|
@@ -8724,8 +8816,8 @@ var quoteItemsList = [
|
|
|
8724
8816
|
if (codeBlockEntry) {
|
|
8725
8817
|
const [codeBlock, path] = codeBlockEntry;
|
|
8726
8818
|
const textContent = Editor61.string(editor, path);
|
|
8727
|
-
|
|
8728
|
-
|
|
8819
|
+
Transforms44.removeNodes(editor, { at: path });
|
|
8820
|
+
Transforms44.insertNodes(
|
|
8729
8821
|
editor,
|
|
8730
8822
|
{
|
|
8731
8823
|
type: "paragraph",
|
|
@@ -8741,8 +8833,8 @@ var quoteItemsList = [
|
|
|
8741
8833
|
}
|
|
8742
8834
|
if (selection && (selection.anchor.offset !== selection.focus.offset || JSON.stringify(selection.anchor.path) !== JSON.stringify(selection.focus.path))) {
|
|
8743
8835
|
const selectedText = Editor61.string(editor, selection);
|
|
8744
|
-
|
|
8745
|
-
|
|
8836
|
+
Transforms44.delete(editor);
|
|
8837
|
+
Transforms44.insertNodes(
|
|
8746
8838
|
editor,
|
|
8747
8839
|
{
|
|
8748
8840
|
type: "code-block",
|
|
@@ -8855,7 +8947,7 @@ var itemSets = [largeItems, mediumItems, smallItems];
|
|
|
8855
8947
|
import { clsx as clsx9 } from "clsx";
|
|
8856
8948
|
import { useCallback as useCallback14, useRef as useRef9 } from "react";
|
|
8857
8949
|
import { ReactEditor as ReactEditor15, useSlate as useSlate2, useSlateStatic as useSlateStatic20 } from "slate-react";
|
|
8858
|
-
import { jsx as
|
|
8950
|
+
import { jsx as jsx61, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
8859
8951
|
function ToolbarButton({
|
|
8860
8952
|
item
|
|
8861
8953
|
}) {
|
|
@@ -8875,9 +8967,9 @@ function ToolbarButton({
|
|
|
8875
8967
|
if (!dest)
|
|
8876
8968
|
return;
|
|
8877
8969
|
if (items) {
|
|
8878
|
-
menuLayer.open(() => /* @__PURE__ */
|
|
8970
|
+
menuLayer.open(() => /* @__PURE__ */ jsx61(Menu, { dest, items, close: menuLayer.close }));
|
|
8879
8971
|
} else if (Component) {
|
|
8880
|
-
menuLayer.open(() => /* @__PURE__ */
|
|
8972
|
+
menuLayer.open(() => /* @__PURE__ */ jsx61(Component, { dest, close: menuLayer.close }));
|
|
8881
8973
|
}
|
|
8882
8974
|
}, [item]);
|
|
8883
8975
|
const onClick = useCallback14(() => {
|
|
@@ -8900,7 +8992,7 @@ function ToolbarButton({
|
|
|
8900
8992
|
},
|
|
8901
8993
|
[menuLayer.layer]
|
|
8902
8994
|
);
|
|
8903
|
-
return /* @__PURE__ */
|
|
8995
|
+
return /* @__PURE__ */ jsxs31(
|
|
8904
8996
|
$ToolbarButton,
|
|
8905
8997
|
{
|
|
8906
8998
|
"data-item-type": "button",
|
|
@@ -8914,24 +9006,24 @@ function ToolbarButton({
|
|
|
8914
9006
|
"--disabled": !isActive && r(item?.title)?.includes("Depth")
|
|
8915
9007
|
}),
|
|
8916
9008
|
children: [
|
|
8917
|
-
/* @__PURE__ */
|
|
8918
|
-
item.more ? /* @__PURE__ */
|
|
9009
|
+
/* @__PURE__ */ jsx61(item.icon, {}),
|
|
9010
|
+
item.more ? /* @__PURE__ */ jsx61(More, {}) : null
|
|
8919
9011
|
]
|
|
8920
9012
|
}
|
|
8921
9013
|
);
|
|
8922
9014
|
}
|
|
8923
9015
|
|
|
8924
9016
|
// src/toolbar-plugin/components/toolbar/toolbar.tsx
|
|
8925
|
-
import { jsx as
|
|
9017
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
8926
9018
|
function ToolbarItem({ item }) {
|
|
8927
9019
|
const editor = useSlateStatic21();
|
|
8928
9020
|
if (item === "divider") {
|
|
8929
|
-
return /* @__PURE__ */
|
|
9021
|
+
return /* @__PURE__ */ jsx62($ToolbarDividerContainer, { "data-item-type": "divider", children: /* @__PURE__ */ jsx62($ToolbarDivider, {}) });
|
|
8930
9022
|
}
|
|
8931
9023
|
const show = item.show === void 0 ? true : item.show(editor);
|
|
8932
9024
|
if (!show)
|
|
8933
9025
|
return null;
|
|
8934
|
-
return /* @__PURE__ */
|
|
9026
|
+
return /* @__PURE__ */ jsx62(ToolbarButton, { item });
|
|
8935
9027
|
}
|
|
8936
9028
|
function getWidths(toolbar) {
|
|
8937
9029
|
const button = toolbar.querySelector(
|
|
@@ -8989,7 +9081,7 @@ function Toolbar() {
|
|
|
8989
9081
|
window.removeEventListener("resize", refresh);
|
|
8990
9082
|
};
|
|
8991
9083
|
}, []);
|
|
8992
|
-
return /* @__PURE__ */
|
|
9084
|
+
return /* @__PURE__ */ jsx62($ToolbarContainer, { ref, children: /* @__PURE__ */ jsx62($Toolbar, { children: items.map((item, index) => /* @__PURE__ */ jsx62(
|
|
8993
9085
|
ToolbarItem,
|
|
8994
9086
|
{
|
|
8995
9087
|
item
|
|
@@ -8999,7 +9091,7 @@ function Toolbar() {
|
|
|
8999
9091
|
}
|
|
9000
9092
|
|
|
9001
9093
|
// src/toolbar-plugin/render-editable/index.tsx
|
|
9002
|
-
import { jsx as
|
|
9094
|
+
import { jsx as jsx63, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
9003
9095
|
function renderEditable({ attributes, Editable: Editable3 }) {
|
|
9004
9096
|
const outerContainerRef = useRef11(null);
|
|
9005
9097
|
const editor = useSlateStatic22();
|
|
@@ -9008,12 +9100,12 @@ function renderEditable({ attributes, Editable: Editable3 }) {
|
|
|
9008
9100
|
(e) => {
|
|
9009
9101
|
if (e.target !== e.currentTarget)
|
|
9010
9102
|
return;
|
|
9011
|
-
|
|
9103
|
+
Transforms45.select(editor, Editor62.end(editor, []));
|
|
9012
9104
|
ReactEditor16.focus(editor);
|
|
9013
9105
|
},
|
|
9014
9106
|
[editor]
|
|
9015
9107
|
);
|
|
9016
|
-
return /* @__PURE__ */
|
|
9108
|
+
return /* @__PURE__ */ jsx63(Layers, { children: /* @__PURE__ */ jsxs32(
|
|
9017
9109
|
$OuterContainer,
|
|
9018
9110
|
{
|
|
9019
9111
|
ref: outerContainerRef,
|
|
@@ -9025,8 +9117,8 @@ function renderEditable({ attributes, Editable: Editable3 }) {
|
|
|
9025
9117
|
},
|
|
9026
9118
|
onClick: onClickOuterContainer,
|
|
9027
9119
|
children: [
|
|
9028
|
-
/* @__PURE__ */
|
|
9029
|
-
/* @__PURE__ */
|
|
9120
|
+
/* @__PURE__ */ jsx63(Toolbar, {}),
|
|
9121
|
+
/* @__PURE__ */ jsx63(
|
|
9030
9122
|
Editable3,
|
|
9031
9123
|
{
|
|
9032
9124
|
as: $Editable,
|
|
@@ -9058,7 +9150,7 @@ var ToolbarPlugin = createPlugin(
|
|
|
9058
9150
|
);
|
|
9059
9151
|
|
|
9060
9152
|
// src/trailing-block-plugin/index.tsx
|
|
9061
|
-
import { Editor as Editor63, Node as Node15, Path as Path16, Transforms as
|
|
9153
|
+
import { Editor as Editor63, Node as Node15, Path as Path16, Transforms as Transforms46 } from "slate";
|
|
9062
9154
|
var TrailingBlockPlugin = createPlugin(
|
|
9063
9155
|
(editor) => {
|
|
9064
9156
|
editor.allowTrailingBlock = true;
|
|
@@ -9074,7 +9166,7 @@ var TrailingBlockPlugin = createPlugin(
|
|
|
9074
9166
|
editor.children.length - 1
|
|
9075
9167
|
);
|
|
9076
9168
|
if (Editor63.hasBlocks(editor, lastElement) || Editor63.isVoid(editor, lastElement)) {
|
|
9077
|
-
|
|
9169
|
+
Transforms46.insertNodes(
|
|
9078
9170
|
editor,
|
|
9079
9171
|
{ type: "paragraph", children: [{ text: "" }] },
|
|
9080
9172
|
{
|
|
@@ -9090,11 +9182,11 @@ var TrailingBlockPlugin = createPlugin(
|
|
|
9090
9182
|
);
|
|
9091
9183
|
|
|
9092
9184
|
// src/paste-markdown-plugin/methods/index.ts
|
|
9093
|
-
import { Transforms as
|
|
9185
|
+
import { Transforms as Transforms47 } from "slate";
|
|
9094
9186
|
function pasteMarkdown(editor, markdown) {
|
|
9095
9187
|
const escapedMarkdown = escapeUrlSlashes(markdown);
|
|
9096
9188
|
const fragment = parse(escapedMarkdown);
|
|
9097
|
-
|
|
9189
|
+
Transforms47.insertNodes(editor, fragment);
|
|
9098
9190
|
}
|
|
9099
9191
|
function createPasteMarkdownMethods(editor) {
|
|
9100
9192
|
return {
|
|
@@ -9126,7 +9218,7 @@ var PasteMarkdownPlugin = createPlugin(
|
|
|
9126
9218
|
);
|
|
9127
9219
|
|
|
9128
9220
|
// src/placeholder-plugin/index.tsx
|
|
9129
|
-
import { jsx as
|
|
9221
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
9130
9222
|
function renderPlaceholder(props) {
|
|
9131
9223
|
const nextAttributes = {
|
|
9132
9224
|
...props.attributes,
|
|
@@ -9136,7 +9228,7 @@ function renderPlaceholder(props) {
|
|
|
9136
9228
|
maxWidth: void 0
|
|
9137
9229
|
}
|
|
9138
9230
|
};
|
|
9139
|
-
return /* @__PURE__ */
|
|
9231
|
+
return /* @__PURE__ */ jsx64("span", { ...nextAttributes, children: props.children });
|
|
9140
9232
|
}
|
|
9141
9233
|
var PlaceholderPlugin = createPlugin(
|
|
9142
9234
|
(editor, _options, { createPolicy }) => {
|
|
@@ -9160,6 +9252,7 @@ var defaultPlugins = [
|
|
|
9160
9252
|
InlineCodePlugin,
|
|
9161
9253
|
BlockQuotePlugin,
|
|
9162
9254
|
CodeBlockPlugin,
|
|
9255
|
+
HtmlBlockPlugin,
|
|
9163
9256
|
TablePlugin,
|
|
9164
9257
|
HorizontalRulePlugin,
|
|
9165
9258
|
TrailingBlockPlugin,
|
|
@@ -9178,7 +9271,7 @@ var { withSink, SinkEditable: SinkEditable2 } = createSink(defaultPlugins);
|
|
|
9178
9271
|
|
|
9179
9272
|
// src/entry/useEditor.tsx
|
|
9180
9273
|
import { useState as useState12 } from "react";
|
|
9181
|
-
import { createEditor, Editor as Editor65, Transforms as
|
|
9274
|
+
import { createEditor, Editor as Editor65, Transforms as Transforms48 } from "slate";
|
|
9182
9275
|
import { withHistory } from "slate-history";
|
|
9183
9276
|
import { withReact } from "slate-react";
|
|
9184
9277
|
function useEditor({
|
|
@@ -9224,7 +9317,7 @@ function useEditor({
|
|
|
9224
9317
|
const documentValue = parse(escapedMarkdown);
|
|
9225
9318
|
editor2.children = documentValue;
|
|
9226
9319
|
editor2.selection = null;
|
|
9227
|
-
|
|
9320
|
+
Transforms48.select(editor2, Editor65.start(editor2, [0]));
|
|
9228
9321
|
};
|
|
9229
9322
|
return nextEditor;
|
|
9230
9323
|
});
|
|
@@ -9232,9 +9325,9 @@ function useEditor({
|
|
|
9232
9325
|
}
|
|
9233
9326
|
|
|
9234
9327
|
// src/entry/index.tsx
|
|
9235
|
-
import { jsx as
|
|
9328
|
+
import { jsx as jsx65, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
9236
9329
|
function renderLeaf({ children, attributes }) {
|
|
9237
|
-
return /* @__PURE__ */
|
|
9330
|
+
return /* @__PURE__ */ jsx65("span", { ...attributes, children });
|
|
9238
9331
|
}
|
|
9239
9332
|
function Editable2({
|
|
9240
9333
|
editor,
|
|
@@ -9255,7 +9348,7 @@ function Editable2({
|
|
|
9255
9348
|
const onThrottledSlateChange = useCallback16(
|
|
9256
9349
|
throttle3(
|
|
9257
9350
|
() => {
|
|
9258
|
-
const markdown = serialize(editor.children);
|
|
9351
|
+
const markdown = unescapeUrlSlashes(serialize(editor.children));
|
|
9259
9352
|
editor.wysimark.prevValue = {
|
|
9260
9353
|
markdown,
|
|
9261
9354
|
children: editor.children
|
|
@@ -9305,7 +9398,7 @@ function Editable2({
|
|
|
9305
9398
|
const documentValue = parse(valueToProcess);
|
|
9306
9399
|
editor.children = documentValue;
|
|
9307
9400
|
editor.selection = null;
|
|
9308
|
-
|
|
9401
|
+
Transforms49.select(editor, Editor66.start(editor, [0]));
|
|
9309
9402
|
}
|
|
9310
9403
|
}
|
|
9311
9404
|
}
|
|
@@ -9343,8 +9436,8 @@ function Editable2({
|
|
|
9343
9436
|
editor.wysimark.toggleRawMode = handleRawModeToggle;
|
|
9344
9437
|
}
|
|
9345
9438
|
editor.wysimark.onImageChange = onImageChange;
|
|
9346
|
-
return /* @__PURE__ */
|
|
9347
|
-
isRawMode && /* @__PURE__ */
|
|
9439
|
+
return /* @__PURE__ */ jsxs33("div", { style: { position: "relative" }, children: [
|
|
9440
|
+
isRawMode && /* @__PURE__ */ jsx65("div", { style: { position: "absolute", top: "5px", right: "25px", zIndex: 10 }, children: /* @__PURE__ */ jsx65(
|
|
9348
9441
|
"div",
|
|
9349
9442
|
{
|
|
9350
9443
|
onClick: handleRawModeToggle,
|
|
@@ -9370,10 +9463,10 @@ function Editable2({
|
|
|
9370
9463
|
e.preventDefault();
|
|
9371
9464
|
}
|
|
9372
9465
|
},
|
|
9373
|
-
children: /* @__PURE__ */
|
|
9466
|
+
children: /* @__PURE__ */ jsx65("span", { style: { color: "#4a90e2", fontSize: "1.25em" }, children: /* @__PURE__ */ jsx65(VisualEditor, {}) })
|
|
9374
9467
|
}
|
|
9375
9468
|
) }),
|
|
9376
|
-
/* @__PURE__ */
|
|
9469
|
+
/* @__PURE__ */ jsx65("div", { style: { display: isRawMode ? "block" : "none", textAlign: "center" }, children: /* @__PURE__ */ jsx65(
|
|
9377
9470
|
"textarea",
|
|
9378
9471
|
{
|
|
9379
9472
|
value: unescapeUrlSlashes(rawText).replace(/ /g, ""),
|
|
@@ -9398,13 +9491,13 @@ function Editable2({
|
|
|
9398
9491
|
}
|
|
9399
9492
|
}
|
|
9400
9493
|
) }),
|
|
9401
|
-
/* @__PURE__ */
|
|
9494
|
+
/* @__PURE__ */ jsx65("div", { style: { display: isRawMode ? "none" : "block" }, children: /* @__PURE__ */ jsx65(
|
|
9402
9495
|
Slate2,
|
|
9403
9496
|
{
|
|
9404
9497
|
editor,
|
|
9405
9498
|
initialValue: initialValueRef.current ?? editor.children,
|
|
9406
9499
|
onChange: onSlateChange,
|
|
9407
|
-
children: /* @__PURE__ */
|
|
9500
|
+
children: /* @__PURE__ */ jsx65(
|
|
9408
9501
|
SinkEditable2,
|
|
9409
9502
|
{
|
|
9410
9503
|
renderLeaf,
|
|
@@ -9421,7 +9514,7 @@ function Editable2({
|
|
|
9421
9514
|
}
|
|
9422
9515
|
|
|
9423
9516
|
// src/index.tsx
|
|
9424
|
-
import { jsx as
|
|
9517
|
+
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
9425
9518
|
function StandaloneEditor({
|
|
9426
9519
|
standaloneOptions: { onChange, placeholder, className, ...options },
|
|
9427
9520
|
standaloneMethodsRef
|
|
@@ -9453,7 +9546,7 @@ function StandaloneEditor({
|
|
|
9453
9546
|
},
|
|
9454
9547
|
[editor]
|
|
9455
9548
|
);
|
|
9456
|
-
return /* @__PURE__ */
|
|
9549
|
+
return /* @__PURE__ */ jsx66(
|
|
9457
9550
|
Editable2,
|
|
9458
9551
|
{
|
|
9459
9552
|
editor,
|
|
@@ -9468,7 +9561,7 @@ function createWysimark(containerElement, options) {
|
|
|
9468
9561
|
const standaloneMethodsRef = createRef();
|
|
9469
9562
|
const root = createRoot(containerElement);
|
|
9470
9563
|
root.render(
|
|
9471
|
-
/* @__PURE__ */
|
|
9564
|
+
/* @__PURE__ */ jsx66(
|
|
9472
9565
|
StandaloneEditor,
|
|
9473
9566
|
{
|
|
9474
9567
|
standaloneMethodsRef,
|