@caspeco/casper-ui-library 10.0.2 → 10.0.3
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/components/modal/modal.d.ts.map +1 -1
- package/dist/components/modal/modal.js +33 -31
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +2 -2
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +16 -16
- package/dist/node_modules/@tiptap/core/dist/index.js +1062 -1056
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +23 -24
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +607 -336
- package/dist/node_modules/@tiptap/extensions/dist/index.js +243 -232
- package/package.json +10 -10
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Extension as
|
|
2
|
-
import { PluginKey as
|
|
3
|
-
import { dropCursor as
|
|
4
|
-
import { DecorationSet as
|
|
1
|
+
import { Extension as g, callOrReturn as R, getExtensionField as x, createStyleTag as _, isNodeSelection as L, isNodeEmpty as E } from "../../core/dist/index.js";
|
|
2
|
+
import { PluginKey as P, Plugin as v } from "../../../prosemirror-state/dist/index.js";
|
|
3
|
+
import { dropCursor as D } from "../../../prosemirror-dropcursor/dist/index.js";
|
|
4
|
+
import { DecorationSet as b, Decoration as S } from "../../../prosemirror-view/dist/index.js";
|
|
5
5
|
import { gapCursor as k } from "../../../prosemirror-gapcursor/dist/index.js";
|
|
6
|
-
import { history as B, redo as
|
|
7
|
-
|
|
6
|
+
import { history as B, redo as I, undo as F } from "../../../prosemirror-history/dist/index.js";
|
|
7
|
+
g.create({
|
|
8
8
|
name: "characterCount",
|
|
9
9
|
addOptions() {
|
|
10
10
|
return {
|
|
11
11
|
limit: null,
|
|
12
12
|
autoTrim: !0,
|
|
13
13
|
mode: "textSize",
|
|
14
|
-
textCounter: (
|
|
15
|
-
wordCounter: (
|
|
14
|
+
textCounter: (e) => e.length,
|
|
15
|
+
wordCounter: (e) => e.split(" ").filter((t) => t !== "").length
|
|
16
16
|
};
|
|
17
17
|
},
|
|
18
18
|
addStorage() {
|
|
@@ -22,59 +22,59 @@ h.create({
|
|
|
22
22
|
};
|
|
23
23
|
},
|
|
24
24
|
onBeforeCreate() {
|
|
25
|
-
this.storage.characters = (
|
|
26
|
-
const
|
|
27
|
-
if ((
|
|
28
|
-
const
|
|
29
|
-
return this.options.textCounter(
|
|
25
|
+
this.storage.characters = (e) => {
|
|
26
|
+
const t = e?.node || this.editor.state.doc;
|
|
27
|
+
if ((e?.mode || this.options.mode) === "textSize") {
|
|
28
|
+
const n = t.textBetween(0, t.content.size, void 0, " ");
|
|
29
|
+
return this.options.textCounter(n);
|
|
30
30
|
}
|
|
31
|
-
return
|
|
32
|
-
}, this.storage.words = (
|
|
33
|
-
const
|
|
34
|
-
return this.options.wordCounter(
|
|
31
|
+
return t.nodeSize;
|
|
32
|
+
}, this.storage.words = (e) => {
|
|
33
|
+
const t = e?.node || this.editor.state.doc, o = t.textBetween(0, t.content.size, " ", " ");
|
|
34
|
+
return this.options.wordCounter(o);
|
|
35
35
|
};
|
|
36
36
|
},
|
|
37
37
|
addProseMirrorPlugins() {
|
|
38
|
-
let
|
|
38
|
+
let e = !1;
|
|
39
39
|
return [
|
|
40
|
-
new
|
|
41
|
-
key: new
|
|
42
|
-
appendTransaction: (
|
|
43
|
-
if (
|
|
40
|
+
new v({
|
|
41
|
+
key: new P("characterCount"),
|
|
42
|
+
appendTransaction: (t, o, n) => {
|
|
43
|
+
if (e)
|
|
44
44
|
return;
|
|
45
|
-
const r = this.options.limit,
|
|
46
|
-
if (r == null || r === 0 ||
|
|
47
|
-
|
|
45
|
+
const r = this.options.limit, a = this.options.autoTrim;
|
|
46
|
+
if (r == null || r === 0 || a === !1) {
|
|
47
|
+
e = !0;
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
50
|
+
const s = this.storage.characters({ node: n.doc });
|
|
51
|
+
if (s > r) {
|
|
52
|
+
const c = s - r, l = 0, i = c;
|
|
53
53
|
console.warn(
|
|
54
54
|
`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`
|
|
55
55
|
);
|
|
56
|
-
const
|
|
57
|
-
return
|
|
56
|
+
const d = n.tr.deleteRange(l, i);
|
|
57
|
+
return e = !0, d;
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
e = !0;
|
|
60
60
|
},
|
|
61
|
-
filterTransaction: (
|
|
62
|
-
const
|
|
63
|
-
if (!
|
|
61
|
+
filterTransaction: (t, o) => {
|
|
62
|
+
const n = this.options.limit;
|
|
63
|
+
if (!t.docChanged || n === 0 || n === null || n === void 0)
|
|
64
64
|
return !0;
|
|
65
|
-
const r = this.storage.characters({ node:
|
|
66
|
-
if (
|
|
65
|
+
const r = this.storage.characters({ node: o.doc }), a = this.storage.characters({ node: t.doc });
|
|
66
|
+
if (a <= n || r > n && a > n && a <= r)
|
|
67
67
|
return !0;
|
|
68
|
-
if (r >
|
|
68
|
+
if (r > n && a > n && a > r || !t.getMeta("paste"))
|
|
69
69
|
return !1;
|
|
70
|
-
const
|
|
71
|
-
return
|
|
70
|
+
const c = t.selection.$head.pos, l = a - n, i = c - l, d = c;
|
|
71
|
+
return t.deleteRange(i, d), !(this.storage.characters({ node: t.doc }) > n);
|
|
72
72
|
}
|
|
73
73
|
})
|
|
74
74
|
];
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
-
var
|
|
77
|
+
var ne = g.create({
|
|
78
78
|
name: "dropCursor",
|
|
79
79
|
addOptions() {
|
|
80
80
|
return {
|
|
@@ -84,10 +84,10 @@ var nt = h.create({
|
|
|
84
84
|
};
|
|
85
85
|
},
|
|
86
86
|
addProseMirrorPlugins() {
|
|
87
|
-
return [
|
|
87
|
+
return [D(this.options)];
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
|
-
|
|
90
|
+
g.create({
|
|
91
91
|
name: "focus",
|
|
92
92
|
addOptions() {
|
|
93
93
|
return {
|
|
@@ -97,187 +97,192 @@ h.create({
|
|
|
97
97
|
},
|
|
98
98
|
addProseMirrorPlugins() {
|
|
99
99
|
return [
|
|
100
|
-
new
|
|
101
|
-
key: new
|
|
100
|
+
new v({
|
|
101
|
+
key: new P("focus"),
|
|
102
102
|
props: {
|
|
103
|
-
decorations: ({ doc:
|
|
104
|
-
const { isEditable:
|
|
105
|
-
if (!
|
|
106
|
-
return
|
|
107
|
-
let
|
|
108
|
-
this.options.mode === "deepest" &&
|
|
109
|
-
if (
|
|
103
|
+
decorations: ({ doc: e, selection: t }) => {
|
|
104
|
+
const { isEditable: o, isFocused: n } = this.editor, { anchor: r } = t, a = [];
|
|
105
|
+
if (!o || !n)
|
|
106
|
+
return b.create(e, []);
|
|
107
|
+
let s = 0;
|
|
108
|
+
this.options.mode === "deepest" && e.descendants((l, i) => {
|
|
109
|
+
if (l.isText)
|
|
110
110
|
return;
|
|
111
|
-
if (!(r >=
|
|
111
|
+
if (!(r >= i && r <= i + l.nodeSize - 1))
|
|
112
112
|
return !1;
|
|
113
|
-
|
|
113
|
+
s += 1;
|
|
114
114
|
});
|
|
115
|
-
let
|
|
116
|
-
return
|
|
117
|
-
if (
|
|
115
|
+
let c = 0;
|
|
116
|
+
return e.descendants((l, i) => {
|
|
117
|
+
if (l.isText || !(r >= i && r <= i + l.nodeSize - 1))
|
|
118
118
|
return !1;
|
|
119
|
-
if (
|
|
119
|
+
if (c += 1, this.options.mode === "deepest" && s - c > 0 || this.options.mode === "shallowest" && c > 1)
|
|
120
120
|
return this.options.mode === "deepest";
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
a.push(
|
|
122
|
+
S.node(i, i + l.nodeSize, {
|
|
123
123
|
class: this.options.className
|
|
124
124
|
})
|
|
125
125
|
);
|
|
126
|
-
}),
|
|
126
|
+
}), b.create(e, a);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
})
|
|
130
130
|
];
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
|
-
var
|
|
133
|
+
var re = g.create({
|
|
134
134
|
name: "gapCursor",
|
|
135
135
|
addProseMirrorPlugins() {
|
|
136
136
|
return [k()];
|
|
137
137
|
},
|
|
138
|
-
extendNodeSchema(
|
|
139
|
-
var
|
|
140
|
-
const
|
|
141
|
-
name:
|
|
142
|
-
options:
|
|
143
|
-
storage:
|
|
138
|
+
extendNodeSchema(e) {
|
|
139
|
+
var t;
|
|
140
|
+
const o = {
|
|
141
|
+
name: e.name,
|
|
142
|
+
options: e.options,
|
|
143
|
+
storage: e.storage
|
|
144
144
|
};
|
|
145
145
|
return {
|
|
146
|
-
allowGapCursor: (
|
|
146
|
+
allowGapCursor: (t = R(x(e, "allowGapCursor", o))) != null ? t : null
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
-
}), A = "placeholder",
|
|
150
|
-
function
|
|
149
|
+
}), A = "placeholder", y = new P("tiptap__placeholder"), M = 200;
|
|
150
|
+
function T(e) {
|
|
151
151
|
const {
|
|
152
|
-
editor:
|
|
153
|
-
placeholder:
|
|
154
|
-
dataAttribute:
|
|
152
|
+
editor: t,
|
|
153
|
+
placeholder: o,
|
|
154
|
+
dataAttribute: n,
|
|
155
155
|
pos: r,
|
|
156
|
-
node:
|
|
157
|
-
isEmptyDoc:
|
|
158
|
-
hasAnchor:
|
|
159
|
-
classes: { emptyNode:
|
|
160
|
-
} =
|
|
161
|
-
return
|
|
162
|
-
class:
|
|
163
|
-
[
|
|
164
|
-
editor:
|
|
165
|
-
node:
|
|
156
|
+
node: a,
|
|
157
|
+
isEmptyDoc: s,
|
|
158
|
+
hasAnchor: c,
|
|
159
|
+
classes: { emptyNode: l, emptyEditor: i }
|
|
160
|
+
} = e, d = [l];
|
|
161
|
+
return s && d.push(i), S.node(r, r + a.nodeSize, {
|
|
162
|
+
class: d.join(" "),
|
|
163
|
+
[n]: typeof o == "function" ? o({
|
|
164
|
+
editor: t,
|
|
165
|
+
node: a,
|
|
166
166
|
pos: r,
|
|
167
|
-
hasAnchor:
|
|
168
|
-
}) :
|
|
167
|
+
hasAnchor: c
|
|
168
|
+
}) : o
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
return typeof
|
|
171
|
+
function N(e, t) {
|
|
172
|
+
return typeof e == "function" ? e(t) : e;
|
|
173
173
|
}
|
|
174
174
|
function $({
|
|
175
|
-
editor:
|
|
176
|
-
options:
|
|
177
|
-
dataAttribute:
|
|
178
|
-
doc:
|
|
175
|
+
editor: e,
|
|
176
|
+
options: t,
|
|
177
|
+
dataAttribute: o,
|
|
178
|
+
doc: n,
|
|
179
179
|
selection: r
|
|
180
180
|
}) {
|
|
181
|
-
var
|
|
182
|
-
if (!(
|
|
181
|
+
var a, s;
|
|
182
|
+
if (!(e.isEditable || !t.showOnlyWhenEditable))
|
|
183
183
|
return null;
|
|
184
|
-
const { anchor:
|
|
185
|
-
if (
|
|
186
|
-
const u =
|
|
184
|
+
const { anchor: l } = r, i = [], d = e.isEmpty;
|
|
185
|
+
if (t.showOnlyCurrent && !t.includeChildren) {
|
|
186
|
+
const u = n.resolve(l), p = u.depth > 0 ? u.node(1) : u.nodeAfter, h = u.depth > 0 ? u.before(1) : l;
|
|
187
187
|
if (p && p.type.isTextblock && E(p)) {
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
editor:
|
|
192
|
-
isEmptyDoc:
|
|
193
|
-
dataAttribute:
|
|
194
|
-
hasAnchor:
|
|
195
|
-
placeholder:
|
|
188
|
+
const f = l >= h && l <= h + p.nodeSize;
|
|
189
|
+
i.push(
|
|
190
|
+
T({
|
|
191
|
+
editor: e,
|
|
192
|
+
isEmptyDoc: d,
|
|
193
|
+
dataAttribute: o,
|
|
194
|
+
hasAnchor: f,
|
|
195
|
+
placeholder: t.placeholder,
|
|
196
196
|
classes: {
|
|
197
|
-
emptyEditor:
|
|
198
|
-
emptyNode:
|
|
199
|
-
editor:
|
|
197
|
+
emptyEditor: t.emptyEditorClass,
|
|
198
|
+
emptyNode: N(t.emptyNodeClass, {
|
|
199
|
+
editor: e,
|
|
200
200
|
node: p,
|
|
201
|
-
pos:
|
|
202
|
-
hasAnchor:
|
|
201
|
+
pos: h,
|
|
202
|
+
hasAnchor: f
|
|
203
203
|
})
|
|
204
204
|
},
|
|
205
205
|
node: p,
|
|
206
|
-
pos:
|
|
206
|
+
pos: h
|
|
207
207
|
})
|
|
208
208
|
);
|
|
209
209
|
}
|
|
210
210
|
} else {
|
|
211
|
-
const u =
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
return
|
|
215
|
-
|
|
216
|
-
editor:
|
|
217
|
-
isEmptyDoc:
|
|
218
|
-
dataAttribute:
|
|
219
|
-
hasAnchor:
|
|
220
|
-
placeholder:
|
|
211
|
+
const u = y.getState(e.state), p = (a = u?.topPos) != null ? a : 0, h = (s = u?.bottomPos) != null ? s : n.content.size;
|
|
212
|
+
n.nodesBetween(p, h, (f, C) => {
|
|
213
|
+
const w = l >= C && l <= C + f.nodeSize, O = !f.isLeaf && E(f);
|
|
214
|
+
return f.type.isTextblock && (w || !t.showOnlyCurrent) && O && i.push(
|
|
215
|
+
T({
|
|
216
|
+
editor: e,
|
|
217
|
+
isEmptyDoc: d,
|
|
218
|
+
dataAttribute: o,
|
|
219
|
+
hasAnchor: w,
|
|
220
|
+
placeholder: t.placeholder,
|
|
221
221
|
classes: {
|
|
222
|
-
emptyEditor:
|
|
223
|
-
emptyNode:
|
|
224
|
-
editor:
|
|
225
|
-
node:
|
|
226
|
-
pos:
|
|
227
|
-
hasAnchor:
|
|
222
|
+
emptyEditor: t.emptyEditorClass,
|
|
223
|
+
emptyNode: N(t.emptyNodeClass, {
|
|
224
|
+
editor: e,
|
|
225
|
+
node: f,
|
|
226
|
+
pos: C,
|
|
227
|
+
hasAnchor: w
|
|
228
228
|
})
|
|
229
229
|
},
|
|
230
|
-
node:
|
|
231
|
-
pos:
|
|
230
|
+
node: f,
|
|
231
|
+
pos: C
|
|
232
232
|
})
|
|
233
|
-
),
|
|
233
|
+
), t.includeChildren;
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
|
-
return
|
|
236
|
+
return b.create(n, i);
|
|
237
237
|
}
|
|
238
|
-
function V(
|
|
239
|
-
return
|
|
238
|
+
function V(e) {
|
|
239
|
+
return e.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
240
240
|
}
|
|
241
|
-
function G(
|
|
242
|
-
const
|
|
243
|
-
return /auto|scroll|overlay/.test(
|
|
241
|
+
function G(e) {
|
|
242
|
+
const t = getComputedStyle(e), o = `${t.overflow} ${t.overflowY} ${t.overflowX}`;
|
|
243
|
+
return /auto|scroll|overlay/.test(o);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
let
|
|
247
|
-
for (;
|
|
248
|
-
if (G(
|
|
249
|
-
return
|
|
250
|
-
const
|
|
251
|
-
if (!
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
254
|
-
|
|
245
|
+
function X(e) {
|
|
246
|
+
let t = e;
|
|
247
|
+
for (; t; ) {
|
|
248
|
+
if (G(t))
|
|
249
|
+
return t;
|
|
250
|
+
const o = t.parentElement;
|
|
251
|
+
if (!o) {
|
|
252
|
+
const n = t.getRootNode();
|
|
253
|
+
if (n instanceof ShadowRoot) {
|
|
254
|
+
t = n.host;
|
|
255
255
|
continue;
|
|
256
256
|
}
|
|
257
257
|
return window;
|
|
258
258
|
}
|
|
259
|
-
|
|
259
|
+
t = o;
|
|
260
260
|
}
|
|
261
261
|
return window;
|
|
262
262
|
}
|
|
263
|
-
function
|
|
264
|
-
return
|
|
263
|
+
function j(e) {
|
|
264
|
+
return e === window ? { top: 0, bottom: window.innerHeight } : e.getBoundingClientRect();
|
|
265
265
|
}
|
|
266
|
-
function
|
|
267
|
-
doc: t,
|
|
266
|
+
function U({
|
|
268
267
|
view: e,
|
|
269
|
-
scrollContainer:
|
|
268
|
+
scrollContainer: t
|
|
270
269
|
}) {
|
|
271
|
-
const o = e.dom.getBoundingClientRect()
|
|
272
|
-
if (
|
|
273
|
-
return
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
270
|
+
const o = e.dom.getBoundingClientRect();
|
|
271
|
+
if (o.width <= 0 || o.height <= 0)
|
|
272
|
+
return null;
|
|
273
|
+
const n = t ? j(t) : { top: 0, bottom: window.innerHeight }, r = Math.max(o.top, n.top) - M, a = Math.min(o.bottom, n.bottom) + M;
|
|
274
|
+
if (r >= a)
|
|
275
|
+
return null;
|
|
276
|
+
const s = o.left + 1, c = o.right - 1;
|
|
277
|
+
if (s > c)
|
|
278
|
+
return null;
|
|
279
|
+
const i = getComputedStyle(e.dom).direction === "rtl" ? o.right - 2 : o.left + 2, d = Math.min(Math.max(i, s), c), m = Math.max(r + 2, o.top + 1), u = Math.min(a - 2, o.bottom - 1);
|
|
280
|
+
if (m > u)
|
|
281
|
+
return null;
|
|
282
|
+
const p = e.posAtCoords({ left: d, top: m }), h = e.posAtCoords({ left: d, top: u });
|
|
283
|
+
return !p || !h ? null : { top: p.pos, bottom: h.pos };
|
|
279
284
|
}
|
|
280
|
-
var
|
|
285
|
+
var W = {
|
|
281
286
|
/**
|
|
282
287
|
* Initialises the viewport state with no known positions.
|
|
283
288
|
* @returns The initial viewport state.
|
|
@@ -291,55 +296,61 @@ var q = {
|
|
|
291
296
|
* @param prev - The previous viewport state.
|
|
292
297
|
* @returns The next viewport state.
|
|
293
298
|
*/
|
|
294
|
-
apply(
|
|
295
|
-
const
|
|
296
|
-
return
|
|
297
|
-
topPos:
|
|
298
|
-
bottomPos:
|
|
299
|
-
} :
|
|
299
|
+
apply(e, t) {
|
|
300
|
+
const o = e.getMeta(y);
|
|
301
|
+
return o?.positions ? { topPos: o.positions.top, bottomPos: o.positions.bottom } : e.docChanged ? {
|
|
302
|
+
topPos: t.topPos !== null ? e.mapping.map(t.topPos) : null,
|
|
303
|
+
bottomPos: t.bottomPos !== null ? e.mapping.map(t.bottomPos) : null
|
|
304
|
+
} : t;
|
|
300
305
|
}
|
|
301
306
|
};
|
|
302
|
-
function
|
|
303
|
-
const
|
|
304
|
-
const
|
|
305
|
-
view:
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
307
|
+
function q(e) {
|
|
308
|
+
const t = X(e.dom), o = () => {
|
|
309
|
+
const i = U({
|
|
310
|
+
view: e,
|
|
311
|
+
scrollContainer: t
|
|
312
|
+
});
|
|
313
|
+
if (i === null)
|
|
314
|
+
return;
|
|
315
|
+
const d = y.getState(e.state);
|
|
316
|
+
if (d?.topPos === i.top && d?.bottomPos === i.bottom)
|
|
310
317
|
return;
|
|
311
|
-
const
|
|
312
|
-
|
|
318
|
+
const m = e.state.tr.setMeta(y, { positions: i });
|
|
319
|
+
e.dispatch(m);
|
|
313
320
|
};
|
|
314
|
-
let
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
const
|
|
319
|
-
|
|
321
|
+
let n = null, r = 0;
|
|
322
|
+
const a = 150, s = () => {
|
|
323
|
+
n === null && (n = requestAnimationFrame(() => {
|
|
324
|
+
n = null;
|
|
325
|
+
const i = performance.now();
|
|
326
|
+
i - r >= a ? (r = i, o()) : s();
|
|
320
327
|
}));
|
|
321
328
|
};
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
329
|
+
t.addEventListener("scroll", s, { passive: !0 });
|
|
330
|
+
const c = typeof ResizeObserver < "u" ? new ResizeObserver(s) : null;
|
|
331
|
+
c?.observe(e.dom);
|
|
332
|
+
const l = typeof IntersectionObserver < "u" ? new IntersectionObserver(s) : null;
|
|
333
|
+
return l?.observe(e.dom), e.dom.addEventListener("focus", s), o(), {
|
|
334
|
+
update(i, d) {
|
|
335
|
+
e.state.doc.content.size !== d.doc.content.size && s();
|
|
325
336
|
},
|
|
326
337
|
destroy: () => {
|
|
327
|
-
|
|
338
|
+
n !== null && cancelAnimationFrame(n), t.removeEventListener("scroll", s), c?.disconnect(), l?.disconnect(), e.dom.removeEventListener("focus", s);
|
|
328
339
|
}
|
|
329
340
|
};
|
|
330
341
|
}
|
|
331
|
-
function
|
|
332
|
-
const
|
|
333
|
-
return new
|
|
334
|
-
key:
|
|
335
|
-
state:
|
|
336
|
-
view:
|
|
342
|
+
function K({ editor: e, options: t }) {
|
|
343
|
+
const o = t.dataAttribute ? `data-${V(t.dataAttribute)}` : `data-${A}`;
|
|
344
|
+
return new v({
|
|
345
|
+
key: y,
|
|
346
|
+
state: W,
|
|
347
|
+
view: q,
|
|
337
348
|
props: {
|
|
338
|
-
decorations: ({ doc:
|
|
349
|
+
decorations: ({ doc: n, selection: r }) => $({ editor: e, options: t, dataAttribute: o, doc: n, selection: r })
|
|
339
350
|
}
|
|
340
351
|
});
|
|
341
352
|
}
|
|
342
|
-
|
|
353
|
+
g.create({
|
|
343
354
|
name: "placeholder",
|
|
344
355
|
addOptions() {
|
|
345
356
|
return {
|
|
@@ -353,17 +364,17 @@ h.create({
|
|
|
353
364
|
};
|
|
354
365
|
},
|
|
355
366
|
addProseMirrorPlugins() {
|
|
356
|
-
return [
|
|
367
|
+
return [K({ editor: this.editor, options: this.options })];
|
|
357
368
|
}
|
|
358
369
|
});
|
|
359
|
-
var
|
|
370
|
+
var H = `.ProseMirror:not(.ProseMirror-focused) *::selection {
|
|
360
371
|
background: transparent;
|
|
361
372
|
}
|
|
362
373
|
|
|
363
374
|
.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
|
|
364
375
|
background: transparent;
|
|
365
376
|
}`;
|
|
366
|
-
|
|
377
|
+
g.create({
|
|
367
378
|
name: "selection",
|
|
368
379
|
addOptions() {
|
|
369
380
|
return {
|
|
@@ -371,15 +382,15 @@ h.create({
|
|
|
371
382
|
};
|
|
372
383
|
},
|
|
373
384
|
addProseMirrorPlugins() {
|
|
374
|
-
const { editor:
|
|
375
|
-
return
|
|
376
|
-
new
|
|
377
|
-
key: new
|
|
385
|
+
const { editor: e, options: t } = this;
|
|
386
|
+
return e.options.injectCSS && typeof document < "u" && _(H, e.options.injectNonce, "selection"), [
|
|
387
|
+
new v({
|
|
388
|
+
key: new P("selection"),
|
|
378
389
|
props: {
|
|
379
|
-
decorations(
|
|
380
|
-
return
|
|
381
|
-
|
|
382
|
-
class:
|
|
390
|
+
decorations(o) {
|
|
391
|
+
return o.selection.empty || e.isFocused || !e.isEditable || L(o.selection) || e.view.dragging ? null : b.create(o.doc, [
|
|
392
|
+
S.inline(o.selection.from, o.selection.to, {
|
|
393
|
+
class: t.className
|
|
383
394
|
})
|
|
384
395
|
]);
|
|
385
396
|
}
|
|
@@ -390,12 +401,12 @@ h.create({
|
|
|
390
401
|
});
|
|
391
402
|
var Y = "skipTrailingNode";
|
|
392
403
|
function z({
|
|
393
|
-
types:
|
|
394
|
-
node:
|
|
404
|
+
types: e,
|
|
405
|
+
node: t
|
|
395
406
|
}) {
|
|
396
|
-
return
|
|
407
|
+
return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
|
|
397
408
|
}
|
|
398
|
-
var
|
|
409
|
+
var se = g.create({
|
|
399
410
|
name: "trailingNode",
|
|
400
411
|
addOptions() {
|
|
401
412
|
return {
|
|
@@ -404,32 +415,32 @@ var st = h.create({
|
|
|
404
415
|
};
|
|
405
416
|
},
|
|
406
417
|
addProseMirrorPlugins() {
|
|
407
|
-
var
|
|
408
|
-
const
|
|
418
|
+
var e;
|
|
419
|
+
const t = new P(this.name), o = this.options.node || ((e = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : e.name) || "paragraph", n = Object.entries(this.editor.schema.nodes).map(([, r]) => r).filter((r) => (this.options.notAfter || []).concat(o).includes(r.name));
|
|
409
420
|
return [
|
|
410
|
-
new
|
|
411
|
-
key:
|
|
412
|
-
appendTransaction: (r,
|
|
413
|
-
const { doc:
|
|
414
|
-
if (!r.some((p) => p.getMeta(Y)) &&
|
|
415
|
-
return
|
|
421
|
+
new v({
|
|
422
|
+
key: t,
|
|
423
|
+
appendTransaction: (r, a, s) => {
|
|
424
|
+
const { doc: c, tr: l, schema: i } = s, d = t.getState(s), m = c.content.size, u = i.nodes[o];
|
|
425
|
+
if (!r.some((p) => p.getMeta(Y)) && d)
|
|
426
|
+
return l.insert(m, u.create());
|
|
416
427
|
},
|
|
417
428
|
state: {
|
|
418
|
-
init: (r,
|
|
419
|
-
const
|
|
420
|
-
return !z({ node:
|
|
429
|
+
init: (r, a) => {
|
|
430
|
+
const s = a.tr.doc.lastChild;
|
|
431
|
+
return !z({ node: s, types: n });
|
|
421
432
|
},
|
|
422
|
-
apply: (r,
|
|
433
|
+
apply: (r, a) => {
|
|
423
434
|
if (!r.docChanged || r.getMeta("__uniqueIDTransaction"))
|
|
424
|
-
return
|
|
425
|
-
const
|
|
426
|
-
return !z({ node:
|
|
435
|
+
return a;
|
|
436
|
+
const s = r.doc.lastChild;
|
|
437
|
+
return !z({ node: s, types: n });
|
|
427
438
|
}
|
|
428
439
|
}
|
|
429
440
|
})
|
|
430
441
|
];
|
|
431
442
|
}
|
|
432
|
-
}),
|
|
443
|
+
}), ie = g.create({
|
|
433
444
|
name: "undoRedo",
|
|
434
445
|
addOptions() {
|
|
435
446
|
return {
|
|
@@ -439,8 +450,8 @@ var st = h.create({
|
|
|
439
450
|
},
|
|
440
451
|
addCommands() {
|
|
441
452
|
return {
|
|
442
|
-
undo: () => ({ state:
|
|
443
|
-
redo: () => ({ state:
|
|
453
|
+
undo: () => ({ state: e, dispatch: t }) => F(e, t),
|
|
454
|
+
redo: () => ({ state: e, dispatch: t }) => I(e, t)
|
|
444
455
|
};
|
|
445
456
|
},
|
|
446
457
|
addProseMirrorPlugins() {
|
|
@@ -459,11 +470,11 @@ var st = h.create({
|
|
|
459
470
|
});
|
|
460
471
|
export {
|
|
461
472
|
A as DEFAULT_DATA_ATTRIBUTE,
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
473
|
+
ne as Dropcursor,
|
|
474
|
+
re as Gapcursor,
|
|
475
|
+
y as PLUGIN_KEY,
|
|
476
|
+
se as TrailingNode,
|
|
477
|
+
ie as UndoRedo,
|
|
467
478
|
V as preparePlaceholderAttribute,
|
|
468
479
|
Y as skipTrailingNodeMeta
|
|
469
480
|
};
|