wysimark-lite 0.21.2 → 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/README.md +41 -2
- package/dist/index.d.ts +101 -7
- package/dist/index.js +158 -127
- package/dist/index.mjs +950 -598
- package/dist/index.mjs.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
createRef,
|
|
6
6
|
useCallback as useCallback17,
|
|
7
7
|
useImperativeHandle,
|
|
8
|
-
useRef as
|
|
9
|
-
useState as
|
|
8
|
+
useRef as useRef13,
|
|
9
|
+
useState as useState14
|
|
10
10
|
} from "react";
|
|
11
11
|
import { createRoot } from "react-dom/client";
|
|
12
12
|
|
|
13
13
|
// src/entry/index.tsx
|
|
14
14
|
import throttle3 from "lodash.throttle";
|
|
15
|
-
import { useCallback as useCallback16, useRef as
|
|
16
|
-
import { Editor as
|
|
15
|
+
import { useCallback as useCallback16, useRef as useRef12, useState as useState13 } from "react";
|
|
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
|
|
@@ -256,14 +256,16 @@ var MARK_KEY_TO_TOKEN = {
|
|
|
256
256
|
*
|
|
257
257
|
* This is handled in the `serializeLine` code.
|
|
258
258
|
*/
|
|
259
|
-
code: ""
|
|
259
|
+
code: "",
|
|
260
|
+
/**
|
|
261
|
+
* Highlight is handled specially in `serializeLine` using <mark> tags.
|
|
262
|
+
*/
|
|
263
|
+
highlight: ""
|
|
260
264
|
};
|
|
261
265
|
function convertMarkToSymbol(mark) {
|
|
262
266
|
if (mark in MARK_KEY_TO_TOKEN)
|
|
263
267
|
return MARK_KEY_TO_TOKEN[mark];
|
|
264
|
-
|
|
265
|
-
`Could not find mark ${JSON.stringify(mark)} in MARK_KEY_TO_TOKEN lookup`
|
|
266
|
-
);
|
|
268
|
+
return "";
|
|
267
269
|
}
|
|
268
270
|
function convertMarksToSymbolsExceptCode(marks) {
|
|
269
271
|
return marks.map(convertMarkToSymbol).join("");
|
|
@@ -458,11 +460,11 @@ function parseUrl(url) {
|
|
|
458
460
|
searchParams: urlData.searchParams,
|
|
459
461
|
hash: urlData.hash
|
|
460
462
|
};
|
|
461
|
-
} catch
|
|
463
|
+
} catch {
|
|
462
464
|
const matchdata = url.match(URL_REGEX);
|
|
463
465
|
if (matchdata === null)
|
|
464
466
|
throw new Error(`Invalid format should not happen: ${url}`);
|
|
465
|
-
const [
|
|
467
|
+
const [, pathname, searchParams, hash] = [...matchdata];
|
|
466
468
|
return {
|
|
467
469
|
origin: "",
|
|
468
470
|
hostname: "",
|
|
@@ -579,8 +581,13 @@ function parsePhrasingContent(phrasingContent, marks = {}) {
|
|
|
579
581
|
});
|
|
580
582
|
case "footnoteReference":
|
|
581
583
|
return [{ text: `[${phrasingContent.identifier}]` }];
|
|
582
|
-
case "html":
|
|
584
|
+
case "html": {
|
|
585
|
+
const markMatch = phrasingContent.value.match(/^<mark>(.*)<\/mark>$/s);
|
|
586
|
+
if (markMatch) {
|
|
587
|
+
return [{ text: markMatch[1], ...marks, highlight: true }];
|
|
588
|
+
}
|
|
583
589
|
return [{ text: phrasingContent.value, code: true }];
|
|
590
|
+
}
|
|
584
591
|
case "image":
|
|
585
592
|
return parseInlineImage(phrasingContent);
|
|
586
593
|
case "inlineCode": {
|
|
@@ -635,12 +642,9 @@ function parseHeading(content) {
|
|
|
635
642
|
function parseHTML(content) {
|
|
636
643
|
return [
|
|
637
644
|
{
|
|
638
|
-
type: "
|
|
639
|
-
|
|
640
|
-
children:
|
|
641
|
-
type: "code-block-line",
|
|
642
|
-
children: [{ text: line }]
|
|
643
|
-
}))
|
|
645
|
+
type: "html-block",
|
|
646
|
+
html: content.value,
|
|
647
|
+
children: [{ text: "" }]
|
|
644
648
|
}
|
|
645
649
|
];
|
|
646
650
|
}
|
|
@@ -1054,7 +1058,6 @@ function moveSpacesAtStartOfAnchor({
|
|
|
1054
1058
|
return false;
|
|
1055
1059
|
if (node.type !== "anchor")
|
|
1056
1060
|
return false;
|
|
1057
|
-
node;
|
|
1058
1061
|
const firstChild = node.children[0];
|
|
1059
1062
|
if (isText(firstChild) && isPlainSpace(firstChild)) {
|
|
1060
1063
|
node.children.splice(0, 1);
|
|
@@ -1077,7 +1080,6 @@ function moveSpacesAtEndOfAnchor({
|
|
|
1077
1080
|
return false;
|
|
1078
1081
|
if (node.type !== "anchor")
|
|
1079
1082
|
return false;
|
|
1080
|
-
node;
|
|
1081
1083
|
const lastChild = node.children[node.children.length - 1];
|
|
1082
1084
|
if (isText(lastChild) && isPlainSpace(lastChild)) {
|
|
1083
1085
|
node.children.splice(node.children.length - 1, 1);
|
|
@@ -1371,9 +1373,17 @@ function serializeLine(inputSegments, leadingMarks = [], trailingMarks = []) {
|
|
|
1371
1373
|
continue;
|
|
1372
1374
|
}
|
|
1373
1375
|
substrings.push(convertMarksToSymbolsExceptCode(leadingDiff.add));
|
|
1376
|
+
const hasHighlightOpen = leadingDiff.add.includes("highlight");
|
|
1377
|
+
if (hasHighlightOpen) {
|
|
1378
|
+
substrings.push("<mark>");
|
|
1379
|
+
}
|
|
1374
1380
|
substrings.push(serializeSegment(segment));
|
|
1375
1381
|
const nextMarks = getNextMarks(segments, i, trailingMarks);
|
|
1376
1382
|
const trailingDiff = diffMarks(leadingDiff.nextOrderedMarks, nextMarks);
|
|
1383
|
+
const hasHighlightClose = trailingDiff.remove.includes("highlight");
|
|
1384
|
+
if (hasHighlightClose) {
|
|
1385
|
+
substrings.push("</mark>");
|
|
1386
|
+
}
|
|
1377
1387
|
substrings.push(convertMarksToSymbolsExceptCode(trailingDiff.remove));
|
|
1378
1388
|
leadingDiff = trailingDiff;
|
|
1379
1389
|
}
|
|
@@ -1503,6 +1513,10 @@ function serializeElement(element, orders) {
|
|
|
1503
1513
|
throw new Error(
|
|
1504
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.`
|
|
1505
1515
|
);
|
|
1516
|
+
case "html-block":
|
|
1517
|
+
return `${element.html}
|
|
1518
|
+
|
|
1519
|
+
`;
|
|
1506
1520
|
}
|
|
1507
1521
|
assertUnreachable(element);
|
|
1508
1522
|
}
|
|
@@ -1558,6 +1572,7 @@ var translations = {
|
|
|
1558
1572
|
strike: "\u53D6\u308A\u6D88\u3057\u7DDA",
|
|
1559
1573
|
inlineCode: "\u30A4\u30F3\u30E9\u30A4\u30F3\u30B3\u30FC\u30C9",
|
|
1560
1574
|
underline: "\u4E0B\u7DDA",
|
|
1575
|
+
highlight: "\u30CF\u30A4\u30E9\u30A4\u30C8",
|
|
1561
1576
|
increaseDepth: "\u968E\u5C64\u3092\u6DF1\u304F\u3059\u308B",
|
|
1562
1577
|
decreaseDepth: "\u968E\u5C64\u3092\u6D45\u304F\u3059\u308B",
|
|
1563
1578
|
heading1: "\u898B\u51FA\u30571",
|
|
@@ -1571,6 +1586,8 @@ var translations = {
|
|
|
1571
1586
|
checkList: "\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",
|
|
1572
1587
|
list: "\u30EA\u30B9\u30C8",
|
|
1573
1588
|
linkUrl: "\u30EA\u30F3\u30AF\u306EURL",
|
|
1589
|
+
linkText: "\u30EA\u30F3\u30AF\u30C6\u30AD\u30B9\u30C8",
|
|
1590
|
+
linkTextHint: "\u30EA\u30F3\u30AF\u3068\u3057\u3066\u8868\u793A\u3055\u308C\u308B\u30C6\u30AD\u30B9\u30C8",
|
|
1574
1591
|
tooltipText: "\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7\u30C6\u30AD\u30B9\u30C8",
|
|
1575
1592
|
tooltipHint: "\u30DE\u30A6\u30B9\u30DB\u30D0\u30FC\u6642\u306B\u8868\u793A\u3055\u308C\u308B\u30C4\u30FC\u30EB\u30C1\u30C3\u30D7",
|
|
1576
1593
|
apply: "\u9069\u7528",
|
|
@@ -1603,6 +1620,7 @@ var translations = {
|
|
|
1603
1620
|
strike: "Strikethrough",
|
|
1604
1621
|
inlineCode: "Inline Code",
|
|
1605
1622
|
underline: "Underline",
|
|
1623
|
+
highlight: "Highlight",
|
|
1606
1624
|
increaseDepth: "Increase Depth",
|
|
1607
1625
|
decreaseDepth: "Decrease Depth",
|
|
1608
1626
|
heading1: "Heading 1",
|
|
@@ -1616,6 +1634,8 @@ var translations = {
|
|
|
1616
1634
|
checkList: "Check List",
|
|
1617
1635
|
list: "List",
|
|
1618
1636
|
linkUrl: "Link URL",
|
|
1637
|
+
linkText: "Link Text",
|
|
1638
|
+
linkTextHint: "Text displayed as the link",
|
|
1619
1639
|
tooltipText: "Tooltip Text",
|
|
1620
1640
|
tooltipHint: "Tooltip shown on mouse hover",
|
|
1621
1641
|
apply: "Apply",
|
|
@@ -1648,7 +1668,7 @@ var getLanguage = () => {
|
|
|
1648
1668
|
if (typeof window !== "undefined" && window.navigator) {
|
|
1649
1669
|
return window.navigator.language.split("-")[0];
|
|
1650
1670
|
}
|
|
1651
|
-
} catch
|
|
1671
|
+
} catch {
|
|
1652
1672
|
}
|
|
1653
1673
|
return "en";
|
|
1654
1674
|
};
|
|
@@ -1680,8 +1700,8 @@ function defined(value) {
|
|
|
1680
1700
|
}
|
|
1681
1701
|
|
|
1682
1702
|
// src/sink/editable/create-decorate.ts
|
|
1683
|
-
function createDecorate(originalFn,
|
|
1684
|
-
const fns =
|
|
1703
|
+
function createDecorate(originalFn, plugins) {
|
|
1704
|
+
const fns = plugins.map((plugin) => plugin.editableProps?.decorate).filter(defined);
|
|
1685
1705
|
return function(entry) {
|
|
1686
1706
|
const ranges = [];
|
|
1687
1707
|
for (const fn of fns) {
|
|
@@ -1697,8 +1717,8 @@ function createDecorate(originalFn, plugins2) {
|
|
|
1697
1717
|
// src/sink/editable/create-editable.tsx
|
|
1698
1718
|
import { Editable } from "slate-react";
|
|
1699
1719
|
import { jsx } from "react/jsx-runtime";
|
|
1700
|
-
function createEditable(
|
|
1701
|
-
const fns =
|
|
1720
|
+
function createEditable(plugins) {
|
|
1721
|
+
const fns = plugins.map((plugin) => plugin.renderEditable).filter(defined);
|
|
1702
1722
|
let CurrentRenderEditable = (props) => /* @__PURE__ */ jsx(Editable, { ...props });
|
|
1703
1723
|
for (const fn of fns) {
|
|
1704
1724
|
const PrevRenderEditable = CurrentRenderEditable;
|
|
@@ -1713,9 +1733,9 @@ function createEditable(plugins2) {
|
|
|
1713
1733
|
}
|
|
1714
1734
|
|
|
1715
1735
|
// src/sink/editable/create-handler.ts
|
|
1716
|
-
function extractEditableFns(
|
|
1736
|
+
function extractEditableFns(plugins, key2) {
|
|
1717
1737
|
const fns = [];
|
|
1718
|
-
for (const plugin of
|
|
1738
|
+
for (const plugin of plugins) {
|
|
1719
1739
|
const maybeFn = plugin.editableProps?.[key2];
|
|
1720
1740
|
if (maybeFn)
|
|
1721
1741
|
fns.push(maybeFn);
|
|
@@ -1731,26 +1751,26 @@ function createHandlerFn(fns, originalFn) {
|
|
|
1731
1751
|
originalFn?.(event);
|
|
1732
1752
|
};
|
|
1733
1753
|
}
|
|
1734
|
-
var createOnKeyDown = (originalFn,
|
|
1735
|
-
const fns = extractEditableFns(
|
|
1754
|
+
var createOnKeyDown = (originalFn, plugins) => {
|
|
1755
|
+
const fns = extractEditableFns(plugins, "onKeyDown");
|
|
1736
1756
|
return createHandlerFn(fns, originalFn);
|
|
1737
1757
|
};
|
|
1738
|
-
var createOnKeyUp = (originalFn,
|
|
1739
|
-
const fns = extractEditableFns(
|
|
1758
|
+
var createOnKeyUp = (originalFn, plugins) => {
|
|
1759
|
+
const fns = extractEditableFns(plugins, "onKeyUp");
|
|
1740
1760
|
return createHandlerFn(fns, originalFn);
|
|
1741
1761
|
};
|
|
1742
|
-
var createOnPaste = (originalFn,
|
|
1743
|
-
const fns = extractEditableFns(
|
|
1762
|
+
var createOnPaste = (originalFn, plugins) => {
|
|
1763
|
+
const fns = extractEditableFns(plugins, "onPaste");
|
|
1744
1764
|
return createHandlerFn(fns, originalFn);
|
|
1745
1765
|
};
|
|
1746
|
-
var createOnDrop = (originalFn,
|
|
1747
|
-
const fns = extractEditableFns(
|
|
1766
|
+
var createOnDrop = (originalFn, plugins) => {
|
|
1767
|
+
const fns = extractEditableFns(plugins, "onDrop");
|
|
1748
1768
|
return createHandlerFn(fns, originalFn);
|
|
1749
1769
|
};
|
|
1750
1770
|
|
|
1751
1771
|
// src/sink/editable/create-render-element.ts
|
|
1752
|
-
function createRenderElement(originalFn,
|
|
1753
|
-
const fns =
|
|
1772
|
+
function createRenderElement(originalFn, plugins) {
|
|
1773
|
+
const fns = plugins.map((plugin) => plugin.editableProps?.renderElement).filter(defined);
|
|
1754
1774
|
return function renderElement5(renderElementProps) {
|
|
1755
1775
|
for (const fn of fns) {
|
|
1756
1776
|
const result = fn(renderElementProps);
|
|
@@ -1768,11 +1788,11 @@ function createRenderElement(originalFn, plugins2) {
|
|
|
1768
1788
|
|
|
1769
1789
|
// src/sink/editable/create-render-leaf.ts
|
|
1770
1790
|
import { cloneElement } from "react";
|
|
1771
|
-
function createRenderLeaf(originalFn,
|
|
1791
|
+
function createRenderLeaf(originalFn, plugins) {
|
|
1772
1792
|
if (originalFn === void 0) {
|
|
1773
1793
|
throw new Error(`renderLeaf was not defined on SinkEditable`);
|
|
1774
1794
|
}
|
|
1775
|
-
const fns =
|
|
1795
|
+
const fns = plugins.map((plugin) => plugin.editableProps?.renderLeaf).filter(defined).reverse();
|
|
1776
1796
|
return function(renderLeafProps) {
|
|
1777
1797
|
let value = originalFn({
|
|
1778
1798
|
...renderLeafProps,
|
|
@@ -1801,10 +1821,10 @@ function createRenderLeaf(originalFn, plugins2) {
|
|
|
1801
1821
|
}
|
|
1802
1822
|
|
|
1803
1823
|
// src/sink/editable/create-render-placeholder.tsx
|
|
1804
|
-
function createRenderPlaceholder(originalFn,
|
|
1824
|
+
function createRenderPlaceholder(originalFn, plugins) {
|
|
1805
1825
|
if (originalFn)
|
|
1806
1826
|
return originalFn;
|
|
1807
|
-
const fns =
|
|
1827
|
+
const fns = plugins.map((plugin) => plugin.editableProps?.renderPlaceholder).filter(defined);
|
|
1808
1828
|
if (fns.length === 0)
|
|
1809
1829
|
return void 0;
|
|
1810
1830
|
return function(renderPlaceholderProps) {
|
|
@@ -1838,16 +1858,16 @@ function SinkEditable(originalProps) {
|
|
|
1838
1858
|
useEffect(() => {
|
|
1839
1859
|
Editor.normalize(editor, { force: true });
|
|
1840
1860
|
}, []);
|
|
1841
|
-
const { plugins
|
|
1861
|
+
const { plugins } = editor.sink;
|
|
1842
1862
|
const nextProps = useMemo(
|
|
1843
1863
|
() => ({
|
|
1844
1864
|
...originalProps,
|
|
1845
|
-
decorate: createDecorate(originalProps.decorate,
|
|
1846
|
-
renderElement: createRenderElement(originalProps.renderElement,
|
|
1847
|
-
renderLeaf: createRenderLeaf(originalProps.renderLeaf,
|
|
1865
|
+
decorate: createDecorate(originalProps.decorate, plugins),
|
|
1866
|
+
renderElement: createRenderElement(originalProps.renderElement, plugins),
|
|
1867
|
+
renderLeaf: createRenderLeaf(originalProps.renderLeaf, plugins),
|
|
1848
1868
|
renderPlaceholder: createRenderPlaceholder(
|
|
1849
1869
|
originalProps.renderPlaceholder,
|
|
1850
|
-
|
|
1870
|
+
plugins
|
|
1851
1871
|
),
|
|
1852
1872
|
/**
|
|
1853
1873
|
* NOTE: We skip `onKeyUp` as it is deprecated. If somebody needs it in new
|
|
@@ -1855,21 +1875,21 @@ function SinkEditable(originalProps) {
|
|
|
1855
1875
|
*
|
|
1856
1876
|
* https://developer.mozilla.org/en-US/docs/Web/API/Element/keypress_event
|
|
1857
1877
|
*/
|
|
1858
|
-
onKeyDown: createOnKeyDown(originalProps.onKeyDown,
|
|
1859
|
-
onKeyUp: createOnKeyUp(originalProps.onKeyUp,
|
|
1860
|
-
onPaste: createOnPaste(originalProps.onPaste,
|
|
1861
|
-
onDrop: createOnDrop(originalProps.onDrop,
|
|
1878
|
+
onKeyDown: createOnKeyDown(originalProps.onKeyDown, plugins),
|
|
1879
|
+
onKeyUp: createOnKeyUp(originalProps.onKeyUp, plugins),
|
|
1880
|
+
onPaste: createOnPaste(originalProps.onPaste, plugins),
|
|
1881
|
+
onDrop: createOnDrop(originalProps.onDrop, plugins)
|
|
1862
1882
|
}),
|
|
1863
1883
|
Object.values(originalProps)
|
|
1864
1884
|
);
|
|
1865
|
-
const NextEditable = useMemo(() => createEditable(
|
|
1885
|
+
const NextEditable = useMemo(() => createEditable(plugins), [plugins]);
|
|
1866
1886
|
return /* @__PURE__ */ jsx2(NextEditable, { ...nextProps });
|
|
1867
1887
|
}
|
|
1868
1888
|
|
|
1869
1889
|
// src/sink/editor/create-boolean-action.ts
|
|
1870
|
-
function createBooleanAction(editor, actionKey,
|
|
1890
|
+
function createBooleanAction(editor, actionKey, plugins) {
|
|
1871
1891
|
const originalAction = editor[actionKey];
|
|
1872
|
-
const actionPlugins =
|
|
1892
|
+
const actionPlugins = plugins.filter((plugin) => plugin.editor?.[actionKey]);
|
|
1873
1893
|
return function nextBooleanAction(node) {
|
|
1874
1894
|
for (const plugin of actionPlugins) {
|
|
1875
1895
|
const result = plugin.editor?.[actionKey]?.(node);
|
|
@@ -1881,9 +1901,9 @@ function createBooleanAction(editor, actionKey, plugins2) {
|
|
|
1881
1901
|
}
|
|
1882
1902
|
|
|
1883
1903
|
// src/sink/editor/create-void-action.ts
|
|
1884
|
-
function createVoidAction(editor, actionKey,
|
|
1904
|
+
function createVoidAction(editor, actionKey, plugins) {
|
|
1885
1905
|
const originalAction = editor[actionKey];
|
|
1886
|
-
const actionPlugins =
|
|
1906
|
+
const actionPlugins = plugins.filter((plugin) => plugin.editor?.[actionKey]);
|
|
1887
1907
|
return function nextVoidAction(...args) {
|
|
1888
1908
|
let isHandled = false;
|
|
1889
1909
|
const afterHandledCallbacks = [];
|
|
@@ -1907,10 +1927,10 @@ function createVoidAction(editor, actionKey, plugins2) {
|
|
|
1907
1927
|
function createWithSink(pluginFns) {
|
|
1908
1928
|
return (originalEditor, options) => {
|
|
1909
1929
|
const editor = originalEditor;
|
|
1910
|
-
const
|
|
1930
|
+
const plugins = pluginFns.map(
|
|
1911
1931
|
(plugin) => plugin(editor, options, { createPolicy: (x) => x })
|
|
1912
1932
|
);
|
|
1913
|
-
editor.sink = { plugins
|
|
1933
|
+
editor.sink = { plugins };
|
|
1914
1934
|
editor.isMaster = "isMaster" in editor ? editor.isMaster : () => false;
|
|
1915
1935
|
editor.isSlave = "isSlave" in editor ? editor.isSlave : () => false;
|
|
1916
1936
|
editor.isStandalone = "isStandalone" in editor ? editor.isStandalone : () => false;
|
|
@@ -1918,22 +1938,22 @@ function createWithSink(pluginFns) {
|
|
|
1918
1938
|
/**
|
|
1919
1939
|
* void
|
|
1920
1940
|
*/
|
|
1921
|
-
normalizeNode: createVoidAction(editor, "normalizeNode",
|
|
1922
|
-
deleteBackward: createVoidAction(editor, "deleteBackward",
|
|
1923
|
-
deleteForward: createVoidAction(editor, "deleteForward",
|
|
1924
|
-
deleteFragment: createVoidAction(editor, "deleteFragment",
|
|
1925
|
-
insertBreak: createVoidAction(editor, "insertBreak",
|
|
1926
|
-
insertFragment: createVoidAction(editor, "insertFragment",
|
|
1927
|
-
insertNode: createVoidAction(editor, "insertNode",
|
|
1928
|
-
insertText: createVoidAction(editor, "insertText",
|
|
1941
|
+
normalizeNode: createVoidAction(editor, "normalizeNode", plugins),
|
|
1942
|
+
deleteBackward: createVoidAction(editor, "deleteBackward", plugins),
|
|
1943
|
+
deleteForward: createVoidAction(editor, "deleteForward", plugins),
|
|
1944
|
+
deleteFragment: createVoidAction(editor, "deleteFragment", plugins),
|
|
1945
|
+
insertBreak: createVoidAction(editor, "insertBreak", plugins),
|
|
1946
|
+
insertFragment: createVoidAction(editor, "insertFragment", plugins),
|
|
1947
|
+
insertNode: createVoidAction(editor, "insertNode", plugins),
|
|
1948
|
+
insertText: createVoidAction(editor, "insertText", plugins),
|
|
1929
1949
|
/**
|
|
1930
1950
|
* boolean
|
|
1931
1951
|
*/
|
|
1932
|
-
isInline: createBooleanAction(editor, "isInline",
|
|
1933
|
-
isVoid: createBooleanAction(editor, "isVoid",
|
|
1934
|
-
isMaster: createBooleanAction(editor, "isMaster",
|
|
1935
|
-
isSlave: createBooleanAction(editor, "isSlave",
|
|
1936
|
-
isStandalone: createBooleanAction(editor, "isStandalone",
|
|
1952
|
+
isInline: createBooleanAction(editor, "isInline", plugins),
|
|
1953
|
+
isVoid: createBooleanAction(editor, "isVoid", plugins),
|
|
1954
|
+
isMaster: createBooleanAction(editor, "isMaster", plugins),
|
|
1955
|
+
isSlave: createBooleanAction(editor, "isSlave", plugins),
|
|
1956
|
+
isStandalone: createBooleanAction(editor, "isStandalone", plugins)
|
|
1937
1957
|
});
|
|
1938
1958
|
return editor;
|
|
1939
1959
|
};
|
|
@@ -2292,18 +2312,31 @@ function isUrl(s) {
|
|
|
2292
2312
|
}
|
|
2293
2313
|
|
|
2294
2314
|
// src/anchor-plugin/methods/editLink.ts
|
|
2295
|
-
import { Transforms as Transforms7 } from "slate";
|
|
2296
|
-
function editLink(editor, { href, title }, { at }) {
|
|
2315
|
+
import { Editor as Editor14, Node as Node4, Transforms as Transforms7 } from "slate";
|
|
2316
|
+
function editLink(editor, { href, title, text }, { at }) {
|
|
2297
2317
|
const link = findElementUp(editor, "anchor", { at });
|
|
2298
2318
|
if (!link)
|
|
2299
2319
|
return false;
|
|
2300
|
-
|
|
2320
|
+
const [element, path] = link;
|
|
2321
|
+
Transforms7.setNodes(editor, { href, title }, { at: path });
|
|
2322
|
+
if (text !== void 0) {
|
|
2323
|
+
const currentText = Node4.string(element);
|
|
2324
|
+
if (text !== currentText) {
|
|
2325
|
+
Editor14.withoutNormalizing(editor, () => {
|
|
2326
|
+
const childCount = element.children.length;
|
|
2327
|
+
for (let i = childCount - 1; i >= 0; i--) {
|
|
2328
|
+
Transforms7.removeNodes(editor, { at: [...path, i] });
|
|
2329
|
+
}
|
|
2330
|
+
Transforms7.insertNodes(editor, { text }, { at: [...path, 0] });
|
|
2331
|
+
});
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2301
2334
|
return true;
|
|
2302
2335
|
}
|
|
2303
2336
|
|
|
2304
2337
|
// src/anchor-plugin/methods/insertLink.ts
|
|
2305
2338
|
import { Editor as Editor15, Range as Range3, Text as Text2, Transforms as Transforms8 } from "slate";
|
|
2306
|
-
function insertLink(editor, href, text = href, { select = true } = {}) {
|
|
2339
|
+
function insertLink(editor, href, text = href, { select = true, title } = {}) {
|
|
2307
2340
|
const selection = editor.selection || {
|
|
2308
2341
|
anchor: Editor15.start(editor, [0]),
|
|
2309
2342
|
focus: Editor15.start(editor, [0])
|
|
@@ -2314,6 +2347,7 @@ function insertLink(editor, href, text = href, { select = true } = {}) {
|
|
|
2314
2347
|
{
|
|
2315
2348
|
type: "anchor",
|
|
2316
2349
|
href,
|
|
2350
|
+
title,
|
|
2317
2351
|
children: [{ text }]
|
|
2318
2352
|
},
|
|
2319
2353
|
{ select, at: selection }
|
|
@@ -2325,7 +2359,7 @@ function insertLink(editor, href, text = href, { select = true } = {}) {
|
|
|
2325
2359
|
} else {
|
|
2326
2360
|
Transforms8.wrapNodes(
|
|
2327
2361
|
editor,
|
|
2328
|
-
{ type: "anchor", href, children: [] },
|
|
2362
|
+
{ type: "anchor", href, title, children: [] },
|
|
2329
2363
|
{
|
|
2330
2364
|
split: true,
|
|
2331
2365
|
match: (node) => Text2.isText(node) || Editor15.isInline(editor, node)
|
|
@@ -3158,6 +3192,7 @@ function useTooltip({
|
|
|
3158
3192
|
// src/anchor-plugin/render-element/AnchorEditDialog.tsx
|
|
3159
3193
|
import styled13 from "@emotion/styled";
|
|
3160
3194
|
import { useCallback as useCallback3, useRef as useRef3, useState as useState3 } from "react";
|
|
3195
|
+
import { Node as Node6 } from "slate";
|
|
3161
3196
|
import { useSlateStatic as useSlateStatic3 } from "slate-react";
|
|
3162
3197
|
|
|
3163
3198
|
// src/shared-styles/index.ts
|
|
@@ -3273,12 +3308,16 @@ function AnchorEditDialog({
|
|
|
3273
3308
|
);
|
|
3274
3309
|
const editor = useSlateStatic3();
|
|
3275
3310
|
const [href, setHref] = useState3(element.href);
|
|
3311
|
+
const [text, setText] = useState3(Node6.string(element));
|
|
3276
3312
|
const [title, setTitle] = useState3(element.title || "");
|
|
3277
|
-
const formRef = useRef3({ href, title });
|
|
3278
|
-
formRef.current = { href, title };
|
|
3313
|
+
const formRef = useRef3({ href, text, title });
|
|
3314
|
+
formRef.current = { href, text, title };
|
|
3279
3315
|
const handleHrefChange = useCallback3((e) => {
|
|
3280
3316
|
setHref(e.target.value);
|
|
3281
3317
|
}, []);
|
|
3318
|
+
const handleTextChange = useCallback3((e) => {
|
|
3319
|
+
setText(e.target.value);
|
|
3320
|
+
}, []);
|
|
3282
3321
|
const handleTitleChange = useCallback3((e) => {
|
|
3283
3322
|
setTitle(e.target.value);
|
|
3284
3323
|
}, []);
|
|
@@ -3293,14 +3332,19 @@ function AnchorEditDialog({
|
|
|
3293
3332
|
));
|
|
3294
3333
|
}, [destAnchor, destStartEdge, element]);
|
|
3295
3334
|
const handleSubmit = useCallback3(() => {
|
|
3296
|
-
const { href: href2, title: title2 } = formRef.current;
|
|
3297
|
-
editor.anchor.editLink({ href: href2, title: title2 }, { at: element });
|
|
3335
|
+
const { href: href2, text: text2, title: title2 } = formRef.current;
|
|
3336
|
+
editor.anchor.editLink({ href: href2, text: text2, title: title2 }, { at: element });
|
|
3298
3337
|
openAnchorDialog();
|
|
3299
3338
|
}, [openAnchorDialog]);
|
|
3300
3339
|
return /* @__PURE__ */ jsxs5($AnchorEditDialog, { contentEditable: false, style, children: [
|
|
3301
3340
|
/* @__PURE__ */ jsxs5($FormGroup, { children: [
|
|
3302
3341
|
/* @__PURE__ */ jsx11($FormCaption, { children: t("linkUrl") }),
|
|
3303
|
-
/* @__PURE__ */ jsx11($
|
|
3342
|
+
/* @__PURE__ */ jsx11($Input, { type: "text", value: href, onChange: handleHrefChange })
|
|
3343
|
+
] }),
|
|
3344
|
+
/* @__PURE__ */ jsxs5($FormGroup, { children: [
|
|
3345
|
+
/* @__PURE__ */ jsx11($FormCaption, { children: t("linkText") }),
|
|
3346
|
+
/* @__PURE__ */ jsx11($Input, { type: "text", value: text, onChange: handleTextChange }),
|
|
3347
|
+
/* @__PURE__ */ jsx11($FormHint, { children: t("linkTextHint") })
|
|
3304
3348
|
] }),
|
|
3305
3349
|
/* @__PURE__ */ jsxs5($FormGroup, { children: [
|
|
3306
3350
|
/* @__PURE__ */ jsx11($FormCaption, { children: t("tooltipText") }),
|
|
@@ -3409,7 +3453,7 @@ function parseUrl2(s) {
|
|
|
3409
3453
|
try {
|
|
3410
3454
|
const url = new URL(s);
|
|
3411
3455
|
return { hostname: url.hostname, pathname: url.pathname };
|
|
3412
|
-
} catch
|
|
3456
|
+
} catch {
|
|
3413
3457
|
return { hostname: "", pathname: "" };
|
|
3414
3458
|
}
|
|
3415
3459
|
}
|
|
@@ -4604,16 +4648,14 @@ function createOnDrop2(editor) {
|
|
|
4604
4648
|
Transforms17.select(editor, range);
|
|
4605
4649
|
}
|
|
4606
4650
|
const onImageChange = editor.wysimark?.onImageChange;
|
|
4607
|
-
|
|
4651
|
+
for (const file of imageFiles) {
|
|
4608
4652
|
if (onImageChange) {
|
|
4609
|
-
|
|
4610
|
-
const url = await onImageChange(file);
|
|
4653
|
+
onImageChange(file).then((url) => {
|
|
4611
4654
|
if (url) {
|
|
4612
4655
|
editor.image.insertImageFromUrl(url, file.name, "");
|
|
4613
4656
|
}
|
|
4614
|
-
}
|
|
4615
|
-
|
|
4616
|
-
}
|
|
4657
|
+
}).catch(() => {
|
|
4658
|
+
});
|
|
4617
4659
|
} else {
|
|
4618
4660
|
const reader = new FileReader();
|
|
4619
4661
|
reader.onload = () => {
|
|
@@ -4622,7 +4664,7 @@ function createOnDrop2(editor) {
|
|
|
4622
4664
|
};
|
|
4623
4665
|
reader.readAsDataURL(file);
|
|
4624
4666
|
}
|
|
4625
|
-
}
|
|
4667
|
+
}
|
|
4626
4668
|
return true;
|
|
4627
4669
|
};
|
|
4628
4670
|
}
|
|
@@ -4861,7 +4903,7 @@ import { Editor as Editor28, Element as Element15, Transforms as Transforms21 }
|
|
|
4861
4903
|
|
|
4862
4904
|
// src/code-block-plugin/decorate.tsx
|
|
4863
4905
|
import Prism from "prismjs";
|
|
4864
|
-
import { Element as Element12, Node as
|
|
4906
|
+
import { Element as Element12, Node as Node8 } from "slate";
|
|
4865
4907
|
var { languages, tokenize } = Prism;
|
|
4866
4908
|
function getLineOffsets(lines) {
|
|
4867
4909
|
let offset = 0;
|
|
@@ -4882,7 +4924,7 @@ function decorate(nodeEntry) {
|
|
|
4882
4924
|
if (lang === void 0)
|
|
4883
4925
|
return [];
|
|
4884
4926
|
const codeLineElements = node.children;
|
|
4885
|
-
const textLines = codeLineElements.map((node2) => `${
|
|
4927
|
+
const textLines = codeLineElements.map((node2) => `${Node8.string(node2)}
|
|
4886
4928
|
`);
|
|
4887
4929
|
const text = textLines.join("");
|
|
4888
4930
|
const lineOffsets = getLineOffsets(textLines);
|
|
@@ -4992,24 +5034,13 @@ var tokenStyles = {
|
|
|
4992
5034
|
italic: italicStyle
|
|
4993
5035
|
};
|
|
4994
5036
|
|
|
4995
|
-
// src/code-block-plugin/types.tsx
|
|
4996
|
-
var LanguageList = [
|
|
4997
|
-
"text",
|
|
4998
|
-
"html",
|
|
4999
|
-
"css",
|
|
5000
|
-
"svg",
|
|
5001
|
-
"javascript",
|
|
5002
|
-
"java",
|
|
5003
|
-
"c"
|
|
5004
|
-
];
|
|
5005
|
-
|
|
5006
5037
|
// src/code-block-plugin/normalizeNode.tsx
|
|
5007
|
-
import { Element as Element14, Node as
|
|
5038
|
+
import { Element as Element14, Node as Node9, Transforms as Transforms20 } from "slate";
|
|
5008
5039
|
function normalizeNode3(editor, entry) {
|
|
5009
5040
|
if (!Element14.isElement(entry[0]))
|
|
5010
5041
|
return false;
|
|
5011
5042
|
if (entry[0].type === "code-block-line") {
|
|
5012
|
-
for (const [child, path] of
|
|
5043
|
+
for (const [child, path] of Node9.children(editor, entry[1])) {
|
|
5013
5044
|
if (!Element14.isElement(child))
|
|
5014
5045
|
continue;
|
|
5015
5046
|
if (editor.isVoid(child)) {
|
|
@@ -5022,7 +5053,7 @@ function normalizeNode3(editor, entry) {
|
|
|
5022
5053
|
}
|
|
5023
5054
|
}
|
|
5024
5055
|
if (entry[0].type === "code-block") {
|
|
5025
|
-
for (const [child, path] of
|
|
5056
|
+
for (const [child, path] of Node9.children(editor, entry[1])) {
|
|
5026
5057
|
if (!Element14.isElement(child))
|
|
5027
5058
|
continue;
|
|
5028
5059
|
if (child.type === "code-block-line")
|
|
@@ -5037,7 +5068,7 @@ function normalizeNode3(editor, entry) {
|
|
|
5037
5068
|
Transforms20.removeNodes(editor, { at: path });
|
|
5038
5069
|
Transforms20.insertNodes(editor, {
|
|
5039
5070
|
type: "code-block-line",
|
|
5040
|
-
children: [{ text:
|
|
5071
|
+
children: [{ text: Node9.string(child) }]
|
|
5041
5072
|
});
|
|
5042
5073
|
return true;
|
|
5043
5074
|
}
|
|
@@ -5047,12 +5078,8 @@ function normalizeNode3(editor, entry) {
|
|
|
5047
5078
|
}
|
|
5048
5079
|
|
|
5049
5080
|
// src/code-block-plugin/render-element/CodeBlock.tsx
|
|
5050
|
-
import { useCallback as useCallback9,
|
|
5051
|
-
import { useSelected as useSelected3 } from "slate-react";
|
|
5052
|
-
|
|
5053
|
-
// src/code-block-plugin/icons/ChevronDownIcon.tsx
|
|
5054
|
-
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
5055
|
-
var ChevronDownIcon = (props) => /* @__PURE__ */ jsx29(TablerIcon, { ...props, children: /* @__PURE__ */ jsx29("path", { d: "m6 9 6 6 6-6" }) });
|
|
5081
|
+
import { useCallback as useCallback9, useState as useState5 } from "react";
|
|
5082
|
+
import { useSelected as useSelected3, useSlateStatic as useSlateStatic11 } from "slate-react";
|
|
5056
5083
|
|
|
5057
5084
|
// src/code-block-plugin/styles.ts
|
|
5058
5085
|
import styled23 from "@emotion/styled";
|
|
@@ -5134,50 +5161,70 @@ var $CodeBlockLine = styled23("div")`
|
|
|
5134
5161
|
`;
|
|
5135
5162
|
|
|
5136
5163
|
// src/code-block-plugin/render-element/CodeBlock.tsx
|
|
5137
|
-
import { jsx as
|
|
5164
|
+
import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5138
5165
|
function CodeBlock({
|
|
5139
5166
|
element,
|
|
5140
5167
|
attributes,
|
|
5141
5168
|
children
|
|
5142
5169
|
}) {
|
|
5143
|
-
const
|
|
5170
|
+
const editor = useSlateStatic11();
|
|
5144
5171
|
const selected = useSelected3();
|
|
5145
|
-
const
|
|
5146
|
-
const
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5172
|
+
const [isEditing, setIsEditing] = useState5(false);
|
|
5173
|
+
const [inputValue, setInputValue] = useState5(element.language);
|
|
5174
|
+
const handleClick = useCallback9(() => {
|
|
5175
|
+
setInputValue(element.language);
|
|
5176
|
+
setIsEditing(true);
|
|
5177
|
+
}, [element.language]);
|
|
5178
|
+
const handleBlur = useCallback9(() => {
|
|
5179
|
+
setIsEditing(false);
|
|
5180
|
+
if (inputValue !== element.language) {
|
|
5181
|
+
editor.codeBlock.setCodeBlockLanguage(inputValue || "text", { at: element });
|
|
5182
|
+
}
|
|
5183
|
+
}, [editor, element, inputValue]);
|
|
5184
|
+
const handleKeyDown = useCallback9((e) => {
|
|
5185
|
+
if (e.key === "Enter") {
|
|
5186
|
+
e.preventDefault();
|
|
5187
|
+
e.target.blur();
|
|
5188
|
+
} else if (e.key === "Escape") {
|
|
5189
|
+
setInputValue(element.language);
|
|
5190
|
+
setIsEditing(false);
|
|
5191
|
+
}
|
|
5192
|
+
}, [element.language]);
|
|
5163
5193
|
return /* @__PURE__ */ jsxs16($CodeBlock, { className: selected ? "--selected" : "", ...attributes, children: [
|
|
5164
|
-
/* @__PURE__ */
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5194
|
+
/* @__PURE__ */ jsx29($CodeBlockLanguage, { contentEditable: false, children: isEditing ? /* @__PURE__ */ jsx29(
|
|
5195
|
+
"input",
|
|
5196
|
+
{
|
|
5197
|
+
type: "text",
|
|
5198
|
+
value: inputValue,
|
|
5199
|
+
onChange: (e) => setInputValue(e.target.value),
|
|
5200
|
+
onBlur: handleBlur,
|
|
5201
|
+
onKeyDown: handleKeyDown,
|
|
5202
|
+
autoFocus: true,
|
|
5203
|
+
style: {
|
|
5204
|
+
width: "100%",
|
|
5205
|
+
border: "none",
|
|
5206
|
+
background: "transparent",
|
|
5207
|
+
font: "inherit",
|
|
5208
|
+
color: "inherit",
|
|
5209
|
+
padding: 0,
|
|
5210
|
+
outline: "none",
|
|
5211
|
+
textAlign: "right"
|
|
5212
|
+
}
|
|
5213
|
+
}
|
|
5214
|
+
) : /* @__PURE__ */ jsx29("span", { onClick: handleClick, style: { cursor: "pointer", width: "100%" }, children: element.language || "text" }) }),
|
|
5215
|
+
/* @__PURE__ */ jsx29($CodeBlockScroller, { children })
|
|
5169
5216
|
] });
|
|
5170
5217
|
}
|
|
5171
5218
|
|
|
5172
5219
|
// src/code-block-plugin/render-element/CodeBlockLine.tsx
|
|
5173
5220
|
import { useSelected as useSelected4 } from "slate-react";
|
|
5174
|
-
import { jsx as
|
|
5221
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
5175
5222
|
function CodeBlockLine({
|
|
5176
5223
|
attributes,
|
|
5177
5224
|
children
|
|
5178
5225
|
}) {
|
|
5179
5226
|
const selected = useSelected4();
|
|
5180
|
-
return /* @__PURE__ */
|
|
5227
|
+
return /* @__PURE__ */ jsx30(
|
|
5181
5228
|
$CodeBlockLine,
|
|
5182
5229
|
{
|
|
5183
5230
|
className: selected ? "--selected" : "",
|
|
@@ -5189,21 +5236,21 @@ function CodeBlockLine({
|
|
|
5189
5236
|
}
|
|
5190
5237
|
|
|
5191
5238
|
// src/code-block-plugin/render-element/index.tsx
|
|
5192
|
-
import { jsx as
|
|
5239
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
5193
5240
|
function renderElement2({
|
|
5194
5241
|
element,
|
|
5195
5242
|
attributes,
|
|
5196
5243
|
children
|
|
5197
5244
|
}) {
|
|
5198
5245
|
if (element.type === "code-block") {
|
|
5199
|
-
return /* @__PURE__ */
|
|
5246
|
+
return /* @__PURE__ */ jsx31(CodeBlock, { element, attributes, children });
|
|
5200
5247
|
} else if (element.type === "code-block-line") {
|
|
5201
|
-
return /* @__PURE__ */
|
|
5248
|
+
return /* @__PURE__ */ jsx31(CodeBlockLine, { element, attributes, children });
|
|
5202
5249
|
}
|
|
5203
5250
|
}
|
|
5204
5251
|
|
|
5205
5252
|
// src/code-block-plugin/index.tsx
|
|
5206
|
-
import { jsx as
|
|
5253
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
5207
5254
|
var CodeBlockPlugin = createPlugin(
|
|
5208
5255
|
(editor, _options, { createPolicy }) => {
|
|
5209
5256
|
editor.codeBlock = createCodeBlockMethods(editor);
|
|
@@ -5261,7 +5308,98 @@ var CodeBlockPlugin = createPlugin(
|
|
|
5261
5308
|
if (style === null) {
|
|
5262
5309
|
return children;
|
|
5263
5310
|
} else {
|
|
5264
|
-
return /* @__PURE__ */
|
|
5311
|
+
return /* @__PURE__ */ jsx32("span", { style, children });
|
|
5312
|
+
}
|
|
5313
|
+
}
|
|
5314
|
+
}
|
|
5315
|
+
});
|
|
5316
|
+
}
|
|
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 });
|
|
5265
5403
|
}
|
|
5266
5404
|
}
|
|
5267
5405
|
}
|
|
@@ -5276,7 +5414,7 @@ import { Editor as Editor32 } from "slate";
|
|
|
5276
5414
|
import { Element as Element18 } from "slate";
|
|
5277
5415
|
|
|
5278
5416
|
// src/collapsible-paragraph-plugin/normalize-node/normalize-sibling-paragraphs.ts
|
|
5279
|
-
import { Element as Element16, Transforms as
|
|
5417
|
+
import { Element as Element16, Transforms as Transforms23 } from "slate";
|
|
5280
5418
|
function isParagraph(node) {
|
|
5281
5419
|
return Element16.isElement(node) && node.type === "paragraph";
|
|
5282
5420
|
}
|
|
@@ -5285,7 +5423,7 @@ function normalizeSiblingParagraphs(editor, entry) {
|
|
|
5285
5423
|
if (!isParagraph(a[0]) || !isParagraph(b[0]))
|
|
5286
5424
|
return false;
|
|
5287
5425
|
if (a[0].__collapsible && b[0].__collapsible) {
|
|
5288
|
-
|
|
5426
|
+
Transforms23.removeNodes(editor, { at: a[1] });
|
|
5289
5427
|
return true;
|
|
5290
5428
|
}
|
|
5291
5429
|
return false;
|
|
@@ -5293,7 +5431,7 @@ function normalizeSiblingParagraphs(editor, entry) {
|
|
|
5293
5431
|
}
|
|
5294
5432
|
|
|
5295
5433
|
// src/collapsible-paragraph-plugin/normalize-node/normalize-sibling-walls.ts
|
|
5296
|
-
import { Element as Element17, Transforms as
|
|
5434
|
+
import { Element as Element17, Transforms as Transforms24 } from "slate";
|
|
5297
5435
|
function isWall(editor, node) {
|
|
5298
5436
|
if (!Element17.isElement(node))
|
|
5299
5437
|
return false;
|
|
@@ -5305,7 +5443,7 @@ function normalizeSiblingWalls(editor, entry) {
|
|
|
5305
5443
|
return normalizeSiblings(editor, entry, (a, b) => {
|
|
5306
5444
|
if (!isWall(editor, a[0]) || !isWall(editor, b[0]))
|
|
5307
5445
|
return false;
|
|
5308
|
-
|
|
5446
|
+
Transforms24.insertNodes(
|
|
5309
5447
|
editor,
|
|
5310
5448
|
{
|
|
5311
5449
|
type: "paragraph",
|
|
@@ -5335,10 +5473,10 @@ import { clsx as clsx5 } from "clsx";
|
|
|
5335
5473
|
import { useSelected as useSelected5 } from "slate-react";
|
|
5336
5474
|
|
|
5337
5475
|
// src/collapsible-paragraph-plugin/render-element/styles.ts
|
|
5338
|
-
import
|
|
5339
|
-
var $Paragraph =
|
|
5476
|
+
import styled25 from "@emotion/styled";
|
|
5477
|
+
var $Paragraph = styled25("p")`
|
|
5340
5478
|
padding: 0;
|
|
5341
|
-
margin:
|
|
5479
|
+
margin: 0;
|
|
5342
5480
|
&:first-child {
|
|
5343
5481
|
margin-top: 0;
|
|
5344
5482
|
}
|
|
@@ -5348,8 +5486,8 @@ var $Paragraph = styled24("p")`
|
|
|
5348
5486
|
|
|
5349
5487
|
&.--collapsible&.--empty {
|
|
5350
5488
|
font-size: 0.25em; /* font-size is collapsed to 1/4 of regular em */
|
|
5351
|
-
margin: -4em 0;
|
|
5352
|
-
padding: 1em 0; /* this is kind of eye-balling it */
|
|
5489
|
+
margin: -0.4em 0;
|
|
5490
|
+
padding: 0.1em 0; /* this is kind of eye-balling it */
|
|
5353
5491
|
border-radius: 1em;
|
|
5354
5492
|
&:hover {
|
|
5355
5493
|
background: rgba(0, 127, 255, 0.1);
|
|
@@ -5359,7 +5497,7 @@ var $Paragraph = styled24("p")`
|
|
|
5359
5497
|
&.--collapsible&.--empty&.--selected {
|
|
5360
5498
|
font-size: 1em;
|
|
5361
5499
|
padding: 0;
|
|
5362
|
-
margin:
|
|
5500
|
+
margin: 0;
|
|
5363
5501
|
&:hover {
|
|
5364
5502
|
background: none;
|
|
5365
5503
|
cursor: default;
|
|
@@ -5369,13 +5507,13 @@ var $Paragraph = styled24("p")`
|
|
|
5369
5507
|
`;
|
|
5370
5508
|
|
|
5371
5509
|
// src/collapsible-paragraph-plugin/render-element/utils.ts
|
|
5372
|
-
import { Node as
|
|
5510
|
+
import { Node as Node12 } from "slate";
|
|
5373
5511
|
function getIsEmpty(element) {
|
|
5374
|
-
return element.children.length === 1 &&
|
|
5512
|
+
return element.children.length === 1 && Node12.string(element.children[0]).length === 0;
|
|
5375
5513
|
}
|
|
5376
5514
|
|
|
5377
5515
|
// src/collapsible-paragraph-plugin/render-element/paragraph.tsx
|
|
5378
|
-
import { jsx as
|
|
5516
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
5379
5517
|
function Paragraph({
|
|
5380
5518
|
element,
|
|
5381
5519
|
attributes,
|
|
@@ -5383,7 +5521,7 @@ function Paragraph({
|
|
|
5383
5521
|
}) {
|
|
5384
5522
|
const selected = useSelected5();
|
|
5385
5523
|
const isEmpty = getIsEmpty(element);
|
|
5386
|
-
return /* @__PURE__ */
|
|
5524
|
+
return /* @__PURE__ */ jsx35(
|
|
5387
5525
|
$Paragraph,
|
|
5388
5526
|
{
|
|
5389
5527
|
...attributes,
|
|
@@ -5398,14 +5536,19 @@ function Paragraph({
|
|
|
5398
5536
|
}
|
|
5399
5537
|
|
|
5400
5538
|
// src/collapsible-paragraph-plugin/index.tsx
|
|
5401
|
-
import { jsx as
|
|
5539
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
5402
5540
|
var CollapsibleParagraphPlugin = createPlugin((editor) => {
|
|
5403
5541
|
const { insertBreak: insertBreak3 } = editor;
|
|
5404
5542
|
editor.insertBreak = () => {
|
|
5405
5543
|
const { selection } = editor;
|
|
5406
5544
|
if (selection && selection.anchor.path[0] === selection.focus.path[0]) {
|
|
5407
|
-
const
|
|
5408
|
-
|
|
5545
|
+
const blockPath = [selection.anchor.path[0]];
|
|
5546
|
+
const blockStart = Editor32.start(editor, blockPath);
|
|
5547
|
+
const textBeforeCursor = Editor32.string(editor, {
|
|
5548
|
+
anchor: blockStart,
|
|
5549
|
+
focus: selection.anchor
|
|
5550
|
+
});
|
|
5551
|
+
if (textBeforeCursor.endsWith("\n")) {
|
|
5409
5552
|
insertBreak3();
|
|
5410
5553
|
} else {
|
|
5411
5554
|
editor.insertText("\n");
|
|
@@ -5440,7 +5583,7 @@ var CollapsibleParagraphPlugin = createPlugin((editor) => {
|
|
|
5440
5583
|
renderElement: ({ element, attributes, children }) => {
|
|
5441
5584
|
switch (element.type) {
|
|
5442
5585
|
case "paragraph": {
|
|
5443
|
-
return /* @__PURE__ */
|
|
5586
|
+
return /* @__PURE__ */ jsx36(Paragraph, { element, attributes, children });
|
|
5444
5587
|
}
|
|
5445
5588
|
}
|
|
5446
5589
|
},
|
|
@@ -5461,13 +5604,51 @@ function addConvertElementType(editor, type) {
|
|
|
5461
5604
|
}
|
|
5462
5605
|
|
|
5463
5606
|
// src/convert-element-plugin/methods/convert-elements.ts
|
|
5464
|
-
import { Editor as Editor33, Element as Element20, Node as
|
|
5607
|
+
import { Editor as Editor33, Element as Element20, Node as Node13, Point, Range as Range5, Transforms as Transforms25 } from "slate";
|
|
5608
|
+
function getOffsetInElement(editor, point, elementPath) {
|
|
5609
|
+
try {
|
|
5610
|
+
const elementStart = Editor33.start(editor, elementPath);
|
|
5611
|
+
const elementEnd = Editor33.end(editor, elementPath);
|
|
5612
|
+
if (Point.isBefore(point, elementStart) || Point.isAfter(point, elementEnd)) {
|
|
5613
|
+
return -1;
|
|
5614
|
+
}
|
|
5615
|
+
const range = { anchor: elementStart, focus: point };
|
|
5616
|
+
return Editor33.string(editor, range).length;
|
|
5617
|
+
} catch {
|
|
5618
|
+
return -1;
|
|
5619
|
+
}
|
|
5620
|
+
}
|
|
5621
|
+
function restoreSelectionInElement(editor, elementPath, offset) {
|
|
5622
|
+
try {
|
|
5623
|
+
const element = Node13.get(editor, elementPath);
|
|
5624
|
+
if (!Element20.isElement(element))
|
|
5625
|
+
return;
|
|
5626
|
+
const text = Node13.string(element);
|
|
5627
|
+
const safeOffset = Math.min(offset, text.length);
|
|
5628
|
+
const elementStart = Editor33.start(editor, elementPath);
|
|
5629
|
+
let currentOffset = 0;
|
|
5630
|
+
let targetPath = elementStart.path;
|
|
5631
|
+
let targetOffset = 0;
|
|
5632
|
+
for (const [node, path] of Node13.texts(element)) {
|
|
5633
|
+
const nodeLength = node.text.length;
|
|
5634
|
+
if (currentOffset + nodeLength >= safeOffset) {
|
|
5635
|
+
targetPath = [...elementPath, ...path];
|
|
5636
|
+
targetOffset = safeOffset - currentOffset;
|
|
5637
|
+
break;
|
|
5638
|
+
}
|
|
5639
|
+
currentOffset += nodeLength;
|
|
5640
|
+
}
|
|
5641
|
+
const point = { path: targetPath, offset: targetOffset };
|
|
5642
|
+
Transforms25.select(editor, { anchor: point, focus: point });
|
|
5643
|
+
} catch {
|
|
5644
|
+
}
|
|
5645
|
+
}
|
|
5465
5646
|
function elementContainsNewlines(element) {
|
|
5466
|
-
const text =
|
|
5647
|
+
const text = Node13.string(element);
|
|
5467
5648
|
return text.includes("\n");
|
|
5468
5649
|
}
|
|
5469
5650
|
function getSelectedLineIndices(editor, element, elementPath, selection) {
|
|
5470
|
-
const text =
|
|
5651
|
+
const text = Node13.string(element);
|
|
5471
5652
|
const lines = text.split("\n");
|
|
5472
5653
|
const elementStart = Editor33.start(editor, elementPath);
|
|
5473
5654
|
const elementEnd = Editor33.end(editor, elementPath);
|
|
@@ -5500,7 +5681,7 @@ function getSelectedLineIndices(editor, element, elementPath, selection) {
|
|
|
5500
5681
|
return { startLineIndex, endLineIndex };
|
|
5501
5682
|
}
|
|
5502
5683
|
function splitElementAtSelectedLines(editor, element, path, selection) {
|
|
5503
|
-
const text =
|
|
5684
|
+
const text = Node13.string(element);
|
|
5504
5685
|
if (!text.includes("\n")) {
|
|
5505
5686
|
return path;
|
|
5506
5687
|
}
|
|
@@ -5529,16 +5710,16 @@ function splitElementAtSelectedLines(editor, element, path, selection) {
|
|
|
5529
5710
|
...element,
|
|
5530
5711
|
children: [{ text: afterText }]
|
|
5531
5712
|
};
|
|
5532
|
-
|
|
5713
|
+
Transforms25.insertNodes(editor, afterElement, {
|
|
5533
5714
|
at: [...basePath, baseIndex + 1]
|
|
5534
5715
|
});
|
|
5535
5716
|
}
|
|
5536
5717
|
const childrenCount = element.children.length;
|
|
5537
5718
|
for (let j = childrenCount - 1; j >= 0; j--) {
|
|
5538
|
-
|
|
5719
|
+
Transforms25.removeNodes(editor, { at: [...path, j] });
|
|
5539
5720
|
}
|
|
5540
5721
|
if (beforeLines.length > 0) {
|
|
5541
|
-
|
|
5722
|
+
Transforms25.insertNodes(
|
|
5542
5723
|
editor,
|
|
5543
5724
|
{ text: beforeLines.join("\n") },
|
|
5544
5725
|
{ at: [...path, 0] }
|
|
@@ -5548,11 +5729,11 @@ function splitElementAtSelectedLines(editor, element, path, selection) {
|
|
|
5548
5729
|
type: "paragraph",
|
|
5549
5730
|
children: [{ text: selectedText }]
|
|
5550
5731
|
};
|
|
5551
|
-
|
|
5732
|
+
Transforms25.insertNodes(editor, selectedElement, {
|
|
5552
5733
|
at: [...basePath, baseIndex + 1]
|
|
5553
5734
|
});
|
|
5554
5735
|
} else {
|
|
5555
|
-
|
|
5736
|
+
Transforms25.insertNodes(
|
|
5556
5737
|
editor,
|
|
5557
5738
|
{ text: selectedLines.join("\n") },
|
|
5558
5739
|
{ at: [...path, 0] }
|
|
@@ -5575,6 +5756,14 @@ function convertElements(editor, matchForToggle, targetElement, allowToggle) {
|
|
|
5575
5756
|
);
|
|
5576
5757
|
if (entries.length === 0)
|
|
5577
5758
|
return false;
|
|
5759
|
+
let savedAnchorOffset = -1;
|
|
5760
|
+
let savedFocusOffset = -1;
|
|
5761
|
+
let isCollapsed2 = Range5.isCollapsed(selection);
|
|
5762
|
+
if (entries.length > 0) {
|
|
5763
|
+
const [, firstPath] = entries[0];
|
|
5764
|
+
savedAnchorOffset = getOffsetInElement(editor, selection.anchor, firstPath);
|
|
5765
|
+
savedFocusOffset = getOffsetInElement(editor, selection.focus, firstPath);
|
|
5766
|
+
}
|
|
5578
5767
|
const allPaths = [];
|
|
5579
5768
|
Editor33.withoutNormalizing(editor, () => {
|
|
5580
5769
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
@@ -5594,7 +5783,7 @@ function convertElements(editor, matchForToggle, targetElement, allowToggle) {
|
|
|
5594
5783
|
});
|
|
5595
5784
|
const updatedEntries = allPaths.map((path) => {
|
|
5596
5785
|
try {
|
|
5597
|
-
const node =
|
|
5786
|
+
const node = Node13.get(editor, path);
|
|
5598
5787
|
if (Element20.isElement(node)) {
|
|
5599
5788
|
return [node, path];
|
|
5600
5789
|
}
|
|
@@ -5619,6 +5808,52 @@ function convertElements(editor, matchForToggle, targetElement, allowToggle) {
|
|
|
5619
5808
|
}
|
|
5620
5809
|
});
|
|
5621
5810
|
}
|
|
5811
|
+
if (updatedEntries.length > 0 && savedAnchorOffset >= 0) {
|
|
5812
|
+
const [, firstPath] = updatedEntries[0];
|
|
5813
|
+
if (isCollapsed2) {
|
|
5814
|
+
restoreSelectionInElement(editor, firstPath, savedAnchorOffset);
|
|
5815
|
+
} else if (savedFocusOffset >= 0) {
|
|
5816
|
+
try {
|
|
5817
|
+
const element = Node13.get(editor, firstPath);
|
|
5818
|
+
if (Element20.isElement(element)) {
|
|
5819
|
+
const text = Node13.string(element);
|
|
5820
|
+
const safeAnchorOffset = Math.min(savedAnchorOffset, text.length);
|
|
5821
|
+
const safeFocusOffset = Math.min(savedFocusOffset, text.length);
|
|
5822
|
+
const elementStart = Editor33.start(editor, firstPath);
|
|
5823
|
+
let anchorPath = elementStart.path;
|
|
5824
|
+
let anchorOffset = safeAnchorOffset;
|
|
5825
|
+
let currentOffset = 0;
|
|
5826
|
+
for (const [node, path] of Node13.texts(element)) {
|
|
5827
|
+
const nodeLength = node.text.length;
|
|
5828
|
+
if (currentOffset + nodeLength >= safeAnchorOffset) {
|
|
5829
|
+
anchorPath = [...firstPath, ...path];
|
|
5830
|
+
anchorOffset = safeAnchorOffset - currentOffset;
|
|
5831
|
+
break;
|
|
5832
|
+
}
|
|
5833
|
+
currentOffset += nodeLength;
|
|
5834
|
+
}
|
|
5835
|
+
let focusPath = elementStart.path;
|
|
5836
|
+
let focusOffset = safeFocusOffset;
|
|
5837
|
+
currentOffset = 0;
|
|
5838
|
+
for (const [node, path] of Node13.texts(element)) {
|
|
5839
|
+
const nodeLength = node.text.length;
|
|
5840
|
+
if (currentOffset + nodeLength >= safeFocusOffset) {
|
|
5841
|
+
focusPath = [...firstPath, ...path];
|
|
5842
|
+
focusOffset = safeFocusOffset - currentOffset;
|
|
5843
|
+
break;
|
|
5844
|
+
}
|
|
5845
|
+
currentOffset += nodeLength;
|
|
5846
|
+
}
|
|
5847
|
+
Transforms25.select(editor, {
|
|
5848
|
+
anchor: { path: anchorPath, offset: anchorOffset },
|
|
5849
|
+
focus: { path: focusPath, offset: focusOffset }
|
|
5850
|
+
});
|
|
5851
|
+
}
|
|
5852
|
+
} catch {
|
|
5853
|
+
restoreSelectionInElement(editor, firstPath, savedAnchorOffset);
|
|
5854
|
+
}
|
|
5855
|
+
}
|
|
5856
|
+
}
|
|
5622
5857
|
return true;
|
|
5623
5858
|
}
|
|
5624
5859
|
|
|
@@ -5649,7 +5884,7 @@ var ConvertElementPlugin = createPlugin((editor) => {
|
|
|
5649
5884
|
});
|
|
5650
5885
|
|
|
5651
5886
|
// src/heading-plugin/insert-break.ts
|
|
5652
|
-
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";
|
|
5653
5888
|
function insertBreak(editor) {
|
|
5654
5889
|
const entry = findElementUp(editor, "heading");
|
|
5655
5890
|
if (!entry)
|
|
@@ -5661,12 +5896,12 @@ function insertBreak(editor) {
|
|
|
5661
5896
|
if (!Editor34.isEnd(editor, editor.selection.anchor, entry[1]))
|
|
5662
5897
|
return false;
|
|
5663
5898
|
const nextPath = Path9.next(entry[1]);
|
|
5664
|
-
|
|
5899
|
+
Transforms26.insertNodes(
|
|
5665
5900
|
editor,
|
|
5666
5901
|
{ type: "paragraph", children: [{ text: "" }] },
|
|
5667
5902
|
{ at: nextPath }
|
|
5668
5903
|
);
|
|
5669
|
-
|
|
5904
|
+
Transforms26.select(editor, {
|
|
5670
5905
|
anchor: Editor34.start(editor, nextPath),
|
|
5671
5906
|
focus: Editor34.start(editor, nextPath)
|
|
5672
5907
|
});
|
|
@@ -5699,7 +5934,7 @@ function createHeadingMethods(editor) {
|
|
|
5699
5934
|
|
|
5700
5935
|
// src/heading-plugin/styles.ts
|
|
5701
5936
|
import { css } from "@emotion/react";
|
|
5702
|
-
import
|
|
5937
|
+
import styled26 from "@emotion/styled";
|
|
5703
5938
|
var headingStyles = css`
|
|
5704
5939
|
margin-top: 1em;
|
|
5705
5940
|
&:first-child {
|
|
@@ -5707,34 +5942,34 @@ var headingStyles = css`
|
|
|
5707
5942
|
}
|
|
5708
5943
|
font-weight: bold;
|
|
5709
5944
|
`;
|
|
5710
|
-
var $H1 =
|
|
5945
|
+
var $H1 = styled26("h1")`
|
|
5711
5946
|
${headingStyles}
|
|
5712
5947
|
font-size: 2.25em;
|
|
5713
5948
|
letter-spacing: -0.01em;
|
|
5714
5949
|
`;
|
|
5715
|
-
var $H2 =
|
|
5950
|
+
var $H2 = styled26("h2")`
|
|
5716
5951
|
${headingStyles}
|
|
5717
5952
|
font-size: 1.5em;
|
|
5718
5953
|
`;
|
|
5719
|
-
var $H3 =
|
|
5954
|
+
var $H3 = styled26("h3")`
|
|
5720
5955
|
${headingStyles}
|
|
5721
5956
|
font-size: 1.25em;
|
|
5722
5957
|
`;
|
|
5723
|
-
var $H4 =
|
|
5958
|
+
var $H4 = styled26("h4")`
|
|
5724
5959
|
${headingStyles}
|
|
5725
5960
|
font-size: 1em;
|
|
5726
5961
|
`;
|
|
5727
|
-
var $H5 =
|
|
5962
|
+
var $H5 = styled26("h5")`
|
|
5728
5963
|
${headingStyles}
|
|
5729
5964
|
font-size: 1em;
|
|
5730
5965
|
`;
|
|
5731
|
-
var $H6 =
|
|
5966
|
+
var $H6 = styled26("h6")`
|
|
5732
5967
|
${headingStyles}
|
|
5733
5968
|
font-size: 1em;
|
|
5734
5969
|
`;
|
|
5735
5970
|
|
|
5736
5971
|
// src/heading-plugin/index.tsx
|
|
5737
|
-
import { jsx as
|
|
5972
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
5738
5973
|
var HeadingPlugin = createPlugin(
|
|
5739
5974
|
(editor) => {
|
|
5740
5975
|
editor.convertElement.addConvertElementType("heading");
|
|
@@ -5765,21 +6000,23 @@ var HeadingPlugin = createPlugin(
|
|
|
5765
6000
|
if (element.type === "heading") {
|
|
5766
6001
|
switch (element.level) {
|
|
5767
6002
|
case 1:
|
|
5768
|
-
return /* @__PURE__ */
|
|
6003
|
+
return /* @__PURE__ */ jsx37($H1, { ...attributes, children });
|
|
5769
6004
|
case 2:
|
|
5770
|
-
return /* @__PURE__ */
|
|
6005
|
+
return /* @__PURE__ */ jsx37($H2, { ...attributes, children });
|
|
5771
6006
|
case 3:
|
|
5772
|
-
return /* @__PURE__ */
|
|
6007
|
+
return /* @__PURE__ */ jsx37($H3, { ...attributes, children });
|
|
5773
6008
|
case 4:
|
|
5774
|
-
return /* @__PURE__ */
|
|
6009
|
+
return /* @__PURE__ */ jsx37($H4, { ...attributes, children });
|
|
5775
6010
|
case 5:
|
|
5776
|
-
return /* @__PURE__ */
|
|
6011
|
+
return /* @__PURE__ */ jsx37($H5, { ...attributes, children });
|
|
5777
6012
|
case 6:
|
|
5778
|
-
return /* @__PURE__ */
|
|
5779
|
-
default:
|
|
6013
|
+
return /* @__PURE__ */ jsx37($H6, { ...attributes, children });
|
|
6014
|
+
default: {
|
|
6015
|
+
const exhaustiveCheck = element.level;
|
|
5780
6016
|
throw new Error(
|
|
5781
|
-
`Expected element.level to be 1-6 but got ${
|
|
6017
|
+
`Expected element.level to be 1-6 but got ${exhaustiveCheck}`
|
|
5782
6018
|
);
|
|
6019
|
+
}
|
|
5783
6020
|
}
|
|
5784
6021
|
}
|
|
5785
6022
|
},
|
|
@@ -5799,8 +6036,8 @@ var HeadingPlugin = createPlugin(
|
|
|
5799
6036
|
import { useSelected as useSelected6 } from "slate-react";
|
|
5800
6037
|
|
|
5801
6038
|
// src/horizontal-rule-plugin/styles.tsx
|
|
5802
|
-
import
|
|
5803
|
-
var $HorizontalRule =
|
|
6039
|
+
import styled27 from "@emotion/styled";
|
|
6040
|
+
var $HorizontalRule = styled27("hr")`
|
|
5804
6041
|
position: relative;
|
|
5805
6042
|
height: 1em;
|
|
5806
6043
|
/* background-color: var(--hr-color); */
|
|
@@ -5833,15 +6070,15 @@ var $HorizontalRule = styled26("hr")`
|
|
|
5833
6070
|
`;
|
|
5834
6071
|
|
|
5835
6072
|
// src/horizontal-rule-plugin/horizontal-rule.tsx
|
|
5836
|
-
import { jsx as
|
|
6073
|
+
import { jsx as jsx38, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5837
6074
|
function HorizontalRule({
|
|
5838
6075
|
attributes,
|
|
5839
6076
|
children
|
|
5840
6077
|
}) {
|
|
5841
6078
|
const selected = useSelected6();
|
|
5842
|
-
return /* @__PURE__ */
|
|
6079
|
+
return /* @__PURE__ */ jsxs18("div", { ...attributes, draggable: true, children: [
|
|
5843
6080
|
children,
|
|
5844
|
-
/* @__PURE__ */
|
|
6081
|
+
/* @__PURE__ */ jsx38("div", { contentEditable: false, children: /* @__PURE__ */ jsx38($HorizontalRule, { className: selected ? "--selected" : "" }) })
|
|
5845
6082
|
] });
|
|
5846
6083
|
}
|
|
5847
6084
|
|
|
@@ -5859,7 +6096,7 @@ function createHorizontalRuleMethods(editor) {
|
|
|
5859
6096
|
}
|
|
5860
6097
|
|
|
5861
6098
|
// src/horizontal-rule-plugin/index.tsx
|
|
5862
|
-
import { jsx as
|
|
6099
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
5863
6100
|
var HorizontalRulePlugin = createPlugin(
|
|
5864
6101
|
(editor, _options, { createPolicy }) => {
|
|
5865
6102
|
editor.horizontalRule = createHorizontalRuleMethods(editor);
|
|
@@ -5874,7 +6111,7 @@ var HorizontalRulePlugin = createPlugin(
|
|
|
5874
6111
|
editableProps: {
|
|
5875
6112
|
renderElement: (props) => {
|
|
5876
6113
|
if (props.element.type === "horizontal-rule") {
|
|
5877
|
-
return /* @__PURE__ */
|
|
6114
|
+
return /* @__PURE__ */ jsx39(HorizontalRule, { ...props });
|
|
5878
6115
|
}
|
|
5879
6116
|
},
|
|
5880
6117
|
onKeyDown: createHotkeyHandler({
|
|
@@ -5886,8 +6123,8 @@ var HorizontalRulePlugin = createPlugin(
|
|
|
5886
6123
|
);
|
|
5887
6124
|
|
|
5888
6125
|
// src/inline-code-plugin/styles.ts
|
|
5889
|
-
import
|
|
5890
|
-
var $InlineCode =
|
|
6126
|
+
import styled28 from "@emotion/styled";
|
|
6127
|
+
var $InlineCode = styled28("code")`
|
|
5891
6128
|
color: var(--shade-600);
|
|
5892
6129
|
background-color: var(--inline-code-bgcolor);
|
|
5893
6130
|
border: 1px solid var(--inline-code-border-color);
|
|
@@ -5909,7 +6146,7 @@ var $InlineCode = styled27("code")`
|
|
|
5909
6146
|
font-size: 0.75em;
|
|
5910
6147
|
vertical-align: baseline;
|
|
5911
6148
|
`;
|
|
5912
|
-
var $InvisibleSpan =
|
|
6149
|
+
var $InvisibleSpan = styled28("span")`
|
|
5913
6150
|
display: inline-block;
|
|
5914
6151
|
opacity: 0;
|
|
5915
6152
|
width: 1px;
|
|
@@ -5917,7 +6154,7 @@ var $InvisibleSpan = styled27("span")`
|
|
|
5917
6154
|
`;
|
|
5918
6155
|
|
|
5919
6156
|
// src/inline-code-plugin/index.tsx
|
|
5920
|
-
import { jsx as
|
|
6157
|
+
import { jsx as jsx40, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5921
6158
|
var InlineCodePlugin = createPlugin(
|
|
5922
6159
|
(editor) => {
|
|
5923
6160
|
if (!editor.marksPlugin)
|
|
@@ -5936,10 +6173,10 @@ var InlineCodePlugin = createPlugin(
|
|
|
5936
6173
|
/**
|
|
5937
6174
|
* Disable spellCheck because it's computer code usually.
|
|
5938
6175
|
*/
|
|
5939
|
-
/* @__PURE__ */
|
|
5940
|
-
/* @__PURE__ */
|
|
6176
|
+
/* @__PURE__ */ jsxs19($InlineCode, { spellCheck: false, children: [
|
|
6177
|
+
/* @__PURE__ */ jsx40($InvisibleSpan, { contentEditable: false, children: "|" }),
|
|
5941
6178
|
children,
|
|
5942
|
-
/* @__PURE__ */
|
|
6179
|
+
/* @__PURE__ */ jsx40($InvisibleSpan, { contentEditable: false, children: "|" })
|
|
5943
6180
|
] })
|
|
5944
6181
|
);
|
|
5945
6182
|
} else {
|
|
@@ -6039,7 +6276,7 @@ function indent(editor) {
|
|
|
6039
6276
|
}
|
|
6040
6277
|
|
|
6041
6278
|
// src/list-plugin/methods/insert-break.ts
|
|
6042
|
-
import { Editor as Editor36, Transforms as
|
|
6279
|
+
import { Editor as Editor36, Transforms as Transforms27 } from "slate";
|
|
6043
6280
|
function insertBreak2(editor) {
|
|
6044
6281
|
const entry = findElementUp(editor, isListItem);
|
|
6045
6282
|
if (!entry)
|
|
@@ -6047,19 +6284,19 @@ function insertBreak2(editor) {
|
|
|
6047
6284
|
const [element, path] = entry;
|
|
6048
6285
|
if (Editor36.isEmpty(editor, element)) {
|
|
6049
6286
|
if (element.depth > 0) {
|
|
6050
|
-
|
|
6287
|
+
Transforms27.setNodes(editor, { depth: element.depth - 1 }, { at: path });
|
|
6051
6288
|
return true;
|
|
6052
6289
|
} else {
|
|
6053
6290
|
rewrapElement(editor, { type: "paragraph" }, path);
|
|
6054
6291
|
return true;
|
|
6055
6292
|
}
|
|
6056
6293
|
}
|
|
6057
|
-
|
|
6294
|
+
Transforms27.splitNodes(editor, { always: true });
|
|
6058
6295
|
const nextEntry = findElementUp(editor, isListItem);
|
|
6059
6296
|
if (!nextEntry)
|
|
6060
6297
|
return true;
|
|
6061
6298
|
if (nextEntry[0].type === "task-list-item" && nextEntry[0].checked === true) {
|
|
6062
|
-
|
|
6299
|
+
Transforms27.setNodes(editor, { checked: false }, { at: nextEntry[1] });
|
|
6063
6300
|
}
|
|
6064
6301
|
return true;
|
|
6065
6302
|
}
|
|
@@ -6086,7 +6323,7 @@ function outdent(editor) {
|
|
|
6086
6323
|
}
|
|
6087
6324
|
|
|
6088
6325
|
// src/list-plugin/methods/toggleTaskListItem.ts
|
|
6089
|
-
import { Transforms as
|
|
6326
|
+
import { Transforms as Transforms28 } from "slate";
|
|
6090
6327
|
function toggleTaskListItem(editor, { at = editor.selection } = {}) {
|
|
6091
6328
|
const taskListItem = findElementUp(
|
|
6092
6329
|
editor,
|
|
@@ -6096,7 +6333,7 @@ function toggleTaskListItem(editor, { at = editor.selection } = {}) {
|
|
|
6096
6333
|
if (!taskListItem)
|
|
6097
6334
|
return false;
|
|
6098
6335
|
const nextChecked = !taskListItem[0].checked;
|
|
6099
|
-
|
|
6336
|
+
Transforms28.setNodes(
|
|
6100
6337
|
editor,
|
|
6101
6338
|
{ checked: nextChecked },
|
|
6102
6339
|
{ at: taskListItem[1] }
|
|
@@ -6122,7 +6359,7 @@ function createListMethods(editor) {
|
|
|
6122
6359
|
}
|
|
6123
6360
|
|
|
6124
6361
|
// src/list-plugin/normalize-node/normalize-ordered-first-at-depth.ts
|
|
6125
|
-
import { Element as Element21, Transforms as
|
|
6362
|
+
import { Element as Element21, Transforms as Transforms29 } from "slate";
|
|
6126
6363
|
var isOrderedListItem = createIsElementType([
|
|
6127
6364
|
"ordered-list-item"
|
|
6128
6365
|
]);
|
|
@@ -6135,7 +6372,7 @@ function normalizeOrderedFirstAtDepth(editor, entry) {
|
|
|
6135
6372
|
return false;
|
|
6136
6373
|
const __firstAtDepth = isOrderedListItem(a[0]) ? b[0].depth > a[0].depth : isListItem(a[0]) ? b[0].depth > a[0].depth : true;
|
|
6137
6374
|
if (b[0].__firstAtDepth !== __firstAtDepth) {
|
|
6138
|
-
|
|
6375
|
+
Transforms29.setNodes(editor, { __firstAtDepth }, { at: b[1] });
|
|
6139
6376
|
return true;
|
|
6140
6377
|
}
|
|
6141
6378
|
return false;
|
|
@@ -6153,17 +6390,16 @@ function normalizeNode5(editor, entry) {
|
|
|
6153
6390
|
// src/list-plugin/render-element/ordered-list-item.tsx
|
|
6154
6391
|
import { clsx as clsx6 } from "clsx";
|
|
6155
6392
|
import { useEffect as useEffect5 } from "react";
|
|
6156
|
-
import { ReactEditor as ReactEditor10, useSlateStatic as
|
|
6393
|
+
import { ReactEditor as ReactEditor10, useSlateStatic as useSlateStatic12 } from "slate-react";
|
|
6157
6394
|
|
|
6158
6395
|
// src/list-plugin/render-element/styles.ts
|
|
6159
|
-
import
|
|
6160
|
-
var $ListItem =
|
|
6396
|
+
import styled29 from "@emotion/styled";
|
|
6397
|
+
var $ListItem = styled29("li")`
|
|
6161
6398
|
margin-top: 0.5em;
|
|
6162
6399
|
margin-bottom: 0.5em;
|
|
6163
6400
|
list-style-position: outside;
|
|
6164
|
-
margin-left: calc(2em + var(--list-item-depth) * 2em);
|
|
6165
6401
|
`;
|
|
6166
|
-
var $UnorderedListItem =
|
|
6402
|
+
var $UnorderedListItem = styled29($ListItem)`
|
|
6167
6403
|
position: relative;
|
|
6168
6404
|
list-style-type: none;
|
|
6169
6405
|
.--list-item-icon {
|
|
@@ -6174,7 +6410,7 @@ var $UnorderedListItem = styled28($ListItem)`
|
|
|
6174
6410
|
color: var(--shade-600);
|
|
6175
6411
|
}
|
|
6176
6412
|
`;
|
|
6177
|
-
var $OrderedListItem =
|
|
6413
|
+
var $OrderedListItem = styled29($ListItem)`
|
|
6178
6414
|
position: relative;
|
|
6179
6415
|
list-style-type: none;
|
|
6180
6416
|
counter-increment: var(--list-item-var);
|
|
@@ -6200,7 +6436,7 @@ var $OrderedListItem = styled28($ListItem)`
|
|
|
6200
6436
|
font-variant-numeric: tabular-nums;
|
|
6201
6437
|
}
|
|
6202
6438
|
`;
|
|
6203
|
-
var $TaskListItem =
|
|
6439
|
+
var $TaskListItem = styled29($ListItem)`
|
|
6204
6440
|
position: relative;
|
|
6205
6441
|
list-style-type: none;
|
|
6206
6442
|
.--list-item-icon {
|
|
@@ -6217,32 +6453,32 @@ var $TaskListItem = styled28($ListItem)`
|
|
|
6217
6453
|
`;
|
|
6218
6454
|
|
|
6219
6455
|
// src/list-plugin/render-element/ordered-list-item.tsx
|
|
6220
|
-
import { jsx as
|
|
6456
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
6221
6457
|
function OrderedListItem({
|
|
6222
6458
|
element,
|
|
6223
6459
|
attributes,
|
|
6224
6460
|
children
|
|
6225
6461
|
}) {
|
|
6226
|
-
const editor =
|
|
6462
|
+
const editor = useSlateStatic12();
|
|
6227
6463
|
useEffect5(() => {
|
|
6228
6464
|
const path = ReactEditor10.findPath(editor, element);
|
|
6229
6465
|
normalizeOrderedFirstAtDepth(editor, [element, path]);
|
|
6230
6466
|
}, []);
|
|
6231
6467
|
const style = {
|
|
6232
|
-
|
|
6468
|
+
marginLeft: `${2 + element.depth * 2}em`,
|
|
6233
6469
|
"--list-item-var": `list-item-depth-${element.depth}`
|
|
6234
6470
|
};
|
|
6235
6471
|
const className = clsx6({ "--first-at-depth": element.__firstAtDepth });
|
|
6236
|
-
return /* @__PURE__ */
|
|
6472
|
+
return /* @__PURE__ */ jsx41($OrderedListItem, { ...attributes, className, style, children });
|
|
6237
6473
|
}
|
|
6238
6474
|
|
|
6239
6475
|
// src/list-plugin/render-element/task-list-item.tsx
|
|
6240
6476
|
import { useCallback as useCallback10 } from "react";
|
|
6241
|
-
import { useSlateStatic as
|
|
6477
|
+
import { useSlateStatic as useSlateStatic13 } from "slate-react";
|
|
6242
6478
|
|
|
6243
6479
|
// src/list-plugin/render-element/list-icons.tsx
|
|
6244
|
-
import { jsx as
|
|
6245
|
-
var UncheckedIcon = (props) => /* @__PURE__ */
|
|
6480
|
+
import { jsx as jsx42, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6481
|
+
var UncheckedIcon = (props) => /* @__PURE__ */ jsxs20(
|
|
6246
6482
|
"svg",
|
|
6247
6483
|
{
|
|
6248
6484
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6256,12 +6492,12 @@ var UncheckedIcon = (props) => /* @__PURE__ */ jsxs19(
|
|
|
6256
6492
|
viewBox: "0 0 24 24",
|
|
6257
6493
|
...props,
|
|
6258
6494
|
children: [
|
|
6259
|
-
/* @__PURE__ */
|
|
6260
|
-
/* @__PURE__ */
|
|
6495
|
+
/* @__PURE__ */ jsx42("path", { d: "M0 0h24v24H0z", stroke: "none" }),
|
|
6496
|
+
/* @__PURE__ */ jsx42("rect", { x: 4, y: 4, width: 16, height: 16, rx: 2 })
|
|
6261
6497
|
]
|
|
6262
6498
|
}
|
|
6263
6499
|
);
|
|
6264
|
-
var CheckedIcon = (props) => /* @__PURE__ */
|
|
6500
|
+
var CheckedIcon = (props) => /* @__PURE__ */ jsxs20(
|
|
6265
6501
|
"svg",
|
|
6266
6502
|
{
|
|
6267
6503
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6276,13 +6512,13 @@ var CheckedIcon = (props) => /* @__PURE__ */ jsxs19(
|
|
|
6276
6512
|
viewBox: "0 0 24 24",
|
|
6277
6513
|
...props,
|
|
6278
6514
|
children: [
|
|
6279
|
-
/* @__PURE__ */
|
|
6280
|
-
/* @__PURE__ */
|
|
6281
|
-
/* @__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" })
|
|
6282
6518
|
]
|
|
6283
6519
|
}
|
|
6284
6520
|
);
|
|
6285
|
-
var BulletIcon = (props) => /* @__PURE__ */
|
|
6521
|
+
var BulletIcon = (props) => /* @__PURE__ */ jsx42(
|
|
6286
6522
|
"svg",
|
|
6287
6523
|
{
|
|
6288
6524
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6291,44 +6527,44 @@ var BulletIcon = (props) => /* @__PURE__ */ jsx41(
|
|
|
6291
6527
|
width: "1em",
|
|
6292
6528
|
height: "1em",
|
|
6293
6529
|
...props,
|
|
6294
|
-
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" })
|
|
6295
6531
|
}
|
|
6296
6532
|
);
|
|
6297
6533
|
|
|
6298
6534
|
// src/list-plugin/render-element/task-list-item.tsx
|
|
6299
|
-
import { jsx as
|
|
6535
|
+
import { jsx as jsx43, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6300
6536
|
function TaskListItem({
|
|
6301
6537
|
element,
|
|
6302
6538
|
attributes,
|
|
6303
6539
|
children
|
|
6304
6540
|
}) {
|
|
6305
|
-
const editor =
|
|
6541
|
+
const editor = useSlateStatic13();
|
|
6306
6542
|
const toggle = useCallback10(() => {
|
|
6307
6543
|
editor.list.toggleTaskListItem({ at: element });
|
|
6308
6544
|
}, [editor, element]);
|
|
6309
|
-
const
|
|
6310
|
-
return /* @__PURE__ */
|
|
6311
|
-
/* @__PURE__ */
|
|
6545
|
+
const marginLeft = `${2 + element.depth * 2}em`;
|
|
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" } }) }),
|
|
6312
6548
|
children
|
|
6313
6549
|
] });
|
|
6314
6550
|
}
|
|
6315
6551
|
|
|
6316
6552
|
// src/list-plugin/render-element/unordered-list-item.tsx
|
|
6317
|
-
import { jsx as
|
|
6553
|
+
import { jsx as jsx44, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6318
6554
|
function UnorderedListItem({
|
|
6319
6555
|
element,
|
|
6320
6556
|
attributes,
|
|
6321
6557
|
children
|
|
6322
6558
|
}) {
|
|
6323
|
-
const
|
|
6324
|
-
return /* @__PURE__ */
|
|
6325
|
-
/* @__PURE__ */
|
|
6559
|
+
const marginLeft = `${2 + element.depth * 2}em`;
|
|
6560
|
+
return /* @__PURE__ */ jsxs22($UnorderedListItem, { ...attributes, style: { marginLeft }, children: [
|
|
6561
|
+
/* @__PURE__ */ jsx44("div", { className: "--list-item-icon", contentEditable: false, children: /* @__PURE__ */ jsx44(BulletIcon, {}) }),
|
|
6326
6562
|
children
|
|
6327
6563
|
] });
|
|
6328
6564
|
}
|
|
6329
6565
|
|
|
6330
6566
|
// src/list-plugin/render-element/index.tsx
|
|
6331
|
-
import { jsx as
|
|
6567
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
6332
6568
|
function renderElement3({
|
|
6333
6569
|
element,
|
|
6334
6570
|
attributes,
|
|
@@ -6336,11 +6572,11 @@ function renderElement3({
|
|
|
6336
6572
|
}) {
|
|
6337
6573
|
switch (element.type) {
|
|
6338
6574
|
case "ordered-list-item":
|
|
6339
|
-
return /* @__PURE__ */
|
|
6575
|
+
return /* @__PURE__ */ jsx45(OrderedListItem, { element, attributes, children });
|
|
6340
6576
|
case "unordered-list-item":
|
|
6341
|
-
return /* @__PURE__ */
|
|
6577
|
+
return /* @__PURE__ */ jsx45(UnorderedListItem, { element, attributes, children });
|
|
6342
6578
|
case "task-list-item":
|
|
6343
|
-
return /* @__PURE__ */
|
|
6579
|
+
return /* @__PURE__ */ jsx45(TaskListItem, { element, attributes, children });
|
|
6344
6580
|
}
|
|
6345
6581
|
}
|
|
6346
6582
|
|
|
@@ -6405,7 +6641,7 @@ import { clsx as clsx7 } from "clsx";
|
|
|
6405
6641
|
import { Editor as Editor43, Point as Point3, Range as Range8 } from "slate";
|
|
6406
6642
|
|
|
6407
6643
|
// src/marks-plugin/methods/removeMarks.ts
|
|
6408
|
-
import { Editor as Editor41, Text as Text4, Transforms as
|
|
6644
|
+
import { Editor as Editor41, Text as Text4, Transforms as Transforms30 } from "slate";
|
|
6409
6645
|
function removeMarks(editor, { at = editor.selection } = {}) {
|
|
6410
6646
|
if (at == null)
|
|
6411
6647
|
return;
|
|
@@ -6423,7 +6659,7 @@ function removeMarks(editor, { at = editor.selection } = {}) {
|
|
|
6423
6659
|
setter[key2] = null;
|
|
6424
6660
|
}
|
|
6425
6661
|
}
|
|
6426
|
-
|
|
6662
|
+
Transforms30.setNodes(editor, setter, {
|
|
6427
6663
|
match: (n) => Text4.isText(n),
|
|
6428
6664
|
split: true,
|
|
6429
6665
|
at
|
|
@@ -6469,13 +6705,14 @@ function createMarksMethods(editor) {
|
|
|
6469
6705
|
toggleBold: () => toggleMark(editor, "bold"),
|
|
6470
6706
|
toggleItalic: () => toggleMark(editor, "italic"),
|
|
6471
6707
|
toggleUnderline: () => toggleMark(editor, "underline"),
|
|
6472
|
-
toggleStrike: () => toggleMark(editor, "strike")
|
|
6708
|
+
toggleStrike: () => toggleMark(editor, "strike"),
|
|
6709
|
+
toggleHighlight: () => toggleMark(editor, "highlight")
|
|
6473
6710
|
};
|
|
6474
6711
|
}
|
|
6475
6712
|
|
|
6476
6713
|
// src/marks-plugin/styles.tsx
|
|
6477
|
-
import
|
|
6478
|
-
var $MarksSpan =
|
|
6714
|
+
import styled30 from "@emotion/styled";
|
|
6715
|
+
var $MarksSpan = styled30("span")`
|
|
6479
6716
|
&.--bold {
|
|
6480
6717
|
font-weight: bold;
|
|
6481
6718
|
}
|
|
@@ -6495,10 +6732,13 @@ var $MarksSpan = styled29("span")`
|
|
|
6495
6732
|
&.--underline.--strike {
|
|
6496
6733
|
text-decoration: underline line-through;
|
|
6497
6734
|
}
|
|
6735
|
+
&.--highlight {
|
|
6736
|
+
background-color: #ffeb3b;
|
|
6737
|
+
}
|
|
6498
6738
|
`;
|
|
6499
6739
|
|
|
6500
6740
|
// src/marks-plugin/index.tsx
|
|
6501
|
-
import { jsx as
|
|
6741
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
6502
6742
|
var MarksPlugin = createPlugin((editor) => {
|
|
6503
6743
|
editor.marksPlugin = createMarksMethods(editor);
|
|
6504
6744
|
editor.activeMarks = {};
|
|
@@ -6538,14 +6778,15 @@ var MarksPlugin = createPlugin((editor) => {
|
|
|
6538
6778
|
name: "marks",
|
|
6539
6779
|
editableProps: {
|
|
6540
6780
|
renderLeaf: ({ leaf, children }) => {
|
|
6541
|
-
return /* @__PURE__ */
|
|
6781
|
+
return /* @__PURE__ */ jsx46(
|
|
6542
6782
|
$MarksSpan,
|
|
6543
6783
|
{
|
|
6544
6784
|
className: clsx7({
|
|
6545
6785
|
"--bold": leaf.bold,
|
|
6546
6786
|
"--italic": leaf.italic,
|
|
6547
6787
|
"--underline": leaf.underline,
|
|
6548
|
-
"--strike": leaf.strike
|
|
6788
|
+
"--strike": leaf.strike,
|
|
6789
|
+
"--highlight": leaf.highlight
|
|
6549
6790
|
}),
|
|
6550
6791
|
children
|
|
6551
6792
|
}
|
|
@@ -6610,7 +6851,7 @@ var NormalizeAfterDeletePlugin = createPlugin((editor) => {
|
|
|
6610
6851
|
import { Element as Element23 } from "slate";
|
|
6611
6852
|
|
|
6612
6853
|
// src/table-plugin/delete-fragment/index.ts
|
|
6613
|
-
import { Editor as Editor46, Path as Path12, Transforms as
|
|
6854
|
+
import { Editor as Editor46, Path as Path12, Transforms as Transforms32 } from "slate";
|
|
6614
6855
|
|
|
6615
6856
|
// src/table-plugin/delete-fragment/get-reversed-delete-safe-ranges.ts
|
|
6616
6857
|
import { Editor as Editor45, Path as Path11 } from "slate";
|
|
@@ -6665,15 +6906,15 @@ function deleteFragmentWithProtectedTypes(editor, protectedTypes) {
|
|
|
6665
6906
|
);
|
|
6666
6907
|
Editor46.withoutNormalizing(editor, () => {
|
|
6667
6908
|
for (const range of reversedRanges) {
|
|
6668
|
-
|
|
6909
|
+
Transforms32.delete(editor, { at: range });
|
|
6669
6910
|
}
|
|
6670
|
-
|
|
6911
|
+
Transforms32.collapse(editor, { edge: "start" });
|
|
6671
6912
|
});
|
|
6672
6913
|
return true;
|
|
6673
6914
|
}
|
|
6674
6915
|
|
|
6675
6916
|
// src/table-plugin/methods/index.ts
|
|
6676
|
-
import { Transforms as
|
|
6917
|
+
import { Transforms as Transforms41 } from "slate";
|
|
6677
6918
|
|
|
6678
6919
|
// src/table-plugin/methods/get-table-info.ts
|
|
6679
6920
|
function getTableInfo(editor, { at = editor.selection } = {}) {
|
|
@@ -6711,7 +6952,7 @@ function getTableInfo(editor, { at = editor.selection } = {}) {
|
|
|
6711
6952
|
}
|
|
6712
6953
|
|
|
6713
6954
|
// src/table-plugin/methods/insert-column.ts
|
|
6714
|
-
import { Editor as Editor47, Transforms as
|
|
6955
|
+
import { Editor as Editor47, Transforms as Transforms33 } from "slate";
|
|
6715
6956
|
|
|
6716
6957
|
// src/table-plugin/methods/utils.ts
|
|
6717
6958
|
function createCell(index, children = [
|
|
@@ -6737,9 +6978,9 @@ function insertColumn(editor, { offset = 0, at = editor.selection } = {}) {
|
|
|
6737
6978
|
const { columns } = tableElement;
|
|
6738
6979
|
const nextColumns = [...columns];
|
|
6739
6980
|
nextColumns.splice(nextCellIndex, 0, columns[nextCellIndex]);
|
|
6740
|
-
|
|
6981
|
+
Transforms33.setNodes(editor, { columns: nextColumns }, { at: tablePath });
|
|
6741
6982
|
tableElement.children.forEach((rowElement, i) => {
|
|
6742
|
-
|
|
6983
|
+
Transforms33.insertNodes(editor, createCell(nextCellIndex), {
|
|
6743
6984
|
at: [...tablePath, i, nextCellIndex]
|
|
6744
6985
|
});
|
|
6745
6986
|
});
|
|
@@ -6748,7 +6989,7 @@ function insertColumn(editor, { offset = 0, at = editor.selection } = {}) {
|
|
|
6748
6989
|
}
|
|
6749
6990
|
|
|
6750
6991
|
// src/table-plugin/methods/insert-row.ts
|
|
6751
|
-
import { Transforms as
|
|
6992
|
+
import { Transforms as Transforms34 } from "slate";
|
|
6752
6993
|
function createRow(columnCount) {
|
|
6753
6994
|
return {
|
|
6754
6995
|
type: "table-row",
|
|
@@ -6760,7 +7001,7 @@ function insertRow(editor, { at = editor.selection, offset = 0 } = {}) {
|
|
|
6760
7001
|
if (!t2)
|
|
6761
7002
|
return false;
|
|
6762
7003
|
const nextRowElement = createRow(t2.tableElement.columns.length);
|
|
6763
|
-
|
|
7004
|
+
Transforms34.insertNodes(editor, nextRowElement, {
|
|
6764
7005
|
at: [...t2.tablePath, t2.rowIndex + offset]
|
|
6765
7006
|
});
|
|
6766
7007
|
return true;
|
|
@@ -6770,7 +7011,7 @@ function insertRowBelow(editor, { at } = {}) {
|
|
|
6770
7011
|
}
|
|
6771
7012
|
|
|
6772
7013
|
// src/table-plugin/methods/insert-table.ts
|
|
6773
|
-
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";
|
|
6774
7015
|
function createRange(size) {
|
|
6775
7016
|
return [...Array(size).keys()];
|
|
6776
7017
|
}
|
|
@@ -6804,17 +7045,17 @@ function insertRootElement2(editor, element, { at = editor.selection } = {}) {
|
|
|
6804
7045
|
if (entry == null) {
|
|
6805
7046
|
const selection = editor.selection;
|
|
6806
7047
|
Editor49.withoutNormalizing(editor, () => {
|
|
6807
|
-
|
|
7048
|
+
Transforms35.insertNodes(editor, element, { at });
|
|
6808
7049
|
if (selection) {
|
|
6809
|
-
|
|
6810
|
-
|
|
7050
|
+
Transforms35.select(editor, selection);
|
|
7051
|
+
Transforms35.move(editor);
|
|
6811
7052
|
}
|
|
6812
7053
|
});
|
|
6813
7054
|
} else {
|
|
6814
7055
|
const nextPath = Path13.next(entry[1]);
|
|
6815
7056
|
Editor49.withoutNormalizing(editor, () => {
|
|
6816
|
-
|
|
6817
|
-
|
|
7057
|
+
Transforms35.insertNodes(editor, element, { at: nextPath });
|
|
7058
|
+
Transforms35.select(editor, Editor49.start(editor, nextPath));
|
|
6818
7059
|
});
|
|
6819
7060
|
}
|
|
6820
7061
|
return true;
|
|
@@ -6894,15 +7135,15 @@ function up(editor) {
|
|
|
6894
7135
|
}
|
|
6895
7136
|
|
|
6896
7137
|
// src/table-plugin/methods/remove-column.ts
|
|
6897
|
-
import { Editor as Editor52, Transforms as
|
|
7138
|
+
import { Editor as Editor52, Transforms as Transforms37 } from "slate";
|
|
6898
7139
|
|
|
6899
7140
|
// src/table-plugin/methods/remove-table.ts
|
|
6900
|
-
import { Transforms as
|
|
7141
|
+
import { Transforms as Transforms36 } from "slate";
|
|
6901
7142
|
function removeTable(editor) {
|
|
6902
7143
|
const t2 = editor.tablePlugin.getTableInfo();
|
|
6903
7144
|
if (t2 === void 0)
|
|
6904
7145
|
return false;
|
|
6905
|
-
|
|
7146
|
+
Transforms36.removeNodes(editor, { at: t2.tablePath });
|
|
6906
7147
|
return true;
|
|
6907
7148
|
}
|
|
6908
7149
|
|
|
@@ -6918,9 +7159,9 @@ function removeColumn(editor, { at = editor.selection } = {}) {
|
|
|
6918
7159
|
Editor52.withoutNormalizing(editor, () => {
|
|
6919
7160
|
const columns = [...tableElement.columns];
|
|
6920
7161
|
columns.splice(cellIndex, 1);
|
|
6921
|
-
|
|
7162
|
+
Transforms37.setNodes(editor, { columns }, { at: tablePath });
|
|
6922
7163
|
tableElement.children.forEach((rowElement, rowIndex2) => {
|
|
6923
|
-
|
|
7164
|
+
Transforms37.removeNodes(editor, {
|
|
6924
7165
|
at: [...tablePath, rowIndex2, cellIndex]
|
|
6925
7166
|
});
|
|
6926
7167
|
});
|
|
@@ -6929,12 +7170,12 @@ function removeColumn(editor, { at = editor.selection } = {}) {
|
|
|
6929
7170
|
rowIndex,
|
|
6930
7171
|
Math.min(cellIndex, cellCount - 2)
|
|
6931
7172
|
]);
|
|
6932
|
-
|
|
7173
|
+
Transforms37.select(editor, selection);
|
|
6933
7174
|
});
|
|
6934
7175
|
}
|
|
6935
7176
|
|
|
6936
7177
|
// src/table-plugin/methods/remove-row.ts
|
|
6937
|
-
import { Editor as Editor53, Transforms as
|
|
7178
|
+
import { Editor as Editor53, Transforms as Transforms38 } from "slate";
|
|
6938
7179
|
function removeRow(editor, { at = editor.selection } = {}) {
|
|
6939
7180
|
const t2 = getTableInfo(editor, { at });
|
|
6940
7181
|
if (t2 === void 0)
|
|
@@ -6944,8 +7185,8 @@ function removeRow(editor, { at = editor.selection } = {}) {
|
|
|
6944
7185
|
return true;
|
|
6945
7186
|
}
|
|
6946
7187
|
Editor53.withoutNormalizing(editor, () => {
|
|
6947
|
-
|
|
6948
|
-
|
|
7188
|
+
Transforms38.removeNodes(editor, { at: t2.rowPath });
|
|
7189
|
+
Transforms38.select(
|
|
6949
7190
|
editor,
|
|
6950
7191
|
Editor53.start(editor, [
|
|
6951
7192
|
...t2.tablePath,
|
|
@@ -6958,7 +7199,7 @@ function removeRow(editor, { at = editor.selection } = {}) {
|
|
|
6958
7199
|
}
|
|
6959
7200
|
|
|
6960
7201
|
// src/table-plugin/methods/setTableColumnAlign.ts
|
|
6961
|
-
import { Transforms as
|
|
7202
|
+
import { Transforms as Transforms39 } from "slate";
|
|
6962
7203
|
function setTableColumnAlign(editor, options) {
|
|
6963
7204
|
const t2 = getTableInfo(editor);
|
|
6964
7205
|
if (t2 === void 0)
|
|
@@ -6966,11 +7207,12 @@ function setTableColumnAlign(editor, options) {
|
|
|
6966
7207
|
const { tableElement, tablePath, cellIndex } = t2;
|
|
6967
7208
|
const nextColumns = tableElement.columns.slice();
|
|
6968
7209
|
nextColumns.splice(cellIndex, 1, { align: options.align });
|
|
6969
|
-
|
|
7210
|
+
Transforms39.setNodes(editor, { columns: nextColumns }, { at: tablePath });
|
|
6970
7211
|
return true;
|
|
6971
7212
|
}
|
|
6972
7213
|
|
|
6973
7214
|
// src/table-plugin/methods/tab.ts
|
|
7215
|
+
import { Path as Path15, Transforms as Transforms40 } from "slate";
|
|
6974
7216
|
function tabForward(editor) {
|
|
6975
7217
|
const t2 = getTableInfo(editor);
|
|
6976
7218
|
if (!t2)
|
|
@@ -6984,8 +7226,13 @@ function tabForward(editor) {
|
|
|
6984
7226
|
selectStartOfElement(editor, [...tablePath, rowIndex + 1, 0]);
|
|
6985
7227
|
return true;
|
|
6986
7228
|
}
|
|
6987
|
-
|
|
6988
|
-
|
|
7229
|
+
const nextPath = Path15.next(tablePath);
|
|
7230
|
+
Transforms40.insertNodes(
|
|
7231
|
+
editor,
|
|
7232
|
+
{ type: "paragraph", children: [{ text: "" }] },
|
|
7233
|
+
{ at: nextPath }
|
|
7234
|
+
);
|
|
7235
|
+
selectStartOfElement(editor, nextPath);
|
|
6989
7236
|
return true;
|
|
6990
7237
|
}
|
|
6991
7238
|
function tabBackward(editor) {
|
|
@@ -7002,6 +7249,23 @@ function tabBackward(editor) {
|
|
|
7002
7249
|
return true;
|
|
7003
7250
|
}
|
|
7004
7251
|
}
|
|
7252
|
+
function shiftEnterForward(editor) {
|
|
7253
|
+
const t2 = getTableInfo(editor);
|
|
7254
|
+
if (!t2)
|
|
7255
|
+
return false;
|
|
7256
|
+
const { cellIndex, cellCount, rowIndex, rowCount, tablePath } = t2;
|
|
7257
|
+
if (cellIndex < cellCount - 1) {
|
|
7258
|
+
selectStartOfElement(editor, [...tablePath, rowIndex, cellIndex + 1]);
|
|
7259
|
+
return true;
|
|
7260
|
+
}
|
|
7261
|
+
if (rowIndex < rowCount - 1) {
|
|
7262
|
+
selectStartOfElement(editor, [...tablePath, rowIndex + 1, 0]);
|
|
7263
|
+
return true;
|
|
7264
|
+
}
|
|
7265
|
+
insertRowBelow(editor);
|
|
7266
|
+
selectStartOfElement(editor, [...tablePath, rowIndex + 1, 0]);
|
|
7267
|
+
return true;
|
|
7268
|
+
}
|
|
7005
7269
|
|
|
7006
7270
|
// src/table-plugin/methods/index.ts
|
|
7007
7271
|
function createTableMethods(editor) {
|
|
@@ -7015,6 +7279,7 @@ function createTableMethods(editor) {
|
|
|
7015
7279
|
removeRow: curryOne(removeRow, editor),
|
|
7016
7280
|
tabForward: curryOne(tabForward, editor),
|
|
7017
7281
|
tabBackward: curryOne(tabBackward, editor),
|
|
7282
|
+
shiftEnterForward: curryOne(shiftEnterForward, editor),
|
|
7018
7283
|
selectCell: curryOne(selectCell, editor),
|
|
7019
7284
|
down: curryOne(down, editor),
|
|
7020
7285
|
up: curryOne(up, editor),
|
|
@@ -7026,12 +7291,12 @@ function selectCell(editor, { at = editor.selection } = {}) {
|
|
|
7026
7291
|
if (t2 === void 0)
|
|
7027
7292
|
return false;
|
|
7028
7293
|
const { cellPath } = t2;
|
|
7029
|
-
|
|
7294
|
+
Transforms41.select(editor, cellPath);
|
|
7030
7295
|
return true;
|
|
7031
7296
|
}
|
|
7032
7297
|
|
|
7033
7298
|
// src/table-plugin/normalize/normalize-table.ts
|
|
7034
|
-
import { Transforms as
|
|
7299
|
+
import { Transforms as Transforms42 } from "slate";
|
|
7035
7300
|
function normalizeTableIndexes(editor, entry) {
|
|
7036
7301
|
let isTransformed = false;
|
|
7037
7302
|
const rowElements = entry[0].children;
|
|
@@ -7039,7 +7304,7 @@ function normalizeTableIndexes(editor, entry) {
|
|
|
7039
7304
|
const cellElements = rowElement.children;
|
|
7040
7305
|
cellElements.forEach((cellElement, x) => {
|
|
7041
7306
|
if (cellElement.x !== x || cellElement.y !== y) {
|
|
7042
|
-
|
|
7307
|
+
Transforms42.setNodes(editor, { x, y }, { at: [...entry[1], y, x] });
|
|
7043
7308
|
isTransformed = true;
|
|
7044
7309
|
}
|
|
7045
7310
|
});
|
|
@@ -7048,14 +7313,14 @@ function normalizeTableIndexes(editor, entry) {
|
|
|
7048
7313
|
}
|
|
7049
7314
|
|
|
7050
7315
|
// src/table-plugin/normalize/normalize-table-cell.ts
|
|
7051
|
-
import { Editor as
|
|
7316
|
+
import { Editor as Editor58, Transforms as Transforms43 } from "slate";
|
|
7052
7317
|
function normalizeTableCell(editor, entry) {
|
|
7053
7318
|
const [node, path] = entry;
|
|
7054
7319
|
if (node.children.length === 1 && node.children[0].type === "table-content") {
|
|
7055
7320
|
return false;
|
|
7056
7321
|
}
|
|
7057
|
-
|
|
7058
|
-
|
|
7322
|
+
Editor58.withoutNormalizing(editor, () => {
|
|
7323
|
+
Transforms43.insertNodes(
|
|
7059
7324
|
editor,
|
|
7060
7325
|
{
|
|
7061
7326
|
type: "table-content",
|
|
@@ -7064,9 +7329,9 @@ function normalizeTableCell(editor, entry) {
|
|
|
7064
7329
|
{ at: [...entry[1], 0] }
|
|
7065
7330
|
);
|
|
7066
7331
|
for (let i = node.children.length; i >= 0; i--) {
|
|
7067
|
-
|
|
7332
|
+
Transforms43.mergeNodes(editor, { at: [...path, i] });
|
|
7068
7333
|
}
|
|
7069
|
-
|
|
7334
|
+
Transforms43.delete(editor, {
|
|
7070
7335
|
at: { path: [...path, 0, 0], offset: 0 },
|
|
7071
7336
|
unit: "character"
|
|
7072
7337
|
});
|
|
@@ -7076,14 +7341,14 @@ function normalizeTableCell(editor, entry) {
|
|
|
7076
7341
|
|
|
7077
7342
|
// src/table-plugin/render-element/table.tsx
|
|
7078
7343
|
import { useEffect as useEffect6 } from "react";
|
|
7079
|
-
import { ReactEditor as ReactEditor12, useSelected as useSelected7, useSlateStatic as
|
|
7344
|
+
import { ReactEditor as ReactEditor12, useSelected as useSelected7, useSlateStatic as useSlateStatic14 } from "slate-react";
|
|
7080
7345
|
|
|
7081
7346
|
// src/table-plugin/render-element/styles/index.ts
|
|
7082
|
-
import
|
|
7347
|
+
import styled32 from "@emotion/styled";
|
|
7083
7348
|
|
|
7084
7349
|
// src/table-plugin/render-element/styles/table-menu-styles.ts
|
|
7085
|
-
import
|
|
7086
|
-
var $BaseMenu =
|
|
7350
|
+
import styled31 from "@emotion/styled";
|
|
7351
|
+
var $BaseMenu = styled31("div")`
|
|
7087
7352
|
position: absolute;
|
|
7088
7353
|
/**
|
|
7089
7354
|
* very slightly shaded
|
|
@@ -7108,7 +7373,7 @@ var $BaseMenu = styled30("div")`
|
|
|
7108
7373
|
}
|
|
7109
7374
|
}
|
|
7110
7375
|
`;
|
|
7111
|
-
var $ColumnMenu =
|
|
7376
|
+
var $ColumnMenu = styled31($BaseMenu)`
|
|
7112
7377
|
cursor: pointer;
|
|
7113
7378
|
/**
|
|
7114
7379
|
* hangs out on top
|
|
@@ -7119,7 +7384,7 @@ var $ColumnMenu = styled30($BaseMenu)`
|
|
|
7119
7384
|
height: 3em;
|
|
7120
7385
|
top: -3em;
|
|
7121
7386
|
`;
|
|
7122
|
-
var $RowMenu =
|
|
7387
|
+
var $RowMenu = styled31($BaseMenu)`
|
|
7123
7388
|
/**
|
|
7124
7389
|
* hangs out on left
|
|
7125
7390
|
*/
|
|
@@ -7128,7 +7393,7 @@ var $RowMenu = styled30($BaseMenu)`
|
|
|
7128
7393
|
width: 3em;
|
|
7129
7394
|
left: -3em;
|
|
7130
7395
|
`;
|
|
7131
|
-
var $MenuTile =
|
|
7396
|
+
var $MenuTile = styled31("div")`
|
|
7132
7397
|
position: absolute;
|
|
7133
7398
|
background: rgba(0, 0, 0, 0.05);
|
|
7134
7399
|
border: 1px solid rgba(0, 0, 0, 0.05);
|
|
@@ -7141,7 +7406,7 @@ var $MenuTile = styled30("div")`
|
|
|
7141
7406
|
right: 0;
|
|
7142
7407
|
bottom: 0;
|
|
7143
7408
|
`;
|
|
7144
|
-
var $ColumnMenuTile =
|
|
7409
|
+
var $ColumnMenuTile = styled31($MenuTile)`
|
|
7145
7410
|
top: 50%;
|
|
7146
7411
|
border-bottom: none;
|
|
7147
7412
|
border-right: none;
|
|
@@ -7168,7 +7433,7 @@ var $ColumnMenuTile = styled30($MenuTile)`
|
|
|
7168
7433
|
/* border-top-left-radius: 0.5em;
|
|
7169
7434
|
border-top-right-radius: 0.5em; */
|
|
7170
7435
|
`;
|
|
7171
|
-
var $RowMenuTile =
|
|
7436
|
+
var $RowMenuTile = styled31($MenuTile)`
|
|
7172
7437
|
left: 50%;
|
|
7173
7438
|
border-right: none;
|
|
7174
7439
|
border-bottom: none;
|
|
@@ -7195,7 +7460,7 @@ var $RowMenuTile = styled30($MenuTile)`
|
|
|
7195
7460
|
/* border-top-left-radius: 0.5em;
|
|
7196
7461
|
border-bottom-left-radius: 0.5em; */
|
|
7197
7462
|
`;
|
|
7198
|
-
var $MenuButton =
|
|
7463
|
+
var $MenuButton = styled31("div")`
|
|
7199
7464
|
position: absolute;
|
|
7200
7465
|
font-size: 1.5em;
|
|
7201
7466
|
background: white;
|
|
@@ -7205,13 +7470,13 @@ var $MenuButton = styled30("div")`
|
|
|
7205
7470
|
display: block;
|
|
7206
7471
|
}
|
|
7207
7472
|
`;
|
|
7208
|
-
var $AddMenuButton =
|
|
7473
|
+
var $AddMenuButton = styled31($MenuButton)`
|
|
7209
7474
|
color: #c0c0c0;
|
|
7210
7475
|
&:hover {
|
|
7211
7476
|
color: royalblue;
|
|
7212
7477
|
}
|
|
7213
7478
|
`;
|
|
7214
|
-
var $RemoveMenuButton =
|
|
7479
|
+
var $RemoveMenuButton = styled31($MenuButton)`
|
|
7215
7480
|
color: #c0c0c0;
|
|
7216
7481
|
&:hover {
|
|
7217
7482
|
color: firebrick;
|
|
@@ -7219,20 +7484,20 @@ var $RemoveMenuButton = styled30($MenuButton)`
|
|
|
7219
7484
|
`;
|
|
7220
7485
|
|
|
7221
7486
|
// src/table-plugin/render-element/styles/index.ts
|
|
7222
|
-
var $Table =
|
|
7487
|
+
var $Table = styled32("table")`
|
|
7223
7488
|
border-collapse: collapse;
|
|
7224
7489
|
margin: 1em 0;
|
|
7225
7490
|
${({ columns }) => columns.map(
|
|
7226
7491
|
(column, index) => `td:nth-of-type(${index + 1}) { text-align: ${column.align}; }`
|
|
7227
7492
|
).join("\n")}
|
|
7228
7493
|
`;
|
|
7229
|
-
var $TableRow =
|
|
7494
|
+
var $TableRow = styled32("tr")`
|
|
7230
7495
|
position: relative;
|
|
7231
7496
|
&:first-of-type {
|
|
7232
7497
|
background: var(--table-head-bgcolor);
|
|
7233
7498
|
}
|
|
7234
7499
|
`;
|
|
7235
|
-
var $TableCell =
|
|
7500
|
+
var $TableCell = styled32("td")`
|
|
7236
7501
|
position: relative;
|
|
7237
7502
|
border-width: 1px;
|
|
7238
7503
|
border-style: solid;
|
|
@@ -7253,7 +7518,7 @@ var $TableCell = styled31("td")`
|
|
|
7253
7518
|
border-right-color: var(--table-border-color);
|
|
7254
7519
|
}
|
|
7255
7520
|
`;
|
|
7256
|
-
var $TableContent =
|
|
7521
|
+
var $TableContent = styled32("div")`
|
|
7257
7522
|
/**
|
|
7258
7523
|
* Smaller font inside a table than outside of it
|
|
7259
7524
|
*/
|
|
@@ -7274,19 +7539,19 @@ var TableContext = createContext2({
|
|
|
7274
7539
|
});
|
|
7275
7540
|
|
|
7276
7541
|
// src/table-plugin/render-element/table.tsx
|
|
7277
|
-
import { jsx as
|
|
7542
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
7278
7543
|
function Table({
|
|
7279
7544
|
element,
|
|
7280
7545
|
attributes,
|
|
7281
7546
|
children
|
|
7282
7547
|
}) {
|
|
7283
|
-
const editor =
|
|
7548
|
+
const editor = useSlateStatic14();
|
|
7284
7549
|
const isSelected = useSelected7();
|
|
7285
7550
|
useEffect6(() => {
|
|
7286
7551
|
const path = ReactEditor12.findPath(editor, element);
|
|
7287
7552
|
normalizeTableIndexes(editor, [element, path]);
|
|
7288
7553
|
}, []);
|
|
7289
|
-
return /* @__PURE__ */
|
|
7554
|
+
return /* @__PURE__ */ jsx47(TableContext.Provider, { value: { isSelected }, children: /* @__PURE__ */ jsx47($Table, { ...attributes, columns: element.columns, children: /* @__PURE__ */ jsx47("tbody", { children }) }) });
|
|
7290
7555
|
}
|
|
7291
7556
|
|
|
7292
7557
|
// src/table-plugin/render-element/table-cell/index.tsx
|
|
@@ -7294,12 +7559,12 @@ import { useContext as useContext2 } from "react";
|
|
|
7294
7559
|
import { useSelected as useSelected8 } from "slate-react";
|
|
7295
7560
|
|
|
7296
7561
|
// src/table-plugin/render-element/table-cell/column-menu/index.tsx
|
|
7297
|
-
import { useCallback as useCallback11, useRef as
|
|
7298
|
-
import { useSlateStatic as
|
|
7562
|
+
import { useCallback as useCallback11, useRef as useRef5, useState as useState6 } from "react";
|
|
7563
|
+
import { useSlateStatic as useSlateStatic15 } from "slate-react";
|
|
7299
7564
|
|
|
7300
7565
|
// src/table-plugin/icons.tsx
|
|
7301
|
-
import { jsx as
|
|
7302
|
-
var PlusIcon = (props) => /* @__PURE__ */
|
|
7566
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
7567
|
+
var PlusIcon = (props) => /* @__PURE__ */ jsx48(
|
|
7303
7568
|
"svg",
|
|
7304
7569
|
{
|
|
7305
7570
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7308,7 +7573,7 @@ var PlusIcon = (props) => /* @__PURE__ */ jsx47(
|
|
|
7308
7573
|
width: "1em",
|
|
7309
7574
|
height: "1em",
|
|
7310
7575
|
...props,
|
|
7311
|
-
children: /* @__PURE__ */
|
|
7576
|
+
children: /* @__PURE__ */ jsx48(
|
|
7312
7577
|
"path",
|
|
7313
7578
|
{
|
|
7314
7579
|
fillRule: "evenodd",
|
|
@@ -7318,7 +7583,7 @@ var PlusIcon = (props) => /* @__PURE__ */ jsx47(
|
|
|
7318
7583
|
)
|
|
7319
7584
|
}
|
|
7320
7585
|
);
|
|
7321
|
-
var MinusIcon = (props) => /* @__PURE__ */
|
|
7586
|
+
var MinusIcon = (props) => /* @__PURE__ */ jsx48(
|
|
7322
7587
|
"svg",
|
|
7323
7588
|
{
|
|
7324
7589
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7327,7 +7592,7 @@ var MinusIcon = (props) => /* @__PURE__ */ jsx47(
|
|
|
7327
7592
|
width: "1em",
|
|
7328
7593
|
height: "1em",
|
|
7329
7594
|
...props,
|
|
7330
|
-
children: /* @__PURE__ */
|
|
7595
|
+
children: /* @__PURE__ */ jsx48(
|
|
7331
7596
|
"path",
|
|
7332
7597
|
{
|
|
7333
7598
|
fillRule: "evenodd",
|
|
@@ -7337,18 +7602,18 @@ var MinusIcon = (props) => /* @__PURE__ */ jsx47(
|
|
|
7337
7602
|
)
|
|
7338
7603
|
}
|
|
7339
7604
|
);
|
|
7340
|
-
var BarsIcon = () => /* @__PURE__ */
|
|
7341
|
-
var AlignLeft = () => /* @__PURE__ */
|
|
7342
|
-
var AlignCenter = () => /* @__PURE__ */
|
|
7343
|
-
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" }) });
|
|
7344
7609
|
|
|
7345
7610
|
// src/table-plugin/render-element/table-cell/column-menu/index.tsx
|
|
7346
|
-
import { Fragment as Fragment4, jsx as
|
|
7611
|
+
import { Fragment as Fragment4, jsx as jsx49, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7347
7612
|
function ColumnMenu({ cellElement }) {
|
|
7348
|
-
const editor =
|
|
7613
|
+
const editor = useSlateStatic15();
|
|
7349
7614
|
const menu = useLayer("column-menu");
|
|
7350
|
-
const buttonRef =
|
|
7351
|
-
const [hover, setHover] =
|
|
7615
|
+
const buttonRef = useRef5(null);
|
|
7616
|
+
const [hover, setHover] = useState6(false);
|
|
7352
7617
|
const onMouseEnter = useCallback11(() => {
|
|
7353
7618
|
setHover(true);
|
|
7354
7619
|
}, []);
|
|
@@ -7384,9 +7649,9 @@ function ColumnMenu({ cellElement }) {
|
|
|
7384
7649
|
}
|
|
7385
7650
|
}
|
|
7386
7651
|
];
|
|
7387
|
-
menu.open(() => /* @__PURE__ */
|
|
7652
|
+
menu.open(() => /* @__PURE__ */ jsx49(Menu, { dest, items, close: menu.close }));
|
|
7388
7653
|
}, []);
|
|
7389
|
-
return /* @__PURE__ */
|
|
7654
|
+
return /* @__PURE__ */ jsxs23(
|
|
7390
7655
|
$ColumnMenu,
|
|
7391
7656
|
{
|
|
7392
7657
|
ref: buttonRef,
|
|
@@ -7395,9 +7660,9 @@ function ColumnMenu({ cellElement }) {
|
|
|
7395
7660
|
onMouseEnter,
|
|
7396
7661
|
onMouseLeave,
|
|
7397
7662
|
children: [
|
|
7398
|
-
/* @__PURE__ */
|
|
7399
|
-
hover ? /* @__PURE__ */
|
|
7400
|
-
/* @__PURE__ */
|
|
7663
|
+
/* @__PURE__ */ jsx49($ColumnMenuTile, { className: "--tile", children: /* @__PURE__ */ jsx49(BarsIcon, {}) }),
|
|
7664
|
+
hover ? /* @__PURE__ */ jsxs23(Fragment4, { children: [
|
|
7665
|
+
/* @__PURE__ */ jsx49(
|
|
7401
7666
|
$RemoveMenuButton,
|
|
7402
7667
|
{
|
|
7403
7668
|
style: {
|
|
@@ -7406,23 +7671,23 @@ function ColumnMenu({ cellElement }) {
|
|
|
7406
7671
|
marginLeft: "-0.5em"
|
|
7407
7672
|
},
|
|
7408
7673
|
onMouseDown: () => editor.tablePlugin.removeColumn({ at: cellElement }),
|
|
7409
|
-
children: /* @__PURE__ */
|
|
7674
|
+
children: /* @__PURE__ */ jsx49(MinusIcon, {})
|
|
7410
7675
|
}
|
|
7411
7676
|
),
|
|
7412
|
-
/* @__PURE__ */
|
|
7677
|
+
/* @__PURE__ */ jsx49(
|
|
7413
7678
|
$AddMenuButton,
|
|
7414
7679
|
{
|
|
7415
7680
|
style: { left: "-0.5em", top: 0 },
|
|
7416
7681
|
onMouseDown: () => editor.tablePlugin.insertColumn({ at: cellElement }),
|
|
7417
|
-
children: /* @__PURE__ */
|
|
7682
|
+
children: /* @__PURE__ */ jsx49(PlusIcon, {})
|
|
7418
7683
|
}
|
|
7419
7684
|
),
|
|
7420
|
-
/* @__PURE__ */
|
|
7685
|
+
/* @__PURE__ */ jsx49(
|
|
7421
7686
|
$AddMenuButton,
|
|
7422
7687
|
{
|
|
7423
7688
|
style: { right: "-0.5em", top: 0 },
|
|
7424
7689
|
onMouseDown: () => editor.tablePlugin.insertColumn({ at: cellElement, offset: 1 }),
|
|
7425
|
-
children: /* @__PURE__ */
|
|
7690
|
+
children: /* @__PURE__ */ jsx49(PlusIcon, {})
|
|
7426
7691
|
}
|
|
7427
7692
|
)
|
|
7428
7693
|
] }) : null
|
|
@@ -7432,22 +7697,22 @@ function ColumnMenu({ cellElement }) {
|
|
|
7432
7697
|
}
|
|
7433
7698
|
|
|
7434
7699
|
// src/table-plugin/render-element/table-cell/row-menu/index.tsx
|
|
7435
|
-
import { useState as
|
|
7436
|
-
import { useSlateStatic as
|
|
7437
|
-
import { Fragment as Fragment5, jsx as
|
|
7700
|
+
import { useState as useState7 } from "react";
|
|
7701
|
+
import { useSlateStatic as useSlateStatic16 } from "slate-react";
|
|
7702
|
+
import { Fragment as Fragment5, jsx as jsx50, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7438
7703
|
function RowMenu({ cellElement }) {
|
|
7439
|
-
const editor =
|
|
7440
|
-
const [hover, setHover] =
|
|
7441
|
-
return /* @__PURE__ */
|
|
7704
|
+
const editor = useSlateStatic16();
|
|
7705
|
+
const [hover, setHover] = useState7(false);
|
|
7706
|
+
return /* @__PURE__ */ jsxs24(
|
|
7442
7707
|
$RowMenu,
|
|
7443
7708
|
{
|
|
7444
7709
|
contentEditable: false,
|
|
7445
7710
|
onMouseEnter: () => setHover(true),
|
|
7446
7711
|
onMouseLeave: () => setHover(false),
|
|
7447
7712
|
children: [
|
|
7448
|
-
/* @__PURE__ */
|
|
7449
|
-
hover ? /* @__PURE__ */
|
|
7450
|
-
/* @__PURE__ */
|
|
7713
|
+
/* @__PURE__ */ jsx50($RowMenuTile, { className: "--tile", children: /* @__PURE__ */ jsx50(BarsIcon, {}) }),
|
|
7714
|
+
hover ? /* @__PURE__ */ jsxs24(Fragment5, { children: [
|
|
7715
|
+
/* @__PURE__ */ jsx50(
|
|
7451
7716
|
$RemoveMenuButton,
|
|
7452
7717
|
{
|
|
7453
7718
|
style: {
|
|
@@ -7456,23 +7721,23 @@ function RowMenu({ cellElement }) {
|
|
|
7456
7721
|
marginTop: "-0.5em"
|
|
7457
7722
|
},
|
|
7458
7723
|
onMouseDown: () => editor.tablePlugin.removeRow({ at: cellElement }),
|
|
7459
|
-
children: /* @__PURE__ */
|
|
7724
|
+
children: /* @__PURE__ */ jsx50(MinusIcon, {})
|
|
7460
7725
|
}
|
|
7461
7726
|
),
|
|
7462
|
-
/* @__PURE__ */
|
|
7727
|
+
/* @__PURE__ */ jsx50(
|
|
7463
7728
|
$AddMenuButton,
|
|
7464
7729
|
{
|
|
7465
7730
|
style: { top: "-0.5em", left: "0.5em" },
|
|
7466
7731
|
onMouseDown: () => editor.tablePlugin.insertRow({ at: cellElement }),
|
|
7467
|
-
children: /* @__PURE__ */
|
|
7732
|
+
children: /* @__PURE__ */ jsx50(PlusIcon, {})
|
|
7468
7733
|
}
|
|
7469
7734
|
),
|
|
7470
|
-
/* @__PURE__ */
|
|
7735
|
+
/* @__PURE__ */ jsx50(
|
|
7471
7736
|
$AddMenuButton,
|
|
7472
7737
|
{
|
|
7473
7738
|
style: { bottom: "-0.5em", left: "0.5em" },
|
|
7474
7739
|
onMouseDown: () => editor.tablePlugin.insertRow({ at: cellElement, offset: 1 }),
|
|
7475
|
-
children: /* @__PURE__ */
|
|
7740
|
+
children: /* @__PURE__ */ jsx50(PlusIcon, {})
|
|
7476
7741
|
}
|
|
7477
7742
|
)
|
|
7478
7743
|
] }) : null
|
|
@@ -7482,8 +7747,8 @@ function RowMenu({ cellElement }) {
|
|
|
7482
7747
|
}
|
|
7483
7748
|
|
|
7484
7749
|
// src/table-plugin/render-element/table-cell/table-menu/$table-menu.tsx
|
|
7485
|
-
import
|
|
7486
|
-
var $TableMenu =
|
|
7750
|
+
import styled33 from "@emotion/styled";
|
|
7751
|
+
var $TableMenu = styled33("div")`
|
|
7487
7752
|
position: absolute;
|
|
7488
7753
|
/**
|
|
7489
7754
|
* very slightly shaded
|
|
@@ -7516,7 +7781,7 @@ var $TableMenu = styled32("div")`
|
|
|
7516
7781
|
}
|
|
7517
7782
|
}
|
|
7518
7783
|
`;
|
|
7519
|
-
var $TableMenuTile =
|
|
7784
|
+
var $TableMenuTile = styled33("div")`
|
|
7520
7785
|
position: absolute;
|
|
7521
7786
|
left: 0;
|
|
7522
7787
|
top: 0;
|
|
@@ -7527,13 +7792,13 @@ var $TableMenuTile = styled32("div")`
|
|
|
7527
7792
|
`;
|
|
7528
7793
|
|
|
7529
7794
|
// src/table-plugin/render-element/table-cell/table-menu/index.tsx
|
|
7530
|
-
import { jsx as
|
|
7795
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
7531
7796
|
function TableMenu() {
|
|
7532
|
-
return /* @__PURE__ */
|
|
7797
|
+
return /* @__PURE__ */ jsx51($TableMenu, { contentEditable: false, children: /* @__PURE__ */ jsx51($TableMenuTile, { className: "--table-menu-tile" }) });
|
|
7533
7798
|
}
|
|
7534
7799
|
|
|
7535
7800
|
// src/table-plugin/render-element/table-cell/index.tsx
|
|
7536
|
-
import { jsx as
|
|
7801
|
+
import { jsx as jsx52, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7537
7802
|
function TableCell({
|
|
7538
7803
|
element,
|
|
7539
7804
|
attributes,
|
|
@@ -7544,7 +7809,7 @@ function TableCell({
|
|
|
7544
7809
|
const showTableMenu = tableContext.isSelected && element.x === 0 && element.y === 0;
|
|
7545
7810
|
const showRowMenu = tableContext.isSelected && element.x === 0;
|
|
7546
7811
|
const showColumnMenu = tableContext.isSelected && element.y === 0;
|
|
7547
|
-
return /* @__PURE__ */
|
|
7812
|
+
return /* @__PURE__ */ jsxs25(
|
|
7548
7813
|
$TableCell,
|
|
7549
7814
|
{
|
|
7550
7815
|
className: selected ? "--selected" : "",
|
|
@@ -7553,34 +7818,34 @@ function TableCell({
|
|
|
7553
7818
|
"data-y": element.y,
|
|
7554
7819
|
children: [
|
|
7555
7820
|
children,
|
|
7556
|
-
showTableMenu ? /* @__PURE__ */
|
|
7557
|
-
showRowMenu ? /* @__PURE__ */
|
|
7558
|
-
showColumnMenu ? /* @__PURE__ */
|
|
7821
|
+
showTableMenu ? /* @__PURE__ */ jsx52(TableMenu, {}) : null,
|
|
7822
|
+
showRowMenu ? /* @__PURE__ */ jsx52(RowMenu, { cellElement: element }) : null,
|
|
7823
|
+
showColumnMenu ? /* @__PURE__ */ jsx52(ColumnMenu, { cellElement: element }) : null
|
|
7559
7824
|
]
|
|
7560
7825
|
}
|
|
7561
7826
|
);
|
|
7562
7827
|
}
|
|
7563
7828
|
|
|
7564
7829
|
// src/table-plugin/render-element/table-content.tsx
|
|
7565
|
-
import { jsx as
|
|
7830
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
7566
7831
|
function TableContent({
|
|
7567
7832
|
attributes,
|
|
7568
7833
|
children
|
|
7569
7834
|
}) {
|
|
7570
|
-
return /* @__PURE__ */
|
|
7835
|
+
return /* @__PURE__ */ jsx53($TableContent, { ...attributes, children });
|
|
7571
7836
|
}
|
|
7572
7837
|
|
|
7573
7838
|
// src/table-plugin/render-element/table-row.tsx
|
|
7574
|
-
import { jsx as
|
|
7839
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
7575
7840
|
function TableRow({
|
|
7576
7841
|
attributes,
|
|
7577
7842
|
children
|
|
7578
7843
|
}) {
|
|
7579
|
-
return /* @__PURE__ */
|
|
7844
|
+
return /* @__PURE__ */ jsx54($TableRow, { ...attributes, children });
|
|
7580
7845
|
}
|
|
7581
7846
|
|
|
7582
7847
|
// src/table-plugin/render-element/index.tsx
|
|
7583
|
-
import { jsx as
|
|
7848
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
7584
7849
|
function renderElement4({
|
|
7585
7850
|
element,
|
|
7586
7851
|
attributes,
|
|
@@ -7588,13 +7853,13 @@ function renderElement4({
|
|
|
7588
7853
|
}) {
|
|
7589
7854
|
switch (element.type) {
|
|
7590
7855
|
case "table":
|
|
7591
|
-
return /* @__PURE__ */
|
|
7856
|
+
return /* @__PURE__ */ jsx55(Table, { element, attributes, children });
|
|
7592
7857
|
case "table-row":
|
|
7593
|
-
return /* @__PURE__ */
|
|
7858
|
+
return /* @__PURE__ */ jsx55(TableRow, { element, attributes, children });
|
|
7594
7859
|
case "table-cell":
|
|
7595
|
-
return /* @__PURE__ */
|
|
7860
|
+
return /* @__PURE__ */ jsx55(TableCell, { element, attributes, children });
|
|
7596
7861
|
case "table-content":
|
|
7597
|
-
return /* @__PURE__ */
|
|
7862
|
+
return /* @__PURE__ */ jsx55(TableContent, { element, attributes, children });
|
|
7598
7863
|
}
|
|
7599
7864
|
}
|
|
7600
7865
|
|
|
@@ -7615,7 +7880,11 @@ var TablePlugin = createPlugin(
|
|
|
7615
7880
|
deleteFragment: () => deleteFragmentWithProtectedTypes(editor, ["table-cell"]),
|
|
7616
7881
|
insertBreak: () => {
|
|
7617
7882
|
const entry = findElementUp(editor, "table-cell");
|
|
7618
|
-
|
|
7883
|
+
if (entry) {
|
|
7884
|
+
editor.insertText("\n");
|
|
7885
|
+
return true;
|
|
7886
|
+
}
|
|
7887
|
+
return false;
|
|
7619
7888
|
},
|
|
7620
7889
|
isMaster(element) {
|
|
7621
7890
|
if (element.type === "table")
|
|
@@ -7649,6 +7918,7 @@ var TablePlugin = createPlugin(
|
|
|
7649
7918
|
*/
|
|
7650
7919
|
tab: editor.tablePlugin.tabForward,
|
|
7651
7920
|
"shift+tab": editor.tablePlugin.tabBackward,
|
|
7921
|
+
"shift+enter": editor.tablePlugin.shiftEnterForward,
|
|
7652
7922
|
down: editor.tablePlugin.down,
|
|
7653
7923
|
up: editor.tablePlugin.up,
|
|
7654
7924
|
/**
|
|
@@ -7733,16 +8003,16 @@ var globalStyles = css2`
|
|
|
7733
8003
|
`;
|
|
7734
8004
|
|
|
7735
8005
|
// src/theme-plugin/index.tsx
|
|
7736
|
-
import { Fragment as Fragment6, jsx as
|
|
8006
|
+
import { Fragment as Fragment6, jsx as jsx56, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
7737
8007
|
var ThemePlugin = createPlugin((editor) => {
|
|
7738
8008
|
editor.theme = true;
|
|
7739
8009
|
return {
|
|
7740
8010
|
name: "theme",
|
|
7741
8011
|
editor: {},
|
|
7742
8012
|
renderEditable: ({ attributes, Editable: Editable3 }) => {
|
|
7743
|
-
return /* @__PURE__ */
|
|
7744
|
-
/* @__PURE__ */
|
|
7745
|
-
/* @__PURE__ */
|
|
8013
|
+
return /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
8014
|
+
/* @__PURE__ */ jsx56(Global, { styles: globalStyles }),
|
|
8015
|
+
/* @__PURE__ */ jsx56(Editable3, { ...attributes })
|
|
7746
8016
|
] });
|
|
7747
8017
|
},
|
|
7748
8018
|
editableProps: {}
|
|
@@ -7751,27 +8021,27 @@ var ThemePlugin = createPlugin((editor) => {
|
|
|
7751
8021
|
|
|
7752
8022
|
// src/toolbar-plugin/render-editable/index.tsx
|
|
7753
8023
|
import { clsx as clsx10 } from "clsx";
|
|
7754
|
-
import { useCallback as useCallback15, useRef as
|
|
7755
|
-
import { Editor as
|
|
7756
|
-
import { ReactEditor as ReactEditor16, useFocused, useSlateStatic as
|
|
8024
|
+
import { useCallback as useCallback15, useRef as useRef11 } from "react";
|
|
8025
|
+
import { Editor as Editor62, Transforms as Transforms45 } from "slate";
|
|
8026
|
+
import { ReactEditor as ReactEditor16, useFocused, useSlateStatic as useSlateStatic22 } from "slate-react";
|
|
7757
8027
|
|
|
7758
8028
|
// src/toolbar-plugin/components/dialog/table-dialog.tsx
|
|
7759
8029
|
import { clsx as clsx8 } from "clsx";
|
|
7760
|
-
import { useCallback as useCallback12, useRef as
|
|
7761
|
-
import { ReactEditor as ReactEditor13, useSlateStatic as
|
|
8030
|
+
import { useCallback as useCallback12, useRef as useRef6, useState as useState8 } from "react";
|
|
8031
|
+
import { ReactEditor as ReactEditor13, useSlateStatic as useSlateStatic17 } from "slate-react";
|
|
7762
8032
|
|
|
7763
8033
|
// src/toolbar-plugin/styles/table-styles.ts
|
|
7764
|
-
import
|
|
7765
|
-
var $TableDialog =
|
|
8034
|
+
import styled34 from "@emotion/styled";
|
|
8035
|
+
var $TableDialog = styled34($Panel)`
|
|
7766
8036
|
padding: 0.5em;
|
|
7767
8037
|
`;
|
|
7768
|
-
var $TableDialogGrid =
|
|
8038
|
+
var $TableDialogGrid = styled34("div")`
|
|
7769
8039
|
display: grid;
|
|
7770
8040
|
grid-template-columns: repeat(5, 1.75em);
|
|
7771
8041
|
grid-template-rows: 1.5em;
|
|
7772
8042
|
/* grid-gap: 1px; */
|
|
7773
8043
|
`;
|
|
7774
|
-
var $TableDialogGridCell =
|
|
8044
|
+
var $TableDialogGridCell = styled34("div")`
|
|
7775
8045
|
background: var(--shade-100);
|
|
7776
8046
|
height: 1.5em;
|
|
7777
8047
|
border-radius: 0.125em;
|
|
@@ -7784,7 +8054,7 @@ var $TableDialogGridCell = styled33("div")`
|
|
|
7784
8054
|
`;
|
|
7785
8055
|
|
|
7786
8056
|
// src/toolbar-plugin/components/dialog/table-dialog.tsx
|
|
7787
|
-
import { Fragment as Fragment7, jsx as
|
|
8057
|
+
import { Fragment as Fragment7, jsx as jsx57, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7788
8058
|
function createRange2(size) {
|
|
7789
8059
|
return [...Array(size).keys()];
|
|
7790
8060
|
}
|
|
@@ -7792,9 +8062,9 @@ function TableDialog({
|
|
|
7792
8062
|
dest,
|
|
7793
8063
|
close
|
|
7794
8064
|
}) {
|
|
7795
|
-
const [hover, setHover] =
|
|
7796
|
-
const editor =
|
|
7797
|
-
const ref =
|
|
8065
|
+
const [hover, setHover] = useState8({ x: 0, y: 0 });
|
|
8066
|
+
const editor = useSlateStatic17();
|
|
8067
|
+
const ref = useRef6(null);
|
|
7798
8068
|
const style = useAbsoluteReposition({ src: ref, dest }, ({ dest: dest2 }) => {
|
|
7799
8069
|
return { left: dest2.left - 8, top: dest2.top + dest2.height };
|
|
7800
8070
|
});
|
|
@@ -7814,12 +8084,12 @@ function TableDialog({
|
|
|
7814
8084
|
},
|
|
7815
8085
|
[editor]
|
|
7816
8086
|
);
|
|
7817
|
-
return /* @__PURE__ */
|
|
7818
|
-
/* @__PURE__ */
|
|
7819
|
-
/* @__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) => {
|
|
7820
8090
|
return cols.map((x) => {
|
|
7821
8091
|
const selected = x <= hover.x && y <= hover.y;
|
|
7822
|
-
return /* @__PURE__ */
|
|
8092
|
+
return /* @__PURE__ */ jsx57(
|
|
7823
8093
|
$TableDialogGridCell,
|
|
7824
8094
|
{
|
|
7825
8095
|
className: clsx8({ "--selected": selected }),
|
|
@@ -7835,60 +8105,66 @@ function TableDialog({
|
|
|
7835
8105
|
|
|
7836
8106
|
// src/toolbar-plugin/components/toolbar/toolbar.tsx
|
|
7837
8107
|
import throttle2 from "lodash.throttle";
|
|
7838
|
-
import { useEffect as useEffect8, useRef as
|
|
7839
|
-
import { useSlateStatic as
|
|
8108
|
+
import { useEffect as useEffect8, useRef as useRef10, useState as useState11 } from "react";
|
|
8109
|
+
import { useSlateStatic as useSlateStatic21 } from "slate-react";
|
|
7840
8110
|
|
|
7841
8111
|
// src/toolbar-plugin/icons.tsx
|
|
7842
|
-
import { jsx as
|
|
7843
|
-
var H = () => /* @__PURE__ */
|
|
7844
|
-
var More = () => /* @__PURE__ */
|
|
7845
|
-
var LinkPlus = () => /* @__PURE__ */
|
|
7846
|
-
var H1 = () => /* @__PURE__ */
|
|
7847
|
-
var H2 = () => /* @__PURE__ */
|
|
7848
|
-
var H3 = () => /* @__PURE__ */
|
|
7849
|
-
var Normal = () => /* @__PURE__ */
|
|
7850
|
-
var Bold = () => /* @__PURE__ */
|
|
7851
|
-
var Italic = () => /* @__PURE__ */
|
|
7852
|
-
var Link = () => /* @__PURE__ */
|
|
7853
|
-
/* @__PURE__ */
|
|
7854
|
-
/* @__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" })
|
|
8125
|
+
] });
|
|
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" })
|
|
7855
8130
|
] });
|
|
7856
|
-
var
|
|
7857
|
-
var
|
|
7858
|
-
/* @__PURE__ */
|
|
7859
|
-
/* @__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" })
|
|
7860
8135
|
] });
|
|
7861
|
-
var
|
|
7862
|
-
var
|
|
7863
|
-
|
|
7864
|
-
/* @__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" })
|
|
7865
8143
|
] });
|
|
7866
|
-
var
|
|
7867
|
-
var
|
|
7868
|
-
var
|
|
7869
|
-
|
|
7870
|
-
/* @__PURE__ */
|
|
7871
|
-
/* @__PURE__ */
|
|
7872
|
-
/* @__PURE__ */ jsx57("path", { d: "m14 14 1-1a3 5 0 0 1 3 0l2 2" })
|
|
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" })
|
|
7873
8150
|
] });
|
|
7874
|
-
var
|
|
7875
|
-
var
|
|
7876
|
-
var
|
|
7877
|
-
var
|
|
7878
|
-
/* @__PURE__ */
|
|
7879
|
-
/* @__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" })
|
|
7880
8157
|
] });
|
|
7881
|
-
var
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
/* @__PURE__ */ jsx57("path", { d: "M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z" }),
|
|
7886
|
-
/* @__PURE__ */ jsx57("path", { d: "M7 15V9l2 2 2-2v6M14 9v6h4M14 13h2" })
|
|
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" })
|
|
7887
8162
|
] });
|
|
7888
|
-
var
|
|
7889
|
-
/* @__PURE__ */
|
|
7890
|
-
/* @__PURE__ */
|
|
7891
|
-
/* @__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" })
|
|
7892
8168
|
] });
|
|
7893
8169
|
|
|
7894
8170
|
// src/toolbar-plugin/items/block-items.tsx
|
|
@@ -7897,15 +8173,17 @@ var listDepthItems = [
|
|
|
7897
8173
|
icon: IncreaseDepth,
|
|
7898
8174
|
title: t("increaseDepth"),
|
|
7899
8175
|
hotkey: "tab",
|
|
7900
|
-
action: (editor) => editor.list
|
|
7901
|
-
active: (editor) => editor.list
|
|
8176
|
+
action: (editor) => editor.list?.increaseDepth(),
|
|
8177
|
+
active: (editor) => editor.list?.canIncreaseDepth() ?? false,
|
|
8178
|
+
show: (editor) => !!editor.list
|
|
7902
8179
|
},
|
|
7903
8180
|
{
|
|
7904
8181
|
icon: DecreaseDepth,
|
|
7905
8182
|
title: t("decreaseDepth"),
|
|
7906
8183
|
hotkey: "shift+tab",
|
|
7907
|
-
action: (editor) => editor.list
|
|
7908
|
-
active: (editor) => editor.list
|
|
8184
|
+
action: (editor) => editor.list?.decreaseDepth(),
|
|
8185
|
+
active: (editor) => editor.list?.canDecreaseDepth() ?? false,
|
|
8186
|
+
show: (editor) => !!editor.list
|
|
7909
8187
|
}
|
|
7910
8188
|
];
|
|
7911
8189
|
var blockItems = [
|
|
@@ -7950,33 +8228,33 @@ var compactBlockItems = [
|
|
|
7950
8228
|
];
|
|
7951
8229
|
|
|
7952
8230
|
// src/toolbar-plugin/components/dialog/image-url-dialog.tsx
|
|
7953
|
-
import { useState as
|
|
7954
|
-
import { useSlateStatic as
|
|
8231
|
+
import { useState as useState9, useRef as useRef7, useEffect as useEffect7 } from "react";
|
|
8232
|
+
import { useSlateStatic as useSlateStatic18 } from "slate-react";
|
|
7955
8233
|
|
|
7956
8234
|
// src/toolbar-plugin/styles/file-dialog-styles.ts
|
|
7957
|
-
import
|
|
7958
|
-
var $FileDialog =
|
|
8235
|
+
import styled35 from "@emotion/styled";
|
|
8236
|
+
var $FileDialog = styled35($Panel)`
|
|
7959
8237
|
padding: 1em;
|
|
7960
8238
|
width: 18em;
|
|
7961
8239
|
`;
|
|
7962
8240
|
|
|
7963
8241
|
// src/toolbar-plugin/components/dialog/image-url-dialog.tsx
|
|
7964
|
-
import { Fragment as Fragment8, jsx as
|
|
8242
|
+
import { Fragment as Fragment8, jsx as jsx59, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7965
8243
|
function ImageUrlDialog({
|
|
7966
8244
|
dest,
|
|
7967
8245
|
close
|
|
7968
8246
|
}) {
|
|
7969
|
-
const editor =
|
|
7970
|
-
const ref =
|
|
7971
|
-
const fileInputRef =
|
|
8247
|
+
const editor = useSlateStatic18();
|
|
8248
|
+
const ref = useRef7(void 0);
|
|
8249
|
+
const fileInputRef = useRef7(null);
|
|
7972
8250
|
const savedState = editor.wysimark?.imageDialogState;
|
|
7973
8251
|
const hasOnImageChange = !!editor.wysimark?.onImageChange;
|
|
7974
|
-
const [url, setUrl] =
|
|
7975
|
-
const [alt, setAlt] =
|
|
7976
|
-
const [title, setTitle] =
|
|
7977
|
-
const [imageSource, setImageSource] =
|
|
7978
|
-
const [isUploading, setIsUploading] =
|
|
7979
|
-
const [uploadedUrl, setUploadedUrl] =
|
|
8252
|
+
const [url, setUrl] = useState9(savedState?.url ?? "");
|
|
8253
|
+
const [alt, setAlt] = useState9(savedState?.alt ?? "");
|
|
8254
|
+
const [title, setTitle] = useState9(savedState?.title ?? "");
|
|
8255
|
+
const [imageSource, setImageSource] = useState9(savedState?.imageSource ?? (hasOnImageChange ? "file" : "url"));
|
|
8256
|
+
const [isUploading, setIsUploading] = useState9(false);
|
|
8257
|
+
const [uploadedUrl, setUploadedUrl] = useState9(savedState?.uploadedUrl ?? "");
|
|
7980
8258
|
useEffect7(() => {
|
|
7981
8259
|
if (editor.wysimark) {
|
|
7982
8260
|
editor.wysimark.imageDialogState = { url, alt, title, imageSource, uploadedUrl };
|
|
@@ -8032,12 +8310,12 @@ function ImageUrlDialog({
|
|
|
8032
8310
|
fileInputRef.current?.click();
|
|
8033
8311
|
}
|
|
8034
8312
|
const isSubmitDisabled = imageSource === "file" ? uploadedUrl.trim() === "" || isUploading : url.trim() === "";
|
|
8035
|
-
return /* @__PURE__ */
|
|
8036
|
-
/* @__PURE__ */
|
|
8037
|
-
/* @__PURE__ */
|
|
8038
|
-
hasOnImageChange && /* @__PURE__ */
|
|
8039
|
-
/* @__PURE__ */
|
|
8040
|
-
/* @__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(
|
|
8041
8319
|
"input",
|
|
8042
8320
|
{
|
|
8043
8321
|
type: "radio",
|
|
@@ -8050,8 +8328,8 @@ function ImageUrlDialog({
|
|
|
8050
8328
|
),
|
|
8051
8329
|
t("imageSourceFile")
|
|
8052
8330
|
] }),
|
|
8053
|
-
/* @__PURE__ */
|
|
8054
|
-
/* @__PURE__ */
|
|
8331
|
+
/* @__PURE__ */ jsxs29("label", { style: { display: "inline-flex", alignItems: "center", cursor: "pointer" }, children: [
|
|
8332
|
+
/* @__PURE__ */ jsx59(
|
|
8055
8333
|
"input",
|
|
8056
8334
|
{
|
|
8057
8335
|
type: "radio",
|
|
@@ -8065,9 +8343,9 @@ function ImageUrlDialog({
|
|
|
8065
8343
|
t("imageSourceUrl")
|
|
8066
8344
|
] })
|
|
8067
8345
|
] }),
|
|
8068
|
-
imageSource === "url" ? /* @__PURE__ */
|
|
8069
|
-
/* @__PURE__ */
|
|
8070
|
-
/* @__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(
|
|
8071
8349
|
"input",
|
|
8072
8350
|
{
|
|
8073
8351
|
type: "text",
|
|
@@ -8083,8 +8361,8 @@ function ImageUrlDialog({
|
|
|
8083
8361
|
placeholder: "https://example.com/image.jpg"
|
|
8084
8362
|
}
|
|
8085
8363
|
)
|
|
8086
|
-
] }) : /* @__PURE__ */
|
|
8087
|
-
/* @__PURE__ */
|
|
8364
|
+
] }) : /* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
|
|
8365
|
+
/* @__PURE__ */ jsx59(
|
|
8088
8366
|
"input",
|
|
8089
8367
|
{
|
|
8090
8368
|
ref: fileInputRef,
|
|
@@ -8094,7 +8372,7 @@ function ImageUrlDialog({
|
|
|
8094
8372
|
style: { display: "none" }
|
|
8095
8373
|
}
|
|
8096
8374
|
),
|
|
8097
|
-
/* @__PURE__ */
|
|
8375
|
+
/* @__PURE__ */ jsx59(
|
|
8098
8376
|
"button",
|
|
8099
8377
|
{
|
|
8100
8378
|
type: "button",
|
|
@@ -8111,9 +8389,9 @@ function ImageUrlDialog({
|
|
|
8111
8389
|
children: isUploading ? t("uploading") : t("selectFile")
|
|
8112
8390
|
}
|
|
8113
8391
|
),
|
|
8114
|
-
uploadedUrl && /* @__PURE__ */
|
|
8115
|
-
/* @__PURE__ */
|
|
8116
|
-
/* @__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(
|
|
8117
8395
|
"input",
|
|
8118
8396
|
{
|
|
8119
8397
|
type: "text",
|
|
@@ -8132,9 +8410,9 @@ function ImageUrlDialog({
|
|
|
8132
8410
|
)
|
|
8133
8411
|
] })
|
|
8134
8412
|
] }),
|
|
8135
|
-
/* @__PURE__ */
|
|
8136
|
-
/* @__PURE__ */
|
|
8137
|
-
/* @__PURE__ */
|
|
8413
|
+
/* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
|
|
8414
|
+
/* @__PURE__ */ jsx59("label", { style: { display: "block", marginBottom: "4px" }, children: t("altText") }),
|
|
8415
|
+
/* @__PURE__ */ jsx59(
|
|
8138
8416
|
"input",
|
|
8139
8417
|
{
|
|
8140
8418
|
type: "text",
|
|
@@ -8151,9 +8429,9 @@ function ImageUrlDialog({
|
|
|
8151
8429
|
}
|
|
8152
8430
|
)
|
|
8153
8431
|
] }),
|
|
8154
|
-
/* @__PURE__ */
|
|
8155
|
-
/* @__PURE__ */
|
|
8156
|
-
/* @__PURE__ */
|
|
8432
|
+
/* @__PURE__ */ jsxs29("div", { style: { marginBottom: "8px" }, children: [
|
|
8433
|
+
/* @__PURE__ */ jsx59("label", { style: { display: "block", marginBottom: "4px" }, children: t("title") }),
|
|
8434
|
+
/* @__PURE__ */ jsx59(
|
|
8157
8435
|
"input",
|
|
8158
8436
|
{
|
|
8159
8437
|
type: "text",
|
|
@@ -8170,8 +8448,8 @@ function ImageUrlDialog({
|
|
|
8170
8448
|
}
|
|
8171
8449
|
)
|
|
8172
8450
|
] }),
|
|
8173
|
-
/* @__PURE__ */
|
|
8174
|
-
/* @__PURE__ */
|
|
8451
|
+
/* @__PURE__ */ jsxs29("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
8452
|
+
/* @__PURE__ */ jsx59(
|
|
8175
8453
|
"button",
|
|
8176
8454
|
{
|
|
8177
8455
|
type: "submit",
|
|
@@ -8190,7 +8468,7 @@ function ImageUrlDialog({
|
|
|
8190
8468
|
children: t("register")
|
|
8191
8469
|
}
|
|
8192
8470
|
),
|
|
8193
|
-
/* @__PURE__ */
|
|
8471
|
+
/* @__PURE__ */ jsx59(
|
|
8194
8472
|
"button",
|
|
8195
8473
|
{
|
|
8196
8474
|
type: "button",
|
|
@@ -8215,14 +8493,16 @@ function ImageUrlDialog({
|
|
|
8215
8493
|
import { isHotkey as isHotkey3 } from "is-hotkey";
|
|
8216
8494
|
import {
|
|
8217
8495
|
useCallback as useCallback13,
|
|
8218
|
-
|
|
8219
|
-
|
|
8496
|
+
useMemo as useMemo2,
|
|
8497
|
+
useRef as useRef8,
|
|
8498
|
+
useState as useState10
|
|
8220
8499
|
} from "react";
|
|
8221
|
-
import {
|
|
8500
|
+
import { Editor as Editor59, Range as Range10 } from "slate";
|
|
8501
|
+
import { ReactEditor as ReactEditor14, useSlateStatic as useSlateStatic19 } from "slate-react";
|
|
8222
8502
|
|
|
8223
8503
|
// src/toolbar-plugin/styles/dialog-shared-styles.ts
|
|
8224
|
-
import
|
|
8225
|
-
var $DialogButton =
|
|
8504
|
+
import styled36 from "@emotion/styled";
|
|
8505
|
+
var $DialogButton = styled36("div")`
|
|
8226
8506
|
/* Center vertically and horizontally */
|
|
8227
8507
|
display: flex;
|
|
8228
8508
|
align-items: center;
|
|
@@ -8247,7 +8527,7 @@ var $DialogButton = styled35("div")`
|
|
|
8247
8527
|
stroke-width: 2px;
|
|
8248
8528
|
}
|
|
8249
8529
|
`;
|
|
8250
|
-
var $DialogHint =
|
|
8530
|
+
var $DialogHint = styled36("div")`
|
|
8251
8531
|
font-size: 0.875em;
|
|
8252
8532
|
margin-top: 0.5em;
|
|
8253
8533
|
color: var(--shade-500);
|
|
@@ -8255,14 +8535,14 @@ var $DialogHint = styled35("div")`
|
|
|
8255
8535
|
`;
|
|
8256
8536
|
|
|
8257
8537
|
// src/toolbar-plugin/components/dialog/anchor-dialog.tsx
|
|
8258
|
-
import { Fragment as Fragment9, jsx as
|
|
8538
|
+
import { Fragment as Fragment9, jsx as jsx60, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8259
8539
|
var isEnter = isHotkey3("enter");
|
|
8260
8540
|
function AnchorDialog2({
|
|
8261
8541
|
dest,
|
|
8262
8542
|
close
|
|
8263
8543
|
}) {
|
|
8264
|
-
const editor =
|
|
8265
|
-
const ref =
|
|
8544
|
+
const editor = useSlateStatic19();
|
|
8545
|
+
const ref = useRef8(null);
|
|
8266
8546
|
const style = useAbsoluteReposition(
|
|
8267
8547
|
{ src: ref, dest },
|
|
8268
8548
|
({ src, dest: dest2 }, viewport) => {
|
|
@@ -8277,18 +8557,47 @@ function AnchorDialog2({
|
|
|
8277
8557
|
);
|
|
8278
8558
|
}
|
|
8279
8559
|
);
|
|
8280
|
-
const
|
|
8560
|
+
const initialText = useMemo2(() => {
|
|
8561
|
+
const { selection } = editor;
|
|
8562
|
+
if (selection && !Range10.isCollapsed(selection)) {
|
|
8563
|
+
return Editor59.string(editor, selection);
|
|
8564
|
+
}
|
|
8565
|
+
return "";
|
|
8566
|
+
}, []);
|
|
8567
|
+
const [url, setUrl] = useState10("");
|
|
8568
|
+
const [text, setText] = useState10(initialText);
|
|
8569
|
+
const [title, setTitle] = useState10(initialText);
|
|
8570
|
+
const [titleManuallyEdited, setTitleManuallyEdited] = useState10(false);
|
|
8281
8571
|
const insertLink2 = () => {
|
|
8282
|
-
|
|
8572
|
+
const linkText = text.trim() || url;
|
|
8573
|
+
const linkTitle = title.trim() || void 0;
|
|
8574
|
+
editor.anchor.insertLink(url, linkText, { select: true, title: linkTitle });
|
|
8283
8575
|
ReactEditor14.focus(editor);
|
|
8284
8576
|
close();
|
|
8285
8577
|
};
|
|
8286
|
-
const
|
|
8578
|
+
const onChangeUrl = useCallback13(
|
|
8287
8579
|
(e) => {
|
|
8288
8580
|
setUrl(e.currentTarget.value);
|
|
8289
8581
|
},
|
|
8290
8582
|
[setUrl]
|
|
8291
8583
|
);
|
|
8584
|
+
const onChangeText = useCallback13(
|
|
8585
|
+
(e) => {
|
|
8586
|
+
const newText = e.currentTarget.value;
|
|
8587
|
+
setText(newText);
|
|
8588
|
+
if (!titleManuallyEdited) {
|
|
8589
|
+
setTitle(newText);
|
|
8590
|
+
}
|
|
8591
|
+
},
|
|
8592
|
+
[setText, setTitle, titleManuallyEdited]
|
|
8593
|
+
);
|
|
8594
|
+
const onChangeTitle = useCallback13(
|
|
8595
|
+
(e) => {
|
|
8596
|
+
setTitle(e.currentTarget.value);
|
|
8597
|
+
setTitleManuallyEdited(true);
|
|
8598
|
+
},
|
|
8599
|
+
[setTitle]
|
|
8600
|
+
);
|
|
8292
8601
|
const onKeyDown = (e) => {
|
|
8293
8602
|
if (!isEnter(e))
|
|
8294
8603
|
return;
|
|
@@ -8296,26 +8605,47 @@ function AnchorDialog2({
|
|
|
8296
8605
|
e.stopPropagation();
|
|
8297
8606
|
insertLink2();
|
|
8298
8607
|
};
|
|
8299
|
-
return /* @__PURE__ */
|
|
8300
|
-
/* @__PURE__ */
|
|
8301
|
-
/* @__PURE__ */
|
|
8302
|
-
/* @__PURE__ */
|
|
8303
|
-
|
|
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(
|
|
8612
|
+
$AnchorDialogInput,
|
|
8613
|
+
{
|
|
8614
|
+
type: "text",
|
|
8615
|
+
value: url,
|
|
8616
|
+
autoFocus: true,
|
|
8617
|
+
placeholder: t("linkUrl"),
|
|
8618
|
+
onChange: onChangeUrl,
|
|
8619
|
+
onKeyDown
|
|
8620
|
+
}
|
|
8621
|
+
) }),
|
|
8622
|
+
/* @__PURE__ */ jsx60($AnchorDialogInputLine, { style: { marginTop: "0.5em" }, children: /* @__PURE__ */ jsx60(
|
|
8623
|
+
$AnchorDialogInput,
|
|
8624
|
+
{
|
|
8625
|
+
type: "text",
|
|
8626
|
+
value: text,
|
|
8627
|
+
placeholder: t("linkText"),
|
|
8628
|
+
onChange: onChangeText,
|
|
8629
|
+
onKeyDown
|
|
8630
|
+
}
|
|
8631
|
+
) }),
|
|
8632
|
+
/* @__PURE__ */ jsxs30($AnchorDialogInputLine, { style: { marginTop: "0.5em" }, children: [
|
|
8633
|
+
/* @__PURE__ */ jsx60(
|
|
8304
8634
|
$AnchorDialogInput,
|
|
8305
8635
|
{
|
|
8306
8636
|
type: "text",
|
|
8307
|
-
value:
|
|
8308
|
-
|
|
8309
|
-
onChange:
|
|
8637
|
+
value: title,
|
|
8638
|
+
placeholder: t("tooltipText"),
|
|
8639
|
+
onChange: onChangeTitle,
|
|
8310
8640
|
onKeyDown
|
|
8311
8641
|
}
|
|
8312
8642
|
),
|
|
8313
|
-
/* @__PURE__ */
|
|
8314
|
-
/* @__PURE__ */
|
|
8315
|
-
/* @__PURE__ */
|
|
8643
|
+
/* @__PURE__ */ jsxs30($DialogButton, { onClick: insertLink2, children: [
|
|
8644
|
+
/* @__PURE__ */ jsx60(Link, {}),
|
|
8645
|
+
/* @__PURE__ */ jsx60(LinkPlus, {})
|
|
8316
8646
|
] })
|
|
8317
8647
|
] }),
|
|
8318
|
-
/* @__PURE__ */
|
|
8648
|
+
/* @__PURE__ */ jsx60($DialogHint, { children: t("tooltipHint") })
|
|
8319
8649
|
] })
|
|
8320
8650
|
] });
|
|
8321
8651
|
}
|
|
@@ -8329,17 +8659,17 @@ var dialogItems = [
|
|
|
8329
8659
|
hotkey: "mod+k",
|
|
8330
8660
|
Component: AnchorDialog2
|
|
8331
8661
|
},
|
|
8332
|
-
{
|
|
8333
|
-
icon: Table2,
|
|
8334
|
-
title: t("insertTable"),
|
|
8335
|
-
more: true,
|
|
8336
|
-
Component: TableDialog
|
|
8337
|
-
},
|
|
8338
8662
|
{
|
|
8339
8663
|
icon: Image,
|
|
8340
8664
|
title: t("insertImageFromUrl"),
|
|
8341
8665
|
more: true,
|
|
8342
8666
|
Component: ImageUrlDialog
|
|
8667
|
+
},
|
|
8668
|
+
{
|
|
8669
|
+
icon: Table2,
|
|
8670
|
+
title: t("insertTable"),
|
|
8671
|
+
more: true,
|
|
8672
|
+
Component: TableDialog
|
|
8343
8673
|
}
|
|
8344
8674
|
];
|
|
8345
8675
|
var expandedDialogItems = dialogItems;
|
|
@@ -8354,15 +8684,16 @@ var smallDialogItems = [
|
|
|
8354
8684
|
];
|
|
8355
8685
|
|
|
8356
8686
|
// src/toolbar-plugin/items/mark-items.tsx
|
|
8357
|
-
import { Editor as
|
|
8687
|
+
import { Editor as Editor60 } from "slate";
|
|
8358
8688
|
function getMarks(editor) {
|
|
8359
|
-
const marks =
|
|
8689
|
+
const marks = Editor60.marks(editor);
|
|
8360
8690
|
return {
|
|
8361
8691
|
bold: marks?.bold || false,
|
|
8362
8692
|
italic: marks?.italic || false,
|
|
8363
8693
|
strike: marks?.strike || false,
|
|
8364
8694
|
code: marks?.code || false,
|
|
8365
|
-
underline: marks?.underline || false
|
|
8695
|
+
underline: marks?.underline || false,
|
|
8696
|
+
highlight: marks?.highlight || false
|
|
8366
8697
|
};
|
|
8367
8698
|
}
|
|
8368
8699
|
var primaryMarkItems = [
|
|
@@ -8400,6 +8731,13 @@ var primaryMarkItems = [
|
|
|
8400
8731
|
hotkey: "mod+u",
|
|
8401
8732
|
action: (editor) => editor.marksPlugin.toggleUnderline(),
|
|
8402
8733
|
active: (editor) => getMarks(editor).underline
|
|
8734
|
+
},
|
|
8735
|
+
{
|
|
8736
|
+
icon: Highlight,
|
|
8737
|
+
title: t("highlight"),
|
|
8738
|
+
action: (editor) => editor.marksPlugin.toggleHighlight(),
|
|
8739
|
+
active: (editor) => getMarks(editor).highlight,
|
|
8740
|
+
show: (editor) => !editor.wysimark?.disableHighlight
|
|
8403
8741
|
}
|
|
8404
8742
|
];
|
|
8405
8743
|
var expandedMarkItems = primaryMarkItems;
|
|
@@ -8418,19 +8756,22 @@ var listItems = [
|
|
|
8418
8756
|
icon: BulletList,
|
|
8419
8757
|
title: t("bulletList"),
|
|
8420
8758
|
hotkey: "super+8",
|
|
8421
|
-
action: (editor) => editor.list
|
|
8759
|
+
action: (editor) => editor.list?.convertUnorderedList(true),
|
|
8760
|
+
show: (editor) => !!editor.list
|
|
8422
8761
|
},
|
|
8423
8762
|
{
|
|
8424
8763
|
icon: ListNumbers,
|
|
8425
8764
|
title: t("numberedList"),
|
|
8426
8765
|
hotkey: "super+7",
|
|
8427
|
-
action: (editor) => editor.list
|
|
8766
|
+
action: (editor) => editor.list?.convertOrderedList(true),
|
|
8767
|
+
show: (editor) => !!editor.list
|
|
8428
8768
|
},
|
|
8429
8769
|
{
|
|
8430
8770
|
icon: ListCheck,
|
|
8431
8771
|
title: t("checkList"),
|
|
8432
8772
|
hotkey: "super+9",
|
|
8433
|
-
action: (editor) => editor.list
|
|
8773
|
+
action: (editor) => editor.list?.convertTaskList(true),
|
|
8774
|
+
show: (editor) => !!editor.list && !editor.wysimark?.disableTaskList
|
|
8434
8775
|
}
|
|
8435
8776
|
];
|
|
8436
8777
|
var expandedListItems = [...listItems, "divider", ...listDepthItems];
|
|
@@ -8439,12 +8780,13 @@ var compactListItems = [
|
|
|
8439
8780
|
icon: ListNumbers,
|
|
8440
8781
|
title: t("list"),
|
|
8441
8782
|
more: true,
|
|
8442
|
-
children: [...listItems, "divider", ...listDepthItems]
|
|
8783
|
+
children: [...listItems, "divider", ...listDepthItems],
|
|
8784
|
+
show: (editor) => !!editor.list
|
|
8443
8785
|
}
|
|
8444
8786
|
];
|
|
8445
8787
|
|
|
8446
8788
|
// src/toolbar-plugin/items/quote-items.tsx
|
|
8447
|
-
import { Editor as
|
|
8789
|
+
import { Editor as Editor61, Transforms as Transforms44 } from "slate";
|
|
8448
8790
|
var quoteItemsList = [
|
|
8449
8791
|
{
|
|
8450
8792
|
icon: Quote,
|
|
@@ -8473,9 +8815,9 @@ var quoteItemsList = [
|
|
|
8473
8815
|
const codeBlockEntry = findElementUp(editor, "code-block");
|
|
8474
8816
|
if (codeBlockEntry) {
|
|
8475
8817
|
const [codeBlock, path] = codeBlockEntry;
|
|
8476
|
-
const textContent =
|
|
8477
|
-
|
|
8478
|
-
|
|
8818
|
+
const textContent = Editor61.string(editor, path);
|
|
8819
|
+
Transforms44.removeNodes(editor, { at: path });
|
|
8820
|
+
Transforms44.insertNodes(
|
|
8479
8821
|
editor,
|
|
8480
8822
|
{
|
|
8481
8823
|
type: "paragraph",
|
|
@@ -8486,13 +8828,13 @@ var quoteItemsList = [
|
|
|
8486
8828
|
return;
|
|
8487
8829
|
}
|
|
8488
8830
|
if (selection && JSON.stringify(selection.anchor.path) !== JSON.stringify(selection.focus.path)) {
|
|
8489
|
-
editor.codeBlock
|
|
8831
|
+
editor.codeBlock?.createCodeBlock({ language: "text" });
|
|
8490
8832
|
return;
|
|
8491
8833
|
}
|
|
8492
8834
|
if (selection && (selection.anchor.offset !== selection.focus.offset || JSON.stringify(selection.anchor.path) !== JSON.stringify(selection.focus.path))) {
|
|
8493
|
-
const selectedText =
|
|
8494
|
-
|
|
8495
|
-
|
|
8835
|
+
const selectedText = Editor61.string(editor, selection);
|
|
8836
|
+
Transforms44.delete(editor);
|
|
8837
|
+
Transforms44.insertNodes(
|
|
8496
8838
|
editor,
|
|
8497
8839
|
{
|
|
8498
8840
|
type: "code-block",
|
|
@@ -8507,9 +8849,10 @@ var quoteItemsList = [
|
|
|
8507
8849
|
);
|
|
8508
8850
|
return;
|
|
8509
8851
|
}
|
|
8510
|
-
editor.codeBlock
|
|
8852
|
+
editor.codeBlock?.createCodeBlock({ language: "text" });
|
|
8511
8853
|
},
|
|
8512
|
-
active: (editor) => !!findElementUp(editor, "code-block")
|
|
8854
|
+
active: (editor) => !!findElementUp(editor, "code-block"),
|
|
8855
|
+
show: (editor) => !!editor.codeBlock && !editor.wysimark?.disableCodeBlock
|
|
8513
8856
|
}
|
|
8514
8857
|
];
|
|
8515
8858
|
var expandedQuoteItems = quoteItemsList;
|
|
@@ -8531,9 +8874,9 @@ var rawModeItem = {
|
|
|
8531
8874
|
editor.wysimark.toggleRawMode();
|
|
8532
8875
|
}
|
|
8533
8876
|
},
|
|
8534
|
-
// Only show in the toolbar when not in Raw mode
|
|
8877
|
+
// Only show in the toolbar when not in Raw mode and toggleRawMode is available
|
|
8535
8878
|
show: (editor) => {
|
|
8536
|
-
return editor.wysimark && !editor.wysimark.isRawMode;
|
|
8879
|
+
return editor.wysimark && typeof editor.wysimark.toggleRawMode === "function" && !editor.wysimark.isRawMode;
|
|
8537
8880
|
},
|
|
8538
8881
|
active: () => false
|
|
8539
8882
|
// Never show as active in the toolbar
|
|
@@ -8602,16 +8945,16 @@ var itemSets = [largeItems, mediumItems, smallItems];
|
|
|
8602
8945
|
|
|
8603
8946
|
// src/toolbar-plugin/components/toolbar/toolbar-button.tsx
|
|
8604
8947
|
import { clsx as clsx9 } from "clsx";
|
|
8605
|
-
import { useCallback as useCallback14, useRef as
|
|
8606
|
-
import { ReactEditor as ReactEditor15, useSlate as useSlate2, useSlateStatic as
|
|
8607
|
-
import { jsx as
|
|
8948
|
+
import { useCallback as useCallback14, useRef as useRef9 } from "react";
|
|
8949
|
+
import { ReactEditor as ReactEditor15, useSlate as useSlate2, useSlateStatic as useSlateStatic20 } from "slate-react";
|
|
8950
|
+
import { jsx as jsx61, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
8608
8951
|
function ToolbarButton({
|
|
8609
8952
|
item
|
|
8610
8953
|
}) {
|
|
8611
|
-
const staticEditor =
|
|
8954
|
+
const staticEditor = useSlateStatic20();
|
|
8612
8955
|
const editor = useSlate2();
|
|
8613
8956
|
const isActive = item.active ? item.active(editor) : false;
|
|
8614
|
-
const ref =
|
|
8957
|
+
const ref = useRef9(null);
|
|
8615
8958
|
const tooltip = useTooltip({
|
|
8616
8959
|
title: item.title,
|
|
8617
8960
|
hotkey: () => item.hotkey ? formatHotkey(item.hotkey) : void 0
|
|
@@ -8624,9 +8967,9 @@ function ToolbarButton({
|
|
|
8624
8967
|
if (!dest)
|
|
8625
8968
|
return;
|
|
8626
8969
|
if (items) {
|
|
8627
|
-
menuLayer.open(() => /* @__PURE__ */
|
|
8970
|
+
menuLayer.open(() => /* @__PURE__ */ jsx61(Menu, { dest, items, close: menuLayer.close }));
|
|
8628
8971
|
} else if (Component) {
|
|
8629
|
-
menuLayer.open(() => /* @__PURE__ */
|
|
8972
|
+
menuLayer.open(() => /* @__PURE__ */ jsx61(Component, { dest, close: menuLayer.close }));
|
|
8630
8973
|
}
|
|
8631
8974
|
}, [item]);
|
|
8632
8975
|
const onClick = useCallback14(() => {
|
|
@@ -8649,7 +8992,7 @@ function ToolbarButton({
|
|
|
8649
8992
|
},
|
|
8650
8993
|
[menuLayer.layer]
|
|
8651
8994
|
);
|
|
8652
|
-
return /* @__PURE__ */
|
|
8995
|
+
return /* @__PURE__ */ jsxs31(
|
|
8653
8996
|
$ToolbarButton,
|
|
8654
8997
|
{
|
|
8655
8998
|
"data-item-type": "button",
|
|
@@ -8663,24 +9006,24 @@ function ToolbarButton({
|
|
|
8663
9006
|
"--disabled": !isActive && r(item?.title)?.includes("Depth")
|
|
8664
9007
|
}),
|
|
8665
9008
|
children: [
|
|
8666
|
-
/* @__PURE__ */
|
|
8667
|
-
item.more ? /* @__PURE__ */
|
|
9009
|
+
/* @__PURE__ */ jsx61(item.icon, {}),
|
|
9010
|
+
item.more ? /* @__PURE__ */ jsx61(More, {}) : null
|
|
8668
9011
|
]
|
|
8669
9012
|
}
|
|
8670
9013
|
);
|
|
8671
9014
|
}
|
|
8672
9015
|
|
|
8673
9016
|
// src/toolbar-plugin/components/toolbar/toolbar.tsx
|
|
8674
|
-
import { jsx as
|
|
9017
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
8675
9018
|
function ToolbarItem({ item }) {
|
|
8676
|
-
const editor =
|
|
9019
|
+
const editor = useSlateStatic21();
|
|
8677
9020
|
if (item === "divider") {
|
|
8678
|
-
return /* @__PURE__ */
|
|
9021
|
+
return /* @__PURE__ */ jsx62($ToolbarDividerContainer, { "data-item-type": "divider", children: /* @__PURE__ */ jsx62($ToolbarDivider, {}) });
|
|
8679
9022
|
}
|
|
8680
9023
|
const show = item.show === void 0 ? true : item.show(editor);
|
|
8681
9024
|
if (!show)
|
|
8682
9025
|
return null;
|
|
8683
|
-
return /* @__PURE__ */
|
|
9026
|
+
return /* @__PURE__ */ jsx62(ToolbarButton, { item });
|
|
8684
9027
|
}
|
|
8685
9028
|
function getWidths(toolbar) {
|
|
8686
9029
|
const button = toolbar.querySelector(
|
|
@@ -8706,8 +9049,8 @@ function measureItemSetWidth(items, buttonWidth, dividerWidth) {
|
|
|
8706
9049
|
}
|
|
8707
9050
|
var WIDTH_BUFFER_PX = 48;
|
|
8708
9051
|
function Toolbar() {
|
|
8709
|
-
const ref =
|
|
8710
|
-
const [items, setItems] =
|
|
9052
|
+
const ref = useRef10(null);
|
|
9053
|
+
const [items, setItems] = useState11(initialItems);
|
|
8711
9054
|
useEffect8(() => {
|
|
8712
9055
|
const refresh = throttle2(
|
|
8713
9056
|
() => {
|
|
@@ -8738,7 +9081,7 @@ function Toolbar() {
|
|
|
8738
9081
|
window.removeEventListener("resize", refresh);
|
|
8739
9082
|
};
|
|
8740
9083
|
}, []);
|
|
8741
|
-
return /* @__PURE__ */
|
|
9084
|
+
return /* @__PURE__ */ jsx62($ToolbarContainer, { ref, children: /* @__PURE__ */ jsx62($Toolbar, { children: items.map((item, index) => /* @__PURE__ */ jsx62(
|
|
8742
9085
|
ToolbarItem,
|
|
8743
9086
|
{
|
|
8744
9087
|
item
|
|
@@ -8748,21 +9091,21 @@ function Toolbar() {
|
|
|
8748
9091
|
}
|
|
8749
9092
|
|
|
8750
9093
|
// src/toolbar-plugin/render-editable/index.tsx
|
|
8751
|
-
import { jsx as
|
|
9094
|
+
import { jsx as jsx63, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8752
9095
|
function renderEditable({ attributes, Editable: Editable3 }) {
|
|
8753
|
-
const outerContainerRef =
|
|
8754
|
-
const editor =
|
|
9096
|
+
const outerContainerRef = useRef11(null);
|
|
9097
|
+
const editor = useSlateStatic22();
|
|
8755
9098
|
const focused = useFocused();
|
|
8756
9099
|
const onClickOuterContainer = useCallback15(
|
|
8757
9100
|
(e) => {
|
|
8758
9101
|
if (e.target !== e.currentTarget)
|
|
8759
9102
|
return;
|
|
8760
|
-
|
|
9103
|
+
Transforms45.select(editor, Editor62.end(editor, []));
|
|
8761
9104
|
ReactEditor16.focus(editor);
|
|
8762
9105
|
},
|
|
8763
9106
|
[editor]
|
|
8764
9107
|
);
|
|
8765
|
-
return /* @__PURE__ */
|
|
9108
|
+
return /* @__PURE__ */ jsx63(Layers, { children: /* @__PURE__ */ jsxs32(
|
|
8766
9109
|
$OuterContainer,
|
|
8767
9110
|
{
|
|
8768
9111
|
ref: outerContainerRef,
|
|
@@ -8774,8 +9117,8 @@ function renderEditable({ attributes, Editable: Editable3 }) {
|
|
|
8774
9117
|
},
|
|
8775
9118
|
onClick: onClickOuterContainer,
|
|
8776
9119
|
children: [
|
|
8777
|
-
/* @__PURE__ */
|
|
8778
|
-
/* @__PURE__ */
|
|
9120
|
+
/* @__PURE__ */ jsx63(Toolbar, {}),
|
|
9121
|
+
/* @__PURE__ */ jsx63(
|
|
8779
9122
|
Editable3,
|
|
8780
9123
|
{
|
|
8781
9124
|
as: $Editable,
|
|
@@ -8807,7 +9150,7 @@ var ToolbarPlugin = createPlugin(
|
|
|
8807
9150
|
);
|
|
8808
9151
|
|
|
8809
9152
|
// src/trailing-block-plugin/index.tsx
|
|
8810
|
-
import { Editor as
|
|
9153
|
+
import { Editor as Editor63, Node as Node15, Path as Path16, Transforms as Transforms46 } from "slate";
|
|
8811
9154
|
var TrailingBlockPlugin = createPlugin(
|
|
8812
9155
|
(editor) => {
|
|
8813
9156
|
editor.allowTrailingBlock = true;
|
|
@@ -8815,19 +9158,19 @@ var TrailingBlockPlugin = createPlugin(
|
|
|
8815
9158
|
name: "trailing-block",
|
|
8816
9159
|
editor: {
|
|
8817
9160
|
normalizeNode: (entry) => {
|
|
8818
|
-
if (!
|
|
9161
|
+
if (!Editor63.isEditor(entry[0]))
|
|
8819
9162
|
return false;
|
|
8820
9163
|
const lastPath = [editor.children.length - 1];
|
|
8821
|
-
const lastElement =
|
|
9164
|
+
const lastElement = Node15.child(
|
|
8822
9165
|
editor,
|
|
8823
9166
|
editor.children.length - 1
|
|
8824
9167
|
);
|
|
8825
|
-
if (
|
|
8826
|
-
|
|
9168
|
+
if (Editor63.hasBlocks(editor, lastElement) || Editor63.isVoid(editor, lastElement)) {
|
|
9169
|
+
Transforms46.insertNodes(
|
|
8827
9170
|
editor,
|
|
8828
9171
|
{ type: "paragraph", children: [{ text: "" }] },
|
|
8829
9172
|
{
|
|
8830
|
-
at:
|
|
9173
|
+
at: Path16.next(lastPath)
|
|
8831
9174
|
}
|
|
8832
9175
|
);
|
|
8833
9176
|
}
|
|
@@ -8839,11 +9182,11 @@ var TrailingBlockPlugin = createPlugin(
|
|
|
8839
9182
|
);
|
|
8840
9183
|
|
|
8841
9184
|
// src/paste-markdown-plugin/methods/index.ts
|
|
8842
|
-
import { Transforms as
|
|
9185
|
+
import { Transforms as Transforms47 } from "slate";
|
|
8843
9186
|
function pasteMarkdown(editor, markdown) {
|
|
8844
9187
|
const escapedMarkdown = escapeUrlSlashes(markdown);
|
|
8845
9188
|
const fragment = parse(escapedMarkdown);
|
|
8846
|
-
|
|
9189
|
+
Transforms47.insertNodes(editor, fragment);
|
|
8847
9190
|
}
|
|
8848
9191
|
function createPasteMarkdownMethods(editor) {
|
|
8849
9192
|
return {
|
|
@@ -8875,7 +9218,7 @@ var PasteMarkdownPlugin = createPlugin(
|
|
|
8875
9218
|
);
|
|
8876
9219
|
|
|
8877
9220
|
// src/placeholder-plugin/index.tsx
|
|
8878
|
-
import { jsx as
|
|
9221
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
8879
9222
|
function renderPlaceholder(props) {
|
|
8880
9223
|
const nextAttributes = {
|
|
8881
9224
|
...props.attributes,
|
|
@@ -8885,7 +9228,7 @@ function renderPlaceholder(props) {
|
|
|
8885
9228
|
maxWidth: void 0
|
|
8886
9229
|
}
|
|
8887
9230
|
};
|
|
8888
|
-
return /* @__PURE__ */
|
|
9231
|
+
return /* @__PURE__ */ jsx64("span", { ...nextAttributes, children: props.children });
|
|
8889
9232
|
}
|
|
8890
9233
|
var PlaceholderPlugin = createPlugin(
|
|
8891
9234
|
(editor, _options, { createPolicy }) => {
|
|
@@ -8900,7 +9243,7 @@ var PlaceholderPlugin = createPlugin(
|
|
|
8900
9243
|
);
|
|
8901
9244
|
|
|
8902
9245
|
// src/entry/plugins.ts
|
|
8903
|
-
var
|
|
9246
|
+
var defaultPlugins = [
|
|
8904
9247
|
PasteMarkdownPlugin,
|
|
8905
9248
|
ConvertElementPlugin,
|
|
8906
9249
|
AnchorPlugin,
|
|
@@ -8909,6 +9252,7 @@ var plugins = [
|
|
|
8909
9252
|
InlineCodePlugin,
|
|
8910
9253
|
BlockQuotePlugin,
|
|
8911
9254
|
CodeBlockPlugin,
|
|
9255
|
+
HtmlBlockPlugin,
|
|
8912
9256
|
TablePlugin,
|
|
8913
9257
|
HorizontalRulePlugin,
|
|
8914
9258
|
TrailingBlockPlugin,
|
|
@@ -8923,21 +9267,24 @@ var plugins = [
|
|
|
8923
9267
|
];
|
|
8924
9268
|
|
|
8925
9269
|
// src/entry/SinkEditable.tsx
|
|
8926
|
-
var
|
|
8927
|
-
var { withSink, SinkEditable: SinkEditable2 } = Sink;
|
|
9270
|
+
var { withSink, SinkEditable: SinkEditable2 } = createSink(defaultPlugins);
|
|
8928
9271
|
|
|
8929
9272
|
// src/entry/useEditor.tsx
|
|
8930
|
-
import { useState as
|
|
8931
|
-
import { createEditor, Editor as
|
|
9273
|
+
import { useState as useState12 } from "react";
|
|
9274
|
+
import { createEditor, Editor as Editor65, Transforms as Transforms48 } from "slate";
|
|
8932
9275
|
import { withHistory } from "slate-history";
|
|
8933
9276
|
import { withReact } from "slate-react";
|
|
8934
9277
|
function useEditor({
|
|
8935
9278
|
authToken,
|
|
8936
9279
|
height,
|
|
8937
9280
|
minHeight,
|
|
8938
|
-
maxHeight
|
|
8939
|
-
|
|
8940
|
-
|
|
9281
|
+
maxHeight,
|
|
9282
|
+
disableRawMode,
|
|
9283
|
+
disableTaskList,
|
|
9284
|
+
disableCodeBlock,
|
|
9285
|
+
disableHighlight
|
|
9286
|
+
} = {}) {
|
|
9287
|
+
const [editor] = useState12(() => {
|
|
8941
9288
|
const editor2 = createEditor();
|
|
8942
9289
|
const nextEditor = withSink(withReact(withHistory(editor2)), {
|
|
8943
9290
|
toolbar: {
|
|
@@ -8953,8 +9300,14 @@ function useEditor({
|
|
|
8953
9300
|
});
|
|
8954
9301
|
nextEditor.convertElement.addConvertElementType("paragraph");
|
|
8955
9302
|
editor2.wysimark = {
|
|
8956
|
-
//
|
|
8957
|
-
|
|
9303
|
+
// Disable raw mode (defaults to true)
|
|
9304
|
+
disableRawMode: disableRawMode ?? true,
|
|
9305
|
+
// Disable task list if specified
|
|
9306
|
+
disableTaskList,
|
|
9307
|
+
// Disable code block if specified
|
|
9308
|
+
disableCodeBlock,
|
|
9309
|
+
// Disable highlight (defaults to true)
|
|
9310
|
+
disableHighlight: disableHighlight ?? true
|
|
8958
9311
|
};
|
|
8959
9312
|
editor2.getMarkdown = () => {
|
|
8960
9313
|
return serialize(editor2.children);
|
|
@@ -8964,7 +9317,7 @@ function useEditor({
|
|
|
8964
9317
|
const documentValue = parse(escapedMarkdown);
|
|
8965
9318
|
editor2.children = documentValue;
|
|
8966
9319
|
editor2.selection = null;
|
|
8967
|
-
|
|
9320
|
+
Transforms48.select(editor2, Editor65.start(editor2, [0]));
|
|
8968
9321
|
};
|
|
8969
9322
|
return nextEditor;
|
|
8970
9323
|
});
|
|
@@ -8972,9 +9325,9 @@ function useEditor({
|
|
|
8972
9325
|
}
|
|
8973
9326
|
|
|
8974
9327
|
// src/entry/index.tsx
|
|
8975
|
-
import { jsx as
|
|
9328
|
+
import { jsx as jsx65, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
8976
9329
|
function renderLeaf({ children, attributes }) {
|
|
8977
|
-
return /* @__PURE__ */
|
|
9330
|
+
return /* @__PURE__ */ jsx65("span", { ...attributes, children });
|
|
8978
9331
|
}
|
|
8979
9332
|
function Editable2({
|
|
8980
9333
|
editor,
|
|
@@ -8986,16 +9339,16 @@ function Editable2({
|
|
|
8986
9339
|
style,
|
|
8987
9340
|
onImageChange
|
|
8988
9341
|
}) {
|
|
8989
|
-
const [isRawMode, setIsRawMode] =
|
|
8990
|
-
const [rawText, setRawText] =
|
|
8991
|
-
const ignoreNextChangeRef =
|
|
8992
|
-
const initialValueRef =
|
|
8993
|
-
const prevValueRef =
|
|
8994
|
-
const lastEmittedValueRef =
|
|
9342
|
+
const [isRawMode, setIsRawMode] = useState13(false);
|
|
9343
|
+
const [rawText, setRawText] = useState13(value);
|
|
9344
|
+
const ignoreNextChangeRef = useRef12(false);
|
|
9345
|
+
const initialValueRef = useRef12(void 0);
|
|
9346
|
+
const prevValueRef = useRef12(void 0);
|
|
9347
|
+
const lastEmittedValueRef = useRef12(void 0);
|
|
8995
9348
|
const onThrottledSlateChange = useCallback16(
|
|
8996
9349
|
throttle3(
|
|
8997
9350
|
() => {
|
|
8998
|
-
const markdown = serialize(editor.children);
|
|
9351
|
+
const markdown = unescapeUrlSlashes(serialize(editor.children));
|
|
8999
9352
|
editor.wysimark.prevValue = {
|
|
9000
9353
|
markdown,
|
|
9001
9354
|
children: editor.children
|
|
@@ -9015,9 +9368,6 @@ function Editable2({
|
|
|
9015
9368
|
prevValueRef.current = nextValue;
|
|
9016
9369
|
return;
|
|
9017
9370
|
}
|
|
9018
|
-
if (prevValueRef.current === nextValue) {
|
|
9019
|
-
return;
|
|
9020
|
-
}
|
|
9021
9371
|
prevValueRef.current = nextValue;
|
|
9022
9372
|
onThrottledSlateChange();
|
|
9023
9373
|
},
|
|
@@ -9048,7 +9398,7 @@ function Editable2({
|
|
|
9048
9398
|
const documentValue = parse(valueToProcess);
|
|
9049
9399
|
editor.children = documentValue;
|
|
9050
9400
|
editor.selection = null;
|
|
9051
|
-
|
|
9401
|
+
Transforms49.select(editor, Editor66.start(editor, [0]));
|
|
9052
9402
|
}
|
|
9053
9403
|
}
|
|
9054
9404
|
}
|
|
@@ -9082,10 +9432,12 @@ function Editable2({
|
|
|
9082
9432
|
setIsRawMode(!isRawMode);
|
|
9083
9433
|
}, [isRawMode, applyRawTextToEditor, updateRawTextFromEditor]);
|
|
9084
9434
|
editor.wysimark.isRawMode = isRawMode;
|
|
9085
|
-
editor.wysimark.
|
|
9435
|
+
if (!editor.wysimark.disableRawMode) {
|
|
9436
|
+
editor.wysimark.toggleRawMode = handleRawModeToggle;
|
|
9437
|
+
}
|
|
9086
9438
|
editor.wysimark.onImageChange = onImageChange;
|
|
9087
|
-
return /* @__PURE__ */
|
|
9088
|
-
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(
|
|
9089
9441
|
"div",
|
|
9090
9442
|
{
|
|
9091
9443
|
onClick: handleRawModeToggle,
|
|
@@ -9111,10 +9463,10 @@ function Editable2({
|
|
|
9111
9463
|
e.preventDefault();
|
|
9112
9464
|
}
|
|
9113
9465
|
},
|
|
9114
|
-
children: /* @__PURE__ */
|
|
9466
|
+
children: /* @__PURE__ */ jsx65("span", { style: { color: "#4a90e2", fontSize: "1.25em" }, children: /* @__PURE__ */ jsx65(VisualEditor, {}) })
|
|
9115
9467
|
}
|
|
9116
9468
|
) }),
|
|
9117
|
-
/* @__PURE__ */
|
|
9469
|
+
/* @__PURE__ */ jsx65("div", { style: { display: isRawMode ? "block" : "none", textAlign: "center" }, children: /* @__PURE__ */ jsx65(
|
|
9118
9470
|
"textarea",
|
|
9119
9471
|
{
|
|
9120
9472
|
value: unescapeUrlSlashes(rawText).replace(/ /g, ""),
|
|
@@ -9139,13 +9491,13 @@ function Editable2({
|
|
|
9139
9491
|
}
|
|
9140
9492
|
}
|
|
9141
9493
|
) }),
|
|
9142
|
-
/* @__PURE__ */
|
|
9494
|
+
/* @__PURE__ */ jsx65("div", { style: { display: isRawMode ? "none" : "block" }, children: /* @__PURE__ */ jsx65(
|
|
9143
9495
|
Slate2,
|
|
9144
9496
|
{
|
|
9145
9497
|
editor,
|
|
9146
9498
|
initialValue: initialValueRef.current ?? editor.children,
|
|
9147
9499
|
onChange: onSlateChange,
|
|
9148
|
-
children: /* @__PURE__ */
|
|
9500
|
+
children: /* @__PURE__ */ jsx65(
|
|
9149
9501
|
SinkEditable2,
|
|
9150
9502
|
{
|
|
9151
9503
|
renderLeaf,
|
|
@@ -9162,13 +9514,13 @@ function Editable2({
|
|
|
9162
9514
|
}
|
|
9163
9515
|
|
|
9164
9516
|
// src/index.tsx
|
|
9165
|
-
import { jsx as
|
|
9517
|
+
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
9166
9518
|
function StandaloneEditor({
|
|
9167
9519
|
standaloneOptions: { onChange, placeholder, className, ...options },
|
|
9168
9520
|
standaloneMethodsRef
|
|
9169
9521
|
}) {
|
|
9170
|
-
const [markdown, setMarkdown] =
|
|
9171
|
-
const markdownRef =
|
|
9522
|
+
const [markdown, setMarkdown] = useState14(options.initialMarkdown || "");
|
|
9523
|
+
const markdownRef = useRef13(markdown);
|
|
9172
9524
|
const editor = useEditor(options);
|
|
9173
9525
|
markdownRef.current = markdown;
|
|
9174
9526
|
useImperativeHandle(
|
|
@@ -9194,7 +9546,7 @@ function StandaloneEditor({
|
|
|
9194
9546
|
},
|
|
9195
9547
|
[editor]
|
|
9196
9548
|
);
|
|
9197
|
-
return /* @__PURE__ */
|
|
9549
|
+
return /* @__PURE__ */ jsx66(
|
|
9198
9550
|
Editable2,
|
|
9199
9551
|
{
|
|
9200
9552
|
editor,
|
|
@@ -9209,7 +9561,7 @@ function createWysimark(containerElement, options) {
|
|
|
9209
9561
|
const standaloneMethodsRef = createRef();
|
|
9210
9562
|
const root = createRoot(containerElement);
|
|
9211
9563
|
root.render(
|
|
9212
|
-
/* @__PURE__ */
|
|
9564
|
+
/* @__PURE__ */ jsx66(
|
|
9213
9565
|
StandaloneEditor,
|
|
9214
9566
|
{
|
|
9215
9567
|
standaloneMethodsRef,
|