@damiro/stylo 0.11.0 → 0.13.0
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/README.md +16 -6
- package/dist/{InPlaceView-Dyf7I4XQ.js → InPlaceView-BGVCST5f.js} +449 -448
- package/dist/{InPlaceView-Dyf7I4XQ.js.map → InPlaceView-BGVCST5f.js.map} +1 -1
- package/dist/Preview-C5Oi_jpI.js +238 -0
- package/dist/Preview-C5Oi_jpI.js.map +1 -0
- package/dist/SplitView.d.ts +3 -2
- package/dist/SplitView.d.ts.map +1 -1
- package/dist/Stylo.d.ts.map +1 -1
- package/dist/editor/SourceView.d.ts +5 -3
- package/dist/editor/SourceView.d.ts.map +1 -1
- package/dist/editor/extensions.d.ts +2 -2
- package/dist/editor/extensions.d.ts.map +1 -1
- package/dist/editor/highlight.d.ts +20 -0
- package/dist/editor/highlight.d.ts.map +1 -1
- package/dist/editor/tag-complete.d.ts +16 -0
- package/dist/editor/tag-complete.d.ts.map +1 -0
- package/dist/editor/useCodeMirror.d.ts +8 -3
- package/dist/editor/useCodeMirror.d.ts.map +1 -1
- package/dist/highlight-DNGJlCDY.js +133 -0
- package/dist/highlight-DNGJlCDY.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/inplace/InPlaceView.d.ts +5 -3
- package/dist/inplace/InPlaceView.d.ts.map +1 -1
- package/dist/render/CodeBlock.d.ts +18 -0
- package/dist/render/CodeBlock.d.ts.map +1 -0
- package/dist/render/Preview.d.ts +9 -2
- package/dist/render/Preview.d.ts.map +1 -1
- package/dist/render/highlightCode.d.ts +10 -0
- package/dist/render/highlightCode.d.ts.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/stylo.js +120 -113
- package/dist/stylo.js.map +1 -1
- package/dist/types.d.ts +35 -12
- package/dist/types.d.ts.map +1 -1
- package/dist/{useCodeMirror-CjG9CwpB.js → useCodeMirror-COmcRrUo.js} +348 -387
- package/dist/useCodeMirror-COmcRrUo.js.map +1 -0
- package/package.json +1 -1
- package/dist/Preview-DIsFdBFA.js +0 -170
- package/dist/Preview-DIsFdBFA.js.map +0 -1
- package/dist/frontmatter-DTCC0gaa.js +0 -40
- package/dist/frontmatter-DTCC0gaa.js.map +0 -1
- package/dist/useCodeMirror-CjG9CwpB.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { S as r, _ as i, a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, l as p, m, n as h, o as
|
|
3
|
-
import { a as
|
|
4
|
-
import { a as
|
|
5
|
-
import { t as
|
|
6
|
-
import { useRef as
|
|
7
|
-
import { Decoration as
|
|
8
|
-
import { createPortal as
|
|
9
|
-
import { Annotation as
|
|
10
|
-
import { syntaxTree as
|
|
11
|
-
import { jsx as
|
|
1
|
+
import { a as e, o as t, r as n } from "./highlight-DNGJlCDY.js";
|
|
2
|
+
import { S as r, _ as i, a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, l as p, m, n as h, o as g, p as _, r as ee, s as v, t as te, u as ne, v as re, x as y, y as b } from "./useCodeMirror-COmcRrUo.js";
|
|
3
|
+
import { a as ie, i as x } from "./config-DTBxVhtH.js";
|
|
4
|
+
import { a as S, n as ae, o as oe, r as C, t as w } from "./embed-Dsu6b-MV.js";
|
|
5
|
+
import { t as se } from "./katex-BfiLlqfN.js";
|
|
6
|
+
import { useRef as T, useState as E, useSyncExternalStore as ce } from "react";
|
|
7
|
+
import { Decoration as D, EditorView as O, ViewPlugin as k, WidgetType as A, hoverTooltip as le, keymap as j, showPanel as ue } from "@codemirror/view";
|
|
8
|
+
import { createPortal as de } from "react-dom";
|
|
9
|
+
import { Annotation as fe, EditorSelection as pe, EditorState as me, Facet as M, Prec as N, StateEffect as he, StateField as P } from "@codemirror/state";
|
|
10
|
+
import { syntaxTree as F } from "@codemirror/language";
|
|
11
|
+
import { jsx as ge, jsxs as _e } from "react/jsx-runtime";
|
|
12
12
|
//#region src/inplace/embed-registry.ts
|
|
13
|
-
var
|
|
13
|
+
var ve = class {
|
|
14
14
|
slots = /* @__PURE__ */ new Map();
|
|
15
15
|
listeners = /* @__PURE__ */ new Set();
|
|
16
16
|
snapshot = [];
|
|
@@ -33,7 +33,7 @@ var be = class {
|
|
|
33
33
|
for (let e of this.listeners) e();
|
|
34
34
|
}));
|
|
35
35
|
}
|
|
36
|
-
},
|
|
36
|
+
}, ye = {
|
|
37
37
|
headings: !0,
|
|
38
38
|
emphasis: !0,
|
|
39
39
|
links: !0,
|
|
@@ -48,19 +48,19 @@ var be = class {
|
|
|
48
48
|
tables: !0,
|
|
49
49
|
embeds: !0
|
|
50
50
|
};
|
|
51
|
-
function
|
|
51
|
+
function be(e) {
|
|
52
52
|
return {
|
|
53
|
-
...
|
|
53
|
+
...ye,
|
|
54
54
|
...e?.decorations
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
var
|
|
57
|
+
var I = M.define({ combine: (e) => e[0] ?? ye }), L = M.define({ combine: (e) => e[0] ?? null }), xe = M.define({ combine: (e) => e[0] ?? "source" }), R = M.define({ combine: (e) => e[0] ?? "caret" }), Se = M.define({ combine: (e) => e[0] ?? null }), Ce = M.define({ combine: (e) => e[0] ?? !0 }), we = [
|
|
58
58
|
"link",
|
|
59
59
|
"format",
|
|
60
60
|
"paragraph",
|
|
61
61
|
"insert",
|
|
62
62
|
"clipboard"
|
|
63
|
-
],
|
|
63
|
+
], z = [
|
|
64
64
|
"bold",
|
|
65
65
|
"italic",
|
|
66
66
|
"strike",
|
|
@@ -69,54 +69,54 @@ var P = A.define({ combine: (e) => e[0] ?? xe }), F = A.define({ combine: (e) =>
|
|
|
69
69
|
"wikilink",
|
|
70
70
|
"math"
|
|
71
71
|
];
|
|
72
|
-
function
|
|
72
|
+
function Te(e) {
|
|
73
73
|
return e === !1 ? {
|
|
74
74
|
enabled: !1,
|
|
75
75
|
groups: []
|
|
76
76
|
} : e == null || e === !0 ? {
|
|
77
77
|
enabled: !0,
|
|
78
|
-
groups:
|
|
78
|
+
groups: we
|
|
79
79
|
} : {
|
|
80
80
|
enabled: !0,
|
|
81
|
-
groups: e.groups?.length ? e.groups :
|
|
81
|
+
groups: e.groups?.length ? e.groups : we
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
var
|
|
85
|
-
function
|
|
86
|
-
if (!e?.length) return
|
|
87
|
-
let t = e.filter((e) =>
|
|
88
|
-
return t.length ? t :
|
|
84
|
+
var Ee = M.define({ combine: (e) => e[0] ?? we });
|
|
85
|
+
function De(e) {
|
|
86
|
+
if (!e?.length) return z;
|
|
87
|
+
let t = e.filter((e) => z.includes(e));
|
|
88
|
+
return t.length ? t : z;
|
|
89
89
|
}
|
|
90
|
-
var
|
|
90
|
+
var Oe = M.define({ combine: (e) => e[0] ?? z }), ke = M.define({ combine: (e) => e[0] ?? "menu" });
|
|
91
91
|
//#endregion
|
|
92
92
|
//#region src/inplace/frontmatter.ts
|
|
93
|
-
function
|
|
94
|
-
if (!e.facet(
|
|
93
|
+
function Ae(e) {
|
|
94
|
+
if (!e.facet(I).frontmatter) return D.none;
|
|
95
95
|
let t = n(e.doc);
|
|
96
|
-
if (!t) return
|
|
96
|
+
if (!t) return D.none;
|
|
97
97
|
let r = e.doc.lineAt(t.from).number, i = e.doc.lineAt(t.to).number, a = e.selection.ranges.some((t) => {
|
|
98
98
|
let n = e.doc.lineAt(t.from).number;
|
|
99
99
|
return n >= r && n <= i;
|
|
100
100
|
}), o = [];
|
|
101
101
|
for (let t = r; t <= i; t++) {
|
|
102
102
|
let n = e.doc.line(t), s = t === r ? "cm-inplace-fm cm-inplace-fm-first" : "cm-inplace-fm";
|
|
103
|
-
o.push(
|
|
103
|
+
o.push(D.line({ class: s }).range(n.from)), (t === r || t === i) && !a && n.to > n.from && o.push(D.replace({}).range(n.from, n.to));
|
|
104
104
|
}
|
|
105
|
-
return
|
|
105
|
+
return D.set(o, !0);
|
|
106
106
|
}
|
|
107
|
-
var
|
|
108
|
-
create:
|
|
109
|
-
update: (e, t) => t.docChanged || t.selection ?
|
|
110
|
-
provide: (e) =>
|
|
107
|
+
var je = P.define({
|
|
108
|
+
create: Ae,
|
|
109
|
+
update: (e, t) => t.docChanged || t.selection ? Ae(t.state) : e,
|
|
110
|
+
provide: (e) => O.decorations.from(e)
|
|
111
111
|
});
|
|
112
112
|
//#endregion
|
|
113
113
|
//#region src/inplace/list-guides.ts
|
|
114
|
-
function
|
|
114
|
+
function Me(e) {
|
|
115
115
|
let t = 1;
|
|
116
116
|
for (let n = e.node.parent; n; n = n.parent) n.name === "ListItem" && t++;
|
|
117
117
|
return t;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function Ne(e, t, n, r, i, a) {
|
|
120
120
|
if (!i.lists) return;
|
|
121
121
|
let o = /* @__PURE__ */ new Set();
|
|
122
122
|
n.iterate({
|
|
@@ -124,10 +124,10 @@ function Pe(e, t, n, r, i, a) {
|
|
|
124
124
|
to: t,
|
|
125
125
|
enter: (e) => {
|
|
126
126
|
if (e.name !== "ListItem") return;
|
|
127
|
-
let t =
|
|
127
|
+
let t = Me(e) - 1;
|
|
128
128
|
if (t < 1) return;
|
|
129
129
|
let n = r.lineAt(e.from).number, i = e.node.getChild("BulletList") ?? e.node.getChild("OrderedList"), s = r.lineAt(i ? i.from - 1 : Math.min(e.to, r.length)).number;
|
|
130
|
-
for (let e = n; e <= s; e++) o.has(e) || (o.add(e), a.push(
|
|
130
|
+
for (let e = n; e <= s; e++) o.has(e) || (o.add(e), a.push(D.line({
|
|
131
131
|
class: "cm-inplace-li",
|
|
132
132
|
attributes: { style: `--sl-li-depth:${t}` }
|
|
133
133
|
}).range(r.line(e).from)));
|
|
@@ -136,7 +136,7 @@ function Pe(e, t, n, r, i, a) {
|
|
|
136
136
|
}
|
|
137
137
|
//#endregion
|
|
138
138
|
//#region src/inplace/reveal.ts
|
|
139
|
-
function
|
|
139
|
+
function B(e) {
|
|
140
140
|
let t = /* @__PURE__ */ new Set();
|
|
141
141
|
for (let n of e.selection.ranges) {
|
|
142
142
|
let r = e.doc.lineAt(n.from).number, i = e.doc.lineAt(n.to).number;
|
|
@@ -146,22 +146,22 @@ function z(e) {
|
|
|
146
146
|
}
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region src/inplace/scan.ts
|
|
149
|
-
var
|
|
149
|
+
var Pe = /* @__PURE__ */ new Set([
|
|
150
150
|
"InlineCode",
|
|
151
151
|
"FencedCode",
|
|
152
152
|
"CodeBlock",
|
|
153
153
|
"CodeText"
|
|
154
154
|
]);
|
|
155
|
-
function
|
|
155
|
+
function V(e, t) {
|
|
156
156
|
let n = e.resolveInner(t, 1);
|
|
157
157
|
for (;;) {
|
|
158
|
-
if (
|
|
158
|
+
if (Pe.has(n.name)) return !0;
|
|
159
159
|
let e = n.parent;
|
|
160
160
|
if (!e) return !1;
|
|
161
161
|
n = e;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function Fe(e, t) {
|
|
165
165
|
let n = e.resolveInner(t, 1);
|
|
166
166
|
for (;;) {
|
|
167
167
|
if (n.name === "Table") return !0;
|
|
@@ -170,16 +170,16 @@ function Ie(e, t) {
|
|
|
170
170
|
n = e;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function Ie(e, t, n, r) {
|
|
174
174
|
let i = t.lineAt(n).number, a = t.lineAt(r).number;
|
|
175
175
|
for (let t = i; t <= a; t++) if (e.has(t)) return !0;
|
|
176
176
|
return !1;
|
|
177
177
|
}
|
|
178
178
|
//#endregion
|
|
179
179
|
//#region src/inplace/math.ts
|
|
180
|
-
var
|
|
181
|
-
function
|
|
182
|
-
for (let n of e.matchAll(
|
|
180
|
+
var Le = /(?<![\w$])\$(?!\s)([^\n$]+?)(?<!\s)\$(?![\w$])/g, Re = /(?<![\w$])\$\$([^\n$]+?)\$\$(?![\w$])/g, ze = /(?<![\w$])\$\$([^]+?)\$\$/g;
|
|
181
|
+
function Be(e, t) {
|
|
182
|
+
for (let n of e.matchAll(Re)) {
|
|
183
183
|
let e = n.index ?? 0, r = e + (n[0] ?? "").length;
|
|
184
184
|
if (t >= e && t <= r) return {
|
|
185
185
|
from: e,
|
|
@@ -188,7 +188,7 @@ function Ve(e, t) {
|
|
|
188
188
|
block: !0
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
for (let n of e.matchAll(
|
|
191
|
+
for (let n of e.matchAll(Le)) {
|
|
192
192
|
let e = n.index ?? 0, r = e + (n[0] ?? "").length;
|
|
193
193
|
if (t >= e && t <= r) return {
|
|
194
194
|
from: e,
|
|
@@ -199,7 +199,7 @@ function Ve(e, t) {
|
|
|
199
199
|
}
|
|
200
200
|
return null;
|
|
201
201
|
}
|
|
202
|
-
var
|
|
202
|
+
var Ve = class extends A {
|
|
203
203
|
src;
|
|
204
204
|
block;
|
|
205
205
|
constructor(e, t) {
|
|
@@ -212,7 +212,7 @@ var He = class extends O {
|
|
|
212
212
|
let e = document.createElement(this.block ? "div" : "span");
|
|
213
213
|
e.className = this.block ? "cm-inplace-math cm-inplace-math-block" : "cm-inplace-math";
|
|
214
214
|
try {
|
|
215
|
-
|
|
215
|
+
se.render(this.src, e, {
|
|
216
216
|
displayMode: this.block,
|
|
217
217
|
throwOnError: !1
|
|
218
218
|
});
|
|
@@ -225,45 +225,45 @@ var He = class extends O {
|
|
|
225
225
|
return !1;
|
|
226
226
|
}
|
|
227
227
|
};
|
|
228
|
-
function
|
|
228
|
+
function He(e, t, n, r, i, a) {
|
|
229
229
|
let o = e.state.doc.sliceString(t, n);
|
|
230
230
|
if (!o.includes("$")) return;
|
|
231
231
|
let { doc: s } = e.state, c = [];
|
|
232
|
-
for (let e of o.matchAll(
|
|
232
|
+
for (let e of o.matchAll(Re)) {
|
|
233
233
|
let n = (e[1] ?? "").trim(), o = t + (e.index ?? 0), l = o + (e[0] ?? "").length;
|
|
234
|
-
!n ||
|
|
234
|
+
!n || V(i, o + 2) || (c.push([o, l]), !Ie(r, s, o, l) && a.push(D.replace({ widget: new Ve(n, !0) }).range(o, l)));
|
|
235
235
|
}
|
|
236
|
-
for (let e of o.matchAll(
|
|
236
|
+
for (let e of o.matchAll(Le)) {
|
|
237
237
|
let n = (e[1] ?? "").trim(), o = t + (e.index ?? 0), l = o + (e[0] ?? "").length;
|
|
238
|
-
!n ||
|
|
238
|
+
!n || V(i, o + 1) || c.some(([e, t]) => o >= e && l <= t) || Ie(r, s, o, l) || a.push(D.replace({ widget: new Ve(n, !1) }).range(o, l));
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
var
|
|
242
|
-
create:
|
|
241
|
+
var Ue = P.define({
|
|
242
|
+
create: We,
|
|
243
243
|
update(e, t) {
|
|
244
|
-
return t.docChanged || t.selection ?
|
|
244
|
+
return t.docChanged || t.selection ? We(t.state) : e;
|
|
245
245
|
},
|
|
246
|
-
provide: (e) => [
|
|
246
|
+
provide: (e) => [O.decorations.from(e), O.atomicRanges.of((t) => t.state.field(e))]
|
|
247
247
|
});
|
|
248
|
-
function
|
|
249
|
-
if (!e.facet(
|
|
248
|
+
function We(e) {
|
|
249
|
+
if (!e.facet(I).math) return D.none;
|
|
250
250
|
let t = e.doc.toString();
|
|
251
|
-
if (!t.includes("$$")) return
|
|
252
|
-
let n = [], r =
|
|
253
|
-
for (let a of t.matchAll(
|
|
251
|
+
if (!t.includes("$$")) return D.none;
|
|
252
|
+
let n = [], r = B(e), i = F(e);
|
|
253
|
+
for (let a of t.matchAll(ze)) {
|
|
254
254
|
let t = a[0] ?? "", o = (a[1] ?? "").trim();
|
|
255
255
|
if (!o || !t.includes("\n")) continue;
|
|
256
256
|
let s = a.index ?? 0, c = s + t.length, l = e.doc.lineAt(s), u = e.doc.lineAt(c), d = e.doc.sliceString(l.from, s).trim(), f = e.doc.sliceString(c, u.to).trim();
|
|
257
|
-
d === "" && f === "" && (
|
|
258
|
-
widget: new
|
|
257
|
+
d === "" && f === "" && (V(i, s + 2) || Ie(r, e.doc, s, c) || n.push(D.replace({
|
|
258
|
+
widget: new Ve(o, !0),
|
|
259
259
|
block: !0
|
|
260
260
|
}).range(s, c)));
|
|
261
261
|
}
|
|
262
|
-
return
|
|
262
|
+
return D.set(n, !0);
|
|
263
263
|
}
|
|
264
264
|
//#endregion
|
|
265
265
|
//#region src/inplace/nodes-inline.ts
|
|
266
|
-
var
|
|
266
|
+
var Ge = {
|
|
267
267
|
StrongEmphasis: {
|
|
268
268
|
mark: "EmphasisMark",
|
|
269
269
|
className: "cm-inplace-strong",
|
|
@@ -285,26 +285,26 @@ var Ke = {
|
|
|
285
285
|
toggle: "code"
|
|
286
286
|
}
|
|
287
287
|
};
|
|
288
|
-
function
|
|
288
|
+
function Ke(e, t, n) {
|
|
289
289
|
let { doc: r, revealed: i, out: a, toggles: o } = t;
|
|
290
290
|
if (!o[n.toggle]) return;
|
|
291
291
|
let s = e.node.getChildren(n.mark), c = s[0], l = s[s.length - 1], u = c && l && c !== l, d = u ? c.to : e.from, f = u ? l.from : e.to;
|
|
292
|
-
f > d && a.push(
|
|
292
|
+
f > d && a.push(D.mark({ class: n.className }).range(d, f)), u && !i.has(r.lineAt(e.from).number) && (a.push(D.replace({}).range(c.from, c.to)), a.push(D.replace({}).range(l.from, l.to)));
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function qe(e, t) {
|
|
295
295
|
let { doc: n, revealed: r, out: i, toggles: a } = t, o = n.sliceString(Math.max(0, e.from - 1), e.from), s = n.sliceString(e.to, e.to + 1);
|
|
296
296
|
if (o === "[" && s === "]" || !a.links) return !1;
|
|
297
|
-
let c = n.lineAt(e.from), l =
|
|
297
|
+
let c = n.lineAt(e.from), l = C.exec(c.text);
|
|
298
298
|
if (l && e.from - c.from < l[1].length + l[2].length) return !1;
|
|
299
299
|
let u = e.node.getChildren("LinkMark");
|
|
300
300
|
if (u.length >= 2) {
|
|
301
301
|
let t = u[0], a = u[1];
|
|
302
|
-
a.from > t.to && i.push(
|
|
302
|
+
a.from > t.to && i.push(D.mark({ class: "cm-inplace-link" }).range(t.to, a.from)), r.has(n.lineAt(e.from).number) || (i.push(D.replace({}).range(e.from, t.to)), i.push(D.replace({}).range(a.from, e.to)));
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
//#endregion
|
|
306
306
|
//#region src/inplace/widgets.ts
|
|
307
|
-
var
|
|
307
|
+
var Je = class extends A {
|
|
308
308
|
eq() {
|
|
309
309
|
return !0;
|
|
310
310
|
}
|
|
@@ -315,7 +315,7 @@ var Ye = class extends O {
|
|
|
315
315
|
ignoreEvent() {
|
|
316
316
|
return !1;
|
|
317
317
|
}
|
|
318
|
-
},
|
|
318
|
+
}, Ye = class extends A {
|
|
319
319
|
eq() {
|
|
320
320
|
return !0;
|
|
321
321
|
}
|
|
@@ -326,7 +326,7 @@ var Ye = class extends O {
|
|
|
326
326
|
ignoreEvent() {
|
|
327
327
|
return !1;
|
|
328
328
|
}
|
|
329
|
-
},
|
|
329
|
+
}, Xe = class extends A {
|
|
330
330
|
checked;
|
|
331
331
|
constructor(e) {
|
|
332
332
|
super(), this.checked = e;
|
|
@@ -348,58 +348,58 @@ var Ye = class extends O {
|
|
|
348
348
|
ignoreEvent() {
|
|
349
349
|
return !0;
|
|
350
350
|
}
|
|
351
|
-
},
|
|
352
|
-
function
|
|
351
|
+
}, Ze = /^[-*+]$/;
|
|
352
|
+
function Qe(e, t) {
|
|
353
353
|
let { doc: n, revealed: r, out: i, toggles: a } = t;
|
|
354
354
|
if (!a.horizontalRule) return !1;
|
|
355
355
|
let o = n.lineAt(e.from);
|
|
356
|
-
return r.has(o.number) || (i.push(
|
|
356
|
+
return r.has(o.number) || (i.push(D.line({ class: "cm-inplace-hr-line" }).range(o.from)), i.push(D.replace({ widget: new Je() }).range(o.from, o.to))), !1;
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function $e(e, t) {
|
|
359
359
|
let { doc: n, revealed: r, caretRevealed: i, out: a, toggles: o, quoteRevealed: s } = t;
|
|
360
360
|
if (o.blockquote) {
|
|
361
|
-
let t = n.lineAt(e.from).number, o = n.lineAt(Math.min(e.to, n.length)).number, c = n.line(t), l =
|
|
361
|
+
let t = n.lineAt(e.from).number, o = n.lineAt(Math.min(e.to, n.length)).number, c = n.line(t), l = C.exec(c.text), u = l ? S(l[3]) : null, d = !1;
|
|
362
362
|
for (let e = t; e <= o; e++) i.has(e) && (d = !0);
|
|
363
363
|
if (d) for (let e = t; e <= o; e++) s.add(e);
|
|
364
364
|
for (let e = t; e <= o; e++) {
|
|
365
365
|
let r = u ? `cm-inplace-callout cm-inplace-callout-${u}` : "cm-inplace-quote";
|
|
366
366
|
u && e === t && (r += " cm-inplace-callout-head"), u && e === o && (r += " cm-inplace-callout-foot");
|
|
367
367
|
let i = {};
|
|
368
|
-
u && (i["data-callout"] = l[3].toLowerCase()), u && d && (i["data-revealed"] = ""), a.push(
|
|
368
|
+
u && (i["data-callout"] = l[3].toLowerCase()), u && d && (i["data-revealed"] = ""), a.push(D.line({
|
|
369
369
|
class: r,
|
|
370
370
|
attributes: i
|
|
371
371
|
}).range(n.line(e).from));
|
|
372
372
|
}
|
|
373
373
|
if (u && !d && !r.has(t)) {
|
|
374
374
|
let e = c.from + l[1].length;
|
|
375
|
-
a.push(
|
|
375
|
+
a.push(D.replace({}).range(e, e + l[2].length));
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function et(e, t) {
|
|
380
380
|
let { doc: n, revealed: r, out: i, toggles: a, quoteRevealed: o } = t;
|
|
381
381
|
if (!a.blockquote) return !1;
|
|
382
382
|
let s = n.lineAt(e.from);
|
|
383
383
|
if (!r.has(s.number) && !o.has(s.number)) {
|
|
384
|
-
let t = Math.min(e.to + 1, s.to), n =
|
|
385
|
-
i.push(
|
|
384
|
+
let t = Math.min(e.to + 1, s.to), n = C.exec(s.text), r = n ? s.text.slice(n[1].length + n[2].length) : s.text.slice(t - s.from);
|
|
385
|
+
i.push(D.replace({}).range(e.from, r.trim() === "" ? e.to : t));
|
|
386
386
|
}
|
|
387
387
|
return !1;
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function tt(e, t) {
|
|
390
390
|
let { doc: n, revealed: r, out: i, toggles: a } = t, o = n.sliceString(e.from, e.to), s = n.lineAt(e.from), c = e.node.parent, l = !!(c?.getChild("Task") ?? c?.getChild("TaskMarker"));
|
|
391
|
-
return r.has(s.number) || (l ? a.tasks && i.push(
|
|
391
|
+
return r.has(s.number) || (l ? a.tasks && i.push(D.replace({}).range(e.from, Math.min(e.to + 1, s.to))) : a.lists && Ze.test(o) && i.push(D.replace({ widget: new Ye() }).range(e.from, e.to))), !1;
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
function nt(e, t) {
|
|
394
394
|
let { doc: n, revealed: r, out: i, toggles: a } = t;
|
|
395
395
|
if (!a.tasks) return !1;
|
|
396
396
|
if (!r.has(n.lineAt(e.from).number)) {
|
|
397
397
|
let t = n.sliceString(e.from + 1, e.to - 1).toLowerCase() === "x";
|
|
398
|
-
i.push(
|
|
398
|
+
i.push(D.replace({ widget: new Xe(t) }).range(e.from, e.to));
|
|
399
399
|
}
|
|
400
400
|
return !1;
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function rt(e, t) {
|
|
403
403
|
let { doc: n, revealed: r, caretRevealed: i, out: a, toggles: o } = t;
|
|
404
404
|
if (!o.code) return !1;
|
|
405
405
|
let s = e.name === "FencedCode", c = n.lineAt(e.from).number, l = n.lineAt(e.to > e.from ? e.to - 1 : e.to).number, u = l > c + 1, d = !1;
|
|
@@ -409,18 +409,18 @@ function it(e, t) {
|
|
|
409
409
|
let t = s && (e === c || e === l), r = "cm-inplace-mono";
|
|
410
410
|
e === c && (r += " cm-inplace-code-top"), e === l && (r += " cm-inplace-code-bottom"), t && (r += f ? " cm-inplace-code-pad" : " cm-inplace-fence");
|
|
411
411
|
let i = n.line(e);
|
|
412
|
-
a.push(
|
|
412
|
+
a.push(D.line({ class: r }).range(i.from)), t && f && i.to > i.from && a.push(D.replace({}).range(i.from, i.to));
|
|
413
413
|
}
|
|
414
414
|
return !1;
|
|
415
415
|
}
|
|
416
416
|
//#endregion
|
|
417
417
|
//#region src/inplace/nodes.ts
|
|
418
|
-
var
|
|
419
|
-
function
|
|
418
|
+
var it = /^ATXHeading([1-6])$/, at = /^SetextHeading([12])$/;
|
|
419
|
+
function ot(e, t, n) {
|
|
420
420
|
let { doc: r, revealed: i, out: a, toggles: o } = t;
|
|
421
421
|
if (o.headings) {
|
|
422
422
|
let t = r.lineAt(e.from);
|
|
423
|
-
if (a.push(
|
|
423
|
+
if (a.push(D.line({
|
|
424
424
|
class: `cm-inplace-heading cm-inplace-h${n}`,
|
|
425
425
|
attributes: {
|
|
426
426
|
role: "heading",
|
|
@@ -428,15 +428,15 @@ function st(e, t, n) {
|
|
|
428
428
|
}
|
|
429
429
|
}).range(t.from)), !i.has(t.number)) {
|
|
430
430
|
let n = e.node.firstChild;
|
|
431
|
-
n?.name === "HeaderMark" && a.push(
|
|
431
|
+
n?.name === "HeaderMark" && a.push(D.replace({}).range(n.from, Math.min(n.to + 1, t.to)));
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
function
|
|
435
|
+
function st(e, t, n) {
|
|
436
436
|
let { doc: r, caretRevealed: i, out: a, toggles: o } = t;
|
|
437
437
|
if (o.headings) {
|
|
438
438
|
let t = r.lineAt(e.from);
|
|
439
|
-
a.push(
|
|
439
|
+
a.push(D.line({
|
|
440
440
|
class: `cm-inplace-heading cm-inplace-h${n}`,
|
|
441
441
|
attributes: {
|
|
442
442
|
role: "heading",
|
|
@@ -446,47 +446,47 @@ function ct(e, t, n) {
|
|
|
446
446
|
let o = e.node.getChild("HeaderMark");
|
|
447
447
|
if (o) {
|
|
448
448
|
let e = r.lineAt(o.from);
|
|
449
|
-
!i.has(t.number) && !i.has(e.number) && (a.push(
|
|
449
|
+
!i.has(t.number) && !i.has(e.number) && (a.push(D.line({ class: "cm-inplace-setext-rule" }).range(e.from)), a.push(D.replace({}).range(o.from, o.to)));
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function ct(e, t) {
|
|
454
454
|
if (e.to <= t.fmEnd) return !1;
|
|
455
|
-
let n =
|
|
456
|
-
if (n) return
|
|
457
|
-
let r =
|
|
458
|
-
if (r) return
|
|
459
|
-
let i =
|
|
460
|
-
if (i) return
|
|
461
|
-
if (e.name === "Link") return
|
|
462
|
-
if (e.name === "HorizontalRule") return
|
|
463
|
-
if (e.name === "Blockquote") return
|
|
464
|
-
if (e.name === "QuoteMark") return
|
|
465
|
-
if (e.name === "ListMark") return
|
|
466
|
-
if (e.name === "TaskMarker") return
|
|
467
|
-
if (e.name === "FencedCode" || e.name === "CodeBlock") return
|
|
455
|
+
let n = it.exec(e.name);
|
|
456
|
+
if (n) return ot(e, t, n[1]);
|
|
457
|
+
let r = at.exec(e.name);
|
|
458
|
+
if (r) return st(e, t, r[1]);
|
|
459
|
+
let i = Ge[e.name];
|
|
460
|
+
if (i) return Ke(e, t, i);
|
|
461
|
+
if (e.name === "Link") return qe(e, t);
|
|
462
|
+
if (e.name === "HorizontalRule") return Qe(e, t);
|
|
463
|
+
if (e.name === "Blockquote") return $e(e, t);
|
|
464
|
+
if (e.name === "QuoteMark") return et(e, t);
|
|
465
|
+
if (e.name === "ListMark") return tt(e, t);
|
|
466
|
+
if (e.name === "TaskMarker") return nt(e, t);
|
|
467
|
+
if (e.name === "FencedCode" || e.name === "CodeBlock") return rt(e, t);
|
|
468
468
|
}
|
|
469
469
|
//#endregion
|
|
470
470
|
//#region src/inplace/wikilinks.ts
|
|
471
|
-
function
|
|
472
|
-
let s =
|
|
471
|
+
function lt(t, n, r, i, a, o) {
|
|
472
|
+
let s = t.state.doc.sliceString(n, r);
|
|
473
473
|
if (!s.includes("[[")) return;
|
|
474
|
-
let c =
|
|
475
|
-
for (let r of s.matchAll(
|
|
476
|
-
let [
|
|
477
|
-
if (!u ||
|
|
478
|
-
let f = d +
|
|
479
|
-
o.push(
|
|
474
|
+
let c = t.state.facet(L) != null;
|
|
475
|
+
for (let r of s.matchAll(e)) {
|
|
476
|
+
let [e = "", s = "", l] = r, u = s.trim(), d = n + (r.index ?? 0);
|
|
477
|
+
if (!u || V(a, d + 1) || c && d > 0 && t.state.doc.sliceString(d - 1, d) === "!") continue;
|
|
478
|
+
let f = d + e.length, p = l == null ? d + 2 : d + 2 + s.length + 1, m = f - 2;
|
|
479
|
+
o.push(D.mark({
|
|
480
480
|
class: "cm-inplace-link cm-inplace-wikilink",
|
|
481
481
|
attributes: { "data-stylo-wikilink": u }
|
|
482
|
-
}).range(p, m)), i.has(
|
|
482
|
+
}).range(p, m)), i.has(t.state.doc.lineAt(d).number) || (o.push(D.replace({}).range(d, p)), o.push(D.replace({}).range(m, f)));
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
485
|
//#endregion
|
|
486
486
|
//#region src/inplace/decorate.ts
|
|
487
|
-
var
|
|
488
|
-
function
|
|
489
|
-
let t = [], r =
|
|
487
|
+
var ut = /* @__PURE__ */ new Set(), dt = D.replace({});
|
|
488
|
+
function ft(e) {
|
|
489
|
+
let t = [], r = B(e.state), i = e.state.facet(R) === "never" ? ut : r, a = F(e.state), { doc: o } = e.state, s = e.state.facet(I), c = {
|
|
490
490
|
doc: o,
|
|
491
491
|
revealed: i,
|
|
492
492
|
caretRevealed: r,
|
|
@@ -498,8 +498,8 @@ function pt(e) {
|
|
|
498
498
|
for (let n of e.visibleRanges) a.iterate({
|
|
499
499
|
from: n.from,
|
|
500
500
|
to: n.to,
|
|
501
|
-
enter: (e) =>
|
|
502
|
-
}), s.wikilinks &&
|
|
501
|
+
enter: (e) => ct(e, c)
|
|
502
|
+
}), s.wikilinks && lt(e, n.from, n.to, i, a, t), s.math && He(e, n.from, n.to, i, a, t), Ne(n.from, n.to, a, o, s, t);
|
|
503
503
|
let l = t.filter((e) => e.from < e.to && !e.value.spec.class).sort((e, t) => e.from - t.from || e.to - t.to), u = [];
|
|
504
504
|
for (let e of l) {
|
|
505
505
|
if (!e.value.spec.widget) {
|
|
@@ -507,38 +507,38 @@ function pt(e) {
|
|
|
507
507
|
if (e.from === t.from && e.to === t.to) continue;
|
|
508
508
|
}
|
|
509
509
|
let t = u[u.length - 1];
|
|
510
|
-
t && e.from <= t.to ? e.to > t.to && (u[u.length - 1] =
|
|
510
|
+
t && e.from <= t.to ? e.to > t.to && (u[u.length - 1] = dt.range(t.from, e.to)) : u.push(dt.range(e.from, e.to));
|
|
511
511
|
}
|
|
512
512
|
return {
|
|
513
|
-
decorations:
|
|
514
|
-
atomic:
|
|
513
|
+
decorations: D.set(t, !0),
|
|
514
|
+
atomic: D.set(u, !0)
|
|
515
515
|
};
|
|
516
516
|
}
|
|
517
517
|
//#endregion
|
|
518
518
|
//#region src/inplace/plugin.ts
|
|
519
|
-
var
|
|
519
|
+
var pt = k.fromClass(class {
|
|
520
520
|
decorations;
|
|
521
521
|
atomic;
|
|
522
522
|
constructor(e) {
|
|
523
|
-
let t =
|
|
523
|
+
let t = ft(e);
|
|
524
524
|
this.decorations = t.decorations, this.atomic = t.atomic;
|
|
525
525
|
}
|
|
526
526
|
update(e) {
|
|
527
527
|
if (e.docChanged || e.viewportChanged || e.selectionSet) {
|
|
528
|
-
let t =
|
|
528
|
+
let t = ft(e.view);
|
|
529
529
|
this.decorations = t.decorations, this.atomic = t.atomic;
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
532
|
}, {
|
|
533
533
|
decorations: (e) => e.decorations,
|
|
534
|
-
provide: (e) =>
|
|
534
|
+
provide: (e) => O.atomicRanges.of((t) => t.plugin(e)?.atomic ?? D.none)
|
|
535
535
|
});
|
|
536
|
-
function
|
|
537
|
-
return
|
|
536
|
+
function mt() {
|
|
537
|
+
return pt;
|
|
538
538
|
}
|
|
539
539
|
//#endregion
|
|
540
540
|
//#region src/inplace/wrap-at.ts
|
|
541
|
-
var
|
|
541
|
+
var ht = {
|
|
542
542
|
StrongEmphasis: {
|
|
543
543
|
markType: "EmphasisMark",
|
|
544
544
|
toggle: "emphasis"
|
|
@@ -556,18 +556,18 @@ var gt = {
|
|
|
556
556
|
toggle: "code"
|
|
557
557
|
}
|
|
558
558
|
};
|
|
559
|
-
function
|
|
560
|
-
return e.facet(
|
|
561
|
-
}
|
|
562
|
-
function
|
|
563
|
-
let a =
|
|
564
|
-
if (!i && !
|
|
565
|
-
let o =
|
|
566
|
-
for (let
|
|
567
|
-
let
|
|
568
|
-
if (
|
|
569
|
-
if (!o[
|
|
570
|
-
let
|
|
559
|
+
function H(e, t) {
|
|
560
|
+
return e.facet(R) === "never" || !B(e).has(t);
|
|
561
|
+
}
|
|
562
|
+
function U(t, n, r = !1, i = !1) {
|
|
563
|
+
let a = t.doc.lineAt(n);
|
|
564
|
+
if (!i && !H(t, a.number)) return null;
|
|
565
|
+
let o = t.facet(I), s = F(t);
|
|
566
|
+
for (let e of [-1, 1]) for (let i = s.resolveInner(n, e); i; i = i.parent) {
|
|
567
|
+
let e = ht[i.name];
|
|
568
|
+
if (e) {
|
|
569
|
+
if (!o[e.toggle]) break;
|
|
570
|
+
let t = i.getChildren(e.markType), n = t[0], r = t[t.length - 1];
|
|
571
571
|
if (!n || !r || n === r) break;
|
|
572
572
|
return {
|
|
573
573
|
from: i.from,
|
|
@@ -578,26 +578,26 @@ function H(e, n, r = !1, i = !1) {
|
|
|
578
578
|
};
|
|
579
579
|
}
|
|
580
580
|
if (i.name === "Link") {
|
|
581
|
-
if (r ||
|
|
582
|
-
let
|
|
583
|
-
if (
|
|
581
|
+
if (r || t.doc.sliceString(Math.max(0, i.from - 1), i.from) === "[" || !o.links) break;
|
|
582
|
+
let e = i.getChildren("LinkMark");
|
|
583
|
+
if (e.length < 2) break;
|
|
584
584
|
return {
|
|
585
585
|
from: i.from,
|
|
586
586
|
to: i.to,
|
|
587
|
-
contentFrom:
|
|
588
|
-
contentTo:
|
|
587
|
+
contentFrom: e[0].to,
|
|
588
|
+
contentTo: e[1].from,
|
|
589
589
|
kind: "link"
|
|
590
590
|
};
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
|
-
if (o.wikilinks && !r) for (let
|
|
594
|
-
let
|
|
595
|
-
if (n <
|
|
596
|
-
let i =
|
|
593
|
+
if (o.wikilinks && !r) for (let t of a.text.matchAll(e)) {
|
|
594
|
+
let e = a.from + (t.index ?? 0), r = e + t[0].length;
|
|
595
|
+
if (n < e || n > r) continue;
|
|
596
|
+
let i = t[1] ?? "", o = t[2] != null;
|
|
597
597
|
return {
|
|
598
|
-
from:
|
|
598
|
+
from: e,
|
|
599
599
|
to: r,
|
|
600
|
-
contentFrom:
|
|
600
|
+
contentFrom: e + 2 + (o ? i.length + 1 : 0),
|
|
601
601
|
contentTo: r - 2,
|
|
602
602
|
kind: "link"
|
|
603
603
|
};
|
|
@@ -606,8 +606,8 @@ function H(e, n, r = !1, i = !1) {
|
|
|
606
606
|
}
|
|
607
607
|
//#endregion
|
|
608
608
|
//#region src/inplace/edit-boundaries.ts
|
|
609
|
-
function
|
|
610
|
-
let r = e.plugin(
|
|
609
|
+
function gt(e, t, n) {
|
|
610
|
+
let r = e.plugin(pt)?.decorations;
|
|
611
611
|
if (!r) return t;
|
|
612
612
|
let i = n < 0 ? 0 : e.state.doc.length, a = t;
|
|
613
613
|
for (let e = !0; e;) e = !1, r.between(Math.min(a, i), Math.max(a, i), (t, r, i) => {
|
|
@@ -615,18 +615,18 @@ function _t(e, t, n) {
|
|
|
615
615
|
});
|
|
616
616
|
return a;
|
|
617
617
|
}
|
|
618
|
-
var
|
|
618
|
+
var _t = (e) => (t) => {
|
|
619
619
|
if (p(t)) return !1;
|
|
620
620
|
let n = t.state.selection.main;
|
|
621
621
|
if (!n.empty) return !1;
|
|
622
622
|
let { state: r } = t;
|
|
623
|
-
if (!
|
|
624
|
-
let i =
|
|
623
|
+
if (!H(r, r.doc.lineAt(n.head).number)) return !1;
|
|
624
|
+
let i = gt(t, n.head, e);
|
|
625
625
|
if (i === n.head) return !1;
|
|
626
626
|
let a = r.doc;
|
|
627
627
|
if (e < 0 ? i <= 0 : i >= a.length) return !0;
|
|
628
628
|
let o = e < 0 ? i - 1 : i, s = e < 0 ? i : i + 1;
|
|
629
|
-
for (let e =
|
|
629
|
+
for (let e = U(r, o); e && o <= e.contentFrom && s >= e.contentTo && e.contentTo > e.contentFrom && !(e.from >= o && e.to <= s); e = U(r, o)) o = Math.min(o, e.from), s = Math.max(s, e.to);
|
|
630
630
|
return t.dispatch({
|
|
631
631
|
changes: {
|
|
632
632
|
from: o,
|
|
@@ -637,87 +637,87 @@ var vt = (e) => (t) => {
|
|
|
637
637
|
userEvent: e < 0 ? "delete.backward" : "delete.forward",
|
|
638
638
|
scrollIntoView: !0
|
|
639
639
|
}), !0;
|
|
640
|
-
},
|
|
641
|
-
function
|
|
640
|
+
}, vt = _t(-1), yt = _t(1);
|
|
641
|
+
function bt(e, t, n) {
|
|
642
642
|
if (n <= t) return !1;
|
|
643
|
-
let r = e.plugin(
|
|
643
|
+
let r = e.plugin(pt)?.decorations;
|
|
644
644
|
if (!r) return !1;
|
|
645
645
|
let i = t;
|
|
646
646
|
return r.between(t, n, (e, t, n) => {
|
|
647
647
|
n.spec.widget || n.spec.class || t <= e || e <= i && (i = Math.max(i, t));
|
|
648
648
|
}), i >= n;
|
|
649
649
|
}
|
|
650
|
-
var
|
|
650
|
+
var W = (e, t) => (n) => {
|
|
651
651
|
if (p(n)) return !1;
|
|
652
652
|
let r = n.state.selection.main;
|
|
653
|
-
if (!t && !r.empty || !
|
|
653
|
+
if (!t && !r.empty || !H(n.state, n.state.doc.lineAt(r.head).number)) return !1;
|
|
654
654
|
let i = n.moveByChar(r, e);
|
|
655
|
-
if (
|
|
656
|
-
let a = t ?
|
|
655
|
+
if (bt(n, Math.min(r.head, i.head), Math.max(r.head, i.head)) && (i = n.moveByChar(i, e)), i.head === r.head) return !1;
|
|
656
|
+
let a = t ? pe.range(r.anchor, i.head) : pe.cursor(i.head);
|
|
657
657
|
return n.dispatch({
|
|
658
658
|
selection: a,
|
|
659
659
|
userEvent: "select"
|
|
660
660
|
}), !0;
|
|
661
|
-
},
|
|
661
|
+
}, xt = W(!1, !1), St = W(!0, !1), Ct = W(!1, !0), wt = W(!0, !0), Tt = N.high(j.of([
|
|
662
662
|
{
|
|
663
663
|
key: "Backspace",
|
|
664
|
-
run:
|
|
664
|
+
run: vt
|
|
665
665
|
},
|
|
666
666
|
{
|
|
667
667
|
key: "Delete",
|
|
668
|
-
run:
|
|
668
|
+
run: yt
|
|
669
669
|
},
|
|
670
670
|
{
|
|
671
671
|
key: "ArrowLeft",
|
|
672
|
-
run:
|
|
672
|
+
run: xt
|
|
673
673
|
},
|
|
674
674
|
{
|
|
675
675
|
key: "ArrowRight",
|
|
676
|
-
run:
|
|
676
|
+
run: St
|
|
677
677
|
},
|
|
678
678
|
{
|
|
679
679
|
key: "Shift-ArrowLeft",
|
|
680
|
-
run:
|
|
680
|
+
run: Ct
|
|
681
681
|
},
|
|
682
682
|
{
|
|
683
683
|
key: "Shift-ArrowRight",
|
|
684
|
-
run:
|
|
684
|
+
run: wt
|
|
685
685
|
}
|
|
686
|
-
])),
|
|
686
|
+
])), Et = (e) => e === "h1" || e === "h2" || e === "h3" ? x.heading : x[e], Dt = [
|
|
687
687
|
"bold",
|
|
688
688
|
"italic",
|
|
689
689
|
"strike"
|
|
690
|
-
],
|
|
690
|
+
], Ot = ["code", "math"], kt = [
|
|
691
691
|
"bulletList",
|
|
692
692
|
"orderedList",
|
|
693
693
|
"task"
|
|
694
|
-
],
|
|
694
|
+
], At = [
|
|
695
695
|
"h1",
|
|
696
696
|
"h2",
|
|
697
697
|
"h3"
|
|
698
|
-
],
|
|
698
|
+
], jt = ["table", "hr"], Mt = [
|
|
699
699
|
"codeBlock",
|
|
700
700
|
"mathBlock",
|
|
701
701
|
"frontmatter"
|
|
702
|
-
],
|
|
702
|
+
], Nt = (e, t, n = !1) => {
|
|
703
703
|
let r = h[t];
|
|
704
704
|
return r ? {
|
|
705
705
|
label: r.title,
|
|
706
|
-
icon:
|
|
706
|
+
icon: Et(t),
|
|
707
707
|
active: !n && !!r.isActive?.(e.state),
|
|
708
708
|
disabled: !n && !!r.disabled?.(e.state),
|
|
709
709
|
onSelect: () => {
|
|
710
710
|
r.run(e), e.focus();
|
|
711
711
|
}
|
|
712
712
|
} : null;
|
|
713
|
-
},
|
|
713
|
+
}, G = (e, t, n = !1, r = !1) => {
|
|
714
714
|
let i = [];
|
|
715
715
|
for (let a of t) {
|
|
716
|
-
let t =
|
|
716
|
+
let t = Nt(e, a, r);
|
|
717
717
|
t && !(n && t.disabled) && i.push(t);
|
|
718
718
|
}
|
|
719
719
|
return i;
|
|
720
|
-
},
|
|
720
|
+
}, K = (e) => {
|
|
721
721
|
let t = e.contentDOM.ownerDocument, n = (n) => () => {
|
|
722
722
|
e.focus();
|
|
723
723
|
try {
|
|
@@ -727,17 +727,17 @@ var U = (e, t) => (n) => {
|
|
|
727
727
|
return [
|
|
728
728
|
{
|
|
729
729
|
label: "Cut",
|
|
730
|
-
icon:
|
|
730
|
+
icon: x.cut,
|
|
731
731
|
onSelect: n("cut")
|
|
732
732
|
},
|
|
733
733
|
{
|
|
734
734
|
label: "Copy",
|
|
735
|
-
icon:
|
|
735
|
+
icon: x.copy,
|
|
736
736
|
onSelect: n("copy")
|
|
737
737
|
},
|
|
738
738
|
i ? {
|
|
739
739
|
label: "Paste",
|
|
740
|
-
icon:
|
|
740
|
+
icon: x.paste,
|
|
741
741
|
onSelect: () => {
|
|
742
742
|
let n = p(e);
|
|
743
743
|
n || e.focus(), r?.readText().then((r) => {
|
|
@@ -746,45 +746,45 @@ var U = (e, t) => (n) => {
|
|
|
746
746
|
}
|
|
747
747
|
} : {
|
|
748
748
|
label: "Paste",
|
|
749
|
-
icon:
|
|
749
|
+
icon: x.paste,
|
|
750
750
|
disabled: !0,
|
|
751
751
|
title: "Paste with the keyboard shortcut",
|
|
752
752
|
onSelect: () => {}
|
|
753
753
|
}
|
|
754
754
|
];
|
|
755
|
-
},
|
|
755
|
+
}, q = (e, t, n, r = !1) => ({
|
|
756
756
|
label: e,
|
|
757
757
|
icon: t,
|
|
758
758
|
rows: n,
|
|
759
759
|
disabled: r
|
|
760
760
|
});
|
|
761
|
-
function
|
|
761
|
+
function J(e, t) {
|
|
762
762
|
t.length && (e.length && e.push("separator"), e.push(...t));
|
|
763
763
|
}
|
|
764
764
|
//#endregion
|
|
765
765
|
//#region src/inplace/edit-divider.ts
|
|
766
|
-
function
|
|
766
|
+
function Pt(e) {
|
|
767
767
|
let t = e.selection.main;
|
|
768
768
|
if (!t.empty) return !1;
|
|
769
769
|
let n = e.doc.lineAt(t.head);
|
|
770
|
-
if (!
|
|
771
|
-
for (let t =
|
|
770
|
+
if (!H(e, n.number)) return !1;
|
|
771
|
+
for (let t = F(e).resolveInner(n.from, 1); t; t = t.parent) {
|
|
772
772
|
if (t.name === "HorizontalRule") return !0;
|
|
773
773
|
if (!t.parent) break;
|
|
774
774
|
}
|
|
775
775
|
return !1;
|
|
776
776
|
}
|
|
777
|
-
var
|
|
777
|
+
var Ft = (e) => p(e) || !Pt(e.state) ? !1 : ee(e), It = N.high(j.of([{
|
|
778
778
|
key: "Backspace",
|
|
779
|
-
run:
|
|
779
|
+
run: Ft
|
|
780
780
|
}, {
|
|
781
781
|
key: "Delete",
|
|
782
|
-
run:
|
|
782
|
+
run: Ft
|
|
783
783
|
}]));
|
|
784
|
-
function
|
|
784
|
+
function Lt(e) {
|
|
785
785
|
return {
|
|
786
786
|
label: "Remove divider",
|
|
787
|
-
icon:
|
|
787
|
+
icon: x.hr,
|
|
788
788
|
onSelect: () => {
|
|
789
789
|
h.hr?.run(e), e.focus();
|
|
790
790
|
}
|
|
@@ -792,33 +792,33 @@ function Rt(e) {
|
|
|
792
792
|
}
|
|
793
793
|
//#endregion
|
|
794
794
|
//#region src/inplace/link-row.ts
|
|
795
|
-
var
|
|
795
|
+
var Rt = (e) => {
|
|
796
796
|
let t = e.trim().replace(/^<([^]*)>$/, "$1");
|
|
797
797
|
return /[\s()]/.test(t) ? `<${t.replace(/[<>]/g, "")}>` : t;
|
|
798
|
-
},
|
|
799
|
-
function
|
|
798
|
+
}, zt = (e) => e.replace(/^<([^]*)>$/, "$1");
|
|
799
|
+
function Bt(e, t) {
|
|
800
800
|
let n = e.doc.lineAt(t.from);
|
|
801
801
|
if (e.doc.lineAt(t.to).number !== n.number) return null;
|
|
802
|
-
let r = t.from - n.from, i = t.to - n.from, a =
|
|
802
|
+
let r = t.from - n.from, i = t.to - n.from, a = y(n.text, r) ?? y(n.text, i);
|
|
803
803
|
if (a) return {
|
|
804
804
|
from: n.from + a.from,
|
|
805
805
|
to: n.from + a.to,
|
|
806
806
|
text: a.label
|
|
807
807
|
};
|
|
808
|
-
let o =
|
|
808
|
+
let o = b(n.text, r) ?? b(n.text, i);
|
|
809
809
|
return o ? {
|
|
810
810
|
from: n.from + o.from,
|
|
811
811
|
to: n.from + o.to,
|
|
812
812
|
text: o.label
|
|
813
813
|
} : null;
|
|
814
814
|
}
|
|
815
|
-
function
|
|
816
|
-
let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i =
|
|
815
|
+
function Vt(e) {
|
|
816
|
+
let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i = y(r.text, n.head - r.from);
|
|
817
817
|
if (i) {
|
|
818
|
-
let n = r.from + i.from, a = r.from + i.to, o = r.from + i.urlFrom, s = r.from + i.urlTo, c = t.facet(
|
|
818
|
+
let n = r.from + i.from, a = r.from + i.to, o = r.from + i.urlFrom, s = r.from + i.urlTo, c = t.facet(Se), l = [];
|
|
819
819
|
return c && i.url && l.push({
|
|
820
820
|
label: "Open link",
|
|
821
|
-
icon:
|
|
821
|
+
icon: x.link,
|
|
822
822
|
onSelect: () => c(i.url)
|
|
823
823
|
}), l.push({
|
|
824
824
|
label: "Remove link",
|
|
@@ -838,24 +838,24 @@ function Ht(e) {
|
|
|
838
838
|
}), {
|
|
839
839
|
field: !0,
|
|
840
840
|
label: "Edit external link",
|
|
841
|
-
icon:
|
|
842
|
-
value:
|
|
841
|
+
icon: x.link,
|
|
842
|
+
value: zt(i.url),
|
|
843
843
|
placeholder: "https://…",
|
|
844
844
|
onSubmit: (t) => {
|
|
845
845
|
e.dispatch({ changes: {
|
|
846
846
|
from: o,
|
|
847
847
|
to: s,
|
|
848
|
-
insert:
|
|
848
|
+
insert: Rt(t)
|
|
849
849
|
} }), e.focus();
|
|
850
850
|
},
|
|
851
851
|
actions: l
|
|
852
852
|
};
|
|
853
853
|
}
|
|
854
|
-
let a =
|
|
854
|
+
let a = Bt(t, n), o = a ? a.from : n.from, s = a ? a.to : n.to, c = (a ? a.text : t.sliceDoc(n.from, n.to)) || "link";
|
|
855
855
|
return {
|
|
856
856
|
field: !0,
|
|
857
857
|
label: "Add external link",
|
|
858
|
-
icon:
|
|
858
|
+
icon: x.link,
|
|
859
859
|
value: "",
|
|
860
860
|
placeholder: "https://…",
|
|
861
861
|
onSubmit: (t) => {
|
|
@@ -863,7 +863,7 @@ function Ht(e) {
|
|
|
863
863
|
changes: {
|
|
864
864
|
from: o,
|
|
865
865
|
to: s,
|
|
866
|
-
insert: `[${c}](${
|
|
866
|
+
insert: `[${c}](${Rt(t)})`
|
|
867
867
|
},
|
|
868
868
|
selection: {
|
|
869
869
|
anchor: o + 1,
|
|
@@ -873,14 +873,14 @@ function Ht(e) {
|
|
|
873
873
|
}
|
|
874
874
|
};
|
|
875
875
|
}
|
|
876
|
-
function
|
|
876
|
+
function Ht(e) {
|
|
877
877
|
let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i = o(r.text, n.head - r.from);
|
|
878
878
|
if (i) {
|
|
879
879
|
let t = r.from + i.from, n = r.from + i.to, a = r.from + i.targetFrom, o = r.from + i.targetTo, s = i.label || i.target;
|
|
880
880
|
return {
|
|
881
881
|
field: !0,
|
|
882
882
|
label: "Edit link",
|
|
883
|
-
icon:
|
|
883
|
+
icon: x.wikilink,
|
|
884
884
|
value: i.target,
|
|
885
885
|
placeholder: "note or path",
|
|
886
886
|
onSubmit: (t) => {
|
|
@@ -908,11 +908,11 @@ function Ut(e) {
|
|
|
908
908
|
}]
|
|
909
909
|
};
|
|
910
910
|
}
|
|
911
|
-
let a =
|
|
911
|
+
let a = Bt(t, n), s = a ? a.from : n.from, c = a ? a.to : n.to, l = a ? a.text : t.sliceDoc(n.from, n.to);
|
|
912
912
|
return {
|
|
913
913
|
field: !0,
|
|
914
914
|
label: "Add link",
|
|
915
|
-
icon:
|
|
915
|
+
icon: x.wikilink,
|
|
916
916
|
value: "",
|
|
917
917
|
placeholder: "note or path",
|
|
918
918
|
onSubmit: (t) => {
|
|
@@ -933,19 +933,19 @@ function Ut(e) {
|
|
|
933
933
|
}
|
|
934
934
|
//#endregion
|
|
935
935
|
//#region src/inplace/context-menu-shell.ts
|
|
936
|
-
function
|
|
936
|
+
function Ut(e, t, n, r) {
|
|
937
937
|
let i = r?.innerWidth ?? 0, a = r?.innerHeight ?? 0;
|
|
938
938
|
e.style.left = "0", e.style.top = "0";
|
|
939
939
|
let { width: o, height: s } = e.getBoundingClientRect();
|
|
940
940
|
e.style.left = `${Math.max(4, Math.min(t, i - o - 4))}px`, e.style.top = `${Math.max(4, Math.min(n, a - s - 4))}px`;
|
|
941
941
|
}
|
|
942
|
-
function
|
|
942
|
+
function Wt(e, t, n) {
|
|
943
943
|
let r = n?.innerWidth ?? 0, i = n?.innerHeight ?? 0;
|
|
944
944
|
e.style.left = "0", e.style.top = "0";
|
|
945
945
|
let { width: a, height: o } = e.getBoundingClientRect(), s = t.right - 4, c = s + a > r - 4 ? t.left - a + 4 : s;
|
|
946
946
|
e.style.left = `${Math.max(4, c)}px`, e.style.top = `${Math.max(4, Math.min(t.top - 4, i - o - 4))}px`;
|
|
947
947
|
}
|
|
948
|
-
function
|
|
948
|
+
function Gt(e, t, n, r = 350) {
|
|
949
949
|
let i = Date.now(), a = (e) => !t.contains(e.target), o = (e) => {
|
|
950
950
|
a(e) && n();
|
|
951
951
|
}, s = (e) => {
|
|
@@ -959,10 +959,10 @@ function Kt(e, t, n, r = 350) {
|
|
|
959
959
|
}
|
|
960
960
|
//#endregion
|
|
961
961
|
//#region src/inplace/context-menu-types.ts
|
|
962
|
-
var
|
|
962
|
+
var Kt = (e) => typeof e != "string" && "rows" in e, qt = (e) => typeof e != "string" && "field" in e;
|
|
963
963
|
//#endregion
|
|
964
964
|
//#region src/inplace/context-menu.ts
|
|
965
|
-
function
|
|
965
|
+
function Y(e, t = "cm-inplace-menu", n) {
|
|
966
966
|
let r = e.defaultView, i = e.createElement("div");
|
|
967
967
|
i.className = t, i.setAttribute("contenteditable", "false"), i.hidden = !0;
|
|
968
968
|
let a = null, o = null, s = () => {
|
|
@@ -972,7 +972,7 @@ function J(e, t = "cm-inplace-menu", n) {
|
|
|
972
972
|
}, l = (e) => e.addEventListener("mousedown", (e) => {
|
|
973
973
|
e.preventDefault(), e.stopPropagation();
|
|
974
974
|
}), u = (t, n, r) => {
|
|
975
|
-
r && t.appendChild(
|
|
975
|
+
r && t.appendChild(ie(e, r));
|
|
976
976
|
let i = e.createElement("span");
|
|
977
977
|
i.textContent = n, t.appendChild(i);
|
|
978
978
|
}, d = (n) => {
|
|
@@ -990,7 +990,7 @@ function J(e, t = "cm-inplace-menu", n) {
|
|
|
990
990
|
if (a?.dataset.for === n) return;
|
|
991
991
|
s();
|
|
992
992
|
let e = c();
|
|
993
|
-
e.dataset.for = n, i.appendChild(e),
|
|
993
|
+
e.dataset.for = n, i.appendChild(e), Wt(e, f.getBoundingClientRect(), r), a = e, e.querySelector("input")?.focus({ preventScroll: !0 });
|
|
994
994
|
};
|
|
995
995
|
return f.addEventListener("pointerenter", p), f.addEventListener("click", (e) => {
|
|
996
996
|
e.stopPropagation(), p();
|
|
@@ -1013,7 +1013,7 @@ function J(e, t = "cm-inplace-menu", n) {
|
|
|
1013
1013
|
for (let i of n) if (i === "separator") {
|
|
1014
1014
|
let n = e.createElement("div");
|
|
1015
1015
|
n.className = `${t}-sep`, r.appendChild(n);
|
|
1016
|
-
} else
|
|
1016
|
+
} else Kt(i) ? r.appendChild(f(i.label, i.icon, () => m(i.rows), i.disabled)) : qt(i) ? r.appendChild(f(i.label, i.icon, () => p(i))) : r.appendChild(d(i));
|
|
1017
1017
|
return r;
|
|
1018
1018
|
};
|
|
1019
1019
|
return {
|
|
@@ -1024,12 +1024,12 @@ function J(e, t = "cm-inplace-menu", n) {
|
|
|
1024
1024
|
show: (t, a, s) => {
|
|
1025
1025
|
c();
|
|
1026
1026
|
let l = m(t);
|
|
1027
|
-
i.appendChild(l), i.hidden = !1,
|
|
1027
|
+
i.appendChild(l), i.hidden = !1, Ut(l, a, s, r), o = Gt(e, i, c), n?.(!0);
|
|
1028
1028
|
},
|
|
1029
1029
|
showField: (t, a, s) => {
|
|
1030
1030
|
c();
|
|
1031
1031
|
let l = p(t);
|
|
1032
|
-
i.appendChild(l), i.hidden = !1,
|
|
1032
|
+
i.appendChild(l), i.hidden = !1, Ut(l, a, s, r), l.querySelector("input")?.focus({ preventScroll: !0 }), o = Gt(e, i, c), n?.(!0);
|
|
1033
1033
|
},
|
|
1034
1034
|
hide: c,
|
|
1035
1035
|
destroy: () => {
|
|
@@ -1039,14 +1039,14 @@ function J(e, t = "cm-inplace-menu", n) {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
//#endregion
|
|
1041
1041
|
//#region src/inplace/math-edit.ts
|
|
1042
|
-
function
|
|
1043
|
-
let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i =
|
|
1042
|
+
function Jt(e) {
|
|
1043
|
+
let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i = Be(r.text, n.head - r.from);
|
|
1044
1044
|
if (i) {
|
|
1045
1045
|
let t = r.from + i.from, n = r.from + i.to, a = i.block ? "$$" : "$";
|
|
1046
1046
|
return {
|
|
1047
1047
|
field: !0,
|
|
1048
1048
|
label: "Edit math",
|
|
1049
|
-
icon:
|
|
1049
|
+
icon: x.math,
|
|
1050
1050
|
value: i.src,
|
|
1051
1051
|
placeholder: "e^{i\\pi} + 1 = 0",
|
|
1052
1052
|
onSubmit: (r) => {
|
|
@@ -1079,7 +1079,7 @@ function Yt(e) {
|
|
|
1079
1079
|
return {
|
|
1080
1080
|
field: !0,
|
|
1081
1081
|
label: "Add math",
|
|
1082
|
-
icon:
|
|
1082
|
+
icon: x.math,
|
|
1083
1083
|
value: "",
|
|
1084
1084
|
placeholder: "e^{i\\pi} + 1 = 0",
|
|
1085
1085
|
onSubmit: (t) => {
|
|
@@ -1098,27 +1098,27 @@ function Yt(e) {
|
|
|
1098
1098
|
}
|
|
1099
1099
|
};
|
|
1100
1100
|
}
|
|
1101
|
-
var
|
|
1101
|
+
var Yt = class {
|
|
1102
1102
|
menu;
|
|
1103
1103
|
contentDOM;
|
|
1104
1104
|
onClick;
|
|
1105
1105
|
constructor(e) {
|
|
1106
|
-
this.menu =
|
|
1107
|
-
if (!e.state.facet(
|
|
1106
|
+
this.menu = Y(e.dom.ownerDocument), e.dom.appendChild(this.menu.el), this.contentDOM = e.contentDOM, this.onClick = (t) => {
|
|
1107
|
+
if (!e.state.facet(I).math) return;
|
|
1108
1108
|
let n = t.target?.closest(".cm-inplace-math");
|
|
1109
1109
|
if (!n) return;
|
|
1110
1110
|
let r = e.posAtDOM(n);
|
|
1111
1111
|
if (r < 0) return;
|
|
1112
1112
|
let i = e.state.doc.lineAt(r);
|
|
1113
|
-
|
|
1113
|
+
Be(i.text, r - i.from) && (e.dispatch({ selection: { anchor: r } }), this.menu.showField(Jt(e), t.clientX, t.clientY));
|
|
1114
1114
|
}, this.contentDOM.addEventListener("click", this.onClick);
|
|
1115
1115
|
}
|
|
1116
1116
|
destroy() {
|
|
1117
1117
|
this.contentDOM.removeEventListener("click", this.onClick), this.menu.destroy();
|
|
1118
1118
|
}
|
|
1119
|
-
},
|
|
1120
|
-
if (!e.state.facet(
|
|
1121
|
-
let n = e.state.doc.lineAt(t), r =
|
|
1119
|
+
}, Xt = k.fromClass(Yt), Zt = le((e, t) => {
|
|
1120
|
+
if (!e.state.facet(I).math) return null;
|
|
1121
|
+
let n = e.state.doc.lineAt(t), r = Be(n.text, t - n.from);
|
|
1122
1122
|
return r ? {
|
|
1123
1123
|
pos: n.from + r.from,
|
|
1124
1124
|
end: n.from + r.to,
|
|
@@ -1131,18 +1131,18 @@ var Xt = class {
|
|
|
1131
1131
|
});
|
|
1132
1132
|
//#endregion
|
|
1133
1133
|
//#region src/inplace/context-menu-actions.ts
|
|
1134
|
-
function
|
|
1134
|
+
function X(e) {
|
|
1135
1135
|
let t = p(e);
|
|
1136
1136
|
if (!t) return !1;
|
|
1137
1137
|
let { from: n, to: r } = u(t);
|
|
1138
1138
|
return r > n;
|
|
1139
1139
|
}
|
|
1140
|
-
function
|
|
1141
|
-
let t =
|
|
1140
|
+
function Qt(e) {
|
|
1141
|
+
let t = v(e.state);
|
|
1142
1142
|
return {
|
|
1143
1143
|
field: !0,
|
|
1144
1144
|
label: "Language",
|
|
1145
|
-
icon:
|
|
1145
|
+
icon: x.codeBlock,
|
|
1146
1146
|
value: t?.lang ?? "",
|
|
1147
1147
|
placeholder: "ts, python, …",
|
|
1148
1148
|
onSubmit: (n) => {
|
|
@@ -1160,44 +1160,44 @@ function $t(e) {
|
|
|
1160
1160
|
}]
|
|
1161
1161
|
};
|
|
1162
1162
|
}
|
|
1163
|
-
var
|
|
1164
|
-
...
|
|
1163
|
+
var $t = (e, t = !1) => [
|
|
1164
|
+
...G(e, Dt, !1, t),
|
|
1165
1165
|
"separator",
|
|
1166
|
-
...t ?
|
|
1166
|
+
...t ? G(e, Ot, !1, !0) : [Nt(e, "code", !1), Jt(e)]
|
|
1167
1167
|
];
|
|
1168
|
-
function
|
|
1169
|
-
let t = e.state.facet(
|
|
1170
|
-
return t.includes("format") &&
|
|
1168
|
+
function en(e) {
|
|
1169
|
+
let t = e.state.facet(Ee), n = [];
|
|
1170
|
+
return t.includes("format") && J(n, [q("Format", x.format, $t(e, !0))]), t.includes("clipboard") && J(n, K(e)), n;
|
|
1171
1171
|
}
|
|
1172
|
-
var
|
|
1173
|
-
...
|
|
1172
|
+
var tn = (e) => [
|
|
1173
|
+
...G(e, kt),
|
|
1174
1174
|
"separator",
|
|
1175
|
-
...
|
|
1175
|
+
...G(e, [...At, "body"]),
|
|
1176
1176
|
"separator",
|
|
1177
|
-
...
|
|
1178
|
-
],
|
|
1179
|
-
...
|
|
1177
|
+
...G(e, ["quote"])
|
|
1178
|
+
], nn = (e) => [
|
|
1179
|
+
...G(e, jt),
|
|
1180
1180
|
"separator",
|
|
1181
|
-
...
|
|
1181
|
+
...G(e, Mt)
|
|
1182
1182
|
];
|
|
1183
|
-
function
|
|
1184
|
-
let { state: t } = e, n = t.facet(
|
|
1185
|
-
if (
|
|
1183
|
+
function rn(e) {
|
|
1184
|
+
let { state: t } = e, n = t.facet(Ee), r = (e) => n.includes(e);
|
|
1185
|
+
if (X(e)) return en(e);
|
|
1186
1186
|
if (s(t)) {
|
|
1187
|
-
let t = [
|
|
1188
|
-
return r("clipboard") &&
|
|
1187
|
+
let t = [Qt(e)];
|
|
1188
|
+
return r("clipboard") && J(t, K(e)), t;
|
|
1189
1189
|
}
|
|
1190
|
-
if (
|
|
1191
|
-
let t = [
|
|
1192
|
-
return r("clipboard") &&
|
|
1190
|
+
if (Pt(t)) {
|
|
1191
|
+
let t = [Lt(e)];
|
|
1192
|
+
return r("clipboard") && J(t, K(e)), t;
|
|
1193
1193
|
}
|
|
1194
|
-
let i = t.selection.main, a = t.doc.lineAt(i.head).text.trim() === "", o = !i.empty || !!t.wordAt(i.head), c = t.facet(
|
|
1195
|
-
for (let t of n) t === "link" && c ?
|
|
1194
|
+
let i = t.selection.main, a = t.doc.lineAt(i.head).text.trim() === "", o = !i.empty || !!t.wordAt(i.head), c = t.facet(ke) === "menu", l = [];
|
|
1195
|
+
for (let t of n) t === "link" && c ? J(l, [Ht(e), Vt(e)]) : t === "format" && c ? J(l, [q("Format", x.format, $t(e), !o)]) : t === "paragraph" ? J(l, [q("Paragraph", x.paragraph, tn(e))]) : t === "insert" ? J(l, [q("Insert", x.insert, nn(e), !a)]) : t === "clipboard" && J(l, K(e));
|
|
1196
1196
|
return l;
|
|
1197
1197
|
}
|
|
1198
1198
|
//#endregion
|
|
1199
1199
|
//#region src/inplace/long-press.ts
|
|
1200
|
-
function
|
|
1200
|
+
function an(e, t) {
|
|
1201
1201
|
let n = t.delay ?? 450, r = t.slop ?? 20, i = null, a = 0, o = 0, s = () => {
|
|
1202
1202
|
i != null && (clearTimeout(i), i = null);
|
|
1203
1203
|
}, c = (e) => {
|
|
@@ -1219,10 +1219,10 @@ function on(e, t) {
|
|
|
1219
1219
|
}
|
|
1220
1220
|
//#endregion
|
|
1221
1221
|
//#region src/inplace/table-gizmos.ts
|
|
1222
|
-
function
|
|
1222
|
+
function on(e, t) {
|
|
1223
1223
|
let n = e.createElement("div");
|
|
1224
1224
|
n.className = "cm-inplace-table-gizmos", n.setAttribute("contenteditable", "false");
|
|
1225
|
-
let r =
|
|
1225
|
+
let r = Y(e), i = (t, n, r) => {
|
|
1226
1226
|
let i = e.createElement("button");
|
|
1227
1227
|
return i.type = "button", i.className = t, i.setAttribute("aria-label", n), i.addEventListener("mousedown", (e) => {
|
|
1228
1228
|
e.preventDefault(), e.stopPropagation();
|
|
@@ -1305,7 +1305,7 @@ function sn(e, t) {
|
|
|
1305
1305
|
}
|
|
1306
1306
|
//#endregion
|
|
1307
1307
|
//#region src/inplace/table-widget-caret.ts
|
|
1308
|
-
function
|
|
1308
|
+
function sn(e) {
|
|
1309
1309
|
let t = e.ownerDocument.getSelection(), n = e.firstChild, r = (e.textContent ?? "").length, i = t?.anchorNode === n ? t?.anchorOffset ?? 0 : r;
|
|
1310
1310
|
return {
|
|
1311
1311
|
offset: i,
|
|
@@ -1314,66 +1314,66 @@ function cn(e) {
|
|
|
1314
1314
|
}
|
|
1315
1315
|
//#endregion
|
|
1316
1316
|
//#region src/inplace/inline-md.ts
|
|
1317
|
-
function
|
|
1317
|
+
function cn(e, t = !1) {
|
|
1318
1318
|
let n = document.createDocumentFragment();
|
|
1319
|
-
return
|
|
1319
|
+
return dn(n, e, t), n;
|
|
1320
1320
|
}
|
|
1321
|
-
var
|
|
1321
|
+
var ln = /!\[\[[^\]\n]+?\]\]/, un = [
|
|
1322
1322
|
{
|
|
1323
1323
|
re: /`([^`\n]+)`/,
|
|
1324
|
-
build: (e) =>
|
|
1324
|
+
build: (e) => Z("code", "cm-inplace-code", document.createTextNode(e[1]))
|
|
1325
1325
|
},
|
|
1326
1326
|
{
|
|
1327
1327
|
re: /(?<![\d$])\$(?!\s)([^$\n]+?)(?<!\s)\$(?![\d$])/,
|
|
1328
1328
|
build: (e) => {
|
|
1329
|
-
let t =
|
|
1330
|
-
return
|
|
1329
|
+
let t = Z("span", "cm-inplace-math");
|
|
1330
|
+
return se.render(e[1], t, { throwOnError: !1 }), t;
|
|
1331
1331
|
}
|
|
1332
1332
|
},
|
|
1333
1333
|
{
|
|
1334
|
-
re: new RegExp(
|
|
1334
|
+
re: new RegExp(e.source),
|
|
1335
1335
|
build: (e) => {
|
|
1336
|
-
let t =
|
|
1336
|
+
let t = Z("span", "cm-inplace-wikilink", document.createTextNode(e[2] || e[1] || ""));
|
|
1337
1337
|
return t.dataset.styloWikilink = e[1] ?? "", t;
|
|
1338
1338
|
}
|
|
1339
1339
|
},
|
|
1340
1340
|
{
|
|
1341
1341
|
re: /\[([^\]\n]*)\]\(([^)\n]*)\)/,
|
|
1342
1342
|
build: (e, t) => {
|
|
1343
|
-
let n =
|
|
1344
|
-
return n.href = e[2] ?? "", n.append(
|
|
1343
|
+
let n = Z("a", "cm-inplace-link");
|
|
1344
|
+
return n.href = e[2] ?? "", n.append(Q(e[1] ?? "", t)), n;
|
|
1345
1345
|
}
|
|
1346
1346
|
},
|
|
1347
1347
|
{
|
|
1348
1348
|
re: /\*\*\*([^*\n]+?)\*\*\*/,
|
|
1349
|
-
build: (e, t) =>
|
|
1349
|
+
build: (e, t) => Z("strong", "cm-inplace-strong", Z("em", "cm-inplace-em", Q(e[1], t)))
|
|
1350
1350
|
},
|
|
1351
1351
|
{
|
|
1352
1352
|
re: /\*\*([^\n]+?)\*\*/,
|
|
1353
|
-
build: (e, t) =>
|
|
1353
|
+
build: (e, t) => Z("strong", "cm-inplace-strong", Q(e[1], t))
|
|
1354
1354
|
},
|
|
1355
1355
|
{
|
|
1356
1356
|
re: /~~([^\n]+?)~~/,
|
|
1357
|
-
build: (e, t) =>
|
|
1357
|
+
build: (e, t) => Z("span", "cm-inplace-strike", Q(e[1], t))
|
|
1358
1358
|
},
|
|
1359
1359
|
{
|
|
1360
1360
|
re: /(?<!\*)\*(?!\*|\s)([^\n]+?)(?<!\s)\*(?!\*)/,
|
|
1361
|
-
build: (e, t) =>
|
|
1361
|
+
build: (e, t) => Z("em", "cm-inplace-em", Q(e[1], t))
|
|
1362
1362
|
}
|
|
1363
1363
|
];
|
|
1364
|
-
function
|
|
1364
|
+
function Z(e, t, ...n) {
|
|
1365
1365
|
let r = document.createElement(e);
|
|
1366
1366
|
return r.className = t, r.append(...n), r;
|
|
1367
1367
|
}
|
|
1368
|
-
function
|
|
1368
|
+
function Q(e, t) {
|
|
1369
1369
|
let n = document.createDocumentFragment();
|
|
1370
|
-
return
|
|
1370
|
+
return dn(n, e, t), n;
|
|
1371
1371
|
}
|
|
1372
|
-
function
|
|
1372
|
+
function dn(e, t, n) {
|
|
1373
1373
|
for (; t;) {
|
|
1374
|
-
let r = -1, i = null, a = n ?
|
|
1374
|
+
let r = -1, i = null, a = n ? ln.exec(t) : null;
|
|
1375
1375
|
a && (r = a.index, i = { literal: a[0] });
|
|
1376
|
-
for (let e of
|
|
1376
|
+
for (let e of un) {
|
|
1377
1377
|
let n = e.re.exec(t);
|
|
1378
1378
|
n && (r < 0 || n.index < r) && (r = n.index, i = {
|
|
1379
1379
|
rule: e,
|
|
@@ -1389,53 +1389,53 @@ function fn(e, t, n) {
|
|
|
1389
1389
|
}
|
|
1390
1390
|
//#endregion
|
|
1391
1391
|
//#region src/inplace/table-widget-render.ts
|
|
1392
|
-
function
|
|
1392
|
+
function fn(e, t, n) {
|
|
1393
1393
|
let r = Number(e.dataset.r), i = Number(e.dataset.c), a = t.rows[r]?.[i] ?? "";
|
|
1394
|
-
e.replaceChildren(n ? e.ownerDocument.createTextNode(a) :
|
|
1394
|
+
e.replaceChildren(n ? e.ownerDocument.createTextNode(a) : cn(re(a), t.embeds));
|
|
1395
1395
|
}
|
|
1396
|
-
function
|
|
1396
|
+
function pn(e, t, n, r) {
|
|
1397
1397
|
let i = document.createElement(r ? "th" : "td");
|
|
1398
1398
|
i.className = "cm-inplace-tcell", i.setAttribute("contenteditable", "true"), i.dataset.r = String(t), i.dataset.c = String(n);
|
|
1399
1399
|
let a = e.aligns[n];
|
|
1400
|
-
return a && (i.style.textAlign = a),
|
|
1400
|
+
return a && (i.style.textAlign = a), fn(i, e, !1), i;
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1402
|
+
function mn(e, t) {
|
|
1403
1403
|
e.replaceChildren();
|
|
1404
1404
|
let n = t.aligns.length, r = e.createTHead().insertRow();
|
|
1405
|
-
for (let e = 0; e < n; e++) r.appendChild(
|
|
1405
|
+
for (let e = 0; e < n; e++) r.appendChild(pn(t, 0, e, !0));
|
|
1406
1406
|
let i = e.createTBody();
|
|
1407
1407
|
for (let e = 1; e < t.rows.length; e++) {
|
|
1408
1408
|
let r = i.insertRow();
|
|
1409
|
-
for (let i = 0; i < n; i++) r.appendChild(
|
|
1409
|
+
for (let i = 0; i < n; i++) r.appendChild(pn(t, e, i, !1));
|
|
1410
1410
|
}
|
|
1411
1411
|
}
|
|
1412
1412
|
//#endregion
|
|
1413
1413
|
//#region src/inplace/table-structure.ts
|
|
1414
|
-
var
|
|
1415
|
-
function
|
|
1416
|
-
let n = Math.max(0, Math.min(t,
|
|
1414
|
+
var $ = (e) => e.aligns.length;
|
|
1415
|
+
function hn(e, t) {
|
|
1416
|
+
let n = Math.max(0, Math.min(t, $(e)));
|
|
1417
1417
|
for (let t of e.rows) t.splice(n, 0, "");
|
|
1418
1418
|
e.aligns.splice(n, 0, "");
|
|
1419
1419
|
}
|
|
1420
|
-
function
|
|
1421
|
-
if (!(
|
|
1420
|
+
function gn(e, t) {
|
|
1421
|
+
if (!($(e) <= 1 || t < 0 || t >= $(e))) {
|
|
1422
1422
|
for (let n of e.rows) n.splice(t, 1);
|
|
1423
1423
|
e.aligns.splice(t, 1);
|
|
1424
1424
|
}
|
|
1425
1425
|
}
|
|
1426
|
-
function
|
|
1426
|
+
function _n(e, t) {
|
|
1427
1427
|
let n = Math.max(1, Math.min(t, e.rows.length));
|
|
1428
|
-
e.rows.splice(n, 0, Array(
|
|
1428
|
+
e.rows.splice(n, 0, Array($(e)).fill(""));
|
|
1429
1429
|
}
|
|
1430
|
-
function
|
|
1430
|
+
function vn(e, t) {
|
|
1431
1431
|
t <= 0 || t >= e.rows.length || e.rows.length <= 2 || e.rows.splice(t, 1);
|
|
1432
1432
|
}
|
|
1433
|
-
function
|
|
1434
|
-
t >= 0 && t <
|
|
1433
|
+
function yn(e, t, n) {
|
|
1434
|
+
t >= 0 && t < $(e) && (e.aligns[t] = n);
|
|
1435
1435
|
}
|
|
1436
1436
|
//#endregion
|
|
1437
1437
|
//#region src/inplace/tables.ts
|
|
1438
|
-
var
|
|
1438
|
+
var bn = class extends A {
|
|
1439
1439
|
table;
|
|
1440
1440
|
embeds;
|
|
1441
1441
|
constructor(e, t) {
|
|
@@ -1447,17 +1447,17 @@ var xn = class extends O {
|
|
|
1447
1447
|
toDOM() {
|
|
1448
1448
|
let { head: e, body: t, aligns: n } = this.table, r = document.createElement("table");
|
|
1449
1449
|
r.className = "cm-inplace-table";
|
|
1450
|
-
let i = (e) =>
|
|
1450
|
+
let i = (e) => cn(e.replace(/\\\|/g, "|"), this.embeds), a = r.createTHead().insertRow();
|
|
1451
1451
|
e.forEach((e, t) => {
|
|
1452
1452
|
let r = document.createElement("th");
|
|
1453
|
-
r.appendChild(i(e)), r.dataset.styloRow = "0", r.dataset.styloCol = String(t),
|
|
1453
|
+
r.appendChild(i(e)), r.dataset.styloRow = "0", r.dataset.styloCol = String(t), xn(r, n[t]), a.appendChild(r);
|
|
1454
1454
|
});
|
|
1455
1455
|
let o = r.createTBody();
|
|
1456
1456
|
return t.forEach((t, r) => {
|
|
1457
1457
|
let a = o.insertRow();
|
|
1458
1458
|
for (let o = 0; o < e.length; o++) {
|
|
1459
1459
|
let e = a.insertCell();
|
|
1460
|
-
e.appendChild(i(t[o] ?? "")), e.dataset.styloRow = String(r + 1), e.dataset.styloCol = String(o),
|
|
1460
|
+
e.appendChild(i(t[o] ?? "")), e.dataset.styloRow = String(r + 1), e.dataset.styloCol = String(o), xn(e, n[o]);
|
|
1461
1461
|
}
|
|
1462
1462
|
}), r;
|
|
1463
1463
|
}
|
|
@@ -1465,10 +1465,10 @@ var xn = class extends O {
|
|
|
1465
1465
|
return !1;
|
|
1466
1466
|
}
|
|
1467
1467
|
};
|
|
1468
|
-
function
|
|
1468
|
+
function xn(e, t) {
|
|
1469
1469
|
t && (e.style.textAlign = t);
|
|
1470
1470
|
}
|
|
1471
|
-
function
|
|
1471
|
+
function Sn(e, t) {
|
|
1472
1472
|
let n = t.lineAt(e.from).number, r = t.lineAt(e.to).number, i = [];
|
|
1473
1473
|
for (let e = n; e <= r; e++) i.push(t.line(e).text);
|
|
1474
1474
|
let o = a(i);
|
|
@@ -1478,9 +1478,9 @@ function Cn(e, t) {
|
|
|
1478
1478
|
aligns: o.aligns
|
|
1479
1479
|
};
|
|
1480
1480
|
}
|
|
1481
|
-
function
|
|
1482
|
-
if (!e.facet(
|
|
1483
|
-
let t = e.facet(
|
|
1481
|
+
function Cn(e) {
|
|
1482
|
+
if (!e.facet(I).tables) return D.none;
|
|
1483
|
+
let t = e.facet(xe) === "cells", r = e.facet(L) != null && e.facet(I).embeds, i = F(e), a = n(e.doc), o = t ? null : B(e), s = [];
|
|
1484
1484
|
return i.iterate({ enter: (n) => {
|
|
1485
1485
|
if (n.name !== "Table") return;
|
|
1486
1486
|
if (a && n.from < a.to) return !1;
|
|
@@ -1488,22 +1488,22 @@ function wn(e) {
|
|
|
1488
1488
|
let t = e.doc.lineAt(n.from).number, r = e.doc.lineAt(n.to).number;
|
|
1489
1489
|
for (let e = t; e <= r; e++) if (o.has(e)) return !1;
|
|
1490
1490
|
}
|
|
1491
|
-
let i =
|
|
1491
|
+
let i = Sn(n.node, e.doc);
|
|
1492
1492
|
if (i) {
|
|
1493
|
-
let e = t ? new En(i, r) : new
|
|
1494
|
-
s.push(
|
|
1493
|
+
let e = t ? new En(i, r) : new bn(i, r);
|
|
1494
|
+
s.push(D.replace({
|
|
1495
1495
|
widget: e,
|
|
1496
1496
|
block: !0
|
|
1497
1497
|
}).range(n.from, n.to));
|
|
1498
1498
|
}
|
|
1499
1499
|
return !1;
|
|
1500
|
-
} }),
|
|
1500
|
+
} }), D.set(s, !0);
|
|
1501
1501
|
}
|
|
1502
|
-
var
|
|
1503
|
-
create:
|
|
1504
|
-
update: (e, t) => t.annotation(
|
|
1505
|
-
provide: (e) => [
|
|
1506
|
-
}),
|
|
1502
|
+
var wn = P.define({
|
|
1503
|
+
create: Cn,
|
|
1504
|
+
update: (e, t) => t.annotation(Tn) ? e.map(t.changes) : t.state.facet(xe) === "cells" ? t.docChanged ? Cn(t.state) : e.map(t.changes) : t.docChanged || t.selection ? Cn(t.state) : e,
|
|
1505
|
+
provide: (e) => [O.decorations.from(e), O.atomicRanges.of((t) => t.state.field(e))]
|
|
1506
|
+
}), Tn = fe.define(), En = class extends A {
|
|
1507
1507
|
data;
|
|
1508
1508
|
embeds;
|
|
1509
1509
|
table = null;
|
|
@@ -1529,7 +1529,7 @@ var Tn = M.define({
|
|
|
1529
1529
|
}
|
|
1530
1530
|
bounds(e) {
|
|
1531
1531
|
let t = e.posAtDOM(this.table), n = null;
|
|
1532
|
-
return e.state.field(
|
|
1532
|
+
return e.state.field(wn).between(t, t, (e, t) => (n = {
|
|
1533
1533
|
from: e,
|
|
1534
1534
|
to: t
|
|
1535
1535
|
}, !1)), n ?? e.state.doc.lineAt(t);
|
|
@@ -1544,21 +1544,21 @@ var Tn = M.define({
|
|
|
1544
1544
|
};
|
|
1545
1545
|
}
|
|
1546
1546
|
paint(e, t) {
|
|
1547
|
-
|
|
1547
|
+
fn(e, {
|
|
1548
1548
|
rows: this.rows,
|
|
1549
1549
|
aligns: this.data.aligns,
|
|
1550
1550
|
embeds: this.embeds
|
|
1551
1551
|
}, t);
|
|
1552
1552
|
}
|
|
1553
1553
|
renderCells() {
|
|
1554
|
-
|
|
1554
|
+
mn(this.table, {
|
|
1555
1555
|
rows: this.rows,
|
|
1556
1556
|
aligns: this.data.aligns,
|
|
1557
1557
|
embeds: this.embeds
|
|
1558
1558
|
});
|
|
1559
1559
|
}
|
|
1560
1560
|
appendRow() {
|
|
1561
|
-
|
|
1561
|
+
_n(this.model(), this.rows.length), this.renderCells(), this.gizmos?.layout(this.table);
|
|
1562
1562
|
}
|
|
1563
1563
|
model() {
|
|
1564
1564
|
return {
|
|
@@ -1569,7 +1569,7 @@ var Tn = M.define({
|
|
|
1569
1569
|
runOp(e, t) {
|
|
1570
1570
|
if (!this.table) return;
|
|
1571
1571
|
let n = this.model();
|
|
1572
|
-
if (t.kind === "insertColumn" ?
|
|
1572
|
+
if (t.kind === "insertColumn" ? hn(n, t.at) : t.kind === "deleteColumn" ? gn(n, t.at) : t.kind === "insertRow" ? _n(n, t.at) : t.kind === "deleteRow" ? vn(n, t.at) : yn(n, t.at, n.aligns[t.at] === t.value ? "" : t.value), this.editing = null, this.sync(e), this.renderCells(), this.gizmos?.layout(this.table), t.kind !== "align") {
|
|
1573
1573
|
let e = Math.max(0, Math.min(t.focus[0], this.rows.length - 1)), n = Math.max(0, Math.min(t.focus[1], this.cols() - 1));
|
|
1574
1574
|
this.cellAt(e, n)?.focus();
|
|
1575
1575
|
}
|
|
@@ -1582,7 +1582,7 @@ var Tn = M.define({
|
|
|
1582
1582
|
let t = e.target.closest("td, th");
|
|
1583
1583
|
if (!t || t === this.editing) return;
|
|
1584
1584
|
let n = this.pendingOffset ?? m(t);
|
|
1585
|
-
this.pendingOffset = null, this.editing && this.finish(this.editing, !1), this.editing = t, this.paint(t, !0),
|
|
1585
|
+
this.pendingOffset = null, this.editing && this.finish(this.editing, !1), this.editing = t, this.paint(t, !0), _(t, n);
|
|
1586
1586
|
}
|
|
1587
1587
|
onFocusOut(e) {
|
|
1588
1588
|
if (this.syncing || !this.editing) return;
|
|
@@ -1595,16 +1595,16 @@ var Tn = M.define({
|
|
|
1595
1595
|
return {
|
|
1596
1596
|
r: e,
|
|
1597
1597
|
c: t,
|
|
1598
|
-
...
|
|
1598
|
+
...sn(this.editing)
|
|
1599
1599
|
};
|
|
1600
1600
|
}
|
|
1601
1601
|
writeCaret(e) {
|
|
1602
1602
|
let t = this.cellAt(e.r, e.c);
|
|
1603
|
-
t &&
|
|
1603
|
+
t && _(t, e.offset, e.head);
|
|
1604
1604
|
}
|
|
1605
1605
|
sync(e) {
|
|
1606
1606
|
if (!this.table) return;
|
|
1607
|
-
let t = this.readCaret(), n =
|
|
1607
|
+
let t = this.readCaret(), n = g({
|
|
1608
1608
|
rows: this.rows,
|
|
1609
1609
|
aligns: this.data.aligns
|
|
1610
1610
|
});
|
|
@@ -1616,7 +1616,7 @@ var Tn = M.define({
|
|
|
1616
1616
|
to: a,
|
|
1617
1617
|
insert: n
|
|
1618
1618
|
},
|
|
1619
|
-
annotations:
|
|
1619
|
+
annotations: Tn.of(!0),
|
|
1620
1620
|
userEvent: "input"
|
|
1621
1621
|
}), this.syncing = !1, t && (this.writeCaret(t), requestAnimationFrame(() => {
|
|
1622
1622
|
this.table && t && this.writeCaret(t);
|
|
@@ -1625,7 +1625,7 @@ var Tn = M.define({
|
|
|
1625
1625
|
onKey(e, t) {
|
|
1626
1626
|
let n = e.target.closest("td, th");
|
|
1627
1627
|
if (!n || !this.table) return;
|
|
1628
|
-
if (
|
|
1628
|
+
if (ne(e, n)) {
|
|
1629
1629
|
e.stopPropagation();
|
|
1630
1630
|
return;
|
|
1631
1631
|
}
|
|
@@ -1684,8 +1684,8 @@ var Tn = M.define({
|
|
|
1684
1684
|
openCellMenuAt(e, t, n, r) {
|
|
1685
1685
|
let i = r?.closest("td, th");
|
|
1686
1686
|
if (!i) return;
|
|
1687
|
-
this.editing === i && !
|
|
1688
|
-
let a =
|
|
1687
|
+
this.editing === i && !X(e) && d(i, t, n);
|
|
1688
|
+
let a = X(e) ? en(e) : void 0;
|
|
1689
1689
|
this.gizmos?.openFor(i, t, n, a);
|
|
1690
1690
|
}
|
|
1691
1691
|
toDOM(e) {
|
|
@@ -1708,9 +1708,9 @@ var Tn = M.define({
|
|
|
1708
1708
|
document.execCommand("insertText", !1, t);
|
|
1709
1709
|
}), n.addEventListener("contextmenu", (t) => {
|
|
1710
1710
|
t.target.closest("td, th") && (t.preventDefault(), t.stopPropagation(), this.longPress?.cancel(), !(Date.now() - this.longPressAt < 700) && this.openCellMenuAt(e, t.clientX, t.clientY, t.target));
|
|
1711
|
-
}), this.longPress =
|
|
1711
|
+
}), this.longPress = an(n, { onLongPress: (t, n, r) => {
|
|
1712
1712
|
this.longPressAt = Date.now(), this.openCellMenuAt(e, t, n, r);
|
|
1713
|
-
} }), this.gizmos =
|
|
1713
|
+
} }), this.gizmos = on(document, {
|
|
1714
1714
|
dims: () => ({
|
|
1715
1715
|
cols: this.cols(),
|
|
1716
1716
|
rows: this.rows.length,
|
|
@@ -1726,8 +1726,8 @@ var Tn = M.define({
|
|
|
1726
1726
|
"-",
|
|
1727
1727
|
"*",
|
|
1728
1728
|
"_"
|
|
1729
|
-
]), On =
|
|
1730
|
-
if (!e.docChanged || e.isUserEvent("undo") || e.isUserEvent("redo") || e.annotation(
|
|
1729
|
+
]), On = me.transactionFilter.of((e) => {
|
|
1730
|
+
if (!e.docChanged || e.isUserEvent("undo") || e.isUserEvent("redo") || e.annotation(Tn) || !e.startState.selection.main.empty) return e;
|
|
1731
1731
|
let t = e.startState.selection.main.head, n = "", r = 0;
|
|
1732
1732
|
if (e.changes.iterChanges((e, i, a, o, s) => {
|
|
1733
1733
|
r += 1, e === i && e === t && (n = s.toString());
|
|
@@ -1796,15 +1796,15 @@ function An(e, t, n) {
|
|
|
1796
1796
|
}
|
|
1797
1797
|
}
|
|
1798
1798
|
function jn(e, t) {
|
|
1799
|
-
let n =
|
|
1799
|
+
let n = U(e, t, !0);
|
|
1800
1800
|
if (!n) return t;
|
|
1801
|
-
let r =
|
|
1801
|
+
let r = F(e);
|
|
1802
1802
|
return t === n.contentTo ? An(r, t, 1) : t === n.contentFrom ? An(r, t, -1) : t;
|
|
1803
1803
|
}
|
|
1804
|
-
var Mn =
|
|
1805
|
-
if (!e.docChanged || e.isUserEvent("undo") || e.isUserEvent("redo") || e.annotation(
|
|
1804
|
+
var Mn = me.transactionFilter.of((e) => {
|
|
1805
|
+
if (!e.docChanged || e.isUserEvent("undo") || e.isUserEvent("redo") || e.annotation(Tn)) return e;
|
|
1806
1806
|
let t = e.startState, n = t.selection.main;
|
|
1807
|
-
if (!n.empty || !
|
|
1807
|
+
if (!n.empty || !H(t, t.doc.lineAt(n.head).number)) return e;
|
|
1808
1808
|
let r = [], i = 0;
|
|
1809
1809
|
e.changes.iterChanges((e, t, a, o, s) => {
|
|
1810
1810
|
i++, e === t && e === n.head && s.length > 0 && r.push(s.toString());
|
|
@@ -1860,14 +1860,14 @@ function Nn(e) {
|
|
|
1860
1860
|
}
|
|
1861
1861
|
return null;
|
|
1862
1862
|
}
|
|
1863
|
-
var Pn =
|
|
1863
|
+
var Pn = N.high(j.of([{
|
|
1864
1864
|
key: "Backspace",
|
|
1865
1865
|
run: (e) => {
|
|
1866
1866
|
if (p(e)) return !1;
|
|
1867
1867
|
let { state: t } = e, n = t.selection.main;
|
|
1868
1868
|
if (!n.empty) return !1;
|
|
1869
1869
|
let r = t.doc.lineAt(n.head);
|
|
1870
|
-
if (!
|
|
1870
|
+
if (!H(t, r.number)) return !1;
|
|
1871
1871
|
let i = Nn(r.text);
|
|
1872
1872
|
if (!i || n.head < r.from || n.head > r.from + i.prefixLen) return !1;
|
|
1873
1873
|
let [a, o] = i.drop;
|
|
@@ -1887,8 +1887,8 @@ var Pn = j.high(k.of([{
|
|
|
1887
1887
|
contentDOM;
|
|
1888
1888
|
onClick;
|
|
1889
1889
|
constructor(e) {
|
|
1890
|
-
this.menu =
|
|
1891
|
-
if (e.state.facet(
|
|
1890
|
+
this.menu = Y(e.dom.ownerDocument), e.dom.appendChild(this.menu.el), this.contentDOM = e.contentDOM, this.onClick = (t) => {
|
|
1891
|
+
if (e.state.facet(R) !== "never" || !e.state.facet(I).links) return;
|
|
1892
1892
|
let n = t.target?.closest(".cm-inplace-link");
|
|
1893
1893
|
if (!n || n.classList.contains("cm-inplace-wikilink")) return;
|
|
1894
1894
|
let r = e.posAtDOM(n);
|
|
@@ -1900,13 +1900,13 @@ var Pn = j.high(k.of([{
|
|
|
1900
1900
|
if (n == null) return;
|
|
1901
1901
|
r = n;
|
|
1902
1902
|
}
|
|
1903
|
-
e.dispatch({ selection: { anchor: r } }), this.menu.showField(
|
|
1903
|
+
e.dispatch({ selection: { anchor: r } }), this.menu.showField(Vt(e), t.clientX, t.clientY);
|
|
1904
1904
|
}, this.contentDOM.addEventListener("click", this.onClick);
|
|
1905
1905
|
}
|
|
1906
1906
|
destroy() {
|
|
1907
1907
|
this.contentDOM.removeEventListener("click", this.onClick), this.menu.destroy();
|
|
1908
1908
|
}
|
|
1909
|
-
}, In =
|
|
1909
|
+
}, In = k.fromClass(Fn), Ln = (e) => e.replace(/^<([^]*)>$/, "$1").trim(), Rn = (e, t, n) => n ? {
|
|
1910
1910
|
pos: e,
|
|
1911
1911
|
end: t,
|
|
1912
1912
|
above: !0,
|
|
@@ -1916,7 +1916,7 @@ var Pn = j.high(k.of([{
|
|
|
1916
1916
|
}
|
|
1917
1917
|
} : null;
|
|
1918
1918
|
function zn(e, t) {
|
|
1919
|
-
for (let n =
|
|
1919
|
+
for (let n = F(e.state).resolveInner(t, -1); n; n = n.parent) {
|
|
1920
1920
|
if (n.name !== "Link") continue;
|
|
1921
1921
|
if (e.state.doc.sliceString(Math.max(0, n.from - 1), n.from) === "[") break;
|
|
1922
1922
|
let t = n.getChild("URL"), r = t ? e.state.sliceDoc(t.from, t.to) : e.state.sliceDoc(n.from, n.to);
|
|
@@ -1924,18 +1924,18 @@ function zn(e, t) {
|
|
|
1924
1924
|
}
|
|
1925
1925
|
return null;
|
|
1926
1926
|
}
|
|
1927
|
-
function Bn(
|
|
1928
|
-
let r =
|
|
1929
|
-
for (let
|
|
1930
|
-
let
|
|
1931
|
-
if (!(n <
|
|
1927
|
+
function Bn(t, n) {
|
|
1928
|
+
let r = t.state.doc.lineAt(n);
|
|
1929
|
+
for (let t of r.text.matchAll(e)) {
|
|
1930
|
+
let e = r.from + (t.index ?? 0), i = e + t[0].length;
|
|
1931
|
+
if (!(n < e || n > i)) return Rn(e, i, (t[1] ?? "").trim());
|
|
1932
1932
|
}
|
|
1933
1933
|
return null;
|
|
1934
1934
|
}
|
|
1935
|
-
var Vn =
|
|
1936
|
-
let n = e.state.facet(
|
|
1935
|
+
var Vn = le((e, t) => {
|
|
1936
|
+
let n = e.state.facet(I);
|
|
1937
1937
|
return (n.links ? zn(e, t) : null) ?? (n.wikilinks ? Bn(e, t) : null);
|
|
1938
|
-
}), Hn = class extends
|
|
1938
|
+
}), Hn = class extends A {
|
|
1939
1939
|
ref;
|
|
1940
1940
|
inline;
|
|
1941
1941
|
registry;
|
|
@@ -1963,38 +1963,38 @@ var Vn = de((e, t) => {
|
|
|
1963
1963
|
}
|
|
1964
1964
|
};
|
|
1965
1965
|
function Un(e) {
|
|
1966
|
-
let t = e.facet(
|
|
1967
|
-
if (!t || !e.facet(
|
|
1968
|
-
let n =
|
|
1966
|
+
let t = e.facet(L);
|
|
1967
|
+
if (!t || !e.facet(I).embeds || !e.doc.toString().includes("![[")) return D.none;
|
|
1968
|
+
let n = B(e), r = F(e), i = [];
|
|
1969
1969
|
for (let a = 1; a <= e.doc.lines; a++) {
|
|
1970
1970
|
let o = e.doc.line(a);
|
|
1971
1971
|
if (!(!o.text.includes("![[") || n.has(a))) {
|
|
1972
|
-
if (
|
|
1973
|
-
|
|
1974
|
-
let e = (
|
|
1975
|
-
if (!e ||
|
|
1976
|
-
i.push(
|
|
1972
|
+
if (ae(o.text)) {
|
|
1973
|
+
w.lastIndex = 0;
|
|
1974
|
+
let e = (w.exec(o.text.trim())?.[1] ?? "").trim();
|
|
1975
|
+
if (!e || V(r, o.from + o.text.indexOf("!["))) continue;
|
|
1976
|
+
i.push(D.replace({
|
|
1977
1977
|
widget: new Hn(e, !1, t),
|
|
1978
1978
|
block: !0
|
|
1979
1979
|
}).range(o.from, o.to));
|
|
1980
1980
|
continue;
|
|
1981
1981
|
}
|
|
1982
|
-
|
|
1983
|
-
for (let e of o.text.matchAll(
|
|
1982
|
+
w.lastIndex = 0;
|
|
1983
|
+
for (let e of o.text.matchAll(w)) {
|
|
1984
1984
|
let n = (e[1] ?? "").trim();
|
|
1985
1985
|
if (!n) continue;
|
|
1986
1986
|
let a = o.from + (e.index ?? 0);
|
|
1987
|
-
|
|
1987
|
+
V(r, a + 2) || Fe(r, a + 2) || i.push(D.replace({ widget: new Hn(n, !0, t) }).range(a, a + e[0].length));
|
|
1988
1988
|
}
|
|
1989
1989
|
}
|
|
1990
1990
|
}
|
|
1991
|
-
return
|
|
1991
|
+
return D.set(i, !0);
|
|
1992
1992
|
}
|
|
1993
|
-
var Wn =
|
|
1993
|
+
var Wn = P.define({
|
|
1994
1994
|
create: Un,
|
|
1995
1995
|
update: (e, t) => t.docChanged || t.selection ? Un(t.state) : e,
|
|
1996
|
-
provide: (e) => [
|
|
1997
|
-
}), Gn =
|
|
1996
|
+
provide: (e) => [O.decorations.from(e), O.atomicRanges.of((t) => t.state.field(e))]
|
|
1997
|
+
}), Gn = he.define(), Kn = P.define({
|
|
1998
1998
|
create: () => !1,
|
|
1999
1999
|
update(e, t) {
|
|
2000
2000
|
for (let n of t.effects) n.is(Gn) && (e = n.value);
|
|
@@ -2011,7 +2011,7 @@ var Wn = M.define({
|
|
|
2011
2011
|
longPressAt = 0;
|
|
2012
2012
|
destroyed = !1;
|
|
2013
2013
|
constructor(e) {
|
|
2014
|
-
this.view = e, this.menu =
|
|
2014
|
+
this.view = e, this.menu = Y(e.dom.ownerDocument, "cm-inplace-menu", (t) => {
|
|
2015
2015
|
this.destroyed || e.dispatch({ effects: Gn.of(t) });
|
|
2016
2016
|
}), e.dom.appendChild(this.menu.el), this.contentDOM = e.contentDOM, this.onPointerDown = () => {
|
|
2017
2017
|
let t = e.state.selection.main;
|
|
@@ -2021,18 +2021,18 @@ var Wn = M.define({
|
|
|
2021
2021
|
};
|
|
2022
2022
|
}, this.contentDOM.addEventListener("pointerdown", this.onPointerDown, !0), this.onContextMenu = (t) => {
|
|
2023
2023
|
let n = t.target;
|
|
2024
|
-
e.state.facet(
|
|
2025
|
-
}, this.contentDOM.addEventListener("contextmenu", this.onContextMenu), this.longPress =
|
|
2024
|
+
e.state.facet(Ce) && (n?.closest(".cm-inplace-table-edit") || (t.preventDefault(), this.longPress.cancel(), !(Date.now() - this.longPressAt < 700) && this.openMenuAt(t.clientX, t.clientY, n)));
|
|
2025
|
+
}, this.contentDOM.addEventListener("contextmenu", this.onContextMenu), this.longPress = an(this.contentDOM, { onLongPress: (e, t, n) => {
|
|
2026
2026
|
this.longPressAt = Date.now(), this.openMenuAt(e, t, n);
|
|
2027
2027
|
} });
|
|
2028
2028
|
}
|
|
2029
2029
|
openMenuAt(e, t, n) {
|
|
2030
2030
|
let r = this.view;
|
|
2031
|
-
if (!r.state.facet(
|
|
2031
|
+
if (!r.state.facet(Ce) || n?.closest(".cm-inplace-table-edit")) return;
|
|
2032
2032
|
let i = n?.closest(".cm-inplace-hr");
|
|
2033
2033
|
if (i) {
|
|
2034
2034
|
let n = r.posAtDOM(i);
|
|
2035
|
-
n >= 0 && r.dispatch({ selection: { anchor: n } }), this.menu.show(
|
|
2035
|
+
n >= 0 && r.dispatch({ selection: { anchor: n } }), this.menu.show(rn(r), e, t);
|
|
2036
2036
|
return;
|
|
2037
2037
|
}
|
|
2038
2038
|
if (this.stashed && r.state.selection.main.empty) r.dispatch({ selection: this.stashed });
|
|
@@ -2042,7 +2042,7 @@ var Wn = M.define({
|
|
|
2042
2042
|
y: t
|
|
2043
2043
|
});
|
|
2044
2044
|
if (n != null) {
|
|
2045
|
-
let e =
|
|
2045
|
+
let e = U(r.state, n, !1, !0), t = r.state.wordAt(n) ?? { anchor: n };
|
|
2046
2046
|
e?.kind === "link" ? t = {
|
|
2047
2047
|
anchor: e.from,
|
|
2048
2048
|
head: e.to
|
|
@@ -2052,12 +2052,12 @@ var Wn = M.define({
|
|
|
2052
2052
|
}), r.dispatch({ selection: t });
|
|
2053
2053
|
}
|
|
2054
2054
|
}
|
|
2055
|
-
this.menu.show(
|
|
2055
|
+
this.menu.show(rn(r), e, t);
|
|
2056
2056
|
}
|
|
2057
2057
|
destroy() {
|
|
2058
2058
|
this.destroyed = !0, this.contentDOM.removeEventListener("pointerdown", this.onPointerDown, !0), this.contentDOM.removeEventListener("contextmenu", this.onContextMenu), this.longPress.dispose(), this.menu.destroy();
|
|
2059
2059
|
}
|
|
2060
|
-
}, Jn =
|
|
2060
|
+
}, Jn = k.fromClass(qn);
|
|
2061
2061
|
//#endregion
|
|
2062
2062
|
//#region src/inplace/selection-bar-position.ts
|
|
2063
2063
|
function Yn(e) {
|
|
@@ -2074,7 +2074,7 @@ function Yn(e) {
|
|
|
2074
2074
|
}
|
|
2075
2075
|
};
|
|
2076
2076
|
}
|
|
2077
|
-
if (!
|
|
2077
|
+
if (!X(e)) return null;
|
|
2078
2078
|
let n = e.dom.ownerDocument.getSelection();
|
|
2079
2079
|
if (!n || n.rangeCount === 0) return null;
|
|
2080
2080
|
let r = n.getRangeAt(0).getBoundingClientRect();
|
|
@@ -2089,7 +2089,7 @@ function Yn(e) {
|
|
|
2089
2089
|
};
|
|
2090
2090
|
}
|
|
2091
2091
|
function Xn(e, t, n) {
|
|
2092
|
-
if (e.state.facet(
|
|
2092
|
+
if (e.state.facet(ke) !== "bar" || e.state.field(Kn, !1)) return null;
|
|
2093
2093
|
let r = Yn(e);
|
|
2094
2094
|
if (!r) return null;
|
|
2095
2095
|
let { box: i, inCell: a } = r;
|
|
@@ -2123,12 +2123,12 @@ var Zn = class {
|
|
|
2123
2123
|
constructor(e) {
|
|
2124
2124
|
this.view = e;
|
|
2125
2125
|
let t = e.dom.ownerDocument;
|
|
2126
|
-
this.ids = e.state.facet(
|
|
2126
|
+
this.ids = e.state.facet(Oe), this.linkMenu = Y(t), e.dom.appendChild(this.linkMenu.el), this.bar = t.createElement("div"), this.bar.className = "cm-inplace-selbar", this.bar.setAttribute("contenteditable", "false"), this.bar.hidden = !0;
|
|
2127
2127
|
for (let n of this.ids) {
|
|
2128
2128
|
let r = h[n], i = t.createElement("button");
|
|
2129
|
-
i.type = "button", i.className = "cm-inplace-selbar-btn", i.title = r.title, i.setAttribute("aria-label", r.title), i.appendChild(
|
|
2129
|
+
i.type = "button", i.className = "cm-inplace-selbar-btn", i.title = r.title, i.setAttribute("aria-label", r.title), i.appendChild(ie(t, x[n] ?? "")), i.addEventListener("mousedown", (e) => e.preventDefault()), i.addEventListener("click", (t) => {
|
|
2130
2130
|
t.preventDefault();
|
|
2131
|
-
let a = !!p(e), o = !a && n === "link" ?
|
|
2131
|
+
let a = !!p(e), o = !a && n === "link" ? Vt(e) : !a && n === "wikilink" ? Ht(e) : null;
|
|
2132
2132
|
if (o) {
|
|
2133
2133
|
let e = i.getBoundingClientRect();
|
|
2134
2134
|
this.linkMenu.showField(o, e.left, e.bottom + 6);
|
|
@@ -2165,24 +2165,24 @@ var Zn = class {
|
|
|
2165
2165
|
let e = this.view.dom.ownerDocument;
|
|
2166
2166
|
e.removeEventListener("scroll", this.onScroll, !0), e.removeEventListener("selectionchange", this.onSelectionChange), this.linkMenu.destroy(), this.bar.remove();
|
|
2167
2167
|
}
|
|
2168
|
-
}, Qn =
|
|
2168
|
+
}, Qn = k.fromClass(Zn), $n = (e) => (t) => {
|
|
2169
2169
|
if (p(t)) return !1;
|
|
2170
2170
|
let n = t.state.selection.main;
|
|
2171
2171
|
if (!n.empty) return !1;
|
|
2172
2172
|
let { doc: r } = t.state, i = r.lineAt(n.head), a = e ? i.number + 1 : i.number - 1;
|
|
2173
2173
|
if (a < 1 || a > r.lines) return !1;
|
|
2174
2174
|
let o = r.line(a), s = -1, c = -1, l;
|
|
2175
|
-
if (t.state.field(
|
|
2175
|
+
if (t.state.field(wn).between(o.from, o.to, (t, n, r) => {
|
|
2176
2176
|
if (e ? t === o.from : n === o.to) return s = t, c = n, l = r.spec.widget, !1;
|
|
2177
2177
|
}), s < 0) return !1;
|
|
2178
|
-
if (t.state.facet(
|
|
2178
|
+
if (t.state.facet(xe) === "cells") return l instanceof En && l.focusEdge(e ? "first" : "last");
|
|
2179
2179
|
let u = e ? r.lineAt(s).from : r.lineAt(c).to;
|
|
2180
2180
|
return t.dispatch({
|
|
2181
2181
|
selection: { anchor: u },
|
|
2182
2182
|
userEvent: "select",
|
|
2183
2183
|
scrollIntoView: !0
|
|
2184
2184
|
}), !0;
|
|
2185
|
-
}, er = $n(!0), tr = $n(!1), nr =
|
|
2185
|
+
}, er = $n(!0), tr = $n(!1), nr = N.high(j.of([{
|
|
2186
2186
|
key: "ArrowDown",
|
|
2187
2187
|
run: er
|
|
2188
2188
|
}, {
|
|
@@ -2583,7 +2583,7 @@ var Zn = class {
|
|
|
2583
2583
|
},
|
|
2584
2584
|
".cm-inplace-tg-edge:hover .cm-inplace-tg-plus": { color: "var(--stylo-text)" },
|
|
2585
2585
|
"@media (hover: none)": { ".cm-inplace-tg-edge": { opacity: "0.5" } }
|
|
2586
|
-
}, dr =
|
|
2586
|
+
}, dr = O.theme({
|
|
2587
2587
|
...or,
|
|
2588
2588
|
...rr,
|
|
2589
2589
|
...lr,
|
|
@@ -2605,37 +2605,37 @@ function pr(e, t, n) {
|
|
|
2605
2605
|
return o === r ? Math.min(s, i) : o === e && s > 0 ? i : 0;
|
|
2606
2606
|
}
|
|
2607
2607
|
function mr(e = {}) {
|
|
2608
|
-
let t =
|
|
2608
|
+
let t = Te(e.inPlace?.contextMenu);
|
|
2609
2609
|
return [
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2610
|
+
I.of(be(e.inPlace)),
|
|
2611
|
+
L.of(e.embedRegistry ?? null),
|
|
2612
|
+
xe.of(e.inPlace?.table ?? "source"),
|
|
2613
|
+
R.of(e.inPlace?.reveal ?? "caret"),
|
|
2614
|
+
Se.of(e.onLinkClick ?? null),
|
|
2615
|
+
Ce.of(t.enabled),
|
|
2616
|
+
Ee.of(t.groups),
|
|
2617
|
+
ke.of(e.inPlace?.selectionUI ?? "menu"),
|
|
2618
|
+
Oe.of(De(e.inPlace?.selectionBarItems)),
|
|
2619
|
+
mt(),
|
|
2620
2620
|
Pn,
|
|
2621
|
-
|
|
2622
|
-
|
|
2621
|
+
It,
|
|
2622
|
+
Tt,
|
|
2623
2623
|
nr,
|
|
2624
2624
|
Mn,
|
|
2625
2625
|
On,
|
|
2626
|
-
|
|
2626
|
+
Ue,
|
|
2627
2627
|
Wn,
|
|
2628
|
-
|
|
2629
|
-
|
|
2628
|
+
je,
|
|
2629
|
+
wn,
|
|
2630
2630
|
Kn,
|
|
2631
2631
|
Jn,
|
|
2632
2632
|
Qn,
|
|
2633
2633
|
In,
|
|
2634
2634
|
Vn,
|
|
2635
|
+
Xt,
|
|
2635
2636
|
Zt,
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
E.domEventHandlers({
|
|
2637
|
+
N.high(dr),
|
|
2638
|
+
O.domEventHandlers({
|
|
2639
2639
|
mousedown(e, t) {
|
|
2640
2640
|
let n = e.target;
|
|
2641
2641
|
if (n?.closest(".cm-inplace-table-edit") || n?.closest(".stylo-embed-content")) return !1;
|
|
@@ -2661,46 +2661,47 @@ function mr(e = {}) {
|
|
|
2661
2661
|
//#endregion
|
|
2662
2662
|
//#region src/inplace/InPlaceView.tsx
|
|
2663
2663
|
var hr = () => () => {}, gr = () => null;
|
|
2664
|
-
function _r({ value:
|
|
2665
|
-
let
|
|
2666
|
-
|
|
2667
|
-
let
|
|
2668
|
-
|
|
2669
|
-
let [
|
|
2670
|
-
|
|
2671
|
-
let
|
|
2672
|
-
|
|
2673
|
-
}).current,
|
|
2674
|
-
|
|
2675
|
-
let [
|
|
2676
|
-
onWikiLinkClick: (e) =>
|
|
2677
|
-
onLinkClick: (e) =>
|
|
2664
|
+
function _r({ value: e, onChange: n, readOnly: i, placeholder: a, onWikiLinkClick: o, onLinkClick: s, inPlace: c, codeLanguages: l, wikiLinkSource: u, tagSource: d, embedSource: f, onResolveError: p, onSave: m, onViewChange: h, canvasHeader: g }) {
|
|
2665
|
+
let _ = T(o);
|
|
2666
|
+
_.current = o;
|
|
2667
|
+
let ee = T(s);
|
|
2668
|
+
ee.current = s;
|
|
2669
|
+
let [v] = E(() => new ve()), ne = ce(v.subscribe, v.getSnapshot, v.getSnapshot), [re, y] = E(null), b = T(h);
|
|
2670
|
+
b.current = h;
|
|
2671
|
+
let ie = T((e) => {
|
|
2672
|
+
y(e), b.current?.(e);
|
|
2673
|
+
}).current, x = T(g);
|
|
2674
|
+
x.current = g;
|
|
2675
|
+
let [S] = E(() => g ? new r() : null), ae = ce(S?.subscribe ?? hr, S?.getSnapshot ?? gr), [C] = E(() => [mr({
|
|
2676
|
+
onWikiLinkClick: (e) => _.current?.(e),
|
|
2677
|
+
onLinkClick: (e) => ee.current?.(e),
|
|
2678
2678
|
inPlace: c,
|
|
2679
|
-
embedRegistry:
|
|
2680
|
-
}), ...
|
|
2681
|
-
value:
|
|
2679
|
+
embedRegistry: f ? v : void 0
|
|
2680
|
+
}), ...S ? [ue.of(S.panel)] : []]), w = te({
|
|
2681
|
+
value: e,
|
|
2682
2682
|
onChange: n,
|
|
2683
2683
|
readOnly: i,
|
|
2684
2684
|
placeholder: a,
|
|
2685
|
-
extensions:
|
|
2685
|
+
extensions: C,
|
|
2686
2686
|
codeLanguages: l,
|
|
2687
2687
|
wikiLinkSource: u,
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2688
|
+
tagSource: d,
|
|
2689
|
+
onResolveError: p,
|
|
2690
|
+
onSave: m,
|
|
2691
|
+
onViewChange: ie
|
|
2691
2692
|
});
|
|
2692
|
-
return /* @__PURE__ */
|
|
2693
|
-
className:
|
|
2694
|
-
ref:
|
|
2695
|
-
children: [
|
|
2693
|
+
return /* @__PURE__ */ _e("div", {
|
|
2694
|
+
className: t.inplace,
|
|
2695
|
+
ref: w,
|
|
2696
|
+
children: [f && ne.map((e) => de(/* @__PURE__ */ ge(oe, {
|
|
2696
2697
|
reference: e.ref,
|
|
2697
|
-
source:
|
|
2698
|
-
onError:
|
|
2698
|
+
source: f,
|
|
2699
|
+
onError: p,
|
|
2699
2700
|
inline: e.inline
|
|
2700
|
-
}), e.el, String(e.id))),
|
|
2701
|
+
}), e.el, String(e.id))), ae && x.current && de(x.current({ view: re }), ae)]
|
|
2701
2702
|
});
|
|
2702
2703
|
}
|
|
2703
2704
|
//#endregion
|
|
2704
2705
|
export { _r as InPlaceView };
|
|
2705
2706
|
|
|
2706
|
-
//# sourceMappingURL=InPlaceView-
|
|
2707
|
+
//# sourceMappingURL=InPlaceView-BGVCST5f.js.map
|