microboard-temp 0.5.18 → 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 +35 -0
- package/dist/cjs/index.js +35 -0
- package/dist/cjs/node.js +35 -0
- package/dist/esm/browser.js +93 -58
- package/dist/esm/index.js +93 -58
- package/dist/esm/node.js +93 -58
- package/dist/types/Items/Examples/CardGame/Dice/Dice.d.ts +4 -2
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -48606,6 +48606,41 @@ class Dice extends BaseItem {
|
|
|
48606
48606
|
this.drawingContext = null;
|
|
48607
48607
|
}
|
|
48608
48608
|
}
|
|
48609
|
+
renderHTML(documentFactory) {
|
|
48610
|
+
const div = super.renderHTML(documentFactory);
|
|
48611
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
48612
|
+
const mbr = this.getMbr();
|
|
48613
|
+
const width2 = mbr.getWidth();
|
|
48614
|
+
const height3 = mbr.getHeight();
|
|
48615
|
+
const unscaledWidth = width2 / scaleX;
|
|
48616
|
+
const unscaledHeight = height3 / scaleY;
|
|
48617
|
+
const svg3 = documentFactory.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
48618
|
+
svg3.setAttribute("width", `${unscaledWidth}px`);
|
|
48619
|
+
svg3.setAttribute("height", `${unscaledHeight}px`);
|
|
48620
|
+
svg3.setAttribute("viewBox", `0 0 ${unscaledWidth} ${unscaledHeight}`);
|
|
48621
|
+
svg3.setAttribute("transform-origin", "0 0");
|
|
48622
|
+
svg3.setAttribute("transform", `scale(${1 / scaleX}, ${1 / scaleY})`);
|
|
48623
|
+
svg3.setAttribute("style", "position: absolute; overflow: visible;");
|
|
48624
|
+
const pathElement = Shapes["RoundedRectangle"].path.copy().renderHTML(documentFactory);
|
|
48625
|
+
const paths = Array.isArray(pathElement) ? pathElement : [pathElement];
|
|
48626
|
+
paths.forEach((element4) => {
|
|
48627
|
+
element4.setAttribute("fill", this.backgroundColor);
|
|
48628
|
+
element4.setAttribute("stroke", this.borderColor);
|
|
48629
|
+
element4.setAttribute("stroke-dasharray", LinePatterns[this.borderStyle].join(", "));
|
|
48630
|
+
element4.setAttribute("stroke-width", this.borderWidth.toString());
|
|
48631
|
+
element4.setAttribute("transform-origin", "0 0");
|
|
48632
|
+
element4.setAttribute("transform", `scale(${scaleX}, ${scaleY})`);
|
|
48633
|
+
});
|
|
48634
|
+
svg3.append(...paths);
|
|
48635
|
+
div.appendChild(svg3);
|
|
48636
|
+
div.id = this.getId();
|
|
48637
|
+
div.style.width = unscaledWidth + "px";
|
|
48638
|
+
div.style.height = unscaledHeight + "px";
|
|
48639
|
+
div.style.transformOrigin = "left top";
|
|
48640
|
+
div.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
48641
|
+
div.style.position = "absolute";
|
|
48642
|
+
return div;
|
|
48643
|
+
}
|
|
48609
48644
|
}
|
|
48610
48645
|
registerItem({
|
|
48611
48646
|
item: Dice,
|
package/dist/cjs/index.js
CHANGED
|
@@ -48606,6 +48606,41 @@ class Dice extends BaseItem {
|
|
|
48606
48606
|
this.drawingContext = null;
|
|
48607
48607
|
}
|
|
48608
48608
|
}
|
|
48609
|
+
renderHTML(documentFactory) {
|
|
48610
|
+
const div = super.renderHTML(documentFactory);
|
|
48611
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
48612
|
+
const mbr = this.getMbr();
|
|
48613
|
+
const width2 = mbr.getWidth();
|
|
48614
|
+
const height3 = mbr.getHeight();
|
|
48615
|
+
const unscaledWidth = width2 / scaleX;
|
|
48616
|
+
const unscaledHeight = height3 / scaleY;
|
|
48617
|
+
const svg3 = documentFactory.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
48618
|
+
svg3.setAttribute("width", `${unscaledWidth}px`);
|
|
48619
|
+
svg3.setAttribute("height", `${unscaledHeight}px`);
|
|
48620
|
+
svg3.setAttribute("viewBox", `0 0 ${unscaledWidth} ${unscaledHeight}`);
|
|
48621
|
+
svg3.setAttribute("transform-origin", "0 0");
|
|
48622
|
+
svg3.setAttribute("transform", `scale(${1 / scaleX}, ${1 / scaleY})`);
|
|
48623
|
+
svg3.setAttribute("style", "position: absolute; overflow: visible;");
|
|
48624
|
+
const pathElement = Shapes["RoundedRectangle"].path.copy().renderHTML(documentFactory);
|
|
48625
|
+
const paths = Array.isArray(pathElement) ? pathElement : [pathElement];
|
|
48626
|
+
paths.forEach((element4) => {
|
|
48627
|
+
element4.setAttribute("fill", this.backgroundColor);
|
|
48628
|
+
element4.setAttribute("stroke", this.borderColor);
|
|
48629
|
+
element4.setAttribute("stroke-dasharray", LinePatterns[this.borderStyle].join(", "));
|
|
48630
|
+
element4.setAttribute("stroke-width", this.borderWidth.toString());
|
|
48631
|
+
element4.setAttribute("transform-origin", "0 0");
|
|
48632
|
+
element4.setAttribute("transform", `scale(${scaleX}, ${scaleY})`);
|
|
48633
|
+
});
|
|
48634
|
+
svg3.append(...paths);
|
|
48635
|
+
div.appendChild(svg3);
|
|
48636
|
+
div.id = this.getId();
|
|
48637
|
+
div.style.width = unscaledWidth + "px";
|
|
48638
|
+
div.style.height = unscaledHeight + "px";
|
|
48639
|
+
div.style.transformOrigin = "left top";
|
|
48640
|
+
div.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
48641
|
+
div.style.position = "absolute";
|
|
48642
|
+
return div;
|
|
48643
|
+
}
|
|
48609
48644
|
}
|
|
48610
48645
|
registerItem({
|
|
48611
48646
|
item: Dice,
|
package/dist/cjs/node.js
CHANGED
|
@@ -51079,6 +51079,41 @@ class Dice extends BaseItem {
|
|
|
51079
51079
|
this.drawingContext = null;
|
|
51080
51080
|
}
|
|
51081
51081
|
}
|
|
51082
|
+
renderHTML(documentFactory) {
|
|
51083
|
+
const div = super.renderHTML(documentFactory);
|
|
51084
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
51085
|
+
const mbr = this.getMbr();
|
|
51086
|
+
const width2 = mbr.getWidth();
|
|
51087
|
+
const height3 = mbr.getHeight();
|
|
51088
|
+
const unscaledWidth = width2 / scaleX;
|
|
51089
|
+
const unscaledHeight = height3 / scaleY;
|
|
51090
|
+
const svg3 = documentFactory.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
51091
|
+
svg3.setAttribute("width", `${unscaledWidth}px`);
|
|
51092
|
+
svg3.setAttribute("height", `${unscaledHeight}px`);
|
|
51093
|
+
svg3.setAttribute("viewBox", `0 0 ${unscaledWidth} ${unscaledHeight}`);
|
|
51094
|
+
svg3.setAttribute("transform-origin", "0 0");
|
|
51095
|
+
svg3.setAttribute("transform", `scale(${1 / scaleX}, ${1 / scaleY})`);
|
|
51096
|
+
svg3.setAttribute("style", "position: absolute; overflow: visible;");
|
|
51097
|
+
const pathElement = Shapes["RoundedRectangle"].path.copy().renderHTML(documentFactory);
|
|
51098
|
+
const paths = Array.isArray(pathElement) ? pathElement : [pathElement];
|
|
51099
|
+
paths.forEach((element3) => {
|
|
51100
|
+
element3.setAttribute("fill", this.backgroundColor);
|
|
51101
|
+
element3.setAttribute("stroke", this.borderColor);
|
|
51102
|
+
element3.setAttribute("stroke-dasharray", LinePatterns[this.borderStyle].join(", "));
|
|
51103
|
+
element3.setAttribute("stroke-width", this.borderWidth.toString());
|
|
51104
|
+
element3.setAttribute("transform-origin", "0 0");
|
|
51105
|
+
element3.setAttribute("transform", `scale(${scaleX}, ${scaleY})`);
|
|
51106
|
+
});
|
|
51107
|
+
svg3.append(...paths);
|
|
51108
|
+
div.appendChild(svg3);
|
|
51109
|
+
div.id = this.getId();
|
|
51110
|
+
div.style.width = unscaledWidth + "px";
|
|
51111
|
+
div.style.height = unscaledHeight + "px";
|
|
51112
|
+
div.style.transformOrigin = "left top";
|
|
51113
|
+
div.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
51114
|
+
div.style.position = "absolute";
|
|
51115
|
+
return div;
|
|
51116
|
+
}
|
|
51082
51117
|
}
|
|
51083
51118
|
registerItem({
|
|
51084
51119
|
item: Dice,
|
package/dist/esm/browser.js
CHANGED
|
@@ -48452,6 +48452,41 @@ class Dice extends BaseItem {
|
|
|
48452
48452
|
this.drawingContext = null;
|
|
48453
48453
|
}
|
|
48454
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
|
+
}
|
|
48455
48490
|
}
|
|
48456
48491
|
registerItem({
|
|
48457
48492
|
item: Dice,
|
|
@@ -54094,7 +54129,7 @@ class Board {
|
|
|
54094
54129
|
}
|
|
54095
54130
|
}
|
|
54096
54131
|
// src/Events/Merge.ts
|
|
54097
|
-
import { Path as
|
|
54132
|
+
import { Path as Path15 } from "slate";
|
|
54098
54133
|
function areItemsTheSame(opA, opB) {
|
|
54099
54134
|
if (opA.method === "transformMany" && opB.method === "transformMany") {
|
|
54100
54135
|
const itemsA = Object.keys(opA.items);
|
|
@@ -54327,7 +54362,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
54327
54362
|
ops: [...opA.ops, ...opB.ops]
|
|
54328
54363
|
};
|
|
54329
54364
|
}
|
|
54330
|
-
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)) {
|
|
54331
54366
|
return {
|
|
54332
54367
|
...opB,
|
|
54333
54368
|
ops: [
|
|
@@ -54339,7 +54374,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
54339
54374
|
]
|
|
54340
54375
|
};
|
|
54341
54376
|
}
|
|
54342
|
-
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)) {
|
|
54343
54378
|
return {
|
|
54344
54379
|
...opB,
|
|
54345
54380
|
ops: [
|
|
@@ -54351,7 +54386,7 @@ function mergeRichTextOperations(opA, opB) {
|
|
|
54351
54386
|
]
|
|
54352
54387
|
};
|
|
54353
54388
|
}
|
|
54354
|
-
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)) {
|
|
54355
54390
|
return {
|
|
54356
54391
|
...opB,
|
|
54357
54392
|
ops: [...opA.ops, ...opB.ops]
|
|
@@ -54503,10 +54538,10 @@ function createSyncLog() {
|
|
|
54503
54538
|
}
|
|
54504
54539
|
|
|
54505
54540
|
// src/Events/Transform/removeText_removeText.ts
|
|
54506
|
-
import { Path as
|
|
54541
|
+
import { Path as Path16 } from "slate";
|
|
54507
54542
|
function removeText_removeText(confirmed, toTransform) {
|
|
54508
54543
|
const transformed = { ...toTransform };
|
|
54509
|
-
if (
|
|
54544
|
+
if (Path16.equals(confirmed.path, toTransform.path)) {
|
|
54510
54545
|
const confirmedStart = confirmed.offset;
|
|
54511
54546
|
const confirmedEnd = confirmed.offset + confirmed.text.length;
|
|
54512
54547
|
const toTransformStart = toTransform.offset;
|
|
@@ -54535,10 +54570,10 @@ function removeText_removeText(confirmed, toTransform) {
|
|
|
54535
54570
|
}
|
|
54536
54571
|
|
|
54537
54572
|
// src/Events/Transform/insertText_insertText.ts
|
|
54538
|
-
import { Path as
|
|
54573
|
+
import { Path as Path17 } from "slate";
|
|
54539
54574
|
function insertText_insertText(confirmed, toTransform) {
|
|
54540
54575
|
const transformed = { ...toTransform };
|
|
54541
|
-
if (
|
|
54576
|
+
if (Path17.equals(confirmed.path, toTransform.path)) {
|
|
54542
54577
|
if (confirmed.offset <= toTransform.offset) {
|
|
54543
54578
|
transformed.offset += confirmed.text.length;
|
|
54544
54579
|
}
|
|
@@ -54547,10 +54582,10 @@ function insertText_insertText(confirmed, toTransform) {
|
|
|
54547
54582
|
}
|
|
54548
54583
|
|
|
54549
54584
|
// src/Events/Transform/removeText_insertText.ts
|
|
54550
|
-
import { Path as
|
|
54585
|
+
import { Path as Path18 } from "slate";
|
|
54551
54586
|
function removeText_insertText(confirmed, toTransform) {
|
|
54552
54587
|
const transformed = { ...toTransform };
|
|
54553
|
-
if (
|
|
54588
|
+
if (Path18.equals(confirmed.path, toTransform.path)) {
|
|
54554
54589
|
if (confirmed.offset <= toTransform.offset) {
|
|
54555
54590
|
transformed.offset -= confirmed.text.length;
|
|
54556
54591
|
}
|
|
@@ -54559,17 +54594,17 @@ function removeText_insertText(confirmed, toTransform) {
|
|
|
54559
54594
|
}
|
|
54560
54595
|
|
|
54561
54596
|
// src/Events/Transform/splitNode_insertText.ts
|
|
54562
|
-
import { Path as
|
|
54597
|
+
import { Path as Path20 } from "slate";
|
|
54563
54598
|
|
|
54564
54599
|
// src/Events/Transform/transformPath.ts
|
|
54565
|
-
import { Path as
|
|
54600
|
+
import { Path as Path19 } from "slate";
|
|
54566
54601
|
function transformPath(confirmed, toTransform) {
|
|
54567
|
-
const newPath =
|
|
54602
|
+
const newPath = Path19.transform(toTransform.path, confirmed);
|
|
54568
54603
|
if (newPath) {
|
|
54569
54604
|
toTransform.path = newPath;
|
|
54570
54605
|
}
|
|
54571
54606
|
if ("newPath" in toTransform) {
|
|
54572
|
-
const newPathUpdated =
|
|
54607
|
+
const newPathUpdated = Path19.transform(toTransform.newPath, confirmed);
|
|
54573
54608
|
if (newPathUpdated) {
|
|
54574
54609
|
toTransform.newPath = newPathUpdated;
|
|
54575
54610
|
}
|
|
@@ -54581,7 +54616,7 @@ function splitNode_insertText(confirmed, toTransform) {
|
|
|
54581
54616
|
const transformed = { ...toTransform };
|
|
54582
54617
|
const confPath = confirmed.path;
|
|
54583
54618
|
const tPath = transformed.path;
|
|
54584
|
-
if (
|
|
54619
|
+
if (Path20.equals(confPath, tPath)) {
|
|
54585
54620
|
if (transformed.offset >= confirmed.position) {
|
|
54586
54621
|
transformed.offset -= confirmed.position;
|
|
54587
54622
|
transformed.path = [...confPath];
|
|
@@ -54608,10 +54643,10 @@ function insertNode_insertText(confirmed, toTransform) {
|
|
|
54608
54643
|
}
|
|
54609
54644
|
|
|
54610
54645
|
// src/Events/Transform/mergeNode_insertText.ts
|
|
54611
|
-
import { Path as
|
|
54646
|
+
import { Path as Path21 } from "slate";
|
|
54612
54647
|
function mergeNode_insertText(confirmed, toTransform) {
|
|
54613
54648
|
const transformed = { ...toTransform };
|
|
54614
|
-
if (
|
|
54649
|
+
if (Path21.equals(confirmed.path, transformed.path)) {
|
|
54615
54650
|
transformed.offset += confirmed.position;
|
|
54616
54651
|
return transformed;
|
|
54617
54652
|
}
|
|
@@ -54620,10 +54655,10 @@ function mergeNode_insertText(confirmed, toTransform) {
|
|
|
54620
54655
|
}
|
|
54621
54656
|
|
|
54622
54657
|
// src/Events/Transform/insertText_removeText.ts
|
|
54623
|
-
import { Path as
|
|
54658
|
+
import { Path as Path22 } from "slate";
|
|
54624
54659
|
function insertText_removeText(confirmed, toTransform) {
|
|
54625
54660
|
const transformed = { ...toTransform };
|
|
54626
|
-
if (
|
|
54661
|
+
if (Path22.equals(confirmed.path, toTransform.path)) {
|
|
54627
54662
|
if (confirmed.offset <= toTransform.offset) {
|
|
54628
54663
|
transformed.offset += confirmed.text.length;
|
|
54629
54664
|
}
|
|
@@ -54639,10 +54674,10 @@ function insertNode_removeText(confirmed, toTransform) {
|
|
|
54639
54674
|
}
|
|
54640
54675
|
|
|
54641
54676
|
// src/Events/Transform/splitNode_removeText.ts
|
|
54642
|
-
import { Path as
|
|
54677
|
+
import { Path as Path23 } from "slate";
|
|
54643
54678
|
function splitNode_removeText(confirmed, toTransform) {
|
|
54644
54679
|
const transformed = { ...toTransform };
|
|
54645
|
-
if (
|
|
54680
|
+
if (Path23.equals(confirmed.path, transformed.path)) {
|
|
54646
54681
|
if (confirmed.position <= transformed.offset) {
|
|
54647
54682
|
transformed.offset -= confirmed.position;
|
|
54648
54683
|
}
|
|
@@ -54661,10 +54696,10 @@ function splitNode_removeText(confirmed, toTransform) {
|
|
|
54661
54696
|
}
|
|
54662
54697
|
|
|
54663
54698
|
// src/Events/Transform/mergeNode_removeText.ts
|
|
54664
|
-
import { Path as
|
|
54699
|
+
import { Path as Path24 } from "slate";
|
|
54665
54700
|
function mergeNode_removeText(confirmed, toTransform) {
|
|
54666
54701
|
const transformed = { ...toTransform };
|
|
54667
|
-
if (
|
|
54702
|
+
if (Path24.equals(confirmed.path, toTransform.path)) {
|
|
54668
54703
|
transformed.offset += confirmed.position;
|
|
54669
54704
|
}
|
|
54670
54705
|
transformPath(confirmed, transformed);
|
|
@@ -54735,12 +54770,12 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
54735
54770
|
}
|
|
54736
54771
|
|
|
54737
54772
|
// src/Events/Transform/splitNode_insertNode.ts
|
|
54738
|
-
import { Path as
|
|
54773
|
+
import { Path as Path25 } from "slate";
|
|
54739
54774
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
54740
54775
|
const transformed = { ...toTransform };
|
|
54741
54776
|
const conf2 = confirmed.path;
|
|
54742
54777
|
const path2 = transformed.path;
|
|
54743
|
-
if (
|
|
54778
|
+
if (Path25.equals(conf2, path2)) {
|
|
54744
54779
|
return transformed;
|
|
54745
54780
|
}
|
|
54746
54781
|
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
@@ -54750,19 +54785,19 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
54750
54785
|
transformed.path = newPath;
|
|
54751
54786
|
return transformed;
|
|
54752
54787
|
}
|
|
54753
|
-
if (
|
|
54788
|
+
if (Path25.isBefore(conf2, path2)) {
|
|
54754
54789
|
transformPath(confirmed, transformed);
|
|
54755
54790
|
}
|
|
54756
54791
|
return transformed;
|
|
54757
54792
|
}
|
|
54758
54793
|
|
|
54759
54794
|
// src/Events/Transform/splitNode_removeNode.ts
|
|
54760
|
-
import { Path as
|
|
54795
|
+
import { Path as Path26 } from "slate";
|
|
54761
54796
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
54762
54797
|
const transformed = { ...toTransform };
|
|
54763
54798
|
const conf2 = confirmed.path;
|
|
54764
54799
|
const path2 = transformed.path;
|
|
54765
|
-
if (
|
|
54800
|
+
if (Path26.equals(conf2, path2)) {
|
|
54766
54801
|
return transformed;
|
|
54767
54802
|
}
|
|
54768
54803
|
if (path2.length === conf2.length + 1 && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i])) {
|
|
@@ -54776,18 +54811,18 @@ function splitNode_removeNode(confirmed, toTransform) {
|
|
|
54776
54811
|
return transformed;
|
|
54777
54812
|
}
|
|
54778
54813
|
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
54779
|
-
if (
|
|
54814
|
+
if (Path26.isBefore(conf2, path2) && !isDescendant) {
|
|
54780
54815
|
transformPath(confirmed, transformed);
|
|
54781
54816
|
}
|
|
54782
54817
|
return transformed;
|
|
54783
54818
|
}
|
|
54784
54819
|
|
|
54785
54820
|
// src/Events/Transform/mergeNode_insertNode.ts
|
|
54786
|
-
import { Path as
|
|
54821
|
+
import { Path as Path27 } from "slate";
|
|
54787
54822
|
function mergeNode_insertNode(confirmed, toTransform) {
|
|
54788
54823
|
const transformed = { ...toTransform };
|
|
54789
|
-
const isDescendant =
|
|
54790
|
-
const isAfter =
|
|
54824
|
+
const isDescendant = Path27.isAncestor(confirmed.path, transformed.path);
|
|
54825
|
+
const isAfter = Path27.isBefore(confirmed.path, transformed.path);
|
|
54791
54826
|
if (confirmed.path.length === 1 && isAfter && !isDescendant || confirmed.path.length > 1 && (isAfter || isDescendant)) {
|
|
54792
54827
|
transformPath(confirmed, transformed);
|
|
54793
54828
|
}
|
|
@@ -54795,40 +54830,40 @@ function mergeNode_insertNode(confirmed, toTransform) {
|
|
|
54795
54830
|
}
|
|
54796
54831
|
|
|
54797
54832
|
// src/Events/Transform/mergeNode_removeNode.ts
|
|
54798
|
-
import { Path as
|
|
54833
|
+
import { Path as Path28 } from "slate";
|
|
54799
54834
|
function mergeNode_removeNode(confirmed, toTransform) {
|
|
54800
54835
|
const transformed = { ...toTransform };
|
|
54801
|
-
if (
|
|
54836
|
+
if (Path28.isBefore(confirmed.path, transformed.path)) {
|
|
54802
54837
|
transformPath(confirmed, transformed);
|
|
54803
54838
|
}
|
|
54804
54839
|
return transformed;
|
|
54805
54840
|
}
|
|
54806
54841
|
|
|
54807
54842
|
// src/Events/Transform/setNode_insertNode.ts
|
|
54808
|
-
import { Path as
|
|
54843
|
+
import { Path as Path29 } from "slate";
|
|
54809
54844
|
function setNode_insertNode(confirmed, toTransform) {
|
|
54810
54845
|
const transformed = { ...toTransform };
|
|
54811
|
-
if (
|
|
54846
|
+
if (Path29.isBefore(confirmed.path, transformed.path)) {
|
|
54812
54847
|
transformPath(confirmed, transformed);
|
|
54813
54848
|
}
|
|
54814
54849
|
return transformed;
|
|
54815
54850
|
}
|
|
54816
54851
|
|
|
54817
54852
|
// src/Events/Transform/setNode_removeNode.ts
|
|
54818
|
-
import { Path as
|
|
54853
|
+
import { Path as Path30 } from "slate";
|
|
54819
54854
|
function setNode_removeNode(confirmed, toTransform) {
|
|
54820
54855
|
const transformed = { ...toTransform };
|
|
54821
|
-
if (
|
|
54856
|
+
if (Path30.isBefore(confirmed.path, transformed.path)) {
|
|
54822
54857
|
transformPath(confirmed, transformed);
|
|
54823
54858
|
}
|
|
54824
54859
|
return transformed;
|
|
54825
54860
|
}
|
|
54826
54861
|
|
|
54827
54862
|
// src/Events/Transform/insertText_mergeNode.ts
|
|
54828
|
-
import { Path as
|
|
54863
|
+
import { Path as Path31 } from "slate";
|
|
54829
54864
|
function insertText_mergeNode(confirmed, toTransform) {
|
|
54830
54865
|
const transformed = { ...toTransform };
|
|
54831
|
-
if (
|
|
54866
|
+
if (Path31.isBefore(confirmed.path, toTransform.path) && Path31.isSibling(confirmed.path, toTransform.path)) {
|
|
54832
54867
|
if (confirmed.offset <= toTransform.position) {
|
|
54833
54868
|
transformed.position += confirmed.text.length;
|
|
54834
54869
|
}
|
|
@@ -54869,12 +54904,12 @@ function removeNode_mergeNode(confirmed, toTransform) {
|
|
|
54869
54904
|
}
|
|
54870
54905
|
|
|
54871
54906
|
// src/Events/Transform/splitNode_mergeNode.ts
|
|
54872
|
-
import { Path as
|
|
54907
|
+
import { Path as Path32 } from "slate";
|
|
54873
54908
|
function splitNode_mergeNode(confirmed, toTransform) {
|
|
54874
54909
|
const transformed = { ...toTransform };
|
|
54875
54910
|
const confPath = confirmed.path;
|
|
54876
54911
|
const tPath = transformed.path;
|
|
54877
|
-
if (
|
|
54912
|
+
if (Path32.equals(confPath, tPath)) {
|
|
54878
54913
|
if (confirmed.position <= transformed.position) {
|
|
54879
54914
|
transformed.position -= confirmed.position;
|
|
54880
54915
|
}
|
|
@@ -54885,10 +54920,10 @@ function splitNode_mergeNode(confirmed, toTransform) {
|
|
|
54885
54920
|
}
|
|
54886
54921
|
|
|
54887
54922
|
// src/Events/Transform/mergeNode_mergeNode.ts
|
|
54888
|
-
import { Path as
|
|
54923
|
+
import { Path as Path33 } from "slate";
|
|
54889
54924
|
function mergeNode_mergeNode(confirmed, toTransform) {
|
|
54890
54925
|
const transformed = { ...toTransform };
|
|
54891
|
-
if (
|
|
54926
|
+
if (Path33.equals(confirmed.path, transformed.path)) {
|
|
54892
54927
|
transformed.position += confirmed.position;
|
|
54893
54928
|
return transformed;
|
|
54894
54929
|
}
|
|
@@ -54903,10 +54938,10 @@ function mergeNode_mergeNode(confirmed, toTransform) {
|
|
|
54903
54938
|
}
|
|
54904
54939
|
|
|
54905
54940
|
// src/Events/Transform/insertText_splitNode.ts
|
|
54906
|
-
import { Path as
|
|
54941
|
+
import { Path as Path34 } from "slate";
|
|
54907
54942
|
function insertText_splitNode(confirmed, toTransform) {
|
|
54908
54943
|
const transformed = { ...toTransform };
|
|
54909
|
-
const newPath =
|
|
54944
|
+
const newPath = Path34.transform(transformed.path, confirmed);
|
|
54910
54945
|
if (newPath) {
|
|
54911
54946
|
transformed.path = newPath;
|
|
54912
54947
|
}
|
|
@@ -54949,12 +54984,12 @@ function removeNode_splitNode(confirmed, toTransform) {
|
|
|
54949
54984
|
}
|
|
54950
54985
|
|
|
54951
54986
|
// src/Events/Transform/mergeNode_splitNode.ts
|
|
54952
|
-
import { Path as
|
|
54987
|
+
import { Path as Path35 } from "slate";
|
|
54953
54988
|
function mergeNode_splitNode(confirmed, toTransform) {
|
|
54954
54989
|
const transformed = { ...toTransform };
|
|
54955
54990
|
const rem = confirmed.path;
|
|
54956
54991
|
const orig = transformed.path;
|
|
54957
|
-
if (
|
|
54992
|
+
if (Path35.equals(rem, orig)) {
|
|
54958
54993
|
transformed.position += confirmed.position;
|
|
54959
54994
|
return transformed;
|
|
54960
54995
|
}
|
|
@@ -54965,7 +55000,7 @@ function mergeNode_splitNode(confirmed, toTransform) {
|
|
|
54965
55000
|
if (rem.length > 1) {
|
|
54966
55001
|
const depth = rem.length - 1;
|
|
54967
55002
|
const prefix2 = rem.slice(0, depth);
|
|
54968
|
-
if (newPath.length > depth &&
|
|
55003
|
+
if (newPath.length > depth && Path35.equals(prefix2, newPath.slice(0, depth)) && newPath[depth] > rem[depth]) {
|
|
54969
55004
|
newPath[depth] = newPath[depth] - 1;
|
|
54970
55005
|
}
|
|
54971
55006
|
}
|
|
@@ -54974,10 +55009,10 @@ function mergeNode_splitNode(confirmed, toTransform) {
|
|
|
54974
55009
|
}
|
|
54975
55010
|
|
|
54976
55011
|
// src/Events/Transform/splitNode_splitNode.ts
|
|
54977
|
-
import { Path as
|
|
55012
|
+
import { Path as Path36 } from "slate";
|
|
54978
55013
|
function splitNode_splitNode(confirmed, toTransform) {
|
|
54979
55014
|
const transformed = { ...toTransform };
|
|
54980
|
-
const samePath =
|
|
55015
|
+
const samePath = Path36.equals(confirmed.path, transformed.path);
|
|
54981
55016
|
if (samePath && confirmed.position <= transformed.position) {
|
|
54982
55017
|
transformed.position -= confirmed.position;
|
|
54983
55018
|
}
|
|
@@ -55001,12 +55036,12 @@ function setNode_splitNode(confirmed, toTransform) {
|
|
|
55001
55036
|
}
|
|
55002
55037
|
|
|
55003
55038
|
// src/Events/Transform/splitNode_setNode.ts
|
|
55004
|
-
import { Path as
|
|
55039
|
+
import { Path as Path37 } from "slate";
|
|
55005
55040
|
function splitNode_setNode(confirmed, toTransform) {
|
|
55006
55041
|
const transformed = { ...toTransform };
|
|
55007
55042
|
const confirmedPath = confirmed.path;
|
|
55008
55043
|
const currentPath = transformed.path;
|
|
55009
|
-
const isSame =
|
|
55044
|
+
const isSame = Path37.equals(currentPath, confirmedPath);
|
|
55010
55045
|
const isDeepNestedDescendant = confirmedPath.length > 1 && currentPath.length > confirmedPath.length && currentPath.slice(0, confirmedPath.length).every((seg, i) => seg === confirmedPath[i]);
|
|
55011
55046
|
if (!isSame && !isDeepNestedDescendant) {
|
|
55012
55047
|
transformPath(confirmed, transformed);
|
|
@@ -55029,11 +55064,11 @@ function insertNode_setNode(confirmed, toTransform) {
|
|
|
55029
55064
|
}
|
|
55030
55065
|
|
|
55031
55066
|
// src/Events/Transform/removeNode_setNode.ts
|
|
55032
|
-
import { Path as
|
|
55067
|
+
import { Path as Path38 } from "slate";
|
|
55033
55068
|
function removeNode_setNode(confirmed, toTransform) {
|
|
55034
55069
|
const removalPath = confirmed.path;
|
|
55035
55070
|
const originalPath = toTransform.path;
|
|
55036
|
-
if (
|
|
55071
|
+
if (Path38.equals(removalPath, originalPath)) {
|
|
55037
55072
|
return;
|
|
55038
55073
|
}
|
|
55039
55074
|
const transformedOp = { ...toTransform };
|
|
@@ -55044,7 +55079,7 @@ function removeNode_setNode(confirmed, toTransform) {
|
|
|
55044
55079
|
if (removalPath.length > 1) {
|
|
55045
55080
|
const depthIndex = removalPath.length - 1;
|
|
55046
55081
|
const parentPrefix = removalPath.slice(0, depthIndex);
|
|
55047
|
-
if (newPath.length > depthIndex &&
|
|
55082
|
+
if (newPath.length > depthIndex && Path38.equals(parentPrefix, newPath.slice(0, depthIndex)) && newPath[depthIndex] > removalPath[depthIndex]) {
|
|
55048
55083
|
newPath[depthIndex] = newPath[depthIndex] - 1;
|
|
55049
55084
|
}
|
|
55050
55085
|
}
|
|
@@ -55053,10 +55088,10 @@ function removeNode_setNode(confirmed, toTransform) {
|
|
|
55053
55088
|
}
|
|
55054
55089
|
|
|
55055
55090
|
// src/Events/Transform/setNode_setNode.ts
|
|
55056
|
-
import { Path as
|
|
55091
|
+
import { Path as Path39 } from "slate";
|
|
55057
55092
|
function setNode_setNode(confirmed, toTransform) {
|
|
55058
55093
|
const transformed = { ...toTransform };
|
|
55059
|
-
if (
|
|
55094
|
+
if (Path39.equals(confirmed.path, toTransform.path)) {
|
|
55060
55095
|
transformed.newProperties = {
|
|
55061
55096
|
...toTransform.newProperties,
|
|
55062
55097
|
...confirmed.newProperties
|