@harbour-enterprises/superdoc 1.0.0-alpha.26 → 1.0.0-alpha.27
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/superdoc.cjs.js +1120 -511
- package/dist/superdoc.cjs.js.map +1 -1
- package/dist/superdoc.es.js +1120 -511
- package/dist/superdoc.es.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.es.js
CHANGED
|
@@ -966,7 +966,7 @@ function add(value) {
|
|
|
966
966
|
function set$1(key, value) {
|
|
967
967
|
value = toRaw(value);
|
|
968
968
|
const target = toRaw(this);
|
|
969
|
-
const { has: has2, get:
|
|
969
|
+
const { has: has2, get: get22 } = getProto(target);
|
|
970
970
|
let hadKey = has2.call(target, key);
|
|
971
971
|
if (!hadKey) {
|
|
972
972
|
key = toRaw(key);
|
|
@@ -974,7 +974,7 @@ function set$1(key, value) {
|
|
|
974
974
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
975
975
|
checkIdentityKeys(target, has2, key);
|
|
976
976
|
}
|
|
977
|
-
const oldValue =
|
|
977
|
+
const oldValue = get22.call(target, key);
|
|
978
978
|
target.set(key, value);
|
|
979
979
|
if (!hadKey) {
|
|
980
980
|
trigger(target, "add", key, value);
|
|
@@ -985,7 +985,7 @@ function set$1(key, value) {
|
|
|
985
985
|
}
|
|
986
986
|
function deleteEntry(key) {
|
|
987
987
|
const target = toRaw(this);
|
|
988
|
-
const { has: has2, get:
|
|
988
|
+
const { has: has2, get: get22 } = getProto(target);
|
|
989
989
|
let hadKey = has2.call(target, key);
|
|
990
990
|
if (!hadKey) {
|
|
991
991
|
key = toRaw(key);
|
|
@@ -993,7 +993,7 @@ function deleteEntry(key) {
|
|
|
993
993
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
994
994
|
checkIdentityKeys(target, has2, key);
|
|
995
995
|
}
|
|
996
|
-
const oldValue =
|
|
996
|
+
const oldValue = get22 ? get22.call(target, key) : void 0;
|
|
997
997
|
const result = target.delete(key);
|
|
998
998
|
if (hadKey) {
|
|
999
999
|
trigger(target, "delete", key, void 0, oldValue);
|
|
@@ -1011,7 +1011,7 @@ function clear() {
|
|
|
1011
1011
|
return result;
|
|
1012
1012
|
}
|
|
1013
1013
|
function createForEach(isReadonly2, isShallow2) {
|
|
1014
|
-
return function
|
|
1014
|
+
return function forEach2(callback, thisArg) {
|
|
1015
1015
|
const observed = this;
|
|
1016
1016
|
const target = observed["__v_raw"];
|
|
1017
1017
|
const rawTarget = toRaw(target);
|
|
@@ -2670,7 +2670,7 @@ function queueEffectWithSuspense(fn, suspense) {
|
|
|
2670
2670
|
queuePostFlushCb(fn);
|
|
2671
2671
|
}
|
|
2672
2672
|
}
|
|
2673
|
-
function injectHook(type2, hook, target = currentInstance,
|
|
2673
|
+
function injectHook(type2, hook, target = currentInstance, prepend2 = false) {
|
|
2674
2674
|
if (target) {
|
|
2675
2675
|
const hooks = target[type2] || (target[type2] = []);
|
|
2676
2676
|
const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
|
@@ -2681,7 +2681,7 @@ function injectHook(type2, hook, target = currentInstance, prepend = false) {
|
|
|
2681
2681
|
resetTracking();
|
|
2682
2682
|
return res;
|
|
2683
2683
|
});
|
|
2684
|
-
if (
|
|
2684
|
+
if (prepend2) {
|
|
2685
2685
|
hooks.unshift(wrappedHook);
|
|
2686
2686
|
} else {
|
|
2687
2687
|
hooks.push(wrappedHook);
|
|
@@ -3172,8 +3172,8 @@ function applyOptions(instance) {
|
|
|
3172
3172
|
if (computedOptions) {
|
|
3173
3173
|
for (const key in computedOptions) {
|
|
3174
3174
|
const opt = computedOptions[key];
|
|
3175
|
-
const
|
|
3176
|
-
if (!!(process.env.NODE_ENV !== "production") &&
|
|
3175
|
+
const get3 = isFunction$1(opt) ? opt.bind(publicThis, publicThis) : isFunction$1(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
|
|
3176
|
+
if (!!(process.env.NODE_ENV !== "production") && get3 === NOOP) {
|
|
3177
3177
|
warn$1(`Computed property "${key}" has no getter.`);
|
|
3178
3178
|
}
|
|
3179
3179
|
const set2 = !isFunction$1(opt) && isFunction$1(opt.set) ? opt.set.bind(publicThis) : !!(process.env.NODE_ENV !== "production") ? () => {
|
|
@@ -3182,7 +3182,7 @@ function applyOptions(instance) {
|
|
|
3182
3182
|
);
|
|
3183
3183
|
} : NOOP;
|
|
3184
3184
|
const c2 = computed({
|
|
3185
|
-
get:
|
|
3185
|
+
get: get3,
|
|
3186
3186
|
set: set2
|
|
3187
3187
|
});
|
|
3188
3188
|
Object.defineProperty(ctx, key, {
|
|
@@ -3349,8 +3349,8 @@ function resolveMergedOptions(instance) {
|
|
|
3349
3349
|
}
|
|
3350
3350
|
return resolved;
|
|
3351
3351
|
}
|
|
3352
|
-
function mergeOptions(to,
|
|
3353
|
-
const { mixins, extends: extendsOptions } =
|
|
3352
|
+
function mergeOptions(to, from2, strats, asMixin = false) {
|
|
3353
|
+
const { mixins, extends: extendsOptions } = from2;
|
|
3354
3354
|
if (extendsOptions) {
|
|
3355
3355
|
mergeOptions(to, extendsOptions, strats, true);
|
|
3356
3356
|
}
|
|
@@ -3359,14 +3359,14 @@ function mergeOptions(to, from, strats, asMixin = false) {
|
|
|
3359
3359
|
(m) => mergeOptions(to, m, strats, true)
|
|
3360
3360
|
);
|
|
3361
3361
|
}
|
|
3362
|
-
for (const key in
|
|
3362
|
+
for (const key in from2) {
|
|
3363
3363
|
if (asMixin && key === "expose") {
|
|
3364
3364
|
!!(process.env.NODE_ENV !== "production") && warn$1(
|
|
3365
3365
|
`"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
|
|
3366
3366
|
);
|
|
3367
3367
|
} else {
|
|
3368
3368
|
const strat = internalOptionMergeStrats[key] || strats && strats[key];
|
|
3369
|
-
to[key] = strat ? strat(to[key],
|
|
3369
|
+
to[key] = strat ? strat(to[key], from2[key]) : from2[key];
|
|
3370
3370
|
}
|
|
3371
3371
|
}
|
|
3372
3372
|
return to;
|
|
@@ -3402,22 +3402,22 @@ const internalOptionMergeStrats = {
|
|
|
3402
3402
|
provide: mergeDataFn,
|
|
3403
3403
|
inject: mergeInject
|
|
3404
3404
|
};
|
|
3405
|
-
function mergeDataFn(to,
|
|
3406
|
-
if (!
|
|
3405
|
+
function mergeDataFn(to, from2) {
|
|
3406
|
+
if (!from2) {
|
|
3407
3407
|
return to;
|
|
3408
3408
|
}
|
|
3409
3409
|
if (!to) {
|
|
3410
|
-
return
|
|
3410
|
+
return from2;
|
|
3411
3411
|
}
|
|
3412
3412
|
return function mergedDataFn() {
|
|
3413
3413
|
return extend(
|
|
3414
3414
|
isFunction$1(to) ? to.call(this, this) : to,
|
|
3415
|
-
isFunction$1(
|
|
3415
|
+
isFunction$1(from2) ? from2.call(this, this) : from2
|
|
3416
3416
|
);
|
|
3417
3417
|
};
|
|
3418
3418
|
}
|
|
3419
|
-
function mergeInject(to,
|
|
3420
|
-
return mergeObjectOptions(normalizeInject(to), normalizeInject(
|
|
3419
|
+
function mergeInject(to, from2) {
|
|
3420
|
+
return mergeObjectOptions(normalizeInject(to), normalizeInject(from2));
|
|
3421
3421
|
}
|
|
3422
3422
|
function normalizeInject(raw) {
|
|
3423
3423
|
if (isArray$4(raw)) {
|
|
@@ -3429,32 +3429,32 @@ function normalizeInject(raw) {
|
|
|
3429
3429
|
}
|
|
3430
3430
|
return raw;
|
|
3431
3431
|
}
|
|
3432
|
-
function mergeAsArray(to,
|
|
3433
|
-
return to ? [...new Set([].concat(to,
|
|
3432
|
+
function mergeAsArray(to, from2) {
|
|
3433
|
+
return to ? [...new Set([].concat(to, from2))] : from2;
|
|
3434
3434
|
}
|
|
3435
|
-
function mergeObjectOptions(to,
|
|
3436
|
-
return to ? extend(/* @__PURE__ */ Object.create(null), to,
|
|
3435
|
+
function mergeObjectOptions(to, from2) {
|
|
3436
|
+
return to ? extend(/* @__PURE__ */ Object.create(null), to, from2) : from2;
|
|
3437
3437
|
}
|
|
3438
|
-
function mergeEmitsOrPropsOptions(to,
|
|
3438
|
+
function mergeEmitsOrPropsOptions(to, from2) {
|
|
3439
3439
|
if (to) {
|
|
3440
|
-
if (isArray$4(to) && isArray$4(
|
|
3441
|
-
return [.../* @__PURE__ */ new Set([...to, ...
|
|
3440
|
+
if (isArray$4(to) && isArray$4(from2)) {
|
|
3441
|
+
return [.../* @__PURE__ */ new Set([...to, ...from2])];
|
|
3442
3442
|
}
|
|
3443
3443
|
return extend(
|
|
3444
3444
|
/* @__PURE__ */ Object.create(null),
|
|
3445
3445
|
normalizePropsOrEmits(to),
|
|
3446
|
-
normalizePropsOrEmits(
|
|
3446
|
+
normalizePropsOrEmits(from2 != null ? from2 : {})
|
|
3447
3447
|
);
|
|
3448
3448
|
} else {
|
|
3449
|
-
return
|
|
3449
|
+
return from2;
|
|
3450
3450
|
}
|
|
3451
3451
|
}
|
|
3452
|
-
function mergeWatchOptions(to,
|
|
3453
|
-
if (!to) return
|
|
3454
|
-
if (!
|
|
3452
|
+
function mergeWatchOptions(to, from2) {
|
|
3453
|
+
if (!to) return from2;
|
|
3454
|
+
if (!from2) return to;
|
|
3455
3455
|
const merged = extend(/* @__PURE__ */ Object.create(null), to);
|
|
3456
|
-
for (const key in
|
|
3457
|
-
merged[key] = mergeAsArray(to[key],
|
|
3456
|
+
for (const key in from2) {
|
|
3457
|
+
merged[key] = mergeAsArray(to[key], from2[key]);
|
|
3458
3458
|
}
|
|
3459
3459
|
return merged;
|
|
3460
3460
|
}
|
|
@@ -10699,9 +10699,9 @@ function stringToBytes(str) {
|
|
|
10699
10699
|
function string32(value) {
|
|
10700
10700
|
return String.fromCharCode(value >> 24 & 255, value >> 16 & 255, value >> 8 & 255, value & 255);
|
|
10701
10701
|
}
|
|
10702
|
-
function objectFromMap(
|
|
10702
|
+
function objectFromMap(map3) {
|
|
10703
10703
|
const obj = /* @__PURE__ */ Object.create(null);
|
|
10704
|
-
for (const [key, value] of
|
|
10704
|
+
for (const [key, value] of map3) {
|
|
10705
10705
|
obj[key] = value;
|
|
10706
10706
|
}
|
|
10707
10707
|
return obj;
|
|
@@ -10947,10 +10947,10 @@ class BaseFilterFactory {
|
|
|
10947
10947
|
addHCMFilter(fgColor, bgColor) {
|
|
10948
10948
|
return "none";
|
|
10949
10949
|
}
|
|
10950
|
-
addAlphaFilter(
|
|
10950
|
+
addAlphaFilter(map3) {
|
|
10951
10951
|
return "none";
|
|
10952
10952
|
}
|
|
10953
|
-
addLuminosityFilter(
|
|
10953
|
+
addLuminosityFilter(map3) {
|
|
10954
10954
|
return "none";
|
|
10955
10955
|
}
|
|
10956
10956
|
addHighlightHCMFilter(filterName, fgColor, bgColor, newFgColor, newBgColor) {
|
|
@@ -11158,12 +11158,12 @@ class DOMFilterFactory extends BaseFilterFactory {
|
|
|
11158
11158
|
if (fgColor === "#000000" && bgColor === "#ffffff" || fgColor === bgColor) {
|
|
11159
11159
|
return info2.url;
|
|
11160
11160
|
}
|
|
11161
|
-
const
|
|
11161
|
+
const map3 = new Array(256);
|
|
11162
11162
|
for (let i = 0; i <= 255; i++) {
|
|
11163
11163
|
const x = i / 255;
|
|
11164
|
-
|
|
11164
|
+
map3[i] = x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
|
|
11165
11165
|
}
|
|
11166
|
-
const table =
|
|
11166
|
+
const table = map3.join(",");
|
|
11167
11167
|
const id = `g_${__privateGet(this, _docId)}_hcm_filter`;
|
|
11168
11168
|
const filter = info2.filter = __privateMethod(this, _DOMFilterFactory_instances, createFilter_fn).call(this, id);
|
|
11169
11169
|
__privateMethod(this, _DOMFilterFactory_instances, addTransferMapConversion_fn).call(this, table, table, table, filter);
|
|
@@ -11181,50 +11181,50 @@ class DOMFilterFactory extends BaseFilterFactory {
|
|
|
11181
11181
|
info2.url = `url(#${id})`;
|
|
11182
11182
|
return info2.url;
|
|
11183
11183
|
}
|
|
11184
|
-
addAlphaFilter(
|
|
11185
|
-
let value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(
|
|
11184
|
+
addAlphaFilter(map3) {
|
|
11185
|
+
let value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(map3);
|
|
11186
11186
|
if (value) {
|
|
11187
11187
|
return value;
|
|
11188
11188
|
}
|
|
11189
|
-
const [tableA] = __privateMethod(this, _DOMFilterFactory_instances, createTables_fn).call(this, [
|
|
11189
|
+
const [tableA] = __privateMethod(this, _DOMFilterFactory_instances, createTables_fn).call(this, [map3]);
|
|
11190
11190
|
const key = `alpha_${tableA}`;
|
|
11191
11191
|
value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(key);
|
|
11192
11192
|
if (value) {
|
|
11193
|
-
__privateGet(this, _DOMFilterFactory_instances, cache_get).set(
|
|
11193
|
+
__privateGet(this, _DOMFilterFactory_instances, cache_get).set(map3, value);
|
|
11194
11194
|
return value;
|
|
11195
11195
|
}
|
|
11196
11196
|
const id = `g_${__privateGet(this, _docId)}_alpha_map_${__privateWrapper(this, _id)._++}`;
|
|
11197
11197
|
const url = `url(#${id})`;
|
|
11198
|
-
__privateGet(this, _DOMFilterFactory_instances, cache_get).set(
|
|
11198
|
+
__privateGet(this, _DOMFilterFactory_instances, cache_get).set(map3, url);
|
|
11199
11199
|
__privateGet(this, _DOMFilterFactory_instances, cache_get).set(key, url);
|
|
11200
11200
|
const filter = __privateMethod(this, _DOMFilterFactory_instances, createFilter_fn).call(this, id);
|
|
11201
11201
|
__privateMethod(this, _DOMFilterFactory_instances, addTransferMapAlphaConversion_fn).call(this, tableA, filter);
|
|
11202
11202
|
return url;
|
|
11203
11203
|
}
|
|
11204
|
-
addLuminosityFilter(
|
|
11205
|
-
let value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(
|
|
11204
|
+
addLuminosityFilter(map3) {
|
|
11205
|
+
let value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(map3 || "luminosity");
|
|
11206
11206
|
if (value) {
|
|
11207
11207
|
return value;
|
|
11208
11208
|
}
|
|
11209
11209
|
let tableA, key;
|
|
11210
|
-
if (
|
|
11211
|
-
[tableA] = __privateMethod(this, _DOMFilterFactory_instances, createTables_fn).call(this, [
|
|
11210
|
+
if (map3) {
|
|
11211
|
+
[tableA] = __privateMethod(this, _DOMFilterFactory_instances, createTables_fn).call(this, [map3]);
|
|
11212
11212
|
key = `luminosity_${tableA}`;
|
|
11213
11213
|
} else {
|
|
11214
11214
|
key = "luminosity";
|
|
11215
11215
|
}
|
|
11216
11216
|
value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(key);
|
|
11217
11217
|
if (value) {
|
|
11218
|
-
__privateGet(this, _DOMFilterFactory_instances, cache_get).set(
|
|
11218
|
+
__privateGet(this, _DOMFilterFactory_instances, cache_get).set(map3, value);
|
|
11219
11219
|
return value;
|
|
11220
11220
|
}
|
|
11221
11221
|
const id = `g_${__privateGet(this, _docId)}_luminosity_map_${__privateWrapper(this, _id)._++}`;
|
|
11222
11222
|
const url = `url(#${id})`;
|
|
11223
|
-
__privateGet(this, _DOMFilterFactory_instances, cache_get).set(
|
|
11223
|
+
__privateGet(this, _DOMFilterFactory_instances, cache_get).set(map3, url);
|
|
11224
11224
|
__privateGet(this, _DOMFilterFactory_instances, cache_get).set(key, url);
|
|
11225
11225
|
const filter = __privateMethod(this, _DOMFilterFactory_instances, createFilter_fn).call(this, id);
|
|
11226
11226
|
__privateMethod(this, _DOMFilterFactory_instances, addLuminosityConversion_fn).call(this, filter);
|
|
11227
|
-
if (
|
|
11227
|
+
if (map3) {
|
|
11228
11228
|
__privateMethod(this, _DOMFilterFactory_instances, addTransferMapAlphaConversion_fn).call(this, tableA, filter);
|
|
11229
11229
|
}
|
|
11230
11230
|
return url;
|
|
@@ -12133,7 +12133,7 @@ class CommandManager {
|
|
|
12133
12133
|
}
|
|
12134
12134
|
add({
|
|
12135
12135
|
cmd,
|
|
12136
|
-
undo,
|
|
12136
|
+
undo: undo2,
|
|
12137
12137
|
post,
|
|
12138
12138
|
mustExec,
|
|
12139
12139
|
type: type2 = NaN,
|
|
@@ -12148,7 +12148,7 @@ class CommandManager {
|
|
|
12148
12148
|
}
|
|
12149
12149
|
const save = {
|
|
12150
12150
|
cmd,
|
|
12151
|
-
undo,
|
|
12151
|
+
undo: undo2,
|
|
12152
12152
|
post,
|
|
12153
12153
|
type: type2
|
|
12154
12154
|
};
|
|
@@ -12184,10 +12184,10 @@ class CommandManager {
|
|
|
12184
12184
|
}
|
|
12185
12185
|
__privateSet(this, _locked, true);
|
|
12186
12186
|
const {
|
|
12187
|
-
undo,
|
|
12187
|
+
undo: undo2,
|
|
12188
12188
|
post
|
|
12189
12189
|
} = __privateGet(this, _commands)[__privateGet(this, _position)];
|
|
12190
|
-
|
|
12190
|
+
undo2();
|
|
12191
12191
|
post?.();
|
|
12192
12192
|
__privateSet(this, _locked, false);
|
|
12193
12193
|
__privateSet(this, _position, __privateGet(this, _position) - 1);
|
|
@@ -12710,14 +12710,14 @@ let AnnotationEditorUIManager$1 = (_c = class {
|
|
|
12710
12710
|
}
|
|
12711
12711
|
__privateMethod(this, _AnnotationEditorUIManager_instances, selectEditors_fn).call(this, newEditors);
|
|
12712
12712
|
};
|
|
12713
|
-
const
|
|
12713
|
+
const undo2 = () => {
|
|
12714
12714
|
for (const editor of newEditors) {
|
|
12715
12715
|
editor.remove();
|
|
12716
12716
|
}
|
|
12717
12717
|
};
|
|
12718
12718
|
this.addCommands({
|
|
12719
12719
|
cmd,
|
|
12720
|
-
undo,
|
|
12720
|
+
undo: undo2,
|
|
12721
12721
|
mustExec: true
|
|
12722
12722
|
});
|
|
12723
12723
|
} catch (ex) {
|
|
@@ -13053,14 +13053,14 @@ let AnnotationEditorUIManager$1 = (_c = class {
|
|
|
13053
13053
|
editor.remove();
|
|
13054
13054
|
}
|
|
13055
13055
|
};
|
|
13056
|
-
const
|
|
13056
|
+
const undo2 = () => {
|
|
13057
13057
|
for (const editor of editors) {
|
|
13058
13058
|
__privateMethod(this, _AnnotationEditorUIManager_instances, addEditorToLayer_fn).call(this, editor);
|
|
13059
13059
|
}
|
|
13060
13060
|
};
|
|
13061
13061
|
this.addCommands({
|
|
13062
13062
|
cmd,
|
|
13063
|
-
undo,
|
|
13063
|
+
undo: undo2,
|
|
13064
13064
|
mustExec: true
|
|
13065
13065
|
});
|
|
13066
13066
|
}
|
|
@@ -13156,14 +13156,14 @@ let AnnotationEditorUIManager$1 = (_c = class {
|
|
|
13156
13156
|
return false;
|
|
13157
13157
|
}
|
|
13158
13158
|
this.disableUserSelect(false);
|
|
13159
|
-
const
|
|
13159
|
+
const map3 = __privateGet(this, _draggingEditors);
|
|
13160
13160
|
__privateSet(this, _draggingEditors, null);
|
|
13161
13161
|
let mustBeAddedInUndoStack = false;
|
|
13162
13162
|
for (const [{
|
|
13163
13163
|
x,
|
|
13164
13164
|
y,
|
|
13165
13165
|
pageIndex
|
|
13166
|
-
}, value] of
|
|
13166
|
+
}, value] of map3) {
|
|
13167
13167
|
value.newX = x;
|
|
13168
13168
|
value.newY = y;
|
|
13169
13169
|
value.newPageIndex = pageIndex;
|
|
@@ -13190,7 +13190,7 @@ let AnnotationEditorUIManager$1 = (_c = class {
|
|
|
13190
13190
|
newX,
|
|
13191
13191
|
newY,
|
|
13192
13192
|
newPageIndex
|
|
13193
|
-
}] of
|
|
13193
|
+
}] of map3) {
|
|
13194
13194
|
move(editor, newX, newY, newPageIndex);
|
|
13195
13195
|
}
|
|
13196
13196
|
},
|
|
@@ -13199,7 +13199,7 @@ let AnnotationEditorUIManager$1 = (_c = class {
|
|
|
13199
13199
|
savedX,
|
|
13200
13200
|
savedY,
|
|
13201
13201
|
savedPageIndex
|
|
13202
|
-
}] of
|
|
13202
|
+
}] of map3) {
|
|
13203
13203
|
move(editor, savedX, savedY, savedPageIndex);
|
|
13204
13204
|
}
|
|
13205
13205
|
},
|
|
@@ -14992,26 +14992,26 @@ class AnnotationStorage {
|
|
|
14992
14992
|
if (__privateGet(this, _storage).size === 0) {
|
|
14993
14993
|
return SerializableEmpty;
|
|
14994
14994
|
}
|
|
14995
|
-
const
|
|
14995
|
+
const map3 = /* @__PURE__ */ new Map(), hash = new MurmurHash3_64(), transfer = [];
|
|
14996
14996
|
const context = /* @__PURE__ */ Object.create(null);
|
|
14997
14997
|
let hasBitmap = false;
|
|
14998
14998
|
for (const [key, val] of __privateGet(this, _storage)) {
|
|
14999
14999
|
const serialized = val instanceof AnnotationEditor ? val.serialize(false, context) : val;
|
|
15000
15000
|
if (serialized) {
|
|
15001
|
-
|
|
15001
|
+
map3.set(key, serialized);
|
|
15002
15002
|
hash.update(`${key}:${JSON.stringify(serialized)}`);
|
|
15003
15003
|
hasBitmap || (hasBitmap = !!serialized.bitmap);
|
|
15004
15004
|
}
|
|
15005
15005
|
}
|
|
15006
15006
|
if (hasBitmap) {
|
|
15007
|
-
for (const value of
|
|
15007
|
+
for (const value of map3.values()) {
|
|
15008
15008
|
if (value.bitmap) {
|
|
15009
15009
|
transfer.push(value.bitmap);
|
|
15010
15010
|
}
|
|
15011
15011
|
}
|
|
15012
15012
|
}
|
|
15013
|
-
return
|
|
15014
|
-
map:
|
|
15013
|
+
return map3.size > 0 ? {
|
|
15014
|
+
map: map3,
|
|
15015
15015
|
hash: hash.hexdigest(),
|
|
15016
15016
|
transfer
|
|
15017
15017
|
} : SerializableEmpty;
|
|
@@ -15034,15 +15034,15 @@ class AnnotationStorage {
|
|
|
15034
15034
|
typeToEditor.set(type2, Object.getPrototypeOf(value).constructor);
|
|
15035
15035
|
}
|
|
15036
15036
|
stats || (stats = /* @__PURE__ */ Object.create(null));
|
|
15037
|
-
const
|
|
15037
|
+
const map3 = stats[type2] || (stats[type2] = /* @__PURE__ */ new Map());
|
|
15038
15038
|
for (const [key, val] of Object.entries(editorStats)) {
|
|
15039
15039
|
if (key === "type") {
|
|
15040
15040
|
continue;
|
|
15041
15041
|
}
|
|
15042
|
-
let counters =
|
|
15042
|
+
let counters = map3.get(key);
|
|
15043
15043
|
if (!counters) {
|
|
15044
15044
|
counters = /* @__PURE__ */ new Map();
|
|
15045
|
-
|
|
15045
|
+
map3.set(key, counters);
|
|
15046
15046
|
}
|
|
15047
15047
|
const count = counters.get(val) ?? 0;
|
|
15048
15048
|
counters.set(val, count + 1);
|
|
@@ -15070,11 +15070,11 @@ class PrintAnnotationStorage extends AnnotationStorage {
|
|
|
15070
15070
|
super();
|
|
15071
15071
|
__privateAdd(this, _serializable);
|
|
15072
15072
|
const {
|
|
15073
|
-
map:
|
|
15073
|
+
map: map3,
|
|
15074
15074
|
hash,
|
|
15075
15075
|
transfer
|
|
15076
15076
|
} = parent.serializable;
|
|
15077
|
-
const clone = structuredClone(
|
|
15077
|
+
const clone = structuredClone(map3, transfer ? {
|
|
15078
15078
|
transfer
|
|
15079
15079
|
} : null);
|
|
15080
15080
|
__privateSet(this, _serializable, {
|
|
@@ -15453,8 +15453,8 @@ if (isNodeJS) {
|
|
|
15453
15453
|
path2d
|
|
15454
15454
|
}));
|
|
15455
15455
|
};
|
|
15456
|
-
loadPackages().then((
|
|
15457
|
-
packageMap =
|
|
15456
|
+
loadPackages().then((map3) => {
|
|
15457
|
+
packageMap = map3;
|
|
15458
15458
|
packageCapability.resolve();
|
|
15459
15459
|
}, (reason) => {
|
|
15460
15460
|
warn(`loadPackages: ${reason}`);
|
|
@@ -17846,9 +17846,9 @@ const _CanvasGraphics = class _CanvasGraphics {
|
|
|
17846
17846
|
}
|
|
17847
17847
|
const width = imgData.width;
|
|
17848
17848
|
const height = imgData.height;
|
|
17849
|
-
const
|
|
17849
|
+
const map3 = [];
|
|
17850
17850
|
for (let i = 0, ii = positions.length; i < ii; i += 2) {
|
|
17851
|
-
|
|
17851
|
+
map3.push({
|
|
17852
17852
|
transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]],
|
|
17853
17853
|
x: 0,
|
|
17854
17854
|
y: 0,
|
|
@@ -17856,7 +17856,7 @@ const _CanvasGraphics = class _CanvasGraphics {
|
|
|
17856
17856
|
h: height
|
|
17857
17857
|
});
|
|
17858
17858
|
}
|
|
17859
|
-
this.paintInlineImageXObjectGroup(imgData,
|
|
17859
|
+
this.paintInlineImageXObjectGroup(imgData, map3);
|
|
17860
17860
|
}
|
|
17861
17861
|
applyTransferMapsToCanvas(ctx) {
|
|
17862
17862
|
if (this.current.transferMaps !== "none") {
|
|
@@ -17916,7 +17916,7 @@ const _CanvasGraphics = class _CanvasGraphics {
|
|
|
17916
17916
|
this.compose();
|
|
17917
17917
|
this.restore();
|
|
17918
17918
|
}
|
|
17919
|
-
paintInlineImageXObjectGroup(imgData,
|
|
17919
|
+
paintInlineImageXObjectGroup(imgData, map3) {
|
|
17920
17920
|
if (!this.contentVisible) {
|
|
17921
17921
|
return;
|
|
17922
17922
|
}
|
|
@@ -17932,7 +17932,7 @@ const _CanvasGraphics = class _CanvasGraphics {
|
|
|
17932
17932
|
putBinaryImageData(tmpCtx, imgData);
|
|
17933
17933
|
imgToPaint = this.applyTransferMapsToCanvas(tmpCtx);
|
|
17934
17934
|
}
|
|
17935
|
-
for (const entry of
|
|
17935
|
+
for (const entry of map3) {
|
|
17936
17936
|
ctx.save();
|
|
17937
17937
|
ctx.transform(...entry.transform);
|
|
17938
17938
|
ctx.scale(1, -1);
|
|
@@ -21345,14 +21345,14 @@ class PDFPageProxy {
|
|
|
21345
21345
|
annotationStorageSerializable
|
|
21346
21346
|
}) {
|
|
21347
21347
|
const {
|
|
21348
|
-
map:
|
|
21348
|
+
map: map3,
|
|
21349
21349
|
transfer
|
|
21350
21350
|
} = annotationStorageSerializable;
|
|
21351
21351
|
const readableStream = this._transport.messageHandler.sendWithStream("GetOperatorList", {
|
|
21352
21352
|
pageIndex: this._pageIndex,
|
|
21353
21353
|
intent: renderingIntent,
|
|
21354
21354
|
cacheKey,
|
|
21355
|
-
annotationStorage:
|
|
21355
|
+
annotationStorage: map3
|
|
21356
21356
|
}, transfer);
|
|
21357
21357
|
const reader = readableStream.getReader();
|
|
21358
21358
|
const intentState = this._intentStates.get(cacheKey);
|
|
@@ -22123,13 +22123,13 @@ class WorkerTransport {
|
|
|
22123
22123
|
warn("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");
|
|
22124
22124
|
}
|
|
22125
22125
|
const {
|
|
22126
|
-
map:
|
|
22126
|
+
map: map3,
|
|
22127
22127
|
transfer
|
|
22128
22128
|
} = this.annotationStorage.serializable;
|
|
22129
22129
|
return this.messageHandler.sendWithPromise("SaveDocument", {
|
|
22130
22130
|
isPureXfa: !!this._htmlForXfa,
|
|
22131
22131
|
numPages: this._numPages,
|
|
22132
|
-
annotationStorage:
|
|
22132
|
+
annotationStorage: map3,
|
|
22133
22133
|
filename: this._fullReader?.filename ?? null
|
|
22134
22134
|
}, transfer).finally(() => {
|
|
22135
22135
|
this.annotationStorage.resetModified();
|
|
@@ -23454,9 +23454,9 @@ class LinkAnnotationElement extends AnnotationElement {
|
|
|
23454
23454
|
}
|
|
23455
23455
|
_bindJSAction(link, data2) {
|
|
23456
23456
|
link.href = this.linkService.getAnchorUrl("");
|
|
23457
|
-
const
|
|
23457
|
+
const map3 = /* @__PURE__ */ new Map([["Action", "onclick"], ["Mouse Up", "onmouseup"], ["Mouse Down", "onmousedown"]]);
|
|
23458
23458
|
for (const name of Object.keys(data2.actions)) {
|
|
23459
|
-
const jsName =
|
|
23459
|
+
const jsName = map3.get(name);
|
|
23460
23460
|
if (!jsName) {
|
|
23461
23461
|
continue;
|
|
23462
23462
|
}
|
|
@@ -27922,7 +27922,7 @@ stopDrawing_fn = function(x, y) {
|
|
|
27922
27922
|
this.bezierPath2D.push(path2D);
|
|
27923
27923
|
this._uiManager.rebuild(this);
|
|
27924
27924
|
};
|
|
27925
|
-
const
|
|
27925
|
+
const undo2 = () => {
|
|
27926
27926
|
this.allRawPaths.pop();
|
|
27927
27927
|
this.paths.pop();
|
|
27928
27928
|
this.bezierPath2D.pop();
|
|
@@ -27938,7 +27938,7 @@ stopDrawing_fn = function(x, y) {
|
|
|
27938
27938
|
};
|
|
27939
27939
|
this.addCommands({
|
|
27940
27940
|
cmd,
|
|
27941
|
-
undo,
|
|
27941
|
+
undo: undo2,
|
|
27942
27942
|
mustExec: true
|
|
27943
27943
|
});
|
|
27944
27944
|
};
|
|
@@ -29012,12 +29012,12 @@ let AnnotationEditorLayer$1 = (_j = class {
|
|
|
29012
29012
|
}
|
|
29013
29013
|
addUndoableEditor(editor) {
|
|
29014
29014
|
const cmd = () => editor._uiManager.rebuild(editor);
|
|
29015
|
-
const
|
|
29015
|
+
const undo2 = () => {
|
|
29016
29016
|
editor.remove();
|
|
29017
29017
|
};
|
|
29018
29018
|
this.addCommands({
|
|
29019
29019
|
cmd,
|
|
29020
|
-
undo,
|
|
29020
|
+
undo: undo2,
|
|
29021
29021
|
mustExec: false
|
|
29022
29022
|
});
|
|
29023
29023
|
}
|
|
@@ -40043,8 +40043,8 @@ function isKeyable(value) {
|
|
|
40043
40043
|
var type2 = typeof value;
|
|
40044
40044
|
return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
|
|
40045
40045
|
}
|
|
40046
|
-
function getMapData(
|
|
40047
|
-
var data2 =
|
|
40046
|
+
function getMapData(map3, key) {
|
|
40047
|
+
var data2 = map3.__data__;
|
|
40048
40048
|
return isKeyable(key) ? data2[typeof key == "string" ? "string" : "hash"] : data2.map;
|
|
40049
40049
|
}
|
|
40050
40050
|
function mapCacheDelete(key) {
|
|
@@ -41722,10 +41722,10 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
41722
41722
|
}
|
|
41723
41723
|
return allocUnsafe(arg);
|
|
41724
41724
|
}
|
|
41725
|
-
return
|
|
41725
|
+
return from2(arg, encodingOrOffset, length);
|
|
41726
41726
|
}
|
|
41727
41727
|
Buffer3.poolSize = 8192;
|
|
41728
|
-
function
|
|
41728
|
+
function from2(value, encodingOrOffset, length) {
|
|
41729
41729
|
if (typeof value === "string") {
|
|
41730
41730
|
return fromString(value, encodingOrOffset);
|
|
41731
41731
|
}
|
|
@@ -41762,7 +41762,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
41762
41762
|
);
|
|
41763
41763
|
}
|
|
41764
41764
|
Buffer3.from = function(value, encodingOrOffset, length) {
|
|
41765
|
-
return
|
|
41765
|
+
return from2(value, encodingOrOffset, length);
|
|
41766
41766
|
};
|
|
41767
41767
|
Object.setPrototypeOf(Buffer3.prototype, GlobalUint8Array.prototype);
|
|
41768
41768
|
Object.setPrototypeOf(Buffer3, GlobalUint8Array);
|
|
@@ -42478,7 +42478,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
42478
42478
|
}
|
|
42479
42479
|
return res;
|
|
42480
42480
|
}
|
|
42481
|
-
Buffer3.prototype.slice = function
|
|
42481
|
+
Buffer3.prototype.slice = function slice2(start, end) {
|
|
42482
42482
|
const len = this.length;
|
|
42483
42483
|
start = ~~start;
|
|
42484
42484
|
end = end === void 0 ? len : ~~end;
|
|
@@ -43397,7 +43397,7 @@ function requireEvents() {
|
|
|
43397
43397
|
}
|
|
43398
43398
|
return true;
|
|
43399
43399
|
};
|
|
43400
|
-
function _addListener(target, type2, listener,
|
|
43400
|
+
function _addListener(target, type2, listener, prepend2) {
|
|
43401
43401
|
var m;
|
|
43402
43402
|
var events2;
|
|
43403
43403
|
var existing;
|
|
@@ -43422,8 +43422,8 @@ function requireEvents() {
|
|
|
43422
43422
|
++target._eventsCount;
|
|
43423
43423
|
} else {
|
|
43424
43424
|
if (typeof existing === "function") {
|
|
43425
|
-
existing = events2[type2] =
|
|
43426
|
-
} else if (
|
|
43425
|
+
existing = events2[type2] = prepend2 ? [listener, existing] : [existing, listener];
|
|
43426
|
+
} else if (prepend2) {
|
|
43427
43427
|
existing.unshift(listener);
|
|
43428
43428
|
} else {
|
|
43429
43429
|
existing.push(listener);
|
|
@@ -43805,16 +43805,16 @@ process$1.nextTick = function(fun) {
|
|
|
43805
43805
|
args[i - 1] = arguments[i];
|
|
43806
43806
|
}
|
|
43807
43807
|
}
|
|
43808
|
-
queue.push(new Item(fun, args));
|
|
43808
|
+
queue.push(new Item$1(fun, args));
|
|
43809
43809
|
if (queue.length === 1 && !draining) {
|
|
43810
43810
|
runTimeout(drainQueue);
|
|
43811
43811
|
}
|
|
43812
43812
|
};
|
|
43813
|
-
function Item(fun, array) {
|
|
43813
|
+
function Item$1(fun, array) {
|
|
43814
43814
|
this.fun = fun;
|
|
43815
43815
|
this.array = array;
|
|
43816
43816
|
}
|
|
43817
|
-
Item.prototype.run = function() {
|
|
43817
|
+
Item$1.prototype.run = function() {
|
|
43818
43818
|
this.fun.apply(null, this.array);
|
|
43819
43819
|
};
|
|
43820
43820
|
process$1.title = "browser";
|
|
@@ -44865,7 +44865,7 @@ function requireForEach() {
|
|
|
44865
44865
|
}
|
|
44866
44866
|
}
|
|
44867
44867
|
};
|
|
44868
|
-
var
|
|
44868
|
+
var forEach2 = function forEach3(list, iterator, thisArg) {
|
|
44869
44869
|
if (!isCallable2(iterator)) {
|
|
44870
44870
|
throw new TypeError("iterator must be a function");
|
|
44871
44871
|
}
|
|
@@ -44881,7 +44881,7 @@ function requireForEach() {
|
|
|
44881
44881
|
forEachObject(list, iterator, receiver);
|
|
44882
44882
|
}
|
|
44883
44883
|
};
|
|
44884
|
-
forEach_1 =
|
|
44884
|
+
forEach_1 = forEach2;
|
|
44885
44885
|
return forEach_1;
|
|
44886
44886
|
}
|
|
44887
44887
|
var possibleTypedArrayNames;
|
|
@@ -44927,7 +44927,7 @@ var hasRequiredWhichTypedArray;
|
|
|
44927
44927
|
function requireWhichTypedArray() {
|
|
44928
44928
|
if (hasRequiredWhichTypedArray) return whichTypedArray;
|
|
44929
44929
|
hasRequiredWhichTypedArray = 1;
|
|
44930
|
-
var
|
|
44930
|
+
var forEach2 = requireForEach();
|
|
44931
44931
|
var availableTypedArrays2 = requireAvailableTypedArrays();
|
|
44932
44932
|
var callBind2 = requireCallBind();
|
|
44933
44933
|
var callBound2 = requireCallBound();
|
|
@@ -44948,7 +44948,7 @@ function requireWhichTypedArray() {
|
|
|
44948
44948
|
};
|
|
44949
44949
|
var cache2 = { __proto__: null };
|
|
44950
44950
|
if (hasToStringTag && gOPD && getPrototypeOf) {
|
|
44951
|
-
|
|
44951
|
+
forEach2(typedArrays, function(typedArray) {
|
|
44952
44952
|
var arr = new g[typedArray]();
|
|
44953
44953
|
if (Symbol.toStringTag in arr) {
|
|
44954
44954
|
var proto = getPrototypeOf(arr);
|
|
@@ -44961,7 +44961,7 @@ function requireWhichTypedArray() {
|
|
|
44961
44961
|
}
|
|
44962
44962
|
});
|
|
44963
44963
|
} else {
|
|
44964
|
-
|
|
44964
|
+
forEach2(typedArrays, function(typedArray) {
|
|
44965
44965
|
var arr = new g[typedArray]();
|
|
44966
44966
|
var fn = arr.slice || arr.set;
|
|
44967
44967
|
if (fn) {
|
|
@@ -44971,7 +44971,7 @@ function requireWhichTypedArray() {
|
|
|
44971
44971
|
}
|
|
44972
44972
|
var tryTypedArrays = function tryAllTypedArrays(value) {
|
|
44973
44973
|
var found2 = false;
|
|
44974
|
-
|
|
44974
|
+
forEach2(
|
|
44975
44975
|
// eslint-disable-next-line no-extra-parens
|
|
44976
44976
|
/** @type {Record<`\$${TypedArrayName}`, Getter>} */
|
|
44977
44977
|
/** @type {any} */
|
|
@@ -44992,7 +44992,7 @@ function requireWhichTypedArray() {
|
|
|
44992
44992
|
};
|
|
44993
44993
|
var trySlices = function tryAllSlices(value) {
|
|
44994
44994
|
var found2 = false;
|
|
44995
|
-
|
|
44995
|
+
forEach2(
|
|
44996
44996
|
// eslint-disable-next-line no-extra-parens
|
|
44997
44997
|
/** @type {Record<`\$${TypedArrayName}`, Getter>} */
|
|
44998
44998
|
/** @type {any} */
|
|
@@ -46523,7 +46523,7 @@ function require_stream_writable() {
|
|
|
46523
46523
|
// because otherwise some prototype manipulation in
|
|
46524
46524
|
// userland will fail
|
|
46525
46525
|
enumerable: false,
|
|
46526
|
-
get: function
|
|
46526
|
+
get: function get22() {
|
|
46527
46527
|
return this._writableState && this._writableState.getBuffer();
|
|
46528
46528
|
}
|
|
46529
46529
|
});
|
|
@@ -46538,7 +46538,7 @@ function require_stream_writable() {
|
|
|
46538
46538
|
// because otherwise some prototype manipulation in
|
|
46539
46539
|
// userland will fail
|
|
46540
46540
|
enumerable: false,
|
|
46541
|
-
get: function
|
|
46541
|
+
get: function get22() {
|
|
46542
46542
|
return this._writableState.highWaterMark;
|
|
46543
46543
|
}
|
|
46544
46544
|
});
|
|
@@ -46708,7 +46708,7 @@ function require_stream_writable() {
|
|
|
46708
46708
|
// because otherwise some prototype manipulation in
|
|
46709
46709
|
// userland will fail
|
|
46710
46710
|
enumerable: false,
|
|
46711
|
-
get: function
|
|
46711
|
+
get: function get22() {
|
|
46712
46712
|
return this._writableState.length;
|
|
46713
46713
|
}
|
|
46714
46714
|
});
|
|
@@ -46781,7 +46781,7 @@ function require_stream_writable() {
|
|
|
46781
46781
|
// because otherwise some prototype manipulation in
|
|
46782
46782
|
// userland will fail
|
|
46783
46783
|
enumerable: false,
|
|
46784
|
-
get: function
|
|
46784
|
+
get: function get22() {
|
|
46785
46785
|
if (this._writableState === void 0) {
|
|
46786
46786
|
return false;
|
|
46787
46787
|
}
|
|
@@ -46841,7 +46841,7 @@ function require_stream_duplex() {
|
|
|
46841
46841
|
// because otherwise some prototype manipulation in
|
|
46842
46842
|
// userland will fail
|
|
46843
46843
|
enumerable: false,
|
|
46844
|
-
get: function
|
|
46844
|
+
get: function get22() {
|
|
46845
46845
|
return this._writableState.highWaterMark;
|
|
46846
46846
|
}
|
|
46847
46847
|
});
|
|
@@ -46850,7 +46850,7 @@ function require_stream_duplex() {
|
|
|
46850
46850
|
// because otherwise some prototype manipulation in
|
|
46851
46851
|
// userland will fail
|
|
46852
46852
|
enumerable: false,
|
|
46853
|
-
get: function
|
|
46853
|
+
get: function get22() {
|
|
46854
46854
|
return this._writableState && this._writableState.getBuffer();
|
|
46855
46855
|
}
|
|
46856
46856
|
});
|
|
@@ -46859,7 +46859,7 @@ function require_stream_duplex() {
|
|
|
46859
46859
|
// because otherwise some prototype manipulation in
|
|
46860
46860
|
// userland will fail
|
|
46861
46861
|
enumerable: false,
|
|
46862
|
-
get: function
|
|
46862
|
+
get: function get22() {
|
|
46863
46863
|
return this._writableState.length;
|
|
46864
46864
|
}
|
|
46865
46865
|
});
|
|
@@ -46875,7 +46875,7 @@ function require_stream_duplex() {
|
|
|
46875
46875
|
// because otherwise some prototype manipulation in
|
|
46876
46876
|
// userland will fail
|
|
46877
46877
|
enumerable: false,
|
|
46878
|
-
get: function
|
|
46878
|
+
get: function get22() {
|
|
46879
46879
|
if (this._readableState === void 0 || this._writableState === void 0) {
|
|
46880
46880
|
return false;
|
|
46881
46881
|
}
|
|
@@ -47507,7 +47507,7 @@ function require_stream_readable() {
|
|
|
47507
47507
|
var _require$codes = requireErrorsBrowser().codes, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
|
|
47508
47508
|
var StringDecoder;
|
|
47509
47509
|
var createReadableStreamAsyncIterator;
|
|
47510
|
-
var
|
|
47510
|
+
var from2;
|
|
47511
47511
|
requireInherits_browser()(Readable, Stream);
|
|
47512
47512
|
var errorOrDestroy = destroyImpl.errorOrDestroy;
|
|
47513
47513
|
var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
|
|
@@ -47569,7 +47569,7 @@ function require_stream_readable() {
|
|
|
47569
47569
|
// because otherwise some prototype manipulation in
|
|
47570
47570
|
// userland will fail
|
|
47571
47571
|
enumerable: false,
|
|
47572
|
-
get: function
|
|
47572
|
+
get: function get22() {
|
|
47573
47573
|
if (this._readableState === void 0) {
|
|
47574
47574
|
return false;
|
|
47575
47575
|
}
|
|
@@ -48110,7 +48110,7 @@ function require_stream_readable() {
|
|
|
48110
48110
|
// because otherwise some prototype manipulation in
|
|
48111
48111
|
// userland will fail
|
|
48112
48112
|
enumerable: false,
|
|
48113
|
-
get: function
|
|
48113
|
+
get: function get22() {
|
|
48114
48114
|
return this._readableState.highWaterMark;
|
|
48115
48115
|
}
|
|
48116
48116
|
});
|
|
@@ -48119,7 +48119,7 @@ function require_stream_readable() {
|
|
|
48119
48119
|
// because otherwise some prototype manipulation in
|
|
48120
48120
|
// userland will fail
|
|
48121
48121
|
enumerable: false,
|
|
48122
|
-
get: function
|
|
48122
|
+
get: function get22() {
|
|
48123
48123
|
return this._readableState && this._readableState.buffer;
|
|
48124
48124
|
}
|
|
48125
48125
|
});
|
|
@@ -48128,7 +48128,7 @@ function require_stream_readable() {
|
|
|
48128
48128
|
// because otherwise some prototype manipulation in
|
|
48129
48129
|
// userland will fail
|
|
48130
48130
|
enumerable: false,
|
|
48131
|
-
get: function
|
|
48131
|
+
get: function get22() {
|
|
48132
48132
|
return this._readableState.flowing;
|
|
48133
48133
|
},
|
|
48134
48134
|
set: function set2(state2) {
|
|
@@ -48143,7 +48143,7 @@ function require_stream_readable() {
|
|
|
48143
48143
|
// because otherwise some prototype manipulation in
|
|
48144
48144
|
// userland will fail
|
|
48145
48145
|
enumerable: false,
|
|
48146
|
-
get: function
|
|
48146
|
+
get: function get22() {
|
|
48147
48147
|
return this._readableState.length;
|
|
48148
48148
|
}
|
|
48149
48149
|
});
|
|
@@ -48185,10 +48185,10 @@ function require_stream_readable() {
|
|
|
48185
48185
|
}
|
|
48186
48186
|
if (typeof Symbol === "function") {
|
|
48187
48187
|
Readable.from = function(iterable, opts) {
|
|
48188
|
-
if (
|
|
48189
|
-
|
|
48188
|
+
if (from2 === void 0) {
|
|
48189
|
+
from2 = requireFromBrowser();
|
|
48190
48190
|
}
|
|
48191
|
-
return
|
|
48191
|
+
return from2(Readable, iterable, opts);
|
|
48192
48192
|
};
|
|
48193
48193
|
}
|
|
48194
48194
|
function indexOf(xs, x) {
|
|
@@ -48362,8 +48362,8 @@ function requirePipeline() {
|
|
|
48362
48362
|
function call2(fn) {
|
|
48363
48363
|
fn();
|
|
48364
48364
|
}
|
|
48365
|
-
function pipe(
|
|
48366
|
-
return
|
|
48365
|
+
function pipe(from2, to) {
|
|
48366
|
+
return from2.pipe(to);
|
|
48367
48367
|
}
|
|
48368
48368
|
function popCallback(streams) {
|
|
48369
48369
|
if (!streams.length) return noop2;
|
|
@@ -50924,16 +50924,16 @@ _SuperConverter_instances = /* @__PURE__ */ new WeakSet();
|
|
|
50924
50924
|
handleListNode_fn = function(node, listItems, listLevel = 0) {
|
|
50925
50925
|
const parsedListItems = [];
|
|
50926
50926
|
let overallListType;
|
|
50927
|
-
for (let item of listItems) {
|
|
50927
|
+
for (let [index, item] of listItems.entries()) {
|
|
50928
50928
|
if (item.seen) continue;
|
|
50929
50929
|
const { attributes, elements, marks = [] } = this._parseProperties(item);
|
|
50930
50930
|
const { listType, ilvl } = this._getNodeListType(attributes);
|
|
50931
50931
|
const intLevel = parseInt(ilvl);
|
|
50932
50932
|
if (listLevel > intLevel) continue;
|
|
50933
50933
|
const content = [];
|
|
50934
|
+
const sublist = {};
|
|
50934
50935
|
if (listLevel < intLevel) {
|
|
50935
|
-
|
|
50936
|
-
content.push(sublist);
|
|
50936
|
+
Object.assign(sublist, __privateMethod2(this, _SuperConverter_instances, handleListNode_fn).call(this, item, listItems, listLevel + 1));
|
|
50937
50937
|
} else {
|
|
50938
50938
|
overallListType = listType;
|
|
50939
50939
|
item.seen = true;
|
|
@@ -50943,7 +50943,12 @@ handleListNode_fn = function(node, listItems, listLevel = 0) {
|
|
|
50943
50943
|
if (schemaNode) content.push(schemaNode);
|
|
50944
50944
|
}
|
|
50945
50945
|
}
|
|
50946
|
-
|
|
50946
|
+
if (Object.keys(sublist).length) {
|
|
50947
|
+
const item2 = parsedListItems[index - 1];
|
|
50948
|
+
item2?.content.push(sublist);
|
|
50949
|
+
} else {
|
|
50950
|
+
parsedListItems.push(__privateMethod2(this, _SuperConverter_instances, createListItem_fn).call(this, content, attributes, marks));
|
|
50951
|
+
}
|
|
50947
50952
|
}
|
|
50948
50953
|
node.seen = true;
|
|
50949
50954
|
return {
|
|
@@ -53463,27 +53468,27 @@ OrderedMap.prototype = {
|
|
|
53463
53468
|
// :: (union<Object, OrderedMap>) → OrderedMap
|
|
53464
53469
|
// Create a new map by prepending the keys in this map that don't
|
|
53465
53470
|
// appear in `map` before the keys in `map`.
|
|
53466
|
-
prepend: function(
|
|
53467
|
-
|
|
53468
|
-
if (!
|
|
53469
|
-
return new OrderedMap(
|
|
53471
|
+
prepend: function(map22) {
|
|
53472
|
+
map22 = OrderedMap.from(map22);
|
|
53473
|
+
if (!map22.size) return this;
|
|
53474
|
+
return new OrderedMap(map22.content.concat(this.subtract(map22).content));
|
|
53470
53475
|
},
|
|
53471
53476
|
// :: (union<Object, OrderedMap>) → OrderedMap
|
|
53472
53477
|
// Create a new map by appending the keys in this map that don't
|
|
53473
53478
|
// appear in `map` after the keys in `map`.
|
|
53474
|
-
append: function(
|
|
53475
|
-
|
|
53476
|
-
if (!
|
|
53477
|
-
return new OrderedMap(this.subtract(
|
|
53479
|
+
append: function(map22) {
|
|
53480
|
+
map22 = OrderedMap.from(map22);
|
|
53481
|
+
if (!map22.size) return this;
|
|
53482
|
+
return new OrderedMap(this.subtract(map22).content.concat(map22.content));
|
|
53478
53483
|
},
|
|
53479
53484
|
// :: (union<Object, OrderedMap>) → OrderedMap
|
|
53480
53485
|
// Create a map containing all the keys in this map that don't
|
|
53481
53486
|
// appear in `map`.
|
|
53482
|
-
subtract: function(
|
|
53487
|
+
subtract: function(map22) {
|
|
53483
53488
|
var result = this;
|
|
53484
|
-
|
|
53485
|
-
for (var i = 0; i <
|
|
53486
|
-
result = result.remove(
|
|
53489
|
+
map22 = OrderedMap.from(map22);
|
|
53490
|
+
for (var i = 0; i < map22.content.length; i += 2)
|
|
53491
|
+
result = result.remove(map22.content[i]);
|
|
53487
53492
|
return result;
|
|
53488
53493
|
},
|
|
53489
53494
|
// :: () → Object
|
|
@@ -53577,12 +53582,12 @@ class Fragment {
|
|
|
53577
53582
|
positions (relative to start of this fragment). Doesn't descend
|
|
53578
53583
|
into a node when the callback returns `false`.
|
|
53579
53584
|
*/
|
|
53580
|
-
nodesBetween(
|
|
53585
|
+
nodesBetween(from2, to, f, nodeStart = 0, parent) {
|
|
53581
53586
|
for (let i = 0, pos = 0; pos < to; i++) {
|
|
53582
53587
|
let child = this.content[i], end = pos + child.nodeSize;
|
|
53583
|
-
if (end >
|
|
53588
|
+
if (end > from2 && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
|
|
53584
53589
|
let start = pos + 1;
|
|
53585
|
-
child.nodesBetween(Math.max(0,
|
|
53590
|
+
child.nodesBetween(Math.max(0, from2 - start), Math.min(child.content.size, to - start), f, nodeStart + start);
|
|
53586
53591
|
}
|
|
53587
53592
|
pos = end;
|
|
53588
53593
|
}
|
|
@@ -53599,10 +53604,10 @@ class Fragment {
|
|
|
53599
53604
|
Extract the text between `from` and `to`. See the same method on
|
|
53600
53605
|
[`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).
|
|
53601
53606
|
*/
|
|
53602
|
-
textBetween(
|
|
53607
|
+
textBetween(from2, to, blockSeparator, leafText) {
|
|
53603
53608
|
let text = "", first = true;
|
|
53604
|
-
this.nodesBetween(
|
|
53605
|
-
let nodeText = node.isText ? node.text.slice(Math.max(
|
|
53609
|
+
this.nodesBetween(from2, to, (node, pos) => {
|
|
53610
|
+
let nodeText = node.isText ? node.text.slice(Math.max(from2, pos) - pos, to - pos) : !node.isLeaf ? "" : leafText ? typeof leafText === "function" ? leafText(node) : leafText : node.type.spec.leafText ? node.type.spec.leafText(node) : "";
|
|
53606
53611
|
if (node.isBlock && (node.isLeaf && nodeText || node.isTextblock) && blockSeparator) {
|
|
53607
53612
|
if (first)
|
|
53608
53613
|
first = false;
|
|
@@ -53634,19 +53639,19 @@ class Fragment {
|
|
|
53634
53639
|
/**
|
|
53635
53640
|
Cut out the sub-fragment between the two given positions.
|
|
53636
53641
|
*/
|
|
53637
|
-
cut(
|
|
53638
|
-
if (
|
|
53642
|
+
cut(from2, to = this.size) {
|
|
53643
|
+
if (from2 == 0 && to == this.size)
|
|
53639
53644
|
return this;
|
|
53640
53645
|
let result = [], size2 = 0;
|
|
53641
|
-
if (to >
|
|
53646
|
+
if (to > from2)
|
|
53642
53647
|
for (let i = 0, pos = 0; pos < to; i++) {
|
|
53643
53648
|
let child = this.content[i], end = pos + child.nodeSize;
|
|
53644
|
-
if (end >
|
|
53645
|
-
if (pos <
|
|
53649
|
+
if (end > from2) {
|
|
53650
|
+
if (pos < from2 || end > to) {
|
|
53646
53651
|
if (child.isText)
|
|
53647
|
-
child = child.cut(Math.max(0,
|
|
53652
|
+
child = child.cut(Math.max(0, from2 - pos), Math.min(child.text.length, to - pos));
|
|
53648
53653
|
else
|
|
53649
|
-
child = child.cut(Math.max(0,
|
|
53654
|
+
child = child.cut(Math.max(0, from2 - pos - 1), Math.min(child.content.size, to - pos - 1));
|
|
53650
53655
|
}
|
|
53651
53656
|
result.push(child);
|
|
53652
53657
|
size2 += child.nodeSize;
|
|
@@ -53658,12 +53663,12 @@ class Fragment {
|
|
|
53658
53663
|
/**
|
|
53659
53664
|
@internal
|
|
53660
53665
|
*/
|
|
53661
|
-
cutByIndex(
|
|
53662
|
-
if (
|
|
53666
|
+
cutByIndex(from2, to) {
|
|
53667
|
+
if (from2 == to)
|
|
53663
53668
|
return Fragment.empty;
|
|
53664
|
-
if (
|
|
53669
|
+
if (from2 == 0 && to == this.content.length)
|
|
53665
53670
|
return this;
|
|
53666
|
-
return new Fragment(this.content.slice(
|
|
53671
|
+
return new Fragment(this.content.slice(from2, to));
|
|
53667
53672
|
}
|
|
53668
53673
|
/**
|
|
53669
53674
|
Create a new fragment in which the node at the given index is
|
|
@@ -54039,8 +54044,8 @@ class Slice {
|
|
|
54039
54044
|
/**
|
|
54040
54045
|
@internal
|
|
54041
54046
|
*/
|
|
54042
|
-
removeBetween(
|
|
54043
|
-
return new Slice(removeRange(this.content,
|
|
54047
|
+
removeBetween(from2, to) {
|
|
54048
|
+
return new Slice(removeRange(this.content, from2 + this.openStart, to + this.openStart), this.openStart, this.openEnd);
|
|
54044
54049
|
}
|
|
54045
54050
|
/**
|
|
54046
54051
|
Tests whether this slice is equal to another slice.
|
|
@@ -54092,17 +54097,17 @@ class Slice {
|
|
|
54092
54097
|
}
|
|
54093
54098
|
}
|
|
54094
54099
|
Slice.empty = new Slice(Fragment.empty, 0, 0);
|
|
54095
|
-
function removeRange(content,
|
|
54096
|
-
let { index, offset } = content.findIndex(
|
|
54100
|
+
function removeRange(content, from2, to) {
|
|
54101
|
+
let { index, offset } = content.findIndex(from2), child = content.maybeChild(index);
|
|
54097
54102
|
let { index: indexTo, offset: offsetTo } = content.findIndex(to);
|
|
54098
|
-
if (offset ==
|
|
54103
|
+
if (offset == from2 || child.isText) {
|
|
54099
54104
|
if (offsetTo != to && !content.child(indexTo).isText)
|
|
54100
54105
|
throw new RangeError("Removing non-flat range");
|
|
54101
|
-
return content.cut(0,
|
|
54106
|
+
return content.cut(0, from2).append(content.cut(to));
|
|
54102
54107
|
}
|
|
54103
54108
|
if (index != indexTo)
|
|
54104
54109
|
throw new RangeError("Removing non-flat range");
|
|
54105
|
-
return content.replaceChild(index, child.copy(removeRange(child.content,
|
|
54110
|
+
return content.replaceChild(index, child.copy(removeRange(child.content, from2 - offset - 1, to - offset - 1)));
|
|
54106
54111
|
}
|
|
54107
54112
|
function insertInto(content, dist2, insert, parent) {
|
|
54108
54113
|
let { index, offset } = content.findIndex(dist2), child = content.maybeChild(index);
|
|
@@ -54112,25 +54117,25 @@ function insertInto(content, dist2, insert, parent) {
|
|
|
54112
54117
|
let inner = insertInto(child.content, dist2 - offset - 1, insert);
|
|
54113
54118
|
return inner && content.replaceChild(index, child.copy(inner));
|
|
54114
54119
|
}
|
|
54115
|
-
function replace($from, $to,
|
|
54116
|
-
if (
|
|
54120
|
+
function replace($from, $to, slice2) {
|
|
54121
|
+
if (slice2.openStart > $from.depth)
|
|
54117
54122
|
throw new ReplaceError("Inserted content deeper than insertion position");
|
|
54118
|
-
if ($from.depth -
|
|
54123
|
+
if ($from.depth - slice2.openStart != $to.depth - slice2.openEnd)
|
|
54119
54124
|
throw new ReplaceError("Inconsistent open depths");
|
|
54120
|
-
return replaceOuter($from, $to,
|
|
54125
|
+
return replaceOuter($from, $to, slice2, 0);
|
|
54121
54126
|
}
|
|
54122
|
-
function replaceOuter($from, $to,
|
|
54127
|
+
function replaceOuter($from, $to, slice2, depth) {
|
|
54123
54128
|
let index = $from.index(depth), node = $from.node(depth);
|
|
54124
|
-
if (index == $to.index(depth) && depth < $from.depth -
|
|
54125
|
-
let inner = replaceOuter($from, $to,
|
|
54129
|
+
if (index == $to.index(depth) && depth < $from.depth - slice2.openStart) {
|
|
54130
|
+
let inner = replaceOuter($from, $to, slice2, depth + 1);
|
|
54126
54131
|
return node.copy(node.content.replaceChild(index, inner));
|
|
54127
|
-
} else if (!
|
|
54132
|
+
} else if (!slice2.content.size) {
|
|
54128
54133
|
return close(node, replaceTwoWay($from, $to, depth));
|
|
54129
|
-
} else if (!
|
|
54134
|
+
} else if (!slice2.openStart && !slice2.openEnd && $from.depth == depth && $to.depth == depth) {
|
|
54130
54135
|
let parent = $from.parent, content = parent.content;
|
|
54131
|
-
return close(parent, content.cut(0, $from.parentOffset).append(
|
|
54136
|
+
return close(parent, content.cut(0, $from.parentOffset).append(slice2.content).append(content.cut($to.parentOffset)));
|
|
54132
54137
|
} else {
|
|
54133
|
-
let { start, end } = prepareSliceForReplace(
|
|
54138
|
+
let { start, end } = prepareSliceForReplace(slice2, $from);
|
|
54134
54139
|
return close(node, replaceThreeWay($from, start, end, $to, depth));
|
|
54135
54140
|
}
|
|
54136
54141
|
}
|
|
@@ -54199,14 +54204,14 @@ function replaceTwoWay($from, $to, depth) {
|
|
|
54199
54204
|
addRange($to, null, depth, content);
|
|
54200
54205
|
return new Fragment(content);
|
|
54201
54206
|
}
|
|
54202
|
-
function prepareSliceForReplace(
|
|
54203
|
-
let extra = $along.depth -
|
|
54204
|
-
let node = parent.copy(
|
|
54207
|
+
function prepareSliceForReplace(slice2, $along) {
|
|
54208
|
+
let extra = $along.depth - slice2.openStart, parent = $along.node(extra);
|
|
54209
|
+
let node = parent.copy(slice2.content);
|
|
54205
54210
|
for (let i = extra - 1; i >= 0; i--)
|
|
54206
54211
|
node = $along.node(i).copy(Fragment.from(node));
|
|
54207
54212
|
return {
|
|
54208
|
-
start: node.resolveNoCache(
|
|
54209
|
-
end: node.resolveNoCache(node.content.size -
|
|
54213
|
+
start: node.resolveNoCache(slice2.openStart + extra),
|
|
54214
|
+
end: node.resolveNoCache(node.content.size - slice2.openEnd - extra)
|
|
54210
54215
|
};
|
|
54211
54216
|
}
|
|
54212
54217
|
class ResolvedPos {
|
|
@@ -54578,8 +54583,8 @@ let Node$1 = class Node2 {
|
|
|
54578
54583
|
recursed over. The last parameter can be used to specify a
|
|
54579
54584
|
starting position to count from.
|
|
54580
54585
|
*/
|
|
54581
|
-
nodesBetween(
|
|
54582
|
-
this.content.nodesBetween(
|
|
54586
|
+
nodesBetween(from2, to, f, startPos = 0) {
|
|
54587
|
+
this.content.nodesBetween(from2, to, f, startPos, this);
|
|
54583
54588
|
}
|
|
54584
54589
|
/**
|
|
54585
54590
|
Call the given callback for every descendant node. Doesn't
|
|
@@ -54602,8 +54607,8 @@ let Node$1 = class Node2 {
|
|
|
54602
54607
|
inserted for every non-text leaf node encountered, otherwise
|
|
54603
54608
|
[`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec^leafText) will be used.
|
|
54604
54609
|
*/
|
|
54605
|
-
textBetween(
|
|
54606
|
-
return this.content.textBetween(
|
|
54610
|
+
textBetween(from2, to, blockSeparator, leafText) {
|
|
54611
|
+
return this.content.textBetween(from2, to, blockSeparator, leafText);
|
|
54607
54612
|
}
|
|
54608
54613
|
/**
|
|
54609
54614
|
Returns this node's first child, or `null` if there are no
|
|
@@ -54660,19 +54665,19 @@ let Node$1 = class Node2 {
|
|
|
54660
54665
|
given positions. If `to` is not given, it defaults to the end of
|
|
54661
54666
|
the node.
|
|
54662
54667
|
*/
|
|
54663
|
-
cut(
|
|
54664
|
-
if (
|
|
54668
|
+
cut(from2, to = this.content.size) {
|
|
54669
|
+
if (from2 == 0 && to == this.content.size)
|
|
54665
54670
|
return this;
|
|
54666
|
-
return this.copy(this.content.cut(
|
|
54671
|
+
return this.copy(this.content.cut(from2, to));
|
|
54667
54672
|
}
|
|
54668
54673
|
/**
|
|
54669
54674
|
Cut out the part of the document between the given positions, and
|
|
54670
54675
|
return it as a `Slice` object.
|
|
54671
54676
|
*/
|
|
54672
|
-
slice(
|
|
54673
|
-
if (
|
|
54677
|
+
slice(from2, to = this.content.size, includeParents = false) {
|
|
54678
|
+
if (from2 == to)
|
|
54674
54679
|
return Slice.empty;
|
|
54675
|
-
let $from = this.resolve(
|
|
54680
|
+
let $from = this.resolve(from2), $to = this.resolve(to);
|
|
54676
54681
|
let depth = includeParents ? 0 : $from.sharedDepth(to);
|
|
54677
54682
|
let start = $from.start(depth), node = $from.node(depth);
|
|
54678
54683
|
let content = node.content.cut($from.pos - start, $to.pos - start);
|
|
@@ -54686,8 +54691,8 @@ let Node$1 = class Node2 {
|
|
|
54686
54691
|
into. If any of this is violated, an error of type
|
|
54687
54692
|
[`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
|
|
54688
54693
|
*/
|
|
54689
|
-
replace(
|
|
54690
|
-
return replace(this.resolve(
|
|
54694
|
+
replace(from2, to, slice2) {
|
|
54695
|
+
return replace(this.resolve(from2), this.resolve(to), slice2);
|
|
54691
54696
|
}
|
|
54692
54697
|
/**
|
|
54693
54698
|
Find the node directly after the given position.
|
|
@@ -54743,10 +54748,10 @@ let Node$1 = class Node2 {
|
|
|
54743
54748
|
Test whether a given mark or mark type occurs in this document
|
|
54744
54749
|
between the two given positions.
|
|
54745
54750
|
*/
|
|
54746
|
-
rangeHasMark(
|
|
54751
|
+
rangeHasMark(from2, to, type2) {
|
|
54747
54752
|
let found2 = false;
|
|
54748
|
-
if (to >
|
|
54749
|
-
this.nodesBetween(
|
|
54753
|
+
if (to > from2)
|
|
54754
|
+
this.nodesBetween(from2, to, (node) => {
|
|
54750
54755
|
if (type2.isInSet(node.marks))
|
|
54751
54756
|
found2 = true;
|
|
54752
54757
|
return !found2;
|
|
@@ -54829,8 +54834,8 @@ let Node$1 = class Node2 {
|
|
|
54829
54834
|
can optionally pass `start` and `end` indices into the
|
|
54830
54835
|
replacement fragment.
|
|
54831
54836
|
*/
|
|
54832
|
-
canReplace(
|
|
54833
|
-
let one = this.contentMatchAt(
|
|
54837
|
+
canReplace(from2, to, replacement = Fragment.empty, start = 0, end = replacement.childCount) {
|
|
54838
|
+
let one = this.contentMatchAt(from2).matchFragment(replacement, start, end);
|
|
54834
54839
|
let two = one && one.matchFragment(this.content, to);
|
|
54835
54840
|
if (!two || !two.validEnd)
|
|
54836
54841
|
return false;
|
|
@@ -54843,10 +54848,10 @@ let Node$1 = class Node2 {
|
|
|
54843
54848
|
Test whether replacing the range `from` to `to` (by index) with
|
|
54844
54849
|
a node of the given type would leave the node's content valid.
|
|
54845
54850
|
*/
|
|
54846
|
-
canReplaceWith(
|
|
54851
|
+
canReplaceWith(from2, to, type2, marks) {
|
|
54847
54852
|
if (marks && !this.type.allowsMarks(marks))
|
|
54848
54853
|
return false;
|
|
54849
|
-
let start = this.contentMatchAt(
|
|
54854
|
+
let start = this.contentMatchAt(from2).matchType(type2);
|
|
54850
54855
|
let end = start && start.matchFragment(this.content, to);
|
|
54851
54856
|
return end ? end.validEnd : false;
|
|
54852
54857
|
}
|
|
@@ -54930,8 +54935,8 @@ class TextNode extends Node$1 {
|
|
|
54930
54935
|
get textContent() {
|
|
54931
54936
|
return this.text;
|
|
54932
54937
|
}
|
|
54933
|
-
textBetween(
|
|
54934
|
-
return this.text.slice(
|
|
54938
|
+
textBetween(from2, to) {
|
|
54939
|
+
return this.text.slice(from2, to);
|
|
54935
54940
|
}
|
|
54936
54941
|
get nodeSize() {
|
|
54937
54942
|
return this.text.length;
|
|
@@ -54944,10 +54949,10 @@ class TextNode extends Node$1 {
|
|
|
54944
54949
|
return this;
|
|
54945
54950
|
return new TextNode(this.type, this.attrs, text, this.marks);
|
|
54946
54951
|
}
|
|
54947
|
-
cut(
|
|
54948
|
-
if (
|
|
54952
|
+
cut(from2 = 0, to = this.text.length) {
|
|
54953
|
+
if (from2 == 0 && to == this.text.length)
|
|
54949
54954
|
return this;
|
|
54950
|
-
return this.withText(this.text.slice(
|
|
54955
|
+
return this.withText(this.text.slice(from2, to));
|
|
54951
54956
|
}
|
|
54952
54957
|
eq(other) {
|
|
54953
54958
|
return this.sameMarkup(other) && this.text == other.text;
|
|
@@ -55247,38 +55252,38 @@ function nfa(expr) {
|
|
|
55247
55252
|
function node() {
|
|
55248
55253
|
return nfa2.push([]) - 1;
|
|
55249
55254
|
}
|
|
55250
|
-
function edge(
|
|
55255
|
+
function edge(from2, to, term) {
|
|
55251
55256
|
let edge2 = { term, to };
|
|
55252
|
-
nfa2[
|
|
55257
|
+
nfa2[from2].push(edge2);
|
|
55253
55258
|
return edge2;
|
|
55254
55259
|
}
|
|
55255
55260
|
function connect(edges, to) {
|
|
55256
55261
|
edges.forEach((edge2) => edge2.to = to);
|
|
55257
55262
|
}
|
|
55258
|
-
function compile2(expr2,
|
|
55263
|
+
function compile2(expr2, from2) {
|
|
55259
55264
|
if (expr2.type == "choice") {
|
|
55260
|
-
return expr2.exprs.reduce((out, expr3) => out.concat(compile2(expr3,
|
|
55265
|
+
return expr2.exprs.reduce((out, expr3) => out.concat(compile2(expr3, from2)), []);
|
|
55261
55266
|
} else if (expr2.type == "seq") {
|
|
55262
55267
|
for (let i = 0; ; i++) {
|
|
55263
|
-
let next = compile2(expr2.exprs[i],
|
|
55268
|
+
let next = compile2(expr2.exprs[i], from2);
|
|
55264
55269
|
if (i == expr2.exprs.length - 1)
|
|
55265
55270
|
return next;
|
|
55266
|
-
connect(next,
|
|
55271
|
+
connect(next, from2 = node());
|
|
55267
55272
|
}
|
|
55268
55273
|
} else if (expr2.type == "star") {
|
|
55269
55274
|
let loop = node();
|
|
55270
|
-
edge(
|
|
55275
|
+
edge(from2, loop);
|
|
55271
55276
|
connect(compile2(expr2.expr, loop), loop);
|
|
55272
55277
|
return [edge(loop)];
|
|
55273
55278
|
} else if (expr2.type == "plus") {
|
|
55274
55279
|
let loop = node();
|
|
55275
|
-
connect(compile2(expr2.expr,
|
|
55280
|
+
connect(compile2(expr2.expr, from2), loop);
|
|
55276
55281
|
connect(compile2(expr2.expr, loop), loop);
|
|
55277
55282
|
return [edge(loop)];
|
|
55278
55283
|
} else if (expr2.type == "opt") {
|
|
55279
|
-
return [edge(
|
|
55284
|
+
return [edge(from2)].concat(compile2(expr2.expr, from2));
|
|
55280
55285
|
} else if (expr2.type == "range") {
|
|
55281
|
-
let cur =
|
|
55286
|
+
let cur = from2;
|
|
55282
55287
|
for (let i = 0; i < expr2.min; i++) {
|
|
55283
55288
|
let next = node();
|
|
55284
55289
|
connect(compile2(expr2.expr, cur), next);
|
|
@@ -55296,7 +55301,7 @@ function nfa(expr) {
|
|
|
55296
55301
|
}
|
|
55297
55302
|
return [edge(cur)];
|
|
55298
55303
|
} else if (expr2.type == "name") {
|
|
55299
|
-
return [edge(
|
|
55304
|
+
return [edge(from2, void 0, expr2.value)];
|
|
55300
55305
|
} else {
|
|
55301
55306
|
throw new Error("Unknown expr type");
|
|
55302
55307
|
}
|
|
@@ -56803,17 +56808,17 @@ class Mapping {
|
|
|
56803
56808
|
/**
|
|
56804
56809
|
Create a new mapping with the given position maps.
|
|
56805
56810
|
*/
|
|
56806
|
-
constructor(maps = [], mirror,
|
|
56811
|
+
constructor(maps = [], mirror, from2 = 0, to = maps.length) {
|
|
56807
56812
|
this.maps = maps;
|
|
56808
56813
|
this.mirror = mirror;
|
|
56809
|
-
this.from =
|
|
56814
|
+
this.from = from2;
|
|
56810
56815
|
this.to = to;
|
|
56811
56816
|
}
|
|
56812
56817
|
/**
|
|
56813
56818
|
Create a mapping that maps only through a part of this one.
|
|
56814
56819
|
*/
|
|
56815
|
-
slice(
|
|
56816
|
-
return new Mapping(this.maps, this.mirror,
|
|
56820
|
+
slice(from2 = 0, to = this.maps.length) {
|
|
56821
|
+
return new Mapping(this.maps, this.mirror, from2, to);
|
|
56817
56822
|
}
|
|
56818
56823
|
/**
|
|
56819
56824
|
@internal
|
|
@@ -56826,8 +56831,8 @@ class Mapping {
|
|
|
56826
56831
|
given, it should be the index of the step map that is the mirror
|
|
56827
56832
|
image of this one.
|
|
56828
56833
|
*/
|
|
56829
|
-
appendMap(
|
|
56830
|
-
this.to = this.maps.push(
|
|
56834
|
+
appendMap(map22, mirrors) {
|
|
56835
|
+
this.to = this.maps.push(map22);
|
|
56831
56836
|
if (mirrors != null)
|
|
56832
56837
|
this.setMirror(this.maps.length - 1, mirrors);
|
|
56833
56838
|
}
|
|
@@ -56901,7 +56906,7 @@ class Mapping {
|
|
|
56901
56906
|
_map(pos, assoc, simple) {
|
|
56902
56907
|
let delInfo = 0;
|
|
56903
56908
|
for (let i = this.from; i < this.to; i++) {
|
|
56904
|
-
let
|
|
56909
|
+
let map22 = this.maps[i], result = map22.mapResult(pos, assoc);
|
|
56905
56910
|
if (result.recover != null) {
|
|
56906
56911
|
let corr = this.getMirror(i);
|
|
56907
56912
|
if (corr != null && corr > i && corr < this.to) {
|
|
@@ -56985,9 +56990,9 @@ class StepResult {
|
|
|
56985
56990
|
arguments. Create a successful result if it succeeds, and a
|
|
56986
56991
|
failed one if it throws a `ReplaceError`.
|
|
56987
56992
|
*/
|
|
56988
|
-
static fromReplace(doc2,
|
|
56993
|
+
static fromReplace(doc2, from2, to, slice2) {
|
|
56989
56994
|
try {
|
|
56990
|
-
return StepResult.ok(doc2.replace(
|
|
56995
|
+
return StepResult.ok(doc2.replace(from2, to, slice2));
|
|
56991
56996
|
} catch (e) {
|
|
56992
56997
|
if (e instanceof ReplaceError)
|
|
56993
56998
|
return StepResult.fail(e.message);
|
|
@@ -57011,30 +57016,30 @@ class AddMarkStep extends Step {
|
|
|
57011
57016
|
/**
|
|
57012
57017
|
Create a mark step.
|
|
57013
57018
|
*/
|
|
57014
|
-
constructor(
|
|
57019
|
+
constructor(from2, to, mark) {
|
|
57015
57020
|
super();
|
|
57016
|
-
this.from =
|
|
57021
|
+
this.from = from2;
|
|
57017
57022
|
this.to = to;
|
|
57018
57023
|
this.mark = mark;
|
|
57019
57024
|
}
|
|
57020
57025
|
apply(doc2) {
|
|
57021
57026
|
let oldSlice = doc2.slice(this.from, this.to), $from = doc2.resolve(this.from);
|
|
57022
57027
|
let parent = $from.node($from.sharedDepth(this.to));
|
|
57023
|
-
let
|
|
57028
|
+
let slice2 = new Slice(mapFragment(oldSlice.content, (node, parent2) => {
|
|
57024
57029
|
if (!node.isAtom || !parent2.type.allowsMarkType(this.mark.type))
|
|
57025
57030
|
return node;
|
|
57026
57031
|
return node.mark(this.mark.addToSet(node.marks));
|
|
57027
57032
|
}, parent), oldSlice.openStart, oldSlice.openEnd);
|
|
57028
|
-
return StepResult.fromReplace(doc2, this.from, this.to,
|
|
57033
|
+
return StepResult.fromReplace(doc2, this.from, this.to, slice2);
|
|
57029
57034
|
}
|
|
57030
57035
|
invert() {
|
|
57031
57036
|
return new RemoveMarkStep(this.from, this.to, this.mark);
|
|
57032
57037
|
}
|
|
57033
57038
|
map(mapping) {
|
|
57034
|
-
let
|
|
57035
|
-
if (
|
|
57039
|
+
let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
57040
|
+
if (from2.deleted && to.deleted || from2.pos >= to.pos)
|
|
57036
57041
|
return null;
|
|
57037
|
-
return new AddMarkStep(
|
|
57042
|
+
return new AddMarkStep(from2.pos, to.pos, this.mark);
|
|
57038
57043
|
}
|
|
57039
57044
|
merge(other) {
|
|
57040
57045
|
if (other instanceof AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from)
|
|
@@ -57063,27 +57068,27 @@ class RemoveMarkStep extends Step {
|
|
|
57063
57068
|
/**
|
|
57064
57069
|
Create a mark-removing step.
|
|
57065
57070
|
*/
|
|
57066
|
-
constructor(
|
|
57071
|
+
constructor(from2, to, mark) {
|
|
57067
57072
|
super();
|
|
57068
|
-
this.from =
|
|
57073
|
+
this.from = from2;
|
|
57069
57074
|
this.to = to;
|
|
57070
57075
|
this.mark = mark;
|
|
57071
57076
|
}
|
|
57072
57077
|
apply(doc2) {
|
|
57073
57078
|
let oldSlice = doc2.slice(this.from, this.to);
|
|
57074
|
-
let
|
|
57079
|
+
let slice2 = new Slice(mapFragment(oldSlice.content, (node) => {
|
|
57075
57080
|
return node.mark(this.mark.removeFromSet(node.marks));
|
|
57076
57081
|
}, doc2), oldSlice.openStart, oldSlice.openEnd);
|
|
57077
|
-
return StepResult.fromReplace(doc2, this.from, this.to,
|
|
57082
|
+
return StepResult.fromReplace(doc2, this.from, this.to, slice2);
|
|
57078
57083
|
}
|
|
57079
57084
|
invert() {
|
|
57080
57085
|
return new AddMarkStep(this.from, this.to, this.mark);
|
|
57081
57086
|
}
|
|
57082
57087
|
map(mapping) {
|
|
57083
|
-
let
|
|
57084
|
-
if (
|
|
57088
|
+
let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
57089
|
+
if (from2.deleted && to.deleted || from2.pos >= to.pos)
|
|
57085
57090
|
return null;
|
|
57086
|
-
return new RemoveMarkStep(
|
|
57091
|
+
return new RemoveMarkStep(from2.pos, to.pos, this.mark);
|
|
57087
57092
|
}
|
|
57088
57093
|
merge(other) {
|
|
57089
57094
|
if (other instanceof RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from)
|
|
@@ -57203,11 +57208,11 @@ class ReplaceStep extends Step {
|
|
|
57203
57208
|
tokens (this is to guard against rebased replace steps
|
|
57204
57209
|
overwriting something they weren't supposed to).
|
|
57205
57210
|
*/
|
|
57206
|
-
constructor(
|
|
57211
|
+
constructor(from2, to, slice2, structure = false) {
|
|
57207
57212
|
super();
|
|
57208
|
-
this.from =
|
|
57213
|
+
this.from = from2;
|
|
57209
57214
|
this.to = to;
|
|
57210
|
-
this.slice =
|
|
57215
|
+
this.slice = slice2;
|
|
57211
57216
|
this.structure = structure;
|
|
57212
57217
|
}
|
|
57213
57218
|
apply(doc2) {
|
|
@@ -57222,20 +57227,20 @@ class ReplaceStep extends Step {
|
|
|
57222
57227
|
return new ReplaceStep(this.from, this.from + this.slice.size, doc2.slice(this.from, this.to));
|
|
57223
57228
|
}
|
|
57224
57229
|
map(mapping) {
|
|
57225
|
-
let
|
|
57226
|
-
if (
|
|
57230
|
+
let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
57231
|
+
if (from2.deletedAcross && to.deletedAcross)
|
|
57227
57232
|
return null;
|
|
57228
|
-
return new ReplaceStep(
|
|
57233
|
+
return new ReplaceStep(from2.pos, Math.max(from2.pos, to.pos), this.slice);
|
|
57229
57234
|
}
|
|
57230
57235
|
merge(other) {
|
|
57231
57236
|
if (!(other instanceof ReplaceStep) || other.structure || this.structure)
|
|
57232
57237
|
return null;
|
|
57233
57238
|
if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {
|
|
57234
|
-
let
|
|
57235
|
-
return new ReplaceStep(this.from, this.to + (other.to - other.from),
|
|
57239
|
+
let slice2 = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);
|
|
57240
|
+
return new ReplaceStep(this.from, this.to + (other.to - other.from), slice2, this.structure);
|
|
57236
57241
|
} else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {
|
|
57237
|
-
let
|
|
57238
|
-
return new ReplaceStep(other.from, this.to,
|
|
57242
|
+
let slice2 = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);
|
|
57243
|
+
return new ReplaceStep(other.from, this.to, slice2, this.structure);
|
|
57239
57244
|
} else {
|
|
57240
57245
|
return null;
|
|
57241
57246
|
}
|
|
@@ -57265,13 +57270,13 @@ class ReplaceAroundStep extends Step {
|
|
|
57265
57270
|
of the gap should be moved. `structure` has the same meaning as
|
|
57266
57271
|
it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.
|
|
57267
57272
|
*/
|
|
57268
|
-
constructor(
|
|
57273
|
+
constructor(from2, to, gapFrom, gapTo, slice2, insert, structure = false) {
|
|
57269
57274
|
super();
|
|
57270
|
-
this.from =
|
|
57275
|
+
this.from = from2;
|
|
57271
57276
|
this.to = to;
|
|
57272
57277
|
this.gapFrom = gapFrom;
|
|
57273
57278
|
this.gapTo = gapTo;
|
|
57274
|
-
this.slice =
|
|
57279
|
+
this.slice = slice2;
|
|
57275
57280
|
this.insert = insert;
|
|
57276
57281
|
this.structure = structure;
|
|
57277
57282
|
}
|
|
@@ -57301,12 +57306,12 @@ class ReplaceAroundStep extends Step {
|
|
|
57301
57306
|
return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc2.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
|
|
57302
57307
|
}
|
|
57303
57308
|
map(mapping) {
|
|
57304
|
-
let
|
|
57305
|
-
let gapFrom = this.from == this.gapFrom ?
|
|
57309
|
+
let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
57310
|
+
let gapFrom = this.from == this.gapFrom ? from2.pos : mapping.map(this.gapFrom, -1);
|
|
57306
57311
|
let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
|
|
57307
|
-
if (
|
|
57312
|
+
if (from2.deletedAcross && to.deletedAcross || gapFrom < from2.pos || gapTo > to.pos)
|
|
57308
57313
|
return null;
|
|
57309
|
-
return new ReplaceAroundStep(
|
|
57314
|
+
return new ReplaceAroundStep(from2.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
|
|
57310
57315
|
}
|
|
57311
57316
|
toJSON() {
|
|
57312
57317
|
let json = {
|
|
@@ -57333,8 +57338,8 @@ class ReplaceAroundStep extends Step {
|
|
|
57333
57338
|
}
|
|
57334
57339
|
}
|
|
57335
57340
|
Step.jsonID("replaceAround", ReplaceAroundStep);
|
|
57336
|
-
function contentBetween(doc2,
|
|
57337
|
-
let $from = doc2.resolve(
|
|
57341
|
+
function contentBetween(doc2, from2, to) {
|
|
57342
|
+
let $from = doc2.resolve(from2), dist2 = to - from2, depth = $from.depth;
|
|
57338
57343
|
while (dist2 > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {
|
|
57339
57344
|
depth--;
|
|
57340
57345
|
dist2--;
|
|
@@ -57350,15 +57355,15 @@ function contentBetween(doc2, from, to) {
|
|
|
57350
57355
|
}
|
|
57351
57356
|
return false;
|
|
57352
57357
|
}
|
|
57353
|
-
function addMark(tr,
|
|
57358
|
+
function addMark(tr, from2, to, mark) {
|
|
57354
57359
|
let removed = [], added = [];
|
|
57355
57360
|
let removing, adding;
|
|
57356
|
-
tr.doc.nodesBetween(
|
|
57361
|
+
tr.doc.nodesBetween(from2, to, (node, pos, parent) => {
|
|
57357
57362
|
if (!node.isInline)
|
|
57358
57363
|
return;
|
|
57359
57364
|
let marks = node.marks;
|
|
57360
57365
|
if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {
|
|
57361
|
-
let start = Math.max(pos,
|
|
57366
|
+
let start = Math.max(pos, from2), end = Math.min(pos + node.nodeSize, to);
|
|
57362
57367
|
let newSet = mark.addToSet(marks);
|
|
57363
57368
|
for (let i = 0; i < marks.length; i++) {
|
|
57364
57369
|
if (!marks[i].isInSet(newSet)) {
|
|
@@ -57377,9 +57382,9 @@ function addMark(tr, from, to, mark) {
|
|
|
57377
57382
|
removed.forEach((s) => tr.step(s));
|
|
57378
57383
|
added.forEach((s) => tr.step(s));
|
|
57379
57384
|
}
|
|
57380
|
-
function removeMark(tr,
|
|
57385
|
+
function removeMark(tr, from2, to, mark) {
|
|
57381
57386
|
let matched = [], step = 0;
|
|
57382
|
-
tr.doc.nodesBetween(
|
|
57387
|
+
tr.doc.nodesBetween(from2, to, (node, pos) => {
|
|
57383
57388
|
if (!node.isInline)
|
|
57384
57389
|
return;
|
|
57385
57390
|
step++;
|
|
@@ -57409,7 +57414,7 @@ function removeMark(tr, from, to, mark) {
|
|
|
57409
57414
|
found2.to = end;
|
|
57410
57415
|
found2.step = step;
|
|
57411
57416
|
} else {
|
|
57412
|
-
matched.push({ style: style2, from: Math.max(pos,
|
|
57417
|
+
matched.push({ style: style2, from: Math.max(pos, from2), to: end, step });
|
|
57413
57418
|
}
|
|
57414
57419
|
}
|
|
57415
57420
|
}
|
|
@@ -57430,11 +57435,11 @@ function clearIncompatible(tr, pos, parentType, match2 = parentType.contentMatch
|
|
|
57430
57435
|
if (!parentType.allowsMarkType(child.marks[j].type))
|
|
57431
57436
|
tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
|
|
57432
57437
|
if (clearNewlines && child.isText && parentType.whitespace != "pre") {
|
|
57433
|
-
let m, newline = /\r?\n|\r/g,
|
|
57438
|
+
let m, newline = /\r?\n|\r/g, slice2;
|
|
57434
57439
|
while (m = newline.exec(child.text)) {
|
|
57435
|
-
if (!
|
|
57436
|
-
|
|
57437
|
-
replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length,
|
|
57440
|
+
if (!slice2)
|
|
57441
|
+
slice2 = new Slice(Fragment.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
|
|
57442
|
+
replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice2));
|
|
57438
57443
|
}
|
|
57439
57444
|
}
|
|
57440
57445
|
}
|
|
@@ -57484,11 +57489,11 @@ function wrap(tr, range2, wrappers) {
|
|
|
57484
57489
|
let start = range2.start, end = range2.end;
|
|
57485
57490
|
tr.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));
|
|
57486
57491
|
}
|
|
57487
|
-
function setBlockType(tr,
|
|
57492
|
+
function setBlockType(tr, from2, to, type2, attrs) {
|
|
57488
57493
|
if (!type2.isTextblock)
|
|
57489
57494
|
throw new RangeError("Type given to setBlockType should be a textblock");
|
|
57490
57495
|
let mapFrom = tr.steps.length;
|
|
57491
|
-
tr.doc.nodesBetween(
|
|
57496
|
+
tr.doc.nodesBetween(from2, to, (node, pos) => {
|
|
57492
57497
|
if (node.isTextblock && !node.hasMarkup(type2, attrs) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type2)) {
|
|
57493
57498
|
let convertNewlines = null;
|
|
57494
57499
|
if (type2.schema.linebreakReplacement) {
|
|
@@ -57581,14 +57586,14 @@ function insertPoint(doc2, pos, nodeType) {
|
|
|
57581
57586
|
}
|
|
57582
57587
|
return null;
|
|
57583
57588
|
}
|
|
57584
|
-
function dropPoint(doc2, pos,
|
|
57589
|
+
function dropPoint(doc2, pos, slice2) {
|
|
57585
57590
|
let $pos = doc2.resolve(pos);
|
|
57586
|
-
if (!
|
|
57591
|
+
if (!slice2.content.size)
|
|
57587
57592
|
return pos;
|
|
57588
|
-
let content =
|
|
57589
|
-
for (let i = 0; i <
|
|
57593
|
+
let content = slice2.content;
|
|
57594
|
+
for (let i = 0; i < slice2.openStart; i++)
|
|
57590
57595
|
content = content.firstChild.content;
|
|
57591
|
-
for (let pass = 1; pass <= (
|
|
57596
|
+
for (let pass = 1; pass <= (slice2.openStart == 0 && slice2.size ? 2 : 1); pass++) {
|
|
57592
57597
|
for (let d = $pos.depth; d >= 0; d--) {
|
|
57593
57598
|
let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;
|
|
57594
57599
|
let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);
|
|
@@ -57605,16 +57610,16 @@ function dropPoint(doc2, pos, slice) {
|
|
|
57605
57610
|
}
|
|
57606
57611
|
return null;
|
|
57607
57612
|
}
|
|
57608
|
-
function replaceStep(doc2,
|
|
57609
|
-
if (
|
|
57613
|
+
function replaceStep(doc2, from2, to = from2, slice2 = Slice.empty) {
|
|
57614
|
+
if (from2 == to && !slice2.size)
|
|
57610
57615
|
return null;
|
|
57611
|
-
let $from = doc2.resolve(
|
|
57612
|
-
if (fitsTrivially($from, $to,
|
|
57613
|
-
return new ReplaceStep(
|
|
57614
|
-
return new Fitter($from, $to,
|
|
57616
|
+
let $from = doc2.resolve(from2), $to = doc2.resolve(to);
|
|
57617
|
+
if (fitsTrivially($from, $to, slice2))
|
|
57618
|
+
return new ReplaceStep(from2, to, slice2);
|
|
57619
|
+
return new Fitter($from, $to, slice2).fit();
|
|
57615
57620
|
}
|
|
57616
|
-
function fitsTrivially($from, $to,
|
|
57617
|
-
return !
|
|
57621
|
+
function fitsTrivially($from, $to, slice2) {
|
|
57622
|
+
return !slice2.openStart && !slice2.openEnd && $from.start() == $to.start() && $from.parent.canReplace($from.index(), $to.index(), slice2.content);
|
|
57618
57623
|
}
|
|
57619
57624
|
class Fitter {
|
|
57620
57625
|
constructor($from, $to, unplaced) {
|
|
@@ -57654,11 +57659,11 @@ class Fitter {
|
|
|
57654
57659
|
openStart--;
|
|
57655
57660
|
openEnd--;
|
|
57656
57661
|
}
|
|
57657
|
-
let
|
|
57662
|
+
let slice2 = new Slice(content, openStart, openEnd);
|
|
57658
57663
|
if (moveInline > -1)
|
|
57659
|
-
return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(),
|
|
57660
|
-
if (
|
|
57661
|
-
return new ReplaceStep($from.pos, $to.pos,
|
|
57664
|
+
return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice2, placedSize);
|
|
57665
|
+
if (slice2.size || $from.pos != this.$to.pos)
|
|
57666
|
+
return new ReplaceStep($from.pos, $to.pos, slice2);
|
|
57662
57667
|
return null;
|
|
57663
57668
|
}
|
|
57664
57669
|
// Find a position on the start spine of `this.unplaced` that has
|
|
@@ -57725,8 +57730,8 @@ class Fitter {
|
|
|
57725
57730
|
if (wrap2)
|
|
57726
57731
|
for (let i = 0; i < wrap2.length; i++)
|
|
57727
57732
|
this.openFrontierNode(wrap2[i]);
|
|
57728
|
-
let
|
|
57729
|
-
let openStart =
|
|
57733
|
+
let slice2 = this.unplaced, fragment = parent ? parent.content : slice2.content;
|
|
57734
|
+
let openStart = slice2.openStart - sliceDepth;
|
|
57730
57735
|
let taken = 0, add2 = [];
|
|
57731
57736
|
let { match: match2, type: type2 } = this.frontier[frontierDepth];
|
|
57732
57737
|
if (inject2) {
|
|
@@ -57734,7 +57739,7 @@ class Fitter {
|
|
|
57734
57739
|
add2.push(inject2.child(i));
|
|
57735
57740
|
match2 = match2.matchFragment(inject2);
|
|
57736
57741
|
}
|
|
57737
|
-
let openEndCount = fragment.size + sliceDepth - (
|
|
57742
|
+
let openEndCount = fragment.size + sliceDepth - (slice2.content.size - slice2.openEnd);
|
|
57738
57743
|
while (taken < fragment.childCount) {
|
|
57739
57744
|
let next = fragment.child(taken), matches2 = match2.matchType(next.type);
|
|
57740
57745
|
if (!matches2)
|
|
@@ -57757,7 +57762,7 @@ class Fitter {
|
|
|
57757
57762
|
this.frontier.push({ type: node.type, match: node.contentMatchAt(node.childCount) });
|
|
57758
57763
|
cur = node.content;
|
|
57759
57764
|
}
|
|
57760
|
-
this.unplaced = !toEnd ? new Slice(dropFromFragment(
|
|
57765
|
+
this.unplaced = !toEnd ? new Slice(dropFromFragment(slice2.content, sliceDepth, taken), slice2.openStart, slice2.openEnd) : sliceDepth == 0 ? Slice.empty : new Slice(dropFromFragment(slice2.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice2.openEnd : sliceDepth - 1);
|
|
57761
57766
|
}
|
|
57762
57767
|
mustMoveInline() {
|
|
57763
57768
|
if (!this.$to.parent.isTextblock)
|
|
@@ -57858,12 +57863,12 @@ function invalidMarks(type2, fragment, start) {
|
|
|
57858
57863
|
function definesContent(type2) {
|
|
57859
57864
|
return type2.spec.defining || type2.spec.definingForContent;
|
|
57860
57865
|
}
|
|
57861
|
-
function replaceRange(tr,
|
|
57862
|
-
if (!
|
|
57863
|
-
return tr.deleteRange(
|
|
57864
|
-
let $from = tr.doc.resolve(
|
|
57865
|
-
if (fitsTrivially($from, $to,
|
|
57866
|
-
return tr.step(new ReplaceStep(
|
|
57866
|
+
function replaceRange(tr, from2, to, slice2) {
|
|
57867
|
+
if (!slice2.size)
|
|
57868
|
+
return tr.deleteRange(from2, to);
|
|
57869
|
+
let $from = tr.doc.resolve(from2), $to = tr.doc.resolve(to);
|
|
57870
|
+
if (fitsTrivially($from, $to, slice2))
|
|
57871
|
+
return tr.step(new ReplaceStep(from2, to, slice2));
|
|
57867
57872
|
let targetDepths = coveredDepths($from, tr.doc.resolve(to));
|
|
57868
57873
|
if (targetDepths[targetDepths.length - 1] == 0)
|
|
57869
57874
|
targetDepths.pop();
|
|
@@ -57879,11 +57884,11 @@ function replaceRange(tr, from, to, slice) {
|
|
|
57879
57884
|
targetDepths.splice(1, 0, -d);
|
|
57880
57885
|
}
|
|
57881
57886
|
let preferredTargetIndex = targetDepths.indexOf(preferredTarget);
|
|
57882
|
-
let leftNodes = [], preferredDepth =
|
|
57883
|
-
for (let content =
|
|
57887
|
+
let leftNodes = [], preferredDepth = slice2.openStart;
|
|
57888
|
+
for (let content = slice2.content, i = 0; ; i++) {
|
|
57884
57889
|
let node = content.firstChild;
|
|
57885
57890
|
leftNodes.push(node);
|
|
57886
|
-
if (i ==
|
|
57891
|
+
if (i == slice2.openStart)
|
|
57887
57892
|
break;
|
|
57888
57893
|
content = node.content;
|
|
57889
57894
|
}
|
|
@@ -57894,8 +57899,8 @@ function replaceRange(tr, from, to, slice) {
|
|
|
57894
57899
|
else if (def2 || !leftNode.type.isTextblock)
|
|
57895
57900
|
break;
|
|
57896
57901
|
}
|
|
57897
|
-
for (let j =
|
|
57898
|
-
let openDepth = (j + preferredDepth + 1) % (
|
|
57902
|
+
for (let j = slice2.openStart; j >= 0; j--) {
|
|
57903
|
+
let openDepth = (j + preferredDepth + 1) % (slice2.openStart + 1);
|
|
57899
57904
|
let insert = leftNodes[openDepth];
|
|
57900
57905
|
if (!insert)
|
|
57901
57906
|
continue;
|
|
@@ -57907,18 +57912,18 @@ function replaceRange(tr, from, to, slice) {
|
|
|
57907
57912
|
}
|
|
57908
57913
|
let parent = $from.node(targetDepth - 1), index = $from.index(targetDepth - 1);
|
|
57909
57914
|
if (parent.canReplaceWith(index, index, insert.type, insert.marks))
|
|
57910
|
-
return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice(closeFragment(
|
|
57915
|
+
return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice(closeFragment(slice2.content, 0, slice2.openStart, openDepth), openDepth, slice2.openEnd));
|
|
57911
57916
|
}
|
|
57912
57917
|
}
|
|
57913
57918
|
let startSteps = tr.steps.length;
|
|
57914
57919
|
for (let i = targetDepths.length - 1; i >= 0; i--) {
|
|
57915
|
-
tr.replace(
|
|
57920
|
+
tr.replace(from2, to, slice2);
|
|
57916
57921
|
if (tr.steps.length > startSteps)
|
|
57917
57922
|
break;
|
|
57918
57923
|
let depth = targetDepths[i];
|
|
57919
57924
|
if (depth < 0)
|
|
57920
57925
|
continue;
|
|
57921
|
-
|
|
57926
|
+
from2 = $from.before(depth);
|
|
57922
57927
|
to = $to.after(depth);
|
|
57923
57928
|
}
|
|
57924
57929
|
}
|
|
@@ -57934,16 +57939,16 @@ function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
|
|
|
57934
57939
|
}
|
|
57935
57940
|
return fragment;
|
|
57936
57941
|
}
|
|
57937
|
-
function replaceRangeWith(tr,
|
|
57938
|
-
if (!node.isInline &&
|
|
57939
|
-
let point = insertPoint(tr.doc,
|
|
57942
|
+
function replaceRangeWith(tr, from2, to, node) {
|
|
57943
|
+
if (!node.isInline && from2 == to && tr.doc.resolve(from2).parent.content.size) {
|
|
57944
|
+
let point = insertPoint(tr.doc, from2, node.type);
|
|
57940
57945
|
if (point != null)
|
|
57941
|
-
|
|
57946
|
+
from2 = to = point;
|
|
57942
57947
|
}
|
|
57943
|
-
tr.replaceRange(
|
|
57948
|
+
tr.replaceRange(from2, to, new Slice(Fragment.from(node), 0, 0));
|
|
57944
57949
|
}
|
|
57945
|
-
function deleteRange(tr,
|
|
57946
|
-
let $from = tr.doc.resolve(
|
|
57950
|
+
function deleteRange(tr, from2, to) {
|
|
57951
|
+
let $from = tr.doc.resolve(from2), $to = tr.doc.resolve(to);
|
|
57947
57952
|
let covered = coveredDepths($from, $to);
|
|
57948
57953
|
for (let i = 0; i < covered.length; i++) {
|
|
57949
57954
|
let depth = covered[i], last = i == covered.length - 1;
|
|
@@ -57953,10 +57958,10 @@ function deleteRange(tr, from, to) {
|
|
|
57953
57958
|
return tr.delete($from.before(depth), $to.after(depth));
|
|
57954
57959
|
}
|
|
57955
57960
|
for (let d = 1; d <= $from.depth && d <= $to.depth; d++) {
|
|
57956
|
-
if (
|
|
57961
|
+
if (from2 - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d)
|
|
57957
57962
|
return tr.delete($from.before(d), to);
|
|
57958
57963
|
}
|
|
57959
|
-
tr.delete(
|
|
57964
|
+
tr.delete(from2, to);
|
|
57960
57965
|
}
|
|
57961
57966
|
function coveredDepths($from, $to) {
|
|
57962
57967
|
let result = [], minDepth = Math.min($from.depth, $to.depth);
|
|
@@ -58112,8 +58117,8 @@ class Transform {
|
|
|
58112
58117
|
Replace the part of the document between `from` and `to` with the
|
|
58113
58118
|
given `slice`.
|
|
58114
58119
|
*/
|
|
58115
|
-
replace(
|
|
58116
|
-
let step = replaceStep(this.doc,
|
|
58120
|
+
replace(from2, to = from2, slice2 = Slice.empty) {
|
|
58121
|
+
let step = replaceStep(this.doc, from2, to, slice2);
|
|
58117
58122
|
if (step)
|
|
58118
58123
|
this.step(step);
|
|
58119
58124
|
return this;
|
|
@@ -58122,14 +58127,14 @@ class Transform {
|
|
|
58122
58127
|
Replace the given range with the given content, which may be a
|
|
58123
58128
|
fragment, node, or array of nodes.
|
|
58124
58129
|
*/
|
|
58125
|
-
replaceWith(
|
|
58126
|
-
return this.replace(
|
|
58130
|
+
replaceWith(from2, to, content) {
|
|
58131
|
+
return this.replace(from2, to, new Slice(Fragment.from(content), 0, 0));
|
|
58127
58132
|
}
|
|
58128
58133
|
/**
|
|
58129
58134
|
Delete the content between the given positions.
|
|
58130
58135
|
*/
|
|
58131
|
-
delete(
|
|
58132
|
-
return this.replace(
|
|
58136
|
+
delete(from2, to) {
|
|
58137
|
+
return this.replace(from2, to, Slice.empty);
|
|
58133
58138
|
}
|
|
58134
58139
|
/**
|
|
58135
58140
|
Insert the given content at the given position.
|
|
@@ -58156,8 +58161,8 @@ class Transform {
|
|
|
58156
58161
|
range, and is useful in situations where you need more precise
|
|
58157
58162
|
control over what happens.
|
|
58158
58163
|
*/
|
|
58159
|
-
replaceRange(
|
|
58160
|
-
replaceRange(this,
|
|
58164
|
+
replaceRange(from2, to, slice2) {
|
|
58165
|
+
replaceRange(this, from2, to, slice2);
|
|
58161
58166
|
return this;
|
|
58162
58167
|
}
|
|
58163
58168
|
/**
|
|
@@ -58169,16 +58174,16 @@ class Transform {
|
|
|
58169
58174
|
completely covers a parent node, this method may completely replace
|
|
58170
58175
|
that parent node.
|
|
58171
58176
|
*/
|
|
58172
|
-
replaceRangeWith(
|
|
58173
|
-
replaceRangeWith(this,
|
|
58177
|
+
replaceRangeWith(from2, to, node) {
|
|
58178
|
+
replaceRangeWith(this, from2, to, node);
|
|
58174
58179
|
return this;
|
|
58175
58180
|
}
|
|
58176
58181
|
/**
|
|
58177
58182
|
Delete the given range, expanding it to cover fully covered
|
|
58178
58183
|
parent nodes until a valid replace is found.
|
|
58179
58184
|
*/
|
|
58180
|
-
deleteRange(
|
|
58181
|
-
deleteRange(this,
|
|
58185
|
+
deleteRange(from2, to) {
|
|
58186
|
+
deleteRange(this, from2, to);
|
|
58182
58187
|
return this;
|
|
58183
58188
|
}
|
|
58184
58189
|
/**
|
|
@@ -58213,8 +58218,8 @@ class Transform {
|
|
|
58213
58218
|
Set the type of all textblocks (partly) between `from` and `to` to
|
|
58214
58219
|
the given node type with the given attributes.
|
|
58215
58220
|
*/
|
|
58216
|
-
setBlockType(
|
|
58217
|
-
setBlockType(this,
|
|
58221
|
+
setBlockType(from2, to = from2, type2, attrs = null) {
|
|
58222
|
+
setBlockType(this, from2, to, type2, attrs);
|
|
58218
58223
|
return this;
|
|
58219
58224
|
}
|
|
58220
58225
|
/**
|
|
@@ -58278,8 +58283,8 @@ class Transform {
|
|
|
58278
58283
|
/**
|
|
58279
58284
|
Add the given mark to the inline content between `from` and `to`.
|
|
58280
58285
|
*/
|
|
58281
|
-
addMark(
|
|
58282
|
-
addMark(this,
|
|
58286
|
+
addMark(from2, to, mark) {
|
|
58287
|
+
addMark(this, from2, to, mark);
|
|
58283
58288
|
return this;
|
|
58284
58289
|
}
|
|
58285
58290
|
/**
|
|
@@ -58288,8 +58293,8 @@ class Transform {
|
|
|
58288
58293
|
a mark type, remove all marks of that type. When it is null,
|
|
58289
58294
|
remove all marks of any type.
|
|
58290
58295
|
*/
|
|
58291
|
-
removeMark(
|
|
58292
|
-
removeMark(this,
|
|
58296
|
+
removeMark(from2, to, mark) {
|
|
58297
|
+
removeMark(this, from2, to, mark);
|
|
58293
58298
|
return this;
|
|
58294
58299
|
}
|
|
58295
58300
|
/**
|
|
@@ -58393,11 +58398,11 @@ class Selection {
|
|
|
58393
58398
|
let mapFrom = tr.steps.length, ranges = this.ranges;
|
|
58394
58399
|
for (let i = 0; i < ranges.length; i++) {
|
|
58395
58400
|
let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
|
|
58396
|
-
let
|
|
58401
|
+
let from2 = mapping.map($from.pos), to = mapping.map($to.pos);
|
|
58397
58402
|
if (i) {
|
|
58398
|
-
tr.deleteRange(
|
|
58403
|
+
tr.deleteRange(from2, to);
|
|
58399
58404
|
} else {
|
|
58400
|
-
tr.replaceRangeWith(
|
|
58405
|
+
tr.replaceRangeWith(from2, to, node);
|
|
58401
58406
|
selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);
|
|
58402
58407
|
}
|
|
58403
58408
|
}
|
|
@@ -58639,8 +58644,8 @@ class NodeSelection extends Selection {
|
|
|
58639
58644
|
/**
|
|
58640
58645
|
Create a node selection from non-resolved positions.
|
|
58641
58646
|
*/
|
|
58642
|
-
static create(doc2,
|
|
58643
|
-
return new NodeSelection(doc2.resolve(
|
|
58647
|
+
static create(doc2, from2) {
|
|
58648
|
+
return new NodeSelection(doc2.resolve(from2));
|
|
58644
58649
|
}
|
|
58645
58650
|
/**
|
|
58646
58651
|
Determines whether the given node may be selected as a node
|
|
@@ -58735,8 +58740,8 @@ function selectionToInsertionEnd(tr, startLen, bias) {
|
|
|
58735
58740
|
let step = tr.steps[last];
|
|
58736
58741
|
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep))
|
|
58737
58742
|
return;
|
|
58738
|
-
let
|
|
58739
|
-
|
|
58743
|
+
let map22 = tr.mapping.maps[last], end;
|
|
58744
|
+
map22.forEach((_from, _to, _newFrom, newTo) => {
|
|
58740
58745
|
if (end == null)
|
|
58741
58746
|
end = newTo;
|
|
58742
58747
|
});
|
|
@@ -58842,8 +58847,8 @@ class Transaction extends Transform {
|
|
|
58842
58847
|
/**
|
|
58843
58848
|
Replace the current selection with the given slice.
|
|
58844
58849
|
*/
|
|
58845
|
-
replaceSelection(
|
|
58846
|
-
this.selection.replace(this,
|
|
58850
|
+
replaceSelection(slice2) {
|
|
58851
|
+
this.selection.replace(this, slice2);
|
|
58847
58852
|
return this;
|
|
58848
58853
|
}
|
|
58849
58854
|
/**
|
|
@@ -58869,24 +58874,24 @@ class Transaction extends Transform {
|
|
|
58869
58874
|
Replace the given range, or the selection if no range is given,
|
|
58870
58875
|
with a text node containing the given string.
|
|
58871
58876
|
*/
|
|
58872
|
-
insertText(text,
|
|
58877
|
+
insertText(text, from2, to) {
|
|
58873
58878
|
let schema = this.doc.type.schema;
|
|
58874
|
-
if (
|
|
58879
|
+
if (from2 == null) {
|
|
58875
58880
|
if (!text)
|
|
58876
58881
|
return this.deleteSelection();
|
|
58877
58882
|
return this.replaceSelectionWith(schema.text(text), true);
|
|
58878
58883
|
} else {
|
|
58879
58884
|
if (to == null)
|
|
58880
|
-
to =
|
|
58881
|
-
to = to == null ?
|
|
58885
|
+
to = from2;
|
|
58886
|
+
to = to == null ? from2 : to;
|
|
58882
58887
|
if (!text)
|
|
58883
|
-
return this.deleteRange(
|
|
58888
|
+
return this.deleteRange(from2, to);
|
|
58884
58889
|
let marks = this.storedMarks;
|
|
58885
58890
|
if (!marks) {
|
|
58886
|
-
let $from = this.doc.resolve(
|
|
58887
|
-
marks = to ==
|
|
58891
|
+
let $from = this.doc.resolve(from2);
|
|
58892
|
+
marks = to == from2 ? $from.marks() : $from.marksAcross(this.doc.resolve(to));
|
|
58888
58893
|
}
|
|
58889
|
-
this.replaceRangeWith(
|
|
58894
|
+
this.replaceRangeWith(from2, to, schema.text(text, marks));
|
|
58890
58895
|
if (!this.selection.empty)
|
|
58891
58896
|
this.setSelection(Selection.near(this.selection.$to));
|
|
58892
58897
|
return this;
|
|
@@ -59238,10 +59243,10 @@ const parentNode = function(node) {
|
|
|
59238
59243
|
return parent && parent.nodeType == 11 ? parent.host : parent;
|
|
59239
59244
|
};
|
|
59240
59245
|
let reusedRange = null;
|
|
59241
|
-
const textRange = function(node,
|
|
59246
|
+
const textRange = function(node, from2, to) {
|
|
59242
59247
|
let range2 = reusedRange || (reusedRange = document.createRange());
|
|
59243
59248
|
range2.setEnd(node, to == null ? node.nodeValue.length : to);
|
|
59244
|
-
range2.setStart(node,
|
|
59249
|
+
range2.setStart(node, from2 || 0);
|
|
59245
59250
|
return range2;
|
|
59246
59251
|
};
|
|
59247
59252
|
const clearReusedRange = function() {
|
|
@@ -59697,19 +59702,19 @@ function coordsAtPos(view, pos, side) {
|
|
|
59697
59702
|
}
|
|
59698
59703
|
return rect;
|
|
59699
59704
|
} else {
|
|
59700
|
-
let
|
|
59705
|
+
let from2 = offset, to = offset, takeSide = side < 0 ? 1 : -1;
|
|
59701
59706
|
if (side < 0 && !offset) {
|
|
59702
59707
|
to++;
|
|
59703
59708
|
takeSide = -1;
|
|
59704
59709
|
} else if (side >= 0 && offset == node.nodeValue.length) {
|
|
59705
|
-
|
|
59710
|
+
from2--;
|
|
59706
59711
|
takeSide = 1;
|
|
59707
59712
|
} else if (side < 0) {
|
|
59708
|
-
|
|
59713
|
+
from2--;
|
|
59709
59714
|
} else {
|
|
59710
59715
|
to++;
|
|
59711
59716
|
}
|
|
59712
|
-
return flattenV(singleRect(textRange(node,
|
|
59717
|
+
return flattenV(singleRect(textRange(node, from2, to), takeSide), takeSide < 0);
|
|
59713
59718
|
}
|
|
59714
59719
|
}
|
|
59715
59720
|
let $dom = view.state.doc.resolve(pos - (atom || 0));
|
|
@@ -60048,24 +60053,24 @@ class ViewDesc {
|
|
|
60048
60053
|
}
|
|
60049
60054
|
// Used to find a DOM range in a single parent for a given changed
|
|
60050
60055
|
// range.
|
|
60051
|
-
parseRange(
|
|
60056
|
+
parseRange(from2, to, base2 = 0) {
|
|
60052
60057
|
if (this.children.length == 0)
|
|
60053
|
-
return { node: this.contentDOM, from, to, fromOffset: 0, toOffset: this.contentDOM.childNodes.length };
|
|
60058
|
+
return { node: this.contentDOM, from: from2, to, fromOffset: 0, toOffset: this.contentDOM.childNodes.length };
|
|
60054
60059
|
let fromOffset = -1, toOffset = -1;
|
|
60055
60060
|
for (let offset = base2, i = 0; ; i++) {
|
|
60056
60061
|
let child = this.children[i], end = offset + child.size;
|
|
60057
|
-
if (fromOffset == -1 &&
|
|
60062
|
+
if (fromOffset == -1 && from2 <= end) {
|
|
60058
60063
|
let childBase = offset + child.border;
|
|
60059
|
-
if (
|
|
60060
|
-
return child.parseRange(
|
|
60061
|
-
|
|
60064
|
+
if (from2 >= childBase && to <= end - child.border && child.node && child.contentDOM && this.contentDOM.contains(child.contentDOM))
|
|
60065
|
+
return child.parseRange(from2, to, childBase);
|
|
60066
|
+
from2 = offset;
|
|
60062
60067
|
for (let j = i; j > 0; j--) {
|
|
60063
60068
|
let prev = this.children[j - 1];
|
|
60064
60069
|
if (prev.size && prev.dom.parentNode == this.contentDOM && !prev.emptyChildAt(1)) {
|
|
60065
60070
|
fromOffset = domIndex(prev.dom) + 1;
|
|
60066
60071
|
break;
|
|
60067
60072
|
}
|
|
60068
|
-
|
|
60073
|
+
from2 -= prev.size;
|
|
60069
60074
|
}
|
|
60070
60075
|
if (fromOffset == -1)
|
|
60071
60076
|
fromOffset = 0;
|
|
@@ -60086,7 +60091,7 @@ class ViewDesc {
|
|
|
60086
60091
|
}
|
|
60087
60092
|
offset = end;
|
|
60088
60093
|
}
|
|
60089
|
-
return { node: this.contentDOM, from, to, fromOffset, toOffset };
|
|
60094
|
+
return { node: this.contentDOM, from: from2, to, fromOffset, toOffset };
|
|
60090
60095
|
}
|
|
60091
60096
|
emptyChildAt(side) {
|
|
60092
60097
|
if (this.border || !this.contentDOM || !this.children.length)
|
|
@@ -60106,10 +60111,10 @@ class ViewDesc {
|
|
|
60106
60111
|
// a selection starts in such a node and ends in another, in which
|
|
60107
60112
|
// case we just use whatever domFromPos produces as a best effort.
|
|
60108
60113
|
setSelection(anchor, head, root2, force = false) {
|
|
60109
|
-
let
|
|
60114
|
+
let from2 = Math.min(anchor, head), to = Math.max(anchor, head);
|
|
60110
60115
|
for (let i = 0, offset = 0; i < this.children.length; i++) {
|
|
60111
60116
|
let child = this.children[i], end = offset + child.size;
|
|
60112
|
-
if (
|
|
60117
|
+
if (from2 > offset && to < end)
|
|
60113
60118
|
return child.setSelection(anchor - offset - child.border, head - offset - child.border, root2, force);
|
|
60114
60119
|
offset = end;
|
|
60115
60120
|
}
|
|
@@ -60176,17 +60181,17 @@ class ViewDesc {
|
|
|
60176
60181
|
}
|
|
60177
60182
|
// Remove a subtree of the element tree that has been touched
|
|
60178
60183
|
// by a DOM change, so that the next update will redraw it.
|
|
60179
|
-
markDirty(
|
|
60184
|
+
markDirty(from2, to) {
|
|
60180
60185
|
for (let offset = 0, i = 0; i < this.children.length; i++) {
|
|
60181
60186
|
let child = this.children[i], end = offset + child.size;
|
|
60182
|
-
if (offset == end ?
|
|
60187
|
+
if (offset == end ? from2 <= end && to >= offset : from2 < end && to > offset) {
|
|
60183
60188
|
let startInside = offset + child.border, endInside = end - child.border;
|
|
60184
|
-
if (
|
|
60185
|
-
this.dirty =
|
|
60186
|
-
if (
|
|
60189
|
+
if (from2 >= startInside && to <= endInside) {
|
|
60190
|
+
this.dirty = from2 == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY;
|
|
60191
|
+
if (from2 == startInside && to == endInside && (child.contentLost || child.dom.parentNode != this.contentDOM))
|
|
60187
60192
|
child.dirty = NODE_DIRTY;
|
|
60188
60193
|
else
|
|
60189
|
-
child.markDirty(
|
|
60194
|
+
child.markDirty(from2 - startInside, to - startInside);
|
|
60190
60195
|
return;
|
|
60191
60196
|
} else {
|
|
60192
60197
|
child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length ? CONTENT_DIRTY : NODE_DIRTY;
|
|
@@ -60303,8 +60308,8 @@ class MarkViewDesc extends ViewDesc {
|
|
|
60303
60308
|
matchesMark(mark) {
|
|
60304
60309
|
return this.dirty != NODE_DIRTY && this.mark.eq(mark);
|
|
60305
60310
|
}
|
|
60306
|
-
markDirty(
|
|
60307
|
-
super.markDirty(
|
|
60311
|
+
markDirty(from2, to) {
|
|
60312
|
+
super.markDirty(from2, to);
|
|
60308
60313
|
if (this.dirty != NOT_DIRTY) {
|
|
60309
60314
|
let parent = this.parent;
|
|
60310
60315
|
while (!parent.node)
|
|
@@ -60314,13 +60319,13 @@ class MarkViewDesc extends ViewDesc {
|
|
|
60314
60319
|
this.dirty = NOT_DIRTY;
|
|
60315
60320
|
}
|
|
60316
60321
|
}
|
|
60317
|
-
slice(
|
|
60322
|
+
slice(from2, to, view) {
|
|
60318
60323
|
let copy2 = MarkViewDesc.create(this.parent, this.mark, true, view);
|
|
60319
60324
|
let nodes = this.children, size2 = this.size;
|
|
60320
60325
|
if (to < size2)
|
|
60321
60326
|
nodes = replaceNodes(nodes, to, size2, view);
|
|
60322
|
-
if (
|
|
60323
|
-
nodes = replaceNodes(nodes, 0,
|
|
60327
|
+
if (from2 > 0)
|
|
60328
|
+
nodes = replaceNodes(nodes, 0, from2, view);
|
|
60324
60329
|
for (let i = 0; i < nodes.length; i++)
|
|
60325
60330
|
nodes[i].parent = copy2;
|
|
60326
60331
|
copy2.children = nodes;
|
|
@@ -60448,15 +60453,15 @@ class NodeViewDesc extends ViewDesc {
|
|
|
60448
60453
|
}
|
|
60449
60454
|
}
|
|
60450
60455
|
localCompositionInfo(view, pos) {
|
|
60451
|
-
let { from, to } = view.state.selection;
|
|
60452
|
-
if (!(view.state.selection instanceof TextSelection) ||
|
|
60456
|
+
let { from: from2, to } = view.state.selection;
|
|
60457
|
+
if (!(view.state.selection instanceof TextSelection) || from2 < pos || to > pos + this.node.content.size)
|
|
60453
60458
|
return null;
|
|
60454
60459
|
let textNode = view.input.compositionNode;
|
|
60455
60460
|
if (!textNode || !this.dom.contains(textNode.parentNode))
|
|
60456
60461
|
return null;
|
|
60457
60462
|
if (this.node.inlineContent) {
|
|
60458
60463
|
let text = textNode.nodeValue;
|
|
60459
|
-
let textPos = findTextInFragment(this.node.content, text,
|
|
60464
|
+
let textPos = findTextInFragment(this.node.content, text, from2 - pos, to - pos);
|
|
60460
60465
|
return textPos < 0 ? null : { node: textNode, pos: textPos, text };
|
|
60461
60466
|
} else {
|
|
60462
60467
|
return { node: textNode, pos: -1, text: "" };
|
|
@@ -60575,13 +60580,13 @@ class TextViewDesc extends NodeViewDesc {
|
|
|
60575
60580
|
ignoreMutation(mutation) {
|
|
60576
60581
|
return mutation.type != "characterData" && mutation.type != "selection";
|
|
60577
60582
|
}
|
|
60578
|
-
slice(
|
|
60579
|
-
let node = this.node.cut(
|
|
60583
|
+
slice(from2, to, view) {
|
|
60584
|
+
let node = this.node.cut(from2, to), dom = document.createTextNode(node.text);
|
|
60580
60585
|
return new TextViewDesc(this.parent, node, this.outerDeco, this.innerDeco, dom, dom, view);
|
|
60581
60586
|
}
|
|
60582
|
-
markDirty(
|
|
60583
|
-
super.markDirty(
|
|
60584
|
-
if (this.dom != this.nodeDOM && (
|
|
60587
|
+
markDirty(from2, to) {
|
|
60588
|
+
super.markDirty(from2, to);
|
|
60589
|
+
if (this.dom != this.nodeDOM && (from2 == 0 || to == this.nodeDOM.nodeValue.length))
|
|
60585
60590
|
this.dirty = NODE_DIRTY;
|
|
60586
60591
|
}
|
|
60587
60592
|
get domAtom() {
|
|
@@ -61105,7 +61110,7 @@ function iosHacks(dom) {
|
|
|
61105
61110
|
dom.style.cssText = oldCSS;
|
|
61106
61111
|
}
|
|
61107
61112
|
}
|
|
61108
|
-
function findTextInFragment(frag, text,
|
|
61113
|
+
function findTextInFragment(frag, text, from2, to) {
|
|
61109
61114
|
for (let i = 0, pos = 0; i < frag.childCount && pos <= to; ) {
|
|
61110
61115
|
let child = frag.child(i++), childStart = pos;
|
|
61111
61116
|
pos += child.nodeSize;
|
|
@@ -61119,27 +61124,27 @@ function findTextInFragment(frag, text, from, to) {
|
|
|
61119
61124
|
break;
|
|
61120
61125
|
str += next.text;
|
|
61121
61126
|
}
|
|
61122
|
-
if (pos >=
|
|
61127
|
+
if (pos >= from2) {
|
|
61123
61128
|
if (pos >= to && str.slice(to - text.length - childStart, to - childStart) == text)
|
|
61124
61129
|
return to - text.length;
|
|
61125
61130
|
let found2 = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1;
|
|
61126
|
-
if (found2 >= 0 && found2 + text.length + childStart >=
|
|
61131
|
+
if (found2 >= 0 && found2 + text.length + childStart >= from2)
|
|
61127
61132
|
return childStart + found2;
|
|
61128
|
-
if (
|
|
61133
|
+
if (from2 == to && str.length >= to + text.length - childStart && str.slice(to - childStart, to - childStart + text.length) == text)
|
|
61129
61134
|
return to;
|
|
61130
61135
|
}
|
|
61131
61136
|
}
|
|
61132
61137
|
return -1;
|
|
61133
61138
|
}
|
|
61134
|
-
function replaceNodes(nodes,
|
|
61139
|
+
function replaceNodes(nodes, from2, to, view, replacement) {
|
|
61135
61140
|
let result = [];
|
|
61136
61141
|
for (let i = 0, off2 = 0; i < nodes.length; i++) {
|
|
61137
61142
|
let child = nodes[i], start = off2, end = off2 += child.size;
|
|
61138
|
-
if (start >= to || end <=
|
|
61143
|
+
if (start >= to || end <= from2) {
|
|
61139
61144
|
result.push(child);
|
|
61140
61145
|
} else {
|
|
61141
|
-
if (start <
|
|
61142
|
-
result.push(child.slice(0,
|
|
61146
|
+
if (start < from2)
|
|
61147
|
+
result.push(child.slice(0, from2 - start, view));
|
|
61143
61148
|
if (replacement) {
|
|
61144
61149
|
result.push(replacement);
|
|
61145
61150
|
replacement = void 0;
|
|
@@ -61650,11 +61655,11 @@ function captureKeyDown(view, event) {
|
|
|
61650
61655
|
}
|
|
61651
61656
|
return false;
|
|
61652
61657
|
}
|
|
61653
|
-
function serializeForClipboard(view,
|
|
61658
|
+
function serializeForClipboard(view, slice2) {
|
|
61654
61659
|
view.someProp("transformCopied", (f) => {
|
|
61655
|
-
|
|
61660
|
+
slice2 = f(slice2, view);
|
|
61656
61661
|
});
|
|
61657
|
-
let context = [], { content, openStart, openEnd } =
|
|
61662
|
+
let context = [], { content, openStart, openEnd } = slice2;
|
|
61658
61663
|
while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {
|
|
61659
61664
|
openStart--;
|
|
61660
61665
|
openEnd--;
|
|
@@ -61678,12 +61683,12 @@ function serializeForClipboard(view, slice) {
|
|
|
61678
61683
|
}
|
|
61679
61684
|
if (firstChild && firstChild.nodeType == 1)
|
|
61680
61685
|
firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
|
|
61681
|
-
let text = view.someProp("clipboardTextSerializer", (f) => f(
|
|
61682
|
-
return { dom: wrap2, text, slice };
|
|
61686
|
+
let text = view.someProp("clipboardTextSerializer", (f) => f(slice2, view)) || slice2.content.textBetween(0, slice2.content.size, "\n\n");
|
|
61687
|
+
return { dom: wrap2, text, slice: slice2 };
|
|
61683
61688
|
}
|
|
61684
61689
|
function parseFromClipboard(view, text, html, plainText, $context) {
|
|
61685
61690
|
let inCode = $context.parent.type.spec.code;
|
|
61686
|
-
let dom,
|
|
61691
|
+
let dom, slice2;
|
|
61687
61692
|
if (!html && !text)
|
|
61688
61693
|
return null;
|
|
61689
61694
|
let asText = text && (plainText || inCode || !html);
|
|
@@ -61695,7 +61700,7 @@ function parseFromClipboard(view, text, html, plainText, $context) {
|
|
|
61695
61700
|
return text ? new Slice(Fragment.from(view.state.schema.text(text.replace(/\r\n?/g, "\n"))), 0, 0) : Slice.empty;
|
|
61696
61701
|
let parsed = view.someProp("clipboardTextParser", (f) => f(text, $context, plainText, view));
|
|
61697
61702
|
if (parsed) {
|
|
61698
|
-
|
|
61703
|
+
slice2 = parsed;
|
|
61699
61704
|
} else {
|
|
61700
61705
|
let marks = $context.marks();
|
|
61701
61706
|
let { schema } = view.state, serializer = DOMSerializer.fromSchema(schema);
|
|
@@ -61725,9 +61730,9 @@ function parseFromClipboard(view, text, html, plainText, $context) {
|
|
|
61725
61730
|
break;
|
|
61726
61731
|
dom = child;
|
|
61727
61732
|
}
|
|
61728
|
-
if (!
|
|
61733
|
+
if (!slice2) {
|
|
61729
61734
|
let parser = view.someProp("clipboardParser") || view.someProp("domParser") || DOMParser.fromSchema(view.state.schema);
|
|
61730
|
-
|
|
61735
|
+
slice2 = parser.parseSlice(dom, {
|
|
61731
61736
|
preserveWhitespace: !!(asText || sliceData),
|
|
61732
61737
|
context: $context,
|
|
61733
61738
|
ruleFromNode(dom2) {
|
|
@@ -61738,22 +61743,22 @@ function parseFromClipboard(view, text, html, plainText, $context) {
|
|
|
61738
61743
|
});
|
|
61739
61744
|
}
|
|
61740
61745
|
if (sliceData) {
|
|
61741
|
-
|
|
61746
|
+
slice2 = addContext(closeSlice(slice2, +sliceData[1], +sliceData[2]), sliceData[4]);
|
|
61742
61747
|
} else {
|
|
61743
|
-
|
|
61744
|
-
if (
|
|
61748
|
+
slice2 = Slice.maxOpen(normalizeSiblings(slice2.content, $context), true);
|
|
61749
|
+
if (slice2.openStart || slice2.openEnd) {
|
|
61745
61750
|
let openStart = 0, openEnd = 0;
|
|
61746
|
-
for (let node =
|
|
61751
|
+
for (let node = slice2.content.firstChild; openStart < slice2.openStart && !node.type.spec.isolating; openStart++, node = node.firstChild) {
|
|
61747
61752
|
}
|
|
61748
|
-
for (let node =
|
|
61753
|
+
for (let node = slice2.content.lastChild; openEnd < slice2.openEnd && !node.type.spec.isolating; openEnd++, node = node.lastChild) {
|
|
61749
61754
|
}
|
|
61750
|
-
|
|
61755
|
+
slice2 = closeSlice(slice2, openStart, openEnd);
|
|
61751
61756
|
}
|
|
61752
61757
|
}
|
|
61753
61758
|
view.someProp("transformPasted", (f) => {
|
|
61754
|
-
|
|
61759
|
+
slice2 = f(slice2, view);
|
|
61755
61760
|
});
|
|
61756
|
-
return
|
|
61761
|
+
return slice2;
|
|
61757
61762
|
}
|
|
61758
61763
|
const inlineParents = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
|
|
61759
61764
|
function normalizeSiblings(fragment, $context) {
|
|
@@ -61785,8 +61790,8 @@ function normalizeSiblings(fragment, $context) {
|
|
|
61785
61790
|
}
|
|
61786
61791
|
return fragment;
|
|
61787
61792
|
}
|
|
61788
|
-
function withWrappers(node, wrap2,
|
|
61789
|
-
for (let i = wrap2.length - 1; i >=
|
|
61793
|
+
function withWrappers(node, wrap2, from2 = 0) {
|
|
61794
|
+
for (let i = wrap2.length - 1; i >= from2; i--)
|
|
61790
61795
|
node = wrap2[i].create(null, Fragment.from(node));
|
|
61791
61796
|
return node;
|
|
61792
61797
|
}
|
|
@@ -61807,22 +61812,22 @@ function closeRight(node, depth) {
|
|
|
61807
61812
|
let fill = node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true);
|
|
61808
61813
|
return node.copy(fragment.append(fill));
|
|
61809
61814
|
}
|
|
61810
|
-
function closeRange(fragment, side,
|
|
61815
|
+
function closeRange(fragment, side, from2, to, depth, openEnd) {
|
|
61811
61816
|
let node = side < 0 ? fragment.firstChild : fragment.lastChild, inner = node.content;
|
|
61812
61817
|
if (fragment.childCount > 1)
|
|
61813
61818
|
openEnd = 0;
|
|
61814
61819
|
if (depth < to - 1)
|
|
61815
|
-
inner = closeRange(inner, side,
|
|
61816
|
-
if (depth >=
|
|
61820
|
+
inner = closeRange(inner, side, from2, to, depth + 1, openEnd);
|
|
61821
|
+
if (depth >= from2)
|
|
61817
61822
|
inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner) : inner.append(node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true));
|
|
61818
61823
|
return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node.copy(inner));
|
|
61819
61824
|
}
|
|
61820
|
-
function closeSlice(
|
|
61821
|
-
if (openStart <
|
|
61822
|
-
|
|
61823
|
-
if (openEnd <
|
|
61824
|
-
|
|
61825
|
-
return
|
|
61825
|
+
function closeSlice(slice2, openStart, openEnd) {
|
|
61826
|
+
if (openStart < slice2.openStart)
|
|
61827
|
+
slice2 = new Slice(closeRange(slice2.content, -1, openStart, slice2.openStart, 0, slice2.openEnd), openStart, slice2.openEnd);
|
|
61828
|
+
if (openEnd < slice2.openEnd)
|
|
61829
|
+
slice2 = new Slice(closeRange(slice2.content, 1, openEnd, slice2.openEnd, 0, 0), slice2.openStart, openEnd);
|
|
61830
|
+
return slice2;
|
|
61826
61831
|
}
|
|
61827
61832
|
const wrapMap = {
|
|
61828
61833
|
thead: ["table"],
|
|
@@ -61861,16 +61866,16 @@ function restoreReplacedSpaces(dom) {
|
|
|
61861
61866
|
node.parentNode.replaceChild(dom.ownerDocument.createTextNode(" "), node);
|
|
61862
61867
|
}
|
|
61863
61868
|
}
|
|
61864
|
-
function addContext(
|
|
61865
|
-
if (!
|
|
61866
|
-
return
|
|
61867
|
-
let schema =
|
|
61869
|
+
function addContext(slice2, context) {
|
|
61870
|
+
if (!slice2.size)
|
|
61871
|
+
return slice2;
|
|
61872
|
+
let schema = slice2.content.firstChild.type.schema, array;
|
|
61868
61873
|
try {
|
|
61869
61874
|
array = JSON.parse(context);
|
|
61870
61875
|
} catch (e) {
|
|
61871
|
-
return
|
|
61876
|
+
return slice2;
|
|
61872
61877
|
}
|
|
61873
|
-
let { content, openStart, openEnd } =
|
|
61878
|
+
let { content, openStart, openEnd } = slice2;
|
|
61874
61879
|
for (let i = array.length - 2; i >= 0; i -= 2) {
|
|
61875
61880
|
let type2 = schema.nodes[array[i]];
|
|
61876
61881
|
if (!type2 || type2.hasRequiredAttrs())
|
|
@@ -62364,7 +62369,7 @@ handlers.copy = editHandlers.cut = (view, _event) => {
|
|
|
62364
62369
|
if (sel.empty)
|
|
62365
62370
|
return;
|
|
62366
62371
|
let data2 = brokenClipboardAPI ? null : event.clipboardData;
|
|
62367
|
-
let
|
|
62372
|
+
let slice2 = sel.content(), { dom, text } = serializeForClipboard(view, slice2);
|
|
62368
62373
|
if (data2) {
|
|
62369
62374
|
event.preventDefault();
|
|
62370
62375
|
data2.clearData();
|
|
@@ -62376,8 +62381,8 @@ handlers.copy = editHandlers.cut = (view, _event) => {
|
|
|
62376
62381
|
if (cut)
|
|
62377
62382
|
view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
|
|
62378
62383
|
};
|
|
62379
|
-
function sliceSingleNode(
|
|
62380
|
-
return
|
|
62384
|
+
function sliceSingleNode(slice2) {
|
|
62385
|
+
return slice2.openStart == 0 && slice2.openEnd == 0 && slice2.content.childCount == 1 ? slice2.content.firstChild : null;
|
|
62381
62386
|
}
|
|
62382
62387
|
function capturePaste(view, event) {
|
|
62383
62388
|
if (!view.dom.parentNode)
|
|
@@ -62400,13 +62405,13 @@ function capturePaste(view, event) {
|
|
|
62400
62405
|
}, 50);
|
|
62401
62406
|
}
|
|
62402
62407
|
function doPaste(view, text, html, preferPlain, event) {
|
|
62403
|
-
let
|
|
62404
|
-
if (view.someProp("handlePaste", (f) => f(view, event,
|
|
62408
|
+
let slice2 = parseFromClipboard(view, text, html, preferPlain, view.state.selection.$from);
|
|
62409
|
+
if (view.someProp("handlePaste", (f) => f(view, event, slice2 || Slice.empty)))
|
|
62405
62410
|
return true;
|
|
62406
|
-
if (!
|
|
62411
|
+
if (!slice2)
|
|
62407
62412
|
return false;
|
|
62408
|
-
let singleNode = sliceSingleNode(
|
|
62409
|
-
let tr = singleNode ? view.state.tr.replaceSelectionWith(singleNode, preferPlain) : view.state.tr.replaceSelection(
|
|
62413
|
+
let singleNode = sliceSingleNode(slice2);
|
|
62414
|
+
let tr = singleNode ? view.state.tr.replaceSelectionWith(singleNode, preferPlain) : view.state.tr.replaceSelection(slice2);
|
|
62410
62415
|
view.dispatch(tr.scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste"));
|
|
62411
62416
|
return true;
|
|
62412
62417
|
}
|
|
@@ -62429,8 +62434,8 @@ editHandlers.paste = (view, _event) => {
|
|
|
62429
62434
|
capturePaste(view, event);
|
|
62430
62435
|
};
|
|
62431
62436
|
class Dragging {
|
|
62432
|
-
constructor(
|
|
62433
|
-
this.slice =
|
|
62437
|
+
constructor(slice2, move, node) {
|
|
62438
|
+
this.slice = slice2;
|
|
62434
62439
|
this.move = move;
|
|
62435
62440
|
this.node = node;
|
|
62436
62441
|
}
|
|
@@ -62455,13 +62460,13 @@ handlers.dragstart = (view, _event) => {
|
|
|
62455
62460
|
node = NodeSelection.create(view.state.doc, desc.posBefore);
|
|
62456
62461
|
}
|
|
62457
62462
|
let draggedSlice = (node || view.state.selection).content();
|
|
62458
|
-
let { dom, text, slice } = serializeForClipboard(view, draggedSlice);
|
|
62463
|
+
let { dom, text, slice: slice2 } = serializeForClipboard(view, draggedSlice);
|
|
62459
62464
|
event.dataTransfer.clearData();
|
|
62460
62465
|
event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
|
|
62461
62466
|
event.dataTransfer.effectAllowed = "copyMove";
|
|
62462
62467
|
if (!brokenClipboardAPI)
|
|
62463
62468
|
event.dataTransfer.setData("text/plain", text);
|
|
62464
|
-
view.dragging = new Dragging(
|
|
62469
|
+
view.dragging = new Dragging(slice2, !event[dragCopyModifier], node);
|
|
62465
62470
|
};
|
|
62466
62471
|
handlers.dragend = (view) => {
|
|
62467
62472
|
let dragging = view.dragging;
|
|
@@ -62481,23 +62486,23 @@ editHandlers.drop = (view, _event) => {
|
|
|
62481
62486
|
if (!eventPos)
|
|
62482
62487
|
return;
|
|
62483
62488
|
let $mouse = view.state.doc.resolve(eventPos.pos);
|
|
62484
|
-
let
|
|
62485
|
-
if (
|
|
62489
|
+
let slice2 = dragging && dragging.slice;
|
|
62490
|
+
if (slice2) {
|
|
62486
62491
|
view.someProp("transformPasted", (f) => {
|
|
62487
|
-
|
|
62492
|
+
slice2 = f(slice2, view);
|
|
62488
62493
|
});
|
|
62489
62494
|
} else {
|
|
62490
|
-
|
|
62495
|
+
slice2 = parseFromClipboard(view, getText(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData("text/html"), false, $mouse);
|
|
62491
62496
|
}
|
|
62492
62497
|
let move = !!(dragging && !event[dragCopyModifier]);
|
|
62493
|
-
if (view.someProp("handleDrop", (f) => f(view, event,
|
|
62498
|
+
if (view.someProp("handleDrop", (f) => f(view, event, slice2 || Slice.empty, move))) {
|
|
62494
62499
|
event.preventDefault();
|
|
62495
62500
|
return;
|
|
62496
62501
|
}
|
|
62497
|
-
if (!
|
|
62502
|
+
if (!slice2)
|
|
62498
62503
|
return;
|
|
62499
62504
|
event.preventDefault();
|
|
62500
|
-
let insertPos =
|
|
62505
|
+
let insertPos = slice2 ? dropPoint(view.state.doc, $mouse.pos, slice2) : $mouse.pos;
|
|
62501
62506
|
if (insertPos == null)
|
|
62502
62507
|
insertPos = $mouse.pos;
|
|
62503
62508
|
let tr = view.state.tr;
|
|
@@ -62509,16 +62514,16 @@ editHandlers.drop = (view, _event) => {
|
|
|
62509
62514
|
tr.deleteSelection();
|
|
62510
62515
|
}
|
|
62511
62516
|
let pos = tr.mapping.map(insertPos);
|
|
62512
|
-
let isNode =
|
|
62517
|
+
let isNode = slice2.openStart == 0 && slice2.openEnd == 0 && slice2.content.childCount == 1;
|
|
62513
62518
|
let beforeInsert = tr.doc;
|
|
62514
62519
|
if (isNode)
|
|
62515
|
-
tr.replaceRangeWith(pos, pos,
|
|
62520
|
+
tr.replaceRangeWith(pos, pos, slice2.content.firstChild);
|
|
62516
62521
|
else
|
|
62517
|
-
tr.replaceRange(pos, pos,
|
|
62522
|
+
tr.replaceRange(pos, pos, slice2);
|
|
62518
62523
|
if (tr.doc.eq(beforeInsert))
|
|
62519
62524
|
return;
|
|
62520
62525
|
let $pos = tr.doc.resolve(pos);
|
|
62521
|
-
if (isNode && NodeSelection.isSelectable(
|
|
62526
|
+
if (isNode && NodeSelection.isSelectable(slice2.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice2.content.firstChild)) {
|
|
62522
62527
|
tr.setSelection(new NodeSelection($pos));
|
|
62523
62528
|
} else {
|
|
62524
62529
|
let end = tr.mapping.map(insertPos);
|
|
@@ -62610,9 +62615,9 @@ class InlineType {
|
|
|
62610
62615
|
this.spec = spec || noSpec;
|
|
62611
62616
|
}
|
|
62612
62617
|
map(mapping, span, offset, oldOffset) {
|
|
62613
|
-
let
|
|
62618
|
+
let from2 = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset;
|
|
62614
62619
|
let to = mapping.map(span.to + oldOffset, this.spec.inclusiveEnd ? 1 : -1) - offset;
|
|
62615
|
-
return
|
|
62620
|
+
return from2 >= to ? null : new Decoration(from2, to, this);
|
|
62616
62621
|
}
|
|
62617
62622
|
valid(_, span) {
|
|
62618
62623
|
return span.from < span.to;
|
|
@@ -62632,13 +62637,13 @@ class NodeType2 {
|
|
|
62632
62637
|
this.spec = spec || noSpec;
|
|
62633
62638
|
}
|
|
62634
62639
|
map(mapping, span, offset, oldOffset) {
|
|
62635
|
-
let
|
|
62636
|
-
if (
|
|
62640
|
+
let from2 = mapping.mapResult(span.from + oldOffset, 1);
|
|
62641
|
+
if (from2.deleted)
|
|
62637
62642
|
return null;
|
|
62638
62643
|
let to = mapping.mapResult(span.to + oldOffset, -1);
|
|
62639
|
-
if (to.deleted || to.pos <=
|
|
62644
|
+
if (to.deleted || to.pos <= from2.pos)
|
|
62640
62645
|
return null;
|
|
62641
|
-
return new Decoration(
|
|
62646
|
+
return new Decoration(from2.pos - offset, to.pos - offset, this);
|
|
62642
62647
|
}
|
|
62643
62648
|
valid(node, span) {
|
|
62644
62649
|
let { index, offset } = node.content.findIndex(span.from), child;
|
|
@@ -62654,16 +62659,16 @@ class Decoration {
|
|
|
62654
62659
|
/**
|
|
62655
62660
|
@internal
|
|
62656
62661
|
*/
|
|
62657
|
-
constructor(
|
|
62658
|
-
this.from =
|
|
62662
|
+
constructor(from2, to, type2) {
|
|
62663
|
+
this.from = from2;
|
|
62659
62664
|
this.to = to;
|
|
62660
62665
|
this.type = type2;
|
|
62661
62666
|
}
|
|
62662
62667
|
/**
|
|
62663
62668
|
@internal
|
|
62664
62669
|
*/
|
|
62665
|
-
copy(
|
|
62666
|
-
return new Decoration(
|
|
62670
|
+
copy(from2, to) {
|
|
62671
|
+
return new Decoration(from2, to, this.type);
|
|
62667
62672
|
}
|
|
62668
62673
|
/**
|
|
62669
62674
|
@internal
|
|
@@ -62692,16 +62697,16 @@ class Decoration {
|
|
|
62692
62697
|
Creates an inline decoration, which adds the given attributes to
|
|
62693
62698
|
each inline node between `from` and `to`.
|
|
62694
62699
|
*/
|
|
62695
|
-
static inline(
|
|
62696
|
-
return new Decoration(
|
|
62700
|
+
static inline(from2, to, attrs, spec) {
|
|
62701
|
+
return new Decoration(from2, to, new InlineType(attrs, spec));
|
|
62697
62702
|
}
|
|
62698
62703
|
/**
|
|
62699
62704
|
Creates a node decoration. `from` and `to` should point precisely
|
|
62700
62705
|
before and after a node in the document. That node, and only that
|
|
62701
62706
|
node, will receive the given attributes.
|
|
62702
62707
|
*/
|
|
62703
|
-
static node(
|
|
62704
|
-
return new Decoration(
|
|
62708
|
+
static node(from2, to, attrs, spec) {
|
|
62709
|
+
return new Decoration(from2, to, new NodeType2(attrs, spec));
|
|
62705
62710
|
}
|
|
62706
62711
|
/**
|
|
62707
62712
|
The spec provided when creating this decoration. Can be useful
|
|
@@ -62840,10 +62845,10 @@ class DecorationSet {
|
|
|
62840
62845
|
let children = this.children, local = this.local;
|
|
62841
62846
|
for (let i = 0; i < children.length; i += 3) {
|
|
62842
62847
|
let found2;
|
|
62843
|
-
let
|
|
62848
|
+
let from2 = children[i] + offset, to = children[i + 1] + offset;
|
|
62844
62849
|
for (let j = 0, span; j < decorations.length; j++)
|
|
62845
62850
|
if (span = decorations[j]) {
|
|
62846
|
-
if (span.from >
|
|
62851
|
+
if (span.from > from2 && span.to < to) {
|
|
62847
62852
|
decorations[j] = null;
|
|
62848
62853
|
(found2 || (found2 = [])).push(span);
|
|
62849
62854
|
}
|
|
@@ -62852,7 +62857,7 @@ class DecorationSet {
|
|
|
62852
62857
|
continue;
|
|
62853
62858
|
if (children == this.children)
|
|
62854
62859
|
children = this.children.slice();
|
|
62855
|
-
let removed = children[i + 2].removeInner(found2,
|
|
62860
|
+
let removed = children[i + 2].removeInner(found2, from2 + 1);
|
|
62856
62861
|
if (removed != empty) {
|
|
62857
62862
|
children[i + 2] = removed;
|
|
62858
62863
|
} else {
|
|
@@ -62891,9 +62896,9 @@ class DecorationSet {
|
|
|
62891
62896
|
for (let i = 0; i < this.local.length; i++) {
|
|
62892
62897
|
let dec = this.local[i];
|
|
62893
62898
|
if (dec.from < end && dec.to > start && dec.type instanceof InlineType) {
|
|
62894
|
-
let
|
|
62895
|
-
if (
|
|
62896
|
-
(local || (local = [])).push(dec.copy(
|
|
62899
|
+
let from2 = Math.max(start, dec.from) - start, to = Math.min(end, dec.to) - start;
|
|
62900
|
+
if (from2 < to)
|
|
62901
|
+
(local || (local = [])).push(dec.copy(from2, to));
|
|
62897
62902
|
}
|
|
62898
62903
|
}
|
|
62899
62904
|
if (local) {
|
|
@@ -63036,7 +63041,7 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
|
|
|
63036
63041
|
children[i + 1] = -1;
|
|
63037
63042
|
continue;
|
|
63038
63043
|
}
|
|
63039
|
-
let
|
|
63044
|
+
let from2 = mapping.map(oldChildren[i] + oldOffset), fromLocal = from2 - offset;
|
|
63040
63045
|
if (fromLocal < 0 || fromLocal >= node.content.size) {
|
|
63041
63046
|
mustRebuild = true;
|
|
63042
63047
|
continue;
|
|
@@ -63045,7 +63050,7 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
|
|
|
63045
63050
|
let { index, offset: childOffset } = node.content.findIndex(fromLocal);
|
|
63046
63051
|
let childNode = node.maybeChild(index);
|
|
63047
63052
|
if (childNode && childOffset == fromLocal && childOffset + childNode.nodeSize == toLocal) {
|
|
63048
|
-
let mapped = children[i + 2].mapInner(mapping, childNode,
|
|
63053
|
+
let mapped = children[i + 2].mapInner(mapping, childNode, from2 + 1, oldChildren[i] + oldOffset + 1, options2);
|
|
63049
63054
|
if (mapped != empty) {
|
|
63050
63055
|
children[i] = fromLocal;
|
|
63051
63056
|
children[i + 1] = toLocal;
|
|
@@ -63068,8 +63073,8 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
|
|
|
63068
63073
|
i -= 3;
|
|
63069
63074
|
}
|
|
63070
63075
|
for (let i = 0, j = 0; i < built.children.length; i += 3) {
|
|
63071
|
-
let
|
|
63072
|
-
while (j < children.length && children[j] <
|
|
63076
|
+
let from2 = built.children[i];
|
|
63077
|
+
while (j < children.length && children[j] < from2)
|
|
63073
63078
|
j += 3;
|
|
63074
63079
|
children.splice(j, 0, built.children[i], built.children[i + 1], built.children[i + 2]);
|
|
63075
63080
|
}
|
|
@@ -63342,12 +63347,12 @@ class DOMObserver {
|
|
|
63342
63347
|
this.queue = [];
|
|
63343
63348
|
let sel = view.domSelectionRange();
|
|
63344
63349
|
let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel);
|
|
63345
|
-
let
|
|
63350
|
+
let from2 = -1, to = -1, typeOver = false, added = [];
|
|
63346
63351
|
if (view.editable) {
|
|
63347
63352
|
for (let i = 0; i < mutations.length; i++) {
|
|
63348
63353
|
let result = this.registerMutation(mutations[i], added);
|
|
63349
63354
|
if (result) {
|
|
63350
|
-
|
|
63355
|
+
from2 = from2 < 0 ? result.from : Math.min(result.from, from2);
|
|
63351
63356
|
to = to < 0 ? result.to : Math.max(result.to, to);
|
|
63352
63357
|
if (result.typeOver)
|
|
63353
63358
|
typeOver = true;
|
|
@@ -63372,17 +63377,17 @@ class DOMObserver {
|
|
|
63372
63377
|
}
|
|
63373
63378
|
}
|
|
63374
63379
|
let readSel = null;
|
|
63375
|
-
if (
|
|
63380
|
+
if (from2 < 0 && newSel && view.input.lastFocus > Date.now() - 200 && Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 && selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) && readSel.eq(Selection.near(view.state.doc.resolve(0), 1))) {
|
|
63376
63381
|
view.input.lastFocus = 0;
|
|
63377
63382
|
selectionToDOM(view);
|
|
63378
63383
|
this.currentSelection.set(sel);
|
|
63379
63384
|
view.scrollToSelection();
|
|
63380
|
-
} else if (
|
|
63381
|
-
if (
|
|
63382
|
-
view.docView.markDirty(
|
|
63385
|
+
} else if (from2 > -1 || newSel) {
|
|
63386
|
+
if (from2 > -1) {
|
|
63387
|
+
view.docView.markDirty(from2, to);
|
|
63383
63388
|
checkCSS(view);
|
|
63384
63389
|
}
|
|
63385
|
-
this.handleDOMChange(
|
|
63390
|
+
this.handleDOMChange(from2, to, typeOver, added);
|
|
63386
63391
|
if (view.docView && view.docView.dirty)
|
|
63387
63392
|
view.updateState(view.state);
|
|
63388
63393
|
else if (!this.currentSelection.eq(sel))
|
|
@@ -63419,10 +63424,10 @@ class DOMObserver {
|
|
|
63419
63424
|
}
|
|
63420
63425
|
}
|
|
63421
63426
|
let fromOffset = prev && prev.parentNode == mut.target ? domIndex(prev) + 1 : 0;
|
|
63422
|
-
let
|
|
63427
|
+
let from2 = desc.localPosFromDOM(mut.target, fromOffset, -1);
|
|
63423
63428
|
let toOffset = next && next.parentNode == mut.target ? domIndex(next) : mut.target.childNodes.length;
|
|
63424
63429
|
let to = desc.localPosFromDOM(mut.target, toOffset, 1);
|
|
63425
|
-
return { from, to };
|
|
63430
|
+
return { from: from2, to };
|
|
63426
63431
|
} else if (mut.type == "attributes") {
|
|
63427
63432
|
return { from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border };
|
|
63428
63433
|
} else {
|
|
@@ -63487,7 +63492,7 @@ function blockParent(view, node) {
|
|
|
63487
63492
|
return null;
|
|
63488
63493
|
}
|
|
63489
63494
|
function parseBetween(view, from_, to_) {
|
|
63490
|
-
let { node: parent, fromOffset, toOffset, from, to } = view.docView.parseRange(from_, to_);
|
|
63495
|
+
let { node: parent, fromOffset, toOffset, from: from2, to } = view.docView.parseRange(from_, to_);
|
|
63491
63496
|
let domSel = view.domSelectionRange();
|
|
63492
63497
|
let find2;
|
|
63493
63498
|
let anchor = domSel.anchorNode;
|
|
@@ -63509,7 +63514,7 @@ function parseBetween(view, from_, to_) {
|
|
|
63509
63514
|
}
|
|
63510
63515
|
let startDoc = view.state.doc;
|
|
63511
63516
|
let parser = view.someProp("domParser") || DOMParser.fromSchema(view.state.schema);
|
|
63512
|
-
let $from = startDoc.resolve(
|
|
63517
|
+
let $from = startDoc.resolve(from2);
|
|
63513
63518
|
let sel = null, doc2 = parser.parse(parent, {
|
|
63514
63519
|
topNode: $from.parent,
|
|
63515
63520
|
topMatch: $from.parent.contentMatchAt($from.index()),
|
|
@@ -63525,9 +63530,9 @@ function parseBetween(view, from_, to_) {
|
|
|
63525
63530
|
let anchor2 = find2[0].pos, head = find2[1] && find2[1].pos;
|
|
63526
63531
|
if (head == null)
|
|
63527
63532
|
head = anchor2;
|
|
63528
|
-
sel = { anchor: anchor2 +
|
|
63533
|
+
sel = { anchor: anchor2 + from2, head: head + from2 };
|
|
63529
63534
|
}
|
|
63530
|
-
return { doc: doc2, sel, from, to };
|
|
63535
|
+
return { doc: doc2, sel, from: from2, to };
|
|
63531
63536
|
}
|
|
63532
63537
|
function ruleFromNode(dom) {
|
|
63533
63538
|
let desc = dom.pmViewDesc;
|
|
@@ -63547,10 +63552,10 @@ function ruleFromNode(dom) {
|
|
|
63547
63552
|
return null;
|
|
63548
63553
|
}
|
|
63549
63554
|
const isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
|
|
63550
|
-
function readDOMChange(view,
|
|
63555
|
+
function readDOMChange(view, from2, to, typeOver, addedNodes) {
|
|
63551
63556
|
let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);
|
|
63552
63557
|
view.input.compositionPendingChanges = 0;
|
|
63553
|
-
if (
|
|
63558
|
+
if (from2 < 0) {
|
|
63554
63559
|
let origin = view.input.lastSelectionTime > Date.now() - 50 ? view.input.lastSelectionOrigin : null;
|
|
63555
63560
|
let newSel = selectionFromDOM(view, origin);
|
|
63556
63561
|
if (newSel && !view.state.selection.eq(newSel)) {
|
|
@@ -63567,12 +63572,12 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
|
|
|
63567
63572
|
}
|
|
63568
63573
|
return;
|
|
63569
63574
|
}
|
|
63570
|
-
let $before = view.state.doc.resolve(
|
|
63575
|
+
let $before = view.state.doc.resolve(from2);
|
|
63571
63576
|
let shared = $before.sharedDepth(to);
|
|
63572
|
-
|
|
63577
|
+
from2 = $before.before(shared + 1);
|
|
63573
63578
|
to = view.state.doc.resolve(to).after(shared + 1);
|
|
63574
63579
|
let sel = view.state.selection;
|
|
63575
|
-
let parse = parseBetween(view,
|
|
63580
|
+
let parse = parseBetween(view, from2, to);
|
|
63576
63581
|
let doc2 = view.state.doc, compare = doc2.slice(parse.from, parse.to);
|
|
63577
63582
|
let preferredPos, preferredSide;
|
|
63578
63583
|
if (view.input.lastKeyCode === 8 && Date.now() - 100 < view.input.lastKeyCodeTime) {
|
|
@@ -63817,7 +63822,7 @@ class EditorView {
|
|
|
63817
63822
|
updateCursorWrapper(this);
|
|
63818
63823
|
this.nodeViews = buildNodeViews(this);
|
|
63819
63824
|
this.docView = docViewDesc(this.state.doc, computeDocDeco(this), viewDecorations(this), this.dom, this);
|
|
63820
|
-
this.domObserver = new DOMObserver(this, (
|
|
63825
|
+
this.domObserver = new DOMObserver(this, (from2, to, typeOver, added) => readDOMChange(this, from2, to, typeOver, added));
|
|
63821
63826
|
this.domObserver.start();
|
|
63822
63827
|
initInput(this);
|
|
63823
63828
|
this.updatePluginViews();
|
|
@@ -64467,10 +64472,10 @@ function normalizeKeyName(name) {
|
|
|
64467
64472
|
result = "Shift-" + result;
|
|
64468
64473
|
return result;
|
|
64469
64474
|
}
|
|
64470
|
-
function normalize(
|
|
64475
|
+
function normalize(map22) {
|
|
64471
64476
|
let copy2 = /* @__PURE__ */ Object.create(null);
|
|
64472
|
-
for (let prop in
|
|
64473
|
-
copy2[normalizeKeyName(prop)] =
|
|
64477
|
+
for (let prop in map22)
|
|
64478
|
+
copy2[normalizeKeyName(prop)] = map22[prop];
|
|
64474
64479
|
return copy2;
|
|
64475
64480
|
}
|
|
64476
64481
|
function modifiers(name, event, shift2 = true) {
|
|
@@ -64488,19 +64493,19 @@ function keymap(bindings) {
|
|
|
64488
64493
|
return new Plugin({ props: { handleKeyDown: keydownHandler(bindings) } });
|
|
64489
64494
|
}
|
|
64490
64495
|
function keydownHandler(bindings) {
|
|
64491
|
-
let
|
|
64496
|
+
let map22 = normalize(bindings);
|
|
64492
64497
|
return function(view, event) {
|
|
64493
|
-
let name = keyName(event), baseName, direct =
|
|
64498
|
+
let name = keyName(event), baseName, direct = map22[modifiers(name, event)];
|
|
64494
64499
|
if (direct && direct(view.state, view.dispatch, view))
|
|
64495
64500
|
return true;
|
|
64496
64501
|
if (name.length == 1 && name != " ") {
|
|
64497
64502
|
if (event.shiftKey) {
|
|
64498
|
-
let noShift =
|
|
64503
|
+
let noShift = map22[modifiers(name, event, false)];
|
|
64499
64504
|
if (noShift && noShift(view.state, view.dispatch, view))
|
|
64500
64505
|
return true;
|
|
64501
64506
|
}
|
|
64502
64507
|
if ((event.shiftKey || event.altKey || event.metaKey || name.charCodeAt(0) > 127) && (baseName = base[event.keyCode]) && baseName != name) {
|
|
64503
|
-
let fromCode =
|
|
64508
|
+
let fromCode = map22[modifiers(baseName, event)];
|
|
64504
64509
|
if (fromCode && fromCode(view.state, view.dispatch, view))
|
|
64505
64510
|
return true;
|
|
64506
64511
|
}
|
|
@@ -64888,7 +64893,7 @@ const _ExtensionService = class _ExtensionService2 {
|
|
|
64888
64893
|
return container;
|
|
64889
64894
|
}
|
|
64890
64895
|
/**
|
|
64891
|
-
* TODO: Add input and paste rules.
|
|
64896
|
+
* TODO:Artem Add input and paste rules.
|
|
64892
64897
|
*
|
|
64893
64898
|
* Get all PM plugins defined in the extensions.
|
|
64894
64899
|
* And also keyboard shortcuts.
|
|
@@ -65149,14 +65154,14 @@ function toggleMark$1(markType, attrs = null) {
|
|
|
65149
65154
|
if (has2) {
|
|
65150
65155
|
tr.removeMark($from.pos, $to.pos, markType);
|
|
65151
65156
|
} else {
|
|
65152
|
-
let
|
|
65157
|
+
let from2 = $from.pos, to = $to.pos, start = $from.nodeAfter, end = $to.nodeBefore;
|
|
65153
65158
|
let spaceStart = start && start.isText ? /^\s*/.exec(start.text)[0].length : 0;
|
|
65154
65159
|
let spaceEnd = end && end.isText ? /\s*$/.exec(end.text)[0].length : 0;
|
|
65155
|
-
if (
|
|
65156
|
-
|
|
65160
|
+
if (from2 + spaceStart < to) {
|
|
65161
|
+
from2 += spaceStart;
|
|
65157
65162
|
to -= spaceEnd;
|
|
65158
65163
|
}
|
|
65159
|
-
tr.addMark(
|
|
65164
|
+
tr.addMark(from2, to, markType.create(attrs));
|
|
65160
65165
|
}
|
|
65161
65166
|
}
|
|
65162
65167
|
dispatch(tr.scrollIntoView());
|
|
@@ -65204,6 +65209,32 @@ const Editable = Extension.create({
|
|
|
65204
65209
|
return [editablePlugin];
|
|
65205
65210
|
}
|
|
65206
65211
|
});
|
|
65212
|
+
const EditorFocus = Extension.create({
|
|
65213
|
+
name: "editorFocus",
|
|
65214
|
+
addPmPlugins() {
|
|
65215
|
+
const editor = this.editor;
|
|
65216
|
+
const editorFocusPlugin = new Plugin({
|
|
65217
|
+
key: new PluginKey("editorFocus"),
|
|
65218
|
+
props: {
|
|
65219
|
+
handleDOMEvents: {
|
|
65220
|
+
focus: (view, event) => {
|
|
65221
|
+
editor.isFocused = true;
|
|
65222
|
+
const tr = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
|
|
65223
|
+
view.dispatch(tr);
|
|
65224
|
+
return false;
|
|
65225
|
+
},
|
|
65226
|
+
blur: (view, event) => {
|
|
65227
|
+
editor.isFocused = false;
|
|
65228
|
+
const tr = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
|
|
65229
|
+
view.dispatch(tr);
|
|
65230
|
+
return false;
|
|
65231
|
+
}
|
|
65232
|
+
}
|
|
65233
|
+
}
|
|
65234
|
+
});
|
|
65235
|
+
return [editorFocusPlugin];
|
|
65236
|
+
}
|
|
65237
|
+
});
|
|
65207
65238
|
function createDocument(converter, schema, parseOptions) {
|
|
65208
65239
|
const documentData = converter.getSchema();
|
|
65209
65240
|
console.debug("\nSCHEMA", JSON.stringify(documentData, null, 2), "\n");
|
|
@@ -65346,7 +65377,8 @@ const initComments = (editorView, converter, documentId) => {
|
|
|
65346
65377
|
commentsFiles.commentsIds = converter.convertedXml["word/commentsIds.xml"];
|
|
65347
65378
|
doc2.descendants((node, pos) => {
|
|
65348
65379
|
if (node.type.name === "commentRangeStart") {
|
|
65349
|
-
|
|
65380
|
+
if (!node.attrs?.attributes || !("w:id" in node.attrs.attributes)) return;
|
|
65381
|
+
const id = parseInt(node?.attrs?.attributes["w:id"]);
|
|
65350
65382
|
const coords = editorView.coordsAtPos(pos);
|
|
65351
65383
|
const parentThread = getParentCommentId(id);
|
|
65352
65384
|
const comment2 = getComment(id);
|
|
@@ -65357,7 +65389,8 @@ const initComments = (editorView, converter, documentId) => {
|
|
|
65357
65389
|
comment: comment2
|
|
65358
65390
|
});
|
|
65359
65391
|
} else if (node.type.name === "commentRangeEnd") {
|
|
65360
|
-
|
|
65392
|
+
if (!node.attrs?.attributes || !("w:id" in node.attrs.attributes)) return;
|
|
65393
|
+
const id = parseInt(node?.attrs?.attributes["w:id"]);
|
|
65361
65394
|
const match2 = comments.find((item) => item.id === id);
|
|
65362
65395
|
const coords = editorView.coordsAtPos(pos);
|
|
65363
65396
|
match2.end = coords;
|
|
@@ -65436,6 +65469,7 @@ class Editor extends EventEmitter {
|
|
|
65436
65469
|
__publicField2(this, "extensionStorage", {});
|
|
65437
65470
|
__publicField2(this, "schema");
|
|
65438
65471
|
__publicField2(this, "view");
|
|
65472
|
+
__publicField2(this, "isFocused", false);
|
|
65439
65473
|
__privateAdd2(this, _css);
|
|
65440
65474
|
__publicField2(this, "options", {
|
|
65441
65475
|
element: document.createElement("div"),
|
|
@@ -65603,6 +65637,7 @@ createExtensionService_fn = function() {
|
|
|
65603
65637
|
const coreExtensions = [
|
|
65604
65638
|
Editable,
|
|
65605
65639
|
Commands,
|
|
65640
|
+
EditorFocus,
|
|
65606
65641
|
Keymap
|
|
65607
65642
|
];
|
|
65608
65643
|
const allExtensions = [
|
|
@@ -65671,6 +65706,22 @@ dispatchTransaction_fn = function(transaction) {
|
|
|
65671
65706
|
transaction
|
|
65672
65707
|
});
|
|
65673
65708
|
}
|
|
65709
|
+
const focus = transaction.getMeta("focus");
|
|
65710
|
+
if (focus) {
|
|
65711
|
+
this.emit("focus", {
|
|
65712
|
+
editor: this,
|
|
65713
|
+
event: focus.event,
|
|
65714
|
+
transaction
|
|
65715
|
+
});
|
|
65716
|
+
}
|
|
65717
|
+
const blur = transaction.getMeta("blur");
|
|
65718
|
+
if (blur) {
|
|
65719
|
+
this.emit("blur", {
|
|
65720
|
+
editor: this,
|
|
65721
|
+
event: blur.event,
|
|
65722
|
+
transaction
|
|
65723
|
+
});
|
|
65724
|
+
}
|
|
65674
65725
|
if (!transaction.docChanged) {
|
|
65675
65726
|
return;
|
|
65676
65727
|
}
|
|
@@ -65751,6 +65802,563 @@ class Mark2 {
|
|
|
65751
65802
|
return new Mark2(...args);
|
|
65752
65803
|
}
|
|
65753
65804
|
}
|
|
65805
|
+
var GOOD_LEAF_SIZE = 200;
|
|
65806
|
+
var RopeSequence = function RopeSequence2() {
|
|
65807
|
+
};
|
|
65808
|
+
RopeSequence.prototype.append = function append(other) {
|
|
65809
|
+
if (!other.length) {
|
|
65810
|
+
return this;
|
|
65811
|
+
}
|
|
65812
|
+
other = RopeSequence.from(other);
|
|
65813
|
+
return !this.length && other || other.length < GOOD_LEAF_SIZE && this.leafAppend(other) || this.length < GOOD_LEAF_SIZE && other.leafPrepend(this) || this.appendInner(other);
|
|
65814
|
+
};
|
|
65815
|
+
RopeSequence.prototype.prepend = function prepend(other) {
|
|
65816
|
+
if (!other.length) {
|
|
65817
|
+
return this;
|
|
65818
|
+
}
|
|
65819
|
+
return RopeSequence.from(other).append(this);
|
|
65820
|
+
};
|
|
65821
|
+
RopeSequence.prototype.appendInner = function appendInner(other) {
|
|
65822
|
+
return new Append(this, other);
|
|
65823
|
+
};
|
|
65824
|
+
RopeSequence.prototype.slice = function slice(from2, to) {
|
|
65825
|
+
if (from2 === void 0) from2 = 0;
|
|
65826
|
+
if (to === void 0) to = this.length;
|
|
65827
|
+
if (from2 >= to) {
|
|
65828
|
+
return RopeSequence.empty;
|
|
65829
|
+
}
|
|
65830
|
+
return this.sliceInner(Math.max(0, from2), Math.min(this.length, to));
|
|
65831
|
+
};
|
|
65832
|
+
RopeSequence.prototype.get = function get2(i) {
|
|
65833
|
+
if (i < 0 || i >= this.length) {
|
|
65834
|
+
return void 0;
|
|
65835
|
+
}
|
|
65836
|
+
return this.getInner(i);
|
|
65837
|
+
};
|
|
65838
|
+
RopeSequence.prototype.forEach = function forEach(f, from2, to) {
|
|
65839
|
+
if (from2 === void 0) from2 = 0;
|
|
65840
|
+
if (to === void 0) to = this.length;
|
|
65841
|
+
if (from2 <= to) {
|
|
65842
|
+
this.forEachInner(f, from2, to, 0);
|
|
65843
|
+
} else {
|
|
65844
|
+
this.forEachInvertedInner(f, from2, to, 0);
|
|
65845
|
+
}
|
|
65846
|
+
};
|
|
65847
|
+
RopeSequence.prototype.map = function map2(f, from2, to) {
|
|
65848
|
+
if (from2 === void 0) from2 = 0;
|
|
65849
|
+
if (to === void 0) to = this.length;
|
|
65850
|
+
var result = [];
|
|
65851
|
+
this.forEach(function(elt, i) {
|
|
65852
|
+
return result.push(f(elt, i));
|
|
65853
|
+
}, from2, to);
|
|
65854
|
+
return result;
|
|
65855
|
+
};
|
|
65856
|
+
RopeSequence.from = function from(values2) {
|
|
65857
|
+
if (values2 instanceof RopeSequence) {
|
|
65858
|
+
return values2;
|
|
65859
|
+
}
|
|
65860
|
+
return values2 && values2.length ? new Leaf(values2) : RopeSequence.empty;
|
|
65861
|
+
};
|
|
65862
|
+
var Leaf = /* @__PURE__ */ function(RopeSequence3) {
|
|
65863
|
+
function Leaf2(values2) {
|
|
65864
|
+
RopeSequence3.call(this);
|
|
65865
|
+
this.values = values2;
|
|
65866
|
+
}
|
|
65867
|
+
if (RopeSequence3) Leaf2.__proto__ = RopeSequence3;
|
|
65868
|
+
Leaf2.prototype = Object.create(RopeSequence3 && RopeSequence3.prototype);
|
|
65869
|
+
Leaf2.prototype.constructor = Leaf2;
|
|
65870
|
+
var prototypeAccessors = { length: { configurable: true }, depth: { configurable: true } };
|
|
65871
|
+
Leaf2.prototype.flatten = function flatten() {
|
|
65872
|
+
return this.values;
|
|
65873
|
+
};
|
|
65874
|
+
Leaf2.prototype.sliceInner = function sliceInner(from2, to) {
|
|
65875
|
+
if (from2 == 0 && to == this.length) {
|
|
65876
|
+
return this;
|
|
65877
|
+
}
|
|
65878
|
+
return new Leaf2(this.values.slice(from2, to));
|
|
65879
|
+
};
|
|
65880
|
+
Leaf2.prototype.getInner = function getInner(i) {
|
|
65881
|
+
return this.values[i];
|
|
65882
|
+
};
|
|
65883
|
+
Leaf2.prototype.forEachInner = function forEachInner(f, from2, to, start) {
|
|
65884
|
+
for (var i = from2; i < to; i++) {
|
|
65885
|
+
if (f(this.values[i], start + i) === false) {
|
|
65886
|
+
return false;
|
|
65887
|
+
}
|
|
65888
|
+
}
|
|
65889
|
+
};
|
|
65890
|
+
Leaf2.prototype.forEachInvertedInner = function forEachInvertedInner(f, from2, to, start) {
|
|
65891
|
+
for (var i = from2 - 1; i >= to; i--) {
|
|
65892
|
+
if (f(this.values[i], start + i) === false) {
|
|
65893
|
+
return false;
|
|
65894
|
+
}
|
|
65895
|
+
}
|
|
65896
|
+
};
|
|
65897
|
+
Leaf2.prototype.leafAppend = function leafAppend(other) {
|
|
65898
|
+
if (this.length + other.length <= GOOD_LEAF_SIZE) {
|
|
65899
|
+
return new Leaf2(this.values.concat(other.flatten()));
|
|
65900
|
+
}
|
|
65901
|
+
};
|
|
65902
|
+
Leaf2.prototype.leafPrepend = function leafPrepend(other) {
|
|
65903
|
+
if (this.length + other.length <= GOOD_LEAF_SIZE) {
|
|
65904
|
+
return new Leaf2(other.flatten().concat(this.values));
|
|
65905
|
+
}
|
|
65906
|
+
};
|
|
65907
|
+
prototypeAccessors.length.get = function() {
|
|
65908
|
+
return this.values.length;
|
|
65909
|
+
};
|
|
65910
|
+
prototypeAccessors.depth.get = function() {
|
|
65911
|
+
return 0;
|
|
65912
|
+
};
|
|
65913
|
+
Object.defineProperties(Leaf2.prototype, prototypeAccessors);
|
|
65914
|
+
return Leaf2;
|
|
65915
|
+
}(RopeSequence);
|
|
65916
|
+
RopeSequence.empty = new Leaf([]);
|
|
65917
|
+
var Append = /* @__PURE__ */ function(RopeSequence3) {
|
|
65918
|
+
function Append2(left, right) {
|
|
65919
|
+
RopeSequence3.call(this);
|
|
65920
|
+
this.left = left;
|
|
65921
|
+
this.right = right;
|
|
65922
|
+
this.length = left.length + right.length;
|
|
65923
|
+
this.depth = Math.max(left.depth, right.depth) + 1;
|
|
65924
|
+
}
|
|
65925
|
+
if (RopeSequence3) Append2.__proto__ = RopeSequence3;
|
|
65926
|
+
Append2.prototype = Object.create(RopeSequence3 && RopeSequence3.prototype);
|
|
65927
|
+
Append2.prototype.constructor = Append2;
|
|
65928
|
+
Append2.prototype.flatten = function flatten() {
|
|
65929
|
+
return this.left.flatten().concat(this.right.flatten());
|
|
65930
|
+
};
|
|
65931
|
+
Append2.prototype.getInner = function getInner(i) {
|
|
65932
|
+
return i < this.left.length ? this.left.get(i) : this.right.get(i - this.left.length);
|
|
65933
|
+
};
|
|
65934
|
+
Append2.prototype.forEachInner = function forEachInner(f, from2, to, start) {
|
|
65935
|
+
var leftLen = this.left.length;
|
|
65936
|
+
if (from2 < leftLen && this.left.forEachInner(f, from2, Math.min(to, leftLen), start) === false) {
|
|
65937
|
+
return false;
|
|
65938
|
+
}
|
|
65939
|
+
if (to > leftLen && this.right.forEachInner(f, Math.max(from2 - leftLen, 0), Math.min(this.length, to) - leftLen, start + leftLen) === false) {
|
|
65940
|
+
return false;
|
|
65941
|
+
}
|
|
65942
|
+
};
|
|
65943
|
+
Append2.prototype.forEachInvertedInner = function forEachInvertedInner(f, from2, to, start) {
|
|
65944
|
+
var leftLen = this.left.length;
|
|
65945
|
+
if (from2 > leftLen && this.right.forEachInvertedInner(f, from2 - leftLen, Math.max(to, leftLen) - leftLen, start + leftLen) === false) {
|
|
65946
|
+
return false;
|
|
65947
|
+
}
|
|
65948
|
+
if (to < leftLen && this.left.forEachInvertedInner(f, Math.min(from2, leftLen), to, start) === false) {
|
|
65949
|
+
return false;
|
|
65950
|
+
}
|
|
65951
|
+
};
|
|
65952
|
+
Append2.prototype.sliceInner = function sliceInner(from2, to) {
|
|
65953
|
+
if (from2 == 0 && to == this.length) {
|
|
65954
|
+
return this;
|
|
65955
|
+
}
|
|
65956
|
+
var leftLen = this.left.length;
|
|
65957
|
+
if (to <= leftLen) {
|
|
65958
|
+
return this.left.slice(from2, to);
|
|
65959
|
+
}
|
|
65960
|
+
if (from2 >= leftLen) {
|
|
65961
|
+
return this.right.slice(from2 - leftLen, to - leftLen);
|
|
65962
|
+
}
|
|
65963
|
+
return this.left.slice(from2, leftLen).append(this.right.slice(0, to - leftLen));
|
|
65964
|
+
};
|
|
65965
|
+
Append2.prototype.leafAppend = function leafAppend(other) {
|
|
65966
|
+
var inner = this.right.leafAppend(other);
|
|
65967
|
+
if (inner) {
|
|
65968
|
+
return new Append2(this.left, inner);
|
|
65969
|
+
}
|
|
65970
|
+
};
|
|
65971
|
+
Append2.prototype.leafPrepend = function leafPrepend(other) {
|
|
65972
|
+
var inner = this.left.leafPrepend(other);
|
|
65973
|
+
if (inner) {
|
|
65974
|
+
return new Append2(inner, this.right);
|
|
65975
|
+
}
|
|
65976
|
+
};
|
|
65977
|
+
Append2.prototype.appendInner = function appendInner2(other) {
|
|
65978
|
+
if (this.left.depth >= Math.max(this.right.depth, other.depth) + 1) {
|
|
65979
|
+
return new Append2(this.left, new Append2(this.right, other));
|
|
65980
|
+
}
|
|
65981
|
+
return new Append2(this, other);
|
|
65982
|
+
};
|
|
65983
|
+
return Append2;
|
|
65984
|
+
}(RopeSequence);
|
|
65985
|
+
const max_empty_items = 500;
|
|
65986
|
+
class Branch {
|
|
65987
|
+
constructor(items, eventCount) {
|
|
65988
|
+
this.items = items;
|
|
65989
|
+
this.eventCount = eventCount;
|
|
65990
|
+
}
|
|
65991
|
+
// Pop the latest event off the branch's history and apply it
|
|
65992
|
+
// to a document transform.
|
|
65993
|
+
popEvent(state2, preserveItems) {
|
|
65994
|
+
if (this.eventCount == 0)
|
|
65995
|
+
return null;
|
|
65996
|
+
let end = this.items.length;
|
|
65997
|
+
for (; ; end--) {
|
|
65998
|
+
let next = this.items.get(end - 1);
|
|
65999
|
+
if (next.selection) {
|
|
66000
|
+
--end;
|
|
66001
|
+
break;
|
|
66002
|
+
}
|
|
66003
|
+
}
|
|
66004
|
+
let remap, mapFrom;
|
|
66005
|
+
if (preserveItems) {
|
|
66006
|
+
remap = this.remapping(end, this.items.length);
|
|
66007
|
+
mapFrom = remap.maps.length;
|
|
66008
|
+
}
|
|
66009
|
+
let transform = state2.tr;
|
|
66010
|
+
let selection, remaining;
|
|
66011
|
+
let addAfter = [], addBefore = [];
|
|
66012
|
+
this.items.forEach((item, i) => {
|
|
66013
|
+
if (!item.step) {
|
|
66014
|
+
if (!remap) {
|
|
66015
|
+
remap = this.remapping(end, i + 1);
|
|
66016
|
+
mapFrom = remap.maps.length;
|
|
66017
|
+
}
|
|
66018
|
+
mapFrom--;
|
|
66019
|
+
addBefore.push(item);
|
|
66020
|
+
return;
|
|
66021
|
+
}
|
|
66022
|
+
if (remap) {
|
|
66023
|
+
addBefore.push(new Item(item.map));
|
|
66024
|
+
let step = item.step.map(remap.slice(mapFrom)), map22;
|
|
66025
|
+
if (step && transform.maybeStep(step).doc) {
|
|
66026
|
+
map22 = transform.mapping.maps[transform.mapping.maps.length - 1];
|
|
66027
|
+
addAfter.push(new Item(map22, void 0, void 0, addAfter.length + addBefore.length));
|
|
66028
|
+
}
|
|
66029
|
+
mapFrom--;
|
|
66030
|
+
if (map22)
|
|
66031
|
+
remap.appendMap(map22, mapFrom);
|
|
66032
|
+
} else {
|
|
66033
|
+
transform.maybeStep(item.step);
|
|
66034
|
+
}
|
|
66035
|
+
if (item.selection) {
|
|
66036
|
+
selection = remap ? item.selection.map(remap.slice(mapFrom)) : item.selection;
|
|
66037
|
+
remaining = new Branch(this.items.slice(0, end).append(addBefore.reverse().concat(addAfter)), this.eventCount - 1);
|
|
66038
|
+
return false;
|
|
66039
|
+
}
|
|
66040
|
+
}, this.items.length, 0);
|
|
66041
|
+
return { remaining, transform, selection };
|
|
66042
|
+
}
|
|
66043
|
+
// Create a new branch with the given transform added.
|
|
66044
|
+
addTransform(transform, selection, histOptions, preserveItems) {
|
|
66045
|
+
let newItems = [], eventCount = this.eventCount;
|
|
66046
|
+
let oldItems = this.items, lastItem = !preserveItems && oldItems.length ? oldItems.get(oldItems.length - 1) : null;
|
|
66047
|
+
for (let i = 0; i < transform.steps.length; i++) {
|
|
66048
|
+
let step = transform.steps[i].invert(transform.docs[i]);
|
|
66049
|
+
let item = new Item(transform.mapping.maps[i], step, selection), merged;
|
|
66050
|
+
if (merged = lastItem && lastItem.merge(item)) {
|
|
66051
|
+
item = merged;
|
|
66052
|
+
if (i)
|
|
66053
|
+
newItems.pop();
|
|
66054
|
+
else
|
|
66055
|
+
oldItems = oldItems.slice(0, oldItems.length - 1);
|
|
66056
|
+
}
|
|
66057
|
+
newItems.push(item);
|
|
66058
|
+
if (selection) {
|
|
66059
|
+
eventCount++;
|
|
66060
|
+
selection = void 0;
|
|
66061
|
+
}
|
|
66062
|
+
if (!preserveItems)
|
|
66063
|
+
lastItem = item;
|
|
66064
|
+
}
|
|
66065
|
+
let overflow = eventCount - histOptions.depth;
|
|
66066
|
+
if (overflow > DEPTH_OVERFLOW) {
|
|
66067
|
+
oldItems = cutOffEvents(oldItems, overflow);
|
|
66068
|
+
eventCount -= overflow;
|
|
66069
|
+
}
|
|
66070
|
+
return new Branch(oldItems.append(newItems), eventCount);
|
|
66071
|
+
}
|
|
66072
|
+
remapping(from2, to) {
|
|
66073
|
+
let maps = new Mapping();
|
|
66074
|
+
this.items.forEach((item, i) => {
|
|
66075
|
+
let mirrorPos = item.mirrorOffset != null && i - item.mirrorOffset >= from2 ? maps.maps.length - item.mirrorOffset : void 0;
|
|
66076
|
+
maps.appendMap(item.map, mirrorPos);
|
|
66077
|
+
}, from2, to);
|
|
66078
|
+
return maps;
|
|
66079
|
+
}
|
|
66080
|
+
addMaps(array) {
|
|
66081
|
+
if (this.eventCount == 0)
|
|
66082
|
+
return this;
|
|
66083
|
+
return new Branch(this.items.append(array.map((map22) => new Item(map22))), this.eventCount);
|
|
66084
|
+
}
|
|
66085
|
+
// When the collab module receives remote changes, the history has
|
|
66086
|
+
// to know about those, so that it can adjust the steps that were
|
|
66087
|
+
// rebased on top of the remote changes, and include the position
|
|
66088
|
+
// maps for the remote changes in its array of items.
|
|
66089
|
+
rebased(rebasedTransform, rebasedCount) {
|
|
66090
|
+
if (!this.eventCount)
|
|
66091
|
+
return this;
|
|
66092
|
+
let rebasedItems = [], start = Math.max(0, this.items.length - rebasedCount);
|
|
66093
|
+
let mapping = rebasedTransform.mapping;
|
|
66094
|
+
let newUntil = rebasedTransform.steps.length;
|
|
66095
|
+
let eventCount = this.eventCount;
|
|
66096
|
+
this.items.forEach((item) => {
|
|
66097
|
+
if (item.selection)
|
|
66098
|
+
eventCount--;
|
|
66099
|
+
}, start);
|
|
66100
|
+
let iRebased = rebasedCount;
|
|
66101
|
+
this.items.forEach((item) => {
|
|
66102
|
+
let pos = mapping.getMirror(--iRebased);
|
|
66103
|
+
if (pos == null)
|
|
66104
|
+
return;
|
|
66105
|
+
newUntil = Math.min(newUntil, pos);
|
|
66106
|
+
let map22 = mapping.maps[pos];
|
|
66107
|
+
if (item.step) {
|
|
66108
|
+
let step = rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]);
|
|
66109
|
+
let selection = item.selection && item.selection.map(mapping.slice(iRebased + 1, pos));
|
|
66110
|
+
if (selection)
|
|
66111
|
+
eventCount++;
|
|
66112
|
+
rebasedItems.push(new Item(map22, step, selection));
|
|
66113
|
+
} else {
|
|
66114
|
+
rebasedItems.push(new Item(map22));
|
|
66115
|
+
}
|
|
66116
|
+
}, start);
|
|
66117
|
+
let newMaps = [];
|
|
66118
|
+
for (let i = rebasedCount; i < newUntil; i++)
|
|
66119
|
+
newMaps.push(new Item(mapping.maps[i]));
|
|
66120
|
+
let items = this.items.slice(0, start).append(newMaps).append(rebasedItems);
|
|
66121
|
+
let branch = new Branch(items, eventCount);
|
|
66122
|
+
if (branch.emptyItemCount() > max_empty_items)
|
|
66123
|
+
branch = branch.compress(this.items.length - rebasedItems.length);
|
|
66124
|
+
return branch;
|
|
66125
|
+
}
|
|
66126
|
+
emptyItemCount() {
|
|
66127
|
+
let count = 0;
|
|
66128
|
+
this.items.forEach((item) => {
|
|
66129
|
+
if (!item.step)
|
|
66130
|
+
count++;
|
|
66131
|
+
});
|
|
66132
|
+
return count;
|
|
66133
|
+
}
|
|
66134
|
+
// Compressing a branch means rewriting it to push the air (map-only
|
|
66135
|
+
// items) out. During collaboration, these naturally accumulate
|
|
66136
|
+
// because each remote change adds one. The `upto` argument is used
|
|
66137
|
+
// to ensure that only the items below a given level are compressed,
|
|
66138
|
+
// because `rebased` relies on a clean, untouched set of items in
|
|
66139
|
+
// order to associate old items with rebased steps.
|
|
66140
|
+
compress(upto = this.items.length) {
|
|
66141
|
+
let remap = this.remapping(0, upto), mapFrom = remap.maps.length;
|
|
66142
|
+
let items = [], events2 = 0;
|
|
66143
|
+
this.items.forEach((item, i) => {
|
|
66144
|
+
if (i >= upto) {
|
|
66145
|
+
items.push(item);
|
|
66146
|
+
if (item.selection)
|
|
66147
|
+
events2++;
|
|
66148
|
+
} else if (item.step) {
|
|
66149
|
+
let step = item.step.map(remap.slice(mapFrom)), map22 = step && step.getMap();
|
|
66150
|
+
mapFrom--;
|
|
66151
|
+
if (map22)
|
|
66152
|
+
remap.appendMap(map22, mapFrom);
|
|
66153
|
+
if (step) {
|
|
66154
|
+
let selection = item.selection && item.selection.map(remap.slice(mapFrom));
|
|
66155
|
+
if (selection)
|
|
66156
|
+
events2++;
|
|
66157
|
+
let newItem = new Item(map22.invert(), step, selection), merged, last = items.length - 1;
|
|
66158
|
+
if (merged = items.length && items[last].merge(newItem))
|
|
66159
|
+
items[last] = merged;
|
|
66160
|
+
else
|
|
66161
|
+
items.push(newItem);
|
|
66162
|
+
}
|
|
66163
|
+
} else if (item.map) {
|
|
66164
|
+
mapFrom--;
|
|
66165
|
+
}
|
|
66166
|
+
}, this.items.length, 0);
|
|
66167
|
+
return new Branch(RopeSequence.from(items.reverse()), events2);
|
|
66168
|
+
}
|
|
66169
|
+
}
|
|
66170
|
+
Branch.empty = new Branch(RopeSequence.empty, 0);
|
|
66171
|
+
function cutOffEvents(items, n) {
|
|
66172
|
+
let cutPoint;
|
|
66173
|
+
items.forEach((item, i) => {
|
|
66174
|
+
if (item.selection && n-- == 0) {
|
|
66175
|
+
cutPoint = i;
|
|
66176
|
+
return false;
|
|
66177
|
+
}
|
|
66178
|
+
});
|
|
66179
|
+
return items.slice(cutPoint);
|
|
66180
|
+
}
|
|
66181
|
+
class Item {
|
|
66182
|
+
constructor(map22, step, selection, mirrorOffset) {
|
|
66183
|
+
this.map = map22;
|
|
66184
|
+
this.step = step;
|
|
66185
|
+
this.selection = selection;
|
|
66186
|
+
this.mirrorOffset = mirrorOffset;
|
|
66187
|
+
}
|
|
66188
|
+
merge(other) {
|
|
66189
|
+
if (this.step && other.step && !other.selection) {
|
|
66190
|
+
let step = other.step.merge(this.step);
|
|
66191
|
+
if (step)
|
|
66192
|
+
return new Item(step.getMap().invert(), step, this.selection);
|
|
66193
|
+
}
|
|
66194
|
+
}
|
|
66195
|
+
}
|
|
66196
|
+
class HistoryState {
|
|
66197
|
+
constructor(done, undone, prevRanges, prevTime, prevComposition) {
|
|
66198
|
+
this.done = done;
|
|
66199
|
+
this.undone = undone;
|
|
66200
|
+
this.prevRanges = prevRanges;
|
|
66201
|
+
this.prevTime = prevTime;
|
|
66202
|
+
this.prevComposition = prevComposition;
|
|
66203
|
+
}
|
|
66204
|
+
}
|
|
66205
|
+
const DEPTH_OVERFLOW = 20;
|
|
66206
|
+
function applyTransaction(history2, state2, tr, options2) {
|
|
66207
|
+
let historyTr = tr.getMeta(historyKey), rebased;
|
|
66208
|
+
if (historyTr)
|
|
66209
|
+
return historyTr.historyState;
|
|
66210
|
+
if (tr.getMeta(closeHistoryKey))
|
|
66211
|
+
history2 = new HistoryState(history2.done, history2.undone, null, 0, -1);
|
|
66212
|
+
let appended = tr.getMeta("appendedTransaction");
|
|
66213
|
+
if (tr.steps.length == 0) {
|
|
66214
|
+
return history2;
|
|
66215
|
+
} else if (appended && appended.getMeta(historyKey)) {
|
|
66216
|
+
if (appended.getMeta(historyKey).redo)
|
|
66217
|
+
return new HistoryState(history2.done.addTransform(tr, void 0, options2, mustPreserveItems(state2)), history2.undone, rangesFor(tr.mapping.maps[tr.steps.length - 1]), history2.prevTime, history2.prevComposition);
|
|
66218
|
+
else
|
|
66219
|
+
return new HistoryState(history2.done, history2.undone.addTransform(tr, void 0, options2, mustPreserveItems(state2)), null, history2.prevTime, history2.prevComposition);
|
|
66220
|
+
} else if (tr.getMeta("addToHistory") !== false && !(appended && appended.getMeta("addToHistory") === false)) {
|
|
66221
|
+
let composition = tr.getMeta("composition");
|
|
66222
|
+
let newGroup = history2.prevTime == 0 || !appended && history2.prevComposition != composition && (history2.prevTime < (tr.time || 0) - options2.newGroupDelay || !isAdjacentTo(tr, history2.prevRanges));
|
|
66223
|
+
let prevRanges = appended ? mapRanges(history2.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps[tr.steps.length - 1]);
|
|
66224
|
+
return new HistoryState(history2.done.addTransform(tr, newGroup ? state2.selection.getBookmark() : void 0, options2, mustPreserveItems(state2)), Branch.empty, prevRanges, tr.time, composition == null ? history2.prevComposition : composition);
|
|
66225
|
+
} else if (rebased = tr.getMeta("rebased")) {
|
|
66226
|
+
return new HistoryState(history2.done.rebased(tr, rebased), history2.undone.rebased(tr, rebased), mapRanges(history2.prevRanges, tr.mapping), history2.prevTime, history2.prevComposition);
|
|
66227
|
+
} else {
|
|
66228
|
+
return new HistoryState(history2.done.addMaps(tr.mapping.maps), history2.undone.addMaps(tr.mapping.maps), mapRanges(history2.prevRanges, tr.mapping), history2.prevTime, history2.prevComposition);
|
|
66229
|
+
}
|
|
66230
|
+
}
|
|
66231
|
+
function isAdjacentTo(transform, prevRanges) {
|
|
66232
|
+
if (!prevRanges)
|
|
66233
|
+
return false;
|
|
66234
|
+
if (!transform.docChanged)
|
|
66235
|
+
return true;
|
|
66236
|
+
let adjacent = false;
|
|
66237
|
+
transform.mapping.maps[0].forEach((start, end) => {
|
|
66238
|
+
for (let i = 0; i < prevRanges.length; i += 2)
|
|
66239
|
+
if (start <= prevRanges[i + 1] && end >= prevRanges[i])
|
|
66240
|
+
adjacent = true;
|
|
66241
|
+
});
|
|
66242
|
+
return adjacent;
|
|
66243
|
+
}
|
|
66244
|
+
function rangesFor(map22) {
|
|
66245
|
+
let result = [];
|
|
66246
|
+
map22.forEach((_from, _to, from2, to) => result.push(from2, to));
|
|
66247
|
+
return result;
|
|
66248
|
+
}
|
|
66249
|
+
function mapRanges(ranges, mapping) {
|
|
66250
|
+
if (!ranges)
|
|
66251
|
+
return null;
|
|
66252
|
+
let result = [];
|
|
66253
|
+
for (let i = 0; i < ranges.length; i += 2) {
|
|
66254
|
+
let from2 = mapping.map(ranges[i], 1), to = mapping.map(ranges[i + 1], -1);
|
|
66255
|
+
if (from2 <= to)
|
|
66256
|
+
result.push(from2, to);
|
|
66257
|
+
}
|
|
66258
|
+
return result;
|
|
66259
|
+
}
|
|
66260
|
+
function histTransaction(history2, state2, redo2) {
|
|
66261
|
+
let preserveItems = mustPreserveItems(state2);
|
|
66262
|
+
let histOptions = historyKey.get(state2).spec.config;
|
|
66263
|
+
let pop = (redo2 ? history2.undone : history2.done).popEvent(state2, preserveItems);
|
|
66264
|
+
if (!pop)
|
|
66265
|
+
return null;
|
|
66266
|
+
let selection = pop.selection.resolve(pop.transform.doc);
|
|
66267
|
+
let added = (redo2 ? history2.done : history2.undone).addTransform(pop.transform, state2.selection.getBookmark(), histOptions, preserveItems);
|
|
66268
|
+
let newHist = new HistoryState(redo2 ? added : pop.remaining, redo2 ? pop.remaining : added, null, 0, -1);
|
|
66269
|
+
return pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist });
|
|
66270
|
+
}
|
|
66271
|
+
let cachedPreserveItems = false, cachedPreserveItemsPlugins = null;
|
|
66272
|
+
function mustPreserveItems(state2) {
|
|
66273
|
+
let plugins = state2.plugins;
|
|
66274
|
+
if (cachedPreserveItemsPlugins != plugins) {
|
|
66275
|
+
cachedPreserveItems = false;
|
|
66276
|
+
cachedPreserveItemsPlugins = plugins;
|
|
66277
|
+
for (let i = 0; i < plugins.length; i++)
|
|
66278
|
+
if (plugins[i].spec.historyPreserveItems) {
|
|
66279
|
+
cachedPreserveItems = true;
|
|
66280
|
+
break;
|
|
66281
|
+
}
|
|
66282
|
+
}
|
|
66283
|
+
return cachedPreserveItems;
|
|
66284
|
+
}
|
|
66285
|
+
const historyKey = new PluginKey("history");
|
|
66286
|
+
const closeHistoryKey = new PluginKey("closeHistory");
|
|
66287
|
+
function history(config = {}) {
|
|
66288
|
+
config = {
|
|
66289
|
+
depth: config.depth || 100,
|
|
66290
|
+
newGroupDelay: config.newGroupDelay || 500
|
|
66291
|
+
};
|
|
66292
|
+
return new Plugin({
|
|
66293
|
+
key: historyKey,
|
|
66294
|
+
state: {
|
|
66295
|
+
init() {
|
|
66296
|
+
return new HistoryState(Branch.empty, Branch.empty, null, 0, -1);
|
|
66297
|
+
},
|
|
66298
|
+
apply(tr, hist, state2) {
|
|
66299
|
+
return applyTransaction(hist, state2, tr, config);
|
|
66300
|
+
}
|
|
66301
|
+
},
|
|
66302
|
+
config,
|
|
66303
|
+
props: {
|
|
66304
|
+
handleDOMEvents: {
|
|
66305
|
+
beforeinput(view, e) {
|
|
66306
|
+
let inputType = e.inputType;
|
|
66307
|
+
let command = inputType == "historyUndo" ? undo : inputType == "historyRedo" ? redo : null;
|
|
66308
|
+
if (!command)
|
|
66309
|
+
return false;
|
|
66310
|
+
e.preventDefault();
|
|
66311
|
+
return command(view.state, view.dispatch);
|
|
66312
|
+
}
|
|
66313
|
+
}
|
|
66314
|
+
}
|
|
66315
|
+
});
|
|
66316
|
+
}
|
|
66317
|
+
function buildCommand(redo2, scroll) {
|
|
66318
|
+
return (state2, dispatch) => {
|
|
66319
|
+
let hist = historyKey.getState(state2);
|
|
66320
|
+
if (!hist || (redo2 ? hist.undone : hist.done).eventCount == 0)
|
|
66321
|
+
return false;
|
|
66322
|
+
if (dispatch) {
|
|
66323
|
+
let tr = histTransaction(hist, state2, redo2);
|
|
66324
|
+
if (tr)
|
|
66325
|
+
dispatch(tr.scrollIntoView());
|
|
66326
|
+
}
|
|
66327
|
+
return true;
|
|
66328
|
+
};
|
|
66329
|
+
}
|
|
66330
|
+
const undo = buildCommand(false);
|
|
66331
|
+
const redo = buildCommand(true);
|
|
66332
|
+
const History = Extension.create({
|
|
66333
|
+
name: "history",
|
|
66334
|
+
addOptions() {
|
|
66335
|
+
return {
|
|
66336
|
+
depth: 100,
|
|
66337
|
+
newGroupDelay: 500
|
|
66338
|
+
};
|
|
66339
|
+
},
|
|
66340
|
+
addPmPlugins() {
|
|
66341
|
+
const historyPlugin = history(this.options);
|
|
66342
|
+
return [historyPlugin];
|
|
66343
|
+
},
|
|
66344
|
+
addCommands() {
|
|
66345
|
+
return {
|
|
66346
|
+
undo: () => ({ state: state2, dispatch }) => {
|
|
66347
|
+
return undo(state2, dispatch);
|
|
66348
|
+
},
|
|
66349
|
+
redo: () => ({ state: state2, dispatch }) => {
|
|
66350
|
+
return redo(state2, dispatch);
|
|
66351
|
+
}
|
|
66352
|
+
};
|
|
66353
|
+
},
|
|
66354
|
+
addShortcuts() {
|
|
66355
|
+
return {
|
|
66356
|
+
"Mod-z": () => this.editor.commands.undo(),
|
|
66357
|
+
"Mod-Shift-z": () => this.editor.commands.redo(),
|
|
66358
|
+
"Mod-y": () => this.editor.commands.redo()
|
|
66359
|
+
};
|
|
66360
|
+
}
|
|
66361
|
+
});
|
|
65754
66362
|
const Document = Node22.create({
|
|
65755
66363
|
name: "doc",
|
|
65756
66364
|
topNode: true,
|
|
@@ -66002,6 +66610,7 @@ const extensions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
66002
66610
|
CommentRangeStart,
|
|
66003
66611
|
CommentReference,
|
|
66004
66612
|
Document,
|
|
66613
|
+
History,
|
|
66005
66614
|
Italic,
|
|
66006
66615
|
ListItem,
|
|
66007
66616
|
OrderedList,
|