@caspeco/casper-ui-library 12.1.0 → 12.1.1
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/_virtual/builtin_esm-external-require-react.js +1 -1
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/combobox.js +88 -93
- package/dist/components/image-upload/image-cropper.js +1 -1
- package/dist/components/image-upload/image-upload-dropzone.js +2 -6
- package/dist/components/menu/menu-group.js +0 -1
- package/dist/components/rich-text-editor/rich-text-editor-control.js +2 -6
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +1 -1
- package/dist/node_modules/@dnd-kit/abstract/index.js +1 -1
- package/dist/node_modules/@dnd-kit/dom/index.js +11 -16
- package/dist/node_modules/@dnd-kit/dom/sortable.js +4 -4
- package/dist/node_modules/@dnd-kit/dom/utilities.js +2 -6
- package/dist/node_modules/@dnd-kit/react/hooks.js +2 -5
- package/dist/node_modules/@dnd-kit/react/sortable.js +4 -4
- package/dist/node_modules/@tanstack/table-core/build/lib/index.js +16 -30
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +9 -18
- package/dist/node_modules/@tiptap/core/dist/index.js +838 -790
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +14 -3
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +114 -97
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +133 -120
- package/dist/node_modules/@tiptap/extensions/dist/index.js +33 -33
- package/dist/node_modules/country-flag-icons/modules/react/3x2/index.js +1 -2
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +1 -1
- package/dist/node_modules/date-fns/getISOWeek.js +1 -1
- package/dist/node_modules/date-fns/getWeek.js +1 -1
- package/dist/node_modules/libphonenumber-js/es6-modern/metadata.js +1 -1
- package/dist/node_modules/prosemirror-commands/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js +2 -6
- package/dist/node_modules/prosemirror-history/dist/index.js +27 -22
- package/dist/node_modules/prosemirror-model/dist/index.js +32 -35
- package/dist/node_modules/prosemirror-view/dist/index.js +10 -11
- package/dist/packages/casper-ui-library/node_modules/@tiptap/react/dist/index.js +74 -57
- package/package.json +13 -13
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Plugin as e, PluginKey as t } from "../../../prosemirror-state/dist/index.js";
|
|
2
2
|
import { Decoration as n, DecorationSet as r } from "../../../prosemirror-view/dist/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
3
|
+
import { history as i, redo as a, undo as o } from "../../../prosemirror-history/dist/index.js";
|
|
4
|
+
import { Extension as s, callOrReturn as c, getChangedRanges as l, getExtensionField as u, isNodeEmpty as d, isNodeSelection as f } from "../../core/dist/index.js";
|
|
5
|
+
import { dropCursor as p } from "../../../prosemirror-dropcursor/dist/index.js";
|
|
6
|
+
import { gapCursor as m } from "../../../prosemirror-gapcursor/dist/index.js";
|
|
7
|
+
s.create({
|
|
8
8
|
name: "characterCount",
|
|
9
9
|
addOptions() {
|
|
10
10
|
return {
|
|
@@ -66,7 +66,7 @@ i.create({
|
|
|
66
66
|
})];
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
|
-
var h =
|
|
69
|
+
var h = s.create({
|
|
70
70
|
name: "dropCursor",
|
|
71
71
|
addOptions() {
|
|
72
72
|
return {
|
|
@@ -76,10 +76,10 @@ var h = i.create({
|
|
|
76
76
|
};
|
|
77
77
|
},
|
|
78
78
|
addProseMirrorPlugins() {
|
|
79
|
-
return [
|
|
79
|
+
return [p(this.options)];
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
|
-
|
|
82
|
+
s.create({
|
|
83
83
|
name: "focus",
|
|
84
84
|
addOptions() {
|
|
85
85
|
return {
|
|
@@ -110,10 +110,10 @@ i.create({
|
|
|
110
110
|
})];
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
|
-
var g =
|
|
113
|
+
var g = s.create({
|
|
114
114
|
name: "gapCursor",
|
|
115
115
|
addProseMirrorPlugins() {
|
|
116
|
-
return [
|
|
116
|
+
return [m()];
|
|
117
117
|
},
|
|
118
118
|
extendNodeSchema(e) {
|
|
119
119
|
let t = {
|
|
@@ -121,7 +121,7 @@ var g = i.create({
|
|
|
121
121
|
options: e.options,
|
|
122
122
|
storage: e.storage
|
|
123
123
|
};
|
|
124
|
-
return { allowGapCursor:
|
|
124
|
+
return { allowGapCursor: c(u(e, "allowGapCursor", t)) ?? null };
|
|
125
125
|
}
|
|
126
126
|
}), _ = "placeholder", v = new t("tiptap__placeholder");
|
|
127
127
|
function y(e) {
|
|
@@ -140,12 +140,12 @@ function b(e, t) {
|
|
|
140
140
|
return typeof e == "function" ? e(t) : e;
|
|
141
141
|
}
|
|
142
142
|
function x({ editor: e, options: t, dataAttribute: n, doc: r, selection: i, from: a, to: o }) {
|
|
143
|
-
let { anchor: s } = i,
|
|
143
|
+
let { anchor: s } = i, c = [], l = e.isEmpty;
|
|
144
144
|
return r.nodesBetween(a, o, (r, i) => {
|
|
145
|
-
let a = s >= i && s <= i + r.nodeSize, o = !r.isLeaf &&
|
|
146
|
-
return r.type.isTextblock && (a || !t.showOnlyCurrent) && o &&
|
|
145
|
+
let a = s >= i && s <= i + r.nodeSize, o = !r.isLeaf && d(r);
|
|
146
|
+
return r.type.isTextblock && (a || !t.showOnlyCurrent) && o && c.push(y({
|
|
147
147
|
editor: e,
|
|
148
|
-
isEmptyDoc:
|
|
148
|
+
isEmptyDoc: l,
|
|
149
149
|
dataAttribute: n,
|
|
150
150
|
hasAnchor: a,
|
|
151
151
|
placeholder: t.placeholder,
|
|
@@ -161,18 +161,18 @@ function x({ editor: e, options: t, dataAttribute: n, doc: r, selection: i, from
|
|
|
161
161
|
node: r,
|
|
162
162
|
pos: i
|
|
163
163
|
})), t.includeChildren;
|
|
164
|
-
}),
|
|
164
|
+
}), c;
|
|
165
165
|
}
|
|
166
166
|
function S({ editor: e, options: t, dataAttribute: n, doc: i, selection: a }) {
|
|
167
|
-
if (!
|
|
168
|
-
let { anchor: o } = a, s = [],
|
|
167
|
+
if (!e.isEditable && t.showOnlyWhenEditable) return null;
|
|
168
|
+
let { anchor: o } = a, s = [], c = e.isEmpty;
|
|
169
169
|
if (t.showOnlyCurrent && !t.includeChildren) {
|
|
170
|
-
let r = i.resolve(o), a = r.depth > 0 ? r.node(1) : r.nodeAfter,
|
|
171
|
-
if (a && a.type.isTextblock &&
|
|
172
|
-
let r = o >=
|
|
170
|
+
let r = i.resolve(o), a = r.depth > 0 ? r.node(1) : r.nodeAfter, l = r.depth > 0 ? r.before(1) : o;
|
|
171
|
+
if (a && a.type.isTextblock && d(a)) {
|
|
172
|
+
let r = o >= l && o <= l + a.nodeSize;
|
|
173
173
|
s.push(y({
|
|
174
174
|
editor: e,
|
|
175
|
-
isEmptyDoc:
|
|
175
|
+
isEmptyDoc: c,
|
|
176
176
|
dataAttribute: n,
|
|
177
177
|
hasAnchor: r,
|
|
178
178
|
placeholder: t.placeholder,
|
|
@@ -181,12 +181,12 @@ function S({ editor: e, options: t, dataAttribute: n, doc: i, selection: a }) {
|
|
|
181
181
|
emptyNode: b(t.emptyNodeClass, {
|
|
182
182
|
editor: e,
|
|
183
183
|
node: a,
|
|
184
|
-
pos:
|
|
184
|
+
pos: l,
|
|
185
185
|
hasAnchor: r
|
|
186
186
|
})
|
|
187
187
|
},
|
|
188
188
|
node: a,
|
|
189
|
-
pos:
|
|
189
|
+
pos: l
|
|
190
190
|
}));
|
|
191
191
|
}
|
|
192
192
|
} else s.push(...x({
|
|
@@ -252,7 +252,7 @@ function D(e, t) {
|
|
|
252
252
|
function O(e, t, n) {
|
|
253
253
|
let r = [];
|
|
254
254
|
if (e.docChanged) {
|
|
255
|
-
let t =
|
|
255
|
+
let t = l(e);
|
|
256
256
|
for (let e of t) r.push(...D(n.doc, e.newRange));
|
|
257
257
|
}
|
|
258
258
|
return e.selectionSet && (r.push(w(n.doc, C(n.doc, e.mapping.map(t.selection.anchor)))), r.push(w(n.doc, C(n.doc, n.selection.anchor)))), E(r);
|
|
@@ -327,7 +327,7 @@ function N({ editor: t, options: n }) {
|
|
|
327
327
|
}) : (e) => n.showOnlyWhenEditable && !t.isEditable ? r.empty : v.getState(e) ?? r.empty }
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
|
-
|
|
330
|
+
s.create({
|
|
331
331
|
name: "placeholder",
|
|
332
332
|
addOptions() {
|
|
333
333
|
return {
|
|
@@ -348,7 +348,7 @@ i.create({
|
|
|
348
348
|
}
|
|
349
349
|
});
|
|
350
350
|
function P(e, t) {
|
|
351
|
-
return !e.selection.empty && !
|
|
351
|
+
return !e.selection.empty && !f(e.selection) && t.isEditable;
|
|
352
352
|
}
|
|
353
353
|
function F(e, t) {
|
|
354
354
|
return P(e, t) && !t.isFocused && !t.view.dragging;
|
|
@@ -360,7 +360,7 @@ function I() {
|
|
|
360
360
|
function L(e) {
|
|
361
361
|
e.focus();
|
|
362
362
|
}
|
|
363
|
-
|
|
363
|
+
s.create({
|
|
364
364
|
name: "selection",
|
|
365
365
|
addOptions() {
|
|
366
366
|
return { className: "selection" };
|
|
@@ -390,7 +390,7 @@ i.create({
|
|
|
390
390
|
function R({ types: e, node: t }) {
|
|
391
391
|
return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
|
|
392
392
|
}
|
|
393
|
-
var z =
|
|
393
|
+
var z = s.create({
|
|
394
394
|
name: "trailingNode",
|
|
395
395
|
addOptions() {
|
|
396
396
|
return {
|
|
@@ -425,7 +425,7 @@ var z = i.create({
|
|
|
425
425
|
}
|
|
426
426
|
})];
|
|
427
427
|
}
|
|
428
|
-
}), B =
|
|
428
|
+
}), B = s.create({
|
|
429
429
|
name: "undoRedo",
|
|
430
430
|
addOptions() {
|
|
431
431
|
return {
|
|
@@ -435,12 +435,12 @@ var z = i.create({
|
|
|
435
435
|
},
|
|
436
436
|
addCommands() {
|
|
437
437
|
return {
|
|
438
|
-
undo: () => ({ state: e, dispatch: t }) =>
|
|
439
|
-
redo: () => ({ state: e, dispatch: t }) =>
|
|
438
|
+
undo: () => ({ state: e, dispatch: t }) => o(e, t),
|
|
439
|
+
redo: () => ({ state: e, dispatch: t }) => a(e, t)
|
|
440
440
|
};
|
|
441
441
|
},
|
|
442
442
|
addProseMirrorPlugins() {
|
|
443
|
-
return [
|
|
443
|
+
return [i(this.options)];
|
|
444
444
|
},
|
|
445
445
|
addKeyboardShortcuts() {
|
|
446
446
|
return {
|
|
@@ -21,8 +21,7 @@ function s(e, t) {
|
|
|
21
21
|
}
|
|
22
22
|
function Gi(e, t) {
|
|
23
23
|
if (e == null) return {};
|
|
24
|
-
var n = {}, r = Object.keys(e), i, a;
|
|
25
|
-
for (a = 0; a < r.length; a++) i = r[a], !(t.indexOf(i) >= 0) && (n[i] = e[i]);
|
|
24
|
+
for (var n = {}, r = Object.keys(e), i, a = 0; a < r.length; a++) i = r[a], !(t.indexOf(i) >= 0) && (n[i] = e[i]);
|
|
26
25
|
return n;
|
|
27
26
|
}
|
|
28
27
|
var c = function(n) {
|
|
@@ -2,7 +2,7 @@ import e from "../toDate.js";
|
|
|
2
2
|
//#region ../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
|
|
3
3
|
function t(t) {
|
|
4
4
|
let n = e(t), r = new Date(Date.UTC(n.getFullYear(), n.getMonth(), n.getDate(), n.getHours(), n.getMinutes(), n.getSeconds(), n.getMilliseconds()));
|
|
5
|
-
return r.setUTCFullYear(n.getFullYear()), t -
|
|
5
|
+
return r.setUTCFullYear(n.getFullYear()), +t - r;
|
|
6
6
|
}
|
|
7
7
|
//#endregion
|
|
8
8
|
export { t as getTimezoneOffsetInMilliseconds };
|
|
@@ -4,7 +4,7 @@ import n from "./startOfISOWeek.js";
|
|
|
4
4
|
import r from "./startOfISOWeekYear.js";
|
|
5
5
|
//#region ../../node_modules/date-fns/getISOWeek.js
|
|
6
6
|
function i(i, a) {
|
|
7
|
-
let o = t(i, a?.in), s = n(o) -
|
|
7
|
+
let o = t(i, a?.in), s = +n(o) - r(o);
|
|
8
8
|
return Math.round(s / e) + 1;
|
|
9
9
|
}
|
|
10
10
|
//#endregion
|
|
@@ -4,7 +4,7 @@ import n from "./startOfWeek.js";
|
|
|
4
4
|
import r from "./startOfWeekYear.js";
|
|
5
5
|
//#region ../../node_modules/date-fns/getWeek.js
|
|
6
6
|
function i(i, a) {
|
|
7
|
-
let o = t(i, a?.in), s = n(o, a) -
|
|
7
|
+
let o = t(i, a?.in), s = +n(o, a) - r(o, a);
|
|
8
8
|
return Math.round(s / e) + 1;
|
|
9
9
|
}
|
|
10
10
|
//#endregion
|
|
@@ -202,7 +202,7 @@ var r = "1.2.0", i = "1.7.35", a = " ext. ", o = class {
|
|
|
202
202
|
return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
|
|
203
203
|
}
|
|
204
204
|
usesNationalPrefix() {
|
|
205
|
-
return
|
|
205
|
+
return !(!this.nationalPrefixFormattingRule() || l.test(this.nationalPrefixFormattingRule()));
|
|
206
206
|
}
|
|
207
207
|
internationalFormat() {
|
|
208
208
|
return this._format[5] || this.format();
|
|
@@ -281,7 +281,7 @@ function G(e, t = null) {
|
|
|
281
281
|
let { $from: { pos: a }, $to: { pos: o } } = n.selection.ranges[r];
|
|
282
282
|
n.doc.nodesBetween(a, o, (r, a) => {
|
|
283
283
|
if (i) return !1;
|
|
284
|
-
if (
|
|
284
|
+
if (r.isTextblock && !r.hasMarkup(e, t)) {
|
|
285
285
|
if (r.type == e) i = !0;
|
|
286
286
|
else {
|
|
287
287
|
let t = n.doc.resolve(a), r = t.index();
|
|
@@ -91,9 +91,7 @@ function f(e) {
|
|
|
91
91
|
let n = e.index(t), r = e.node(t);
|
|
92
92
|
if (n == 0) {
|
|
93
93
|
if (r.type.spec.isolating) return !0;
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
for (let e = r.child(n - 1);; e = e.lastChild) {
|
|
94
|
+
} else for (let e = r.child(n - 1);; e = e.lastChild) {
|
|
97
95
|
if (e.childCount == 0 && !e.inlineContent || d(e.type)) return !0;
|
|
98
96
|
if (e.inlineContent) return !1;
|
|
99
97
|
}
|
|
@@ -105,9 +103,7 @@ function p(e) {
|
|
|
105
103
|
let n = e.indexAfter(t), r = e.node(t);
|
|
106
104
|
if (n == r.childCount) {
|
|
107
105
|
if (r.type.spec.isolating) return !0;
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
for (let e = r.child(n);; e = e.firstChild) {
|
|
106
|
+
} else for (let e = r.child(n);; e = e.firstChild) {
|
|
111
107
|
if (e.childCount == 0 && !e.inlineContent || d(e.type)) return !0;
|
|
112
108
|
if (e.inlineContent) return !1;
|
|
113
109
|
}
|
|
@@ -17,16 +17,15 @@ var i = 500, a = class t {
|
|
|
17
17
|
n && (i = this.remapping(r, this.items.length), a = i.maps.length);
|
|
18
18
|
let o = e.tr, c, l, u = [], d = [];
|
|
19
19
|
return this.items.forEach((e, n) => {
|
|
20
|
-
if (!e.step)
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
if (!e.step) i || (i = this.remapping(r, n + 1), a = i.maps.length), a--, d.push(e);
|
|
21
|
+
else {
|
|
22
|
+
if (i) {
|
|
23
|
+
d.push(new s(e.map));
|
|
24
|
+
let t = e.step.map(i.slice(a)), n;
|
|
25
|
+
t && o.maybeStep(t).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], u.push(new s(n, void 0, void 0, u.length + d.length))), a--, n && i.appendMap(n, a);
|
|
26
|
+
} else o.maybeStep(e.step);
|
|
27
|
+
if (e.selection) return c = i ? e.selection.map(i.slice(a)) : e.selection, l = new t(this.items.slice(0, r).append(d.reverse().concat(u)), this.eventCount - 1), !1;
|
|
23
28
|
}
|
|
24
|
-
if (i) {
|
|
25
|
-
d.push(new s(e.map));
|
|
26
|
-
let t = e.step.map(i.slice(a)), n;
|
|
27
|
-
t && o.maybeStep(t).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], u.push(new s(n, void 0, void 0, u.length + d.length))), a--, n && i.appendMap(n, a);
|
|
28
|
-
} else o.maybeStep(e.step);
|
|
29
|
-
if (e.selection) return c = i ? e.selection.map(i.slice(a)) : e.selection, l = new t(this.items.slice(0, r).append(d.reverse().concat(u)), this.eventCount - 1), !1;
|
|
30
29
|
}, this.items.length, 0), {
|
|
31
30
|
remaining: l,
|
|
32
31
|
transform: o,
|
|
@@ -119,12 +118,12 @@ var s = class e {
|
|
|
119
118
|
}
|
|
120
119
|
}, l = 20;
|
|
121
120
|
function u(e, t, n, r) {
|
|
122
|
-
let i = n.getMeta(
|
|
121
|
+
let i = n.getMeta(y), o;
|
|
123
122
|
if (i) return i.historyState;
|
|
124
|
-
n.getMeta(
|
|
123
|
+
n.getMeta(b) && (e = new c(e.done, e.undone, null, 0, -1));
|
|
125
124
|
let s = n.getMeta("appendedTransaction");
|
|
126
125
|
if (n.steps.length == 0) return e;
|
|
127
|
-
if (s && s.getMeta(
|
|
126
|
+
if (s && s.getMeta(y)) return s.getMeta(y).redo ? new c(e.done.addTransform(n, void 0, r, _(t)), e.undone, f(n.mapping.maps), e.prevTime, e.prevComposition) : new c(e.done, e.undone.addTransform(n, void 0, r, _(t)), null, e.prevTime, e.prevComposition);
|
|
128
127
|
if (n.getMeta("addToHistory") !== !1 && !(s && s.getMeta("addToHistory") === !1)) {
|
|
129
128
|
let i = n.getMeta("composition"), o = e.prevTime == 0 || !s && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !d(n, e.prevRanges)), l = s ? p(e.prevRanges, n.mapping) : f(n.mapping.maps);
|
|
130
129
|
return new c(e.done.addTransform(n, o ? t.selection.getBookmark() : void 0, r, _(t)), a.empty, l, n.time, i ?? e.prevComposition);
|
|
@@ -154,10 +153,10 @@ function p(e, t) {
|
|
|
154
153
|
return n;
|
|
155
154
|
}
|
|
156
155
|
function m(e, t, n) {
|
|
157
|
-
let r = _(t), i =
|
|
156
|
+
let r = _(t), i = y.get(t).spec.config, a = (n ? e.undone : e.done).popEvent(t, r);
|
|
158
157
|
if (!a) return null;
|
|
159
158
|
let o = a.selection.resolve(a.transform.doc), s = (n ? e.done : e.undone).addTransform(a.transform, t.selection.getBookmark(), i, r), l = new c(n ? s : a.remaining, n ? a.remaining : s, null, 0, -1);
|
|
160
|
-
return a.transform.setSelection(o).setMeta(
|
|
159
|
+
return a.transform.setSelection(o).setMeta(y, {
|
|
161
160
|
redo: n,
|
|
162
161
|
historyState: l
|
|
163
162
|
});
|
|
@@ -174,13 +173,16 @@ function _(e) {
|
|
|
174
173
|
}
|
|
175
174
|
return h;
|
|
176
175
|
}
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
function v(e) {
|
|
177
|
+
return e.setMeta(b, !0);
|
|
178
|
+
}
|
|
179
|
+
var y = new n("history"), b = new n("closeHistory");
|
|
180
|
+
function x(e = {}) {
|
|
179
181
|
return e = {
|
|
180
182
|
depth: e.depth || 100,
|
|
181
183
|
newGroupDelay: e.newGroupDelay || 500
|
|
182
184
|
}, new t({
|
|
183
|
-
key:
|
|
185
|
+
key: y,
|
|
184
186
|
state: {
|
|
185
187
|
init() {
|
|
186
188
|
return new c(a.empty, a.empty, null, 0, -1);
|
|
@@ -191,14 +193,14 @@ function b(e = {}) {
|
|
|
191
193
|
},
|
|
192
194
|
config: e,
|
|
193
195
|
props: { handleDOMEvents: { beforeinput(e, t) {
|
|
194
|
-
let n = t.inputType, r = n == "historyUndo" ?
|
|
196
|
+
let n = t.inputType, r = n == "historyUndo" ? C : n == "historyRedo" ? w : null;
|
|
195
197
|
return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
|
|
196
198
|
} } }
|
|
197
199
|
});
|
|
198
200
|
}
|
|
199
|
-
function
|
|
201
|
+
function S(e, t) {
|
|
200
202
|
return (n, r) => {
|
|
201
|
-
let i =
|
|
203
|
+
let i = y.getState(n);
|
|
202
204
|
if (!i || (e ? i.undone : i.done).eventCount == 0) return !1;
|
|
203
205
|
if (r) {
|
|
204
206
|
let a = m(i, n, e);
|
|
@@ -207,6 +209,9 @@ function x(e, t) {
|
|
|
207
209
|
return !0;
|
|
208
210
|
};
|
|
209
211
|
}
|
|
210
|
-
var
|
|
212
|
+
var C = S(!1, !0), w = S(!0, !0);
|
|
213
|
+
function T(e) {
|
|
214
|
+
return e.getMeta(y) != null;
|
|
215
|
+
}
|
|
211
216
|
//#endregion
|
|
212
|
-
export {
|
|
217
|
+
export { v as closeHistory, x as history, T as isHistoryTransaction, w as redo, C as undo };
|
|
@@ -4,21 +4,20 @@ function t(e, n, a) {
|
|
|
4
4
|
for (let o = 0;; o++) {
|
|
5
5
|
if (o == e.childCount || o == n.childCount) return e.childCount == n.childCount ? null : a;
|
|
6
6
|
let s = e.child(o), c = n.child(o);
|
|
7
|
-
if (s == c)
|
|
7
|
+
if (s == c) a += s.nodeSize;
|
|
8
|
+
else {
|
|
9
|
+
if (!s.sameMarkup(c)) return a;
|
|
10
|
+
if (s.isText && s.text != c.text) {
|
|
11
|
+
let e = s.text, t = c.text, n = 0;
|
|
12
|
+
for (; e[n] == t[n]; n++) a++;
|
|
13
|
+
return n && n < e.length && n < t.length && i(e.charCodeAt(n - 1)) && r(e.charCodeAt(n)) && a--, a;
|
|
14
|
+
}
|
|
15
|
+
if (s.content.size || c.content.size) {
|
|
16
|
+
let e = t(s.content, c.content, a + 1);
|
|
17
|
+
if (e != null) return e;
|
|
18
|
+
}
|
|
8
19
|
a += s.nodeSize;
|
|
9
|
-
continue;
|
|
10
|
-
}
|
|
11
|
-
if (!s.sameMarkup(c)) return a;
|
|
12
|
-
if (s.isText && s.text != c.text) {
|
|
13
|
-
let e = s.text, t = c.text, n = 0;
|
|
14
|
-
for (; e[n] == t[n]; n++) a++;
|
|
15
|
-
return n && n < e.length && n < t.length && i(e.charCodeAt(n - 1)) && r(e.charCodeAt(n)) && a--, a;
|
|
16
20
|
}
|
|
17
|
-
if (s.content.size || c.content.size) {
|
|
18
|
-
let e = t(s.content, c.content, a + 1);
|
|
19
|
-
if (e != null) return e;
|
|
20
|
-
}
|
|
21
|
-
a += s.nodeSize;
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
function n(e, t, a, o) {
|
|
@@ -28,27 +27,26 @@ function n(e, t, a, o) {
|
|
|
28
27
|
b: o
|
|
29
28
|
};
|
|
30
29
|
let l = e.child(--s), u = t.child(--c), d = l.nodeSize;
|
|
31
|
-
if (l == u)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
if (!l.sameMarkup(u)) return {
|
|
36
|
-
a,
|
|
37
|
-
b: o
|
|
38
|
-
};
|
|
39
|
-
if (l.isText && l.text != u.text) {
|
|
40
|
-
let e = l.text, t = u.text, n = e.length, s = t.length;
|
|
41
|
-
for (; n > 0 && s > 0 && e[n - 1] == t[s - 1];) n--, s--, a--, o--;
|
|
42
|
-
return n && s && n < e.length && i(e.charCodeAt(n - 1)) && r(e.charCodeAt(n)) && (a++, o++), {
|
|
30
|
+
if (l == u) a -= d, o -= d;
|
|
31
|
+
else {
|
|
32
|
+
if (!l.sameMarkup(u)) return {
|
|
43
33
|
a,
|
|
44
34
|
b: o
|
|
45
35
|
};
|
|
36
|
+
if (l.isText && l.text != u.text) {
|
|
37
|
+
let e = l.text, t = u.text, n = e.length, s = t.length;
|
|
38
|
+
for (; n > 0 && s > 0 && e[n - 1] == t[s - 1];) n--, s--, a--, o--;
|
|
39
|
+
return n && s && n < e.length && i(e.charCodeAt(n - 1)) && r(e.charCodeAt(n)) && (a++, o++), {
|
|
40
|
+
a,
|
|
41
|
+
b: o
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (l.content.size || u.content.size) {
|
|
45
|
+
let e = n(l.content, u.content, a - 1, o - 1);
|
|
46
|
+
if (e) return e;
|
|
47
|
+
}
|
|
48
|
+
a -= d, o -= d;
|
|
46
49
|
}
|
|
47
|
-
if (l.content.size || u.content.size) {
|
|
48
|
-
let e = n(l.content, u.content, a - 1, o - 1);
|
|
49
|
-
if (e) return e;
|
|
50
|
-
}
|
|
51
|
-
a -= d, o -= d;
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
function r(e) {
|
|
@@ -1662,12 +1660,11 @@ var Ce = class e {
|
|
|
1662
1660
|
let n = 0, a = 0;
|
|
1663
1661
|
for (; n < i.length && a < e.marks.length;) {
|
|
1664
1662
|
let t = e.marks[a];
|
|
1665
|
-
if (!this.marks[t.type.name])
|
|
1666
|
-
|
|
1667
|
-
|
|
1663
|
+
if (!this.marks[t.type.name]) a++;
|
|
1664
|
+
else {
|
|
1665
|
+
if (!t.eq(i[n][0]) || t.type.spec.spanning === !1) break;
|
|
1666
|
+
n++, a++;
|
|
1668
1667
|
}
|
|
1669
|
-
if (!t.eq(i[n][0]) || t.type.spec.spanning === !1) break;
|
|
1670
|
-
n++, a++;
|
|
1671
1668
|
}
|
|
1672
1669
|
for (; n < i.length;) r = i.pop()[1];
|
|
1673
1670
|
for (; a < e.marks.length;) {
|
|
@@ -592,7 +592,7 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
592
592
|
for (let e; n && !(e = this.children[n - 1]).size && e instanceof Ue && e.side >= 0; n--);
|
|
593
593
|
if (t <= 0) {
|
|
594
594
|
let e, r = !0;
|
|
595
|
-
for (; e = n ? this.children[n - 1] : null,
|
|
595
|
+
for (; e = n ? this.children[n - 1] : null, e && e.dom.parentNode != this.contentDOM; n--, r = !1);
|
|
596
596
|
return e && t && r && !e.border && !e.domAtom ? e.domFromPos(e.size, t) : {
|
|
597
597
|
node: this.contentDOM,
|
|
598
598
|
offset: e ? u(e.dom) + 1 : 0
|
|
@@ -600,7 +600,7 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
600
600
|
}
|
|
601
601
|
{
|
|
602
602
|
let e, r = !0;
|
|
603
|
-
for (; e = n < this.children.length ? this.children[n] : null,
|
|
603
|
+
for (; e = n < this.children.length ? this.children[n] : null, e && e.dom.parentNode != this.contentDOM; n++, r = !1);
|
|
604
604
|
return e && r && !e.border && !e.domAtom ? e.domFromPos(0, t) : {
|
|
605
605
|
node: this.contentDOM,
|
|
606
606
|
offset: e ? u(e.dom) : this.contentDOM.childNodes.length
|
|
@@ -1096,7 +1096,7 @@ function $e(e, t, n, r) {
|
|
|
1096
1096
|
let a = r[t], o = n[t];
|
|
1097
1097
|
if (t) {
|
|
1098
1098
|
let t;
|
|
1099
|
-
o && o.nodeName == a.nodeName && i != e && (t = i.parentNode) && t.nodeName.toLowerCase() == a.nodeName
|
|
1099
|
+
o && o.nodeName == a.nodeName && i != e && (t = i.parentNode) && t.nodeName.toLowerCase() == a.nodeName || (t = document.createElement(a.nodeName), t.pmIsDeco = !0, t.appendChild(i), o = V[0]), i = t;
|
|
1100
1100
|
}
|
|
1101
1101
|
et(i, o || V[0], a);
|
|
1102
1102
|
}
|
|
@@ -2050,7 +2050,7 @@ var En = class {
|
|
|
2050
2050
|
n.button == 0 && (i.type.spec.draggable && i.type.spec.selectable !== !1 || l instanceof s && l.from <= a && l.to > a) && (this.mightDrag = {
|
|
2051
2051
|
node: i,
|
|
2052
2052
|
pos: a,
|
|
2053
|
-
addAttr:
|
|
2053
|
+
addAttr: !(!this.target || this.target.draggable),
|
|
2054
2054
|
setUneditable: !!(this.target && O && !this.target.hasAttribute("contentEditable"))
|
|
2055
2055
|
}), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
|
|
2056
2056
|
this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
|
|
@@ -2147,7 +2147,7 @@ function Pn(e) {
|
|
|
2147
2147
|
if (!t || !t.isText(r.nodeValue)) return r;
|
|
2148
2148
|
if (e.input.compositionNode == r) {
|
|
2149
2149
|
let e = n.pmViewDesc;
|
|
2150
|
-
if (
|
|
2150
|
+
if (e && e.isText(n.nodeValue)) return r;
|
|
2151
2151
|
}
|
|
2152
2152
|
}
|
|
2153
2153
|
return n || r;
|
|
@@ -2640,12 +2640,11 @@ function rr(e) {
|
|
|
2640
2640
|
let r = t[n];
|
|
2641
2641
|
if (r.from != r.to) for (let i = n + 1; i < t.length; i++) {
|
|
2642
2642
|
let a = t[i];
|
|
2643
|
-
if (a.from == r.from)
|
|
2644
|
-
|
|
2645
|
-
|
|
2643
|
+
if (a.from == r.from) a.to != r.to && (t == e && (t = e.slice()), t[i] = a.copy(a.from, r.to), ir(t, i + 1, a.copy(r.to, a.to)));
|
|
2644
|
+
else {
|
|
2645
|
+
a.from < r.to && (t == e && (t = e.slice()), t[n] = r.copy(r.from, a.from), ir(t, i, r.copy(a.from, r.to)));
|
|
2646
|
+
break;
|
|
2646
2647
|
}
|
|
2647
|
-
a.from < r.to && (t == e && (t = e.slice()), t[n] = r.copy(r.from, a.from), ir(t, i, r.copy(a.from, r.to)));
|
|
2648
|
-
break;
|
|
2649
2648
|
}
|
|
2650
2649
|
}
|
|
2651
2650
|
return t;
|
|
@@ -3127,7 +3126,7 @@ var Er = class {
|
|
|
3127
3126
|
}
|
|
3128
3127
|
scrollToSelection() {
|
|
3129
3128
|
let e = this.domSelectionRange().focusNode;
|
|
3130
|
-
if (
|
|
3129
|
+
if (e && this.dom.contains(e.nodeType == 1 ? e : e.parentNode) && !this.someProp("handleScrollToSelection", (e) => e(this))) {
|
|
3131
3130
|
if (this.state.selection instanceof s) {
|
|
3132
3131
|
let t = this.docView.domAfterPos(this.state.selection.from);
|
|
3133
3132
|
t.nodeType == 1 && me(this, t.getBoundingClientRect(), e);
|