rme 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +436 -1301
- package/dist/index.mjs.map +4 -4
- package/package.json +7 -2
package/dist/index.mjs
CHANGED
|
@@ -9,9 +9,9 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
9
9
|
};
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let
|
|
13
|
-
if (!__hasOwnProp.call(to,
|
|
14
|
-
__defProp(to,
|
|
12
|
+
for (let key2 of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
|
14
|
+
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
|
15
15
|
}
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
@@ -23,12 +23,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
24
|
mod
|
|
25
25
|
));
|
|
26
|
-
var __decorateClass = (decorators, target,
|
|
27
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target,
|
|
26
|
+
var __decorateClass = (decorators, target, key2, kind) => {
|
|
27
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key2) : target;
|
|
28
28
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
29
29
|
if (decorator = decorators[i])
|
|
30
|
-
result = (kind ? decorator(target,
|
|
31
|
-
if (kind && result) __defProp(target,
|
|
30
|
+
result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
|
|
31
|
+
if (kind && result) __defProp(target, key2, result);
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -911,7 +911,7 @@ var require_implementation2 = __commonJS({
|
|
|
911
911
|
return false;
|
|
912
912
|
}
|
|
913
913
|
};
|
|
914
|
-
keysShim = function
|
|
914
|
+
keysShim = function keys(object2) {
|
|
915
915
|
var isObject = object2 !== null && typeof object2 === "object";
|
|
916
916
|
var isFunction3 = toStr.call(object2) === "[object Function]";
|
|
917
917
|
var isArguments = isArgs(object2);
|
|
@@ -971,7 +971,7 @@ var require_object_keys = __commonJS({
|
|
|
971
971
|
var slice = Array.prototype.slice;
|
|
972
972
|
var isArgs = import_isArguments.default;
|
|
973
973
|
var origKeys = Object.keys;
|
|
974
|
-
var keysShim = origKeys ? function
|
|
974
|
+
var keysShim = origKeys ? function keys(o) {
|
|
975
975
|
return origKeys(o);
|
|
976
976
|
} : import_implementation.default;
|
|
977
977
|
var originalKeys = Object.keys;
|
|
@@ -982,7 +982,7 @@ var require_object_keys = __commonJS({
|
|
|
982
982
|
return args && args.length === arguments.length;
|
|
983
983
|
}(1, 2);
|
|
984
984
|
if (!keysWorksWithArguments) {
|
|
985
|
-
Object.keys = function
|
|
985
|
+
Object.keys = function keys(object2) {
|
|
986
986
|
if (isArgs(object2)) {
|
|
987
987
|
return originalKeys(slice.call(object2));
|
|
988
988
|
}
|
|
@@ -1004,7 +1004,7 @@ var require_define_properties = __commonJS({
|
|
|
1004
1004
|
var import_object_keys = __toESM(require_object_keys());
|
|
1005
1005
|
var import_define_data_property = __toESM(require_define_data_property());
|
|
1006
1006
|
var import_has_property_descriptors = __toESM(require_has_property_descriptors());
|
|
1007
|
-
var
|
|
1007
|
+
var keys = import_object_keys.default;
|
|
1008
1008
|
var hasSymbols = typeof Symbol === "function" && typeof Symbol("foo") === "symbol";
|
|
1009
1009
|
var toStr = Object.prototype.toString;
|
|
1010
1010
|
var concat = Array.prototype.concat;
|
|
@@ -1031,7 +1031,7 @@ var require_define_properties = __commonJS({
|
|
|
1031
1031
|
};
|
|
1032
1032
|
var defineProperties = function(object2, map) {
|
|
1033
1033
|
var predicates = arguments.length > 2 ? arguments[2] : {};
|
|
1034
|
-
var props =
|
|
1034
|
+
var props = keys(map);
|
|
1035
1035
|
if (hasSymbols) {
|
|
1036
1036
|
props = concat.call(props, Object.getOwnPropertySymbols(map));
|
|
1037
1037
|
}
|
|
@@ -1243,8 +1243,8 @@ var require_object_inspect = __commonJS({
|
|
|
1243
1243
|
}
|
|
1244
1244
|
if (typeof obj === "function" && !isRegExp2(obj)) {
|
|
1245
1245
|
var name = nameOf(obj);
|
|
1246
|
-
var
|
|
1247
|
-
return "[Function" + (name ? ": " + name : " (anonymous)") + "]" + (
|
|
1246
|
+
var keys = arrObjKeys(obj, inspect);
|
|
1247
|
+
return "[Function" + (name ? ": " + name : " (anonymous)") + "]" + (keys.length > 0 ? " { " + $join.call(keys, ", ") + " }" : "");
|
|
1248
1248
|
}
|
|
1249
1249
|
if (isSymbol2(obj)) {
|
|
1250
1250
|
var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, "$1") : symToString.call(obj);
|
|
@@ -1293,8 +1293,8 @@ var require_object_inspect = __commonJS({
|
|
|
1293
1293
|
if (isMap(obj)) {
|
|
1294
1294
|
var mapParts = [];
|
|
1295
1295
|
if (mapForEach) {
|
|
1296
|
-
mapForEach.call(obj, function(value,
|
|
1297
|
-
mapParts.push(inspect(
|
|
1296
|
+
mapForEach.call(obj, function(value, key2) {
|
|
1297
|
+
mapParts.push(inspect(key2, obj, true) + " => " + inspect(value, obj));
|
|
1298
1298
|
});
|
|
1299
1299
|
}
|
|
1300
1300
|
return collectionOf("Map", mapSize.call(obj), mapParts, indent);
|
|
@@ -1408,11 +1408,11 @@ var require_object_inspect = __commonJS({
|
|
|
1408
1408
|
}
|
|
1409
1409
|
return false;
|
|
1410
1410
|
}
|
|
1411
|
-
var hasOwn = Object.prototype.hasOwnProperty || function(
|
|
1412
|
-
return
|
|
1411
|
+
var hasOwn = Object.prototype.hasOwnProperty || function(key2) {
|
|
1412
|
+
return key2 in this;
|
|
1413
1413
|
};
|
|
1414
|
-
function has(obj,
|
|
1415
|
-
return hasOwn.call(obj,
|
|
1414
|
+
function has(obj, key2) {
|
|
1415
|
+
return hasOwn.call(obj, key2);
|
|
1416
1416
|
}
|
|
1417
1417
|
function toStr(obj) {
|
|
1418
1418
|
return objectToString.call(obj);
|
|
@@ -1601,19 +1601,19 @@ var require_object_inspect = __commonJS({
|
|
|
1601
1601
|
symMap["$" + syms[k]] = syms[k];
|
|
1602
1602
|
}
|
|
1603
1603
|
}
|
|
1604
|
-
for (var
|
|
1605
|
-
if (!has(obj,
|
|
1604
|
+
for (var key2 in obj) {
|
|
1605
|
+
if (!has(obj, key2)) {
|
|
1606
1606
|
continue;
|
|
1607
1607
|
}
|
|
1608
|
-
if (isArr && String(Number(
|
|
1608
|
+
if (isArr && String(Number(key2)) === key2 && key2 < obj.length) {
|
|
1609
1609
|
continue;
|
|
1610
1610
|
}
|
|
1611
|
-
if (hasShammedSymbols && symMap["$" +
|
|
1611
|
+
if (hasShammedSymbols && symMap["$" + key2] instanceof Symbol) {
|
|
1612
1612
|
continue;
|
|
1613
|
-
} else if ($test.call(/[^\w$]/,
|
|
1614
|
-
xs.push(inspect(
|
|
1613
|
+
} else if ($test.call(/[^\w$]/, key2)) {
|
|
1614
|
+
xs.push(inspect(key2, obj) + ": " + inspect(obj[key2], obj));
|
|
1615
1615
|
} else {
|
|
1616
|
-
xs.push(
|
|
1616
|
+
xs.push(key2 + ": " + inspect(obj[key2], obj));
|
|
1617
1617
|
}
|
|
1618
1618
|
}
|
|
1619
1619
|
if (typeof gOPS === "function") {
|
|
@@ -2431,8 +2431,8 @@ var require_property_descriptor = __commonJS({
|
|
|
2431
2431
|
if (!Desc || typeof Desc !== "object") {
|
|
2432
2432
|
return false;
|
|
2433
2433
|
}
|
|
2434
|
-
for (var
|
|
2435
|
-
if (hasOwn(Desc,
|
|
2434
|
+
for (var key2 in Desc) {
|
|
2435
|
+
if (hasOwn(Desc, key2) && !allowed[key2]) {
|
|
2436
2436
|
return false;
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
@@ -2711,11 +2711,11 @@ var require_DefineMethodProperty = __commonJS({
|
|
|
2711
2711
|
var IsExtensible = import_IsExtensible.default;
|
|
2712
2712
|
var IsPropertyKey = import_IsPropertyKey.default;
|
|
2713
2713
|
var Type = import_Type.default;
|
|
2714
|
-
module.exports = function DefineMethodProperty(homeObject,
|
|
2714
|
+
module.exports = function DefineMethodProperty(homeObject, key2, closure, enumerable) {
|
|
2715
2715
|
if (Type(homeObject) !== "Object") {
|
|
2716
2716
|
throw new $TypeError("Assertion failed: `homeObject` is not an Object");
|
|
2717
2717
|
}
|
|
2718
|
-
if (!IsPropertyKey(
|
|
2718
|
+
if (!IsPropertyKey(key2)) {
|
|
2719
2719
|
throw new $TypeError("Assertion failed: `key` is not a Property Key or a Private Name");
|
|
2720
2720
|
}
|
|
2721
2721
|
if (typeof closure !== "function") {
|
|
@@ -2734,7 +2734,7 @@ var require_DefineMethodProperty = __commonJS({
|
|
|
2734
2734
|
"[[Enumerable]]": enumerable,
|
|
2735
2735
|
"[[Configurable]]": true
|
|
2736
2736
|
};
|
|
2737
|
-
DefinePropertyOrThrow(homeObject,
|
|
2737
|
+
DefinePropertyOrThrow(homeObject, key2, desc);
|
|
2738
2738
|
};
|
|
2739
2739
|
}
|
|
2740
2740
|
});
|
|
@@ -2770,11 +2770,11 @@ var require_side_channel = __commonJS({
|
|
|
2770
2770
|
var $mapGet = callBound("Map.prototype.get", true);
|
|
2771
2771
|
var $mapSet = callBound("Map.prototype.set", true);
|
|
2772
2772
|
var $mapHas = callBound("Map.prototype.has", true);
|
|
2773
|
-
var listGetNode = function(list,
|
|
2773
|
+
var listGetNode = function(list, key2) {
|
|
2774
2774
|
var prev = list;
|
|
2775
2775
|
var curr;
|
|
2776
2776
|
for (; (curr = prev.next) !== null; prev = curr) {
|
|
2777
|
-
if (curr.key ===
|
|
2777
|
+
if (curr.key === key2) {
|
|
2778
2778
|
prev.next = curr.next;
|
|
2779
2779
|
curr.next = /** @type {NonNullable<typeof list.next>} */
|
|
2780
2780
|
list.next;
|
|
@@ -2783,84 +2783,84 @@ var require_side_channel = __commonJS({
|
|
|
2783
2783
|
}
|
|
2784
2784
|
}
|
|
2785
2785
|
};
|
|
2786
|
-
var listGet = function(objects,
|
|
2787
|
-
var node = listGetNode(objects,
|
|
2786
|
+
var listGet = function(objects, key2) {
|
|
2787
|
+
var node = listGetNode(objects, key2);
|
|
2788
2788
|
return node && node.value;
|
|
2789
2789
|
};
|
|
2790
|
-
var listSet = function(objects,
|
|
2791
|
-
var node = listGetNode(objects,
|
|
2790
|
+
var listSet = function(objects, key2, value) {
|
|
2791
|
+
var node = listGetNode(objects, key2);
|
|
2792
2792
|
if (node) {
|
|
2793
2793
|
node.value = value;
|
|
2794
2794
|
} else {
|
|
2795
2795
|
objects.next = /** @type {import('.').ListNode<typeof value>} */
|
|
2796
2796
|
{
|
|
2797
2797
|
// eslint-disable-line no-param-reassign, no-extra-parens
|
|
2798
|
-
key,
|
|
2798
|
+
key: key2,
|
|
2799
2799
|
next: objects.next,
|
|
2800
2800
|
value
|
|
2801
2801
|
};
|
|
2802
2802
|
}
|
|
2803
2803
|
};
|
|
2804
|
-
var listHas = function(objects,
|
|
2805
|
-
return !!listGetNode(objects,
|
|
2804
|
+
var listHas = function(objects, key2) {
|
|
2805
|
+
return !!listGetNode(objects, key2);
|
|
2806
2806
|
};
|
|
2807
2807
|
module.exports = function getSideChannel() {
|
|
2808
2808
|
var $wm;
|
|
2809
2809
|
var $m;
|
|
2810
2810
|
var $o;
|
|
2811
2811
|
var channel = {
|
|
2812
|
-
assert: function(
|
|
2813
|
-
if (!channel.has(
|
|
2814
|
-
throw new $TypeError("Side channel does not contain " + inspect(
|
|
2812
|
+
assert: function(key2) {
|
|
2813
|
+
if (!channel.has(key2)) {
|
|
2814
|
+
throw new $TypeError("Side channel does not contain " + inspect(key2));
|
|
2815
2815
|
}
|
|
2816
2816
|
},
|
|
2817
|
-
get: function(
|
|
2818
|
-
if ($WeakMap &&
|
|
2817
|
+
get: function(key2) {
|
|
2818
|
+
if ($WeakMap && key2 && (typeof key2 === "object" || typeof key2 === "function")) {
|
|
2819
2819
|
if ($wm) {
|
|
2820
|
-
return $weakMapGet($wm,
|
|
2820
|
+
return $weakMapGet($wm, key2);
|
|
2821
2821
|
}
|
|
2822
2822
|
} else if ($Map) {
|
|
2823
2823
|
if ($m) {
|
|
2824
|
-
return $mapGet($m,
|
|
2824
|
+
return $mapGet($m, key2);
|
|
2825
2825
|
}
|
|
2826
2826
|
} else {
|
|
2827
2827
|
if ($o) {
|
|
2828
|
-
return listGet($o,
|
|
2828
|
+
return listGet($o, key2);
|
|
2829
2829
|
}
|
|
2830
2830
|
}
|
|
2831
2831
|
},
|
|
2832
|
-
has: function(
|
|
2833
|
-
if ($WeakMap &&
|
|
2832
|
+
has: function(key2) {
|
|
2833
|
+
if ($WeakMap && key2 && (typeof key2 === "object" || typeof key2 === "function")) {
|
|
2834
2834
|
if ($wm) {
|
|
2835
|
-
return $weakMapHas($wm,
|
|
2835
|
+
return $weakMapHas($wm, key2);
|
|
2836
2836
|
}
|
|
2837
2837
|
} else if ($Map) {
|
|
2838
2838
|
if ($m) {
|
|
2839
|
-
return $mapHas($m,
|
|
2839
|
+
return $mapHas($m, key2);
|
|
2840
2840
|
}
|
|
2841
2841
|
} else {
|
|
2842
2842
|
if ($o) {
|
|
2843
|
-
return listHas($o,
|
|
2843
|
+
return listHas($o, key2);
|
|
2844
2844
|
}
|
|
2845
2845
|
}
|
|
2846
2846
|
return false;
|
|
2847
2847
|
},
|
|
2848
|
-
set: function(
|
|
2849
|
-
if ($WeakMap &&
|
|
2848
|
+
set: function(key2, value) {
|
|
2849
|
+
if ($WeakMap && key2 && (typeof key2 === "object" || typeof key2 === "function")) {
|
|
2850
2850
|
if (!$wm) {
|
|
2851
2851
|
$wm = new $WeakMap();
|
|
2852
2852
|
}
|
|
2853
|
-
$weakMapSet($wm,
|
|
2853
|
+
$weakMapSet($wm, key2, value);
|
|
2854
2854
|
} else if ($Map) {
|
|
2855
2855
|
if (!$m) {
|
|
2856
2856
|
$m = new $Map();
|
|
2857
2857
|
}
|
|
2858
|
-
$mapSet($m,
|
|
2858
|
+
$mapSet($m, key2, value);
|
|
2859
2859
|
} else {
|
|
2860
2860
|
if (!$o) {
|
|
2861
2861
|
$o = { key: {}, next: null };
|
|
2862
2862
|
}
|
|
2863
|
-
listSet($o,
|
|
2863
|
+
listSet($o, key2, value);
|
|
2864
2864
|
}
|
|
2865
2865
|
}
|
|
2866
2866
|
};
|
|
@@ -3964,26 +3964,26 @@ var require_querystringify = __commonJS({
|
|
|
3964
3964
|
function querystring(query) {
|
|
3965
3965
|
var parser4 = /([^=?#&]+)=?([^&]*)/g, result = {}, part;
|
|
3966
3966
|
while (part = parser4.exec(query)) {
|
|
3967
|
-
var
|
|
3968
|
-
if (
|
|
3969
|
-
result[
|
|
3967
|
+
var key2 = decode(part[1]), value = decode(part[2]);
|
|
3968
|
+
if (key2 === null || value === null || key2 in result) continue;
|
|
3969
|
+
result[key2] = value;
|
|
3970
3970
|
}
|
|
3971
3971
|
return result;
|
|
3972
3972
|
}
|
|
3973
3973
|
function querystringify(obj, prefix) {
|
|
3974
3974
|
prefix = prefix || "";
|
|
3975
|
-
var pairs = [], value,
|
|
3975
|
+
var pairs = [], value, key2;
|
|
3976
3976
|
if ("string" !== typeof prefix) prefix = "?";
|
|
3977
|
-
for (
|
|
3978
|
-
if (has.call(obj,
|
|
3979
|
-
value = obj[
|
|
3977
|
+
for (key2 in obj) {
|
|
3978
|
+
if (has.call(obj, key2)) {
|
|
3979
|
+
value = obj[key2];
|
|
3980
3980
|
if (!value && (value === null || value === undef || isNaN(value))) {
|
|
3981
3981
|
value = "";
|
|
3982
3982
|
}
|
|
3983
|
-
|
|
3983
|
+
key2 = encode(key2);
|
|
3984
3984
|
value = encode(value);
|
|
3985
|
-
if (
|
|
3986
|
-
pairs.push(
|
|
3985
|
+
if (key2 === null || value === null) continue;
|
|
3986
|
+
pairs.push(key2 + "=" + value);
|
|
3987
3987
|
}
|
|
3988
3988
|
}
|
|
3989
3989
|
return pairs.length ? prefix + pairs.join("&") : "";
|
|
@@ -4141,11 +4141,11 @@ var require_cjs = __commonJS({
|
|
|
4141
4141
|
return cloneUnlessOtherwiseSpecified(element, options);
|
|
4142
4142
|
});
|
|
4143
4143
|
}
|
|
4144
|
-
function getMergeFunction(
|
|
4144
|
+
function getMergeFunction(key2, options) {
|
|
4145
4145
|
if (!options.customMerge) {
|
|
4146
4146
|
return deepmerge2;
|
|
4147
4147
|
}
|
|
4148
|
-
var customMerge = options.customMerge(
|
|
4148
|
+
var customMerge = options.customMerge(key2);
|
|
4149
4149
|
return typeof customMerge === "function" ? customMerge : deepmerge2;
|
|
4150
4150
|
}
|
|
4151
4151
|
function getEnumerableOwnPropertySymbols(target) {
|
|
@@ -4163,24 +4163,24 @@ var require_cjs = __commonJS({
|
|
|
4163
4163
|
return false;
|
|
4164
4164
|
}
|
|
4165
4165
|
}
|
|
4166
|
-
function propertyIsUnsafe(target,
|
|
4167
|
-
return propertyIsOnObject(target,
|
|
4166
|
+
function propertyIsUnsafe(target, key2) {
|
|
4167
|
+
return propertyIsOnObject(target, key2) && !(Object.hasOwnProperty.call(target, key2) && Object.propertyIsEnumerable.call(target, key2));
|
|
4168
4168
|
}
|
|
4169
4169
|
function mergeObject(target, source, options) {
|
|
4170
4170
|
var destination = {};
|
|
4171
4171
|
if (options.isMergeableObject(target)) {
|
|
4172
|
-
getKeys(target).forEach(function(
|
|
4173
|
-
destination[
|
|
4172
|
+
getKeys(target).forEach(function(key2) {
|
|
4173
|
+
destination[key2] = cloneUnlessOtherwiseSpecified(target[key2], options);
|
|
4174
4174
|
});
|
|
4175
4175
|
}
|
|
4176
|
-
getKeys(source).forEach(function(
|
|
4177
|
-
if (propertyIsUnsafe(target,
|
|
4176
|
+
getKeys(source).forEach(function(key2) {
|
|
4177
|
+
if (propertyIsUnsafe(target, key2)) {
|
|
4178
4178
|
return;
|
|
4179
4179
|
}
|
|
4180
|
-
if (propertyIsOnObject(target,
|
|
4181
|
-
destination[
|
|
4180
|
+
if (propertyIsOnObject(target, key2) && options.isMergeableObject(source[key2])) {
|
|
4181
|
+
destination[key2] = getMergeFunction(key2, options)(target[key2], source[key2], options);
|
|
4182
4182
|
} else {
|
|
4183
|
-
destination[
|
|
4183
|
+
destination[key2] = cloneUnlessOtherwiseSpecified(source[key2], options);
|
|
4184
4184
|
}
|
|
4185
4185
|
});
|
|
4186
4186
|
return destination;
|
|
@@ -4222,7 +4222,7 @@ var require_fast_deep_equal = __commonJS({
|
|
|
4222
4222
|
if (a === b) return true;
|
|
4223
4223
|
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
4224
4224
|
if (a.constructor !== b.constructor) return false;
|
|
4225
|
-
var length, i,
|
|
4225
|
+
var length, i, keys;
|
|
4226
4226
|
if (Array.isArray(a)) {
|
|
4227
4227
|
length = a.length;
|
|
4228
4228
|
if (length != b.length) return false;
|
|
@@ -4233,14 +4233,14 @@ var require_fast_deep_equal = __commonJS({
|
|
|
4233
4233
|
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
4234
4234
|
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
4235
4235
|
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
4236
|
-
|
|
4237
|
-
length =
|
|
4236
|
+
keys = Object.keys(a);
|
|
4237
|
+
length = keys.length;
|
|
4238
4238
|
if (length !== Object.keys(b).length) return false;
|
|
4239
4239
|
for (i = length; i-- !== 0; )
|
|
4240
|
-
if (!Object.prototype.hasOwnProperty.call(b,
|
|
4240
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
4241
4241
|
for (i = length; i-- !== 0; ) {
|
|
4242
|
-
var
|
|
4243
|
-
if (!equal(a[
|
|
4242
|
+
var key2 = keys[i];
|
|
4243
|
+
if (!equal(a[key2], b[key2])) return false;
|
|
4244
4244
|
}
|
|
4245
4245
|
return true;
|
|
4246
4246
|
}
|
|
@@ -4308,13 +4308,13 @@ var require_object = __commonJS({
|
|
|
4308
4308
|
props = [props];
|
|
4309
4309
|
}
|
|
4310
4310
|
var isFunction3 = typeof fn === "function";
|
|
4311
|
-
var
|
|
4311
|
+
var keys = Object.keys(obj);
|
|
4312
4312
|
var res = {};
|
|
4313
|
-
for (var i = 0; i <
|
|
4314
|
-
var
|
|
4315
|
-
var val = obj[
|
|
4316
|
-
if (!props || props.indexOf(
|
|
4317
|
-
res[
|
|
4313
|
+
for (var i = 0; i < keys.length; i++) {
|
|
4314
|
+
var key2 = keys[i];
|
|
4315
|
+
var val = obj[key2];
|
|
4316
|
+
if (!props || props.indexOf(key2) === -1 && (!isFunction3 || fn(val, key2, obj))) {
|
|
4317
|
+
res[key2] = val;
|
|
4318
4318
|
}
|
|
4319
4319
|
}
|
|
4320
4320
|
return res;
|
|
@@ -4327,23 +4327,23 @@ var require_object2 = __commonJS({
|
|
|
4327
4327
|
"node_modules/object.pick/index.js"(exports, module) {
|
|
4328
4328
|
var import_isobject = __toESM(require_isobject());
|
|
4329
4329
|
var isObject = import_isobject.default;
|
|
4330
|
-
module.exports = function pick2(obj,
|
|
4330
|
+
module.exports = function pick2(obj, keys) {
|
|
4331
4331
|
if (!isObject(obj) && typeof obj !== "function") {
|
|
4332
4332
|
return {};
|
|
4333
4333
|
}
|
|
4334
4334
|
var res = {};
|
|
4335
|
-
if (typeof
|
|
4336
|
-
if (
|
|
4337
|
-
res[
|
|
4335
|
+
if (typeof keys === "string") {
|
|
4336
|
+
if (keys in obj) {
|
|
4337
|
+
res[keys] = obj[keys];
|
|
4338
4338
|
}
|
|
4339
4339
|
return res;
|
|
4340
4340
|
}
|
|
4341
|
-
var len =
|
|
4341
|
+
var len = keys.length;
|
|
4342
4342
|
var idx = -1;
|
|
4343
4343
|
while (++idx < len) {
|
|
4344
|
-
var
|
|
4345
|
-
if (
|
|
4346
|
-
res[
|
|
4344
|
+
var key2 = keys[idx];
|
|
4345
|
+
if (key2 in obj) {
|
|
4346
|
+
res[key2] = obj[key2];
|
|
4347
4347
|
}
|
|
4348
4348
|
}
|
|
4349
4349
|
return res;
|
|
@@ -5883,10 +5883,10 @@ var MfCodemirrorView = class {
|
|
|
5883
5883
|
this.options?.onValueChange?.(tr.state.doc.toString());
|
|
5884
5884
|
}
|
|
5885
5885
|
}
|
|
5886
|
-
asProseMirrorSelection(
|
|
5886
|
+
asProseMirrorSelection(doc) {
|
|
5887
5887
|
const start = this.getPos() + 1;
|
|
5888
5888
|
const { anchor, head } = this.cm.state.selection.main;
|
|
5889
|
-
return TextSelection.between(
|
|
5889
|
+
return TextSelection.between(doc.resolve(anchor + start), doc.resolve(head + start));
|
|
5890
5890
|
}
|
|
5891
5891
|
codeMirrorKeymap() {
|
|
5892
5892
|
const keymaps = [
|
|
@@ -6054,7 +6054,7 @@ import { memo } from "react";
|
|
|
6054
6054
|
import { jsx } from "react/jsx-runtime";
|
|
6055
6055
|
var Text = memo(({ children, ...props }) => {
|
|
6056
6056
|
const { getRootProps } = useRemirrorContext();
|
|
6057
|
-
const { key, ...rootProps } = getRootProps();
|
|
6057
|
+
const { key: key2, ...rootProps } = getRootProps();
|
|
6058
6058
|
const style = Object.assign(
|
|
6059
6059
|
{
|
|
6060
6060
|
position: "relative"
|
|
@@ -6091,7 +6091,6 @@ var rule = (state) => {
|
|
|
6091
6091
|
let edited = false;
|
|
6092
6092
|
const tokens = state.tokens;
|
|
6093
6093
|
const tokensLength = tokens.length;
|
|
6094
|
-
console.log("tokens", tokens);
|
|
6095
6094
|
for (let i = tokensLength - 3; i >= 0; i--) {
|
|
6096
6095
|
if (isBulletListItemToken(tokens[i]) && isParagraphOpenToken(tokens[i + 1]) && isInlineToken(tokens[i + 2])) {
|
|
6097
6096
|
const inlineToken = tokens[i + 2];
|
|
@@ -6146,7 +6145,7 @@ function buildHtmlStringFromAst(ast) {
|
|
|
6146
6145
|
if (ast.attrs) {
|
|
6147
6146
|
const filteredAttrs = Object.entries(ast.attrs).filter(([, value]) => value);
|
|
6148
6147
|
if (filteredAttrs.length) {
|
|
6149
|
-
attrs = `${filteredAttrs.map(([
|
|
6148
|
+
attrs = `${filteredAttrs.map(([key2, value]) => `${key2}="${value}"`).join(" ")}`;
|
|
6150
6149
|
}
|
|
6151
6150
|
}
|
|
6152
6151
|
if (ast.voidElement) {
|
|
@@ -6514,13 +6513,13 @@ var MarkdownParser = class {
|
|
|
6514
6513
|
}
|
|
6515
6514
|
parse(text) {
|
|
6516
6515
|
const state = new MarkdownParseState(this.schema, this.tokenHandlers);
|
|
6517
|
-
let
|
|
6516
|
+
let doc;
|
|
6518
6517
|
const mdTokens = this.tokenizer.parse(text, {});
|
|
6519
6518
|
state.parseTokens(mdTokens);
|
|
6520
6519
|
do {
|
|
6521
|
-
|
|
6520
|
+
doc = state.closeNode();
|
|
6522
6521
|
} while (state.stack.length);
|
|
6523
|
-
return
|
|
6522
|
+
return doc;
|
|
6524
6523
|
}
|
|
6525
6524
|
};
|
|
6526
6525
|
|
|
@@ -6628,11 +6627,11 @@ import { Decoration, DecorationSet } from "@remirror/pm/view";
|
|
|
6628
6627
|
function createElement(tagName, attributes, ...children) {
|
|
6629
6628
|
const element = document.createElement(tagName);
|
|
6630
6629
|
if (attributes) {
|
|
6631
|
-
Object.entries(attributes).forEach(([
|
|
6630
|
+
Object.entries(attributes).forEach(([key2, value]) => {
|
|
6632
6631
|
if (typeof value === "string") {
|
|
6633
|
-
element.setAttribute(
|
|
6632
|
+
element.setAttribute(key2, value);
|
|
6634
6633
|
} else {
|
|
6635
|
-
element[
|
|
6634
|
+
element[key2] = value;
|
|
6636
6635
|
}
|
|
6637
6636
|
});
|
|
6638
6637
|
}
|
|
@@ -6784,7 +6783,7 @@ function createColumnSelector(view, getPos, highlight) {
|
|
|
6784
6783
|
});
|
|
6785
6784
|
}
|
|
6786
6785
|
function createSelectorDecorations(state) {
|
|
6787
|
-
const { doc
|
|
6786
|
+
const { doc, selection } = state;
|
|
6788
6787
|
const table = findTable(selection);
|
|
6789
6788
|
if (!table) {
|
|
6790
6789
|
return DecorationSet.empty;
|
|
@@ -6847,7 +6846,7 @@ function createSelectorDecorations(state) {
|
|
|
6847
6846
|
)
|
|
6848
6847
|
);
|
|
6849
6848
|
});
|
|
6850
|
-
return DecorationSet.create(
|
|
6849
|
+
return DecorationSet.create(doc, decos);
|
|
6851
6850
|
}
|
|
6852
6851
|
|
|
6853
6852
|
// src/editor/extensions/Table/table-selector-extension.ts
|
|
@@ -6866,33 +6865,109 @@ var LineTableExtension = class extends TableExtension {
|
|
|
6866
6865
|
super(...arguments);
|
|
6867
6866
|
this.createKeymap = () => {
|
|
6868
6867
|
const schema = this.store.schema;
|
|
6869
|
-
return
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6868
|
+
return {
|
|
6869
|
+
...buildBlockEnterKeymap(
|
|
6870
|
+
/^\|((?:[^\|]+\|){2,})\s*$/,
|
|
6871
|
+
({ match }) => {
|
|
6872
|
+
const texts = match[1].split("|").slice(0, -1).map((text) => {
|
|
6873
|
+
text = text.trim();
|
|
6874
|
+
if (!text) text = " ";
|
|
6875
|
+
return schema.text(text);
|
|
6876
|
+
});
|
|
6877
|
+
const cells1 = texts.map((text) => schema.nodes.tableCell.create(null, text));
|
|
6878
|
+
const cells2 = texts.map(() => schema.nodes.tableCell.create(null));
|
|
6879
|
+
const row1 = schema.nodes.tableRow.create(null, cells1);
|
|
6880
|
+
const row2 = schema.nodes.tableRow.create(null, cells2);
|
|
6881
|
+
const table = schema.nodes.table.create(null, [row1, row2]);
|
|
6882
|
+
return table;
|
|
6883
|
+
},
|
|
6884
|
+
({ tr }) => {
|
|
6885
|
+
const $cursor = tr.selection?.$cursor;
|
|
6886
|
+
if (!$cursor) {
|
|
6887
|
+
return tr;
|
|
6888
|
+
} else {
|
|
6889
|
+
const depth = $cursor.depth - 1;
|
|
6890
|
+
const pos = $cursor.posAtIndex($cursor.index(depth) - 1, depth);
|
|
6891
|
+
const $pos = tr.doc.resolve(pos);
|
|
6892
|
+
return tr.setSelection(TextSelection2.near($pos));
|
|
6893
|
+
}
|
|
6894
|
+
}
|
|
6895
|
+
),
|
|
6896
|
+
ArrowUp: ({ state, dispatch }) => {
|
|
6897
|
+
const { selection } = state;
|
|
6898
|
+
const { $head } = selection;
|
|
6899
|
+
const cell = findParentNodeOfType3({ selection: $head, types: "tableCell" });
|
|
6900
|
+
if (!cell) return false;
|
|
6901
|
+
const cellNode = cell.node;
|
|
6902
|
+
const cellContent = cellNode.content;
|
|
6903
|
+
const posInCell = $head.pos - cell.pos - 1;
|
|
6904
|
+
const nodePositions = getNodePositionByCellContent(cellContent);
|
|
6905
|
+
let isAtFirstLine = posInCell <= nodePositions[0].end;
|
|
6906
|
+
if (!isAtFirstLine) return false;
|
|
6907
|
+
const table = findTable(selection);
|
|
6908
|
+
if (!table) return false;
|
|
6909
|
+
const map = TableMap4.get(table.node);
|
|
6910
|
+
const cellPos = cell.pos;
|
|
6911
|
+
const cellIndex = cellPos - table.start;
|
|
6912
|
+
let cellRow = -1;
|
|
6913
|
+
let cellCol = -1;
|
|
6914
|
+
for (let row = 0; row < map.height; row++) {
|
|
6915
|
+
for (let col = 0; col < map.width; col++) {
|
|
6916
|
+
const index = row * map.width + col;
|
|
6917
|
+
if (map.map[index] === cellIndex) {
|
|
6918
|
+
cellRow = row;
|
|
6919
|
+
cellCol = col;
|
|
6920
|
+
break;
|
|
6921
|
+
}
|
|
6922
|
+
}
|
|
6923
|
+
if (cellRow !== -1) break;
|
|
6924
|
+
}
|
|
6925
|
+
if (cellRow === -1 || cellRow === 0) return false;
|
|
6926
|
+
const targetCellIndex = map.map[(cellRow - 1) * map.width + cellCol];
|
|
6927
|
+
if (targetCellIndex === void 0) return false;
|
|
6928
|
+
const targetPos = table.start + targetCellIndex;
|
|
6929
|
+
const tr = state.tr.setSelection(TextSelection2.near(state.doc.resolve(targetPos + 1)));
|
|
6930
|
+
if (dispatch) dispatch(tr);
|
|
6931
|
+
return true;
|
|
6883
6932
|
},
|
|
6884
|
-
({
|
|
6885
|
-
const
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6933
|
+
ArrowDown: ({ state, dispatch }) => {
|
|
6934
|
+
const { selection } = state;
|
|
6935
|
+
const { $head } = selection;
|
|
6936
|
+
const cell = findParentNodeOfType3({ selection: $head, types: "tableCell" });
|
|
6937
|
+
if (!cell) return false;
|
|
6938
|
+
const cellNode = cell.node;
|
|
6939
|
+
const cellContent = cellNode.content;
|
|
6940
|
+
const posInCell = $head.pos - cell.pos - 1;
|
|
6941
|
+
const nodePositions = getNodePositionByCellContent(cellContent);
|
|
6942
|
+
let isAtLastLine = posInCell >= nodePositions[nodePositions.length - 1].start;
|
|
6943
|
+
if (!isAtLastLine) return false;
|
|
6944
|
+
const table = findTable(selection);
|
|
6945
|
+
if (!table) return false;
|
|
6946
|
+
const map = TableMap4.get(table.node);
|
|
6947
|
+
const cellPos = cell.pos;
|
|
6948
|
+
const cellIndex = cellPos - table.start;
|
|
6949
|
+
let cellRow = -1;
|
|
6950
|
+
let cellCol = -1;
|
|
6951
|
+
for (let row = 0; row < map.height; row++) {
|
|
6952
|
+
for (let col = 0; col < map.width; col++) {
|
|
6953
|
+
const index = row * map.width + col;
|
|
6954
|
+
if (map.map[index] === cellIndex) {
|
|
6955
|
+
cellRow = row;
|
|
6956
|
+
cellCol = col;
|
|
6957
|
+
break;
|
|
6958
|
+
}
|
|
6959
|
+
}
|
|
6960
|
+
if (cellRow !== -1) break;
|
|
6893
6961
|
}
|
|
6962
|
+
if (cellRow === -1 || cellRow === map.height - 1) return false;
|
|
6963
|
+
const targetCellIndex = map.map[(cellRow + 1) * map.width + cellCol];
|
|
6964
|
+
if (targetCellIndex === void 0) return false;
|
|
6965
|
+
const targetPos = table.start + targetCellIndex;
|
|
6966
|
+
const tr = state.tr.setSelection(TextSelection2.near(state.doc.resolve(targetPos + 1)));
|
|
6967
|
+
if (dispatch) dispatch(tr);
|
|
6968
|
+
return true;
|
|
6894
6969
|
}
|
|
6895
|
-
|
|
6970
|
+
};
|
|
6896
6971
|
};
|
|
6897
6972
|
}
|
|
6898
6973
|
get name() {
|
|
@@ -7021,87 +7096,6 @@ var LineTableHeaderCellExtension = class extends TableHeaderCellExtension {
|
|
|
7021
7096
|
}
|
|
7022
7097
|
};
|
|
7023
7098
|
var LineTableCellExtension = class extends TableCellExtension {
|
|
7024
|
-
constructor() {
|
|
7025
|
-
super(...arguments);
|
|
7026
|
-
this.createKeymap = () => {
|
|
7027
|
-
return {
|
|
7028
|
-
ArrowUp: ({ state, dispatch }) => {
|
|
7029
|
-
const { selection } = state;
|
|
7030
|
-
const { $head } = selection;
|
|
7031
|
-
const cell = findParentNodeOfType3({ selection: $head, types: "tableCell" });
|
|
7032
|
-
if (!cell) return false;
|
|
7033
|
-
const cellNode = cell.node;
|
|
7034
|
-
const cellContent = cellNode.content;
|
|
7035
|
-
const posInCell = $head.pos - cell.pos - 1;
|
|
7036
|
-
const nodePositions = getNodePositionByCellContent(cellContent);
|
|
7037
|
-
let isAtFirstLine = posInCell <= nodePositions[0].end;
|
|
7038
|
-
if (!isAtFirstLine) return false;
|
|
7039
|
-
const table = findTable(selection);
|
|
7040
|
-
if (!table) return false;
|
|
7041
|
-
const map = TableMap4.get(table.node);
|
|
7042
|
-
const cellPos = cell.pos;
|
|
7043
|
-
const cellIndex = cellPos - table.start;
|
|
7044
|
-
let cellRow = -1;
|
|
7045
|
-
let cellCol = -1;
|
|
7046
|
-
for (let row = 0; row < map.height; row++) {
|
|
7047
|
-
for (let col = 0; col < map.width; col++) {
|
|
7048
|
-
const index = row * map.width + col;
|
|
7049
|
-
if (map.map[index] === cellIndex) {
|
|
7050
|
-
cellRow = row;
|
|
7051
|
-
cellCol = col;
|
|
7052
|
-
break;
|
|
7053
|
-
}
|
|
7054
|
-
}
|
|
7055
|
-
if (cellRow !== -1) break;
|
|
7056
|
-
}
|
|
7057
|
-
if (cellRow === -1 || cellRow === 0) return false;
|
|
7058
|
-
const targetCellIndex = map.map[(cellRow - 1) * map.width + cellCol];
|
|
7059
|
-
if (targetCellIndex === void 0) return false;
|
|
7060
|
-
const targetPos = table.start + targetCellIndex;
|
|
7061
|
-
const tr = state.tr.setSelection(TextSelection2.near(state.doc.resolve(targetPos + 1)));
|
|
7062
|
-
if (dispatch) dispatch(tr);
|
|
7063
|
-
return true;
|
|
7064
|
-
},
|
|
7065
|
-
ArrowDown: ({ state, dispatch }) => {
|
|
7066
|
-
const { selection } = state;
|
|
7067
|
-
const { $head } = selection;
|
|
7068
|
-
const cell = findParentNodeOfType3({ selection: $head, types: "tableCell" });
|
|
7069
|
-
if (!cell) return false;
|
|
7070
|
-
const cellNode = cell.node;
|
|
7071
|
-
const cellContent = cellNode.content;
|
|
7072
|
-
const posInCell = $head.pos - cell.pos - 1;
|
|
7073
|
-
const nodePositions = getNodePositionByCellContent(cellContent);
|
|
7074
|
-
let isAtLastLine = posInCell >= nodePositions[nodePositions.length - 1].start;
|
|
7075
|
-
if (!isAtLastLine) return false;
|
|
7076
|
-
const table = findTable(selection);
|
|
7077
|
-
if (!table) return false;
|
|
7078
|
-
const map = TableMap4.get(table.node);
|
|
7079
|
-
const cellPos = cell.pos;
|
|
7080
|
-
const cellIndex = cellPos - table.start;
|
|
7081
|
-
let cellRow = -1;
|
|
7082
|
-
let cellCol = -1;
|
|
7083
|
-
for (let row = 0; row < map.height; row++) {
|
|
7084
|
-
for (let col = 0; col < map.width; col++) {
|
|
7085
|
-
const index = row * map.width + col;
|
|
7086
|
-
if (map.map[index] === cellIndex) {
|
|
7087
|
-
cellRow = row;
|
|
7088
|
-
cellCol = col;
|
|
7089
|
-
break;
|
|
7090
|
-
}
|
|
7091
|
-
}
|
|
7092
|
-
if (cellRow !== -1) break;
|
|
7093
|
-
}
|
|
7094
|
-
if (cellRow === -1 || cellRow === map.height - 1) return false;
|
|
7095
|
-
const targetCellIndex = map.map[(cellRow + 1) * map.width + cellCol];
|
|
7096
|
-
if (targetCellIndex === void 0) return false;
|
|
7097
|
-
const targetPos = table.start + targetCellIndex;
|
|
7098
|
-
const tr = state.tr.setSelection(TextSelection2.near(state.doc.resolve(targetPos + 1)));
|
|
7099
|
-
if (dispatch) dispatch(tr);
|
|
7100
|
-
return true;
|
|
7101
|
-
}
|
|
7102
|
-
};
|
|
7103
|
-
};
|
|
7104
|
-
}
|
|
7105
7099
|
get name() {
|
|
7106
7100
|
return "tableCell";
|
|
7107
7101
|
}
|
|
@@ -7281,9 +7275,9 @@ function AINodeView(props) {
|
|
|
7281
7275
|
btnType: "primary",
|
|
7282
7276
|
onClick: () => {
|
|
7283
7277
|
if (generatedText) {
|
|
7284
|
-
const
|
|
7285
|
-
if (
|
|
7286
|
-
const transaction = props.view.state.tr.replaceWith(pos, pos + 1,
|
|
7278
|
+
const doc = transformer.stringToDoc?.(generatedText);
|
|
7279
|
+
if (doc && pos) {
|
|
7280
|
+
const transaction = props.view.state.tr.replaceWith(pos, pos + 1, doc);
|
|
7287
7281
|
props.view.dispatch(transaction);
|
|
7288
7282
|
}
|
|
7289
7283
|
}
|
|
@@ -7598,9 +7592,9 @@ var ClipboardExtension = class extends PlainExtension2 {
|
|
|
7598
7592
|
const isText = isPureText(slice.content.toJSON());
|
|
7599
7593
|
if (isText)
|
|
7600
7594
|
return slice.content.textBetween(0, slice.content.size, "\n\n");
|
|
7601
|
-
const
|
|
7602
|
-
if (!
|
|
7603
|
-
const value = serializer?.(
|
|
7595
|
+
const doc = schema.topNodeType.createAndFill(void 0, slice.content);
|
|
7596
|
+
if (!doc) return "";
|
|
7597
|
+
const value = serializer?.(doc) || "";
|
|
7604
7598
|
return value;
|
|
7605
7599
|
}
|
|
7606
7600
|
}
|
|
@@ -7787,11 +7781,11 @@ var FindExtension = class extends PlainExtension3 {
|
|
|
7787
7781
|
},
|
|
7788
7782
|
apply: (tr, old) => {
|
|
7789
7783
|
if (this._updating || tr.docChanged && this.options.alwaysFind) {
|
|
7790
|
-
const
|
|
7791
|
-
this._ranges = this.gatherFindResults(
|
|
7784
|
+
const doc = tr.doc;
|
|
7785
|
+
this._ranges = this.gatherFindResults(doc);
|
|
7792
7786
|
this.normalizeActiveIndex();
|
|
7793
7787
|
this.scrollToActiveResult();
|
|
7794
|
-
return this.createDecorationSet(
|
|
7788
|
+
return this.createDecorationSet(doc);
|
|
7795
7789
|
}
|
|
7796
7790
|
if (tr.docChanged) {
|
|
7797
7791
|
return old.map(tr.mapping, tr.doc);
|
|
@@ -7813,13 +7807,13 @@ var FindExtension = class extends PlainExtension3 {
|
|
|
7813
7807
|
this._activeIndex = activeIndex;
|
|
7814
7808
|
this._caseSensitive = caseSensitive ?? false;
|
|
7815
7809
|
}
|
|
7816
|
-
gatherFindResults(
|
|
7810
|
+
gatherFindResults(doc) {
|
|
7817
7811
|
if (!this._query) {
|
|
7818
7812
|
return [];
|
|
7819
7813
|
}
|
|
7820
7814
|
const re = new RegExp(this._query, this._caseSensitive ? "gu" : "gui");
|
|
7821
7815
|
const ranges = [];
|
|
7822
|
-
|
|
7816
|
+
doc.descendants((node, pos) => {
|
|
7823
7817
|
if (!node.isTextblock) {
|
|
7824
7818
|
return true;
|
|
7825
7819
|
}
|
|
@@ -7851,7 +7845,7 @@ var FindExtension = class extends PlainExtension3 {
|
|
|
7851
7845
|
this._activeIndex = rotateIndex(this._activeIndex, this._ranges.length);
|
|
7852
7846
|
}
|
|
7853
7847
|
}
|
|
7854
|
-
createDecorationSet(
|
|
7848
|
+
createDecorationSet(doc) {
|
|
7855
7849
|
const decorations = this._ranges.map(
|
|
7856
7850
|
(deco, index) => Decoration2.inline(
|
|
7857
7851
|
deco.from,
|
|
@@ -7859,7 +7853,7 @@ var FindExtension = class extends PlainExtension3 {
|
|
|
7859
7853
|
index === this._activeIndex ? this.options.activeDecoration : this.options.decoration
|
|
7860
7854
|
)
|
|
7861
7855
|
);
|
|
7862
|
-
return DecorationSet2.create(
|
|
7856
|
+
return DecorationSet2.create(doc, decorations);
|
|
7863
7857
|
}
|
|
7864
7858
|
/**
|
|
7865
7859
|
* Dispatch an empty transaction to trigger an update of the decoration.
|
|
@@ -7972,7 +7966,7 @@ var LineHeadingExtension = class extends HeadingExtension {
|
|
|
7972
7966
|
};
|
|
7973
7967
|
}
|
|
7974
7968
|
createKeymap() {
|
|
7975
|
-
const
|
|
7969
|
+
const keys = {
|
|
7976
7970
|
Backspace: ({ state, dispatch }) => {
|
|
7977
7971
|
const { selection } = state;
|
|
7978
7972
|
if (!selection.empty) {
|
|
@@ -7994,9 +7988,9 @@ var LineHeadingExtension = class extends HeadingExtension {
|
|
|
7994
7988
|
}
|
|
7995
7989
|
};
|
|
7996
7990
|
this.options.levels.forEach((level) => {
|
|
7997
|
-
|
|
7991
|
+
keys[`mod-${level}`] = convertCommand3(setBlockType(this.type, { level }));
|
|
7998
7992
|
});
|
|
7999
|
-
return
|
|
7993
|
+
return keys;
|
|
8000
7994
|
}
|
|
8001
7995
|
fromMarkdown() {
|
|
8002
7996
|
return [
|
|
@@ -13120,7 +13114,7 @@ var tags3 = /* @__PURE__ */ [
|
|
|
13120
13114
|
].map((name) => ({ type: "type", label: name }));
|
|
13121
13115
|
var identifier2 = /^(\w[\w-]*|-\w[\w-]*|)$/;
|
|
13122
13116
|
var variable = /^-(-[\w-]*)?$/;
|
|
13123
|
-
function isVarArg(node,
|
|
13117
|
+
function isVarArg(node, doc) {
|
|
13124
13118
|
var _a;
|
|
13125
13119
|
if (node.name == "(" || node.type.isError)
|
|
13126
13120
|
node = node.parent || node;
|
|
@@ -13129,7 +13123,7 @@ function isVarArg(node, doc2) {
|
|
|
13129
13123
|
let callee2 = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.firstChild;
|
|
13130
13124
|
if ((callee2 === null || callee2 === void 0 ? void 0 : callee2.name) != "Callee")
|
|
13131
13125
|
return false;
|
|
13132
|
-
return
|
|
13126
|
+
return doc.sliceString(callee2.from, callee2.to) == "var";
|
|
13133
13127
|
}
|
|
13134
13128
|
var VariablesByNode = /* @__PURE__ */ new NodeWeakMap();
|
|
13135
13129
|
var declSelector = ["Declaration"];
|
|
@@ -13141,7 +13135,7 @@ function astTop(node) {
|
|
|
13141
13135
|
return node;
|
|
13142
13136
|
}
|
|
13143
13137
|
}
|
|
13144
|
-
function variableNames(
|
|
13138
|
+
function variableNames(doc, node, isVariable) {
|
|
13145
13139
|
if (node.to - node.from > 4096) {
|
|
13146
13140
|
let known = VariablesByNode.get(node);
|
|
13147
13141
|
if (known)
|
|
@@ -13149,7 +13143,7 @@ function variableNames(doc2, node, isVariable) {
|
|
|
13149
13143
|
let result = [], seen = /* @__PURE__ */ new Set(), cursor = node.cursor(IterMode.IncludeAnonymous);
|
|
13150
13144
|
if (cursor.firstChild())
|
|
13151
13145
|
do {
|
|
13152
|
-
for (let option of variableNames(
|
|
13146
|
+
for (let option of variableNames(doc, cursor.node, isVariable))
|
|
13153
13147
|
if (!seen.has(option.label)) {
|
|
13154
13148
|
seen.add(option.label);
|
|
13155
13149
|
result.push(option);
|
|
@@ -13162,7 +13156,7 @@ function variableNames(doc2, node, isVariable) {
|
|
|
13162
13156
|
node.cursor().iterate((node2) => {
|
|
13163
13157
|
var _a;
|
|
13164
13158
|
if (isVariable(node2) && node2.matchContext(declSelector) && ((_a = node2.node.nextSibling) === null || _a === void 0 ? void 0 : _a.name) == ":") {
|
|
13165
|
-
let name =
|
|
13159
|
+
let name = doc.sliceString(node2.from, node2.to);
|
|
13166
13160
|
if (!seen.has(name)) {
|
|
13167
13161
|
seen.add(name);
|
|
13168
13162
|
result.push({ label: name, type: "variable" });
|
|
@@ -13540,13 +13534,13 @@ var gatherCompletions = {
|
|
|
13540
13534
|
},
|
|
13541
13535
|
__proto__: null
|
|
13542
13536
|
};
|
|
13543
|
-
function getScope(
|
|
13537
|
+
function getScope(doc, node) {
|
|
13544
13538
|
let cached = cache.get(node);
|
|
13545
13539
|
if (cached)
|
|
13546
13540
|
return cached;
|
|
13547
13541
|
let completions = [], top = true;
|
|
13548
13542
|
function def(node2, type) {
|
|
13549
|
-
let name =
|
|
13543
|
+
let name = doc.sliceString(node2.from, node2.to);
|
|
13550
13544
|
completions.push({ label: name, type });
|
|
13551
13545
|
}
|
|
13552
13546
|
node.cursor(IterMode.IncludeAnonymous).iterate((node2) => {
|
|
@@ -13557,7 +13551,7 @@ function getScope(doc2, node) {
|
|
|
13557
13551
|
if (gather && gather(node2, def) || ScopeNodes.has(node2.name))
|
|
13558
13552
|
return false;
|
|
13559
13553
|
} else if (node2.to - node2.from > 8192) {
|
|
13560
|
-
for (let c of getScope(
|
|
13554
|
+
for (let c of getScope(doc, node2.node))
|
|
13561
13555
|
completions.push(c);
|
|
13562
13556
|
return false;
|
|
13563
13557
|
}
|
|
@@ -13681,10 +13675,10 @@ function findOpenTag(node) {
|
|
|
13681
13675
|
node = node.parent;
|
|
13682
13676
|
}
|
|
13683
13677
|
}
|
|
13684
|
-
function elementName(
|
|
13678
|
+
function elementName(doc, tree, max3 = doc.length) {
|
|
13685
13679
|
for (let ch = tree === null || tree === void 0 ? void 0 : tree.firstChild; ch; ch = ch.nextSibling) {
|
|
13686
13680
|
if (ch.name == "JSXIdentifier" || ch.name == "JSXBuiltin" || ch.name == "JSXNamespacedName" || ch.name == "JSXMemberExpression")
|
|
13687
|
-
return
|
|
13681
|
+
return doc.sliceString(ch.from, Math.min(ch.to, max3));
|
|
13688
13682
|
}
|
|
13689
13683
|
return "";
|
|
13690
13684
|
}
|
|
@@ -14165,12 +14159,12 @@ var Schema = class {
|
|
|
14165
14159
|
}
|
|
14166
14160
|
};
|
|
14167
14161
|
Schema.default = /* @__PURE__ */ new Schema();
|
|
14168
|
-
function elementName2(
|
|
14162
|
+
function elementName2(doc, tree, max3 = doc.length) {
|
|
14169
14163
|
if (!tree)
|
|
14170
14164
|
return "";
|
|
14171
14165
|
let tag = tree.firstChild;
|
|
14172
14166
|
let name = tag && tag.getChild("TagName");
|
|
14173
|
-
return name ?
|
|
14167
|
+
return name ? doc.sliceString(name.from, Math.min(name.to, max3)) : "";
|
|
14174
14168
|
}
|
|
14175
14169
|
function findParentElement(tree, skip = false) {
|
|
14176
14170
|
for (; tree; tree = tree.parent)
|
|
@@ -14182,14 +14176,14 @@ function findParentElement(tree, skip = false) {
|
|
|
14182
14176
|
}
|
|
14183
14177
|
return null;
|
|
14184
14178
|
}
|
|
14185
|
-
function allowedChildren(
|
|
14186
|
-
let parentInfo = schema.tags[elementName2(
|
|
14179
|
+
function allowedChildren(doc, tree, schema) {
|
|
14180
|
+
let parentInfo = schema.tags[elementName2(doc, findParentElement(tree))];
|
|
14187
14181
|
return (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.children) || schema.allTags;
|
|
14188
14182
|
}
|
|
14189
|
-
function openTags(
|
|
14183
|
+
function openTags(doc, tree) {
|
|
14190
14184
|
let open = [];
|
|
14191
14185
|
for (let parent = findParentElement(tree); parent && !parent.type.isTop; parent = findParentElement(parent.parent)) {
|
|
14192
|
-
let tagName = elementName2(
|
|
14186
|
+
let tagName = elementName2(doc, parent);
|
|
14193
14187
|
if (tagName && parent.lastChild.name == "CloseTag")
|
|
14194
14188
|
break;
|
|
14195
14189
|
if (tagName && open.indexOf(tagName) < 0 && (tree.name == "EndTag" || tree.from >= parent.firstChild.to))
|
|
@@ -14856,8 +14850,8 @@ var HTMLInlineView = class {
|
|
|
14856
14850
|
}
|
|
14857
14851
|
const renderEl = document.createElement("span");
|
|
14858
14852
|
const domParser = new DOMParser();
|
|
14859
|
-
const
|
|
14860
|
-
|
|
14853
|
+
const doc = domParser.parseFromString(texString, "text/html");
|
|
14854
|
+
doc.body.childNodes.forEach((child) => {
|
|
14861
14855
|
if (isImageElement(child) && child.src && this.options.handleViewImgSrcUrl) {
|
|
14862
14856
|
let targetUrl = child.src;
|
|
14863
14857
|
if (child.src.includes(location.origin)) {
|
|
@@ -16203,18 +16197,18 @@ import { Step as Step2, StepResult as StepResult2 } from "@remirror/pm/transform
|
|
|
16203
16197
|
// src/editor/steps/replace-doc-step.ts
|
|
16204
16198
|
import { Step, StepMap, StepResult } from "@remirror/pm/transform";
|
|
16205
16199
|
var ReplaceDocStep = class _ReplaceDocStep extends Step {
|
|
16206
|
-
constructor(
|
|
16200
|
+
constructor(doc) {
|
|
16207
16201
|
super();
|
|
16208
|
-
this.doc =
|
|
16202
|
+
this.doc = doc;
|
|
16209
16203
|
}
|
|
16210
|
-
apply(
|
|
16211
|
-
return StepResult.ok(
|
|
16204
|
+
apply(doc) {
|
|
16205
|
+
return StepResult.ok(doc);
|
|
16212
16206
|
}
|
|
16213
16207
|
getMap() {
|
|
16214
16208
|
return StepMap.empty;
|
|
16215
16209
|
}
|
|
16216
|
-
invert(
|
|
16217
|
-
return new _ReplaceDocStep(
|
|
16210
|
+
invert(doc) {
|
|
16211
|
+
return new _ReplaceDocStep(doc);
|
|
16218
16212
|
}
|
|
16219
16213
|
map() {
|
|
16220
16214
|
return null;
|
|
@@ -16227,8 +16221,8 @@ var ReplaceDocStep = class _ReplaceDocStep extends Step {
|
|
|
16227
16221
|
}
|
|
16228
16222
|
/// @internal
|
|
16229
16223
|
static fromJSON(schema, json) {
|
|
16230
|
-
const
|
|
16231
|
-
return new _ReplaceDocStep(
|
|
16224
|
+
const doc = schema.nodeFromJSON(json.doc);
|
|
16225
|
+
return new _ReplaceDocStep(doc);
|
|
16232
16226
|
}
|
|
16233
16227
|
};
|
|
16234
16228
|
try {
|
|
@@ -16252,15 +16246,15 @@ var BatchSetMarkStep = class _BatchSetMarkStep extends Step2 {
|
|
|
16252
16246
|
super();
|
|
16253
16247
|
this.chunks = chunks;
|
|
16254
16248
|
}
|
|
16255
|
-
apply(
|
|
16249
|
+
apply(doc) {
|
|
16256
16250
|
const chunks = this.chunks;
|
|
16257
16251
|
const from = chunks[0][0];
|
|
16258
16252
|
const to = chunks[chunks.length - 1][1];
|
|
16259
|
-
const $from =
|
|
16260
|
-
const $to =
|
|
16253
|
+
const $from = doc.resolve(from);
|
|
16254
|
+
const $to = doc.resolve(to);
|
|
16261
16255
|
const depth = $from.sharedDepth(to);
|
|
16262
16256
|
const { start, parent } = new NodeRange($from, $to, depth);
|
|
16263
|
-
const oldSlice =
|
|
16257
|
+
const oldSlice = doc.slice(start, to);
|
|
16264
16258
|
let chunkIndex = 0, nodeHi, chunkLo, chunkHi, lo, hi, mark, expectedMarks, marks, node, nextNode;
|
|
16265
16259
|
const fragment = mapFragment(
|
|
16266
16260
|
oldSlice.content,
|
|
@@ -16317,14 +16311,14 @@ var BatchSetMarkStep = class _BatchSetMarkStep extends Step2 {
|
|
|
16317
16311
|
}
|
|
16318
16312
|
);
|
|
16319
16313
|
return StepResult2.fromReplace(
|
|
16320
|
-
|
|
16314
|
+
doc,
|
|
16321
16315
|
start,
|
|
16322
16316
|
to,
|
|
16323
16317
|
new Slice2(fragment, oldSlice.openStart, oldSlice.openEnd)
|
|
16324
16318
|
);
|
|
16325
16319
|
}
|
|
16326
|
-
invert(
|
|
16327
|
-
return new ReplaceDocStep(
|
|
16320
|
+
invert(doc) {
|
|
16321
|
+
return new ReplaceDocStep(doc);
|
|
16328
16322
|
}
|
|
16329
16323
|
map() {
|
|
16330
16324
|
return null;
|
|
@@ -16774,10 +16768,10 @@ function updateNodeMarks(tr, node, startPos, output) {
|
|
|
16774
16768
|
parseNode(schema, node, startPos, output);
|
|
16775
16769
|
}
|
|
16776
16770
|
}
|
|
16777
|
-
function initDocMarks(
|
|
16778
|
-
const tr = new Transform(
|
|
16771
|
+
function initDocMarks(doc) {
|
|
16772
|
+
const tr = new Transform(doc);
|
|
16779
16773
|
const output = [];
|
|
16780
|
-
updateNodeMarks(tr,
|
|
16774
|
+
updateNodeMarks(tr, doc, 0, output);
|
|
16781
16775
|
if (output.length) {
|
|
16782
16776
|
tr.step(new BatchSetMarkStep(output));
|
|
16783
16777
|
}
|
|
@@ -17339,13 +17333,7 @@ var LineInlineMarkExtension = class extends PlainExtension5 {
|
|
|
17339
17333
|
|
|
17340
17334
|
// src/editor/extensions/List/list-extensions.ts
|
|
17341
17335
|
import { isString as isString2 } from "@remirror/core";
|
|
17342
|
-
|
|
17343
|
-
// src/editor/extensions/List/remirror-extension/extension.ts
|
|
17344
|
-
import {
|
|
17345
|
-
convertCommand as convertCommand4,
|
|
17346
|
-
ExtensionTag as ExtensionTag6,
|
|
17347
|
-
NodeExtension as NodeExtension7
|
|
17348
|
-
} from "@remirror/core";
|
|
17336
|
+
import { ListExtension } from "remirror-extension-flat-list";
|
|
17349
17337
|
|
|
17350
17338
|
// node_modules/prosemirror-model/dist/index.js
|
|
17351
17339
|
function findDiffStart(a, b, pos) {
|
|
@@ -18288,12 +18276,12 @@ var ResolvedPos = class _ResolvedPos {
|
|
|
18288
18276
|
/**
|
|
18289
18277
|
@internal
|
|
18290
18278
|
*/
|
|
18291
|
-
static resolve(
|
|
18292
|
-
if (!(pos >= 0 && pos <=
|
|
18279
|
+
static resolve(doc, pos) {
|
|
18280
|
+
if (!(pos >= 0 && pos <= doc.content.size))
|
|
18293
18281
|
throw new RangeError("Position " + pos + " out of range");
|
|
18294
18282
|
let path = [];
|
|
18295
18283
|
let start = 0, parentOffset = pos;
|
|
18296
|
-
for (let node =
|
|
18284
|
+
for (let node = doc; ; ) {
|
|
18297
18285
|
let { index, offset } = node.content.findIndex(parentOffset);
|
|
18298
18286
|
let rem = parentOffset - offset;
|
|
18299
18287
|
path.push(node, index, start + offset);
|
|
@@ -18310,13 +18298,13 @@ var ResolvedPos = class _ResolvedPos {
|
|
|
18310
18298
|
/**
|
|
18311
18299
|
@internal
|
|
18312
18300
|
*/
|
|
18313
|
-
static resolveCached(
|
|
18301
|
+
static resolveCached(doc, pos) {
|
|
18314
18302
|
for (let i = 0; i < resolveCache.length; i++) {
|
|
18315
18303
|
let cached = resolveCache[i];
|
|
18316
|
-
if (cached.pos == pos && cached.doc ==
|
|
18304
|
+
if (cached.pos == pos && cached.doc == doc)
|
|
18317
18305
|
return cached;
|
|
18318
18306
|
}
|
|
18319
|
-
let result = resolveCache[resolveCachePos] = _ResolvedPos.resolve(
|
|
18307
|
+
let result = resolveCache[resolveCachePos] = _ResolvedPos.resolve(doc, pos);
|
|
18320
18308
|
resolveCachePos = (resolveCachePos + 1) % resolveCacheSize;
|
|
18321
18309
|
return result;
|
|
18322
18310
|
}
|
|
@@ -19164,182 +19152,6 @@ function checkForDeadEnds(match, stream) {
|
|
|
19164
19152
|
stream.err("Only non-generatable nodes (" + nodes.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
|
|
19165
19153
|
}
|
|
19166
19154
|
}
|
|
19167
|
-
var DOMSerializer = class _DOMSerializer {
|
|
19168
|
-
/**
|
|
19169
|
-
Create a serializer. `nodes` should map node names to functions
|
|
19170
|
-
that take a node and return a description of the corresponding
|
|
19171
|
-
DOM. `marks` does the same for mark names, but also gets an
|
|
19172
|
-
argument that tells it whether the mark's content is block or
|
|
19173
|
-
inline content (for typical use, it'll always be inline). A mark
|
|
19174
|
-
serializer may be `null` to indicate that marks of that type
|
|
19175
|
-
should not be serialized.
|
|
19176
|
-
*/
|
|
19177
|
-
constructor(nodes, marks) {
|
|
19178
|
-
this.nodes = nodes;
|
|
19179
|
-
this.marks = marks;
|
|
19180
|
-
}
|
|
19181
|
-
/**
|
|
19182
|
-
Serialize the content of this fragment to a DOM fragment. When
|
|
19183
|
-
not in the browser, the `document` option, containing a DOM
|
|
19184
|
-
document, should be passed so that the serializer can create
|
|
19185
|
-
nodes.
|
|
19186
|
-
*/
|
|
19187
|
-
serializeFragment(fragment, options = {}, target) {
|
|
19188
|
-
if (!target)
|
|
19189
|
-
target = doc(options).createDocumentFragment();
|
|
19190
|
-
let top = target, active = [];
|
|
19191
|
-
fragment.forEach((node) => {
|
|
19192
|
-
if (active.length || node.marks.length) {
|
|
19193
|
-
let keep = 0, rendered = 0;
|
|
19194
|
-
while (keep < active.length && rendered < node.marks.length) {
|
|
19195
|
-
let next = node.marks[rendered];
|
|
19196
|
-
if (!this.marks[next.type.name]) {
|
|
19197
|
-
rendered++;
|
|
19198
|
-
continue;
|
|
19199
|
-
}
|
|
19200
|
-
if (!next.eq(active[keep][0]) || next.type.spec.spanning === false)
|
|
19201
|
-
break;
|
|
19202
|
-
keep++;
|
|
19203
|
-
rendered++;
|
|
19204
|
-
}
|
|
19205
|
-
while (keep < active.length)
|
|
19206
|
-
top = active.pop()[1];
|
|
19207
|
-
while (rendered < node.marks.length) {
|
|
19208
|
-
let add = node.marks[rendered++];
|
|
19209
|
-
let markDOM = this.serializeMark(add, node.isInline, options);
|
|
19210
|
-
if (markDOM) {
|
|
19211
|
-
active.push([add, top]);
|
|
19212
|
-
top.appendChild(markDOM.dom);
|
|
19213
|
-
top = markDOM.contentDOM || markDOM.dom;
|
|
19214
|
-
}
|
|
19215
|
-
}
|
|
19216
|
-
}
|
|
19217
|
-
top.appendChild(this.serializeNodeInner(node, options));
|
|
19218
|
-
});
|
|
19219
|
-
return target;
|
|
19220
|
-
}
|
|
19221
|
-
/**
|
|
19222
|
-
@internal
|
|
19223
|
-
*/
|
|
19224
|
-
serializeNodeInner(node, options) {
|
|
19225
|
-
let { dom, contentDOM } = _DOMSerializer.renderSpec(doc(options), this.nodes[node.type.name](node));
|
|
19226
|
-
if (contentDOM) {
|
|
19227
|
-
if (node.isLeaf)
|
|
19228
|
-
throw new RangeError("Content hole not allowed in a leaf node spec");
|
|
19229
|
-
this.serializeFragment(node.content, options, contentDOM);
|
|
19230
|
-
}
|
|
19231
|
-
return dom;
|
|
19232
|
-
}
|
|
19233
|
-
/**
|
|
19234
|
-
Serialize this node to a DOM node. This can be useful when you
|
|
19235
|
-
need to serialize a part of a document, as opposed to the whole
|
|
19236
|
-
document. To serialize a whole document, use
|
|
19237
|
-
[`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on
|
|
19238
|
-
its [content](https://prosemirror.net/docs/ref/#model.Node.content).
|
|
19239
|
-
*/
|
|
19240
|
-
serializeNode(node, options = {}) {
|
|
19241
|
-
let dom = this.serializeNodeInner(node, options);
|
|
19242
|
-
for (let i = node.marks.length - 1; i >= 0; i--) {
|
|
19243
|
-
let wrap = this.serializeMark(node.marks[i], node.isInline, options);
|
|
19244
|
-
if (wrap) {
|
|
19245
|
-
(wrap.contentDOM || wrap.dom).appendChild(dom);
|
|
19246
|
-
dom = wrap.dom;
|
|
19247
|
-
}
|
|
19248
|
-
}
|
|
19249
|
-
return dom;
|
|
19250
|
-
}
|
|
19251
|
-
/**
|
|
19252
|
-
@internal
|
|
19253
|
-
*/
|
|
19254
|
-
serializeMark(mark, inline2, options = {}) {
|
|
19255
|
-
let toDOM = this.marks[mark.type.name];
|
|
19256
|
-
return toDOM && _DOMSerializer.renderSpec(doc(options), toDOM(mark, inline2));
|
|
19257
|
-
}
|
|
19258
|
-
/**
|
|
19259
|
-
Render an [output spec](https://prosemirror.net/docs/ref/#model.DOMOutputSpec) to a DOM node. If
|
|
19260
|
-
the spec has a hole (zero) in it, `contentDOM` will point at the
|
|
19261
|
-
node with the hole.
|
|
19262
|
-
*/
|
|
19263
|
-
static renderSpec(doc2, structure, xmlNS = null) {
|
|
19264
|
-
if (typeof structure == "string")
|
|
19265
|
-
return { dom: doc2.createTextNode(structure) };
|
|
19266
|
-
if (structure.nodeType != null)
|
|
19267
|
-
return { dom: structure };
|
|
19268
|
-
if (structure.dom && structure.dom.nodeType != null)
|
|
19269
|
-
return structure;
|
|
19270
|
-
let tagName = structure[0], space3 = tagName.indexOf(" ");
|
|
19271
|
-
if (space3 > 0) {
|
|
19272
|
-
xmlNS = tagName.slice(0, space3);
|
|
19273
|
-
tagName = tagName.slice(space3 + 1);
|
|
19274
|
-
}
|
|
19275
|
-
let contentDOM;
|
|
19276
|
-
let dom = xmlNS ? doc2.createElementNS(xmlNS, tagName) : doc2.createElement(tagName);
|
|
19277
|
-
let attrs = structure[1], start = 1;
|
|
19278
|
-
if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
|
|
19279
|
-
start = 2;
|
|
19280
|
-
for (let name in attrs)
|
|
19281
|
-
if (attrs[name] != null) {
|
|
19282
|
-
let space4 = name.indexOf(" ");
|
|
19283
|
-
if (space4 > 0)
|
|
19284
|
-
dom.setAttributeNS(name.slice(0, space4), name.slice(space4 + 1), attrs[name]);
|
|
19285
|
-
else
|
|
19286
|
-
dom.setAttribute(name, attrs[name]);
|
|
19287
|
-
}
|
|
19288
|
-
}
|
|
19289
|
-
for (let i = start; i < structure.length; i++) {
|
|
19290
|
-
let child = structure[i];
|
|
19291
|
-
if (child === 0) {
|
|
19292
|
-
if (i < structure.length - 1 || i > start)
|
|
19293
|
-
throw new RangeError("Content hole must be the only child of its parent node");
|
|
19294
|
-
return { dom, contentDOM: dom };
|
|
19295
|
-
} else {
|
|
19296
|
-
let { dom: inner, contentDOM: innerContent } = _DOMSerializer.renderSpec(doc2, child, xmlNS);
|
|
19297
|
-
dom.appendChild(inner);
|
|
19298
|
-
if (innerContent) {
|
|
19299
|
-
if (contentDOM)
|
|
19300
|
-
throw new RangeError("Multiple content holes");
|
|
19301
|
-
contentDOM = innerContent;
|
|
19302
|
-
}
|
|
19303
|
-
}
|
|
19304
|
-
}
|
|
19305
|
-
return { dom, contentDOM };
|
|
19306
|
-
}
|
|
19307
|
-
/**
|
|
19308
|
-
Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
|
|
19309
|
-
properties in a schema's node and mark specs.
|
|
19310
|
-
*/
|
|
19311
|
-
static fromSchema(schema) {
|
|
19312
|
-
return schema.cached.domSerializer || (schema.cached.domSerializer = new _DOMSerializer(this.nodesFromSchema(schema), this.marksFromSchema(schema)));
|
|
19313
|
-
}
|
|
19314
|
-
/**
|
|
19315
|
-
Gather the serializers in a schema's node specs into an object.
|
|
19316
|
-
This can be useful as a base to build a custom serializer from.
|
|
19317
|
-
*/
|
|
19318
|
-
static nodesFromSchema(schema) {
|
|
19319
|
-
let result = gatherToDOM(schema.nodes);
|
|
19320
|
-
if (!result.text)
|
|
19321
|
-
result.text = (node) => node.text;
|
|
19322
|
-
return result;
|
|
19323
|
-
}
|
|
19324
|
-
/**
|
|
19325
|
-
Gather the serializers in a schema's mark specs into an object.
|
|
19326
|
-
*/
|
|
19327
|
-
static marksFromSchema(schema) {
|
|
19328
|
-
return gatherToDOM(schema.marks);
|
|
19329
|
-
}
|
|
19330
|
-
};
|
|
19331
|
-
function gatherToDOM(obj) {
|
|
19332
|
-
let result = {};
|
|
19333
|
-
for (let name in obj) {
|
|
19334
|
-
let toDOM = obj[name].spec.toDOM;
|
|
19335
|
-
if (toDOM)
|
|
19336
|
-
result[name] = toDOM;
|
|
19337
|
-
}
|
|
19338
|
-
return result;
|
|
19339
|
-
}
|
|
19340
|
-
function doc(options) {
|
|
19341
|
-
return options.document || window.document;
|
|
19342
|
-
}
|
|
19343
19155
|
|
|
19344
19156
|
// node_modules/prosemirror-transform/dist/index.js
|
|
19345
19157
|
var lower16 = 65535;
|
|
@@ -19549,15 +19361,15 @@ var StepResult3 = class _StepResult {
|
|
|
19549
19361
|
/**
|
|
19550
19362
|
@internal
|
|
19551
19363
|
*/
|
|
19552
|
-
constructor(
|
|
19553
|
-
this.doc =
|
|
19364
|
+
constructor(doc, failed) {
|
|
19365
|
+
this.doc = doc;
|
|
19554
19366
|
this.failed = failed;
|
|
19555
19367
|
}
|
|
19556
19368
|
/**
|
|
19557
19369
|
Create a successful step result.
|
|
19558
19370
|
*/
|
|
19559
|
-
static ok(
|
|
19560
|
-
return new _StepResult(
|
|
19371
|
+
static ok(doc) {
|
|
19372
|
+
return new _StepResult(doc, null);
|
|
19561
19373
|
}
|
|
19562
19374
|
/**
|
|
19563
19375
|
Create a failed step result.
|
|
@@ -19570,9 +19382,9 @@ var StepResult3 = class _StepResult {
|
|
|
19570
19382
|
arguments. Create a successful result if it succeeds, and a
|
|
19571
19383
|
failed one if it throws a `ReplaceError`.
|
|
19572
19384
|
*/
|
|
19573
|
-
static fromReplace(
|
|
19385
|
+
static fromReplace(doc, from, to, slice) {
|
|
19574
19386
|
try {
|
|
19575
|
-
return _StepResult.ok(
|
|
19387
|
+
return _StepResult.ok(doc.replace(from, to, slice));
|
|
19576
19388
|
} catch (e) {
|
|
19577
19389
|
if (e instanceof ReplaceError)
|
|
19578
19390
|
return _StepResult.fail(e.message);
|
|
@@ -19602,15 +19414,15 @@ var AddMarkStep = class _AddMarkStep extends Step3 {
|
|
|
19602
19414
|
this.to = to;
|
|
19603
19415
|
this.mark = mark;
|
|
19604
19416
|
}
|
|
19605
|
-
apply(
|
|
19606
|
-
let oldSlice =
|
|
19417
|
+
apply(doc) {
|
|
19418
|
+
let oldSlice = doc.slice(this.from, this.to), $from = doc.resolve(this.from);
|
|
19607
19419
|
let parent = $from.node($from.sharedDepth(this.to));
|
|
19608
19420
|
let slice = new Slice3(mapFragment2(oldSlice.content, (node, parent2) => {
|
|
19609
19421
|
if (!node.isAtom || !parent2.type.allowsMarkType(this.mark.type))
|
|
19610
19422
|
return node;
|
|
19611
19423
|
return node.mark(this.mark.addToSet(node.marks));
|
|
19612
19424
|
}, parent), oldSlice.openStart, oldSlice.openEnd);
|
|
19613
|
-
return StepResult3.fromReplace(
|
|
19425
|
+
return StepResult3.fromReplace(doc, this.from, this.to, slice);
|
|
19614
19426
|
}
|
|
19615
19427
|
invert() {
|
|
19616
19428
|
return new RemoveMarkStep(this.from, this.to, this.mark);
|
|
@@ -19654,12 +19466,12 @@ var RemoveMarkStep = class _RemoveMarkStep extends Step3 {
|
|
|
19654
19466
|
this.to = to;
|
|
19655
19467
|
this.mark = mark;
|
|
19656
19468
|
}
|
|
19657
|
-
apply(
|
|
19658
|
-
let oldSlice =
|
|
19469
|
+
apply(doc) {
|
|
19470
|
+
let oldSlice = doc.slice(this.from, this.to);
|
|
19659
19471
|
let slice = new Slice3(mapFragment2(oldSlice.content, (node) => {
|
|
19660
19472
|
return node.mark(this.mark.removeFromSet(node.marks));
|
|
19661
|
-
},
|
|
19662
|
-
return StepResult3.fromReplace(
|
|
19473
|
+
}, doc), oldSlice.openStart, oldSlice.openEnd);
|
|
19474
|
+
return StepResult3.fromReplace(doc, this.from, this.to, slice);
|
|
19663
19475
|
}
|
|
19664
19476
|
invert() {
|
|
19665
19477
|
return new AddMarkStep(this.from, this.to, this.mark);
|
|
@@ -19702,15 +19514,15 @@ var AddNodeMarkStep = class _AddNodeMarkStep extends Step3 {
|
|
|
19702
19514
|
this.pos = pos;
|
|
19703
19515
|
this.mark = mark;
|
|
19704
19516
|
}
|
|
19705
|
-
apply(
|
|
19706
|
-
let node =
|
|
19517
|
+
apply(doc) {
|
|
19518
|
+
let node = doc.nodeAt(this.pos);
|
|
19707
19519
|
if (!node)
|
|
19708
19520
|
return StepResult3.fail("No node at mark step's position");
|
|
19709
19521
|
let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
|
|
19710
|
-
return StepResult3.fromReplace(
|
|
19522
|
+
return StepResult3.fromReplace(doc, this.pos, this.pos + 1, new Slice3(Fragment3.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
19711
19523
|
}
|
|
19712
|
-
invert(
|
|
19713
|
-
let node =
|
|
19524
|
+
invert(doc) {
|
|
19525
|
+
let node = doc.nodeAt(this.pos);
|
|
19714
19526
|
if (node) {
|
|
19715
19527
|
let newSet = this.mark.addToSet(node.marks);
|
|
19716
19528
|
if (newSet.length == node.marks.length) {
|
|
@@ -19748,15 +19560,15 @@ var RemoveNodeMarkStep = class _RemoveNodeMarkStep extends Step3 {
|
|
|
19748
19560
|
this.pos = pos;
|
|
19749
19561
|
this.mark = mark;
|
|
19750
19562
|
}
|
|
19751
|
-
apply(
|
|
19752
|
-
let node =
|
|
19563
|
+
apply(doc) {
|
|
19564
|
+
let node = doc.nodeAt(this.pos);
|
|
19753
19565
|
if (!node)
|
|
19754
19566
|
return StepResult3.fail("No node at mark step's position");
|
|
19755
19567
|
let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
|
|
19756
|
-
return StepResult3.fromReplace(
|
|
19568
|
+
return StepResult3.fromReplace(doc, this.pos, this.pos + 1, new Slice3(Fragment3.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
19757
19569
|
}
|
|
19758
|
-
invert(
|
|
19759
|
-
let node =
|
|
19570
|
+
invert(doc) {
|
|
19571
|
+
let node = doc.nodeAt(this.pos);
|
|
19760
19572
|
if (!node || !this.mark.isInSet(node.marks))
|
|
19761
19573
|
return this;
|
|
19762
19574
|
return new AddNodeMarkStep(this.pos, this.mark);
|
|
@@ -19795,16 +19607,16 @@ var ReplaceStep = class _ReplaceStep extends Step3 {
|
|
|
19795
19607
|
this.slice = slice;
|
|
19796
19608
|
this.structure = structure;
|
|
19797
19609
|
}
|
|
19798
|
-
apply(
|
|
19799
|
-
if (this.structure && contentBetween(
|
|
19610
|
+
apply(doc) {
|
|
19611
|
+
if (this.structure && contentBetween(doc, this.from, this.to))
|
|
19800
19612
|
return StepResult3.fail("Structure replace would overwrite content");
|
|
19801
|
-
return StepResult3.fromReplace(
|
|
19613
|
+
return StepResult3.fromReplace(doc, this.from, this.to, this.slice);
|
|
19802
19614
|
}
|
|
19803
19615
|
getMap() {
|
|
19804
19616
|
return new StepMap2([this.from, this.to - this.from, this.slice.size]);
|
|
19805
19617
|
}
|
|
19806
|
-
invert(
|
|
19807
|
-
return new _ReplaceStep(this.from, this.from + this.slice.size,
|
|
19618
|
+
invert(doc) {
|
|
19619
|
+
return new _ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));
|
|
19808
19620
|
}
|
|
19809
19621
|
map(mapping) {
|
|
19810
19622
|
let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
@@ -19860,16 +19672,16 @@ var ReplaceAroundStep = class _ReplaceAroundStep extends Step3 {
|
|
|
19860
19672
|
this.insert = insert;
|
|
19861
19673
|
this.structure = structure;
|
|
19862
19674
|
}
|
|
19863
|
-
apply(
|
|
19864
|
-
if (this.structure && (contentBetween(
|
|
19675
|
+
apply(doc) {
|
|
19676
|
+
if (this.structure && (contentBetween(doc, this.from, this.gapFrom) || contentBetween(doc, this.gapTo, this.to)))
|
|
19865
19677
|
return StepResult3.fail("Structure gap-replace would overwrite content");
|
|
19866
|
-
let gap =
|
|
19678
|
+
let gap = doc.slice(this.gapFrom, this.gapTo);
|
|
19867
19679
|
if (gap.openStart || gap.openEnd)
|
|
19868
19680
|
return StepResult3.fail("Gap is not a flat range");
|
|
19869
19681
|
let inserted = this.slice.insertAt(this.insert, gap.content);
|
|
19870
19682
|
if (!inserted)
|
|
19871
19683
|
return StepResult3.fail("Content does not fit in gap");
|
|
19872
|
-
return StepResult3.fromReplace(
|
|
19684
|
+
return StepResult3.fromReplace(doc, this.from, this.to, inserted);
|
|
19873
19685
|
}
|
|
19874
19686
|
getMap() {
|
|
19875
19687
|
return new StepMap2([
|
|
@@ -19881,9 +19693,9 @@ var ReplaceAroundStep = class _ReplaceAroundStep extends Step3 {
|
|
|
19881
19693
|
this.slice.size - this.insert
|
|
19882
19694
|
]);
|
|
19883
19695
|
}
|
|
19884
|
-
invert(
|
|
19696
|
+
invert(doc) {
|
|
19885
19697
|
let gap = this.gapTo - this.gapFrom;
|
|
19886
|
-
return new _ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap,
|
|
19698
|
+
return new _ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
|
|
19887
19699
|
}
|
|
19888
19700
|
map(mapping) {
|
|
19889
19701
|
let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
@@ -19917,8 +19729,8 @@ var ReplaceAroundStep = class _ReplaceAroundStep extends Step3 {
|
|
|
19917
19729
|
}
|
|
19918
19730
|
};
|
|
19919
19731
|
Step3.jsonID("replaceAround", ReplaceAroundStep);
|
|
19920
|
-
function contentBetween(
|
|
19921
|
-
let $from =
|
|
19732
|
+
function contentBetween(doc, from, to) {
|
|
19733
|
+
let $from = doc.resolve(from), dist = to - from, depth = $from.depth;
|
|
19922
19734
|
while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {
|
|
19923
19735
|
depth--;
|
|
19924
19736
|
dist--;
|
|
@@ -19982,8 +19794,8 @@ function findWrappingInside(range, type) {
|
|
|
19982
19794
|
return null;
|
|
19983
19795
|
return inside;
|
|
19984
19796
|
}
|
|
19985
|
-
function canSplit(
|
|
19986
|
-
let $pos =
|
|
19797
|
+
function canSplit(doc, pos, depth = 1, typesAfter) {
|
|
19798
|
+
let $pos = doc.resolve(pos), base = $pos.depth - depth;
|
|
19987
19799
|
let innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent;
|
|
19988
19800
|
if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount)))
|
|
19989
19801
|
return false;
|
|
@@ -20003,17 +19815,17 @@ function canSplit(doc2, pos, depth = 1, typesAfter) {
|
|
|
20003
19815
|
let baseType = typesAfter && typesAfter[0];
|
|
20004
19816
|
return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);
|
|
20005
19817
|
}
|
|
20006
|
-
function canJoin(
|
|
20007
|
-
let $pos =
|
|
19818
|
+
function canJoin(doc, pos) {
|
|
19819
|
+
let $pos = doc.resolve(pos), index = $pos.index();
|
|
20008
19820
|
return joinable2($pos.nodeBefore, $pos.nodeAfter) && $pos.parent.canReplace(index, index + 1);
|
|
20009
19821
|
}
|
|
20010
19822
|
function joinable2(a, b) {
|
|
20011
19823
|
return !!(a && b && !a.isLeaf && a.canAppend(b));
|
|
20012
19824
|
}
|
|
20013
|
-
function replaceStep(
|
|
19825
|
+
function replaceStep(doc, from, to = from, slice = Slice3.empty) {
|
|
20014
19826
|
if (from == to && !slice.size)
|
|
20015
19827
|
return null;
|
|
20016
|
-
let $from =
|
|
19828
|
+
let $from = doc.resolve(from), $to = doc.resolve(to);
|
|
20017
19829
|
if (fitsTrivially($from, $to, slice))
|
|
20018
19830
|
return new ReplaceStep(from, to, slice);
|
|
20019
19831
|
return new Fitter($from, $to, slice).fit();
|
|
@@ -20270,8 +20082,8 @@ var AttrStep = class _AttrStep extends Step3 {
|
|
|
20270
20082
|
this.attr = attr;
|
|
20271
20083
|
this.value = value;
|
|
20272
20084
|
}
|
|
20273
|
-
apply(
|
|
20274
|
-
let node =
|
|
20085
|
+
apply(doc) {
|
|
20086
|
+
let node = doc.nodeAt(this.pos);
|
|
20275
20087
|
if (!node)
|
|
20276
20088
|
return StepResult3.fail("No node at attribute step's position");
|
|
20277
20089
|
let attrs = /* @__PURE__ */ Object.create(null);
|
|
@@ -20279,13 +20091,13 @@ var AttrStep = class _AttrStep extends Step3 {
|
|
|
20279
20091
|
attrs[name] = node.attrs[name];
|
|
20280
20092
|
attrs[this.attr] = this.value;
|
|
20281
20093
|
let updated = node.type.create(attrs, null, node.marks);
|
|
20282
|
-
return StepResult3.fromReplace(
|
|
20094
|
+
return StepResult3.fromReplace(doc, this.pos, this.pos + 1, new Slice3(Fragment3.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
20283
20095
|
}
|
|
20284
20096
|
getMap() {
|
|
20285
20097
|
return StepMap2.empty;
|
|
20286
20098
|
}
|
|
20287
|
-
invert(
|
|
20288
|
-
return new _AttrStep(this.pos, this.attr,
|
|
20099
|
+
invert(doc) {
|
|
20100
|
+
return new _AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);
|
|
20289
20101
|
}
|
|
20290
20102
|
map(mapping) {
|
|
20291
20103
|
let pos = mapping.mapResult(this.pos, 1);
|
|
@@ -20310,19 +20122,19 @@ var DocAttrStep = class _DocAttrStep extends Step3 {
|
|
|
20310
20122
|
this.attr = attr;
|
|
20311
20123
|
this.value = value;
|
|
20312
20124
|
}
|
|
20313
|
-
apply(
|
|
20125
|
+
apply(doc) {
|
|
20314
20126
|
let attrs = /* @__PURE__ */ Object.create(null);
|
|
20315
|
-
for (let name in
|
|
20316
|
-
attrs[name] =
|
|
20127
|
+
for (let name in doc.attrs)
|
|
20128
|
+
attrs[name] = doc.attrs[name];
|
|
20317
20129
|
attrs[this.attr] = this.value;
|
|
20318
|
-
let updated =
|
|
20130
|
+
let updated = doc.type.create(attrs, doc.content, doc.marks);
|
|
20319
20131
|
return StepResult3.ok(updated);
|
|
20320
20132
|
}
|
|
20321
20133
|
getMap() {
|
|
20322
20134
|
return StepMap2.empty;
|
|
20323
20135
|
}
|
|
20324
|
-
invert(
|
|
20325
|
-
return new _DocAttrStep(this.attr,
|
|
20136
|
+
invert(doc) {
|
|
20137
|
+
return new _DocAttrStep(this.attr, doc.attrs[this.attr]);
|
|
20326
20138
|
}
|
|
20327
20139
|
map(mapping) {
|
|
20328
20140
|
return this;
|
|
@@ -20356,221 +20168,18 @@ function parseInteger(attr) {
|
|
|
20356
20168
|
return null;
|
|
20357
20169
|
}
|
|
20358
20170
|
|
|
20359
|
-
// src/editor/extensions/List/core/schema/
|
|
20360
|
-
|
|
20361
|
-
|
|
20362
|
-
|
|
20363
|
-
|
|
20364
|
-
|
|
20365
|
-
|
|
20366
|
-
|
|
20367
|
-
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
20371
|
-
checked: element.hasAttribute("data-list-checked"),
|
|
20372
|
-
collapsed: element.hasAttribute("data-list-collapsed")
|
|
20373
|
-
};
|
|
20374
|
-
}
|
|
20375
|
-
},
|
|
20376
|
-
{
|
|
20377
|
-
tag: "div[data-list]",
|
|
20378
|
-
getAttrs: (element) => {
|
|
20379
|
-
if (typeof element === "string") {
|
|
20380
|
-
return {};
|
|
20381
|
-
}
|
|
20382
|
-
return {
|
|
20383
|
-
kind: element.getAttribute("data-list-kind") || "bullet",
|
|
20384
|
-
order: parseInteger(element.getAttribute("data-list-order")),
|
|
20385
|
-
checked: element.hasAttribute("data-list-checked"),
|
|
20386
|
-
collapsed: element.hasAttribute("data-list-collapsed")
|
|
20387
|
-
};
|
|
20388
|
-
}
|
|
20389
|
-
},
|
|
20390
|
-
{
|
|
20391
|
-
tag: "ul > li",
|
|
20392
|
-
getAttrs: (element) => {
|
|
20393
|
-
if (typeof element !== "string") {
|
|
20394
|
-
let checkbox = element.firstChild;
|
|
20395
|
-
for (let i = 0; i < 3 && checkbox; i++) {
|
|
20396
|
-
if (["INPUT", "UL", "OL", "LI"].includes(checkbox.nodeName)) {
|
|
20397
|
-
break;
|
|
20398
|
-
}
|
|
20399
|
-
checkbox = checkbox.firstChild;
|
|
20400
|
-
}
|
|
20401
|
-
if (checkbox && checkbox.nodeName === "INPUT" && checkbox.getAttribute("type") === "checkbox") {
|
|
20402
|
-
return {
|
|
20403
|
-
kind: "task",
|
|
20404
|
-
checked: checkbox.hasAttribute("checked")
|
|
20405
|
-
};
|
|
20406
|
-
}
|
|
20407
|
-
if (element.hasAttribute("data-task-list-item") || element.getAttribute("data-list-kind") === "task") {
|
|
20408
|
-
return {
|
|
20409
|
-
kind: "task",
|
|
20410
|
-
checked: element.hasAttribute("data-list-checked") || element.hasAttribute("data-checked")
|
|
20411
|
-
};
|
|
20412
|
-
}
|
|
20413
|
-
if (element.hasAttribute("data-toggle-list-item") || element.getAttribute("data-list-kind") === "toggle") {
|
|
20414
|
-
return {
|
|
20415
|
-
kind: "toggle",
|
|
20416
|
-
collapsed: element.hasAttribute("data-list-collapsed")
|
|
20417
|
-
};
|
|
20418
|
-
}
|
|
20419
|
-
if (element.firstChild?.nodeType === 3) {
|
|
20420
|
-
const textContent = element.firstChild.textContent;
|
|
20421
|
-
if (textContent && /^\[[\sx|]]\s{1,2}/.test(textContent)) {
|
|
20422
|
-
element.firstChild.textContent = textContent.replace(
|
|
20423
|
-
/^\[[\sx|]]\s{1,2}/,
|
|
20424
|
-
""
|
|
20425
|
-
);
|
|
20426
|
-
return {
|
|
20427
|
-
kind: "task",
|
|
20428
|
-
checked: textContent.startsWith("[x]")
|
|
20429
|
-
};
|
|
20430
|
-
}
|
|
20431
|
-
}
|
|
20432
|
-
}
|
|
20433
|
-
return {
|
|
20434
|
-
kind: "bullet"
|
|
20435
|
-
};
|
|
20436
|
-
}
|
|
20437
|
-
},
|
|
20438
|
-
{
|
|
20439
|
-
tag: "ol > li",
|
|
20440
|
-
getAttrs: (element) => {
|
|
20441
|
-
if (typeof element === "string") {
|
|
20442
|
-
return {
|
|
20443
|
-
kind: "ordered"
|
|
20444
|
-
};
|
|
20445
|
-
}
|
|
20446
|
-
return {
|
|
20447
|
-
kind: "ordered",
|
|
20448
|
-
order: parseInteger(element.getAttribute("data-list-order"))
|
|
20449
|
-
};
|
|
20450
|
-
}
|
|
20451
|
-
},
|
|
20452
|
-
{
|
|
20453
|
-
// This rule is for handling nested lists copied from Dropbox Paper. It's
|
|
20454
|
-
// technically invalid HTML structure.
|
|
20455
|
-
tag: ":is(ul, ol) > :is(ul, ol)",
|
|
20456
|
-
getAttrs: () => {
|
|
20457
|
-
return {
|
|
20458
|
-
kind: "bullet"
|
|
20459
|
-
};
|
|
20460
|
-
}
|
|
20461
|
-
}
|
|
20462
|
-
];
|
|
20463
|
-
}
|
|
20464
|
-
|
|
20465
|
-
// src/editor/extensions/List/core/schema/to-dom.ts
|
|
20466
|
-
function listToDOM({
|
|
20467
|
-
node,
|
|
20468
|
-
nativeList = false,
|
|
20469
|
-
getMarkers = defaultMarkerGetter,
|
|
20470
|
-
getAttributes = defaultAttributesGetter
|
|
20471
|
-
}) {
|
|
20472
|
-
const attrs = node.attrs;
|
|
20473
|
-
const markerHidden = node.firstChild?.type === node.type;
|
|
20474
|
-
const markers = markerHidden ? null : getMarkers(node);
|
|
20475
|
-
const domAttrs = getAttributes(node);
|
|
20476
|
-
const contentContainer = ["div", { class: "list-content" }, 0];
|
|
20477
|
-
const markerContainer = markers && [
|
|
20478
|
-
"div",
|
|
20479
|
-
{
|
|
20480
|
-
class: "list-marker list-marker-click-target",
|
|
20481
|
-
// Set `contenteditable` to `false` so that the cursor won't be
|
|
20482
|
-
// moved into the mark container when clicking on it.
|
|
20483
|
-
contenteditable: "false"
|
|
20484
|
-
},
|
|
20485
|
-
...markers
|
|
20486
|
-
];
|
|
20487
|
-
if (nativeList) {
|
|
20488
|
-
const listTag = attrs.kind === "ordered" ? "ol" : "ul";
|
|
20489
|
-
if (markerContainer) {
|
|
20490
|
-
return [listTag, ["li", domAttrs, markerContainer, contentContainer]];
|
|
20491
|
-
} else {
|
|
20492
|
-
return [listTag, ["li", domAttrs, 0]];
|
|
20493
|
-
}
|
|
20494
|
-
} else {
|
|
20495
|
-
if (markerContainer) {
|
|
20496
|
-
return ["div", domAttrs, markerContainer, contentContainer];
|
|
20497
|
-
} else {
|
|
20498
|
-
return ["div", domAttrs, contentContainer];
|
|
20499
|
-
}
|
|
20500
|
-
}
|
|
20501
|
-
}
|
|
20502
|
-
function defaultMarkerGetter(node) {
|
|
20503
|
-
const attrs = node.attrs;
|
|
20504
|
-
switch (attrs.kind) {
|
|
20505
|
-
case "task":
|
|
20506
|
-
return [
|
|
20507
|
-
[
|
|
20508
|
-
"label",
|
|
20509
|
-
[
|
|
20510
|
-
"input",
|
|
20511
|
-
{ type: "checkbox", checked: attrs.checked ? "" : void 0 }
|
|
20512
|
-
]
|
|
20513
|
-
]
|
|
20514
|
-
];
|
|
20515
|
-
case "toggle":
|
|
20516
|
-
return [];
|
|
20517
|
-
default:
|
|
20518
|
-
return null;
|
|
20519
|
-
}
|
|
20520
|
-
}
|
|
20521
|
-
function defaultAttributesGetter(node) {
|
|
20522
|
-
const attrs = node.attrs;
|
|
20523
|
-
const markerHidden = node.firstChild?.type === node.type;
|
|
20524
|
-
const markerType = markerHidden ? void 0 : attrs.kind || "bullet";
|
|
20525
|
-
const domAttrs = {
|
|
20526
|
-
class: "prosemirror-flat-list",
|
|
20527
|
-
"data-list-kind": markerType,
|
|
20528
|
-
"data-list-order": attrs.order != null ? String(attrs.order) : void 0,
|
|
20529
|
-
"data-list-checked": attrs.checked ? "" : void 0,
|
|
20530
|
-
"data-list-collapsed": attrs.collapsed ? "" : void 0,
|
|
20531
|
-
"data-list-collapsable": node.childCount >= 2 ? "" : void 0,
|
|
20532
|
-
style: attrs.order != null ? `--prosemirror-flat-list-order: ${attrs.order};` : void 0
|
|
20533
|
-
};
|
|
20534
|
-
return domAttrs;
|
|
20535
|
-
}
|
|
20536
|
-
|
|
20537
|
-
// src/editor/extensions/List/core/schema/node-spec.ts
|
|
20538
|
-
var flatListGroup = "flatList";
|
|
20539
|
-
function createListSpec() {
|
|
20540
|
-
return {
|
|
20541
|
-
content: "block+",
|
|
20542
|
-
group: `${flatListGroup} block`,
|
|
20543
|
-
definingForContent: true,
|
|
20544
|
-
definingAsContext: false,
|
|
20545
|
-
attrs: {
|
|
20546
|
-
kind: {
|
|
20547
|
-
default: "bullet"
|
|
20548
|
-
},
|
|
20549
|
-
order: {
|
|
20550
|
-
default: null
|
|
20551
|
-
},
|
|
20552
|
-
checked: {
|
|
20553
|
-
default: false
|
|
20554
|
-
},
|
|
20555
|
-
collapsed: {
|
|
20556
|
-
default: false
|
|
20557
|
-
}
|
|
20558
|
-
},
|
|
20559
|
-
toDOM: (node) => {
|
|
20560
|
-
return listToDOM({ node });
|
|
20561
|
-
},
|
|
20562
|
-
parseDOM: createParseDomRules()
|
|
20563
|
-
};
|
|
20564
|
-
}
|
|
20565
|
-
|
|
20566
|
-
// src/editor/extensions/List/core/utils/get-list-type.ts
|
|
20567
|
-
function getListType(schema) {
|
|
20568
|
-
let name = schema.cached["PROSEMIRROR_FLAT_LIST_LIST_TYPE_NAME"];
|
|
20569
|
-
if (!name) {
|
|
20570
|
-
for (const type of Object.values(schema.nodes)) {
|
|
20571
|
-
if ((type.spec.group || "").split(" ").includes(flatListGroup)) {
|
|
20572
|
-
name = type.name;
|
|
20573
|
-
break;
|
|
20171
|
+
// src/editor/extensions/List/core/schema/node-spec.ts
|
|
20172
|
+
var flatListGroup = "flatList";
|
|
20173
|
+
|
|
20174
|
+
// src/editor/extensions/List/core/utils/get-list-type-name.ts
|
|
20175
|
+
var key = "PROSEMIRROR_FLAT_LIST_TYPE_NAME";
|
|
20176
|
+
function getListTypeName(schema) {
|
|
20177
|
+
let name = schema.cached[key];
|
|
20178
|
+
if (!name) {
|
|
20179
|
+
for (const type of Object.values(schema.nodes)) {
|
|
20180
|
+
if ((type.spec.group || "").split(" ").includes(flatListGroup)) {
|
|
20181
|
+
name = type.name;
|
|
20182
|
+
break;
|
|
20574
20183
|
}
|
|
20575
20184
|
}
|
|
20576
20185
|
if (!name) {
|
|
@@ -20578,14 +20187,15 @@ function getListType(schema) {
|
|
|
20578
20187
|
"[prosemirror-flat-list] Unable to find a flat list type in the schema"
|
|
20579
20188
|
);
|
|
20580
20189
|
}
|
|
20581
|
-
schema.cached[
|
|
20190
|
+
schema.cached[key] = name;
|
|
20191
|
+
return name;
|
|
20582
20192
|
}
|
|
20583
|
-
return
|
|
20193
|
+
return name;
|
|
20584
20194
|
}
|
|
20585
20195
|
|
|
20586
20196
|
// src/editor/extensions/List/core/utils/is-list-type.ts
|
|
20587
20197
|
function isListType(type) {
|
|
20588
|
-
return
|
|
20198
|
+
return getListTypeName(type.schema) === type.name;
|
|
20589
20199
|
}
|
|
20590
20200
|
|
|
20591
20201
|
// src/editor/extensions/List/core/utils/is-list-node.ts
|
|
@@ -20626,11 +20236,11 @@ function* getTransactionRanges(tr) {
|
|
|
20626
20236
|
yield ranges;
|
|
20627
20237
|
}
|
|
20628
20238
|
}
|
|
20629
|
-
function findBoundaries(positions,
|
|
20239
|
+
function findBoundaries(positions, doc, prediction) {
|
|
20630
20240
|
const boundaries = /* @__PURE__ */ new Set();
|
|
20631
20241
|
const joinable3 = [];
|
|
20632
20242
|
for (const pos of positions) {
|
|
20633
|
-
const $pos =
|
|
20243
|
+
const $pos = doc.resolve(pos);
|
|
20634
20244
|
for (let depth = $pos.depth; depth >= 0; depth--) {
|
|
20635
20245
|
const boundary = $pos.before(depth + 1);
|
|
20636
20246
|
if (boundaries.has(boundary)) {
|
|
@@ -20703,6 +20313,11 @@ function atEndBlockBoundary($pos, depth) {
|
|
|
20703
20313
|
return true;
|
|
20704
20314
|
}
|
|
20705
20315
|
|
|
20316
|
+
// src/editor/extensions/List/core/utils/get-list-type.ts
|
|
20317
|
+
function getListType(schema) {
|
|
20318
|
+
return schema.nodes[getListTypeName(schema)];
|
|
20319
|
+
}
|
|
20320
|
+
|
|
20706
20321
|
// src/editor/extensions/List/core/utils/list-range.ts
|
|
20707
20322
|
function findListsRange($from, $to = $from) {
|
|
20708
20323
|
if ($to.pos < $from.pos) {
|
|
@@ -20753,19 +20368,12 @@ function safeLift(tr, range) {
|
|
|
20753
20368
|
tr.lift(range, target);
|
|
20754
20369
|
return true;
|
|
20755
20370
|
}
|
|
20756
|
-
function safeLiftFromTo(tr, from, to) {
|
|
20757
|
-
const $from = tr.doc.resolve(from);
|
|
20758
|
-
const $to = tr.doc.resolve(to);
|
|
20759
|
-
const range = $from.blockRange($to);
|
|
20760
|
-
if (!range) return false;
|
|
20761
|
-
return safeLift(tr, range);
|
|
20762
|
-
}
|
|
20763
20371
|
|
|
20764
20372
|
// src/editor/extensions/List/core/utils/zoom-in-range.ts
|
|
20765
20373
|
function zoomInRange(range) {
|
|
20766
20374
|
const { $from, $to, depth, start, end } = range;
|
|
20767
|
-
const
|
|
20768
|
-
const deeper = ($from.pos > start ? $from :
|
|
20375
|
+
const doc = $from.doc;
|
|
20376
|
+
const deeper = ($from.pos > start ? $from : doc.resolve(start + 1)).blockRange($to.pos < end ? $to : doc.resolve(end - 1));
|
|
20769
20377
|
if (deeper && deeper.depth > depth) {
|
|
20770
20378
|
return deeper;
|
|
20771
20379
|
}
|
|
@@ -20904,27 +20512,27 @@ var Selection3 = class {
|
|
|
20904
20512
|
[`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position
|
|
20905
20513
|
exists.
|
|
20906
20514
|
*/
|
|
20907
|
-
static atStart(
|
|
20908
|
-
return findSelectionIn(
|
|
20515
|
+
static atStart(doc) {
|
|
20516
|
+
return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc);
|
|
20909
20517
|
}
|
|
20910
20518
|
/**
|
|
20911
20519
|
Find the cursor or leaf node selection closest to the end of the
|
|
20912
20520
|
given document.
|
|
20913
20521
|
*/
|
|
20914
|
-
static atEnd(
|
|
20915
|
-
return findSelectionIn(
|
|
20522
|
+
static atEnd(doc) {
|
|
20523
|
+
return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc);
|
|
20916
20524
|
}
|
|
20917
20525
|
/**
|
|
20918
20526
|
Deserialize the JSON representation of a selection. Must be
|
|
20919
20527
|
implemented for custom classes (as a static class method).
|
|
20920
20528
|
*/
|
|
20921
|
-
static fromJSON(
|
|
20529
|
+
static fromJSON(doc, json) {
|
|
20922
20530
|
if (!json || !json.type)
|
|
20923
20531
|
throw new RangeError("Invalid input for Selection.fromJSON");
|
|
20924
20532
|
let cls = classesById[json.type];
|
|
20925
20533
|
if (!cls)
|
|
20926
20534
|
throw new RangeError(`No selection type ${json.type} defined`);
|
|
20927
|
-
return cls.fromJSON(
|
|
20535
|
+
return cls.fromJSON(doc, json);
|
|
20928
20536
|
}
|
|
20929
20537
|
/**
|
|
20930
20538
|
To be able to deserialize selections from JSON, custom selection
|
|
@@ -20985,11 +20593,11 @@ var TextSelection8 = class _TextSelection extends Selection3 {
|
|
|
20985
20593
|
get $cursor() {
|
|
20986
20594
|
return this.$anchor.pos == this.$head.pos ? this.$head : null;
|
|
20987
20595
|
}
|
|
20988
|
-
map(
|
|
20989
|
-
let $head =
|
|
20596
|
+
map(doc, mapping) {
|
|
20597
|
+
let $head = doc.resolve(mapping.map(this.head));
|
|
20990
20598
|
if (!$head.parent.inlineContent)
|
|
20991
20599
|
return Selection3.near($head);
|
|
20992
|
-
let $anchor =
|
|
20600
|
+
let $anchor = doc.resolve(mapping.map(this.anchor));
|
|
20993
20601
|
return new _TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head);
|
|
20994
20602
|
}
|
|
20995
20603
|
replace(tr, content = Slice3.empty) {
|
|
@@ -21012,17 +20620,17 @@ var TextSelection8 = class _TextSelection extends Selection3 {
|
|
|
21012
20620
|
/**
|
|
21013
20621
|
@internal
|
|
21014
20622
|
*/
|
|
21015
|
-
static fromJSON(
|
|
20623
|
+
static fromJSON(doc, json) {
|
|
21016
20624
|
if (typeof json.anchor != "number" || typeof json.head != "number")
|
|
21017
20625
|
throw new RangeError("Invalid input for TextSelection.fromJSON");
|
|
21018
|
-
return new _TextSelection(
|
|
20626
|
+
return new _TextSelection(doc.resolve(json.anchor), doc.resolve(json.head));
|
|
21019
20627
|
}
|
|
21020
20628
|
/**
|
|
21021
20629
|
Create a text selection from non-resolved positions.
|
|
21022
20630
|
*/
|
|
21023
|
-
static create(
|
|
21024
|
-
let $anchor =
|
|
21025
|
-
return new this($anchor, head == anchor ? $anchor :
|
|
20631
|
+
static create(doc, anchor, head = anchor) {
|
|
20632
|
+
let $anchor = doc.resolve(anchor);
|
|
20633
|
+
return new this($anchor, head == anchor ? $anchor : doc.resolve(head));
|
|
21026
20634
|
}
|
|
21027
20635
|
/**
|
|
21028
20636
|
Return a text selection that spans the given positions or, if
|
|
@@ -21064,8 +20672,8 @@ var TextBookmark = class _TextBookmark {
|
|
|
21064
20672
|
map(mapping) {
|
|
21065
20673
|
return new _TextBookmark(mapping.map(this.anchor), mapping.map(this.head));
|
|
21066
20674
|
}
|
|
21067
|
-
resolve(
|
|
21068
|
-
return TextSelection8.between(
|
|
20675
|
+
resolve(doc) {
|
|
20676
|
+
return TextSelection8.between(doc.resolve(this.anchor), doc.resolve(this.head));
|
|
21069
20677
|
}
|
|
21070
20678
|
};
|
|
21071
20679
|
var NodeSelection = class _NodeSelection extends Selection3 {
|
|
@@ -21079,9 +20687,9 @@ var NodeSelection = class _NodeSelection extends Selection3 {
|
|
|
21079
20687
|
super($pos, $end);
|
|
21080
20688
|
this.node = node;
|
|
21081
20689
|
}
|
|
21082
|
-
map(
|
|
20690
|
+
map(doc, mapping) {
|
|
21083
20691
|
let { deleted, pos } = mapping.mapResult(this.anchor);
|
|
21084
|
-
let $pos =
|
|
20692
|
+
let $pos = doc.resolve(pos);
|
|
21085
20693
|
if (deleted)
|
|
21086
20694
|
return Selection3.near($pos);
|
|
21087
20695
|
return new _NodeSelection($pos);
|
|
@@ -21101,16 +20709,16 @@ var NodeSelection = class _NodeSelection extends Selection3 {
|
|
|
21101
20709
|
/**
|
|
21102
20710
|
@internal
|
|
21103
20711
|
*/
|
|
21104
|
-
static fromJSON(
|
|
20712
|
+
static fromJSON(doc, json) {
|
|
21105
20713
|
if (typeof json.anchor != "number")
|
|
21106
20714
|
throw new RangeError("Invalid input for NodeSelection.fromJSON");
|
|
21107
|
-
return new _NodeSelection(
|
|
20715
|
+
return new _NodeSelection(doc.resolve(json.anchor));
|
|
21108
20716
|
}
|
|
21109
20717
|
/**
|
|
21110
20718
|
Create a node selection from non-resolved positions.
|
|
21111
20719
|
*/
|
|
21112
|
-
static create(
|
|
21113
|
-
return new _NodeSelection(
|
|
20720
|
+
static create(doc, from) {
|
|
20721
|
+
return new _NodeSelection(doc.resolve(from));
|
|
21114
20722
|
}
|
|
21115
20723
|
/**
|
|
21116
20724
|
Determines whether the given node may be selected as a node
|
|
@@ -21130,8 +20738,8 @@ var NodeBookmark = class _NodeBookmark {
|
|
|
21130
20738
|
let { deleted, pos } = mapping.mapResult(this.anchor);
|
|
21131
20739
|
return deleted ? new TextBookmark(pos, pos) : new _NodeBookmark(pos);
|
|
21132
20740
|
}
|
|
21133
|
-
resolve(
|
|
21134
|
-
let $pos =
|
|
20741
|
+
resolve(doc) {
|
|
20742
|
+
let $pos = doc.resolve(this.anchor), node = $pos.nodeAfter;
|
|
21135
20743
|
if (node && NodeSelection.isSelectable(node))
|
|
21136
20744
|
return new NodeSelection($pos);
|
|
21137
20745
|
return Selection3.near($pos);
|
|
@@ -21141,8 +20749,8 @@ var AllSelection = class _AllSelection extends Selection3 {
|
|
|
21141
20749
|
/**
|
|
21142
20750
|
Create an all-selection over the given document.
|
|
21143
20751
|
*/
|
|
21144
|
-
constructor(
|
|
21145
|
-
super(
|
|
20752
|
+
constructor(doc) {
|
|
20753
|
+
super(doc.resolve(0), doc.resolve(doc.content.size));
|
|
21146
20754
|
}
|
|
21147
20755
|
replace(tr, content = Slice3.empty) {
|
|
21148
20756
|
if (content == Slice3.empty) {
|
|
@@ -21160,11 +20768,11 @@ var AllSelection = class _AllSelection extends Selection3 {
|
|
|
21160
20768
|
/**
|
|
21161
20769
|
@internal
|
|
21162
20770
|
*/
|
|
21163
|
-
static fromJSON(
|
|
21164
|
-
return new _AllSelection(
|
|
20771
|
+
static fromJSON(doc) {
|
|
20772
|
+
return new _AllSelection(doc);
|
|
21165
20773
|
}
|
|
21166
|
-
map(
|
|
21167
|
-
return new _AllSelection(
|
|
20774
|
+
map(doc) {
|
|
20775
|
+
return new _AllSelection(doc);
|
|
21168
20776
|
}
|
|
21169
20777
|
eq(other) {
|
|
21170
20778
|
return other instanceof _AllSelection;
|
|
@@ -21178,21 +20786,21 @@ var AllBookmark = {
|
|
|
21178
20786
|
map() {
|
|
21179
20787
|
return this;
|
|
21180
20788
|
},
|
|
21181
|
-
resolve(
|
|
21182
|
-
return new AllSelection(
|
|
20789
|
+
resolve(doc) {
|
|
20790
|
+
return new AllSelection(doc);
|
|
21183
20791
|
}
|
|
21184
20792
|
};
|
|
21185
|
-
function findSelectionIn(
|
|
20793
|
+
function findSelectionIn(doc, node, pos, index, dir, text = false) {
|
|
21186
20794
|
if (node.inlineContent)
|
|
21187
|
-
return TextSelection8.create(
|
|
20795
|
+
return TextSelection8.create(doc, pos);
|
|
21188
20796
|
for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {
|
|
21189
20797
|
let child = node.child(i);
|
|
21190
20798
|
if (!child.isAtom) {
|
|
21191
|
-
let inner = findSelectionIn(
|
|
20799
|
+
let inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);
|
|
21192
20800
|
if (inner)
|
|
21193
20801
|
return inner;
|
|
21194
20802
|
} else if (!text && NodeSelection.isSelectable(child)) {
|
|
21195
|
-
return NodeSelection.create(
|
|
20803
|
+
return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0));
|
|
21196
20804
|
}
|
|
21197
20805
|
pos += child.nodeSize * dir;
|
|
21198
20806
|
}
|
|
@@ -21256,42 +20864,6 @@ var baseFields = [
|
|
|
21256
20864
|
}
|
|
21257
20865
|
})
|
|
21258
20866
|
];
|
|
21259
|
-
function bindProps(obj, self, target) {
|
|
21260
|
-
for (let prop in obj) {
|
|
21261
|
-
let val = obj[prop];
|
|
21262
|
-
if (val instanceof Function)
|
|
21263
|
-
val = val.bind(self);
|
|
21264
|
-
else if (prop == "handleDOMEvents")
|
|
21265
|
-
val = bindProps(val, self, {});
|
|
21266
|
-
target[prop] = val;
|
|
21267
|
-
}
|
|
21268
|
-
return target;
|
|
21269
|
-
}
|
|
21270
|
-
var Plugin2 = class {
|
|
21271
|
-
/**
|
|
21272
|
-
Create a plugin.
|
|
21273
|
-
*/
|
|
21274
|
-
constructor(spec) {
|
|
21275
|
-
this.spec = spec;
|
|
21276
|
-
this.props = {};
|
|
21277
|
-
if (spec.props)
|
|
21278
|
-
bindProps(spec.props, this, this.props);
|
|
21279
|
-
this.key = spec.key ? spec.key.key : createKey("plugin");
|
|
21280
|
-
}
|
|
21281
|
-
/**
|
|
21282
|
-
Extract the plugin's state field from an editor state.
|
|
21283
|
-
*/
|
|
21284
|
-
getState(state) {
|
|
21285
|
-
return state[this.key];
|
|
21286
|
-
}
|
|
21287
|
-
};
|
|
21288
|
-
var keys = /* @__PURE__ */ Object.create(null);
|
|
21289
|
-
function createKey(name) {
|
|
21290
|
-
if (name in keys)
|
|
21291
|
-
return name + "$" + ++keys[name];
|
|
21292
|
-
keys[name] = 0;
|
|
21293
|
-
return name + "$";
|
|
21294
|
-
}
|
|
21295
20867
|
|
|
21296
20868
|
// src/editor/extensions/List/core/utils/is-collapsed-list-node.ts
|
|
21297
20869
|
function isCollapsedListNode(node) {
|
|
@@ -21301,9 +20873,9 @@ function isCollapsedListNode(node) {
|
|
|
21301
20873
|
// src/editor/extensions/List/core/utils/set-node-attributes.ts
|
|
21302
20874
|
function setNodeAttributes(tr, pos, oldAttrs, newAttrs) {
|
|
21303
20875
|
let needUpdate = false;
|
|
21304
|
-
for (const
|
|
21305
|
-
if (newAttrs[
|
|
21306
|
-
tr.setNodeAttribute(pos,
|
|
20876
|
+
for (const key2 of Object.keys(newAttrs)) {
|
|
20877
|
+
if (newAttrs[key2] !== oldAttrs[key2]) {
|
|
20878
|
+
tr.setNodeAttribute(pos, key2, newAttrs[key2]);
|
|
21307
20879
|
needUpdate = true;
|
|
21308
20880
|
}
|
|
21309
20881
|
}
|
|
@@ -21948,8 +21520,8 @@ var macBaseKeymap = {
|
|
|
21948
21520
|
"Ctrl-a": selectTextblockStart,
|
|
21949
21521
|
"Ctrl-e": selectTextblockEnd
|
|
21950
21522
|
};
|
|
21951
|
-
for (let
|
|
21952
|
-
macBaseKeymap[
|
|
21523
|
+
for (let key2 in pcBaseKeymap)
|
|
21524
|
+
macBaseKeymap[key2] = pcBaseKeymap[key2];
|
|
21953
21525
|
var mac = typeof navigator != "undefined" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os != "undefined" && os.platform ? os.platform() == "darwin" : false;
|
|
21954
21526
|
|
|
21955
21527
|
// src/editor/extensions/List/core/commands/enter-without-lift.ts
|
|
@@ -22022,7 +21594,9 @@ function splitAndIndentRange(range, tr, splitIndex) {
|
|
|
22022
21594
|
const getRange2To = mapPos(tr, $to.pos);
|
|
22023
21595
|
indentRange(range1, tr, void 0, true);
|
|
22024
21596
|
const range2 = tr.doc.resolve(getRange2From()).blockRange(tr.doc.resolve(getRange2To()));
|
|
22025
|
-
|
|
21597
|
+
if (range2) {
|
|
21598
|
+
indentRange(range2, tr, true, void 0);
|
|
21599
|
+
}
|
|
22026
21600
|
return true;
|
|
22027
21601
|
}
|
|
22028
21602
|
function indentNodeRange(range, tr) {
|
|
@@ -22372,272 +21946,8 @@ var listKeymap = {
|
|
|
22372
21946
|
"Mod-]": createIndentListCommand()
|
|
22373
21947
|
};
|
|
22374
21948
|
|
|
22375
|
-
// src/editor/extensions/List/core/utils/cut-by-index.ts
|
|
22376
|
-
function cutByIndex(fragment, from, to) {
|
|
22377
|
-
return fragment.cutByIndex(from, to);
|
|
22378
|
-
}
|
|
22379
|
-
|
|
22380
|
-
// src/editor/extensions/List/core/commands/move-list.ts
|
|
22381
|
-
function createMoveListCommand(direction) {
|
|
22382
|
-
const moveList = (state, dispatch) => {
|
|
22383
|
-
const tr = state.tr;
|
|
22384
|
-
if (doMoveList(tr, direction, true, !!dispatch)) {
|
|
22385
|
-
dispatch?.(tr);
|
|
22386
|
-
return true;
|
|
22387
|
-
}
|
|
22388
|
-
return false;
|
|
22389
|
-
};
|
|
22390
|
-
return withAutoFixList(moveList);
|
|
22391
|
-
}
|
|
22392
|
-
function doMoveList(tr, direction, canDedent, dispatch) {
|
|
22393
|
-
const { $from, $to } = tr.selection;
|
|
22394
|
-
const range = findListsRange($from, $to);
|
|
22395
|
-
if (!range) return false;
|
|
22396
|
-
const { parent, depth, startIndex, endIndex } = range;
|
|
22397
|
-
if (direction === "up") {
|
|
22398
|
-
if (startIndex >= 2 || startIndex === 1 && isListNode(parent.child(0))) {
|
|
22399
|
-
const before = cutByIndex(parent.content, startIndex - 1, startIndex);
|
|
22400
|
-
const selected = cutByIndex(parent.content, startIndex, endIndex);
|
|
22401
|
-
if (parent.canReplace(startIndex - 1, endIndex, selected.append(before))) {
|
|
22402
|
-
if (dispatch) {
|
|
22403
|
-
tr.insert($from.posAtIndex(endIndex, depth), before);
|
|
22404
|
-
tr.delete(
|
|
22405
|
-
$from.posAtIndex(startIndex - 1, depth),
|
|
22406
|
-
$from.posAtIndex(startIndex, depth)
|
|
22407
|
-
);
|
|
22408
|
-
}
|
|
22409
|
-
return true;
|
|
22410
|
-
} else {
|
|
22411
|
-
return false;
|
|
22412
|
-
}
|
|
22413
|
-
} else if (canDedent && isListNode(parent)) {
|
|
22414
|
-
return safeLift(tr, range) && doMoveList(tr, direction, false, dispatch);
|
|
22415
|
-
} else {
|
|
22416
|
-
return false;
|
|
22417
|
-
}
|
|
22418
|
-
} else {
|
|
22419
|
-
if (endIndex < parent.childCount) {
|
|
22420
|
-
const selected = cutByIndex(parent.content, startIndex, endIndex);
|
|
22421
|
-
const after = cutByIndex(parent.content, endIndex, endIndex + 1);
|
|
22422
|
-
if (parent.canReplace(startIndex, endIndex + 1, after.append(selected))) {
|
|
22423
|
-
if (dispatch) {
|
|
22424
|
-
tr.delete(
|
|
22425
|
-
$from.posAtIndex(endIndex, depth),
|
|
22426
|
-
$from.posAtIndex(endIndex + 1, depth)
|
|
22427
|
-
);
|
|
22428
|
-
tr.insert($from.posAtIndex(startIndex, depth), after);
|
|
22429
|
-
}
|
|
22430
|
-
return true;
|
|
22431
|
-
} else {
|
|
22432
|
-
return false;
|
|
22433
|
-
}
|
|
22434
|
-
} else if (canDedent && isListNode(parent)) {
|
|
22435
|
-
return safeLift(tr, range) && doMoveList(tr, direction, false, dispatch);
|
|
22436
|
-
} else {
|
|
22437
|
-
return false;
|
|
22438
|
-
}
|
|
22439
|
-
}
|
|
22440
|
-
}
|
|
22441
|
-
|
|
22442
|
-
// src/editor/extensions/List/core/commands/toggle-collapsed.ts
|
|
22443
|
-
function createToggleCollapsedCommand({
|
|
22444
|
-
collapsed = void 0,
|
|
22445
|
-
isToggleable = defaultIsToggleable
|
|
22446
|
-
} = {}) {
|
|
22447
|
-
const toggleCollapsed = (state, dispatch) => {
|
|
22448
|
-
const { $from } = state.selection;
|
|
22449
|
-
for (let depth = $from.depth; depth >= 0; depth--) {
|
|
22450
|
-
const node = $from.node(depth);
|
|
22451
|
-
if (isListNode(node) && isToggleable(node)) {
|
|
22452
|
-
if (dispatch) {
|
|
22453
|
-
const pos = $from.before(depth);
|
|
22454
|
-
const attrs = node.attrs;
|
|
22455
|
-
const tr = state.tr;
|
|
22456
|
-
tr.setNodeAttribute(pos, "collapsed", collapsed ?? !attrs.collapsed);
|
|
22457
|
-
dispatch(setSafeSelection(tr));
|
|
22458
|
-
}
|
|
22459
|
-
return true;
|
|
22460
|
-
}
|
|
22461
|
-
}
|
|
22462
|
-
return false;
|
|
22463
|
-
};
|
|
22464
|
-
return toggleCollapsed;
|
|
22465
|
-
}
|
|
22466
|
-
function defaultIsToggleable(node) {
|
|
22467
|
-
const attrs = node.attrs;
|
|
22468
|
-
return attrs.kind === "toggle" && node.childCount >= 2 && !isListNode(node.firstChild);
|
|
22469
|
-
}
|
|
22470
|
-
|
|
22471
|
-
// src/editor/extensions/List/core/commands/unwrap-list.ts
|
|
22472
|
-
function createUnwrapListCommand(options) {
|
|
22473
|
-
const kind = options?.kind;
|
|
22474
|
-
const unwrapList = (state, dispatch) => {
|
|
22475
|
-
const selection = state.selection;
|
|
22476
|
-
if (isNodeSelection(selection) && isTargetList(selection.node, kind)) {
|
|
22477
|
-
if (dispatch) {
|
|
22478
|
-
const tr = state.tr;
|
|
22479
|
-
safeLiftFromTo(tr, tr.selection.from + 1, tr.selection.to - 1);
|
|
22480
|
-
dispatch(tr.scrollIntoView());
|
|
22481
|
-
}
|
|
22482
|
-
return true;
|
|
22483
|
-
}
|
|
22484
|
-
const range = selection.$from.blockRange(selection.$to);
|
|
22485
|
-
if (range && isTargetListsRange(range, kind)) {
|
|
22486
|
-
const tr = state.tr;
|
|
22487
|
-
if (dedentOutOfList(tr, range)) {
|
|
22488
|
-
dispatch?.(tr);
|
|
22489
|
-
return true;
|
|
22490
|
-
}
|
|
22491
|
-
}
|
|
22492
|
-
if (range && isTargetList(range.parent, kind)) {
|
|
22493
|
-
if (dispatch) {
|
|
22494
|
-
const tr = state.tr;
|
|
22495
|
-
safeLiftFromTo(
|
|
22496
|
-
tr,
|
|
22497
|
-
range.$from.start(range.depth),
|
|
22498
|
-
range.$to.end(range.depth)
|
|
22499
|
-
);
|
|
22500
|
-
dispatch(tr.scrollIntoView());
|
|
22501
|
-
}
|
|
22502
|
-
return true;
|
|
22503
|
-
}
|
|
22504
|
-
return false;
|
|
22505
|
-
};
|
|
22506
|
-
return unwrapList;
|
|
22507
|
-
}
|
|
22508
|
-
function isTargetList(node, kind) {
|
|
22509
|
-
if (isListNode(node)) {
|
|
22510
|
-
if (kind) {
|
|
22511
|
-
return node.attrs.kind === kind;
|
|
22512
|
-
}
|
|
22513
|
-
return true;
|
|
22514
|
-
}
|
|
22515
|
-
return false;
|
|
22516
|
-
}
|
|
22517
|
-
function isTargetListsRange(range, kind) {
|
|
22518
|
-
const { startIndex, endIndex, parent } = range;
|
|
22519
|
-
for (let i = startIndex; i < endIndex; i++) {
|
|
22520
|
-
if (!isTargetList(parent.child(i), kind)) {
|
|
22521
|
-
return false;
|
|
22522
|
-
}
|
|
22523
|
-
}
|
|
22524
|
-
return true;
|
|
22525
|
-
}
|
|
22526
|
-
|
|
22527
|
-
// src/editor/extensions/List/core/commands/wrap-in-list.ts
|
|
22528
|
-
function createWrapInListCommand(getAttrs2) {
|
|
22529
|
-
const wrapInList = (state, dispatch) => {
|
|
22530
|
-
const { $from, $to } = state.selection;
|
|
22531
|
-
let range = $from.blockRange($to);
|
|
22532
|
-
if (!range) {
|
|
22533
|
-
return false;
|
|
22534
|
-
}
|
|
22535
|
-
if (rangeAllowInlineContent(range) && isListNode(range.parent) && range.depth > 0 && range.startIndex === 0) {
|
|
22536
|
-
range = new NodeRange2($from, $to, range.depth - 1);
|
|
22537
|
-
}
|
|
22538
|
-
const attrs = typeof getAttrs2 === "function" ? getAttrs2(range) : getAttrs2;
|
|
22539
|
-
if (!attrs) {
|
|
22540
|
-
return false;
|
|
22541
|
-
}
|
|
22542
|
-
const { parent, startIndex, endIndex, depth } = range;
|
|
22543
|
-
const tr = state.tr;
|
|
22544
|
-
const listType = getListType(state.schema);
|
|
22545
|
-
for (let i = endIndex - 1; i >= startIndex; i--) {
|
|
22546
|
-
const node = parent.child(i);
|
|
22547
|
-
if (isListNode(node)) {
|
|
22548
|
-
const oldAttrs = node.attrs;
|
|
22549
|
-
const newAttrs = { ...oldAttrs, ...attrs };
|
|
22550
|
-
setNodeAttributes(tr, $from.posAtIndex(i, depth), oldAttrs, newAttrs);
|
|
22551
|
-
} else {
|
|
22552
|
-
const beforeNode = $from.posAtIndex(i, depth);
|
|
22553
|
-
const afterNode = $from.posAtIndex(i + 1, depth);
|
|
22554
|
-
let nodeStart = beforeNode + 1;
|
|
22555
|
-
let nodeEnd = afterNode - 1;
|
|
22556
|
-
if (nodeStart > nodeEnd) {
|
|
22557
|
-
;
|
|
22558
|
-
[nodeStart, nodeEnd] = [nodeEnd, nodeStart];
|
|
22559
|
-
}
|
|
22560
|
-
const range2 = new NodeRange2(
|
|
22561
|
-
tr.doc.resolve(nodeStart),
|
|
22562
|
-
tr.doc.resolve(nodeEnd),
|
|
22563
|
-
depth
|
|
22564
|
-
);
|
|
22565
|
-
const wrapping = findWrapping(range2, listType, attrs);
|
|
22566
|
-
if (wrapping) {
|
|
22567
|
-
tr.wrap(range2, wrapping);
|
|
22568
|
-
}
|
|
22569
|
-
}
|
|
22570
|
-
}
|
|
22571
|
-
dispatch?.(tr);
|
|
22572
|
-
return true;
|
|
22573
|
-
};
|
|
22574
|
-
return wrapInList;
|
|
22575
|
-
}
|
|
22576
|
-
function rangeAllowInlineContent(range) {
|
|
22577
|
-
const { parent, startIndex, endIndex } = range;
|
|
22578
|
-
for (let i = startIndex; i < endIndex; i++) {
|
|
22579
|
-
if (parent.child(i).inlineContent) {
|
|
22580
|
-
return true;
|
|
22581
|
-
}
|
|
22582
|
-
}
|
|
22583
|
-
return false;
|
|
22584
|
-
}
|
|
22585
|
-
|
|
22586
|
-
// src/editor/extensions/List/core/commands/toggle-list.ts
|
|
22587
|
-
function createToggleListCommand(attrs) {
|
|
22588
|
-
const unwrapList = createUnwrapListCommand({ kind: attrs.kind });
|
|
22589
|
-
const wrapInList = createWrapInListCommand(attrs);
|
|
22590
|
-
return chainCommands2(unwrapList, wrapInList);
|
|
22591
|
-
}
|
|
22592
|
-
|
|
22593
|
-
// src/editor/extensions/List/core/dom-events.ts
|
|
22594
|
-
function handleListMarkerMouseDown({
|
|
22595
|
-
view,
|
|
22596
|
-
event,
|
|
22597
|
-
onListClick = defaultListClickHandler
|
|
22598
|
-
}) {
|
|
22599
|
-
const target = event.target;
|
|
22600
|
-
if (target?.closest(".list-marker-click-target")) {
|
|
22601
|
-
event.preventDefault();
|
|
22602
|
-
const pos = view.posAtDOM(target, -10, -10);
|
|
22603
|
-
return handleMouseDown(pos, onListClick)(
|
|
22604
|
-
view.state,
|
|
22605
|
-
(tr) => view.dispatch(tr)
|
|
22606
|
-
);
|
|
22607
|
-
}
|
|
22608
|
-
return false;
|
|
22609
|
-
}
|
|
22610
|
-
function handleMouseDown(pos, onListClick) {
|
|
22611
|
-
const mouseDown = (state, dispatch) => {
|
|
22612
|
-
const tr = state.tr;
|
|
22613
|
-
const $pos = tr.doc.resolve(pos);
|
|
22614
|
-
const list = $pos.parent;
|
|
22615
|
-
if (!isListNode(list)) {
|
|
22616
|
-
return false;
|
|
22617
|
-
}
|
|
22618
|
-
const listPos = $pos.before($pos.depth);
|
|
22619
|
-
const attrs = onListClick(list);
|
|
22620
|
-
if (setNodeAttributes(tr, listPos, list.attrs, attrs)) {
|
|
22621
|
-
dispatch?.(tr);
|
|
22622
|
-
}
|
|
22623
|
-
return true;
|
|
22624
|
-
};
|
|
22625
|
-
return withSafeSelection(mouseDown);
|
|
22626
|
-
}
|
|
22627
|
-
var defaultListClickHandler = (node) => {
|
|
22628
|
-
const attrs = node.attrs;
|
|
22629
|
-
if (attrs.kind === "task") {
|
|
22630
|
-
return { ...attrs, checked: !attrs.checked };
|
|
22631
|
-
} else if (attrs.kind === "toggle") {
|
|
22632
|
-
return { ...attrs, collapsed: !attrs.collapsed };
|
|
22633
|
-
} else {
|
|
22634
|
-
return attrs;
|
|
22635
|
-
}
|
|
22636
|
-
};
|
|
22637
|
-
|
|
22638
21949
|
// node_modules/prosemirror-inputrules/dist/index.js
|
|
22639
21950
|
var InputRule = class {
|
|
22640
|
-
// :: (RegExp, union<string, (state: EditorState, match: [string], start: number, end: number) → ?Transaction>)
|
|
22641
21951
|
/**
|
|
22642
21952
|
Create an input rule. The rule applies when the user typed
|
|
22643
21953
|
something and the text directly in front of the cursor matches
|
|
@@ -22660,6 +21970,7 @@ var InputRule = class {
|
|
|
22660
21970
|
this.handler = typeof handler == "string" ? stringHandler(handler) : handler;
|
|
22661
21971
|
this.undoable = options.undoable !== false;
|
|
22662
21972
|
this.inCode = options.inCode || false;
|
|
21973
|
+
this.inCodeMark = options.inCodeMark !== false;
|
|
22663
21974
|
}
|
|
22664
21975
|
};
|
|
22665
21976
|
function stringHandler(string) {
|
|
@@ -22678,12 +21989,12 @@ function stringHandler(string) {
|
|
|
22678
21989
|
return state.tr.insertText(insert, start, end);
|
|
22679
21990
|
};
|
|
22680
21991
|
}
|
|
22681
|
-
var emDash = new InputRule(/--$/, "\u2014");
|
|
22682
|
-
var ellipsis = new InputRule(/\.\.\.$/, "\u2026");
|
|
22683
|
-
var openDoubleQuote = new InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/, "\u201C");
|
|
22684
|
-
var closeDoubleQuote = new InputRule(/"$/, "\u201D");
|
|
22685
|
-
var openSingleQuote = new InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/, "\u2018");
|
|
22686
|
-
var closeSingleQuote = new InputRule(/'$/, "\u2019");
|
|
21992
|
+
var emDash = new InputRule(/--$/, "\u2014", { inCodeMark: false });
|
|
21993
|
+
var ellipsis = new InputRule(/\.\.\.$/, "\u2026", { inCodeMark: false });
|
|
21994
|
+
var openDoubleQuote = new InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/, "\u201C", { inCodeMark: false });
|
|
21995
|
+
var closeDoubleQuote = new InputRule(/"$/, "\u201D", { inCodeMark: false });
|
|
21996
|
+
var openSingleQuote = new InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/, "\u2018", { inCodeMark: false });
|
|
21997
|
+
var closeSingleQuote = new InputRule(/'$/, "\u2019", { inCodeMark: false });
|
|
22687
21998
|
|
|
22688
21999
|
// src/editor/extensions/List/core/input-rule.ts
|
|
22689
22000
|
function isInsideTableCell($pos) {
|
|
@@ -22709,15 +22020,15 @@ function wrappingListInputRule(regexp, getAttrs2) {
|
|
|
22709
22020
|
if (listNode && isListNode(listNode)) {
|
|
22710
22021
|
const oldAttrs = listNode.attrs;
|
|
22711
22022
|
const newAttrs2 = typeof getAttrs2 === "function" ? getAttrs2({ match, attributes: oldAttrs }) : getAttrs2;
|
|
22712
|
-
const entries = Object.entries(newAttrs2).filter(([
|
|
22713
|
-
return oldAttrs[
|
|
22023
|
+
const entries = Object.entries(newAttrs2).filter(([key2, value]) => {
|
|
22024
|
+
return oldAttrs[key2] !== value;
|
|
22714
22025
|
});
|
|
22715
22026
|
if (entries.length === 0) {
|
|
22716
22027
|
return null;
|
|
22717
22028
|
} else {
|
|
22718
22029
|
const pos = $pos.before(-1);
|
|
22719
|
-
for (const [
|
|
22720
|
-
tr.setNodeAttribute(pos,
|
|
22030
|
+
for (const [key2, value] of entries) {
|
|
22031
|
+
tr.setNodeAttribute(pos, key2, value);
|
|
22721
22032
|
}
|
|
22722
22033
|
return tr;
|
|
22723
22034
|
}
|
|
@@ -22770,190 +22081,14 @@ var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent);
|
|
|
22770
22081
|
var ie = !!(ie_upto10 || ie_11up || ie_edge);
|
|
22771
22082
|
var safari = !ie && !!nav && /Apple Computer/.test(nav.vendor);
|
|
22772
22083
|
|
|
22773
|
-
// src/editor/extensions/List/core/node-view.ts
|
|
22774
|
-
var createListNodeView = (node) => {
|
|
22775
|
-
let prevNode = node;
|
|
22776
|
-
const prevNested = node.firstChild?.type === node.type;
|
|
22777
|
-
const prevSingleChild = node.childCount === 1;
|
|
22778
|
-
const spec = node.type.spec.toDOM(node);
|
|
22779
|
-
const { dom, contentDOM } = DOMSerializer.renderSpec(document, spec);
|
|
22780
|
-
if (safari && node.attrs.kind === "toggle") {
|
|
22781
|
-
;
|
|
22782
|
-
dom.querySelector(".list-marker-click-target")?.appendChild(document.createElement("span"));
|
|
22783
|
-
}
|
|
22784
|
-
const update = (node2) => {
|
|
22785
|
-
if (!node2.sameMarkup(prevNode)) return false;
|
|
22786
|
-
const nested = node2.firstChild?.type === node2.type;
|
|
22787
|
-
const singleChild = node2.childCount === 1;
|
|
22788
|
-
if (prevNested !== nested || prevSingleChild !== singleChild) return false;
|
|
22789
|
-
prevNode = node2;
|
|
22790
|
-
return true;
|
|
22791
|
-
};
|
|
22792
|
-
return { dom, contentDOM, update };
|
|
22793
|
-
};
|
|
22794
|
-
|
|
22795
|
-
// src/editor/extensions/List/core/utils/list-serializer.ts
|
|
22796
|
-
var ListDOMSerializer = class _ListDOMSerializer extends DOMSerializer {
|
|
22797
|
-
static nodesFromSchema(schema) {
|
|
22798
|
-
const nodes = DOMSerializer.nodesFromSchema(schema);
|
|
22799
|
-
return {
|
|
22800
|
-
...nodes,
|
|
22801
|
-
list: (node) => listToDOM({ node, nativeList: true, getMarkers: () => null })
|
|
22802
|
-
};
|
|
22803
|
-
}
|
|
22804
|
-
static fromSchema(schema) {
|
|
22805
|
-
return schema.cached.listDomSerializer || (schema.cached.listDomSerializer = new _ListDOMSerializer(
|
|
22806
|
-
this.nodesFromSchema(schema),
|
|
22807
|
-
this.marksFromSchema(schema)
|
|
22808
|
-
));
|
|
22809
|
-
}
|
|
22810
|
-
serializeFragment(fragment, options, target) {
|
|
22811
|
-
const dom = super.serializeFragment(fragment, options, target);
|
|
22812
|
-
return joinListElements(dom);
|
|
22813
|
-
}
|
|
22814
|
-
};
|
|
22815
|
-
function joinListElements(parent) {
|
|
22816
|
-
for (let i = 0; i < parent.childNodes.length; i++) {
|
|
22817
|
-
const child = parent.children.item(i);
|
|
22818
|
-
if (!child) continue;
|
|
22819
|
-
if (child.tagName === "UL" || child.tagName === "OL") {
|
|
22820
|
-
let next = null;
|
|
22821
|
-
while (next = child.nextElementSibling, next?.tagName === child.tagName) {
|
|
22822
|
-
child.append(...Array.from(next.children));
|
|
22823
|
-
next.remove();
|
|
22824
|
-
}
|
|
22825
|
-
}
|
|
22826
|
-
joinListElements(child);
|
|
22827
|
-
}
|
|
22828
|
-
return parent;
|
|
22829
|
-
}
|
|
22830
|
-
|
|
22831
|
-
// src/editor/extensions/List/core/utils/unwrap-list-slice.ts
|
|
22832
|
-
function unwrapListSlice(slice) {
|
|
22833
|
-
while (slice.openStart >= 2 && slice.openEnd >= 2 && slice.content.childCount === 1 && isListNode(slice.content.child(0))) {
|
|
22834
|
-
slice = new Slice3(
|
|
22835
|
-
slice.content.child(0).content,
|
|
22836
|
-
slice.openStart - 1,
|
|
22837
|
-
slice.openEnd - 1
|
|
22838
|
-
);
|
|
22839
|
-
}
|
|
22840
|
-
return slice;
|
|
22841
|
-
}
|
|
22842
|
-
|
|
22843
|
-
// src/editor/extensions/List/core/plugins/clipboard.ts
|
|
22844
|
-
function createListClipboardPlugin(schema) {
|
|
22845
|
-
return new Plugin2({
|
|
22846
|
-
props: {
|
|
22847
|
-
clipboardSerializer: ListDOMSerializer.fromSchema(schema),
|
|
22848
|
-
transformCopied: unwrapListSlice
|
|
22849
|
-
}
|
|
22850
|
-
});
|
|
22851
|
-
}
|
|
22852
|
-
|
|
22853
|
-
// src/editor/extensions/List/core/plugins/event.ts
|
|
22854
|
-
function createListEventPlugin() {
|
|
22855
|
-
return new Plugin2({
|
|
22856
|
-
props: {
|
|
22857
|
-
handleDOMEvents: {
|
|
22858
|
-
mousedown: (view, event) => handleListMarkerMouseDown({ view, event })
|
|
22859
|
-
}
|
|
22860
|
-
}
|
|
22861
|
-
});
|
|
22862
|
-
}
|
|
22863
|
-
|
|
22864
|
-
// src/editor/extensions/List/core/plugins/rendering.ts
|
|
22865
|
-
function createListRenderingPlugin() {
|
|
22866
|
-
return new Plugin2({
|
|
22867
|
-
props: {
|
|
22868
|
-
nodeViews: {
|
|
22869
|
-
list: createListNodeView
|
|
22870
|
-
}
|
|
22871
|
-
}
|
|
22872
|
-
});
|
|
22873
|
-
}
|
|
22874
|
-
|
|
22875
22084
|
// src/editor/extensions/List/core/plugins/safari-workaround.ts
|
|
22876
22085
|
import { imeSpan } from "prosemirror-safari-ime-span";
|
|
22877
|
-
function createSafariInputMethodWorkaroundPlugin() {
|
|
22878
|
-
return imeSpan;
|
|
22879
|
-
}
|
|
22880
|
-
|
|
22881
|
-
// src/editor/extensions/List/core/plugins/index.ts
|
|
22882
|
-
function createListPlugins({ schema }) {
|
|
22883
|
-
return [
|
|
22884
|
-
createListEventPlugin(),
|
|
22885
|
-
createListRenderingPlugin(),
|
|
22886
|
-
createListClipboardPlugin(schema),
|
|
22887
|
-
createSafariInputMethodWorkaroundPlugin()
|
|
22888
|
-
];
|
|
22889
|
-
}
|
|
22890
22086
|
|
|
22891
|
-
// src/editor/extensions/List/
|
|
22892
|
-
var
|
|
22893
|
-
static {
|
|
22894
|
-
this.disableExtraAttributes = true;
|
|
22895
|
-
}
|
|
22896
|
-
get name() {
|
|
22897
|
-
return "list";
|
|
22898
|
-
}
|
|
22899
|
-
createTags() {
|
|
22900
|
-
return [ExtensionTag6.Block];
|
|
22901
|
-
}
|
|
22902
|
-
createNodeSpec() {
|
|
22903
|
-
return createListSpec();
|
|
22904
|
-
}
|
|
22905
|
-
createKeymap() {
|
|
22906
|
-
const bindings = {};
|
|
22907
|
-
for (const [key, command5] of Object.entries(listKeymap)) {
|
|
22908
|
-
bindings[key] = convertCommand4(command5);
|
|
22909
|
-
}
|
|
22910
|
-
bindings["Tab"] = alwaysTrue(bindings["Mod-]"]);
|
|
22911
|
-
bindings["Shift-Tab"] = alwaysTrue(bindings["Mod-["]);
|
|
22912
|
-
return bindings;
|
|
22913
|
-
}
|
|
22914
|
-
createExternalPlugins() {
|
|
22915
|
-
return createListPlugins({ schema: this.store.schema });
|
|
22916
|
-
}
|
|
22087
|
+
// src/editor/extensions/List/list-extensions.ts
|
|
22088
|
+
var LineListExtension = class extends ListExtension {
|
|
22917
22089
|
createInputRules() {
|
|
22918
22090
|
return listInputRules;
|
|
22919
22091
|
}
|
|
22920
|
-
createCommands() {
|
|
22921
|
-
return {
|
|
22922
|
-
indentList: (props) => {
|
|
22923
|
-
return convertCommand4(createIndentListCommand(props));
|
|
22924
|
-
},
|
|
22925
|
-
dedentList: (props) => {
|
|
22926
|
-
return convertCommand4(createDedentListCommand(props));
|
|
22927
|
-
},
|
|
22928
|
-
unwrapList: (options) => {
|
|
22929
|
-
return convertCommand4(createUnwrapListCommand(options));
|
|
22930
|
-
},
|
|
22931
|
-
wrapInList: (getAttrs2) => {
|
|
22932
|
-
return convertCommand4(createWrapInListCommand(getAttrs2));
|
|
22933
|
-
},
|
|
22934
|
-
moveList: (direction) => {
|
|
22935
|
-
return convertCommand4(createMoveListCommand(direction));
|
|
22936
|
-
},
|
|
22937
|
-
splitList: () => convertCommand4(createSplitListCommand()),
|
|
22938
|
-
protectCollapsed: () => convertCommand4(protectCollapsed),
|
|
22939
|
-
toggleCollapsed: (props) => {
|
|
22940
|
-
return convertCommand4(createToggleCollapsedCommand(props));
|
|
22941
|
-
},
|
|
22942
|
-
toggleList: (attrs) => {
|
|
22943
|
-
return convertCommand4(createToggleListCommand(attrs));
|
|
22944
|
-
}
|
|
22945
|
-
};
|
|
22946
|
-
}
|
|
22947
|
-
};
|
|
22948
|
-
function alwaysTrue(func) {
|
|
22949
|
-
return (...args) => {
|
|
22950
|
-
func(...args);
|
|
22951
|
-
return true;
|
|
22952
|
-
};
|
|
22953
|
-
}
|
|
22954
|
-
|
|
22955
|
-
// src/editor/extensions/List/list-extensions.ts
|
|
22956
|
-
var LineListExtension = class extends ListExtension {
|
|
22957
22092
|
fromMarkdown() {
|
|
22958
22093
|
return [
|
|
22959
22094
|
{
|
|
@@ -23028,7 +22163,7 @@ function isOrderedListNode(node) {
|
|
|
23028
22163
|
}
|
|
23029
22164
|
|
|
23030
22165
|
// src/editor/extensions/Mermaid/mermaid-extension.ts
|
|
23031
|
-
import { NodeExtension as
|
|
22166
|
+
import { NodeExtension as NodeExtension7, isElementDomNode as isElementDomNode3, nodeInputRule as nodeInputRule6 } from "@remirror/core";
|
|
23032
22167
|
|
|
23033
22168
|
// src/editor/extensions/Mermaid/mermaid-view.ts
|
|
23034
22169
|
import { Compartment as Compartment3 } from "@codemirror/state";
|
|
@@ -23203,7 +22338,7 @@ var MermaidNodeView = class {
|
|
|
23203
22338
|
|
|
23204
22339
|
// src/editor/extensions/Mermaid/mermaid-extension.ts
|
|
23205
22340
|
import { TextSelection as TextSelection9 } from "@remirror/pm/state";
|
|
23206
|
-
var MermaidBlockExtension = class extends
|
|
22341
|
+
var MermaidBlockExtension = class extends NodeExtension7 {
|
|
23207
22342
|
get name() {
|
|
23208
22343
|
return "mermaid_node";
|
|
23209
22344
|
}
|
|
@@ -23381,8 +22516,8 @@ var ShortcutManager = class _ShortcutManager {
|
|
|
23381
22516
|
}
|
|
23382
22517
|
return _ShortcutManager.instance;
|
|
23383
22518
|
}
|
|
23384
|
-
setShortcut(
|
|
23385
|
-
this.shortcuts[
|
|
22519
|
+
setShortcut(key2, command5) {
|
|
22520
|
+
this.shortcuts[key2] = command5;
|
|
23386
22521
|
}
|
|
23387
22522
|
setShortcuts(shortcuts) {
|
|
23388
22523
|
this.shortcuts = { ...this.shortcuts, ...shortcuts };
|
|
@@ -23415,8 +22550,8 @@ var ShortcutsExtension = class extends PlainExtension7 {
|
|
|
23415
22550
|
}
|
|
23416
22551
|
createExternalAPI() {
|
|
23417
22552
|
return {
|
|
23418
|
-
setShortcut: (
|
|
23419
|
-
ShortcutManager.getInstance().setShortcut(
|
|
22553
|
+
setShortcut: (key2, command5) => {
|
|
22554
|
+
ShortcutManager.getInstance().setShortcut(key2, command5);
|
|
23420
22555
|
},
|
|
23421
22556
|
setShortcuts: (shortcuts) => {
|
|
23422
22557
|
ShortcutManager.getInstance().setShortcuts(shortcuts);
|
|
@@ -23454,7 +22589,7 @@ ShortcutsExtension = __decorateClass([
|
|
|
23454
22589
|
], ShortcutsExtension);
|
|
23455
22590
|
|
|
23456
22591
|
// src/editor/extensions/SlashMenu/utils.ts
|
|
23457
|
-
var dispatchWithMeta = (view,
|
|
22592
|
+
var dispatchWithMeta = (view, key2, meta) => view.dispatch(view.state.tr.setMeta(key2, meta));
|
|
23458
22593
|
var defaultIgnoredKeys = [
|
|
23459
22594
|
"Unidentified",
|
|
23460
22595
|
"Alt",
|
|
@@ -24833,7 +23968,7 @@ import {
|
|
|
24833
23968
|
isEqual,
|
|
24834
23969
|
isTextSelection as isTextSelection4,
|
|
24835
23970
|
keyBinding,
|
|
24836
|
-
NodeExtension as
|
|
23971
|
+
NodeExtension as NodeExtension8,
|
|
24837
23972
|
nodeInputRule as nodeInputRule7,
|
|
24838
23973
|
setBlockType as setBlockType3
|
|
24839
23974
|
} from "@remirror/core";
|
|
@@ -24895,7 +24030,7 @@ var CodeMirror6NodeView = class {
|
|
|
24895
24030
|
// src/editor/extensions/CodeMirror/codemirror-extension.ts
|
|
24896
24031
|
import { languages as languages3 } from "@codemirror/language-data";
|
|
24897
24032
|
var fakeIndentedLanguage = "indent-code";
|
|
24898
|
-
var LineCodeMirrorExtension = class extends
|
|
24033
|
+
var LineCodeMirrorExtension = class extends NodeExtension8 {
|
|
24899
24034
|
get name() {
|
|
24900
24035
|
return "codeMirror";
|
|
24901
24036
|
}
|
|
@@ -25125,8 +24260,8 @@ var createSourceCodeDelegate = (options) => {
|
|
|
25125
24260
|
const child = content ? schema.text(content) : void 0;
|
|
25126
24261
|
return schema.nodes.doc.create({}, schema.nodes.codeMirror.create(attrs, child));
|
|
25127
24262
|
};
|
|
25128
|
-
const docToString = (
|
|
25129
|
-
return
|
|
24263
|
+
const docToString = (doc) => {
|
|
24264
|
+
return doc.textContent;
|
|
25130
24265
|
};
|
|
25131
24266
|
return { manager, stringToDoc, docToString, view: "SourceCode" };
|
|
25132
24267
|
};
|
|
@@ -25134,11 +24269,11 @@ var createSourceCodeDelegate = (options) => {
|
|
|
25134
24269
|
// src/editor/components/ErrorBoundary.tsx
|
|
25135
24270
|
import React2 from "react";
|
|
25136
24271
|
import styled6 from "styled-components";
|
|
25137
|
-
import { Fragment as
|
|
24272
|
+
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
25138
24273
|
var Title = styled6.h1`
|
|
25139
24274
|
color: ${({ theme }) => theme.dangerColor};
|
|
25140
24275
|
`;
|
|
25141
|
-
var DefaultFallback = (props) => /* @__PURE__ */ jsxs3(
|
|
24276
|
+
var DefaultFallback = (props) => /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
25142
24277
|
/* @__PURE__ */ jsx12(Title, { children: "Sorry, something went wrong!" }),
|
|
25143
24278
|
/* @__PURE__ */ jsx12("p", { children: String(props.error) })
|
|
25144
24279
|
] });
|
|
@@ -25583,7 +24718,7 @@ var MenuItem = styled8.li.attrs((props) => ({
|
|
|
25583
24718
|
|
|
25584
24719
|
// src/editor/toolbar/SlashMenu/index.tsx
|
|
25585
24720
|
import styled9 from "styled-components";
|
|
25586
|
-
import { Fragment as
|
|
24721
|
+
import { Fragment as Fragment5, jsx as jsx16 } from "react/jsx-runtime";
|
|
25587
24722
|
var SlashMenu = () => {
|
|
25588
24723
|
const { view: editorView, getState, commands } = useRemirrorContext3({ autoUpdate: true });
|
|
25589
24724
|
if (!editorView) {
|
|
@@ -25658,7 +24793,7 @@ var SlashMenu = () => {
|
|
|
25658
24793
|
useEffect6(() => {
|
|
25659
24794
|
editorView.focus();
|
|
25660
24795
|
}, [menuState?.open]);
|
|
25661
|
-
return /* @__PURE__ */ jsx16(
|
|
24796
|
+
return /* @__PURE__ */ jsx16(Fragment5, { children: menuState.open ? /* @__PURE__ */ jsx16(
|
|
25662
24797
|
Container2,
|
|
25663
24798
|
{
|
|
25664
24799
|
ref: setPopperElement,
|
|
@@ -25746,7 +24881,7 @@ var ActiveCellMenu = (props) => {
|
|
|
25746
24881
|
}
|
|
25747
24882
|
setOpen(false);
|
|
25748
24883
|
};
|
|
25749
|
-
const { ref, key, x, y } = positioner;
|
|
24884
|
+
const { ref, key: key2, x, y } = positioner;
|
|
25750
24885
|
return /* @__PURE__ */ jsxs7(
|
|
25751
24886
|
Container3,
|
|
25752
24887
|
{
|
|
@@ -25799,7 +24934,7 @@ var ActiveCellMenu = (props) => {
|
|
|
25799
24934
|
)
|
|
25800
24935
|
]
|
|
25801
24936
|
},
|
|
25802
|
-
|
|
24937
|
+
key2
|
|
25803
24938
|
);
|
|
25804
24939
|
};
|
|
25805
24940
|
var ActiveCellMenu_default = ActiveCellMenu;
|
|
@@ -25816,7 +24951,7 @@ var Container4 = styled11.div`
|
|
|
25816
24951
|
function TableBar(props) {
|
|
25817
24952
|
const { positioner } = props;
|
|
25818
24953
|
const commands = useCommands2();
|
|
25819
|
-
const { ref, key, x, y } = positioner;
|
|
24954
|
+
const { ref, key: key2, x, y } = positioner;
|
|
25820
24955
|
return /* @__PURE__ */ jsx18(
|
|
25821
24956
|
Container4,
|
|
25822
24957
|
{
|
|
@@ -25834,7 +24969,7 @@ function TableBar(props) {
|
|
|
25834
24969
|
},
|
|
25835
24970
|
children: /* @__PURE__ */ jsx18(Tooltip2, { title: "delete", children: /* @__PURE__ */ jsx18("i", { className: "ri-delete-bin-line" }) })
|
|
25836
24971
|
},
|
|
25837
|
-
|
|
24972
|
+
key2
|
|
25838
24973
|
);
|
|
25839
24974
|
}
|
|
25840
24975
|
var TableBar_default = TableBar;
|
|
@@ -25922,7 +25057,7 @@ var activeCellColumnAndRowPositioner = Positioner.create({
|
|
|
25922
25057
|
});
|
|
25923
25058
|
|
|
25924
25059
|
// src/editor/toolbar/TableToolbar/index.tsx
|
|
25925
|
-
import { Fragment as
|
|
25060
|
+
import { Fragment as Fragment6, jsx as jsx19 } from "react/jsx-runtime";
|
|
25926
25061
|
var MultiPositionerIllustration = ({ positioner }) => {
|
|
25927
25062
|
const positioners = useMultiPositioner(positioner, []);
|
|
25928
25063
|
const { forceUpdatePositioners } = useCommands3();
|
|
@@ -25931,13 +25066,13 @@ var MultiPositionerIllustration = ({ positioner }) => {
|
|
|
25931
25066
|
}, [forceUpdatePositioners]);
|
|
25932
25067
|
if (positioners.length === 0) return null;
|
|
25933
25068
|
const positionersRender = [TableBar_default, ActiveCellMenu_default];
|
|
25934
|
-
return /* @__PURE__ */ jsx19(
|
|
25069
|
+
return /* @__PURE__ */ jsx19(Fragment6, { children: positioners.map((pos, i) => {
|
|
25935
25070
|
const Component = positionersRender[i];
|
|
25936
25071
|
return /* @__PURE__ */ jsx19(Component, { positioner: pos }, pos.key);
|
|
25937
25072
|
}) });
|
|
25938
25073
|
};
|
|
25939
25074
|
var TableToolbar = () => {
|
|
25940
|
-
return /* @__PURE__ */ jsx19(
|
|
25075
|
+
return /* @__PURE__ */ jsx19(Fragment6, { children: /* @__PURE__ */ jsx19(PositionerPortal, { children: /* @__PURE__ */ jsx19(MultiPositionerIllustration, { positioner: activeCellColumnAndRowPositioner }) }) });
|
|
25941
25076
|
};
|
|
25942
25077
|
var TableToolbar_default = TableToolbar;
|
|
25943
25078
|
|
|
@@ -26479,11 +25614,11 @@ var createWysiwygDelegate = (options = {}) => {
|
|
|
26479
25614
|
const parser4 = buildMarkdownParser(manager);
|
|
26480
25615
|
const serializer = buildMarkdownSerializer(manager);
|
|
26481
25616
|
const stringToDoc = (content) => {
|
|
26482
|
-
const
|
|
26483
|
-
return initDocMarks(
|
|
25617
|
+
const doc = parser4.parse(content);
|
|
25618
|
+
return initDocMarks(doc);
|
|
26484
25619
|
};
|
|
26485
|
-
const docToString = (
|
|
26486
|
-
return serializer.serialize(
|
|
25620
|
+
const docToString = (doc) => {
|
|
25621
|
+
return serializer.serialize(doc);
|
|
26487
25622
|
};
|
|
26488
25623
|
return {
|
|
26489
25624
|
view: "Wysiwyg",
|
|
@@ -26772,8 +25907,8 @@ var handlerByAdditions = {
|
|
|
26772
25907
|
]
|
|
26773
25908
|
};
|
|
26774
25909
|
var previewMermaidRenderCount = { count: 0 };
|
|
26775
|
-
var rmeProsemirrorNodeToHtml = async (
|
|
26776
|
-
const html2 = prosemirrorNodeToHtml2(
|
|
25910
|
+
var rmeProsemirrorNodeToHtml = async (doc, delegateOptions) => {
|
|
25911
|
+
const html2 = prosemirrorNodeToHtml2(doc);
|
|
26777
25912
|
const fullAst = HTML3.parse(html2);
|
|
26778
25913
|
const imageLoadTasks = [];
|
|
26779
25914
|
const handleHtmlText = (ast) => {
|
|
@@ -26809,9 +25944,9 @@ var rmeProsemirrorNodeToHtml = async (doc2, delegateOptions) => {
|
|
|
26809
25944
|
// src/editor/components/Preview/preview.tsx
|
|
26810
25945
|
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
26811
25946
|
var Preview = (props) => {
|
|
26812
|
-
const { doc
|
|
25947
|
+
const { doc, delegateOptions } = props;
|
|
26813
25948
|
const [processedHtml, setProcessedHtml] = useState10("");
|
|
26814
|
-
let targetDoc =
|
|
25949
|
+
let targetDoc = doc;
|
|
26815
25950
|
if (typeof targetDoc === "string") {
|
|
26816
25951
|
targetDoc = createWysiwygDelegate(delegateOptions).stringToDoc(targetDoc);
|
|
26817
25952
|
}
|