@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.
@@ -1,18 +1,18 @@
1
- import { Extension as h, callOrReturn as x, getExtensionField as O, createStyleTag as _, isNodeSelection as D, isNodeEmpty as E } from "../../core/dist/index.js";
2
- import { PluginKey as y, Plugin as P } from "../../../prosemirror-state/dist/index.js";
3
- import { dropCursor as L } from "../../../prosemirror-dropcursor/dist/index.js";
4
- import { DecorationSet as v, Decoration as b } from "../../../prosemirror-view/dist/index.js";
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 F, undo as I } from "../../../prosemirror-history/dist/index.js";
7
- h.create({
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: (t) => t.length,
15
- wordCounter: (t) => t.split(" ").filter((e) => e !== "").length
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 = (t) => {
26
- const e = t?.node || this.editor.state.doc;
27
- if ((t?.mode || this.options.mode) === "textSize") {
28
- const o = e.textBetween(0, e.content.size, void 0, " ");
29
- return this.options.textCounter(o);
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 e.nodeSize;
32
- }, this.storage.words = (t) => {
33
- const e = t?.node || this.editor.state.doc, n = e.textBetween(0, e.content.size, " ", " ");
34
- return this.options.wordCounter(n);
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 t = !1;
38
+ let e = !1;
39
39
  return [
40
- new P({
41
- key: new y("characterCount"),
42
- appendTransaction: (e, n, o) => {
43
- if (t)
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, i = this.options.autoTrim;
46
- if (r == null || r === 0 || i === !1) {
47
- t = !0;
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 a = this.storage.characters({ node: o.doc });
51
- if (a > r) {
52
- const d = a - r, s = 0, c = d;
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 l = o.tr.deleteRange(s, c);
57
- return t = !0, l;
56
+ const d = n.tr.deleteRange(l, i);
57
+ return e = !0, d;
58
58
  }
59
- t = !0;
59
+ e = !0;
60
60
  },
61
- filterTransaction: (e, n) => {
62
- const o = this.options.limit;
63
- if (!e.docChanged || o === 0 || o === null || o === void 0)
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: n.doc }), i = this.storage.characters({ node: e.doc });
66
- if (i <= o || r > o && i > o && i <= r)
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 > o && i > o && i > r || !e.getMeta("paste"))
68
+ if (r > n && a > n && a > r || !t.getMeta("paste"))
69
69
  return !1;
70
- const d = e.selection.$head.pos, s = i - o, c = d - s, l = d;
71
- return e.deleteRange(c, l), !(this.storage.characters({ node: e.doc }) > o);
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 nt = h.create({
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 [L(this.options)];
87
+ return [D(this.options)];
88
88
  }
89
89
  });
90
- h.create({
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 P({
101
- key: new y("focus"),
100
+ new v({
101
+ key: new P("focus"),
102
102
  props: {
103
- decorations: ({ doc: t, selection: e }) => {
104
- const { isEditable: n, isFocused: o } = this.editor, { anchor: r } = e, i = [];
105
- if (!n || !o)
106
- return v.create(t, []);
107
- let a = 0;
108
- this.options.mode === "deepest" && t.descendants((s, c) => {
109
- if (s.isText)
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 >= c && r <= c + s.nodeSize - 1))
111
+ if (!(r >= i && r <= i + l.nodeSize - 1))
112
112
  return !1;
113
- a += 1;
113
+ s += 1;
114
114
  });
115
- let d = 0;
116
- return t.descendants((s, c) => {
117
- if (s.isText || !(r >= c && r <= c + s.nodeSize - 1))
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 (d += 1, this.options.mode === "deepest" && a - d > 0 || this.options.mode === "shallowest" && d > 1)
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
- i.push(
122
- b.node(c, c + s.nodeSize, {
121
+ a.push(
122
+ S.node(i, i + l.nodeSize, {
123
123
  class: this.options.className
124
124
  })
125
125
  );
126
- }), v.create(t, i);
126
+ }), b.create(e, a);
127
127
  }
128
128
  }
129
129
  })
130
130
  ];
131
131
  }
132
132
  });
133
- var rt = h.create({
133
+ var re = g.create({
134
134
  name: "gapCursor",
135
135
  addProseMirrorPlugins() {
136
136
  return [k()];
137
137
  },
138
- extendNodeSchema(t) {
139
- var e;
140
- const n = {
141
- name: t.name,
142
- options: t.options,
143
- storage: t.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: (e = x(O(t, "allowGapCursor", n))) != null ? e : null
146
+ allowGapCursor: (t = R(x(e, "allowGapCursor", o))) != null ? t : null
147
147
  };
148
148
  }
149
- }), A = "placeholder", g = new y("tiptap__placeholder"), M = 200;
150
- function N(t) {
149
+ }), A = "placeholder", y = new P("tiptap__placeholder"), M = 200;
150
+ function T(e) {
151
151
  const {
152
- editor: e,
153
- placeholder: n,
154
- dataAttribute: o,
152
+ editor: t,
153
+ placeholder: o,
154
+ dataAttribute: n,
155
155
  pos: r,
156
- node: i,
157
- isEmptyDoc: a,
158
- hasAnchor: d,
159
- classes: { emptyNode: s, emptyEditor: c }
160
- } = t, l = [s];
161
- return a && l.push(c), b.node(r, r + i.nodeSize, {
162
- class: l.join(" "),
163
- [o]: typeof n == "function" ? n({
164
- editor: e,
165
- node: i,
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: d
168
- }) : n
167
+ hasAnchor: c
168
+ }) : o
169
169
  });
170
170
  }
171
- function T(t, e) {
172
- return typeof t == "function" ? t(e) : t;
171
+ function N(e, t) {
172
+ return typeof e == "function" ? e(t) : e;
173
173
  }
174
174
  function $({
175
- editor: t,
176
- options: e,
177
- dataAttribute: n,
178
- doc: o,
175
+ editor: e,
176
+ options: t,
177
+ dataAttribute: o,
178
+ doc: n,
179
179
  selection: r
180
180
  }) {
181
- var i, a;
182
- if (!(t.isEditable || !e.showOnlyWhenEditable))
181
+ var a, s;
182
+ if (!(e.isEditable || !t.showOnlyWhenEditable))
183
183
  return null;
184
- const { anchor: s } = r, c = [], l = t.isEmpty;
185
- if (e.showOnlyCurrent && !e.includeChildren) {
186
- const u = o.resolve(s), p = u.depth > 0 ? u.node(1) : u.nodeAfter, f = u.depth > 0 ? u.before(1) : s;
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 m = s >= f && s <= f + p.nodeSize;
189
- c.push(
190
- N({
191
- editor: t,
192
- isEmptyDoc: l,
193
- dataAttribute: n,
194
- hasAnchor: m,
195
- placeholder: e.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: e.emptyEditorClass,
198
- emptyNode: T(e.emptyNodeClass, {
199
- editor: t,
197
+ emptyEditor: t.emptyEditorClass,
198
+ emptyNode: N(t.emptyNodeClass, {
199
+ editor: e,
200
200
  node: p,
201
- pos: f,
202
- hasAnchor: m
201
+ pos: h,
202
+ hasAnchor: f
203
203
  })
204
204
  },
205
205
  node: p,
206
- pos: f
206
+ pos: h
207
207
  })
208
208
  );
209
209
  }
210
210
  } else {
211
- const u = g.getState(t.state), p = (i = u?.topPos) != null ? i : 0, f = (a = u?.bottomPos) != null ? a : o.content.size;
212
- o.nodesBetween(p, f, (m, w) => {
213
- const S = s >= w && s <= w + m.nodeSize, R = !m.isLeaf && E(m);
214
- return m.type.isTextblock && (S || !e.showOnlyCurrent) && R && c.push(
215
- N({
216
- editor: t,
217
- isEmptyDoc: l,
218
- dataAttribute: n,
219
- hasAnchor: S,
220
- placeholder: e.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: e.emptyEditorClass,
223
- emptyNode: T(e.emptyNodeClass, {
224
- editor: t,
225
- node: m,
226
- pos: w,
227
- hasAnchor: S
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: m,
231
- pos: w
230
+ node: f,
231
+ pos: C
232
232
  })
233
- ), e.includeChildren;
233
+ ), t.includeChildren;
234
234
  });
235
235
  }
236
- return v.create(o, c);
236
+ return b.create(n, i);
237
237
  }
238
- function V(t) {
239
- return t.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
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(t) {
242
- const e = getComputedStyle(t), n = `${e.overflow} ${e.overflowY} ${e.overflowX}`;
243
- return /auto|scroll|overlay/.test(n);
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 j(t) {
246
- let e = t;
247
- for (; e; ) {
248
- if (G(e))
249
- return e;
250
- const n = e.parentElement;
251
- if (!n) {
252
- const o = e.getRootNode();
253
- if (o instanceof ShadowRoot) {
254
- e = o.host;
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
- e = n;
259
+ t = o;
260
260
  }
261
261
  return window;
262
262
  }
263
- function U(t) {
264
- return t === window ? { top: 0, bottom: window.innerHeight } : t.getBoundingClientRect();
263
+ function j(e) {
264
+ return e === window ? { top: 0, bottom: window.innerHeight } : e.getBoundingClientRect();
265
265
  }
266
- function W({
267
- doc: t,
266
+ function U({
268
267
  view: e,
269
- scrollContainer: n
268
+ scrollContainer: t
270
269
  }) {
271
- const o = e.dom.getBoundingClientRect(), r = n ? U(n) : { top: 0, bottom: window.innerHeight }, i = Math.max(o.top, r.top) - M, a = Math.min(o.bottom, r.bottom) + M;
272
- if (i >= a)
273
- return { top: 0, bottom: t.content.size };
274
- const s = getComputedStyle(e.dom).direction === "rtl" ? Math.max(o.right - 2, o.left + 2) : o.left + 2, c = e.posAtCoords({ left: s, top: i + 2 }), l = e.posAtCoords({ left: s, top: a - 2 });
275
- return {
276
- top: c ? c.pos : 0,
277
- bottom: l ? l.pos : t.content.size
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 q = {
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(t, e) {
295
- const n = t.getMeta(g);
296
- return n?.positions ? { topPos: n.positions.top, bottomPos: n.positions.bottom } : t.docChanged ? {
297
- topPos: e.topPos !== null ? t.mapping.map(e.topPos) : null,
298
- bottomPos: e.bottomPos !== null ? t.mapping.map(e.bottomPos) : null
299
- } : e;
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 K(t) {
303
- const e = j(t.dom), n = () => {
304
- const d = W({
305
- view: t,
306
- doc: t.state.doc,
307
- scrollContainer: e
308
- }), s = g.getState(t.state);
309
- if (s?.topPos === d.top && s?.bottomPos === d.bottom)
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 c = t.state.tr.setMeta(g, { positions: d });
312
- t.dispatch(c);
318
+ const m = e.state.tr.setMeta(y, { positions: i });
319
+ e.dispatch(m);
313
320
  };
314
- let o = null, r = 0;
315
- const i = 150, a = () => {
316
- o === null && (o = requestAnimationFrame(() => {
317
- o = null;
318
- const d = performance.now();
319
- d - r >= i ? (r = d, n()) : a();
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
- return e.addEventListener("scroll", a, { passive: !0 }), n(), {
323
- update(d, s) {
324
- t.state.doc.content.size !== s.doc.content.size && a();
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
- o !== null && cancelAnimationFrame(o), e.removeEventListener("scroll", a);
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 H({ editor: t, options: e }) {
332
- const n = e.dataAttribute ? `data-${V(e.dataAttribute)}` : `data-${A}`;
333
- return new P({
334
- key: g,
335
- state: q,
336
- view: K,
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: o, selection: r }) => $({ editor: t, options: e, dataAttribute: n, doc: o, selection: r })
349
+ decorations: ({ doc: n, selection: r }) => $({ editor: e, options: t, dataAttribute: o, doc: n, selection: r })
339
350
  }
340
351
  });
341
352
  }
342
- h.create({
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 [H({ editor: this.editor, options: this.options })];
367
+ return [K({ editor: this.editor, options: this.options })];
357
368
  }
358
369
  });
359
- var X = `.ProseMirror:not(.ProseMirror-focused) *::selection {
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
- h.create({
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: t, options: e } = this;
375
- return t.options.injectCSS && typeof document < "u" && _(X, t.options.injectNonce, "selection"), [
376
- new P({
377
- key: new y("selection"),
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(n) {
380
- return n.selection.empty || t.isFocused || !t.isEditable || D(n.selection) || t.view.dragging ? null : v.create(n.doc, [
381
- b.inline(n.selection.from, n.selection.to, {
382
- class: e.className
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: t,
394
- node: e
404
+ types: e,
405
+ node: t
395
406
  }) {
396
- return e && Array.isArray(t) && t.includes(e.type) || e?.type === t;
407
+ return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
397
408
  }
398
- var st = h.create({
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 t;
408
- const e = new y(this.name), n = this.options.node || ((t = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : t.name) || "paragraph", o = Object.entries(this.editor.schema.nodes).map(([, r]) => r).filter((r) => (this.options.notAfter || []).concat(n).includes(r.name));
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 P({
411
- key: e,
412
- appendTransaction: (r, i, a) => {
413
- const { doc: d, tr: s, schema: c } = a, l = e.getState(a), C = d.content.size, u = c.nodes[n];
414
- if (!r.some((p) => p.getMeta(Y)) && l)
415
- return s.insert(C, u.create());
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, i) => {
419
- const a = i.tr.doc.lastChild;
420
- return !z({ node: a, types: o });
429
+ init: (r, a) => {
430
+ const s = a.tr.doc.lastChild;
431
+ return !z({ node: s, types: n });
421
432
  },
422
- apply: (r, i) => {
433
+ apply: (r, a) => {
423
434
  if (!r.docChanged || r.getMeta("__uniqueIDTransaction"))
424
- return i;
425
- const a = r.doc.lastChild;
426
- return !z({ node: a, types: o });
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
- }), it = h.create({
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: t, dispatch: e }) => I(t, e),
443
- redo: () => ({ state: t, dispatch: e }) => F(t, e)
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
- nt as Dropcursor,
463
- rt as Gapcursor,
464
- g as PLUGIN_KEY,
465
- st as TrailingNode,
466
- it as UndoRedo,
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
  };