microboard-temp 0.5.17 → 0.5.19
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/cjs/browser.js +44 -5
- package/dist/cjs/index.js +44 -5
- package/dist/cjs/node.js +44 -5
- package/dist/esm/browser.js +102 -63
- package/dist/esm/index.js +102 -63
- package/dist/esm/node.js +102 -63
- package/dist/types/Items/Examples/CardGame/Dice/Dice.d.ts +4 -2
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -47696,8 +47696,6 @@ class Card extends BaseItem {
|
|
|
47696
47696
|
createImages() {
|
|
47697
47697
|
this.face = conf.documentFactory.createElement("img");
|
|
47698
47698
|
this.backside = conf.documentFactory.createElement("img");
|
|
47699
|
-
this.face.crossOrigin = "anonymous";
|
|
47700
|
-
this.backside.crossOrigin = "anonymous";
|
|
47701
47699
|
this.face.src = this.faceUrl;
|
|
47702
47700
|
this.backside.src = this.backsideUrl;
|
|
47703
47701
|
this.face.onload = () => {
|
|
@@ -47977,15 +47975,21 @@ class Deck extends BaseItem {
|
|
|
47977
47975
|
}
|
|
47978
47976
|
renderHTML(documentFactory) {
|
|
47979
47977
|
const div = super.renderHTML(documentFactory);
|
|
47980
|
-
|
|
47978
|
+
const cards = this.index?.list();
|
|
47979
|
+
const topCard = cards[cards.length - 1];
|
|
47980
|
+
if (!topCard) {
|
|
47981
47981
|
return div;
|
|
47982
47982
|
}
|
|
47983
47983
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
47984
|
-
const transform = `translate(${translateX}px, ${translateY}px) scale(
|
|
47985
|
-
|
|
47984
|
+
const transform = `translate(${translateX}px, ${translateY}px) scale(1, 1)`;
|
|
47985
|
+
const topCardElement = topCard.renderHTML(documentFactory);
|
|
47986
|
+
div.appendChild(topCardElement);
|
|
47987
|
+
const offset = ((this.index?.list().length || 0) - 1) * 2;
|
|
47988
|
+
topCardElement.style.transform = `translate(${offset}px, ${0}px) scale(1, 1)`;
|
|
47986
47989
|
div.id = this.getId();
|
|
47987
47990
|
div.style.width = `${this.getWidth()}px`;
|
|
47988
47991
|
div.style.height = `${this.getHeight()}px`;
|
|
47992
|
+
div.style.boxShadow = `${offset}px 0px 0px 0px rgba(34, 60, 80, 0.74) inset`;
|
|
47989
47993
|
div.style.transformOrigin = "top left";
|
|
47990
47994
|
div.style.transform = transform;
|
|
47991
47995
|
div.style.position = "absolute";
|
|
@@ -48441,6 +48445,41 @@ class Dice extends BaseItem {
|
|
|
48441
48445
|
this.drawingContext = null;
|
|
48442
48446
|
}
|
|
48443
48447
|
}
|
|
48448
|
+
renderHTML(documentFactory) {
|
|
48449
|
+
const div = super.renderHTML(documentFactory);
|
|
48450
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
48451
|
+
const mbr = this.getMbr();
|
|
48452
|
+
const width2 = mbr.getWidth();
|
|
48453
|
+
const height3 = mbr.getHeight();
|
|
48454
|
+
const unscaledWidth = width2 / scaleX;
|
|
48455
|
+
const unscaledHeight = height3 / scaleY;
|
|
48456
|
+
const svg3 = documentFactory.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
48457
|
+
svg3.setAttribute("width", `${unscaledWidth}px`);
|
|
48458
|
+
svg3.setAttribute("height", `${unscaledHeight}px`);
|
|
48459
|
+
svg3.setAttribute("viewBox", `0 0 ${unscaledWidth} ${unscaledHeight}`);
|
|
48460
|
+
svg3.setAttribute("transform-origin", "0 0");
|
|
48461
|
+
svg3.setAttribute("transform", `scale(${1 / scaleX}, ${1 / scaleY})`);
|
|
48462
|
+
svg3.setAttribute("style", "position: absolute; overflow: visible;");
|
|
48463
|
+
const pathElement = Shapes["RoundedRectangle"].path.copy().renderHTML(documentFactory);
|
|
48464
|
+
const paths = Array.isArray(pathElement) ? pathElement : [pathElement];
|
|
48465
|
+
paths.forEach((element4) => {
|
|
48466
|
+
element4.setAttribute("fill", this.backgroundColor);
|
|
48467
|
+
element4.setAttribute("stroke", this.borderColor);
|
|
48468
|
+
element4.setAttribute("stroke-dasharray", LinePatterns[this.borderStyle].join(", "));
|
|
48469
|
+
element4.setAttribute("stroke-width", this.borderWidth.toString());
|
|
48470
|
+
element4.setAttribute("transform-origin", "0 0");
|
|
48471
|
+
element4.setAttribute("transform", `scale(${scaleX}, ${scaleY})`);
|
|
48472
|
+
});
|
|
48473
|
+
svg3.append(...paths);
|
|
48474
|
+
div.appendChild(svg3);
|
|
48475
|
+
div.id = this.getId();
|
|
48476
|
+
div.style.width = unscaledWidth + "px";
|
|
48477
|
+
div.style.height = unscaledHeight + "px";
|
|
48478
|
+
div.style.transformOrigin = "left top";
|
|
48479
|
+
div.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
48480
|
+
div.style.position = "absolute";
|
|
48481
|
+
return div;
|
|
48482
|
+
}
|
|
48444
48483
|
}
|
|
48445
48484
|
registerItem({
|
|
48446
48485
|
item: Dice,
|
|
@@ -54083,7 +54122,7 @@ class Board {
|
|
|
54083
54122
|
}
|
|
54084
54123
|
}
|
|
54085
54124
|
// src/Events/Merge.ts
|
|
54086
|
-
import { Path as
|
|
54125
|
+
import { Path as Path15 } from "slate";
|
|
54087
54126
|
function areItemsTheSame(opA, opB) {
|
|
54088
54127
|
if (opA.method === "transformMany" && opB.method === "transformMany") {
|
|
54089
54128
|
const itemsA = Object.keys(opA.items);
|
|
@@ -54316,7 +54355,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
54316
54355
|
ops: [...opA.ops, ...opB.ops]
|
|
54317
54356
|
};
|
|
54318
54357
|
}
|
|
54319
|
-
if (B.type === "insert_text" && A.type === "insert_text" && B.offset === A.offset + A.text.length &&
|
|
54358
|
+
if (B.type === "insert_text" && A.type === "insert_text" && B.offset === A.offset + A.text.length && Path15.equals(B.path, A.path)) {
|
|
54320
54359
|
return {
|
|
54321
54360
|
...opB,
|
|
54322
54361
|
ops: [
|
|
@@ -54328,7 +54367,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
54328
54367
|
]
|
|
54329
54368
|
};
|
|
54330
54369
|
}
|
|
54331
|
-
if (B.type === "remove_text" && A.type === "remove_text" && B.offset + B.text.length === A.offset &&
|
|
54370
|
+
if (B.type === "remove_text" && A.type === "remove_text" && B.offset + B.text.length === A.offset && Path15.equals(B.path, A.path)) {
|
|
54332
54371
|
return {
|
|
54333
54372
|
...opB,
|
|
54334
54373
|
ops: [
|
|
@@ -54340,7 +54379,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
54340
54379
|
]
|
|
54341
54380
|
};
|
|
54342
54381
|
}
|
|
54343
|
-
if (B.type === "split_node" && A.type === "split_node" &&
|
|
54382
|
+
if (B.type === "split_node" && A.type === "split_node" && Path15.isChild(A.path, B.path)) {
|
|
54344
54383
|
return {
|
|
54345
54384
|
...opB,
|
|
54346
54385
|
ops: [...opA.ops, ...opB.ops]
|
|
@@ -54492,10 +54531,10 @@ function createSyncLog() {
|
|
|
54492
54531
|
}
|
|
54493
54532
|
|
|
54494
54533
|
// src/Events/Transform/removeText_removeText.ts
|
|
54495
|
-
import { Path as
|
|
54534
|
+
import { Path as Path16 } from "slate";
|
|
54496
54535
|
function removeText_removeText(confirmed, toTransform) {
|
|
54497
54536
|
const transformed = { ...toTransform };
|
|
54498
|
-
if (
|
|
54537
|
+
if (Path16.equals(confirmed.path, toTransform.path)) {
|
|
54499
54538
|
const confirmedStart = confirmed.offset;
|
|
54500
54539
|
const confirmedEnd = confirmed.offset + confirmed.text.length;
|
|
54501
54540
|
const toTransformStart = toTransform.offset;
|
|
@@ -54524,10 +54563,10 @@ function removeText_removeText(confirmed, toTransform) {
|
|
|
54524
54563
|
}
|
|
54525
54564
|
|
|
54526
54565
|
// src/Events/Transform/insertText_insertText.ts
|
|
54527
|
-
import { Path as
|
|
54566
|
+
import { Path as Path17 } from "slate";
|
|
54528
54567
|
function insertText_insertText(confirmed, toTransform) {
|
|
54529
54568
|
const transformed = { ...toTransform };
|
|
54530
|
-
if (
|
|
54569
|
+
if (Path17.equals(confirmed.path, toTransform.path)) {
|
|
54531
54570
|
if (confirmed.offset <= toTransform.offset) {
|
|
54532
54571
|
transformed.offset += confirmed.text.length;
|
|
54533
54572
|
}
|
|
@@ -54536,10 +54575,10 @@ function insertText_insertText(confirmed, toTransform) {
|
|
|
54536
54575
|
}
|
|
54537
54576
|
|
|
54538
54577
|
// src/Events/Transform/removeText_insertText.ts
|
|
54539
|
-
import { Path as
|
|
54578
|
+
import { Path as Path18 } from "slate";
|
|
54540
54579
|
function removeText_insertText(confirmed, toTransform) {
|
|
54541
54580
|
const transformed = { ...toTransform };
|
|
54542
|
-
if (
|
|
54581
|
+
if (Path18.equals(confirmed.path, toTransform.path)) {
|
|
54543
54582
|
if (confirmed.offset <= toTransform.offset) {
|
|
54544
54583
|
transformed.offset -= confirmed.text.length;
|
|
54545
54584
|
}
|
|
@@ -54548,17 +54587,17 @@ function removeText_insertText(confirmed, toTransform) {
|
|
|
54548
54587
|
}
|
|
54549
54588
|
|
|
54550
54589
|
// src/Events/Transform/splitNode_insertText.ts
|
|
54551
|
-
import { Path as
|
|
54590
|
+
import { Path as Path20 } from "slate";
|
|
54552
54591
|
|
|
54553
54592
|
// src/Events/Transform/transformPath.ts
|
|
54554
|
-
import { Path as
|
|
54593
|
+
import { Path as Path19 } from "slate";
|
|
54555
54594
|
function transformPath(confirmed, toTransform) {
|
|
54556
|
-
const newPath =
|
|
54595
|
+
const newPath = Path19.transform(toTransform.path, confirmed);
|
|
54557
54596
|
if (newPath) {
|
|
54558
54597
|
toTransform.path = newPath;
|
|
54559
54598
|
}
|
|
54560
54599
|
if ("newPath" in toTransform) {
|
|
54561
|
-
const newPathUpdated =
|
|
54600
|
+
const newPathUpdated = Path19.transform(toTransform.newPath, confirmed);
|
|
54562
54601
|
if (newPathUpdated) {
|
|
54563
54602
|
toTransform.newPath = newPathUpdated;
|
|
54564
54603
|
}
|
|
@@ -54570,7 +54609,7 @@ function splitNode_insertText(confirmed, toTransform) {
|
|
|
54570
54609
|
const transformed = { ...toTransform };
|
|
54571
54610
|
const confPath = confirmed.path;
|
|
54572
54611
|
const tPath = transformed.path;
|
|
54573
|
-
if (
|
|
54612
|
+
if (Path20.equals(confPath, tPath)) {
|
|
54574
54613
|
if (transformed.offset >= confirmed.position) {
|
|
54575
54614
|
transformed.offset -= confirmed.position;
|
|
54576
54615
|
transformed.path = [...confPath];
|
|
@@ -54597,10 +54636,10 @@ function insertNode_insertText(confirmed, toTransform) {
|
|
|
54597
54636
|
}
|
|
54598
54637
|
|
|
54599
54638
|
// src/Events/Transform/mergeNode_insertText.ts
|
|
54600
|
-
import { Path as
|
|
54639
|
+
import { Path as Path21 } from "slate";
|
|
54601
54640
|
function mergeNode_insertText(confirmed, toTransform) {
|
|
54602
54641
|
const transformed = { ...toTransform };
|
|
54603
|
-
if (
|
|
54642
|
+
if (Path21.equals(confirmed.path, transformed.path)) {
|
|
54604
54643
|
transformed.offset += confirmed.position;
|
|
54605
54644
|
return transformed;
|
|
54606
54645
|
}
|
|
@@ -54609,10 +54648,10 @@ function mergeNode_insertText(confirmed, toTransform) {
|
|
|
54609
54648
|
}
|
|
54610
54649
|
|
|
54611
54650
|
// src/Events/Transform/insertText_removeText.ts
|
|
54612
|
-
import { Path as
|
|
54651
|
+
import { Path as Path22 } from "slate";
|
|
54613
54652
|
function insertText_removeText(confirmed, toTransform) {
|
|
54614
54653
|
const transformed = { ...toTransform };
|
|
54615
|
-
if (
|
|
54654
|
+
if (Path22.equals(confirmed.path, toTransform.path)) {
|
|
54616
54655
|
if (confirmed.offset <= toTransform.offset) {
|
|
54617
54656
|
transformed.offset += confirmed.text.length;
|
|
54618
54657
|
}
|
|
@@ -54628,10 +54667,10 @@ function insertNode_removeText(confirmed, toTransform) {
|
|
|
54628
54667
|
}
|
|
54629
54668
|
|
|
54630
54669
|
// src/Events/Transform/splitNode_removeText.ts
|
|
54631
|
-
import { Path as
|
|
54670
|
+
import { Path as Path23 } from "slate";
|
|
54632
54671
|
function splitNode_removeText(confirmed, toTransform) {
|
|
54633
54672
|
const transformed = { ...toTransform };
|
|
54634
|
-
if (
|
|
54673
|
+
if (Path23.equals(confirmed.path, transformed.path)) {
|
|
54635
54674
|
if (confirmed.position <= transformed.offset) {
|
|
54636
54675
|
transformed.offset -= confirmed.position;
|
|
54637
54676
|
}
|
|
@@ -54650,10 +54689,10 @@ function splitNode_removeText(confirmed, toTransform) {
|
|
|
54650
54689
|
}
|
|
54651
54690
|
|
|
54652
54691
|
// src/Events/Transform/mergeNode_removeText.ts
|
|
54653
|
-
import { Path as
|
|
54692
|
+
import { Path as Path24 } from "slate";
|
|
54654
54693
|
function mergeNode_removeText(confirmed, toTransform) {
|
|
54655
54694
|
const transformed = { ...toTransform };
|
|
54656
|
-
if (
|
|
54695
|
+
if (Path24.equals(confirmed.path, toTransform.path)) {
|
|
54657
54696
|
transformed.offset += confirmed.position;
|
|
54658
54697
|
}
|
|
54659
54698
|
transformPath(confirmed, transformed);
|
|
@@ -54724,12 +54763,12 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
54724
54763
|
}
|
|
54725
54764
|
|
|
54726
54765
|
// src/Events/Transform/splitNode_insertNode.ts
|
|
54727
|
-
import { Path as
|
|
54766
|
+
import { Path as Path25 } from "slate";
|
|
54728
54767
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
54729
54768
|
const transformed = { ...toTransform };
|
|
54730
54769
|
const conf2 = confirmed.path;
|
|
54731
54770
|
const path2 = transformed.path;
|
|
54732
|
-
if (
|
|
54771
|
+
if (Path25.equals(conf2, path2)) {
|
|
54733
54772
|
return transformed;
|
|
54734
54773
|
}
|
|
54735
54774
|
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
@@ -54739,19 +54778,19 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
54739
54778
|
transformed.path = newPath;
|
|
54740
54779
|
return transformed;
|
|
54741
54780
|
}
|
|
54742
|
-
if (
|
|
54781
|
+
if (Path25.isBefore(conf2, path2)) {
|
|
54743
54782
|
transformPath(confirmed, transformed);
|
|
54744
54783
|
}
|
|
54745
54784
|
return transformed;
|
|
54746
54785
|
}
|
|
54747
54786
|
|
|
54748
54787
|
// src/Events/Transform/splitNode_removeNode.ts
|
|
54749
|
-
import { Path as
|
|
54788
|
+
import { Path as Path26 } from "slate";
|
|
54750
54789
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
54751
54790
|
const transformed = { ...toTransform };
|
|
54752
54791
|
const conf2 = confirmed.path;
|
|
54753
54792
|
const path2 = transformed.path;
|
|
54754
|
-
if (
|
|
54793
|
+
if (Path26.equals(conf2, path2)) {
|
|
54755
54794
|
return transformed;
|
|
54756
54795
|
}
|
|
54757
54796
|
if (path2.length === conf2.length + 1 && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i])) {
|
|
@@ -54765,18 +54804,18 @@ function splitNode_removeNode(confirmed, toTransform) {
|
|
|
54765
54804
|
return transformed;
|
|
54766
54805
|
}
|
|
54767
54806
|
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
54768
|
-
if (
|
|
54807
|
+
if (Path26.isBefore(conf2, path2) && !isDescendant) {
|
|
54769
54808
|
transformPath(confirmed, transformed);
|
|
54770
54809
|
}
|
|
54771
54810
|
return transformed;
|
|
54772
54811
|
}
|
|
54773
54812
|
|
|
54774
54813
|
// src/Events/Transform/mergeNode_insertNode.ts
|
|
54775
|
-
import { Path as
|
|
54814
|
+
import { Path as Path27 } from "slate";
|
|
54776
54815
|
function mergeNode_insertNode(confirmed, toTransform) {
|
|
54777
54816
|
const transformed = { ...toTransform };
|
|
54778
|
-
const isDescendant =
|
|
54779
|
-
const isAfter =
|
|
54817
|
+
const isDescendant = Path27.isAncestor(confirmed.path, transformed.path);
|
|
54818
|
+
const isAfter = Path27.isBefore(confirmed.path, transformed.path);
|
|
54780
54819
|
if (confirmed.path.length === 1 && isAfter && !isDescendant || confirmed.path.length > 1 && (isAfter || isDescendant)) {
|
|
54781
54820
|
transformPath(confirmed, transformed);
|
|
54782
54821
|
}
|
|
@@ -54784,40 +54823,40 @@ function mergeNode_insertNode(confirmed, toTransform) {
|
|
|
54784
54823
|
}
|
|
54785
54824
|
|
|
54786
54825
|
// src/Events/Transform/mergeNode_removeNode.ts
|
|
54787
|
-
import { Path as
|
|
54826
|
+
import { Path as Path28 } from "slate";
|
|
54788
54827
|
function mergeNode_removeNode(confirmed, toTransform) {
|
|
54789
54828
|
const transformed = { ...toTransform };
|
|
54790
|
-
if (
|
|
54829
|
+
if (Path28.isBefore(confirmed.path, transformed.path)) {
|
|
54791
54830
|
transformPath(confirmed, transformed);
|
|
54792
54831
|
}
|
|
54793
54832
|
return transformed;
|
|
54794
54833
|
}
|
|
54795
54834
|
|
|
54796
54835
|
// src/Events/Transform/setNode_insertNode.ts
|
|
54797
|
-
import { Path as
|
|
54836
|
+
import { Path as Path29 } from "slate";
|
|
54798
54837
|
function setNode_insertNode(confirmed, toTransform) {
|
|
54799
54838
|
const transformed = { ...toTransform };
|
|
54800
|
-
if (
|
|
54839
|
+
if (Path29.isBefore(confirmed.path, transformed.path)) {
|
|
54801
54840
|
transformPath(confirmed, transformed);
|
|
54802
54841
|
}
|
|
54803
54842
|
return transformed;
|
|
54804
54843
|
}
|
|
54805
54844
|
|
|
54806
54845
|
// src/Events/Transform/setNode_removeNode.ts
|
|
54807
|
-
import { Path as
|
|
54846
|
+
import { Path as Path30 } from "slate";
|
|
54808
54847
|
function setNode_removeNode(confirmed, toTransform) {
|
|
54809
54848
|
const transformed = { ...toTransform };
|
|
54810
|
-
if (
|
|
54849
|
+
if (Path30.isBefore(confirmed.path, transformed.path)) {
|
|
54811
54850
|
transformPath(confirmed, transformed);
|
|
54812
54851
|
}
|
|
54813
54852
|
return transformed;
|
|
54814
54853
|
}
|
|
54815
54854
|
|
|
54816
54855
|
// src/Events/Transform/insertText_mergeNode.ts
|
|
54817
|
-
import { Path as
|
|
54856
|
+
import { Path as Path31 } from "slate";
|
|
54818
54857
|
function insertText_mergeNode(confirmed, toTransform) {
|
|
54819
54858
|
const transformed = { ...toTransform };
|
|
54820
|
-
if (
|
|
54859
|
+
if (Path31.isBefore(confirmed.path, toTransform.path) && Path31.isSibling(confirmed.path, toTransform.path)) {
|
|
54821
54860
|
if (confirmed.offset <= toTransform.position) {
|
|
54822
54861
|
transformed.position += confirmed.text.length;
|
|
54823
54862
|
}
|
|
@@ -54858,12 +54897,12 @@ function removeNode_mergeNode(confirmed, toTransform) {
|
|
|
54858
54897
|
}
|
|
54859
54898
|
|
|
54860
54899
|
// src/Events/Transform/splitNode_mergeNode.ts
|
|
54861
|
-
import { Path as
|
|
54900
|
+
import { Path as Path32 } from "slate";
|
|
54862
54901
|
function splitNode_mergeNode(confirmed, toTransform) {
|
|
54863
54902
|
const transformed = { ...toTransform };
|
|
54864
54903
|
const confPath = confirmed.path;
|
|
54865
54904
|
const tPath = transformed.path;
|
|
54866
|
-
if (
|
|
54905
|
+
if (Path32.equals(confPath, tPath)) {
|
|
54867
54906
|
if (confirmed.position <= transformed.position) {
|
|
54868
54907
|
transformed.position -= confirmed.position;
|
|
54869
54908
|
}
|
|
@@ -54874,10 +54913,10 @@ function splitNode_mergeNode(confirmed, toTransform) {
|
|
|
54874
54913
|
}
|
|
54875
54914
|
|
|
54876
54915
|
// src/Events/Transform/mergeNode_mergeNode.ts
|
|
54877
|
-
import { Path as
|
|
54916
|
+
import { Path as Path33 } from "slate";
|
|
54878
54917
|
function mergeNode_mergeNode(confirmed, toTransform) {
|
|
54879
54918
|
const transformed = { ...toTransform };
|
|
54880
|
-
if (
|
|
54919
|
+
if (Path33.equals(confirmed.path, transformed.path)) {
|
|
54881
54920
|
transformed.position += confirmed.position;
|
|
54882
54921
|
return transformed;
|
|
54883
54922
|
}
|
|
@@ -54892,10 +54931,10 @@ function mergeNode_mergeNode(confirmed, toTransform) {
|
|
|
54892
54931
|
}
|
|
54893
54932
|
|
|
54894
54933
|
// src/Events/Transform/insertText_splitNode.ts
|
|
54895
|
-
import { Path as
|
|
54934
|
+
import { Path as Path34 } from "slate";
|
|
54896
54935
|
function insertText_splitNode(confirmed, toTransform) {
|
|
54897
54936
|
const transformed = { ...toTransform };
|
|
54898
|
-
const newPath =
|
|
54937
|
+
const newPath = Path34.transform(transformed.path, confirmed);
|
|
54899
54938
|
if (newPath) {
|
|
54900
54939
|
transformed.path = newPath;
|
|
54901
54940
|
}
|
|
@@ -54938,12 +54977,12 @@ function removeNode_splitNode(confirmed, toTransform) {
|
|
|
54938
54977
|
}
|
|
54939
54978
|
|
|
54940
54979
|
// src/Events/Transform/mergeNode_splitNode.ts
|
|
54941
|
-
import { Path as
|
|
54980
|
+
import { Path as Path35 } from "slate";
|
|
54942
54981
|
function mergeNode_splitNode(confirmed, toTransform) {
|
|
54943
54982
|
const transformed = { ...toTransform };
|
|
54944
54983
|
const rem = confirmed.path;
|
|
54945
54984
|
const orig = transformed.path;
|
|
54946
|
-
if (
|
|
54985
|
+
if (Path35.equals(rem, orig)) {
|
|
54947
54986
|
transformed.position += confirmed.position;
|
|
54948
54987
|
return transformed;
|
|
54949
54988
|
}
|
|
@@ -54954,7 +54993,7 @@ function mergeNode_splitNode(confirmed, toTransform) {
|
|
|
54954
54993
|
if (rem.length > 1) {
|
|
54955
54994
|
const depth = rem.length - 1;
|
|
54956
54995
|
const prefix2 = rem.slice(0, depth);
|
|
54957
|
-
if (newPath.length > depth &&
|
|
54996
|
+
if (newPath.length > depth && Path35.equals(prefix2, newPath.slice(0, depth)) && newPath[depth] > rem[depth]) {
|
|
54958
54997
|
newPath[depth] = newPath[depth] - 1;
|
|
54959
54998
|
}
|
|
54960
54999
|
}
|
|
@@ -54963,10 +55002,10 @@ function mergeNode_splitNode(confirmed, toTransform) {
|
|
|
54963
55002
|
}
|
|
54964
55003
|
|
|
54965
55004
|
// src/Events/Transform/splitNode_splitNode.ts
|
|
54966
|
-
import { Path as
|
|
55005
|
+
import { Path as Path36 } from "slate";
|
|
54967
55006
|
function splitNode_splitNode(confirmed, toTransform) {
|
|
54968
55007
|
const transformed = { ...toTransform };
|
|
54969
|
-
const samePath =
|
|
55008
|
+
const samePath = Path36.equals(confirmed.path, transformed.path);
|
|
54970
55009
|
if (samePath && confirmed.position <= transformed.position) {
|
|
54971
55010
|
transformed.position -= confirmed.position;
|
|
54972
55011
|
}
|
|
@@ -54990,12 +55029,12 @@ function setNode_splitNode(confirmed, toTransform) {
|
|
|
54990
55029
|
}
|
|
54991
55030
|
|
|
54992
55031
|
// src/Events/Transform/splitNode_setNode.ts
|
|
54993
|
-
import { Path as
|
|
55032
|
+
import { Path as Path37 } from "slate";
|
|
54994
55033
|
function splitNode_setNode(confirmed, toTransform) {
|
|
54995
55034
|
const transformed = { ...toTransform };
|
|
54996
55035
|
const confirmedPath = confirmed.path;
|
|
54997
55036
|
const currentPath = transformed.path;
|
|
54998
|
-
const isSame =
|
|
55037
|
+
const isSame = Path37.equals(currentPath, confirmedPath);
|
|
54999
55038
|
const isDeepNestedDescendant = confirmedPath.length > 1 && currentPath.length > confirmedPath.length && currentPath.slice(0, confirmedPath.length).every((seg, i) => seg === confirmedPath[i]);
|
|
55000
55039
|
if (!isSame && !isDeepNestedDescendant) {
|
|
55001
55040
|
transformPath(confirmed, transformed);
|
|
@@ -55018,11 +55057,11 @@ function insertNode_setNode(confirmed, toTransform) {
|
|
|
55018
55057
|
}
|
|
55019
55058
|
|
|
55020
55059
|
// src/Events/Transform/removeNode_setNode.ts
|
|
55021
|
-
import { Path as
|
|
55060
|
+
import { Path as Path38 } from "slate";
|
|
55022
55061
|
function removeNode_setNode(confirmed, toTransform) {
|
|
55023
55062
|
const removalPath = confirmed.path;
|
|
55024
55063
|
const originalPath = toTransform.path;
|
|
55025
|
-
if (
|
|
55064
|
+
if (Path38.equals(removalPath, originalPath)) {
|
|
55026
55065
|
return;
|
|
55027
55066
|
}
|
|
55028
55067
|
const transformedOp = { ...toTransform };
|
|
@@ -55033,7 +55072,7 @@ function removeNode_setNode(confirmed, toTransform) {
|
|
|
55033
55072
|
if (removalPath.length > 1) {
|
|
55034
55073
|
const depthIndex = removalPath.length - 1;
|
|
55035
55074
|
const parentPrefix = removalPath.slice(0, depthIndex);
|
|
55036
|
-
if (newPath.length > depthIndex &&
|
|
55075
|
+
if (newPath.length > depthIndex && Path38.equals(parentPrefix, newPath.slice(0, depthIndex)) && newPath[depthIndex] > removalPath[depthIndex]) {
|
|
55037
55076
|
newPath[depthIndex] = newPath[depthIndex] - 1;
|
|
55038
55077
|
}
|
|
55039
55078
|
}
|
|
@@ -55042,10 +55081,10 @@ function removeNode_setNode(confirmed, toTransform) {
|
|
|
55042
55081
|
}
|
|
55043
55082
|
|
|
55044
55083
|
// src/Events/Transform/setNode_setNode.ts
|
|
55045
|
-
import { Path as
|
|
55084
|
+
import { Path as Path39 } from "slate";
|
|
55046
55085
|
function setNode_setNode(confirmed, toTransform) {
|
|
55047
55086
|
const transformed = { ...toTransform };
|
|
55048
|
-
if (
|
|
55087
|
+
if (Path39.equals(confirmed.path, toTransform.path)) {
|
|
55049
55088
|
transformed.newProperties = {
|
|
55050
55089
|
...toTransform.newProperties,
|
|
55051
55090
|
...confirmed.newProperties
|