@damiro/stylo 0.5.0 → 0.7.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 +18 -9
- package/dist/{InPlaceView-B1GXXnoz.js → InPlaceView-CS1qy-Ba.js} +116 -115
- package/dist/{InPlaceView-B1GXXnoz.js.map → InPlaceView-CS1qy-Ba.js.map} +1 -1
- package/dist/{Preview-Dxb9zPVv.js → Preview-Bw0k3Mev.js} +2 -2
- package/dist/{Preview-Dxb9zPVv.js.map → Preview-Bw0k3Mev.js.map} +1 -1
- 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 +4 -2
- 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/theme.d.ts.map +1 -1
- package/dist/editor/useCodeMirror.d.ts +4 -2
- package/dist/editor/useCodeMirror.d.ts.map +1 -1
- package/dist/editor/wikilink-complete.d.ts +15 -0
- package/dist/editor/wikilink-complete.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/inplace/InPlaceView.d.ts +4 -2
- package/dist/inplace/InPlaceView.d.ts.map +1 -1
- package/dist/inplace/theme.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/stylo.js +58 -53
- package/dist/stylo.js.map +1 -1
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/{useCodeMirror-hLeJQw6e.js → useCodeMirror-GPSkaYW6.js} +203 -167
- package/dist/useCodeMirror-GPSkaYW6.js.map +1 -0
- package/dist/wikilink-CTR8IFKc.js +42 -0
- package/dist/wikilink-CTR8IFKc.js.map +1 -0
- package/package.json +4 -1
- package/dist/useCodeMirror-hLeJQw6e.js.map +0 -1
- package/dist/wikilink-BFpTehto.js +0 -42
- package/dist/wikilink-BFpTehto.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as e, n as t, t as n } from "./wikilink-
|
|
2
|
-
import { _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, n as m, o as
|
|
3
|
-
import { a as
|
|
4
|
-
import { t as
|
|
5
|
-
import { r as
|
|
6
|
-
import { useRef as
|
|
7
|
-
import { Decoration as
|
|
1
|
+
import { i as e, n as t, t as n } from "./wikilink-CTR8IFKc.js";
|
|
2
|
+
import { _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, n as m, o as h, p as ee, r as te, s as ne, t as re, u as ie, v as ae, y as oe } from "./useCodeMirror-GPSkaYW6.js";
|
|
3
|
+
import { a as se, i as g } from "./config-DTBxVhtH.js";
|
|
4
|
+
import { t as ce } from "./katex-BfiLlqfN.js";
|
|
5
|
+
import { r as le, t as _ } from "./callout-oLE630ZP.js";
|
|
6
|
+
import { useRef as ue, useState as de } from "react";
|
|
7
|
+
import { Decoration as v, EditorView as y, ViewPlugin as b, WidgetType as x, hoverTooltip as fe, keymap as pe } from "@codemirror/view";
|
|
8
8
|
import { Annotation as me, EditorSelection as he, EditorState as ge, Facet as S, Prec as C, StateEffect as _e, StateField as w } from "@codemirror/state";
|
|
9
9
|
import { syntaxTree as T } from "@codemirror/language";
|
|
10
10
|
import { jsx as ve } from "react/jsx-runtime";
|
|
@@ -66,23 +66,23 @@ var we = S.define({ combine: (e) => e[0] ?? j }), N = S.define({ combine: (e) =>
|
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/inplace/frontmatter.ts
|
|
68
68
|
function Te(e) {
|
|
69
|
-
if (!e.facet(E).frontmatter) return
|
|
69
|
+
if (!e.facet(E).frontmatter) return v.none;
|
|
70
70
|
let n = t(e.doc);
|
|
71
|
-
if (!n) return
|
|
71
|
+
if (!n) return v.none;
|
|
72
72
|
let r = e.doc.lineAt(n.from).number, i = e.doc.lineAt(n.to).number, a = e.selection.ranges.some((t) => {
|
|
73
73
|
let n = e.doc.lineAt(t.from).number;
|
|
74
74
|
return n >= r && n <= i;
|
|
75
75
|
}), o = [];
|
|
76
76
|
for (let t = r; t <= i; t++) {
|
|
77
77
|
let n = e.doc.line(t), s = t === r ? "cm-inplace-fm cm-inplace-fm-first" : "cm-inplace-fm";
|
|
78
|
-
o.push(
|
|
78
|
+
o.push(v.line({ class: s }).range(n.from)), (t === r || t === i) && !a && n.to > n.from && o.push(v.replace({}).range(n.from, n.to));
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return v.set(o, !0);
|
|
81
81
|
}
|
|
82
82
|
var Ee = w.define({
|
|
83
83
|
create: Te,
|
|
84
84
|
update: (e, t) => t.docChanged || t.selection ? Te(t.state) : e,
|
|
85
|
-
provide: (e) =>
|
|
85
|
+
provide: (e) => y.decorations.from(e)
|
|
86
86
|
});
|
|
87
87
|
//#endregion
|
|
88
88
|
//#region src/inplace/list-guides.ts
|
|
@@ -102,7 +102,7 @@ function Oe(e, t, n, r, i, a) {
|
|
|
102
102
|
let t = De(e) - 1;
|
|
103
103
|
if (t < 1) return;
|
|
104
104
|
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;
|
|
105
|
-
for (let e = n; e <= s; e++) o.has(e) || (o.add(e), a.push(
|
|
105
|
+
for (let e = n; e <= s; e++) o.has(e) || (o.add(e), a.push(v.line({
|
|
106
106
|
class: "cm-inplace-li",
|
|
107
107
|
attributes: { style: `--sl-li-depth:${t}` }
|
|
108
108
|
}).range(r.line(e).from)));
|
|
@@ -143,7 +143,7 @@ function I(e, t, n, r) {
|
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region src/inplace/math.ts
|
|
146
|
-
var Ae = /(?<![\w$])\$(?!\s)([^\n$]+?)(?<!\s)\$(?![\w$])/g, je = /(?<![\w$])\$\$([^\n$]+?)\$\$(?![\w$])/g, Me = /(?<![\w$])\$\$([^]+?)\$\$/g, L = class extends
|
|
146
|
+
var Ae = /(?<![\w$])\$(?!\s)([^\n$]+?)(?<!\s)\$(?![\w$])/g, je = /(?<![\w$])\$\$([^\n$]+?)\$\$(?![\w$])/g, Me = /(?<![\w$])\$\$([^]+?)\$\$/g, L = class extends x {
|
|
147
147
|
src;
|
|
148
148
|
block;
|
|
149
149
|
constructor(e, t) {
|
|
@@ -156,7 +156,7 @@ var Ae = /(?<![\w$])\$(?!\s)([^\n$]+?)(?<!\s)\$(?![\w$])/g, je = /(?<![\w$])\$\$
|
|
|
156
156
|
let e = document.createElement(this.block ? "div" : "span");
|
|
157
157
|
e.className = this.block ? "cm-inplace-math cm-inplace-math-block" : "cm-inplace-math";
|
|
158
158
|
try {
|
|
159
|
-
|
|
159
|
+
ce.render(this.src, e, {
|
|
160
160
|
displayMode: this.block,
|
|
161
161
|
throwOnError: !1
|
|
162
162
|
});
|
|
@@ -175,11 +175,11 @@ function Ne(e, t, n, r, i, a) {
|
|
|
175
175
|
let { doc: s } = e.state, c = [];
|
|
176
176
|
for (let e of o.matchAll(je)) {
|
|
177
177
|
let n = (e[1] ?? "").trim(), o = t + (e.index ?? 0), l = o + (e[0] ?? "").length;
|
|
178
|
-
!n || F(i, o + 2) || (c.push([o, l]), !I(r, s, o, l) && a.push(
|
|
178
|
+
!n || F(i, o + 2) || (c.push([o, l]), !I(r, s, o, l) && a.push(v.replace({ widget: new L(n, !0) }).range(o, l)));
|
|
179
179
|
}
|
|
180
180
|
for (let e of o.matchAll(Ae)) {
|
|
181
181
|
let n = (e[1] ?? "").trim(), o = t + (e.index ?? 0), l = o + (e[0] ?? "").length;
|
|
182
|
-
!n || F(i, o + 1) || c.some(([e, t]) => o >= e && l <= t) || I(r, s, o, l) || a.push(
|
|
182
|
+
!n || F(i, o + 1) || c.some(([e, t]) => o >= e && l <= t) || I(r, s, o, l) || a.push(v.replace({ widget: new L(n, !1) }).range(o, l));
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
var Pe = w.define({
|
|
@@ -187,27 +187,27 @@ var Pe = w.define({
|
|
|
187
187
|
update(e, t) {
|
|
188
188
|
return t.docChanged || t.selection ? Fe(t.state) : e;
|
|
189
189
|
},
|
|
190
|
-
provide: (e) => [
|
|
190
|
+
provide: (e) => [y.decorations.from(e), y.atomicRanges.of((t) => t.state.field(e))]
|
|
191
191
|
});
|
|
192
192
|
function Fe(e) {
|
|
193
|
-
if (!e.facet(E).math) return
|
|
193
|
+
if (!e.facet(E).math) return v.none;
|
|
194
194
|
let t = e.doc.toString();
|
|
195
|
-
if (!t.includes("$$")) return
|
|
195
|
+
if (!t.includes("$$")) return v.none;
|
|
196
196
|
let n = [], r = P(e), i = T(e);
|
|
197
197
|
for (let a of t.matchAll(Me)) {
|
|
198
198
|
let t = a[0] ?? "", o = (a[1] ?? "").trim();
|
|
199
199
|
if (!o || !t.includes("\n")) continue;
|
|
200
200
|
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();
|
|
201
|
-
d === "" && f === "" && (F(i, s + 2) || I(r, e.doc, s, c) || n.push(
|
|
201
|
+
d === "" && f === "" && (F(i, s + 2) || I(r, e.doc, s, c) || n.push(v.replace({
|
|
202
202
|
widget: new L(o, !0),
|
|
203
203
|
block: !0
|
|
204
204
|
}).range(s, c)));
|
|
205
205
|
}
|
|
206
|
-
return
|
|
206
|
+
return v.set(n, !0);
|
|
207
207
|
}
|
|
208
208
|
//#endregion
|
|
209
209
|
//#region src/inplace/widgets.ts
|
|
210
|
-
var Ie = class extends
|
|
210
|
+
var Ie = class extends x {
|
|
211
211
|
eq() {
|
|
212
212
|
return !0;
|
|
213
213
|
}
|
|
@@ -218,7 +218,7 @@ var Ie = class extends b {
|
|
|
218
218
|
ignoreEvent() {
|
|
219
219
|
return !1;
|
|
220
220
|
}
|
|
221
|
-
}, Le = class extends
|
|
221
|
+
}, Le = class extends x {
|
|
222
222
|
eq() {
|
|
223
223
|
return !0;
|
|
224
224
|
}
|
|
@@ -229,7 +229,7 @@ var Ie = class extends b {
|
|
|
229
229
|
ignoreEvent() {
|
|
230
230
|
return !1;
|
|
231
231
|
}
|
|
232
|
-
}, Re = class extends
|
|
232
|
+
}, Re = class extends x {
|
|
233
233
|
checked;
|
|
234
234
|
constructor(e) {
|
|
235
235
|
super(), this.checked = e;
|
|
@@ -280,7 +280,7 @@ function Ue(e, t) {
|
|
|
280
280
|
if (l) {
|
|
281
281
|
if (o.headings) {
|
|
282
282
|
let t = n.lineAt(e.from);
|
|
283
|
-
if (a.push(
|
|
283
|
+
if (a.push(v.line({
|
|
284
284
|
class: `cm-inplace-heading cm-inplace-h${l[1]}`,
|
|
285
285
|
attributes: {
|
|
286
286
|
role: "heading",
|
|
@@ -288,7 +288,7 @@ function Ue(e, t) {
|
|
|
288
288
|
}
|
|
289
289
|
}).range(t.from)), !r.has(t.number)) {
|
|
290
290
|
let n = e.node.firstChild;
|
|
291
|
-
n?.name === "HeaderMark" && a.push(
|
|
291
|
+
n?.name === "HeaderMark" && a.push(v.replace({}).range(n.from, Math.min(n.to + 1, t.to)));
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
return;
|
|
@@ -297,7 +297,7 @@ function Ue(e, t) {
|
|
|
297
297
|
if (u) {
|
|
298
298
|
if (o.headings) {
|
|
299
299
|
let t = n.lineAt(e.from);
|
|
300
|
-
a.push(
|
|
300
|
+
a.push(v.line({
|
|
301
301
|
class: `cm-inplace-heading cm-inplace-h${u[1]}`,
|
|
302
302
|
attributes: {
|
|
303
303
|
role: "heading",
|
|
@@ -307,7 +307,7 @@ function Ue(e, t) {
|
|
|
307
307
|
let r = e.node.getChild("HeaderMark");
|
|
308
308
|
if (r) {
|
|
309
309
|
let e = n.lineAt(r.from);
|
|
310
|
-
!i.has(t.number) && !i.has(e.number) && (a.push(
|
|
310
|
+
!i.has(t.number) && !i.has(e.number) && (a.push(v.line({ class: "cm-inplace-setext-rule" }).range(e.from)), a.push(v.replace({}).range(r.from, r.to)));
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
return;
|
|
@@ -316,43 +316,43 @@ function Ue(e, t) {
|
|
|
316
316
|
if (d) {
|
|
317
317
|
if (!o[d.toggle]) return;
|
|
318
318
|
let t = e.node.getChildren(d.mark), i = t[0], s = t[t.length - 1], c = i && s && i !== s, l = c ? i.to : e.from, u = c ? s.from : e.to;
|
|
319
|
-
u > l && a.push(
|
|
319
|
+
u > l && a.push(v.mark({ class: d.className }).range(l, u)), c && !r.has(n.lineAt(e.from).number) && (a.push(v.replace({}).range(i.from, i.to)), a.push(v.replace({}).range(s.from, s.to)));
|
|
320
320
|
return;
|
|
321
321
|
}
|
|
322
322
|
if (e.name === "Link") {
|
|
323
323
|
let t = n.sliceString(Math.max(0, e.from - 1), e.from), i = n.sliceString(e.to, e.to + 1);
|
|
324
324
|
if (t === "[" && i === "]" || !o.links) return !1;
|
|
325
|
-
let s = n.lineAt(e.from), c =
|
|
325
|
+
let s = n.lineAt(e.from), c = _.exec(s.text);
|
|
326
326
|
if (c && e.from - s.from < c[1].length + c[2].length) return !1;
|
|
327
327
|
let l = e.node.getChildren("LinkMark");
|
|
328
328
|
if (l.length >= 2) {
|
|
329
329
|
let t = l[0], i = l[1];
|
|
330
|
-
i.from > t.to && a.push(
|
|
330
|
+
i.from > t.to && a.push(v.mark({ class: "cm-inplace-link" }).range(t.to, i.from)), r.has(n.lineAt(e.from).number) || (a.push(v.replace({}).range(e.from, t.to)), a.push(v.replace({}).range(i.from, e.to)));
|
|
331
331
|
}
|
|
332
332
|
return;
|
|
333
333
|
}
|
|
334
334
|
if (e.name === "HorizontalRule") {
|
|
335
335
|
if (!o.horizontalRule) return !1;
|
|
336
336
|
let t = n.lineAt(e.from);
|
|
337
|
-
return i.has(t.number) || (a.push(
|
|
337
|
+
return i.has(t.number) || (a.push(v.line({ class: "cm-inplace-hr-line" }).range(t.from)), a.push(v.replace({ widget: new Ie() }).range(t.from, t.to))), !1;
|
|
338
338
|
}
|
|
339
339
|
if (e.name === "Blockquote") {
|
|
340
340
|
if (o.blockquote) {
|
|
341
|
-
let t = n.lineAt(e.from).number, o = n.lineAt(Math.min(e.to, n.length)).number, s = n.line(t), l =
|
|
341
|
+
let t = n.lineAt(e.from).number, o = n.lineAt(Math.min(e.to, n.length)).number, s = n.line(t), l = _.exec(s.text), u = l ? le(l[3]) : null, d = !1;
|
|
342
342
|
for (let e = t; e <= o; e++) i.has(e) && (d = !0);
|
|
343
343
|
if (d) for (let e = t; e <= o; e++) c.add(e);
|
|
344
344
|
for (let e = t; e <= o; e++) {
|
|
345
345
|
let r = u ? `cm-inplace-callout cm-inplace-callout-${u}` : "cm-inplace-quote";
|
|
346
346
|
u && e === t && (r += " cm-inplace-callout-head"), u && e === o && (r += " cm-inplace-callout-foot");
|
|
347
347
|
let i = {};
|
|
348
|
-
u && (i["data-callout"] = l[3].toLowerCase()), u && d && (i["data-revealed"] = ""), a.push(
|
|
348
|
+
u && (i["data-callout"] = l[3].toLowerCase()), u && d && (i["data-revealed"] = ""), a.push(v.line({
|
|
349
349
|
class: r,
|
|
350
350
|
attributes: i
|
|
351
351
|
}).range(n.line(e).from));
|
|
352
352
|
}
|
|
353
353
|
if (u && !d && !r.has(t)) {
|
|
354
354
|
let e = s.from + l[1].length;
|
|
355
|
-
a.push(
|
|
355
|
+
a.push(v.replace({}).range(e, e + l[2].length));
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
return;
|
|
@@ -361,20 +361,20 @@ function Ue(e, t) {
|
|
|
361
361
|
if (!o.blockquote) return !1;
|
|
362
362
|
let t = n.lineAt(e.from);
|
|
363
363
|
if (!r.has(t.number) && !c.has(t.number)) {
|
|
364
|
-
let n = Math.min(e.to + 1, t.to), r =
|
|
365
|
-
a.push(
|
|
364
|
+
let n = Math.min(e.to + 1, t.to), r = _.exec(t.text), i = r ? t.text.slice(r[1].length + r[2].length) : t.text.slice(n - t.from);
|
|
365
|
+
a.push(v.replace({}).range(e.from, i.trim() === "" ? e.to : n));
|
|
366
366
|
}
|
|
367
367
|
return !1;
|
|
368
368
|
}
|
|
369
369
|
if (e.name === "ListMark") {
|
|
370
370
|
let t = n.sliceString(e.from, e.to), i = n.lineAt(e.from), s = e.node.parent, c = !!(s?.getChild("Task") ?? s?.getChild("TaskMarker"));
|
|
371
|
-
return r.has(i.number) || (c ? o.tasks && a.push(
|
|
371
|
+
return r.has(i.number) || (c ? o.tasks && a.push(v.replace({}).range(e.from, Math.min(e.to + 1, i.to))) : o.lists && Ve.test(t) && a.push(v.replace({ widget: new Le() }).range(e.from, e.to))), !1;
|
|
372
372
|
}
|
|
373
373
|
if (e.name === "TaskMarker") {
|
|
374
374
|
if (!o.tasks) return !1;
|
|
375
375
|
if (!r.has(n.lineAt(e.from).number)) {
|
|
376
376
|
let t = n.sliceString(e.from + 1, e.to - 1).toLowerCase() === "x";
|
|
377
|
-
a.push(
|
|
377
|
+
a.push(v.replace({ widget: new Re(t) }).range(e.from, e.to));
|
|
378
378
|
}
|
|
379
379
|
return !1;
|
|
380
380
|
}
|
|
@@ -387,7 +387,7 @@ function Ue(e, t) {
|
|
|
387
387
|
let i = t && (e === r || e === s), o = "cm-inplace-mono";
|
|
388
388
|
e === r && (o += " cm-inplace-code-top"), e === s && (o += " cm-inplace-code-bottom"), i && (o += l ? " cm-inplace-code-pad" : " cm-inplace-fence");
|
|
389
389
|
let c = n.line(e);
|
|
390
|
-
a.push(
|
|
390
|
+
a.push(v.line({ class: o }).range(c.from)), i && l && c.to > c.from && a.push(v.replace({}).range(c.from, c.to));
|
|
391
391
|
}
|
|
392
392
|
return !1;
|
|
393
393
|
}
|
|
@@ -400,15 +400,15 @@ function We(e, t, r, i, a, o) {
|
|
|
400
400
|
let [n = "", s = "", c] = r, l = s.trim(), u = t + (r.index ?? 0);
|
|
401
401
|
if (!l || F(a, u + 1)) continue;
|
|
402
402
|
let d = u + n.length, f = c == null ? u + 2 : u + 2 + s.length + 1, p = d - 2;
|
|
403
|
-
o.push(
|
|
403
|
+
o.push(v.mark({
|
|
404
404
|
class: "cm-inplace-link cm-inplace-wikilink",
|
|
405
405
|
attributes: { "data-stylo-wikilink": l }
|
|
406
|
-
}).range(f, p)), i.has(e.state.doc.lineAt(u).number) || (o.push(
|
|
406
|
+
}).range(f, p)), i.has(e.state.doc.lineAt(u).number) || (o.push(v.replace({}).range(u, f)), o.push(v.replace({}).range(p, d)));
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
//#endregion
|
|
410
410
|
//#region src/inplace/decorate.ts
|
|
411
|
-
var Ge = /* @__PURE__ */ new Set(), Ke =
|
|
411
|
+
var Ge = /* @__PURE__ */ new Set(), Ke = v.replace({});
|
|
412
412
|
function qe(e) {
|
|
413
413
|
let n = [], r = P(e.state), i = e.state.facet(O) === "never" ? Ge : r, a = T(e.state), { doc: o } = e.state, s = e.state.facet(E), c = {
|
|
414
414
|
doc: o,
|
|
@@ -434,13 +434,13 @@ function qe(e) {
|
|
|
434
434
|
t && e.from <= t.to ? e.to > t.to && (u[u.length - 1] = Ke.range(t.from, e.to)) : u.push(Ke.range(e.from, e.to));
|
|
435
435
|
}
|
|
436
436
|
return {
|
|
437
|
-
decorations:
|
|
438
|
-
atomic:
|
|
437
|
+
decorations: v.set(n, !0),
|
|
438
|
+
atomic: v.set(u, !0)
|
|
439
439
|
};
|
|
440
440
|
}
|
|
441
441
|
//#endregion
|
|
442
442
|
//#region src/inplace/plugin.ts
|
|
443
|
-
var R =
|
|
443
|
+
var R = b.fromClass(class {
|
|
444
444
|
decorations;
|
|
445
445
|
atomic;
|
|
446
446
|
constructor(e) {
|
|
@@ -455,7 +455,7 @@ var R = y.fromClass(class {
|
|
|
455
455
|
}
|
|
456
456
|
}, {
|
|
457
457
|
decorations: (e) => e.decorations,
|
|
458
|
-
provide: (e) =>
|
|
458
|
+
provide: (e) => y.atomicRanges.of((t) => t.plugin(e)?.atomic ?? v.none)
|
|
459
459
|
});
|
|
460
460
|
function Je() {
|
|
461
461
|
return R;
|
|
@@ -580,7 +580,7 @@ var V = (e, t) => (n) => {
|
|
|
580
580
|
selection: a,
|
|
581
581
|
userEvent: "select"
|
|
582
582
|
}), !0;
|
|
583
|
-
}, tt = V(!1, !1), nt = V(!0, !1), rt = V(!1, !0), it = V(!0, !0), at = C.high(
|
|
583
|
+
}, tt = V(!1, !1), nt = V(!0, !1), rt = V(!1, !0), it = V(!0, !0), at = C.high(pe.of([
|
|
584
584
|
{
|
|
585
585
|
key: "Backspace",
|
|
586
586
|
run: Qe
|
|
@@ -605,7 +605,7 @@ var V = (e, t) => (n) => {
|
|
|
605
605
|
key: "Shift-ArrowRight",
|
|
606
606
|
run: it
|
|
607
607
|
}
|
|
608
|
-
])), ot = (e) => e === "h1" || e === "h2" || e === "h3" ?
|
|
608
|
+
])), ot = (e) => e === "h1" || e === "h2" || e === "h3" ? g.heading : g[e], st = [
|
|
609
609
|
"bold",
|
|
610
610
|
"italic",
|
|
611
611
|
"strike"
|
|
@@ -656,17 +656,17 @@ var pt = (e, t, n = !1) => {
|
|
|
656
656
|
return [
|
|
657
657
|
{
|
|
658
658
|
label: "Cut",
|
|
659
|
-
icon:
|
|
659
|
+
icon: g.cut,
|
|
660
660
|
onSelect: n("cut")
|
|
661
661
|
},
|
|
662
662
|
{
|
|
663
663
|
label: "Copy",
|
|
664
|
-
icon:
|
|
664
|
+
icon: g.copy,
|
|
665
665
|
onSelect: n("copy")
|
|
666
666
|
},
|
|
667
667
|
i ? {
|
|
668
668
|
label: "Paste",
|
|
669
|
-
icon:
|
|
669
|
+
icon: g.paste,
|
|
670
670
|
onSelect: () => {
|
|
671
671
|
let n = o(e);
|
|
672
672
|
n || e.focus(), r?.readText().then((r) => {
|
|
@@ -675,7 +675,7 @@ var pt = (e, t, n = !1) => {
|
|
|
675
675
|
}
|
|
676
676
|
} : {
|
|
677
677
|
label: "Paste",
|
|
678
|
-
icon:
|
|
678
|
+
icon: g.paste,
|
|
679
679
|
disabled: !0,
|
|
680
680
|
title: "Paste with the keyboard shortcut",
|
|
681
681
|
onSelect: () => {}
|
|
@@ -688,13 +688,13 @@ var pt = (e, t, n = !1) => {
|
|
|
688
688
|
function gt(e, t) {
|
|
689
689
|
let n = e.doc.lineAt(t.from);
|
|
690
690
|
if (e.doc.lineAt(t.to).number !== n.number) return null;
|
|
691
|
-
let r = t.from - n.from, i = t.to - n.from, a =
|
|
691
|
+
let r = t.from - n.from, i = t.to - n.from, a = ae(n.text, r) ?? ae(n.text, i);
|
|
692
692
|
if (a) return {
|
|
693
693
|
from: n.from + a.from,
|
|
694
694
|
to: n.from + a.to,
|
|
695
695
|
text: a.label
|
|
696
696
|
};
|
|
697
|
-
let o =
|
|
697
|
+
let o = oe(n.text, r) ?? oe(n.text, i);
|
|
698
698
|
return o ? {
|
|
699
699
|
from: n.from + o.from,
|
|
700
700
|
to: n.from + o.to,
|
|
@@ -702,12 +702,12 @@ function gt(e, t) {
|
|
|
702
702
|
} : null;
|
|
703
703
|
}
|
|
704
704
|
function G(e) {
|
|
705
|
-
let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i =
|
|
705
|
+
let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i = ae(r.text, n.head - r.from);
|
|
706
706
|
if (i) {
|
|
707
707
|
let n = r.from + i.from, a = r.from + i.to, o = r.from + i.urlFrom, s = r.from + i.urlTo, c = t.facet(xe), l = [];
|
|
708
708
|
return c && i.url && l.push({
|
|
709
709
|
label: "Open link",
|
|
710
|
-
icon:
|
|
710
|
+
icon: g.link,
|
|
711
711
|
onSelect: () => c(i.url)
|
|
712
712
|
}), l.push({
|
|
713
713
|
label: "Remove link",
|
|
@@ -727,7 +727,7 @@ function G(e) {
|
|
|
727
727
|
}), {
|
|
728
728
|
field: !0,
|
|
729
729
|
label: "Edit external link",
|
|
730
|
-
icon:
|
|
730
|
+
icon: g.link,
|
|
731
731
|
value: ht(i.url),
|
|
732
732
|
placeholder: "https://…",
|
|
733
733
|
onSubmit: (t) => {
|
|
@@ -744,7 +744,7 @@ function G(e) {
|
|
|
744
744
|
return {
|
|
745
745
|
field: !0,
|
|
746
746
|
label: "Add external link",
|
|
747
|
-
icon:
|
|
747
|
+
icon: g.link,
|
|
748
748
|
value: "",
|
|
749
749
|
placeholder: "https://…",
|
|
750
750
|
onSubmit: (t) => {
|
|
@@ -769,7 +769,7 @@ function _t(e) {
|
|
|
769
769
|
return {
|
|
770
770
|
field: !0,
|
|
771
771
|
label: "Edit link",
|
|
772
|
-
icon:
|
|
772
|
+
icon: g.wikilink,
|
|
773
773
|
value: i.target,
|
|
774
774
|
placeholder: "note or path",
|
|
775
775
|
onSubmit: (t) => {
|
|
@@ -801,7 +801,7 @@ function _t(e) {
|
|
|
801
801
|
return {
|
|
802
802
|
field: !0,
|
|
803
803
|
label: "Add link",
|
|
804
|
-
icon:
|
|
804
|
+
icon: g.wikilink,
|
|
805
805
|
value: "",
|
|
806
806
|
placeholder: "note or path",
|
|
807
807
|
onSubmit: (t) => {
|
|
@@ -827,11 +827,11 @@ var K = (e, t, n, r = !1) => ({
|
|
|
827
827
|
disabled: r
|
|
828
828
|
});
|
|
829
829
|
function vt(e) {
|
|
830
|
-
let t =
|
|
830
|
+
let t = h(e.state);
|
|
831
831
|
return {
|
|
832
832
|
field: !0,
|
|
833
833
|
label: "Language",
|
|
834
|
-
icon:
|
|
834
|
+
icon: g.codeBlock,
|
|
835
835
|
value: t?.lang ?? "",
|
|
836
836
|
placeholder: "ts, python, …",
|
|
837
837
|
onSubmit: (n) => {
|
|
@@ -856,7 +856,7 @@ var yt = (e, t = !1) => [
|
|
|
856
856
|
];
|
|
857
857
|
function bt(e) {
|
|
858
858
|
let t = e.state.facet(M), n = [];
|
|
859
|
-
return t.includes("format") && q(n, [K("Format",
|
|
859
|
+
return t.includes("format") && q(n, [K("Format", g.format, yt(e, !0))]), t.includes("clipboard") && q(n, W(e)), n;
|
|
860
860
|
}
|
|
861
861
|
var xt = (e) => [
|
|
862
862
|
...U(e, lt),
|
|
@@ -875,12 +875,12 @@ function q(e, t) {
|
|
|
875
875
|
function Ct(e) {
|
|
876
876
|
let { state: t } = e, n = t.facet(M), r = (e) => n.includes(e);
|
|
877
877
|
if (H(e)) return bt(e);
|
|
878
|
-
if (
|
|
878
|
+
if (ne(t)) {
|
|
879
879
|
let t = [vt(e)];
|
|
880
880
|
return r("clipboard") && q(t, W(e)), t;
|
|
881
881
|
}
|
|
882
882
|
let i = t.selection.main, a = t.doc.lineAt(i.head).text.trim() === "", o = !i.empty || !!t.wordAt(i.head), s = t.facet(N) === "menu", c = [];
|
|
883
|
-
for (let t of n) t === "link" && s ? q(c, [_t(e), G(e)]) : t === "format" && s ? q(c, [K("Format",
|
|
883
|
+
for (let t of n) t === "link" && s ? q(c, [_t(e), G(e)]) : t === "format" && s ? q(c, [K("Format", g.format, yt(e), !o)]) : t === "paragraph" ? q(c, [K("Paragraph", g.paragraph, xt(e))]) : t === "insert" ? q(c, [K("Insert", g.insert, St(e), !a)]) : t === "clipboard" && q(c, W(e));
|
|
884
884
|
return c;
|
|
885
885
|
}
|
|
886
886
|
//#endregion
|
|
@@ -898,7 +898,7 @@ var Tt = [
|
|
|
898
898
|
re: /(?<![\d$])\$(?!\s)([^$\n]+?)(?<!\s)\$(?![\d$])/,
|
|
899
899
|
build: (e) => {
|
|
900
900
|
let t = J("span", "cm-inplace-math");
|
|
901
|
-
return
|
|
901
|
+
return ce.render(e[1], t, { throwOnError: !1 }), t;
|
|
902
902
|
}
|
|
903
903
|
},
|
|
904
904
|
{
|
|
@@ -992,7 +992,7 @@ function X(e, t = "cm-inplace-menu", n) {
|
|
|
992
992
|
}, l = (e) => e.addEventListener("mousedown", (e) => {
|
|
993
993
|
e.preventDefault(), e.stopPropagation();
|
|
994
994
|
}), u = (t, n, r) => {
|
|
995
|
-
r && t.appendChild(
|
|
995
|
+
r && t.appendChild(se(e, r));
|
|
996
996
|
let i = e.createElement("span");
|
|
997
997
|
i.textContent = n, t.appendChild(i);
|
|
998
998
|
}, d = (n) => {
|
|
@@ -1010,7 +1010,7 @@ function X(e, t = "cm-inplace-menu", n) {
|
|
|
1010
1010
|
if (a?.dataset.for === n) return;
|
|
1011
1011
|
s();
|
|
1012
1012
|
let e = o();
|
|
1013
|
-
e.dataset.for = n, i.appendChild(e),
|
|
1013
|
+
e.dataset.for = n, i.appendChild(e), ee(e, d.getBoundingClientRect()), a = e, e.querySelector("input")?.focus({ preventScroll: !0 });
|
|
1014
1014
|
};
|
|
1015
1015
|
return d.addEventListener("pointerenter", f), d.addEventListener("click", (e) => {
|
|
1016
1016
|
e.stopPropagation(), f();
|
|
@@ -1035,17 +1035,17 @@ function X(e, t = "cm-inplace-menu", n) {
|
|
|
1035
1035
|
n.className = `${t}-sep`, r.appendChild(n);
|
|
1036
1036
|
} else Ot(i) ? r.appendChild(f(i.label, i.icon, () => m(i.rows), i.disabled)) : kt(i) ? r.appendChild(f(i.label, i.icon, () => p(i))) : r.appendChild(d(i));
|
|
1037
1037
|
return r;
|
|
1038
|
-
},
|
|
1038
|
+
}, h = (e, t, n) => {
|
|
1039
1039
|
let i = r?.innerWidth ?? 0, a = r?.innerHeight ?? 0;
|
|
1040
1040
|
e.style.left = "0", e.style.top = "0";
|
|
1041
1041
|
let { width: o, height: s } = e.getBoundingClientRect();
|
|
1042
1042
|
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`;
|
|
1043
|
-
},
|
|
1043
|
+
}, ee = (e, t) => {
|
|
1044
1044
|
let n = r?.innerWidth ?? 0, i = r?.innerHeight ?? 0;
|
|
1045
1045
|
e.style.left = "0", e.style.top = "0";
|
|
1046
1046
|
let { width: a, height: o } = e.getBoundingClientRect(), s = t.right - 4, c = s + a > n - 4 ? t.left - a + 4 : s;
|
|
1047
1047
|
e.style.left = `${Math.max(4, c)}px`, e.style.top = `${Math.max(4, Math.min(t.top - 4, i - o - 4))}px`;
|
|
1048
|
-
},
|
|
1048
|
+
}, te = () => {
|
|
1049
1049
|
let t = Date.now(), n = (e) => !i.contains(e.target), r = (e) => {
|
|
1050
1050
|
n(e) && c();
|
|
1051
1051
|
}, a = (e) => {
|
|
@@ -1065,12 +1065,12 @@ function X(e, t = "cm-inplace-menu", n) {
|
|
|
1065
1065
|
show: (e, t, r) => {
|
|
1066
1066
|
c();
|
|
1067
1067
|
let a = m(e);
|
|
1068
|
-
i.appendChild(a), i.hidden = !1,
|
|
1068
|
+
i.appendChild(a), i.hidden = !1, h(a, t, r), te(), n?.(!0);
|
|
1069
1069
|
},
|
|
1070
1070
|
showField: (e, t, r) => {
|
|
1071
1071
|
c();
|
|
1072
1072
|
let a = p(e);
|
|
1073
|
-
i.appendChild(a), i.hidden = !1,
|
|
1073
|
+
i.appendChild(a), i.hidden = !1, h(a, t, r), a.querySelector("input")?.focus({ preventScroll: !0 }), te(), n?.(!0);
|
|
1074
1074
|
},
|
|
1075
1075
|
hide: c,
|
|
1076
1076
|
destroy: () => {
|
|
@@ -1190,7 +1190,7 @@ function Ft(e, t, n) {
|
|
|
1190
1190
|
}
|
|
1191
1191
|
//#endregion
|
|
1192
1192
|
//#region src/inplace/table-widget.ts
|
|
1193
|
-
var Q = me.define(), It = class extends
|
|
1193
|
+
var Q = me.define(), It = class extends x {
|
|
1194
1194
|
data;
|
|
1195
1195
|
table = null;
|
|
1196
1196
|
rows;
|
|
@@ -1202,7 +1202,7 @@ var Q = me.define(), It = class extends b {
|
|
|
1202
1202
|
longPress = null;
|
|
1203
1203
|
longPressAt = 0;
|
|
1204
1204
|
constructor(e) {
|
|
1205
|
-
super(), this.data = e, this.rows =
|
|
1205
|
+
super(), this.data = e, this.rows = ie(e), this.current = l(this.rows);
|
|
1206
1206
|
}
|
|
1207
1207
|
eq(e) {
|
|
1208
1208
|
return !this.table && JSON.stringify(this.current) === JSON.stringify(e.current);
|
|
@@ -1279,7 +1279,7 @@ var Q = me.define(), It = class extends b {
|
|
|
1279
1279
|
onFocusIn(e) {
|
|
1280
1280
|
let t = e.target.closest("td, th");
|
|
1281
1281
|
if (!t || t === this.editing) return;
|
|
1282
|
-
let n = this.pendingOffset ??
|
|
1282
|
+
let n = this.pendingOffset ?? ee(t);
|
|
1283
1283
|
this.pendingOffset = null, this.editing && this.finish(this.editing, !1), this.editing = t, this.paint(t, !0), c(t, n);
|
|
1284
1284
|
}
|
|
1285
1285
|
onFocusOut(e) {
|
|
@@ -1559,7 +1559,7 @@ function Ut(e) {
|
|
|
1559
1559
|
}
|
|
1560
1560
|
return null;
|
|
1561
1561
|
}
|
|
1562
|
-
var Wt = C.high(
|
|
1562
|
+
var Wt = C.high(pe.of([{
|
|
1563
1563
|
key: "Backspace",
|
|
1564
1564
|
run: (e) => {
|
|
1565
1565
|
if (o(e)) return !1;
|
|
@@ -1605,7 +1605,7 @@ var Wt = C.high(x.of([{
|
|
|
1605
1605
|
destroy() {
|
|
1606
1606
|
this.contentDOM.removeEventListener("click", this.onClick), this.menu.destroy();
|
|
1607
1607
|
}
|
|
1608
|
-
}, Kt =
|
|
1608
|
+
}, Kt = b.fromClass(Gt), qt = (e) => e.replace(/^<([^]*)>$/, "$1").trim(), Jt = (e, t, n) => n ? {
|
|
1609
1609
|
pos: e,
|
|
1610
1610
|
end: t,
|
|
1611
1611
|
above: !0,
|
|
@@ -1631,7 +1631,7 @@ function Xt(e, t) {
|
|
|
1631
1631
|
}
|
|
1632
1632
|
return null;
|
|
1633
1633
|
}
|
|
1634
|
-
var Zt =
|
|
1634
|
+
var Zt = fe((e, t) => {
|
|
1635
1635
|
let n = e.state.facet(E);
|
|
1636
1636
|
return (n.links ? Yt(e, t) : null) ?? (n.wikilinks ? Xt(e, t) : null);
|
|
1637
1637
|
}), Qt = _e.define(), $ = w.define({
|
|
@@ -1692,7 +1692,7 @@ var Zt = pe((e, t) => {
|
|
|
1692
1692
|
destroy() {
|
|
1693
1693
|
this.destroyed = !0, this.contentDOM.removeEventListener("pointerdown", this.onPointerDown, !0), this.contentDOM.removeEventListener("contextmenu", this.onContextMenu), this.longPress.dispose(), this.menu.destroy();
|
|
1694
1694
|
}
|
|
1695
|
-
}, en =
|
|
1695
|
+
}, en = b.fromClass($t), tn = class {
|
|
1696
1696
|
view;
|
|
1697
1697
|
bar;
|
|
1698
1698
|
ids;
|
|
@@ -1710,7 +1710,7 @@ var Zt = pe((e, t) => {
|
|
|
1710
1710
|
this.ids = e.state.facet(we), this.linkMenu = X(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;
|
|
1711
1711
|
for (let n of this.ids) {
|
|
1712
1712
|
let r = m[n], i = t.createElement("button");
|
|
1713
|
-
i.type = "button", i.className = "cm-inplace-selbar-btn", i.title = r.title, i.setAttribute("aria-label", r.title), i.appendChild(
|
|
1713
|
+
i.type = "button", i.className = "cm-inplace-selbar-btn", i.title = r.title, i.setAttribute("aria-label", r.title), i.appendChild(se(t, g[n] ?? "")), i.addEventListener("mousedown", (e) => e.preventDefault()), i.addEventListener("click", (t) => {
|
|
1714
1714
|
t.preventDefault();
|
|
1715
1715
|
let a = !!o(e), s = !a && n === "link" ? G(e) : !a && n === "wikilink" ? _t(e) : null;
|
|
1716
1716
|
if (s) {
|
|
@@ -1793,7 +1793,7 @@ var Zt = pe((e, t) => {
|
|
|
1793
1793
|
let e = this.view.dom.ownerDocument;
|
|
1794
1794
|
e.removeEventListener("scroll", this.onScroll, !0), e.removeEventListener("selectionchange", this.onSelectionChange), this.linkMenu.destroy(), this.bar.remove();
|
|
1795
1795
|
}
|
|
1796
|
-
}, nn =
|
|
1796
|
+
}, nn = b.fromClass(tn), rn = class extends x {
|
|
1797
1797
|
table;
|
|
1798
1798
|
constructor(e) {
|
|
1799
1799
|
super(), this.table = e;
|
|
@@ -1836,7 +1836,7 @@ function on(e, t) {
|
|
|
1836
1836
|
};
|
|
1837
1837
|
}
|
|
1838
1838
|
function sn(e) {
|
|
1839
|
-
if (!e.facet(E).tables) return
|
|
1839
|
+
if (!e.facet(E).tables) return v.none;
|
|
1840
1840
|
let n = e.facet(D) === "cells", r = T(e), i = t(e.doc), a = n ? null : P(e), o = [];
|
|
1841
1841
|
return r.iterate({ enter: (t) => {
|
|
1842
1842
|
if (t.name !== "Table") return;
|
|
@@ -1848,18 +1848,18 @@ function sn(e) {
|
|
|
1848
1848
|
let r = on(t.node, e.doc);
|
|
1849
1849
|
if (r) {
|
|
1850
1850
|
let e = n ? new It(r) : new rn(r);
|
|
1851
|
-
o.push(
|
|
1851
|
+
o.push(v.replace({
|
|
1852
1852
|
widget: e,
|
|
1853
1853
|
block: !0
|
|
1854
1854
|
}).range(t.from, t.to));
|
|
1855
1855
|
}
|
|
1856
1856
|
return !1;
|
|
1857
|
-
} }),
|
|
1857
|
+
} }), v.set(o, !0);
|
|
1858
1858
|
}
|
|
1859
1859
|
var cn = w.define({
|
|
1860
1860
|
create: sn,
|
|
1861
1861
|
update: (e, t) => t.annotation(Q) ? e.map(t.changes) : t.state.facet(D) === "cells" ? t.docChanged ? sn(t.state) : e.map(t.changes) : t.docChanged || t.selection ? sn(t.state) : e,
|
|
1862
|
-
provide: (e) => [
|
|
1862
|
+
provide: (e) => [y.decorations.from(e), y.atomicRanges.of((t) => t.state.field(e))]
|
|
1863
1863
|
}), ln = (e) => (t) => {
|
|
1864
1864
|
if (o(t)) return !1;
|
|
1865
1865
|
let n = t.state.selection.main;
|
|
@@ -1877,15 +1877,15 @@ var cn = w.define({
|
|
|
1877
1877
|
userEvent: "select",
|
|
1878
1878
|
scrollIntoView: !0
|
|
1879
1879
|
}), !0;
|
|
1880
|
-
}, un = ln(!0), dn = ln(!1), fn = C.high(
|
|
1880
|
+
}, un = ln(!0), dn = ln(!1), fn = C.high(pe.of([{
|
|
1881
1881
|
key: "ArrowDown",
|
|
1882
1882
|
run: un
|
|
1883
1883
|
}, {
|
|
1884
1884
|
key: "ArrowUp",
|
|
1885
1885
|
run: dn
|
|
1886
|
-
}])), pn = "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace", mn =
|
|
1886
|
+
}])), pn = "var(--stylo-font-family-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace)", mn = "var(--stylo-font-family, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif)", hn = y.theme({
|
|
1887
1887
|
"& .cm-content": {
|
|
1888
|
-
fontFamily:
|
|
1888
|
+
fontFamily: mn,
|
|
1889
1889
|
lineHeight: "1.75",
|
|
1890
1890
|
padding: "0.75rem",
|
|
1891
1891
|
WebkitTouchCallout: "none"
|
|
@@ -2036,7 +2036,7 @@ var cn = w.define({
|
|
|
2036
2036
|
".cm-inplace-fm-first::before": {
|
|
2037
2037
|
content: "\"Frontmatter\"",
|
|
2038
2038
|
marginRight: "0.6em",
|
|
2039
|
-
fontFamily:
|
|
2039
|
+
fontFamily: mn,
|
|
2040
2040
|
fontSize: "0.8rem",
|
|
2041
2041
|
fontWeight: "600",
|
|
2042
2042
|
textTransform: "uppercase",
|
|
@@ -2262,8 +2262,8 @@ var cn = w.define({
|
|
|
2262
2262
|
lineHeight: "1.4",
|
|
2263
2263
|
wordBreak: "break-all"
|
|
2264
2264
|
}
|
|
2265
|
-
}),
|
|
2266
|
-
function
|
|
2265
|
+
}), gn = ".cm-inplace-math, .cm-inplace-hr, .cm-inplace-table";
|
|
2266
|
+
function _n(e, t, n) {
|
|
2267
2267
|
let r = e.firstChild, i = e.textContent?.length ?? 0;
|
|
2268
2268
|
if (!r || r.nodeType !== Node.TEXT_NODE || i === 0) return 0;
|
|
2269
2269
|
let a = e.ownerDocument, o = null, s = 0;
|
|
@@ -2276,7 +2276,7 @@ function gn(e, t, n) {
|
|
|
2276
2276
|
}
|
|
2277
2277
|
return o === r ? Math.min(s, i) : o === e && s > 0 ? i : 0;
|
|
2278
2278
|
}
|
|
2279
|
-
function
|
|
2279
|
+
function vn(e = {}) {
|
|
2280
2280
|
let t = Se(e.inPlace?.contextMenu);
|
|
2281
2281
|
return [
|
|
2282
2282
|
E.of(be(e.inPlace)),
|
|
@@ -2301,19 +2301,19 @@ function _n(e = {}) {
|
|
|
2301
2301
|
nn,
|
|
2302
2302
|
Kt,
|
|
2303
2303
|
Zt,
|
|
2304
|
-
C.high(
|
|
2305
|
-
|
|
2304
|
+
C.high(hn),
|
|
2305
|
+
y.domEventHandlers({
|
|
2306
2306
|
mousedown(e, t) {
|
|
2307
2307
|
let n = e.target;
|
|
2308
2308
|
if (n?.closest(".cm-inplace-table-edit")) return !1;
|
|
2309
|
-
let r = n?.closest(
|
|
2309
|
+
let r = n?.closest(gn);
|
|
2310
2310
|
if (!r) return !1;
|
|
2311
2311
|
let i = t.posAtDOM(r);
|
|
2312
2312
|
if (i < 0) return !1;
|
|
2313
2313
|
let a = n?.closest("[data-stylo-row]");
|
|
2314
2314
|
if (a && r.contains(a)) {
|
|
2315
|
-
let n =
|
|
2316
|
-
n != null && (i = n +
|
|
2315
|
+
let n = te(t.state.doc, i, Number(a.dataset.styloRow), Number(a.dataset.styloCol));
|
|
2316
|
+
n != null && (i = n + _n(a, e.clientX, e.clientY));
|
|
2317
2317
|
}
|
|
2318
2318
|
return t.focus(), t.dispatch({ selection: { anchor: i } }), !0;
|
|
2319
2319
|
},
|
|
@@ -2327,31 +2327,32 @@ function _n(e = {}) {
|
|
|
2327
2327
|
}
|
|
2328
2328
|
//#endregion
|
|
2329
2329
|
//#region src/inplace/InPlaceView.tsx
|
|
2330
|
-
function
|
|
2331
|
-
let
|
|
2332
|
-
|
|
2333
|
-
let
|
|
2334
|
-
|
|
2335
|
-
let [
|
|
2336
|
-
onWikiLinkClick: (e) =>
|
|
2337
|
-
onLinkClick: (e) =>
|
|
2330
|
+
function yn({ value: t, onChange: n, readOnly: r, placeholder: i, onWikiLinkClick: a, onLinkClick: o, inPlace: s, codeLanguages: c, wikiLinkSource: l, onSave: u, onViewChange: d }) {
|
|
2331
|
+
let f = ue(a);
|
|
2332
|
+
f.current = a;
|
|
2333
|
+
let p = ue(o);
|
|
2334
|
+
p.current = o;
|
|
2335
|
+
let [m] = de(() => [vn({
|
|
2336
|
+
onWikiLinkClick: (e) => f.current?.(e),
|
|
2337
|
+
onLinkClick: (e) => p.current?.(e),
|
|
2338
2338
|
inPlace: s
|
|
2339
|
-
})]),
|
|
2339
|
+
})]), h = re({
|
|
2340
2340
|
value: t,
|
|
2341
2341
|
onChange: n,
|
|
2342
2342
|
readOnly: r,
|
|
2343
2343
|
placeholder: i,
|
|
2344
|
-
extensions:
|
|
2344
|
+
extensions: m,
|
|
2345
2345
|
codeLanguages: c,
|
|
2346
|
-
|
|
2347
|
-
|
|
2346
|
+
wikiLinkSource: l,
|
|
2347
|
+
onSave: u,
|
|
2348
|
+
onViewChange: d
|
|
2348
2349
|
});
|
|
2349
2350
|
return /* @__PURE__ */ ve("div", {
|
|
2350
2351
|
className: e.inplace,
|
|
2351
|
-
ref:
|
|
2352
|
+
ref: h
|
|
2352
2353
|
});
|
|
2353
2354
|
}
|
|
2354
2355
|
//#endregion
|
|
2355
|
-
export {
|
|
2356
|
+
export { yn as InPlaceView };
|
|
2356
2357
|
|
|
2357
|
-
//# sourceMappingURL=InPlaceView-
|
|
2358
|
+
//# sourceMappingURL=InPlaceView-CS1qy-Ba.js.map
|