wysimark-lite 0.25.2 → 0.25.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +110 -118
- package/dist/index.mjs +153 -128
- package/dist/index.mjs.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { createRoot } from "react-dom/client";
|
|
|
13
13
|
// src/entry/index.tsx
|
|
14
14
|
import throttle3 from "lodash.throttle";
|
|
15
15
|
import { useCallback as useCallback18, useRef as useRef14, useState as useState13 } from "react";
|
|
16
|
-
import { Editor as
|
|
16
|
+
import { Editor as Editor67, 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
|
|
@@ -1546,17 +1546,7 @@ function serializeElements(elements) {
|
|
|
1546
1546
|
const joined = segments.join("");
|
|
1547
1547
|
if (joined.trim() === "")
|
|
1548
1548
|
return "";
|
|
1549
|
-
return
|
|
1550
|
-
}
|
|
1551
|
-
function replaceLeadingNewlines(input) {
|
|
1552
|
-
return input.replace(/^\n\n/g, "\\\n\n");
|
|
1553
|
-
}
|
|
1554
|
-
function replaceConsecutiveNewlines(input) {
|
|
1555
|
-
return input.replace(/(\n{4,})/g, (match) => {
|
|
1556
|
-
const newlineCount = match.length;
|
|
1557
|
-
const count = Math.floor((newlineCount - 2) / 2);
|
|
1558
|
-
return "\n\n" + Array(count).fill("\\").join("\n\n") + "\n\n";
|
|
1559
|
-
});
|
|
1549
|
+
return joined.replace(/^\n+/, "").trim();
|
|
1560
1550
|
}
|
|
1561
1551
|
|
|
1562
1552
|
// src/convert/serialize/index.ts
|
|
@@ -1609,6 +1599,7 @@ var translations = {
|
|
|
1609
1599
|
switchToRawMarkdown: "\u30DE\u30FC\u30AF\u30C0\u30A6\u30F3\u8868\u793A\u306B\u5207\u308A\u66FF\u3048",
|
|
1610
1600
|
codeBlock: "\u30B3\u30FC\u30C9\u30D6\u30ED\u30C3\u30AF",
|
|
1611
1601
|
increaseQuoteDepth: "\u5F15\u7528\u3092\u91CD\u306D\u308B",
|
|
1602
|
+
horizontalRule: "\u533A\u5207\u308A\u7DDA",
|
|
1612
1603
|
register: "\u767B\u9332",
|
|
1613
1604
|
imageSourceUrl: "URL",
|
|
1614
1605
|
imageSourceFile: "\u30D5\u30A1\u30A4\u30EB",
|
|
@@ -1661,6 +1652,7 @@ var translations = {
|
|
|
1661
1652
|
switchToRawMarkdown: "Switch to raw markdown",
|
|
1662
1653
|
codeBlock: "Code Block",
|
|
1663
1654
|
increaseQuoteDepth: "Increase Quote Depth",
|
|
1655
|
+
horizontalRule: "Horizontal Rule",
|
|
1664
1656
|
register: "Register",
|
|
1665
1657
|
imageSourceUrl: "URL",
|
|
1666
1658
|
imageSourceFile: "File",
|
|
@@ -6228,11 +6220,37 @@ function HorizontalRule({
|
|
|
6228
6220
|
}
|
|
6229
6221
|
|
|
6230
6222
|
// src/horizontal-rule-plugin/methods/index.ts
|
|
6223
|
+
import { Editor as Editor36, Element as Element21, Path as Path10, Transforms as Transforms27 } from "slate";
|
|
6231
6224
|
function insertHorizontalRule(editor) {
|
|
6232
|
-
|
|
6225
|
+
const { selection } = editor;
|
|
6226
|
+
if (!selection)
|
|
6227
|
+
return false;
|
|
6228
|
+
const entry = findElementUp(
|
|
6229
|
+
editor,
|
|
6230
|
+
(node) => Element21.isElement(node) && editor.isMaster(node)
|
|
6231
|
+
);
|
|
6232
|
+
const hrElement = {
|
|
6233
6233
|
type: "horizontal-rule",
|
|
6234
6234
|
children: [{ text: "" }]
|
|
6235
|
-
}
|
|
6235
|
+
};
|
|
6236
|
+
const paragraphElement = {
|
|
6237
|
+
type: "paragraph",
|
|
6238
|
+
children: [{ text: "" }]
|
|
6239
|
+
};
|
|
6240
|
+
if (entry == null) {
|
|
6241
|
+
Editor36.withoutNormalizing(editor, () => {
|
|
6242
|
+
Transforms27.insertNodes(editor, [hrElement, paragraphElement]);
|
|
6243
|
+
Transforms27.move(editor);
|
|
6244
|
+
});
|
|
6245
|
+
} else {
|
|
6246
|
+
const nextPath = Path10.next(entry[1]);
|
|
6247
|
+
Editor36.withoutNormalizing(editor, () => {
|
|
6248
|
+
Transforms27.insertNodes(editor, [hrElement, paragraphElement], { at: nextPath });
|
|
6249
|
+
const paragraphPath = Path10.next(nextPath);
|
|
6250
|
+
Transforms27.select(editor, Editor36.start(editor, paragraphPath));
|
|
6251
|
+
});
|
|
6252
|
+
}
|
|
6253
|
+
return true;
|
|
6236
6254
|
}
|
|
6237
6255
|
function createHorizontalRuleMethods(editor) {
|
|
6238
6256
|
return {
|
|
@@ -6337,7 +6355,7 @@ var InlineCodePlugin = createPlugin(
|
|
|
6337
6355
|
);
|
|
6338
6356
|
|
|
6339
6357
|
// src/list-plugin/index.tsx
|
|
6340
|
-
import { Editor as
|
|
6358
|
+
import { Editor as Editor41, Path as Path11 } from "slate";
|
|
6341
6359
|
|
|
6342
6360
|
// src/list-plugin/methods/convert-list-item.ts
|
|
6343
6361
|
function convertOrderedList(editor, allowToggle) {
|
|
@@ -6421,36 +6439,36 @@ function indent(editor) {
|
|
|
6421
6439
|
}
|
|
6422
6440
|
|
|
6423
6441
|
// src/list-plugin/methods/insert-break.ts
|
|
6424
|
-
import { Editor as
|
|
6442
|
+
import { Editor as Editor37, Transforms as Transforms28 } from "slate";
|
|
6425
6443
|
function insertBreak2(editor) {
|
|
6426
6444
|
const entry = findElementUp(editor, isListItem);
|
|
6427
6445
|
if (!entry)
|
|
6428
6446
|
return false;
|
|
6429
6447
|
const [element, path] = entry;
|
|
6430
|
-
if (
|
|
6448
|
+
if (Editor37.isEmpty(editor, element)) {
|
|
6431
6449
|
if (element.depth > 0) {
|
|
6432
|
-
|
|
6450
|
+
Transforms28.setNodes(editor, { depth: element.depth - 1 }, { at: path });
|
|
6433
6451
|
return true;
|
|
6434
6452
|
} else {
|
|
6435
6453
|
rewrapElement(editor, { type: "paragraph" }, path);
|
|
6436
6454
|
return true;
|
|
6437
6455
|
}
|
|
6438
6456
|
}
|
|
6439
|
-
|
|
6457
|
+
Transforms28.splitNodes(editor, { always: true });
|
|
6440
6458
|
const nextEntry = findElementUp(editor, isListItem);
|
|
6441
6459
|
if (!nextEntry)
|
|
6442
6460
|
return true;
|
|
6443
6461
|
if (nextEntry[0].type === "task-list-item" && nextEntry[0].checked === true) {
|
|
6444
|
-
|
|
6462
|
+
Transforms28.setNodes(editor, { checked: false }, { at: nextEntry[1] });
|
|
6445
6463
|
}
|
|
6446
6464
|
return true;
|
|
6447
6465
|
}
|
|
6448
6466
|
|
|
6449
6467
|
// src/list-plugin/methods/outdent.ts
|
|
6450
|
-
import { Editor as
|
|
6468
|
+
import { Editor as Editor38 } from "slate";
|
|
6451
6469
|
function outdent(editor) {
|
|
6452
6470
|
const entries = Array.from(
|
|
6453
|
-
|
|
6471
|
+
Editor38.nodes(editor, {
|
|
6454
6472
|
match: isListItem
|
|
6455
6473
|
})
|
|
6456
6474
|
);
|
|
@@ -6468,7 +6486,7 @@ function outdent(editor) {
|
|
|
6468
6486
|
}
|
|
6469
6487
|
|
|
6470
6488
|
// src/list-plugin/methods/toggleTaskListItem.ts
|
|
6471
|
-
import { Transforms as
|
|
6489
|
+
import { Transforms as Transforms29 } from "slate";
|
|
6472
6490
|
function toggleTaskListItem(editor, { at = editor.selection } = {}) {
|
|
6473
6491
|
const taskListItem = findElementUp(
|
|
6474
6492
|
editor,
|
|
@@ -6478,7 +6496,7 @@ function toggleTaskListItem(editor, { at = editor.selection } = {}) {
|
|
|
6478
6496
|
if (!taskListItem)
|
|
6479
6497
|
return false;
|
|
6480
6498
|
const nextChecked = !taskListItem[0].checked;
|
|
6481
|
-
|
|
6499
|
+
Transforms29.setNodes(
|
|
6482
6500
|
editor,
|
|
6483
6501
|
{ checked: nextChecked },
|
|
6484
6502
|
{ at: taskListItem[1] }
|
|
@@ -6504,20 +6522,20 @@ function createListMethods(editor) {
|
|
|
6504
6522
|
}
|
|
6505
6523
|
|
|
6506
6524
|
// src/list-plugin/normalize-node/normalize-ordered-first-at-depth.ts
|
|
6507
|
-
import { Element as
|
|
6525
|
+
import { Element as Element22, Transforms as Transforms30 } from "slate";
|
|
6508
6526
|
var isOrderedListItem = createIsElementType([
|
|
6509
6527
|
"ordered-list-item"
|
|
6510
6528
|
]);
|
|
6511
6529
|
function normalizeOrderedFirstAtDepth(editor, entry) {
|
|
6512
6530
|
const [node, path] = entry;
|
|
6513
|
-
if (!
|
|
6531
|
+
if (!Element22.isElement(node))
|
|
6514
6532
|
return false;
|
|
6515
6533
|
return normalizeSiblings(editor, [node, path], (a, b) => {
|
|
6516
6534
|
if (!isOrderedListItem(b[0]))
|
|
6517
6535
|
return false;
|
|
6518
6536
|
const __firstAtDepth = isOrderedListItem(a[0]) ? b[0].depth > a[0].depth : isListItem(a[0]) ? b[0].depth > a[0].depth : true;
|
|
6519
6537
|
if (b[0].__firstAtDepth !== __firstAtDepth) {
|
|
6520
|
-
|
|
6538
|
+
Transforms30.setNodes(editor, { __firstAtDepth }, { at: b[1] });
|
|
6521
6539
|
return true;
|
|
6522
6540
|
}
|
|
6523
6541
|
return false;
|
|
@@ -6757,12 +6775,12 @@ var ListPlugin = createPlugin(
|
|
|
6757
6775
|
if (!listItem)
|
|
6758
6776
|
return false;
|
|
6759
6777
|
const listItemPath = listItem[1];
|
|
6760
|
-
if (!
|
|
6778
|
+
if (!Path11.hasPrevious(listItemPath)) {
|
|
6761
6779
|
editor.collapsibleParagraph.convertParagraph();
|
|
6762
6780
|
return true;
|
|
6763
6781
|
}
|
|
6764
|
-
const prevElementPath =
|
|
6765
|
-
const prevElementEntry =
|
|
6782
|
+
const prevElementPath = Path11.previous(listItemPath);
|
|
6783
|
+
const prevElementEntry = Editor41.node(editor, prevElementPath);
|
|
6766
6784
|
if (isListItem(prevElementEntry[0]))
|
|
6767
6785
|
return false;
|
|
6768
6786
|
editor.collapsibleParagraph.convertParagraph();
|
|
@@ -6772,7 +6790,7 @@ var ListPlugin = createPlugin(
|
|
|
6772
6790
|
editableProps: {
|
|
6773
6791
|
renderElement: renderElement3,
|
|
6774
6792
|
onKeyDown(e) {
|
|
6775
|
-
if (!
|
|
6793
|
+
if (!Editor41.nodes(editor, { match: isListItem }))
|
|
6776
6794
|
return false;
|
|
6777
6795
|
return hotkeyHandler(e);
|
|
6778
6796
|
}
|
|
@@ -6783,15 +6801,15 @@ var ListPlugin = createPlugin(
|
|
|
6783
6801
|
|
|
6784
6802
|
// src/marks-plugin/index.tsx
|
|
6785
6803
|
import { clsx as clsx7 } from "clsx";
|
|
6786
|
-
import { Editor as
|
|
6804
|
+
import { Editor as Editor44, Point as Point3, Range as Range8 } from "slate";
|
|
6787
6805
|
|
|
6788
6806
|
// src/marks-plugin/methods/removeMarks.ts
|
|
6789
|
-
import { Editor as
|
|
6807
|
+
import { Editor as Editor42, Text as Text4, Transforms as Transforms31 } from "slate";
|
|
6790
6808
|
function removeMarks(editor, { at = editor.selection } = {}) {
|
|
6791
6809
|
if (at == null)
|
|
6792
6810
|
return;
|
|
6793
6811
|
const nodeEntries = [
|
|
6794
|
-
...
|
|
6812
|
+
...Editor42.nodes(editor, {
|
|
6795
6813
|
match: (n) => Text4.isText(n),
|
|
6796
6814
|
at
|
|
6797
6815
|
})
|
|
@@ -6804,7 +6822,7 @@ function removeMarks(editor, { at = editor.selection } = {}) {
|
|
|
6804
6822
|
setter[key2] = null;
|
|
6805
6823
|
}
|
|
6806
6824
|
}
|
|
6807
|
-
|
|
6825
|
+
Transforms31.setNodes(editor, setter, {
|
|
6808
6826
|
match: (n) => Text4.isText(n),
|
|
6809
6827
|
split: true,
|
|
6810
6828
|
at
|
|
@@ -6812,14 +6830,14 @@ function removeMarks(editor, { at = editor.selection } = {}) {
|
|
|
6812
6830
|
}
|
|
6813
6831
|
|
|
6814
6832
|
// src/marks-plugin/methods/toggle-mark.ts
|
|
6815
|
-
import { Editor as
|
|
6833
|
+
import { Editor as Editor43, Point as Point2, Range as Range7 } from "slate";
|
|
6816
6834
|
function toggleMark(editor, markKey, unsetKey, { at = editor.selection } = {}) {
|
|
6817
6835
|
if (at == null)
|
|
6818
6836
|
return;
|
|
6819
6837
|
const point = Range7.isRange(at) ? at.focus : at;
|
|
6820
|
-
const isAtLineEnd = Point2.isPoint(point) && (
|
|
6838
|
+
const isAtLineEnd = Point2.isPoint(point) && (Editor43.after(editor, point) === null || Editor43.isEnd(editor, point, Editor43.end(editor, [])));
|
|
6821
6839
|
const validMarkKey = markKey;
|
|
6822
|
-
const marks =
|
|
6840
|
+
const marks = Editor43.marks(editor) || {};
|
|
6823
6841
|
const isActive = marks[validMarkKey] === true;
|
|
6824
6842
|
if (isAtLineEnd) {
|
|
6825
6843
|
if (!isActive) {
|
|
@@ -6833,12 +6851,12 @@ function toggleMark(editor, markKey, unsetKey, { at = editor.selection } = {}) {
|
|
|
6833
6851
|
}
|
|
6834
6852
|
}
|
|
6835
6853
|
if (isActive) {
|
|
6836
|
-
|
|
6854
|
+
Editor43.removeMark(editor, validMarkKey);
|
|
6837
6855
|
} else {
|
|
6838
|
-
|
|
6856
|
+
Editor43.addMark(editor, validMarkKey, true);
|
|
6839
6857
|
}
|
|
6840
6858
|
if (typeof unsetKey === "string") {
|
|
6841
|
-
|
|
6859
|
+
Editor43.removeMark(editor, unsetKey);
|
|
6842
6860
|
}
|
|
6843
6861
|
}
|
|
6844
6862
|
|
|
@@ -6913,7 +6931,7 @@ var MarksPlugin = createPlugin((editor) => {
|
|
|
6913
6931
|
if (editor.selection) {
|
|
6914
6932
|
const point = Range8.isRange(editor.selection) ? editor.selection.focus : editor.selection;
|
|
6915
6933
|
if (Point3.isPoint(point)) {
|
|
6916
|
-
const isAtLineEnd =
|
|
6934
|
+
const isAtLineEnd = Editor44.after(editor, point) === null || Editor44.isEnd(editor, point, Editor44.end(editor, []));
|
|
6917
6935
|
if (isAtLineEnd) {
|
|
6918
6936
|
editor.activeMarks = {};
|
|
6919
6937
|
}
|
|
@@ -6948,11 +6966,11 @@ var MarksPlugin = createPlugin((editor) => {
|
|
|
6948
6966
|
});
|
|
6949
6967
|
|
|
6950
6968
|
// src/normalize-after-delete-plugin/index.tsx
|
|
6951
|
-
import { Editor as
|
|
6969
|
+
import { Editor as Editor45, Point as Point4 } from "slate";
|
|
6952
6970
|
function forceNormalizeNearestElement(editor) {
|
|
6953
6971
|
if (!editor.selection)
|
|
6954
6972
|
return;
|
|
6955
|
-
const entry =
|
|
6973
|
+
const entry = Editor45.parent(editor, editor.selection);
|
|
6956
6974
|
forceNormalizePath(editor, entry[1]);
|
|
6957
6975
|
}
|
|
6958
6976
|
var NormalizeAfterDeletePlugin = createPlugin((editor) => {
|
|
@@ -6963,9 +6981,9 @@ var NormalizeAfterDeletePlugin = createPlugin((editor) => {
|
|
|
6963
6981
|
deleteBackward() {
|
|
6964
6982
|
if (!editor.selection)
|
|
6965
6983
|
return false;
|
|
6966
|
-
const entry =
|
|
6984
|
+
const entry = Editor45.parent(editor, editor.selection);
|
|
6967
6985
|
const isStart = Point4.equals(
|
|
6968
|
-
|
|
6986
|
+
Editor45.start(editor, entry[1]),
|
|
6969
6987
|
editor.selection.anchor
|
|
6970
6988
|
);
|
|
6971
6989
|
if (!isStart)
|
|
@@ -6977,9 +6995,9 @@ var NormalizeAfterDeletePlugin = createPlugin((editor) => {
|
|
|
6977
6995
|
deleteForward() {
|
|
6978
6996
|
if (!editor.selection)
|
|
6979
6997
|
return false;
|
|
6980
|
-
const entry =
|
|
6998
|
+
const entry = Editor45.parent(editor, editor.selection);
|
|
6981
6999
|
const isEnd = Point4.equals(
|
|
6982
|
-
|
|
7000
|
+
Editor45.end(editor, entry[1]),
|
|
6983
7001
|
editor.selection.anchor
|
|
6984
7002
|
);
|
|
6985
7003
|
if (!isEnd)
|
|
@@ -6994,15 +7012,15 @@ var NormalizeAfterDeletePlugin = createPlugin((editor) => {
|
|
|
6994
7012
|
});
|
|
6995
7013
|
|
|
6996
7014
|
// src/table-plugin/index.tsx
|
|
6997
|
-
import { Element as
|
|
7015
|
+
import { Element as Element24 } from "slate";
|
|
6998
7016
|
|
|
6999
7017
|
// src/table-plugin/delete-fragment/index.ts
|
|
7000
|
-
import { Editor as
|
|
7018
|
+
import { Editor as Editor47, Path as Path13, Transforms as Transforms32 } from "slate";
|
|
7001
7019
|
|
|
7002
7020
|
// src/table-plugin/delete-fragment/get-reversed-delete-safe-ranges.ts
|
|
7003
|
-
import { Editor as
|
|
7021
|
+
import { Editor as Editor46, Path as Path12 } from "slate";
|
|
7004
7022
|
function getReversedDeleteSafeRanges(editor, deleteRange, protectedTypes) {
|
|
7005
|
-
const positions = [...
|
|
7023
|
+
const positions = [...Editor46.positions(editor, { at: deleteRange })];
|
|
7006
7024
|
const deleteSafeRanges = [];
|
|
7007
7025
|
let startPos, prevPos, startTdPath;
|
|
7008
7026
|
startPos = prevPos = positions[0];
|
|
@@ -7013,7 +7031,7 @@ function getReversedDeleteSafeRanges(editor, deleteRange, protectedTypes) {
|
|
|
7013
7031
|
const tdPath = findElementUpPath(editor, protectedTypes, {
|
|
7014
7032
|
at: pos
|
|
7015
7033
|
});
|
|
7016
|
-
if (startTdPath && tdPath &&
|
|
7034
|
+
if (startTdPath && tdPath && Path12.equals(startTdPath, tdPath) || startTdPath == void 0 && tdPath == void 0) {
|
|
7017
7035
|
prevPos = pos;
|
|
7018
7036
|
} else {
|
|
7019
7037
|
const range2 = { anchor: startPos, focus: prevPos };
|
|
@@ -7032,7 +7050,7 @@ function getReversedDeleteSafeRanges(editor, deleteRange, protectedTypes) {
|
|
|
7032
7050
|
function deleteFragmentWithProtectedTypes(editor, protectedTypes) {
|
|
7033
7051
|
if (editor.selection == null)
|
|
7034
7052
|
return false;
|
|
7035
|
-
const [start, end] =
|
|
7053
|
+
const [start, end] = Editor47.edges(editor, editor.selection);
|
|
7036
7054
|
const startProtectedPath = findElementUpPath(editor, protectedTypes, {
|
|
7037
7055
|
at: start
|
|
7038
7056
|
});
|
|
@@ -7042,7 +7060,7 @@ function deleteFragmentWithProtectedTypes(editor, protectedTypes) {
|
|
|
7042
7060
|
if (!startProtectedPath && !endProtectedPath) {
|
|
7043
7061
|
return false;
|
|
7044
7062
|
}
|
|
7045
|
-
if (startProtectedPath && endProtectedPath &&
|
|
7063
|
+
if (startProtectedPath && endProtectedPath && Path13.equals(startProtectedPath, endProtectedPath)) {
|
|
7046
7064
|
return false;
|
|
7047
7065
|
}
|
|
7048
7066
|
const reversedRanges = getReversedDeleteSafeRanges(
|
|
@@ -7050,17 +7068,17 @@ function deleteFragmentWithProtectedTypes(editor, protectedTypes) {
|
|
|
7050
7068
|
editor.selection,
|
|
7051
7069
|
protectedTypes
|
|
7052
7070
|
);
|
|
7053
|
-
|
|
7071
|
+
Editor47.withoutNormalizing(editor, () => {
|
|
7054
7072
|
for (const range of reversedRanges) {
|
|
7055
|
-
|
|
7073
|
+
Transforms32.delete(editor, { at: range });
|
|
7056
7074
|
}
|
|
7057
|
-
|
|
7075
|
+
Transforms32.collapse(editor, { edge: "start" });
|
|
7058
7076
|
});
|
|
7059
7077
|
return true;
|
|
7060
7078
|
}
|
|
7061
7079
|
|
|
7062
7080
|
// src/table-plugin/methods/index.ts
|
|
7063
|
-
import { Transforms as
|
|
7081
|
+
import { Transforms as Transforms41 } from "slate";
|
|
7064
7082
|
|
|
7065
7083
|
// src/table-plugin/methods/get-table-info.ts
|
|
7066
7084
|
function getTableInfo(editor, { at = editor.selection } = {}) {
|
|
@@ -7098,7 +7116,7 @@ function getTableInfo(editor, { at = editor.selection } = {}) {
|
|
|
7098
7116
|
}
|
|
7099
7117
|
|
|
7100
7118
|
// src/table-plugin/methods/insert-column.ts
|
|
7101
|
-
import { Editor as
|
|
7119
|
+
import { Editor as Editor48, Transforms as Transforms33 } from "slate";
|
|
7102
7120
|
|
|
7103
7121
|
// src/table-plugin/methods/utils.ts
|
|
7104
7122
|
function createCell(index, children = [
|
|
@@ -7120,13 +7138,13 @@ function insertColumn(editor, { offset = 0, at = editor.selection } = {}) {
|
|
|
7120
7138
|
return false;
|
|
7121
7139
|
const { tableElement, tablePath, cellIndex } = t2;
|
|
7122
7140
|
const nextCellIndex = cellIndex + offset;
|
|
7123
|
-
|
|
7141
|
+
Editor48.withoutNormalizing(editor, () => {
|
|
7124
7142
|
const { columns } = tableElement;
|
|
7125
7143
|
const nextColumns = [...columns];
|
|
7126
7144
|
nextColumns.splice(nextCellIndex, 0, columns[nextCellIndex]);
|
|
7127
|
-
|
|
7145
|
+
Transforms33.setNodes(editor, { columns: nextColumns }, { at: tablePath });
|
|
7128
7146
|
tableElement.children.forEach((rowElement, i) => {
|
|
7129
|
-
|
|
7147
|
+
Transforms33.insertNodes(editor, createCell(nextCellIndex), {
|
|
7130
7148
|
at: [...tablePath, i, nextCellIndex]
|
|
7131
7149
|
});
|
|
7132
7150
|
});
|
|
@@ -7135,7 +7153,7 @@ function insertColumn(editor, { offset = 0, at = editor.selection } = {}) {
|
|
|
7135
7153
|
}
|
|
7136
7154
|
|
|
7137
7155
|
// src/table-plugin/methods/insert-row.ts
|
|
7138
|
-
import { Transforms as
|
|
7156
|
+
import { Transforms as Transforms34 } from "slate";
|
|
7139
7157
|
function createRow(columnCount) {
|
|
7140
7158
|
return {
|
|
7141
7159
|
type: "table-row",
|
|
@@ -7147,7 +7165,7 @@ function insertRow(editor, { at = editor.selection, offset = 0 } = {}) {
|
|
|
7147
7165
|
if (!t2)
|
|
7148
7166
|
return false;
|
|
7149
7167
|
const nextRowElement = createRow(t2.tableElement.columns.length);
|
|
7150
|
-
|
|
7168
|
+
Transforms34.insertNodes(editor, nextRowElement, {
|
|
7151
7169
|
at: [...t2.tablePath, t2.rowIndex + offset]
|
|
7152
7170
|
});
|
|
7153
7171
|
return true;
|
|
@@ -7157,7 +7175,7 @@ function insertRowBelow(editor, { at } = {}) {
|
|
|
7157
7175
|
}
|
|
7158
7176
|
|
|
7159
7177
|
// src/table-plugin/methods/insert-table.ts
|
|
7160
|
-
import { Editor as
|
|
7178
|
+
import { Editor as Editor50, Element as Element23, Path as Path14, Transforms as Transforms35 } from "slate";
|
|
7161
7179
|
function createRange(size) {
|
|
7162
7180
|
return [...Array(size).keys()];
|
|
7163
7181
|
}
|
|
@@ -7186,29 +7204,29 @@ function insertRootElement2(editor, element, { at = editor.selection } = {}) {
|
|
|
7186
7204
|
return false;
|
|
7187
7205
|
const entry = findElementUp(
|
|
7188
7206
|
editor,
|
|
7189
|
-
(node) =>
|
|
7207
|
+
(node) => Element23.isElement(node) && editor.isMaster(node)
|
|
7190
7208
|
);
|
|
7191
7209
|
if (entry == null) {
|
|
7192
7210
|
const selection = editor.selection;
|
|
7193
|
-
|
|
7194
|
-
|
|
7211
|
+
Editor50.withoutNormalizing(editor, () => {
|
|
7212
|
+
Transforms35.insertNodes(editor, element, { at });
|
|
7195
7213
|
if (selection) {
|
|
7196
|
-
|
|
7197
|
-
|
|
7214
|
+
Transforms35.select(editor, selection);
|
|
7215
|
+
Transforms35.move(editor);
|
|
7198
7216
|
}
|
|
7199
7217
|
});
|
|
7200
7218
|
} else {
|
|
7201
|
-
const nextPath =
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7219
|
+
const nextPath = Path14.next(entry[1]);
|
|
7220
|
+
Editor50.withoutNormalizing(editor, () => {
|
|
7221
|
+
Transforms35.insertNodes(editor, element, { at: nextPath });
|
|
7222
|
+
Transforms35.select(editor, Editor50.start(editor, nextPath));
|
|
7205
7223
|
});
|
|
7206
7224
|
}
|
|
7207
7225
|
return true;
|
|
7208
7226
|
}
|
|
7209
7227
|
|
|
7210
7228
|
// src/table-plugin/methods/navigation/select-element.ts
|
|
7211
|
-
import { Path as
|
|
7229
|
+
import { Path as Path15 } from "slate";
|
|
7212
7230
|
function selectElementBelow(editor, t2) {
|
|
7213
7231
|
const { cellIndex, rowIndex, rowCount, tablePath } = t2;
|
|
7214
7232
|
if (rowIndex < rowCount - 1) {
|
|
@@ -7216,7 +7234,7 @@ function selectElementBelow(editor, t2) {
|
|
|
7216
7234
|
return true;
|
|
7217
7235
|
}
|
|
7218
7236
|
try {
|
|
7219
|
-
selectStartOfElement(editor,
|
|
7237
|
+
selectStartOfElement(editor, Path15.next(tablePath));
|
|
7220
7238
|
return true;
|
|
7221
7239
|
} catch {
|
|
7222
7240
|
return false;
|
|
@@ -7229,7 +7247,7 @@ function selectElementAbove(editor, t2) {
|
|
|
7229
7247
|
return true;
|
|
7230
7248
|
}
|
|
7231
7249
|
try {
|
|
7232
|
-
selectEndOfElement(editor,
|
|
7250
|
+
selectEndOfElement(editor, Path15.previous(tablePath));
|
|
7233
7251
|
return true;
|
|
7234
7252
|
} catch {
|
|
7235
7253
|
return false;
|
|
@@ -7281,15 +7299,15 @@ function up(editor) {
|
|
|
7281
7299
|
}
|
|
7282
7300
|
|
|
7283
7301
|
// src/table-plugin/methods/remove-column.ts
|
|
7284
|
-
import { Editor as
|
|
7302
|
+
import { Editor as Editor53, Transforms as Transforms37 } from "slate";
|
|
7285
7303
|
|
|
7286
7304
|
// src/table-plugin/methods/remove-table.ts
|
|
7287
|
-
import { Transforms as
|
|
7305
|
+
import { Transforms as Transforms36 } from "slate";
|
|
7288
7306
|
function removeTable(editor) {
|
|
7289
7307
|
const t2 = editor.tablePlugin.getTableInfo();
|
|
7290
7308
|
if (t2 === void 0)
|
|
7291
7309
|
return false;
|
|
7292
|
-
|
|
7310
|
+
Transforms36.removeNodes(editor, { at: t2.tablePath });
|
|
7293
7311
|
return true;
|
|
7294
7312
|
}
|
|
7295
7313
|
|
|
@@ -7302,26 +7320,26 @@ function removeColumn(editor, { at = editor.selection } = {}) {
|
|
|
7302
7320
|
if (cellCount === 1) {
|
|
7303
7321
|
return removeTable(editor);
|
|
7304
7322
|
}
|
|
7305
|
-
|
|
7323
|
+
Editor53.withoutNormalizing(editor, () => {
|
|
7306
7324
|
const columns = [...tableElement.columns];
|
|
7307
7325
|
columns.splice(cellIndex, 1);
|
|
7308
|
-
|
|
7326
|
+
Transforms37.setNodes(editor, { columns }, { at: tablePath });
|
|
7309
7327
|
tableElement.children.forEach((rowElement, rowIndex2) => {
|
|
7310
|
-
|
|
7328
|
+
Transforms37.removeNodes(editor, {
|
|
7311
7329
|
at: [...tablePath, rowIndex2, cellIndex]
|
|
7312
7330
|
});
|
|
7313
7331
|
});
|
|
7314
|
-
const selection =
|
|
7332
|
+
const selection = Editor53.start(editor, [
|
|
7315
7333
|
...tablePath,
|
|
7316
7334
|
rowIndex,
|
|
7317
7335
|
Math.min(cellIndex, cellCount - 2)
|
|
7318
7336
|
]);
|
|
7319
|
-
|
|
7337
|
+
Transforms37.select(editor, selection);
|
|
7320
7338
|
});
|
|
7321
7339
|
}
|
|
7322
7340
|
|
|
7323
7341
|
// src/table-plugin/methods/remove-row.ts
|
|
7324
|
-
import { Editor as
|
|
7342
|
+
import { Editor as Editor54, Transforms as Transforms38 } from "slate";
|
|
7325
7343
|
function removeRow(editor, { at = editor.selection } = {}) {
|
|
7326
7344
|
const t2 = getTableInfo(editor, { at });
|
|
7327
7345
|
if (t2 === void 0)
|
|
@@ -7330,11 +7348,11 @@ function removeRow(editor, { at = editor.selection } = {}) {
|
|
|
7330
7348
|
removeTable(editor);
|
|
7331
7349
|
return true;
|
|
7332
7350
|
}
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7351
|
+
Editor54.withoutNormalizing(editor, () => {
|
|
7352
|
+
Transforms38.removeNodes(editor, { at: t2.rowPath });
|
|
7353
|
+
Transforms38.select(
|
|
7336
7354
|
editor,
|
|
7337
|
-
|
|
7355
|
+
Editor54.start(editor, [
|
|
7338
7356
|
...t2.tablePath,
|
|
7339
7357
|
Math.min(t2.rowIndex, t2.rowCount - 2),
|
|
7340
7358
|
t2.cellIndex
|
|
@@ -7345,7 +7363,7 @@ function removeRow(editor, { at = editor.selection } = {}) {
|
|
|
7345
7363
|
}
|
|
7346
7364
|
|
|
7347
7365
|
// src/table-plugin/methods/setTableColumnAlign.ts
|
|
7348
|
-
import { Transforms as
|
|
7366
|
+
import { Transforms as Transforms39 } from "slate";
|
|
7349
7367
|
function setTableColumnAlign(editor, options) {
|
|
7350
7368
|
const t2 = getTableInfo(editor);
|
|
7351
7369
|
if (t2 === void 0)
|
|
@@ -7353,12 +7371,12 @@ function setTableColumnAlign(editor, options) {
|
|
|
7353
7371
|
const { tableElement, tablePath, cellIndex } = t2;
|
|
7354
7372
|
const nextColumns = tableElement.columns.slice();
|
|
7355
7373
|
nextColumns.splice(cellIndex, 1, { align: options.align });
|
|
7356
|
-
|
|
7374
|
+
Transforms39.setNodes(editor, { columns: nextColumns }, { at: tablePath });
|
|
7357
7375
|
return true;
|
|
7358
7376
|
}
|
|
7359
7377
|
|
|
7360
7378
|
// src/table-plugin/methods/tab.ts
|
|
7361
|
-
import { Path as
|
|
7379
|
+
import { Path as Path16, Transforms as Transforms40 } from "slate";
|
|
7362
7380
|
function tabForward(editor) {
|
|
7363
7381
|
const t2 = getTableInfo(editor);
|
|
7364
7382
|
if (!t2)
|
|
@@ -7372,8 +7390,8 @@ function tabForward(editor) {
|
|
|
7372
7390
|
selectStartOfElement(editor, [...tablePath, rowIndex + 1, 0]);
|
|
7373
7391
|
return true;
|
|
7374
7392
|
}
|
|
7375
|
-
const nextPath =
|
|
7376
|
-
|
|
7393
|
+
const nextPath = Path16.next(tablePath);
|
|
7394
|
+
Transforms40.insertNodes(
|
|
7377
7395
|
editor,
|
|
7378
7396
|
{ type: "paragraph", children: [{ text: "" }] },
|
|
7379
7397
|
{ at: nextPath }
|
|
@@ -7437,12 +7455,12 @@ function selectCell(editor, { at = editor.selection } = {}) {
|
|
|
7437
7455
|
if (t2 === void 0)
|
|
7438
7456
|
return false;
|
|
7439
7457
|
const { cellPath } = t2;
|
|
7440
|
-
|
|
7458
|
+
Transforms41.select(editor, cellPath);
|
|
7441
7459
|
return true;
|
|
7442
7460
|
}
|
|
7443
7461
|
|
|
7444
7462
|
// src/table-plugin/normalize/normalize-table.ts
|
|
7445
|
-
import { Transforms as
|
|
7463
|
+
import { Transforms as Transforms42 } from "slate";
|
|
7446
7464
|
function normalizeTableIndexes(editor, entry) {
|
|
7447
7465
|
let isTransformed = false;
|
|
7448
7466
|
const rowElements = entry[0].children;
|
|
@@ -7450,7 +7468,7 @@ function normalizeTableIndexes(editor, entry) {
|
|
|
7450
7468
|
const cellElements = rowElement.children;
|
|
7451
7469
|
cellElements.forEach((cellElement, x) => {
|
|
7452
7470
|
if (cellElement.x !== x || cellElement.y !== y) {
|
|
7453
|
-
|
|
7471
|
+
Transforms42.setNodes(editor, { x, y }, { at: [...entry[1], y, x] });
|
|
7454
7472
|
isTransformed = true;
|
|
7455
7473
|
}
|
|
7456
7474
|
});
|
|
@@ -7459,14 +7477,14 @@ function normalizeTableIndexes(editor, entry) {
|
|
|
7459
7477
|
}
|
|
7460
7478
|
|
|
7461
7479
|
// src/table-plugin/normalize/normalize-table-cell.ts
|
|
7462
|
-
import { Editor as
|
|
7480
|
+
import { Editor as Editor59, Transforms as Transforms43 } from "slate";
|
|
7463
7481
|
function normalizeTableCell(editor, entry) {
|
|
7464
7482
|
const [node, path] = entry;
|
|
7465
7483
|
if (node.children.length === 1 && node.children[0].type === "table-content") {
|
|
7466
7484
|
return false;
|
|
7467
7485
|
}
|
|
7468
|
-
|
|
7469
|
-
|
|
7486
|
+
Editor59.withoutNormalizing(editor, () => {
|
|
7487
|
+
Transforms43.insertNodes(
|
|
7470
7488
|
editor,
|
|
7471
7489
|
{
|
|
7472
7490
|
type: "table-content",
|
|
@@ -7475,9 +7493,9 @@ function normalizeTableCell(editor, entry) {
|
|
|
7475
7493
|
{ at: [...entry[1], 0] }
|
|
7476
7494
|
);
|
|
7477
7495
|
for (let i = node.children.length; i >= 0; i--) {
|
|
7478
|
-
|
|
7496
|
+
Transforms43.mergeNodes(editor, { at: [...path, i] });
|
|
7479
7497
|
}
|
|
7480
|
-
|
|
7498
|
+
Transforms43.delete(editor, {
|
|
7481
7499
|
at: { path: [...path, 0, 0], offset: 0 },
|
|
7482
7500
|
unit: "character"
|
|
7483
7501
|
});
|
|
@@ -8038,7 +8056,7 @@ var TablePlugin = createPlugin(
|
|
|
8038
8056
|
},
|
|
8039
8057
|
normalizeNode: (entry) => {
|
|
8040
8058
|
const [node] = entry;
|
|
8041
|
-
if (!
|
|
8059
|
+
if (!Element24.isElement(node))
|
|
8042
8060
|
return false;
|
|
8043
8061
|
switch (node.type) {
|
|
8044
8062
|
case "table":
|
|
@@ -8168,7 +8186,7 @@ var ThemePlugin = createPlugin((editor) => {
|
|
|
8168
8186
|
// src/toolbar-plugin/render-editable/index.tsx
|
|
8169
8187
|
import { clsx as clsx10 } from "clsx";
|
|
8170
8188
|
import { useCallback as useCallback17, useRef as useRef13 } from "react";
|
|
8171
|
-
import { Editor as
|
|
8189
|
+
import { Editor as Editor63, Transforms as Transforms45 } from "slate";
|
|
8172
8190
|
import { ReactEditor as ReactEditor16, useFocused, useSlateStatic as useSlateStatic21 } from "slate-react";
|
|
8173
8191
|
|
|
8174
8192
|
// src/toolbar-plugin/components/dialog/table-dialog.tsx
|
|
@@ -8303,6 +8321,7 @@ var Highlight = () => /* @__PURE__ */ jsxs28(TablerIcon, { children: [
|
|
|
8303
8321
|
/* @__PURE__ */ jsx60("path", { d: "M13.5 6.5l4 4" }),
|
|
8304
8322
|
/* @__PURE__ */ jsx60("path", { d: "m14 19 6-6M18 15l2 2M5 21h4" })
|
|
8305
8323
|
] });
|
|
8324
|
+
var HorizontalRule2 = () => /* @__PURE__ */ jsx60(TablerIcon, { children: /* @__PURE__ */ jsx60("path", { d: "M5 12h14" }) });
|
|
8306
8325
|
|
|
8307
8326
|
// src/toolbar-plugin/items/block-items.tsx
|
|
8308
8327
|
var listDepthItems = [
|
|
@@ -8654,7 +8673,7 @@ import {
|
|
|
8654
8673
|
useRef as useRef10,
|
|
8655
8674
|
useState as useState10
|
|
8656
8675
|
} from "react";
|
|
8657
|
-
import { Editor as
|
|
8676
|
+
import { Editor as Editor60, Range as Range10 } from "slate";
|
|
8658
8677
|
import { ReactEditor as ReactEditor14, useSlateStatic as useSlateStatic18 } from "slate-react";
|
|
8659
8678
|
|
|
8660
8679
|
// src/toolbar-plugin/styles/dialog-shared-styles.ts
|
|
@@ -8726,7 +8745,7 @@ function AnchorDialog2({
|
|
|
8726
8745
|
const initialText = useMemo2(() => {
|
|
8727
8746
|
const { selection } = editor;
|
|
8728
8747
|
if (selection && !Range10.isCollapsed(selection)) {
|
|
8729
|
-
return
|
|
8748
|
+
return Editor60.string(editor, selection);
|
|
8730
8749
|
}
|
|
8731
8750
|
return "";
|
|
8732
8751
|
}, []);
|
|
@@ -8840,6 +8859,12 @@ var dialogItems = [
|
|
|
8840
8859
|
title: t("insertTable"),
|
|
8841
8860
|
more: true,
|
|
8842
8861
|
Component: TableDialog
|
|
8862
|
+
},
|
|
8863
|
+
{
|
|
8864
|
+
icon: HorizontalRule2,
|
|
8865
|
+
title: t("horizontalRule"),
|
|
8866
|
+
hotkey: "super+-",
|
|
8867
|
+
action: (editor) => editor.horizontalRule.insertHorizontalRule()
|
|
8843
8868
|
}
|
|
8844
8869
|
];
|
|
8845
8870
|
var expandedDialogItems = dialogItems;
|
|
@@ -8854,9 +8879,9 @@ var smallDialogItems = [
|
|
|
8854
8879
|
];
|
|
8855
8880
|
|
|
8856
8881
|
// src/toolbar-plugin/items/mark-items.tsx
|
|
8857
|
-
import { Editor as
|
|
8882
|
+
import { Editor as Editor61 } from "slate";
|
|
8858
8883
|
function getMarks(editor) {
|
|
8859
|
-
const marks =
|
|
8884
|
+
const marks = Editor61.marks(editor);
|
|
8860
8885
|
return {
|
|
8861
8886
|
bold: marks?.bold || false,
|
|
8862
8887
|
italic: marks?.italic || false,
|
|
@@ -8954,7 +8979,7 @@ var compactListItems = [
|
|
|
8954
8979
|
];
|
|
8955
8980
|
|
|
8956
8981
|
// src/toolbar-plugin/items/quote-items.tsx
|
|
8957
|
-
import { Editor as
|
|
8982
|
+
import { Editor as Editor62, Transforms as Transforms44 } from "slate";
|
|
8958
8983
|
var quoteItemsList = [
|
|
8959
8984
|
{
|
|
8960
8985
|
icon: Quote,
|
|
@@ -8983,9 +9008,9 @@ var quoteItemsList = [
|
|
|
8983
9008
|
const codeBlockEntry = findElementUp(editor, "code-block");
|
|
8984
9009
|
if (codeBlockEntry) {
|
|
8985
9010
|
const [, path] = codeBlockEntry;
|
|
8986
|
-
const textContent =
|
|
8987
|
-
|
|
8988
|
-
|
|
9011
|
+
const textContent = Editor62.string(editor, path);
|
|
9012
|
+
Transforms44.removeNodes(editor, { at: path });
|
|
9013
|
+
Transforms44.insertNodes(
|
|
8989
9014
|
editor,
|
|
8990
9015
|
{
|
|
8991
9016
|
type: "paragraph",
|
|
@@ -9000,9 +9025,9 @@ var quoteItemsList = [
|
|
|
9000
9025
|
return;
|
|
9001
9026
|
}
|
|
9002
9027
|
if (selection && (selection.anchor.offset !== selection.focus.offset || JSON.stringify(selection.anchor.path) !== JSON.stringify(selection.focus.path))) {
|
|
9003
|
-
const selectedText =
|
|
9004
|
-
|
|
9005
|
-
|
|
9028
|
+
const selectedText = Editor62.string(editor, selection);
|
|
9029
|
+
Transforms44.delete(editor);
|
|
9030
|
+
Transforms44.insertNodes(
|
|
9006
9031
|
editor,
|
|
9007
9032
|
{
|
|
9008
9033
|
type: "code-block",
|
|
@@ -9227,7 +9252,7 @@ function renderEditable({ attributes, Editable: Editable3 }) {
|
|
|
9227
9252
|
(e) => {
|
|
9228
9253
|
if (e.target !== e.currentTarget)
|
|
9229
9254
|
return;
|
|
9230
|
-
|
|
9255
|
+
Transforms45.select(editor, Editor63.end(editor, []));
|
|
9231
9256
|
ReactEditor16.focus(editor);
|
|
9232
9257
|
},
|
|
9233
9258
|
[editor]
|
|
@@ -9277,7 +9302,7 @@ var ToolbarPlugin = createPlugin(
|
|
|
9277
9302
|
);
|
|
9278
9303
|
|
|
9279
9304
|
// src/trailing-block-plugin/index.tsx
|
|
9280
|
-
import { Editor as
|
|
9305
|
+
import { Editor as Editor64, Node as Node15, Path as Path17, Transforms as Transforms46 } from "slate";
|
|
9281
9306
|
var TrailingBlockPlugin = createPlugin(
|
|
9282
9307
|
(editor) => {
|
|
9283
9308
|
editor.allowTrailingBlock = true;
|
|
@@ -9285,19 +9310,19 @@ var TrailingBlockPlugin = createPlugin(
|
|
|
9285
9310
|
name: "trailing-block",
|
|
9286
9311
|
editor: {
|
|
9287
9312
|
normalizeNode: (entry) => {
|
|
9288
|
-
if (!
|
|
9313
|
+
if (!Editor64.isEditor(entry[0]))
|
|
9289
9314
|
return false;
|
|
9290
9315
|
const lastPath = [editor.children.length - 1];
|
|
9291
9316
|
const lastElement = Node15.child(
|
|
9292
9317
|
editor,
|
|
9293
9318
|
editor.children.length - 1
|
|
9294
9319
|
);
|
|
9295
|
-
if (
|
|
9296
|
-
|
|
9320
|
+
if (Editor64.hasBlocks(editor, lastElement) || Editor64.isVoid(editor, lastElement)) {
|
|
9321
|
+
Transforms46.insertNodes(
|
|
9297
9322
|
editor,
|
|
9298
9323
|
{ type: "paragraph", children: [{ text: "" }] },
|
|
9299
9324
|
{
|
|
9300
|
-
at:
|
|
9325
|
+
at: Path17.next(lastPath)
|
|
9301
9326
|
}
|
|
9302
9327
|
);
|
|
9303
9328
|
}
|
|
@@ -9309,11 +9334,11 @@ var TrailingBlockPlugin = createPlugin(
|
|
|
9309
9334
|
);
|
|
9310
9335
|
|
|
9311
9336
|
// src/paste-markdown-plugin/methods/index.ts
|
|
9312
|
-
import { Transforms as
|
|
9337
|
+
import { Transforms as Transforms47 } from "slate";
|
|
9313
9338
|
function pasteMarkdown(editor, markdown) {
|
|
9314
9339
|
const escapedMarkdown = escapeUrlSlashes(markdown);
|
|
9315
9340
|
const fragment = parse(escapedMarkdown);
|
|
9316
|
-
|
|
9341
|
+
Transforms47.insertNodes(editor, fragment);
|
|
9317
9342
|
}
|
|
9318
9343
|
function createPasteMarkdownMethods(editor) {
|
|
9319
9344
|
return {
|
|
@@ -9399,7 +9424,7 @@ var { withSink, SinkEditable: SinkEditable2 } = Sink;
|
|
|
9399
9424
|
|
|
9400
9425
|
// src/entry/useEditor.tsx
|
|
9401
9426
|
import { useState as useState12 } from "react";
|
|
9402
|
-
import { createEditor, Editor as
|
|
9427
|
+
import { createEditor, Editor as Editor66, Transforms as Transforms48 } from "slate";
|
|
9403
9428
|
import { withHistory } from "slate-history";
|
|
9404
9429
|
import { withReact } from "slate-react";
|
|
9405
9430
|
function useEditor({
|
|
@@ -9445,7 +9470,7 @@ function useEditor({
|
|
|
9445
9470
|
const documentValue = parse(escapedMarkdown);
|
|
9446
9471
|
editor2.children = documentValue;
|
|
9447
9472
|
editor2.selection = null;
|
|
9448
|
-
|
|
9473
|
+
Transforms48.select(editor2, Editor66.start(editor2, [0]));
|
|
9449
9474
|
};
|
|
9450
9475
|
return nextEditor;
|
|
9451
9476
|
});
|
|
@@ -9517,7 +9542,7 @@ function Editable2({
|
|
|
9517
9542
|
const documentValue = parse(valueToProcess);
|
|
9518
9543
|
editor.children = documentValue;
|
|
9519
9544
|
editor.selection = null;
|
|
9520
|
-
|
|
9545
|
+
Transforms49.select(editor, Editor67.start(editor, [0]));
|
|
9521
9546
|
}
|
|
9522
9547
|
}
|
|
9523
9548
|
}
|