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/browser.js
CHANGED
|
@@ -47703,8 +47703,6 @@ class Card extends BaseItem {
|
|
|
47703
47703
|
createImages() {
|
|
47704
47704
|
this.face = conf.documentFactory.createElement("img");
|
|
47705
47705
|
this.backside = conf.documentFactory.createElement("img");
|
|
47706
|
-
this.face.crossOrigin = "anonymous";
|
|
47707
|
-
this.backside.crossOrigin = "anonymous";
|
|
47708
47706
|
this.face.src = this.faceUrl;
|
|
47709
47707
|
this.backside.src = this.backsideUrl;
|
|
47710
47708
|
this.face.onload = () => {
|
|
@@ -47984,15 +47982,21 @@ class Deck extends BaseItem {
|
|
|
47984
47982
|
}
|
|
47985
47983
|
renderHTML(documentFactory) {
|
|
47986
47984
|
const div = super.renderHTML(documentFactory);
|
|
47987
|
-
|
|
47985
|
+
const cards = this.index?.list();
|
|
47986
|
+
const topCard = cards[cards.length - 1];
|
|
47987
|
+
if (!topCard) {
|
|
47988
47988
|
return div;
|
|
47989
47989
|
}
|
|
47990
47990
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
47991
|
-
const transform = `translate(${translateX}px, ${translateY}px) scale(
|
|
47992
|
-
|
|
47991
|
+
const transform = `translate(${translateX}px, ${translateY}px) scale(1, 1)`;
|
|
47992
|
+
const topCardElement = topCard.renderHTML(documentFactory);
|
|
47993
|
+
div.appendChild(topCardElement);
|
|
47994
|
+
const offset = ((this.index?.list().length || 0) - 1) * 2;
|
|
47995
|
+
topCardElement.style.transform = `translate(${offset}px, ${0}px) scale(1, 1)`;
|
|
47993
47996
|
div.id = this.getId();
|
|
47994
47997
|
div.style.width = `${this.getWidth()}px`;
|
|
47995
47998
|
div.style.height = `${this.getHeight()}px`;
|
|
47999
|
+
div.style.boxShadow = `${offset}px 0px 0px 0px rgba(34, 60, 80, 0.74) inset`;
|
|
47996
48000
|
div.style.transformOrigin = "top left";
|
|
47997
48001
|
div.style.transform = transform;
|
|
47998
48002
|
div.style.position = "absolute";
|
|
@@ -48448,6 +48452,41 @@ class Dice extends BaseItem {
|
|
|
48448
48452
|
this.drawingContext = null;
|
|
48449
48453
|
}
|
|
48450
48454
|
}
|
|
48455
|
+
renderHTML(documentFactory) {
|
|
48456
|
+
const div = super.renderHTML(documentFactory);
|
|
48457
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
48458
|
+
const mbr = this.getMbr();
|
|
48459
|
+
const width2 = mbr.getWidth();
|
|
48460
|
+
const height3 = mbr.getHeight();
|
|
48461
|
+
const unscaledWidth = width2 / scaleX;
|
|
48462
|
+
const unscaledHeight = height3 / scaleY;
|
|
48463
|
+
const svg3 = documentFactory.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
48464
|
+
svg3.setAttribute("width", `${unscaledWidth}px`);
|
|
48465
|
+
svg3.setAttribute("height", `${unscaledHeight}px`);
|
|
48466
|
+
svg3.setAttribute("viewBox", `0 0 ${unscaledWidth} ${unscaledHeight}`);
|
|
48467
|
+
svg3.setAttribute("transform-origin", "0 0");
|
|
48468
|
+
svg3.setAttribute("transform", `scale(${1 / scaleX}, ${1 / scaleY})`);
|
|
48469
|
+
svg3.setAttribute("style", "position: absolute; overflow: visible;");
|
|
48470
|
+
const pathElement = Shapes["RoundedRectangle"].path.copy().renderHTML(documentFactory);
|
|
48471
|
+
const paths = Array.isArray(pathElement) ? pathElement : [pathElement];
|
|
48472
|
+
paths.forEach((element4) => {
|
|
48473
|
+
element4.setAttribute("fill", this.backgroundColor);
|
|
48474
|
+
element4.setAttribute("stroke", this.borderColor);
|
|
48475
|
+
element4.setAttribute("stroke-dasharray", LinePatterns[this.borderStyle].join(", "));
|
|
48476
|
+
element4.setAttribute("stroke-width", this.borderWidth.toString());
|
|
48477
|
+
element4.setAttribute("transform-origin", "0 0");
|
|
48478
|
+
element4.setAttribute("transform", `scale(${scaleX}, ${scaleY})`);
|
|
48479
|
+
});
|
|
48480
|
+
svg3.append(...paths);
|
|
48481
|
+
div.appendChild(svg3);
|
|
48482
|
+
div.id = this.getId();
|
|
48483
|
+
div.style.width = unscaledWidth + "px";
|
|
48484
|
+
div.style.height = unscaledHeight + "px";
|
|
48485
|
+
div.style.transformOrigin = "left top";
|
|
48486
|
+
div.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
48487
|
+
div.style.position = "absolute";
|
|
48488
|
+
return div;
|
|
48489
|
+
}
|
|
48451
48490
|
}
|
|
48452
48491
|
registerItem({
|
|
48453
48492
|
item: Dice,
|
|
@@ -54090,7 +54129,7 @@ class Board {
|
|
|
54090
54129
|
}
|
|
54091
54130
|
}
|
|
54092
54131
|
// src/Events/Merge.ts
|
|
54093
|
-
import { Path as
|
|
54132
|
+
import { Path as Path15 } from "slate";
|
|
54094
54133
|
function areItemsTheSame(opA, opB) {
|
|
54095
54134
|
if (opA.method === "transformMany" && opB.method === "transformMany") {
|
|
54096
54135
|
const itemsA = Object.keys(opA.items);
|
|
@@ -54323,7 +54362,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
54323
54362
|
ops: [...opA.ops, ...opB.ops]
|
|
54324
54363
|
};
|
|
54325
54364
|
}
|
|
54326
|
-
if (B.type === "insert_text" && A.type === "insert_text" && B.offset === A.offset + A.text.length &&
|
|
54365
|
+
if (B.type === "insert_text" && A.type === "insert_text" && B.offset === A.offset + A.text.length && Path15.equals(B.path, A.path)) {
|
|
54327
54366
|
return {
|
|
54328
54367
|
...opB,
|
|
54329
54368
|
ops: [
|
|
@@ -54335,7 +54374,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
54335
54374
|
]
|
|
54336
54375
|
};
|
|
54337
54376
|
}
|
|
54338
|
-
if (B.type === "remove_text" && A.type === "remove_text" && B.offset + B.text.length === A.offset &&
|
|
54377
|
+
if (B.type === "remove_text" && A.type === "remove_text" && B.offset + B.text.length === A.offset && Path15.equals(B.path, A.path)) {
|
|
54339
54378
|
return {
|
|
54340
54379
|
...opB,
|
|
54341
54380
|
ops: [
|
|
@@ -54347,7 +54386,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
54347
54386
|
]
|
|
54348
54387
|
};
|
|
54349
54388
|
}
|
|
54350
|
-
if (B.type === "split_node" && A.type === "split_node" &&
|
|
54389
|
+
if (B.type === "split_node" && A.type === "split_node" && Path15.isChild(A.path, B.path)) {
|
|
54351
54390
|
return {
|
|
54352
54391
|
...opB,
|
|
54353
54392
|
ops: [...opA.ops, ...opB.ops]
|
|
@@ -54499,10 +54538,10 @@ function createSyncLog() {
|
|
|
54499
54538
|
}
|
|
54500
54539
|
|
|
54501
54540
|
// src/Events/Transform/removeText_removeText.ts
|
|
54502
|
-
import { Path as
|
|
54541
|
+
import { Path as Path16 } from "slate";
|
|
54503
54542
|
function removeText_removeText(confirmed, toTransform) {
|
|
54504
54543
|
const transformed = { ...toTransform };
|
|
54505
|
-
if (
|
|
54544
|
+
if (Path16.equals(confirmed.path, toTransform.path)) {
|
|
54506
54545
|
const confirmedStart = confirmed.offset;
|
|
54507
54546
|
const confirmedEnd = confirmed.offset + confirmed.text.length;
|
|
54508
54547
|
const toTransformStart = toTransform.offset;
|
|
@@ -54531,10 +54570,10 @@ function removeText_removeText(confirmed, toTransform) {
|
|
|
54531
54570
|
}
|
|
54532
54571
|
|
|
54533
54572
|
// src/Events/Transform/insertText_insertText.ts
|
|
54534
|
-
import { Path as
|
|
54573
|
+
import { Path as Path17 } from "slate";
|
|
54535
54574
|
function insertText_insertText(confirmed, toTransform) {
|
|
54536
54575
|
const transformed = { ...toTransform };
|
|
54537
|
-
if (
|
|
54576
|
+
if (Path17.equals(confirmed.path, toTransform.path)) {
|
|
54538
54577
|
if (confirmed.offset <= toTransform.offset) {
|
|
54539
54578
|
transformed.offset += confirmed.text.length;
|
|
54540
54579
|
}
|
|
@@ -54543,10 +54582,10 @@ function insertText_insertText(confirmed, toTransform) {
|
|
|
54543
54582
|
}
|
|
54544
54583
|
|
|
54545
54584
|
// src/Events/Transform/removeText_insertText.ts
|
|
54546
|
-
import { Path as
|
|
54585
|
+
import { Path as Path18 } from "slate";
|
|
54547
54586
|
function removeText_insertText(confirmed, toTransform) {
|
|
54548
54587
|
const transformed = { ...toTransform };
|
|
54549
|
-
if (
|
|
54588
|
+
if (Path18.equals(confirmed.path, toTransform.path)) {
|
|
54550
54589
|
if (confirmed.offset <= toTransform.offset) {
|
|
54551
54590
|
transformed.offset -= confirmed.text.length;
|
|
54552
54591
|
}
|
|
@@ -54555,17 +54594,17 @@ function removeText_insertText(confirmed, toTransform) {
|
|
|
54555
54594
|
}
|
|
54556
54595
|
|
|
54557
54596
|
// src/Events/Transform/splitNode_insertText.ts
|
|
54558
|
-
import { Path as
|
|
54597
|
+
import { Path as Path20 } from "slate";
|
|
54559
54598
|
|
|
54560
54599
|
// src/Events/Transform/transformPath.ts
|
|
54561
|
-
import { Path as
|
|
54600
|
+
import { Path as Path19 } from "slate";
|
|
54562
54601
|
function transformPath(confirmed, toTransform) {
|
|
54563
|
-
const newPath =
|
|
54602
|
+
const newPath = Path19.transform(toTransform.path, confirmed);
|
|
54564
54603
|
if (newPath) {
|
|
54565
54604
|
toTransform.path = newPath;
|
|
54566
54605
|
}
|
|
54567
54606
|
if ("newPath" in toTransform) {
|
|
54568
|
-
const newPathUpdated =
|
|
54607
|
+
const newPathUpdated = Path19.transform(toTransform.newPath, confirmed);
|
|
54569
54608
|
if (newPathUpdated) {
|
|
54570
54609
|
toTransform.newPath = newPathUpdated;
|
|
54571
54610
|
}
|
|
@@ -54577,7 +54616,7 @@ function splitNode_insertText(confirmed, toTransform) {
|
|
|
54577
54616
|
const transformed = { ...toTransform };
|
|
54578
54617
|
const confPath = confirmed.path;
|
|
54579
54618
|
const tPath = transformed.path;
|
|
54580
|
-
if (
|
|
54619
|
+
if (Path20.equals(confPath, tPath)) {
|
|
54581
54620
|
if (transformed.offset >= confirmed.position) {
|
|
54582
54621
|
transformed.offset -= confirmed.position;
|
|
54583
54622
|
transformed.path = [...confPath];
|
|
@@ -54604,10 +54643,10 @@ function insertNode_insertText(confirmed, toTransform) {
|
|
|
54604
54643
|
}
|
|
54605
54644
|
|
|
54606
54645
|
// src/Events/Transform/mergeNode_insertText.ts
|
|
54607
|
-
import { Path as
|
|
54646
|
+
import { Path as Path21 } from "slate";
|
|
54608
54647
|
function mergeNode_insertText(confirmed, toTransform) {
|
|
54609
54648
|
const transformed = { ...toTransform };
|
|
54610
|
-
if (
|
|
54649
|
+
if (Path21.equals(confirmed.path, transformed.path)) {
|
|
54611
54650
|
transformed.offset += confirmed.position;
|
|
54612
54651
|
return transformed;
|
|
54613
54652
|
}
|
|
@@ -54616,10 +54655,10 @@ function mergeNode_insertText(confirmed, toTransform) {
|
|
|
54616
54655
|
}
|
|
54617
54656
|
|
|
54618
54657
|
// src/Events/Transform/insertText_removeText.ts
|
|
54619
|
-
import { Path as
|
|
54658
|
+
import { Path as Path22 } from "slate";
|
|
54620
54659
|
function insertText_removeText(confirmed, toTransform) {
|
|
54621
54660
|
const transformed = { ...toTransform };
|
|
54622
|
-
if (
|
|
54661
|
+
if (Path22.equals(confirmed.path, toTransform.path)) {
|
|
54623
54662
|
if (confirmed.offset <= toTransform.offset) {
|
|
54624
54663
|
transformed.offset += confirmed.text.length;
|
|
54625
54664
|
}
|
|
@@ -54635,10 +54674,10 @@ function insertNode_removeText(confirmed, toTransform) {
|
|
|
54635
54674
|
}
|
|
54636
54675
|
|
|
54637
54676
|
// src/Events/Transform/splitNode_removeText.ts
|
|
54638
|
-
import { Path as
|
|
54677
|
+
import { Path as Path23 } from "slate";
|
|
54639
54678
|
function splitNode_removeText(confirmed, toTransform) {
|
|
54640
54679
|
const transformed = { ...toTransform };
|
|
54641
|
-
if (
|
|
54680
|
+
if (Path23.equals(confirmed.path, transformed.path)) {
|
|
54642
54681
|
if (confirmed.position <= transformed.offset) {
|
|
54643
54682
|
transformed.offset -= confirmed.position;
|
|
54644
54683
|
}
|
|
@@ -54657,10 +54696,10 @@ function splitNode_removeText(confirmed, toTransform) {
|
|
|
54657
54696
|
}
|
|
54658
54697
|
|
|
54659
54698
|
// src/Events/Transform/mergeNode_removeText.ts
|
|
54660
|
-
import { Path as
|
|
54699
|
+
import { Path as Path24 } from "slate";
|
|
54661
54700
|
function mergeNode_removeText(confirmed, toTransform) {
|
|
54662
54701
|
const transformed = { ...toTransform };
|
|
54663
|
-
if (
|
|
54702
|
+
if (Path24.equals(confirmed.path, toTransform.path)) {
|
|
54664
54703
|
transformed.offset += confirmed.position;
|
|
54665
54704
|
}
|
|
54666
54705
|
transformPath(confirmed, transformed);
|
|
@@ -54731,12 +54770,12 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
54731
54770
|
}
|
|
54732
54771
|
|
|
54733
54772
|
// src/Events/Transform/splitNode_insertNode.ts
|
|
54734
|
-
import { Path as
|
|
54773
|
+
import { Path as Path25 } from "slate";
|
|
54735
54774
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
54736
54775
|
const transformed = { ...toTransform };
|
|
54737
54776
|
const conf2 = confirmed.path;
|
|
54738
54777
|
const path2 = transformed.path;
|
|
54739
|
-
if (
|
|
54778
|
+
if (Path25.equals(conf2, path2)) {
|
|
54740
54779
|
return transformed;
|
|
54741
54780
|
}
|
|
54742
54781
|
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
@@ -54746,19 +54785,19 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
54746
54785
|
transformed.path = newPath;
|
|
54747
54786
|
return transformed;
|
|
54748
54787
|
}
|
|
54749
|
-
if (
|
|
54788
|
+
if (Path25.isBefore(conf2, path2)) {
|
|
54750
54789
|
transformPath(confirmed, transformed);
|
|
54751
54790
|
}
|
|
54752
54791
|
return transformed;
|
|
54753
54792
|
}
|
|
54754
54793
|
|
|
54755
54794
|
// src/Events/Transform/splitNode_removeNode.ts
|
|
54756
|
-
import { Path as
|
|
54795
|
+
import { Path as Path26 } from "slate";
|
|
54757
54796
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
54758
54797
|
const transformed = { ...toTransform };
|
|
54759
54798
|
const conf2 = confirmed.path;
|
|
54760
54799
|
const path2 = transformed.path;
|
|
54761
|
-
if (
|
|
54800
|
+
if (Path26.equals(conf2, path2)) {
|
|
54762
54801
|
return transformed;
|
|
54763
54802
|
}
|
|
54764
54803
|
if (path2.length === conf2.length + 1 && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i])) {
|
|
@@ -54772,18 +54811,18 @@ function splitNode_removeNode(confirmed, toTransform) {
|
|
|
54772
54811
|
return transformed;
|
|
54773
54812
|
}
|
|
54774
54813
|
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
54775
|
-
if (
|
|
54814
|
+
if (Path26.isBefore(conf2, path2) && !isDescendant) {
|
|
54776
54815
|
transformPath(confirmed, transformed);
|
|
54777
54816
|
}
|
|
54778
54817
|
return transformed;
|
|
54779
54818
|
}
|
|
54780
54819
|
|
|
54781
54820
|
// src/Events/Transform/mergeNode_insertNode.ts
|
|
54782
|
-
import { Path as
|
|
54821
|
+
import { Path as Path27 } from "slate";
|
|
54783
54822
|
function mergeNode_insertNode(confirmed, toTransform) {
|
|
54784
54823
|
const transformed = { ...toTransform };
|
|
54785
|
-
const isDescendant =
|
|
54786
|
-
const isAfter =
|
|
54824
|
+
const isDescendant = Path27.isAncestor(confirmed.path, transformed.path);
|
|
54825
|
+
const isAfter = Path27.isBefore(confirmed.path, transformed.path);
|
|
54787
54826
|
if (confirmed.path.length === 1 && isAfter && !isDescendant || confirmed.path.length > 1 && (isAfter || isDescendant)) {
|
|
54788
54827
|
transformPath(confirmed, transformed);
|
|
54789
54828
|
}
|
|
@@ -54791,40 +54830,40 @@ function mergeNode_insertNode(confirmed, toTransform) {
|
|
|
54791
54830
|
}
|
|
54792
54831
|
|
|
54793
54832
|
// src/Events/Transform/mergeNode_removeNode.ts
|
|
54794
|
-
import { Path as
|
|
54833
|
+
import { Path as Path28 } from "slate";
|
|
54795
54834
|
function mergeNode_removeNode(confirmed, toTransform) {
|
|
54796
54835
|
const transformed = { ...toTransform };
|
|
54797
|
-
if (
|
|
54836
|
+
if (Path28.isBefore(confirmed.path, transformed.path)) {
|
|
54798
54837
|
transformPath(confirmed, transformed);
|
|
54799
54838
|
}
|
|
54800
54839
|
return transformed;
|
|
54801
54840
|
}
|
|
54802
54841
|
|
|
54803
54842
|
// src/Events/Transform/setNode_insertNode.ts
|
|
54804
|
-
import { Path as
|
|
54843
|
+
import { Path as Path29 } from "slate";
|
|
54805
54844
|
function setNode_insertNode(confirmed, toTransform) {
|
|
54806
54845
|
const transformed = { ...toTransform };
|
|
54807
|
-
if (
|
|
54846
|
+
if (Path29.isBefore(confirmed.path, transformed.path)) {
|
|
54808
54847
|
transformPath(confirmed, transformed);
|
|
54809
54848
|
}
|
|
54810
54849
|
return transformed;
|
|
54811
54850
|
}
|
|
54812
54851
|
|
|
54813
54852
|
// src/Events/Transform/setNode_removeNode.ts
|
|
54814
|
-
import { Path as
|
|
54853
|
+
import { Path as Path30 } from "slate";
|
|
54815
54854
|
function setNode_removeNode(confirmed, toTransform) {
|
|
54816
54855
|
const transformed = { ...toTransform };
|
|
54817
|
-
if (
|
|
54856
|
+
if (Path30.isBefore(confirmed.path, transformed.path)) {
|
|
54818
54857
|
transformPath(confirmed, transformed);
|
|
54819
54858
|
}
|
|
54820
54859
|
return transformed;
|
|
54821
54860
|
}
|
|
54822
54861
|
|
|
54823
54862
|
// src/Events/Transform/insertText_mergeNode.ts
|
|
54824
|
-
import { Path as
|
|
54863
|
+
import { Path as Path31 } from "slate";
|
|
54825
54864
|
function insertText_mergeNode(confirmed, toTransform) {
|
|
54826
54865
|
const transformed = { ...toTransform };
|
|
54827
|
-
if (
|
|
54866
|
+
if (Path31.isBefore(confirmed.path, toTransform.path) && Path31.isSibling(confirmed.path, toTransform.path)) {
|
|
54828
54867
|
if (confirmed.offset <= toTransform.position) {
|
|
54829
54868
|
transformed.position += confirmed.text.length;
|
|
54830
54869
|
}
|
|
@@ -54865,12 +54904,12 @@ function removeNode_mergeNode(confirmed, toTransform) {
|
|
|
54865
54904
|
}
|
|
54866
54905
|
|
|
54867
54906
|
// src/Events/Transform/splitNode_mergeNode.ts
|
|
54868
|
-
import { Path as
|
|
54907
|
+
import { Path as Path32 } from "slate";
|
|
54869
54908
|
function splitNode_mergeNode(confirmed, toTransform) {
|
|
54870
54909
|
const transformed = { ...toTransform };
|
|
54871
54910
|
const confPath = confirmed.path;
|
|
54872
54911
|
const tPath = transformed.path;
|
|
54873
|
-
if (
|
|
54912
|
+
if (Path32.equals(confPath, tPath)) {
|
|
54874
54913
|
if (confirmed.position <= transformed.position) {
|
|
54875
54914
|
transformed.position -= confirmed.position;
|
|
54876
54915
|
}
|
|
@@ -54881,10 +54920,10 @@ function splitNode_mergeNode(confirmed, toTransform) {
|
|
|
54881
54920
|
}
|
|
54882
54921
|
|
|
54883
54922
|
// src/Events/Transform/mergeNode_mergeNode.ts
|
|
54884
|
-
import { Path as
|
|
54923
|
+
import { Path as Path33 } from "slate";
|
|
54885
54924
|
function mergeNode_mergeNode(confirmed, toTransform) {
|
|
54886
54925
|
const transformed = { ...toTransform };
|
|
54887
|
-
if (
|
|
54926
|
+
if (Path33.equals(confirmed.path, transformed.path)) {
|
|
54888
54927
|
transformed.position += confirmed.position;
|
|
54889
54928
|
return transformed;
|
|
54890
54929
|
}
|
|
@@ -54899,10 +54938,10 @@ function mergeNode_mergeNode(confirmed, toTransform) {
|
|
|
54899
54938
|
}
|
|
54900
54939
|
|
|
54901
54940
|
// src/Events/Transform/insertText_splitNode.ts
|
|
54902
|
-
import { Path as
|
|
54941
|
+
import { Path as Path34 } from "slate";
|
|
54903
54942
|
function insertText_splitNode(confirmed, toTransform) {
|
|
54904
54943
|
const transformed = { ...toTransform };
|
|
54905
|
-
const newPath =
|
|
54944
|
+
const newPath = Path34.transform(transformed.path, confirmed);
|
|
54906
54945
|
if (newPath) {
|
|
54907
54946
|
transformed.path = newPath;
|
|
54908
54947
|
}
|
|
@@ -54945,12 +54984,12 @@ function removeNode_splitNode(confirmed, toTransform) {
|
|
|
54945
54984
|
}
|
|
54946
54985
|
|
|
54947
54986
|
// src/Events/Transform/mergeNode_splitNode.ts
|
|
54948
|
-
import { Path as
|
|
54987
|
+
import { Path as Path35 } from "slate";
|
|
54949
54988
|
function mergeNode_splitNode(confirmed, toTransform) {
|
|
54950
54989
|
const transformed = { ...toTransform };
|
|
54951
54990
|
const rem = confirmed.path;
|
|
54952
54991
|
const orig = transformed.path;
|
|
54953
|
-
if (
|
|
54992
|
+
if (Path35.equals(rem, orig)) {
|
|
54954
54993
|
transformed.position += confirmed.position;
|
|
54955
54994
|
return transformed;
|
|
54956
54995
|
}
|
|
@@ -54961,7 +55000,7 @@ function mergeNode_splitNode(confirmed, toTransform) {
|
|
|
54961
55000
|
if (rem.length > 1) {
|
|
54962
55001
|
const depth = rem.length - 1;
|
|
54963
55002
|
const prefix2 = rem.slice(0, depth);
|
|
54964
|
-
if (newPath.length > depth &&
|
|
55003
|
+
if (newPath.length > depth && Path35.equals(prefix2, newPath.slice(0, depth)) && newPath[depth] > rem[depth]) {
|
|
54965
55004
|
newPath[depth] = newPath[depth] - 1;
|
|
54966
55005
|
}
|
|
54967
55006
|
}
|
|
@@ -54970,10 +55009,10 @@ function mergeNode_splitNode(confirmed, toTransform) {
|
|
|
54970
55009
|
}
|
|
54971
55010
|
|
|
54972
55011
|
// src/Events/Transform/splitNode_splitNode.ts
|
|
54973
|
-
import { Path as
|
|
55012
|
+
import { Path as Path36 } from "slate";
|
|
54974
55013
|
function splitNode_splitNode(confirmed, toTransform) {
|
|
54975
55014
|
const transformed = { ...toTransform };
|
|
54976
|
-
const samePath =
|
|
55015
|
+
const samePath = Path36.equals(confirmed.path, transformed.path);
|
|
54977
55016
|
if (samePath && confirmed.position <= transformed.position) {
|
|
54978
55017
|
transformed.position -= confirmed.position;
|
|
54979
55018
|
}
|
|
@@ -54997,12 +55036,12 @@ function setNode_splitNode(confirmed, toTransform) {
|
|
|
54997
55036
|
}
|
|
54998
55037
|
|
|
54999
55038
|
// src/Events/Transform/splitNode_setNode.ts
|
|
55000
|
-
import { Path as
|
|
55039
|
+
import { Path as Path37 } from "slate";
|
|
55001
55040
|
function splitNode_setNode(confirmed, toTransform) {
|
|
55002
55041
|
const transformed = { ...toTransform };
|
|
55003
55042
|
const confirmedPath = confirmed.path;
|
|
55004
55043
|
const currentPath = transformed.path;
|
|
55005
|
-
const isSame =
|
|
55044
|
+
const isSame = Path37.equals(currentPath, confirmedPath);
|
|
55006
55045
|
const isDeepNestedDescendant = confirmedPath.length > 1 && currentPath.length > confirmedPath.length && currentPath.slice(0, confirmedPath.length).every((seg, i) => seg === confirmedPath[i]);
|
|
55007
55046
|
if (!isSame && !isDeepNestedDescendant) {
|
|
55008
55047
|
transformPath(confirmed, transformed);
|
|
@@ -55025,11 +55064,11 @@ function insertNode_setNode(confirmed, toTransform) {
|
|
|
55025
55064
|
}
|
|
55026
55065
|
|
|
55027
55066
|
// src/Events/Transform/removeNode_setNode.ts
|
|
55028
|
-
import { Path as
|
|
55067
|
+
import { Path as Path38 } from "slate";
|
|
55029
55068
|
function removeNode_setNode(confirmed, toTransform) {
|
|
55030
55069
|
const removalPath = confirmed.path;
|
|
55031
55070
|
const originalPath = toTransform.path;
|
|
55032
|
-
if (
|
|
55071
|
+
if (Path38.equals(removalPath, originalPath)) {
|
|
55033
55072
|
return;
|
|
55034
55073
|
}
|
|
55035
55074
|
const transformedOp = { ...toTransform };
|
|
@@ -55040,7 +55079,7 @@ function removeNode_setNode(confirmed, toTransform) {
|
|
|
55040
55079
|
if (removalPath.length > 1) {
|
|
55041
55080
|
const depthIndex = removalPath.length - 1;
|
|
55042
55081
|
const parentPrefix = removalPath.slice(0, depthIndex);
|
|
55043
|
-
if (newPath.length > depthIndex &&
|
|
55082
|
+
if (newPath.length > depthIndex && Path38.equals(parentPrefix, newPath.slice(0, depthIndex)) && newPath[depthIndex] > removalPath[depthIndex]) {
|
|
55044
55083
|
newPath[depthIndex] = newPath[depthIndex] - 1;
|
|
55045
55084
|
}
|
|
55046
55085
|
}
|
|
@@ -55049,10 +55088,10 @@ function removeNode_setNode(confirmed, toTransform) {
|
|
|
55049
55088
|
}
|
|
55050
55089
|
|
|
55051
55090
|
// src/Events/Transform/setNode_setNode.ts
|
|
55052
|
-
import { Path as
|
|
55091
|
+
import { Path as Path39 } from "slate";
|
|
55053
55092
|
function setNode_setNode(confirmed, toTransform) {
|
|
55054
55093
|
const transformed = { ...toTransform };
|
|
55055
|
-
if (
|
|
55094
|
+
if (Path39.equals(confirmed.path, toTransform.path)) {
|
|
55056
55095
|
transformed.newProperties = {
|
|
55057
55096
|
...toTransform.newProperties,
|
|
55058
55097
|
...confirmed.newProperties
|