@moontra/moonui-pro 3.4.10 → 3.4.12
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/cdn/index.global.js +79 -79
- package/dist/cdn/index.global.js.map +1 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.mjs +271 -125
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -17340,8 +17340,70 @@ var FloatingDockInternal = React71__default.forwardRef(
|
|
|
17340
17340
|
size: size4 = "md",
|
|
17341
17341
|
position = "bottom",
|
|
17342
17342
|
containerMode = false,
|
|
17343
|
+
mobileMode = "toggle",
|
|
17344
|
+
mobileBreakpoint = "lg",
|
|
17345
|
+
autoHideDelay = 5e3,
|
|
17346
|
+
toggleIcon,
|
|
17343
17347
|
...props
|
|
17344
17348
|
}, ref) => {
|
|
17349
|
+
const [isMobileOpen, setIsMobileOpen] = useState(false);
|
|
17350
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
17351
|
+
const autoHideTimerRef = useRef(null);
|
|
17352
|
+
useEffect(() => {
|
|
17353
|
+
const breakpoints = {
|
|
17354
|
+
sm: 640,
|
|
17355
|
+
md: 768,
|
|
17356
|
+
lg: 1024,
|
|
17357
|
+
xl: 1280
|
|
17358
|
+
};
|
|
17359
|
+
const checkMobile = () => {
|
|
17360
|
+
setIsMobile(window.innerWidth < breakpoints[mobileBreakpoint]);
|
|
17361
|
+
};
|
|
17362
|
+
checkMobile();
|
|
17363
|
+
window.addEventListener("resize", checkMobile);
|
|
17364
|
+
return () => window.removeEventListener("resize", checkMobile);
|
|
17365
|
+
}, [mobileBreakpoint]);
|
|
17366
|
+
useEffect(() => {
|
|
17367
|
+
if (isMobileOpen && mobileMode === "toggle" && isMobile) {
|
|
17368
|
+
autoHideTimerRef.current = setTimeout(() => {
|
|
17369
|
+
setIsMobileOpen(false);
|
|
17370
|
+
}, autoHideDelay);
|
|
17371
|
+
}
|
|
17372
|
+
return () => {
|
|
17373
|
+
if (autoHideTimerRef.current) {
|
|
17374
|
+
clearTimeout(autoHideTimerRef.current);
|
|
17375
|
+
}
|
|
17376
|
+
};
|
|
17377
|
+
}, [isMobileOpen, autoHideDelay, mobileMode, isMobile]);
|
|
17378
|
+
const getDockVisibility = () => {
|
|
17379
|
+
if (!isMobile)
|
|
17380
|
+
return true;
|
|
17381
|
+
if (mobileMode === "always")
|
|
17382
|
+
return true;
|
|
17383
|
+
if (mobileMode === "hidden")
|
|
17384
|
+
return false;
|
|
17385
|
+
if (mobileMode === "toggle")
|
|
17386
|
+
return isMobileOpen;
|
|
17387
|
+
return true;
|
|
17388
|
+
};
|
|
17389
|
+
const slideVariants = {
|
|
17390
|
+
right: {
|
|
17391
|
+
hidden: { x: "calc(100% + 24px)", opacity: 0 },
|
|
17392
|
+
visible: { x: 0, opacity: 1 }
|
|
17393
|
+
},
|
|
17394
|
+
left: {
|
|
17395
|
+
hidden: { x: "calc(-100% - 24px)", opacity: 0 },
|
|
17396
|
+
visible: { x: 0, opacity: 1 }
|
|
17397
|
+
},
|
|
17398
|
+
bottom: {
|
|
17399
|
+
hidden: { y: "calc(100% + 24px)", opacity: 0 },
|
|
17400
|
+
visible: { y: 0, opacity: 1 }
|
|
17401
|
+
},
|
|
17402
|
+
top: {
|
|
17403
|
+
hidden: { y: "calc(-100% - 24px)", opacity: 0 },
|
|
17404
|
+
visible: { y: 0, opacity: 1 }
|
|
17405
|
+
}
|
|
17406
|
+
};
|
|
17345
17407
|
const getPositionClass = () => {
|
|
17346
17408
|
if (containerMode) {
|
|
17347
17409
|
switch (position) {
|
|
@@ -17371,31 +17433,115 @@ var FloatingDockInternal = React71__default.forwardRef(
|
|
|
17371
17433
|
}
|
|
17372
17434
|
}
|
|
17373
17435
|
};
|
|
17374
|
-
|
|
17375
|
-
|
|
17376
|
-
|
|
17377
|
-
|
|
17378
|
-
|
|
17379
|
-
|
|
17380
|
-
|
|
17381
|
-
|
|
17382
|
-
|
|
17383
|
-
|
|
17384
|
-
|
|
17385
|
-
|
|
17386
|
-
|
|
17387
|
-
|
|
17388
|
-
|
|
17389
|
-
|
|
17390
|
-
|
|
17391
|
-
|
|
17392
|
-
|
|
17393
|
-
|
|
17394
|
-
|
|
17395
|
-
|
|
17396
|
-
|
|
17436
|
+
const getToggleButtonClass = () => {
|
|
17437
|
+
if (containerMode) {
|
|
17438
|
+
switch (position) {
|
|
17439
|
+
case "right":
|
|
17440
|
+
return "absolute right-2 top-1/2 -translate-y-1/2";
|
|
17441
|
+
case "left":
|
|
17442
|
+
return "absolute left-2 top-1/2 -translate-y-1/2";
|
|
17443
|
+
case "bottom":
|
|
17444
|
+
return "absolute bottom-2 left-1/2 -translate-x-1/2";
|
|
17445
|
+
case "top":
|
|
17446
|
+
return "absolute top-2 left-1/2 -translate-x-1/2";
|
|
17447
|
+
default:
|
|
17448
|
+
return "absolute right-2 top-1/2 -translate-y-1/2";
|
|
17449
|
+
}
|
|
17450
|
+
} else {
|
|
17451
|
+
switch (position) {
|
|
17452
|
+
case "right":
|
|
17453
|
+
return "fixed right-2 top-1/2 -translate-y-1/2";
|
|
17454
|
+
case "left":
|
|
17455
|
+
return "fixed left-2 top-1/2 -translate-y-1/2";
|
|
17456
|
+
case "bottom":
|
|
17457
|
+
return "fixed bottom-2 left-1/2 -translate-x-1/2";
|
|
17458
|
+
case "top":
|
|
17459
|
+
return "fixed top-2 left-1/2 -translate-x-1/2";
|
|
17460
|
+
default:
|
|
17461
|
+
return "fixed right-2 top-1/2 -translate-y-1/2";
|
|
17462
|
+
}
|
|
17397
17463
|
}
|
|
17398
|
-
|
|
17464
|
+
};
|
|
17465
|
+
const getToggleIconRotation = () => {
|
|
17466
|
+
if (!isMobileOpen) {
|
|
17467
|
+
switch (position) {
|
|
17468
|
+
case "right":
|
|
17469
|
+
return 0;
|
|
17470
|
+
case "left":
|
|
17471
|
+
return 180;
|
|
17472
|
+
case "bottom":
|
|
17473
|
+
return 90;
|
|
17474
|
+
case "top":
|
|
17475
|
+
return -90;
|
|
17476
|
+
default:
|
|
17477
|
+
return 0;
|
|
17478
|
+
}
|
|
17479
|
+
} else {
|
|
17480
|
+
switch (position) {
|
|
17481
|
+
case "right":
|
|
17482
|
+
return 180;
|
|
17483
|
+
case "left":
|
|
17484
|
+
return 0;
|
|
17485
|
+
case "bottom":
|
|
17486
|
+
return -90;
|
|
17487
|
+
case "top":
|
|
17488
|
+
return 90;
|
|
17489
|
+
default:
|
|
17490
|
+
return 180;
|
|
17491
|
+
}
|
|
17492
|
+
}
|
|
17493
|
+
};
|
|
17494
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17495
|
+
isMobile && mobileMode === "toggle" && /* @__PURE__ */ jsx(
|
|
17496
|
+
motion.button,
|
|
17497
|
+
{
|
|
17498
|
+
className: cn(
|
|
17499
|
+
"z-[9998] p-2.5 rounded-full bg-background/95 backdrop-blur-md border border-border shadow-lg hover:shadow-xl transition-shadow",
|
|
17500
|
+
getToggleButtonClass()
|
|
17501
|
+
),
|
|
17502
|
+
onClick: () => setIsMobileOpen(!isMobileOpen),
|
|
17503
|
+
whileTap: { scale: 0.95 },
|
|
17504
|
+
initial: { opacity: 0, scale: 0.8 },
|
|
17505
|
+
animate: { opacity: 1, scale: 1 },
|
|
17506
|
+
transition: { duration: 0.3 },
|
|
17507
|
+
children: /* @__PURE__ */ jsx(
|
|
17508
|
+
motion.div,
|
|
17509
|
+
{
|
|
17510
|
+
animate: { rotate: getToggleIconRotation() },
|
|
17511
|
+
transition: { duration: 0.3, ease: "easeOut" },
|
|
17512
|
+
children: toggleIcon || /* @__PURE__ */ jsx(ChevronRight, { className: "w-4 h-4" })
|
|
17513
|
+
}
|
|
17514
|
+
)
|
|
17515
|
+
}
|
|
17516
|
+
),
|
|
17517
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: getDockVisibility() && /* @__PURE__ */ jsx(
|
|
17518
|
+
motion.div,
|
|
17519
|
+
{
|
|
17520
|
+
ref,
|
|
17521
|
+
className: cn(
|
|
17522
|
+
floatingDockVariants({ size: size4, position }),
|
|
17523
|
+
getPositionClass(),
|
|
17524
|
+
className
|
|
17525
|
+
),
|
|
17526
|
+
variants: isMobile ? slideVariants[position || "bottom"] : void 0,
|
|
17527
|
+
initial: isMobile ? "hidden" : { opacity: 0, scale: 0.95 },
|
|
17528
|
+
animate: isMobile ? "visible" : { opacity: 1, scale: 1 },
|
|
17529
|
+
exit: "hidden",
|
|
17530
|
+
transition: { duration: 0.3, ease: "easeOut" },
|
|
17531
|
+
children: items.map((item) => /* @__PURE__ */ jsx(
|
|
17532
|
+
DockIcon,
|
|
17533
|
+
{
|
|
17534
|
+
item,
|
|
17535
|
+
size: size4 || "md",
|
|
17536
|
+
magnification,
|
|
17537
|
+
showTooltip,
|
|
17538
|
+
position: position || "bottom"
|
|
17539
|
+
},
|
|
17540
|
+
item.id
|
|
17541
|
+
))
|
|
17542
|
+
}
|
|
17543
|
+
) })
|
|
17544
|
+
] });
|
|
17399
17545
|
}
|
|
17400
17546
|
);
|
|
17401
17547
|
FloatingDockInternal.displayName = "FloatingDockInternal";
|
|
@@ -22956,7 +23102,7 @@ function findDiffEnd(a, b, posA, posB) {
|
|
|
22956
23102
|
posB -= size4;
|
|
22957
23103
|
}
|
|
22958
23104
|
}
|
|
22959
|
-
var
|
|
23105
|
+
var Fragment19 = class {
|
|
22960
23106
|
/**
|
|
22961
23107
|
@internal
|
|
22962
23108
|
*/
|
|
@@ -23024,7 +23170,7 @@ var Fragment18 = class {
|
|
|
23024
23170
|
}
|
|
23025
23171
|
for (; i < other.content.length; i++)
|
|
23026
23172
|
content.push(other.content[i]);
|
|
23027
|
-
return new
|
|
23173
|
+
return new Fragment19(content, this.size + other.size);
|
|
23028
23174
|
}
|
|
23029
23175
|
/**
|
|
23030
23176
|
Cut out the sub-fragment between the two given positions.
|
|
@@ -23048,17 +23194,17 @@ var Fragment18 = class {
|
|
|
23048
23194
|
}
|
|
23049
23195
|
pos = end;
|
|
23050
23196
|
}
|
|
23051
|
-
return new
|
|
23197
|
+
return new Fragment19(result, size4);
|
|
23052
23198
|
}
|
|
23053
23199
|
/**
|
|
23054
23200
|
@internal
|
|
23055
23201
|
*/
|
|
23056
23202
|
cutByIndex(from2, to) {
|
|
23057
23203
|
if (from2 == to)
|
|
23058
|
-
return
|
|
23204
|
+
return Fragment19.empty;
|
|
23059
23205
|
if (from2 == 0 && to == this.content.length)
|
|
23060
23206
|
return this;
|
|
23061
|
-
return new
|
|
23207
|
+
return new Fragment19(this.content.slice(from2, to));
|
|
23062
23208
|
}
|
|
23063
23209
|
/**
|
|
23064
23210
|
Create a new fragment in which the node at the given index is
|
|
@@ -23071,21 +23217,21 @@ var Fragment18 = class {
|
|
|
23071
23217
|
let copy2 = this.content.slice();
|
|
23072
23218
|
let size4 = this.size + node.nodeSize - current.nodeSize;
|
|
23073
23219
|
copy2[index2] = node;
|
|
23074
|
-
return new
|
|
23220
|
+
return new Fragment19(copy2, size4);
|
|
23075
23221
|
}
|
|
23076
23222
|
/**
|
|
23077
23223
|
Create a new fragment by prepending the given node to this
|
|
23078
23224
|
fragment.
|
|
23079
23225
|
*/
|
|
23080
23226
|
addToStart(node) {
|
|
23081
|
-
return new
|
|
23227
|
+
return new Fragment19([node].concat(this.content), this.size + node.nodeSize);
|
|
23082
23228
|
}
|
|
23083
23229
|
/**
|
|
23084
23230
|
Create a new fragment by appending the given node to this
|
|
23085
23231
|
fragment.
|
|
23086
23232
|
*/
|
|
23087
23233
|
addToEnd(node) {
|
|
23088
|
-
return new
|
|
23234
|
+
return new Fragment19(this.content.concat(node), this.size + node.nodeSize);
|
|
23089
23235
|
}
|
|
23090
23236
|
/**
|
|
23091
23237
|
Compare this fragment to another one.
|
|
@@ -23204,10 +23350,10 @@ var Fragment18 = class {
|
|
|
23204
23350
|
*/
|
|
23205
23351
|
static fromJSON(schema, value) {
|
|
23206
23352
|
if (!value)
|
|
23207
|
-
return
|
|
23353
|
+
return Fragment19.empty;
|
|
23208
23354
|
if (!Array.isArray(value))
|
|
23209
23355
|
throw new RangeError("Invalid input for Fragment.fromJSON");
|
|
23210
|
-
return new
|
|
23356
|
+
return new Fragment19(value.map(schema.nodeFromJSON));
|
|
23211
23357
|
}
|
|
23212
23358
|
/**
|
|
23213
23359
|
Build a fragment from an array of nodes. Ensures that adjacent
|
|
@@ -23215,7 +23361,7 @@ var Fragment18 = class {
|
|
|
23215
23361
|
*/
|
|
23216
23362
|
static fromArray(array) {
|
|
23217
23363
|
if (!array.length)
|
|
23218
|
-
return
|
|
23364
|
+
return Fragment19.empty;
|
|
23219
23365
|
let joined, size4 = 0;
|
|
23220
23366
|
for (let i = 0; i < array.length; i++) {
|
|
23221
23367
|
let node = array[i];
|
|
@@ -23228,7 +23374,7 @@ var Fragment18 = class {
|
|
|
23228
23374
|
joined.push(node);
|
|
23229
23375
|
}
|
|
23230
23376
|
}
|
|
23231
|
-
return new
|
|
23377
|
+
return new Fragment19(joined || array, size4);
|
|
23232
23378
|
}
|
|
23233
23379
|
/**
|
|
23234
23380
|
Create a fragment from something that can be interpreted as a
|
|
@@ -23238,17 +23384,17 @@ var Fragment18 = class {
|
|
|
23238
23384
|
*/
|
|
23239
23385
|
static from(nodes) {
|
|
23240
23386
|
if (!nodes)
|
|
23241
|
-
return
|
|
23242
|
-
if (nodes instanceof
|
|
23387
|
+
return Fragment19.empty;
|
|
23388
|
+
if (nodes instanceof Fragment19)
|
|
23243
23389
|
return nodes;
|
|
23244
23390
|
if (Array.isArray(nodes))
|
|
23245
23391
|
return this.fromArray(nodes);
|
|
23246
23392
|
if (nodes.attrs)
|
|
23247
|
-
return new
|
|
23393
|
+
return new Fragment19([nodes], nodes.nodeSize);
|
|
23248
23394
|
throw new RangeError("Can not convert " + nodes + " to a Fragment" + (nodes.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
|
|
23249
23395
|
}
|
|
23250
23396
|
};
|
|
23251
|
-
|
|
23397
|
+
Fragment19.empty = new Fragment19([], 0);
|
|
23252
23398
|
var found = { index: 0, offset: 0 };
|
|
23253
23399
|
function retIndex(index2, offset4) {
|
|
23254
23400
|
found.index = index2;
|
|
@@ -23473,7 +23619,7 @@ var Slice = class {
|
|
|
23473
23619
|
let openStart = json2.openStart || 0, openEnd = json2.openEnd || 0;
|
|
23474
23620
|
if (typeof openStart != "number" || typeof openEnd != "number")
|
|
23475
23621
|
throw new RangeError("Invalid input for Slice.fromJSON");
|
|
23476
|
-
return new Slice(
|
|
23622
|
+
return new Slice(Fragment19.fromJSON(schema, json2.content), openStart, openEnd);
|
|
23477
23623
|
}
|
|
23478
23624
|
/**
|
|
23479
23625
|
Create a slice from a fragment by taking the maximum possible
|
|
@@ -23488,7 +23634,7 @@ var Slice = class {
|
|
|
23488
23634
|
return new Slice(fragment, openStart, openEnd);
|
|
23489
23635
|
}
|
|
23490
23636
|
};
|
|
23491
|
-
Slice.empty = new Slice(
|
|
23637
|
+
Slice.empty = new Slice(Fragment19.empty, 0, 0);
|
|
23492
23638
|
function removeRange(content, from2, to) {
|
|
23493
23639
|
let { index: index2, offset: offset4 } = content.findIndex(from2), child = content.maybeChild(index2);
|
|
23494
23640
|
let { index: indexTo, offset: offsetTo } = content.findIndex(to);
|
|
@@ -23586,7 +23732,7 @@ function replaceThreeWay($from, $start, $end, $to, depth) {
|
|
|
23586
23732
|
addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content);
|
|
23587
23733
|
}
|
|
23588
23734
|
addRange($to, null, depth, content);
|
|
23589
|
-
return new
|
|
23735
|
+
return new Fragment19(content);
|
|
23590
23736
|
}
|
|
23591
23737
|
function replaceTwoWay($from, $to, depth) {
|
|
23592
23738
|
let content = [];
|
|
@@ -23596,13 +23742,13 @@ function replaceTwoWay($from, $to, depth) {
|
|
|
23596
23742
|
addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content);
|
|
23597
23743
|
}
|
|
23598
23744
|
addRange($to, null, depth, content);
|
|
23599
|
-
return new
|
|
23745
|
+
return new Fragment19(content);
|
|
23600
23746
|
}
|
|
23601
23747
|
function prepareSliceForReplace(slice2, $along) {
|
|
23602
23748
|
let extra = $along.depth - slice2.openStart, parent = $along.node(extra);
|
|
23603
23749
|
let node = parent.copy(slice2.content);
|
|
23604
23750
|
for (let i = extra - 1; i >= 0; i--)
|
|
23605
|
-
node = $along.node(i).copy(
|
|
23751
|
+
node = $along.node(i).copy(Fragment19.from(node));
|
|
23606
23752
|
return {
|
|
23607
23753
|
start: node.resolveNoCache(slice2.openStart + extra),
|
|
23608
23754
|
end: node.resolveNoCache(node.content.size - slice2.openEnd - extra)
|
|
@@ -23941,7 +24087,7 @@ var Node2 = class {
|
|
|
23941
24087
|
this.type = type;
|
|
23942
24088
|
this.attrs = attrs;
|
|
23943
24089
|
this.marks = marks;
|
|
23944
|
-
this.content = content ||
|
|
24090
|
+
this.content = content || Fragment19.empty;
|
|
23945
24091
|
}
|
|
23946
24092
|
/**
|
|
23947
24093
|
The array of this node's child nodes.
|
|
@@ -24246,7 +24392,7 @@ var Node2 = class {
|
|
|
24246
24392
|
can optionally pass `start` and `end` indices into the
|
|
24247
24393
|
replacement fragment.
|
|
24248
24394
|
*/
|
|
24249
|
-
canReplace(from2, to, replacement =
|
|
24395
|
+
canReplace(from2, to, replacement = Fragment19.empty, start = 0, end = replacement.childCount) {
|
|
24250
24396
|
let one = this.contentMatchAt(from2).matchFragment(replacement, start, end);
|
|
24251
24397
|
let two = one && one.matchFragment(this.content, to);
|
|
24252
24398
|
if (!two || !two.validEnd)
|
|
@@ -24328,7 +24474,7 @@ var Node2 = class {
|
|
|
24328
24474
|
throw new RangeError("Invalid text node in JSON");
|
|
24329
24475
|
return schema.text(json2.text, marks);
|
|
24330
24476
|
}
|
|
24331
|
-
let content =
|
|
24477
|
+
let content = Fragment19.fromJSON(schema, json2.content);
|
|
24332
24478
|
let node = schema.nodeType(json2.type).create(json2.attrs, content, marks);
|
|
24333
24479
|
node.type.checkAttrs(node.attrs);
|
|
24334
24480
|
return node;
|
|
@@ -24470,7 +24616,7 @@ var ContentMatch = class {
|
|
|
24470
24616
|
function search(match, types) {
|
|
24471
24617
|
let finished = match.matchFragment(after, startIndex);
|
|
24472
24618
|
if (finished && (!toEnd || finished.validEnd))
|
|
24473
|
-
return
|
|
24619
|
+
return Fragment19.from(types.map((tp) => tp.createAndFill()));
|
|
24474
24620
|
for (let i = 0; i < match.next.length; i++) {
|
|
24475
24621
|
let { type, next } = match.next[i];
|
|
24476
24622
|
if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {
|
|
@@ -24922,7 +25068,7 @@ var NodeType = class {
|
|
|
24922
25068
|
create(attrs = null, content, marks) {
|
|
24923
25069
|
if (this.isText)
|
|
24924
25070
|
throw new Error("NodeType.create can't construct text nodes");
|
|
24925
|
-
return new Node2(this, this.computeAttrs(attrs),
|
|
25071
|
+
return new Node2(this, this.computeAttrs(attrs), Fragment19.from(content), Mark.setFrom(marks));
|
|
24926
25072
|
}
|
|
24927
25073
|
/**
|
|
24928
25074
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
|
|
@@ -24930,7 +25076,7 @@ var NodeType = class {
|
|
|
24930
25076
|
if it doesn't match.
|
|
24931
25077
|
*/
|
|
24932
25078
|
createChecked(attrs = null, content, marks) {
|
|
24933
|
-
content =
|
|
25079
|
+
content = Fragment19.from(content);
|
|
24934
25080
|
this.checkContent(content);
|
|
24935
25081
|
return new Node2(this, this.computeAttrs(attrs), content, Mark.setFrom(marks));
|
|
24936
25082
|
}
|
|
@@ -24944,7 +25090,7 @@ var NodeType = class {
|
|
|
24944
25090
|
*/
|
|
24945
25091
|
createAndFill(attrs = null, content, marks) {
|
|
24946
25092
|
attrs = this.computeAttrs(attrs);
|
|
24947
|
-
content =
|
|
25093
|
+
content = Fragment19.from(content);
|
|
24948
25094
|
if (content.size) {
|
|
24949
25095
|
let before = this.contentMatch.fillBefore(content);
|
|
24950
25096
|
if (!before)
|
|
@@ -24952,7 +25098,7 @@ var NodeType = class {
|
|
|
24952
25098
|
content = before.append(content);
|
|
24953
25099
|
}
|
|
24954
25100
|
let matched = this.contentMatch.matchFragment(content);
|
|
24955
|
-
let after = matched && matched.fillBefore(
|
|
25101
|
+
let after = matched && matched.fillBefore(Fragment19.empty, true);
|
|
24956
25102
|
if (!after)
|
|
24957
25103
|
return null;
|
|
24958
25104
|
return new Node2(this, attrs, content.append(after), Mark.setFrom(marks));
|
|
@@ -25416,7 +25562,7 @@ var NodeContext = class {
|
|
|
25416
25562
|
if (!this.match) {
|
|
25417
25563
|
if (!this.type)
|
|
25418
25564
|
return [];
|
|
25419
|
-
let fill = this.type.contentMatch.fillBefore(
|
|
25565
|
+
let fill = this.type.contentMatch.fillBefore(Fragment19.from(node));
|
|
25420
25566
|
if (fill) {
|
|
25421
25567
|
this.match = this.type.contentMatch.matchFragment(fill);
|
|
25422
25568
|
} else {
|
|
@@ -25442,9 +25588,9 @@ var NodeContext = class {
|
|
|
25442
25588
|
this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));
|
|
25443
25589
|
}
|
|
25444
25590
|
}
|
|
25445
|
-
let content =
|
|
25591
|
+
let content = Fragment19.from(this.content);
|
|
25446
25592
|
if (!openEnd && this.match)
|
|
25447
|
-
content = content.append(this.match.fillBefore(
|
|
25593
|
+
content = content.append(this.match.fillBefore(Fragment19.empty, true));
|
|
25448
25594
|
return this.type ? this.type.create(this.attrs, content, this.marks) : content;
|
|
25449
25595
|
}
|
|
25450
25596
|
inlineContext(node) {
|
|
@@ -26461,7 +26607,7 @@ function mapFragment(fragment, f, parent) {
|
|
|
26461
26607
|
child = f(child, parent, i);
|
|
26462
26608
|
mapped.push(child);
|
|
26463
26609
|
}
|
|
26464
|
-
return
|
|
26610
|
+
return Fragment19.fromArray(mapped);
|
|
26465
26611
|
}
|
|
26466
26612
|
var AddMarkStep = class extends Step {
|
|
26467
26613
|
/**
|
|
@@ -26578,7 +26724,7 @@ var AddNodeMarkStep = class extends Step {
|
|
|
26578
26724
|
if (!node)
|
|
26579
26725
|
return StepResult.fail("No node at mark step's position");
|
|
26580
26726
|
let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
|
|
26581
|
-
return StepResult.fromReplace(doc3, this.pos, this.pos + 1, new Slice(
|
|
26727
|
+
return StepResult.fromReplace(doc3, this.pos, this.pos + 1, new Slice(Fragment19.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
26582
26728
|
}
|
|
26583
26729
|
invert(doc3) {
|
|
26584
26730
|
let node = doc3.nodeAt(this.pos);
|
|
@@ -26624,7 +26770,7 @@ var RemoveNodeMarkStep = class extends Step {
|
|
|
26624
26770
|
if (!node)
|
|
26625
26771
|
return StepResult.fail("No node at mark step's position");
|
|
26626
26772
|
let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
|
|
26627
|
-
return StepResult.fromReplace(doc3, this.pos, this.pos + 1, new Slice(
|
|
26773
|
+
return StepResult.fromReplace(doc3, this.pos, this.pos + 1, new Slice(Fragment19.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
26628
26774
|
}
|
|
26629
26775
|
invert(doc3) {
|
|
26630
26776
|
let node = doc3.nodeAt(this.pos);
|
|
@@ -26889,7 +27035,7 @@ function clearIncompatible(tr2, pos, parentType, match = parentType.contentMatch
|
|
|
26889
27035
|
let m, newline = /\r?\n|\r/g, slice2;
|
|
26890
27036
|
while (m = newline.exec(child.text)) {
|
|
26891
27037
|
if (!slice2)
|
|
26892
|
-
slice2 = new Slice(
|
|
27038
|
+
slice2 = new Slice(Fragment19.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
|
|
26893
27039
|
replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice2));
|
|
26894
27040
|
}
|
|
26895
27041
|
}
|
|
@@ -26897,7 +27043,7 @@ function clearIncompatible(tr2, pos, parentType, match = parentType.contentMatch
|
|
|
26897
27043
|
cur = end;
|
|
26898
27044
|
}
|
|
26899
27045
|
if (!match.validEnd) {
|
|
26900
|
-
let fill = match.fillBefore(
|
|
27046
|
+
let fill = match.fillBefore(Fragment19.empty, true);
|
|
26901
27047
|
tr2.replace(cur, cur, new Slice(fill, 0, 0));
|
|
26902
27048
|
}
|
|
26903
27049
|
for (let i = replSteps.length - 1; i >= 0; i--)
|
|
@@ -26923,20 +27069,20 @@ function lift(tr2, range, target) {
|
|
|
26923
27069
|
let { $from, $to, depth } = range;
|
|
26924
27070
|
let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);
|
|
26925
27071
|
let start = gapStart, end = gapEnd;
|
|
26926
|
-
let before =
|
|
27072
|
+
let before = Fragment19.empty, openStart = 0;
|
|
26927
27073
|
for (let d = depth, splitting = false; d > target; d--)
|
|
26928
27074
|
if (splitting || $from.index(d) > 0) {
|
|
26929
27075
|
splitting = true;
|
|
26930
|
-
before =
|
|
27076
|
+
before = Fragment19.from($from.node(d).copy(before));
|
|
26931
27077
|
openStart++;
|
|
26932
27078
|
} else {
|
|
26933
27079
|
start--;
|
|
26934
27080
|
}
|
|
26935
|
-
let after =
|
|
27081
|
+
let after = Fragment19.empty, openEnd = 0;
|
|
26936
27082
|
for (let d = depth, splitting = false; d > target; d--)
|
|
26937
27083
|
if (splitting || $to.after(d + 1) < $to.end(d)) {
|
|
26938
27084
|
splitting = true;
|
|
26939
|
-
after =
|
|
27085
|
+
after = Fragment19.from($to.node(d).copy(after));
|
|
26940
27086
|
openEnd++;
|
|
26941
27087
|
} else {
|
|
26942
27088
|
end++;
|
|
@@ -26976,14 +27122,14 @@ function findWrappingInside(range, type) {
|
|
|
26976
27122
|
return inside;
|
|
26977
27123
|
}
|
|
26978
27124
|
function wrap(tr2, range, wrappers) {
|
|
26979
|
-
let content =
|
|
27125
|
+
let content = Fragment19.empty;
|
|
26980
27126
|
for (let i = wrappers.length - 1; i >= 0; i--) {
|
|
26981
27127
|
if (content.size) {
|
|
26982
27128
|
let match = wrappers[i].type.contentMatch.matchFragment(content);
|
|
26983
27129
|
if (!match || !match.validEnd)
|
|
26984
27130
|
throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
|
|
26985
27131
|
}
|
|
26986
|
-
content =
|
|
27132
|
+
content = Fragment19.from(wrappers[i].type.create(wrappers[i].attrs, content));
|
|
26987
27133
|
}
|
|
26988
27134
|
let start = range.start, end = range.end;
|
|
26989
27135
|
tr2.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));
|
|
@@ -27008,7 +27154,7 @@ function setBlockType(tr2, from2, to, type, attrs) {
|
|
|
27008
27154
|
clearIncompatible(tr2, tr2.mapping.slice(mapFrom).map(pos, 1), type, void 0, convertNewlines === null);
|
|
27009
27155
|
let mapping = tr2.mapping.slice(mapFrom);
|
|
27010
27156
|
let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
|
|
27011
|
-
tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(
|
|
27157
|
+
tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment19.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));
|
|
27012
27158
|
if (convertNewlines === true)
|
|
27013
27159
|
replaceNewlines(tr2, node, pos, mapFrom);
|
|
27014
27160
|
return false;
|
|
@@ -27049,7 +27195,7 @@ function setNodeMarkup(tr2, pos, type, attrs, marks) {
|
|
|
27049
27195
|
return tr2.replaceWith(pos, pos + node.nodeSize, newNode);
|
|
27050
27196
|
if (!type.validContent(node.content))
|
|
27051
27197
|
throw new RangeError("Invalid content for node type " + type.name);
|
|
27052
|
-
tr2.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(
|
|
27198
|
+
tr2.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(Fragment19.from(newNode), 0, 0), 1, true));
|
|
27053
27199
|
}
|
|
27054
27200
|
function canSplit(doc3, pos, depth = 1, typesAfter) {
|
|
27055
27201
|
let $pos = doc3.resolve(pos), base2 = $pos.depth - depth;
|
|
@@ -27073,11 +27219,11 @@ function canSplit(doc3, pos, depth = 1, typesAfter) {
|
|
|
27073
27219
|
return $pos.node(base2).canReplaceWith(index2, index2, baseType ? baseType.type : $pos.node(base2 + 1).type);
|
|
27074
27220
|
}
|
|
27075
27221
|
function split(tr2, pos, depth = 1, typesAfter) {
|
|
27076
|
-
let $pos = tr2.doc.resolve(pos), before =
|
|
27222
|
+
let $pos = tr2.doc.resolve(pos), before = Fragment19.empty, after = Fragment19.empty;
|
|
27077
27223
|
for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {
|
|
27078
|
-
before =
|
|
27224
|
+
before = Fragment19.from($pos.node(d).copy(before));
|
|
27079
27225
|
let typeAfter = typesAfter && typesAfter[i];
|
|
27080
|
-
after =
|
|
27226
|
+
after = Fragment19.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));
|
|
27081
27227
|
}
|
|
27082
27228
|
tr2.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true));
|
|
27083
27229
|
}
|
|
@@ -27216,7 +27362,7 @@ var Fitter = class {
|
|
|
27216
27362
|
this.$to = $to;
|
|
27217
27363
|
this.unplaced = unplaced;
|
|
27218
27364
|
this.frontier = [];
|
|
27219
|
-
this.placed =
|
|
27365
|
+
this.placed = Fragment19.empty;
|
|
27220
27366
|
for (let i = 0; i <= $from.depth; i++) {
|
|
27221
27367
|
let node = $from.node(i);
|
|
27222
27368
|
this.frontier.push({
|
|
@@ -27225,7 +27371,7 @@ var Fitter = class {
|
|
|
27225
27371
|
});
|
|
27226
27372
|
}
|
|
27227
27373
|
for (let i = $from.depth; i > 0; i--)
|
|
27228
|
-
this.placed =
|
|
27374
|
+
this.placed = Fragment19.from($from.node(i).copy(this.placed));
|
|
27229
27375
|
}
|
|
27230
27376
|
get depth() {
|
|
27231
27377
|
return this.frontier.length - 1;
|
|
@@ -27282,7 +27428,7 @@ var Fitter = class {
|
|
|
27282
27428
|
let first2 = fragment.firstChild;
|
|
27283
27429
|
for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {
|
|
27284
27430
|
let { type, match } = this.frontier[frontierDepth], wrap2, inject = null;
|
|
27285
|
-
if (pass == 1 && (first2 ? match.matchType(first2.type) || (inject = match.fillBefore(
|
|
27431
|
+
if (pass == 1 && (first2 ? match.matchType(first2.type) || (inject = match.fillBefore(Fragment19.from(first2), false)) : parent && type.compatibleContent(parent.type)))
|
|
27286
27432
|
return { sliceDepth, frontierDepth, parent, inject };
|
|
27287
27433
|
else if (pass == 2 && first2 && (wrap2 = match.findWrapping(first2.type)))
|
|
27288
27434
|
return { sliceDepth, frontierDepth, parent, wrap: wrap2 };
|
|
@@ -27342,7 +27488,7 @@ var Fitter = class {
|
|
|
27342
27488
|
let toEnd = taken == fragment.childCount;
|
|
27343
27489
|
if (!toEnd)
|
|
27344
27490
|
openEndCount = -1;
|
|
27345
|
-
this.placed = addToFragment(this.placed, frontierDepth,
|
|
27491
|
+
this.placed = addToFragment(this.placed, frontierDepth, Fragment19.from(add));
|
|
27346
27492
|
this.frontier[frontierDepth].match = match;
|
|
27347
27493
|
if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1)
|
|
27348
27494
|
this.closeFrontierNode();
|
|
@@ -27399,12 +27545,12 @@ var Fitter = class {
|
|
|
27399
27545
|
openFrontierNode(type, attrs = null, content) {
|
|
27400
27546
|
let top = this.frontier[this.depth];
|
|
27401
27547
|
top.match = top.match.matchType(type);
|
|
27402
|
-
this.placed = addToFragment(this.placed, this.depth,
|
|
27548
|
+
this.placed = addToFragment(this.placed, this.depth, Fragment19.from(type.create(attrs, content)));
|
|
27403
27549
|
this.frontier.push({ type, match: type.contentMatch });
|
|
27404
27550
|
}
|
|
27405
27551
|
closeFrontierNode() {
|
|
27406
27552
|
let open = this.frontier.pop();
|
|
27407
|
-
let add = open.match.fillBefore(
|
|
27553
|
+
let add = open.match.fillBefore(Fragment19.empty, true);
|
|
27408
27554
|
if (add.childCount)
|
|
27409
27555
|
this.placed = addToFragment(this.placed, this.frontier.length, add);
|
|
27410
27556
|
}
|
|
@@ -27433,7 +27579,7 @@ function closeNodeStart(node, openStart, openEnd) {
|
|
|
27433
27579
|
if (openStart > 0) {
|
|
27434
27580
|
frag = node.type.contentMatch.fillBefore(frag).append(frag);
|
|
27435
27581
|
if (openEnd <= 0)
|
|
27436
|
-
frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(
|
|
27582
|
+
frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment19.empty, true));
|
|
27437
27583
|
}
|
|
27438
27584
|
return node.copy(frag);
|
|
27439
27585
|
}
|
|
@@ -27525,7 +27671,7 @@ function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
|
|
|
27525
27671
|
if (depth > newOpen) {
|
|
27526
27672
|
let match = parent.contentMatchAt(0);
|
|
27527
27673
|
let start = match.fillBefore(fragment).append(fragment);
|
|
27528
|
-
fragment = start.append(match.matchFragment(start).fillBefore(
|
|
27674
|
+
fragment = start.append(match.matchFragment(start).fillBefore(Fragment19.empty, true));
|
|
27529
27675
|
}
|
|
27530
27676
|
return fragment;
|
|
27531
27677
|
}
|
|
@@ -27535,7 +27681,7 @@ function replaceRangeWith(tr2, from2, to, node) {
|
|
|
27535
27681
|
if (point != null)
|
|
27536
27682
|
from2 = to = point;
|
|
27537
27683
|
}
|
|
27538
|
-
tr2.replaceRange(from2, to, new Slice(
|
|
27684
|
+
tr2.replaceRange(from2, to, new Slice(Fragment19.from(node), 0, 0));
|
|
27539
27685
|
}
|
|
27540
27686
|
function deleteRange(tr2, from2, to) {
|
|
27541
27687
|
let $from = tr2.doc.resolve(from2), $to = tr2.doc.resolve(to);
|
|
@@ -27583,7 +27729,7 @@ var AttrStep = class extends Step {
|
|
|
27583
27729
|
attrs[name] = node.attrs[name];
|
|
27584
27730
|
attrs[this.attr] = this.value;
|
|
27585
27731
|
let updated = node.type.create(attrs, null, node.marks);
|
|
27586
|
-
return StepResult.fromReplace(doc3, this.pos, this.pos + 1, new Slice(
|
|
27732
|
+
return StepResult.fromReplace(doc3, this.pos, this.pos + 1, new Slice(Fragment19.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
27587
27733
|
}
|
|
27588
27734
|
getMap() {
|
|
27589
27735
|
return StepMap.empty;
|
|
@@ -27718,7 +27864,7 @@ var Transform = class {
|
|
|
27718
27864
|
fragment, node, or array of nodes.
|
|
27719
27865
|
*/
|
|
27720
27866
|
replaceWith(from2, to, content) {
|
|
27721
|
-
return this.replace(from2, to, new Slice(
|
|
27867
|
+
return this.replace(from2, to, new Slice(Fragment19.from(content), 0, 0));
|
|
27722
27868
|
}
|
|
27723
27869
|
/**
|
|
27724
27870
|
Delete the content between the given positions.
|
|
@@ -28220,7 +28366,7 @@ var NodeSelection = class extends Selection {
|
|
|
28220
28366
|
return new NodeSelection($pos);
|
|
28221
28367
|
}
|
|
28222
28368
|
content() {
|
|
28223
|
-
return new Slice(
|
|
28369
|
+
return new Slice(Fragment19.from(this.node), 0, 0);
|
|
28224
28370
|
}
|
|
28225
28371
|
eq(other) {
|
|
28226
28372
|
return other instanceof NodeSelection && other.anchor == this.anchor;
|
|
@@ -30042,7 +30188,7 @@ var NodeViewDesc = class extends ViewDesc {
|
|
|
30042
30188
|
}
|
|
30043
30189
|
}
|
|
30044
30190
|
if (!rule.contentElement)
|
|
30045
|
-
rule.getContent = () =>
|
|
30191
|
+
rule.getContent = () => Fragment19.empty;
|
|
30046
30192
|
}
|
|
30047
30193
|
return rule;
|
|
30048
30194
|
}
|
|
@@ -31361,7 +31507,7 @@ function parseFromClipboard(view, text, html, plainText, $context) {
|
|
|
31361
31507
|
text = f(text, inCode || plainText, view);
|
|
31362
31508
|
});
|
|
31363
31509
|
if (inCode)
|
|
31364
|
-
return text ? new Slice(
|
|
31510
|
+
return text ? new Slice(Fragment19.from(view.state.schema.text(text.replace(/\r\n?/g, "\n"))), 0, 0) : Slice.empty;
|
|
31365
31511
|
let parsed = view.someProp("clipboardTextParser", (f) => f(text, $context, plainText, view));
|
|
31366
31512
|
if (parsed) {
|
|
31367
31513
|
slice2 = parsed;
|
|
@@ -31450,13 +31596,13 @@ function normalizeSiblings(fragment, $context) {
|
|
|
31450
31596
|
}
|
|
31451
31597
|
});
|
|
31452
31598
|
if (result)
|
|
31453
|
-
return
|
|
31599
|
+
return Fragment19.from(result);
|
|
31454
31600
|
}
|
|
31455
31601
|
return fragment;
|
|
31456
31602
|
}
|
|
31457
31603
|
function withWrappers(node, wrap2, from2 = 0) {
|
|
31458
31604
|
for (let i = wrap2.length - 1; i >= from2; i--)
|
|
31459
|
-
node = wrap2[i].create(null,
|
|
31605
|
+
node = wrap2[i].create(null, Fragment19.from(node));
|
|
31460
31606
|
return node;
|
|
31461
31607
|
}
|
|
31462
31608
|
function addToSibling(wrap2, lastWrap, node, sibling, depth) {
|
|
@@ -31466,14 +31612,14 @@ function addToSibling(wrap2, lastWrap, node, sibling, depth) {
|
|
|
31466
31612
|
return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner));
|
|
31467
31613
|
let match = sibling.contentMatchAt(sibling.childCount);
|
|
31468
31614
|
if (match.matchType(depth == wrap2.length - 1 ? node.type : wrap2[depth + 1]))
|
|
31469
|
-
return sibling.copy(sibling.content.append(
|
|
31615
|
+
return sibling.copy(sibling.content.append(Fragment19.from(withWrappers(node, wrap2, depth + 1))));
|
|
31470
31616
|
}
|
|
31471
31617
|
}
|
|
31472
31618
|
function closeRight(node, depth) {
|
|
31473
31619
|
if (depth == 0)
|
|
31474
31620
|
return node;
|
|
31475
31621
|
let fragment = node.content.replaceChild(node.childCount - 1, closeRight(node.lastChild, depth - 1));
|
|
31476
|
-
let fill = node.contentMatchAt(node.childCount).fillBefore(
|
|
31622
|
+
let fill = node.contentMatchAt(node.childCount).fillBefore(Fragment19.empty, true);
|
|
31477
31623
|
return node.copy(fragment.append(fill));
|
|
31478
31624
|
}
|
|
31479
31625
|
function closeRange(fragment, side, from2, to, depth, openEnd) {
|
|
@@ -31483,7 +31629,7 @@ function closeRange(fragment, side, from2, to, depth, openEnd) {
|
|
|
31483
31629
|
if (depth < to - 1)
|
|
31484
31630
|
inner = closeRange(inner, side, from2, to, depth + 1, openEnd);
|
|
31485
31631
|
if (depth >= from2)
|
|
31486
|
-
inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner) : inner.append(node.contentMatchAt(node.childCount).fillBefore(
|
|
31632
|
+
inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner) : inner.append(node.contentMatchAt(node.childCount).fillBefore(Fragment19.empty, true));
|
|
31487
31633
|
return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node.copy(inner));
|
|
31488
31634
|
}
|
|
31489
31635
|
function closeSlice(slice2, openStart, openEnd) {
|
|
@@ -31553,7 +31699,7 @@ function addContext(slice2, context) {
|
|
|
31553
31699
|
let type = schema.nodes[array[i]];
|
|
31554
31700
|
if (!type || type.hasRequiredAttrs())
|
|
31555
31701
|
break;
|
|
31556
|
-
content =
|
|
31702
|
+
content = Fragment19.from(type.create(array[i + 1], content));
|
|
31557
31703
|
openStart++;
|
|
31558
31704
|
openEnd++;
|
|
31559
31705
|
}
|
|
@@ -33414,7 +33560,7 @@ function isMarkChange(cur, prev) {
|
|
|
33414
33560
|
let updated = [];
|
|
33415
33561
|
for (let i = 0; i < prev.childCount; i++)
|
|
33416
33562
|
updated.push(update(prev.child(i)));
|
|
33417
|
-
if (
|
|
33563
|
+
if (Fragment19.from(updated).eq(cur))
|
|
33418
33564
|
return { mark, type };
|
|
33419
33565
|
}
|
|
33420
33566
|
function looksLikeBackspace(old, start, end, $newStart, $newEnd) {
|
|
@@ -34524,10 +34670,10 @@ function deleteBarrier(state, $cut, dispatch2, dir) {
|
|
|
34524
34670
|
let canDelAfter = !isolated && $cut.parent.canReplace($cut.index(), $cut.index() + 1);
|
|
34525
34671
|
if (canDelAfter && (conn = (match = before.contentMatchAt(before.childCount)).findWrapping(after.type)) && match.matchType(conn[0] || after.type).validEnd) {
|
|
34526
34672
|
if (dispatch2) {
|
|
34527
|
-
let end = $cut.pos + after.nodeSize, wrap2 =
|
|
34673
|
+
let end = $cut.pos + after.nodeSize, wrap2 = Fragment19.empty;
|
|
34528
34674
|
for (let i = conn.length - 1; i >= 0; i--)
|
|
34529
|
-
wrap2 =
|
|
34530
|
-
wrap2 =
|
|
34675
|
+
wrap2 = Fragment19.from(conn[i].create(null, wrap2));
|
|
34676
|
+
wrap2 = Fragment19.from(before.copy(wrap2));
|
|
34531
34677
|
let tr2 = state.tr.step(new ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new Slice(wrap2, 1, 0), conn.length, true));
|
|
34532
34678
|
let $joinAt = tr2.doc.resolve(end + 2 * conn.length);
|
|
34533
34679
|
if ($joinAt.nodeAfter && $joinAt.nodeAfter.type == before.type && canJoin(tr2.doc, $joinAt.pos))
|
|
@@ -34556,9 +34702,9 @@ function deleteBarrier(state, $cut, dispatch2, dir) {
|
|
|
34556
34702
|
afterDepth++;
|
|
34557
34703
|
if (at2.canReplace(at2.childCount, at2.childCount, afterText.content)) {
|
|
34558
34704
|
if (dispatch2) {
|
|
34559
|
-
let end =
|
|
34705
|
+
let end = Fragment19.empty;
|
|
34560
34706
|
for (let i = wrap2.length - 1; i >= 0; i--)
|
|
34561
|
-
end =
|
|
34707
|
+
end = Fragment19.from(wrap2[i].copy(end));
|
|
34562
34708
|
let tr2 = state.tr.step(new ReplaceAroundStep($cut.pos - wrap2.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end, wrap2.length, 0), 0, true));
|
|
34563
34709
|
dispatch2(tr2.scrollIntoView());
|
|
34564
34710
|
}
|
|
@@ -34663,9 +34809,9 @@ function wrapRangeInList(tr2, range, listType, attrs = null) {
|
|
|
34663
34809
|
return true;
|
|
34664
34810
|
}
|
|
34665
34811
|
function doWrapInList(tr2, range, wrappers, joinBefore, listType) {
|
|
34666
|
-
let content =
|
|
34812
|
+
let content = Fragment19.empty;
|
|
34667
34813
|
for (let i = wrappers.length - 1; i >= 0; i--)
|
|
34668
|
-
content =
|
|
34814
|
+
content = Fragment19.from(wrappers[i].type.create(wrappers[i].attrs, content));
|
|
34669
34815
|
tr2.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));
|
|
34670
34816
|
let found2 = 0;
|
|
34671
34817
|
for (let i = 0; i < wrappers.length; i++)
|
|
@@ -34699,7 +34845,7 @@ function liftListItem(itemType) {
|
|
|
34699
34845
|
function liftToOuterList(state, dispatch2, itemType, range) {
|
|
34700
34846
|
let tr2 = state.tr, end = range.end, endOfList = range.$to.end(range.depth);
|
|
34701
34847
|
if (end < endOfList) {
|
|
34702
|
-
tr2.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(
|
|
34848
|
+
tr2.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment19.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));
|
|
34703
34849
|
range = new NodeRange(tr2.doc.resolve(range.$from.pos), tr2.doc.resolve(endOfList), range.depth);
|
|
34704
34850
|
}
|
|
34705
34851
|
const target = liftTarget(range);
|
|
@@ -34723,10 +34869,10 @@ function liftOutOfList(state, dispatch2, range) {
|
|
|
34723
34869
|
return false;
|
|
34724
34870
|
let atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;
|
|
34725
34871
|
let parent = $start.node(-1), indexBefore = $start.index(-1);
|
|
34726
|
-
if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ?
|
|
34872
|
+
if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment19.empty : Fragment19.from(list))))
|
|
34727
34873
|
return false;
|
|
34728
34874
|
let start = $start.pos, end = start + item.nodeSize;
|
|
34729
|
-
tr2.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ?
|
|
34875
|
+
tr2.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment19.empty : Fragment19.from(list.copy(Fragment19.empty))).append(atEnd ? Fragment19.empty : Fragment19.from(list.copy(Fragment19.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
|
|
34730
34876
|
dispatch2(tr2.scrollIntoView());
|
|
34731
34877
|
return true;
|
|
34732
34878
|
}
|
|
@@ -34744,8 +34890,8 @@ function sinkListItem(itemType) {
|
|
|
34744
34890
|
return false;
|
|
34745
34891
|
if (dispatch2) {
|
|
34746
34892
|
let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;
|
|
34747
|
-
let inner =
|
|
34748
|
-
let slice2 = new Slice(
|
|
34893
|
+
let inner = Fragment19.from(nestedBefore ? itemType.create() : null);
|
|
34894
|
+
let slice2 = new Slice(Fragment19.from(itemType.create(null, Fragment19.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
|
|
34749
34895
|
let before = range.start, after = range.end;
|
|
34750
34896
|
dispatch2(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice2, 1, true)).scrollIntoView());
|
|
34751
34897
|
}
|
|
@@ -34963,7 +35109,7 @@ function elementFromString(value) {
|
|
|
34963
35109
|
return removeWhitespaces(html);
|
|
34964
35110
|
}
|
|
34965
35111
|
function createNodeFromContent(content, schema, options) {
|
|
34966
|
-
if (content instanceof Node2 || content instanceof
|
|
35112
|
+
if (content instanceof Node2 || content instanceof Fragment19) {
|
|
34967
35113
|
return content;
|
|
34968
35114
|
}
|
|
34969
35115
|
options = {
|
|
@@ -34977,7 +35123,7 @@ function createNodeFromContent(content, schema, options) {
|
|
|
34977
35123
|
try {
|
|
34978
35124
|
const isArrayContent = Array.isArray(content) && content.length > 0;
|
|
34979
35125
|
if (isArrayContent) {
|
|
34980
|
-
return
|
|
35126
|
+
return Fragment19.fromArray(content.map((item) => schema.nodeFromJSON(item)));
|
|
34981
35127
|
}
|
|
34982
35128
|
const node = schema.nodeFromJSON(content);
|
|
34983
35129
|
if (options.errorOnInvalidContent) {
|
|
@@ -36115,7 +36261,7 @@ function inputRulesPlugin(props) {
|
|
|
36115
36261
|
if (typeof text === "string") {
|
|
36116
36262
|
text = text;
|
|
36117
36263
|
} else {
|
|
36118
|
-
text = getHTMLFromFragment(
|
|
36264
|
+
text = getHTMLFromFragment(Fragment19.from(text), state.schema);
|
|
36119
36265
|
}
|
|
36120
36266
|
const { from: from2 } = simulatedInputMeta;
|
|
36121
36267
|
const to = from2 + text.length;
|
|
@@ -36498,7 +36644,7 @@ function pasteRulesPlugin(props) {
|
|
|
36498
36644
|
if (typeof text === "string") {
|
|
36499
36645
|
text = text;
|
|
36500
36646
|
} else {
|
|
36501
|
-
text = getHTMLFromFragment(
|
|
36647
|
+
text = getHTMLFromFragment(Fragment19.from(text), state.schema);
|
|
36502
36648
|
}
|
|
36503
36649
|
const { from: from22 } = simulatedPasteMeta;
|
|
36504
36650
|
const to2 = from22 + text.length;
|
|
@@ -37155,7 +37301,7 @@ var insertContentAt = (position, value, options) => ({ tr: tr2, dispatch: dispat
|
|
|
37155
37301
|
if (isOnlyTextContent) {
|
|
37156
37302
|
if (Array.isArray(value)) {
|
|
37157
37303
|
newContent = value.map((v) => v.text || "").join("");
|
|
37158
|
-
} else if (value instanceof
|
|
37304
|
+
} else if (value instanceof Fragment19) {
|
|
37159
37305
|
let text = "";
|
|
37160
37306
|
value.forEach((node) => {
|
|
37161
37307
|
if (node.text) {
|
|
@@ -37625,10 +37771,10 @@ var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr: tr2, state, dispa
|
|
|
37625
37771
|
return false;
|
|
37626
37772
|
}
|
|
37627
37773
|
if (dispatch2) {
|
|
37628
|
-
let wrap2 =
|
|
37774
|
+
let wrap2 = Fragment19.empty;
|
|
37629
37775
|
const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
|
|
37630
37776
|
for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) {
|
|
37631
|
-
wrap2 =
|
|
37777
|
+
wrap2 = Fragment19.from($from.node(d).copy(wrap2));
|
|
37632
37778
|
}
|
|
37633
37779
|
const depthAfter = (
|
|
37634
37780
|
// eslint-disable-next-line no-nested-ternary
|
|
@@ -37639,7 +37785,7 @@ var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr: tr2, state, dispa
|
|
|
37639
37785
|
...overrideAttrs
|
|
37640
37786
|
};
|
|
37641
37787
|
const nextType2 = ((_a2 = type.contentMatch.defaultType) == null ? void 0 : _a2.createAndFill(newNextTypeAttributes2)) || void 0;
|
|
37642
|
-
wrap2 = wrap2.append(
|
|
37788
|
+
wrap2 = wrap2.append(Fragment19.from(type.createAndFill(null, nextType2) || void 0));
|
|
37643
37789
|
const start = $from.before($from.depth - (depthBefore - 1));
|
|
37644
37790
|
tr2.replace(start, $from.after(-depthAfter), new Slice(wrap2, 4 - depthBefore, 0));
|
|
37645
37791
|
let sel = -1;
|
|
@@ -43190,9 +43336,9 @@ function beforeinput(view, event) {
|
|
|
43190
43336
|
let insert = $from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);
|
|
43191
43337
|
if (!insert)
|
|
43192
43338
|
return false;
|
|
43193
|
-
let frag =
|
|
43339
|
+
let frag = Fragment19.empty;
|
|
43194
43340
|
for (let i = insert.length - 1; i >= 0; i--)
|
|
43195
|
-
frag =
|
|
43341
|
+
frag = Fragment19.from(insert[i].createAndFill(null, frag));
|
|
43196
43342
|
let tr2 = view.state.tr.replace($from.pos, $from.pos, new Slice(frag, 0, 0));
|
|
43197
43343
|
tr2.setSelection(TextSelection.near(tr2.doc.resolve($from.pos + 1)));
|
|
43198
43344
|
view.dispatch(tr2);
|
|
@@ -44872,10 +45018,10 @@ var CellSelection = class _CellSelection extends Selection {
|
|
|
44872
45018
|
}
|
|
44873
45019
|
rowContent.push(cell);
|
|
44874
45020
|
}
|
|
44875
|
-
rows.push(table.child(row).copy(
|
|
45021
|
+
rows.push(table.child(row).copy(Fragment19.from(rowContent)));
|
|
44876
45022
|
}
|
|
44877
45023
|
const fragment = this.isColSelection() && this.isRowSelection() ? table : rows;
|
|
44878
|
-
return new Slice(
|
|
45024
|
+
return new Slice(Fragment19.from(fragment), 1, 1);
|
|
44879
45025
|
}
|
|
44880
45026
|
replace(tr2, content = Slice.empty) {
|
|
44881
45027
|
const mapFrom = tr2.steps.length, ranges = this.ranges;
|
|
@@ -44895,7 +45041,7 @@ var CellSelection = class _CellSelection extends Selection {
|
|
|
44895
45041
|
tr2.setSelection(sel);
|
|
44896
45042
|
}
|
|
44897
45043
|
replaceWith(tr2, node) {
|
|
44898
|
-
this.replace(tr2, new Slice(
|
|
45044
|
+
this.replace(tr2, new Slice(Fragment19.from(node), 0, 0));
|
|
44899
45045
|
}
|
|
44900
45046
|
forEachCell(f) {
|
|
44901
45047
|
const table = this.$anchorCell.node(-1);
|
|
@@ -45443,7 +45589,7 @@ function mergeCells(state, dispatch2) {
|
|
|
45443
45589
|
if (dispatch2) {
|
|
45444
45590
|
const tr2 = state.tr;
|
|
45445
45591
|
const seen = {};
|
|
45446
|
-
let content =
|
|
45592
|
+
let content = Fragment19.empty;
|
|
45447
45593
|
let mergedPos;
|
|
45448
45594
|
let mergedCell;
|
|
45449
45595
|
for (let row = rect.top; row < rect.bottom; row++) {
|
|
@@ -45824,14 +45970,14 @@ function ensureRectangular(schema, rows) {
|
|
|
45824
45970
|
width = Math.max(width, widths[r2]);
|
|
45825
45971
|
for (let r2 = 0; r2 < widths.length; r2++) {
|
|
45826
45972
|
if (r2 >= rows.length)
|
|
45827
|
-
rows.push(
|
|
45973
|
+
rows.push(Fragment19.empty);
|
|
45828
45974
|
if (widths[r2] < width) {
|
|
45829
45975
|
const empty2 = tableNodeTypes(schema).cell.createAndFill();
|
|
45830
45976
|
const cells = [];
|
|
45831
45977
|
for (let i = widths[r2]; i < width; i++) {
|
|
45832
45978
|
cells.push(empty2);
|
|
45833
45979
|
}
|
|
45834
|
-
rows[r2] = rows[r2].append(
|
|
45980
|
+
rows[r2] = rows[r2].append(Fragment19.from(cells));
|
|
45835
45981
|
}
|
|
45836
45982
|
}
|
|
45837
45983
|
return { height: rows.length, width, rows };
|
|
@@ -45863,7 +46009,7 @@ function clipCells({ width, height, rows }, newWidth, newHeight) {
|
|
|
45863
46009
|
for (let j = 1; j < cell.attrs.rowspan; j++)
|
|
45864
46010
|
added[row + j] = (added[row + j] || 0) + cell.attrs.colspan;
|
|
45865
46011
|
}
|
|
45866
|
-
newRows.push(
|
|
46012
|
+
newRows.push(Fragment19.from(cells));
|
|
45867
46013
|
}
|
|
45868
46014
|
rows = newRows;
|
|
45869
46015
|
width = newWidth;
|
|
@@ -45884,7 +46030,7 @@ function clipCells({ width, height, rows }, newWidth, newHeight) {
|
|
|
45884
46030
|
);
|
|
45885
46031
|
cells.push(cell);
|
|
45886
46032
|
}
|
|
45887
|
-
newRows.push(
|
|
46033
|
+
newRows.push(Fragment19.from(cells));
|
|
45888
46034
|
}
|
|
45889
46035
|
rows = newRows;
|
|
45890
46036
|
height = newHeight;
|
|
@@ -45919,7 +46065,7 @@ function growTable(tr2, map2, table, start, width, height, mapFrom) {
|
|
|
45919
46065
|
header ? emptyHead || (emptyHead = types.header_cell.createAndFill()) : empty2 || (empty2 = types.cell.createAndFill())
|
|
45920
46066
|
);
|
|
45921
46067
|
}
|
|
45922
|
-
const emptyRow = types.row.create(null,
|
|
46068
|
+
const emptyRow = types.row.create(null, Fragment19.from(cells)), rows = [];
|
|
45923
46069
|
for (let i = map2.height; i < height; i++)
|
|
45924
46070
|
rows.push(emptyRow);
|
|
45925
46071
|
tr2.insert(tr2.mapping.slice(mapFrom).map(start + table.nodeSize - 2), rows);
|
|
@@ -46128,7 +46274,7 @@ function handlePaste(view, _2, slice2) {
|
|
|
46128
46274
|
width: 1,
|
|
46129
46275
|
height: 1,
|
|
46130
46276
|
rows: [
|
|
46131
|
-
|
|
46277
|
+
Fragment19.from(
|
|
46132
46278
|
fitSlice(tableNodeTypes(view.state.schema).cell, slice2)
|
|
46133
46279
|
)
|
|
46134
46280
|
]
|