@glifox/gnosis 0.0.14 → 0.0.19
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 +1 -0
- package/dist/exports.d.ts +3 -3
- package/dist/gnosis.mjs +528 -472
- package/dist/gnosis.umd.js +7 -7
- package/package.json +55 -55
package/dist/gnosis.mjs
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
1
|
var _ = Object.defineProperty;
|
|
2
|
-
var O = (e, t,
|
|
3
|
-
var
|
|
4
|
-
import { languages as
|
|
5
|
-
import { markdown as
|
|
2
|
+
var O = (e, t, r) => t in e ? _(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var S = (e, t, r) => O(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { languages as V } from "@codemirror/language-data";
|
|
5
|
+
import { markdown as W } from "@codemirror/lang-markdown";
|
|
6
6
|
import { GFM as F } from "@lezer/markdown";
|
|
7
|
-
import { Tag as U, styleTags as X, tags as
|
|
8
|
-
import { ViewPlugin as j, Decoration as l, WidgetType as
|
|
9
|
-
import { syntaxTree as
|
|
10
|
-
import { EditorView as
|
|
7
|
+
import { Tag as U, styleTags as X, tags as A } from "@lezer/highlight";
|
|
8
|
+
import { ViewPlugin as j, Decoration as l, WidgetType as $, EditorView as z } from "@codemirror/view";
|
|
9
|
+
import { syntaxTree as I } from "@codemirror/language";
|
|
10
|
+
import { EditorView as x } from "codemirror";
|
|
11
11
|
import { StateEffect as G, StateField as K } from "@codemirror/state";
|
|
12
|
-
const
|
|
13
|
-
"Blockquote/...":
|
|
14
|
-
HorizontalRule:
|
|
15
|
-
"ATXHeading1/... SetextHeading1/...":
|
|
16
|
-
"ATXHeading2/... SetextHeading2/...":
|
|
17
|
-
"ATXHeading3/...":
|
|
18
|
-
"ATXHeading4/...":
|
|
19
|
-
"ATXHeading5/...":
|
|
20
|
-
"ATXHeading6/...":
|
|
21
|
-
"Comment CommentBlock":
|
|
22
|
-
Escape:
|
|
23
|
-
Entity:
|
|
24
|
-
"Emphasis/...":
|
|
25
|
-
"StrongEmphasis/...":
|
|
26
|
-
"Strikethrough/...":
|
|
27
|
-
"TableHeader/...":
|
|
28
|
-
"Link/... Image/...":
|
|
29
|
-
"OrderedList/... BulletList/...":
|
|
30
|
-
"BlockQuote/...":
|
|
31
|
-
"InlineCode CodeText":
|
|
32
|
-
"URL Autolink":
|
|
33
|
-
"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark StrikethroughMark":
|
|
34
|
-
"CodeInfo LinkLabel TaskMarker TableDelimiter":
|
|
35
|
-
LinkTitle:
|
|
36
|
-
Paragraph:
|
|
37
|
-
"QuoteType/.. QuoteTypeMark QuoteTypeText":
|
|
38
|
-
}), J = { props: [Y] },
|
|
39
|
-
const
|
|
12
|
+
const h = U.define("none"), Y = X({
|
|
13
|
+
"Blockquote/...": h,
|
|
14
|
+
HorizontalRule: h,
|
|
15
|
+
"ATXHeading1/... SetextHeading1/...": h,
|
|
16
|
+
"ATXHeading2/... SetextHeading2/...": h,
|
|
17
|
+
"ATXHeading3/...": h,
|
|
18
|
+
"ATXHeading4/...": h,
|
|
19
|
+
"ATXHeading5/...": h,
|
|
20
|
+
"ATXHeading6/...": h,
|
|
21
|
+
"Comment CommentBlock": h,
|
|
22
|
+
Escape: h,
|
|
23
|
+
Entity: h,
|
|
24
|
+
"Emphasis/...": h,
|
|
25
|
+
"StrongEmphasis/...": h,
|
|
26
|
+
"Strikethrough/...": h,
|
|
27
|
+
"TableHeader/...": h,
|
|
28
|
+
"Link/... Image/...": h,
|
|
29
|
+
"OrderedList/... BulletList/...": h,
|
|
30
|
+
"BlockQuote/...": h,
|
|
31
|
+
"InlineCode CodeText": h,
|
|
32
|
+
"URL Autolink": h,
|
|
33
|
+
"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark StrikethroughMark": h,
|
|
34
|
+
"CodeInfo LinkLabel TaskMarker TableDelimiter": h,
|
|
35
|
+
LinkTitle: h,
|
|
36
|
+
Paragraph: h,
|
|
37
|
+
"QuoteType/.. QuoteTypeMark QuoteTypeText": h
|
|
38
|
+
}), J = { props: [Y] }, y = (e, t, r = {}) => {
|
|
39
|
+
const i = class {
|
|
40
40
|
constructor(c) {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
S(this, "decorations");
|
|
42
|
+
S(this, "conf");
|
|
43
43
|
this.conf = t, this.decorations = e(c, this.conf);
|
|
44
44
|
}
|
|
45
45
|
update(c) {
|
|
46
46
|
(c.docChanged || c.viewportChanged || c.selectionSet) && (this.decorations = e(c.view, this.conf));
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
return j.fromClass(
|
|
50
|
-
}, M = (e, t,
|
|
51
|
-
const
|
|
52
|
-
for (let a of
|
|
53
|
-
if (a.from >= t && a.from <=
|
|
49
|
+
return j.fromClass(i, { decorations: (a) => a.decorations, ...r });
|
|
50
|
+
}, M = (e, t, r) => {
|
|
51
|
+
const i = e.state.selection.ranges;
|
|
52
|
+
for (let a of i)
|
|
53
|
+
if (a.from >= t && a.from <= r || a.to >= t && a.to <= r || a.from <= t && a.to >= r)
|
|
54
54
|
return !0;
|
|
55
55
|
return !1;
|
|
56
|
-
},
|
|
57
|
-
for (const { from:
|
|
58
|
-
|
|
56
|
+
}, v = (e, t) => {
|
|
57
|
+
for (const { from: r, to: i } of e.visibleRanges)
|
|
58
|
+
I(e.state).iterate({ ...t, from: r, to: i });
|
|
59
59
|
};
|
|
60
60
|
function ee(e, t) {
|
|
61
|
-
const
|
|
62
|
-
HorizontalRule: (
|
|
63
|
-
l.line({ class: "hr " + (
|
|
64
|
-
l.mark({ class: "mk" }).range(
|
|
61
|
+
const r = ["Document"], i = {}, a = {
|
|
62
|
+
HorizontalRule: (n, s, o = !0) => [
|
|
63
|
+
l.line({ class: "hr " + (o ? "sw" : "") }).range(n),
|
|
64
|
+
l.mark({ class: "mk" }).range(n, s)
|
|
65
65
|
]
|
|
66
66
|
}, c = [];
|
|
67
|
-
return
|
|
68
|
-
enter: ({ type:
|
|
67
|
+
return v(e, {
|
|
68
|
+
enter: ({ type: n, from: s, to: o }) => (n.name in a && c.push(...a[n.name](s, o, M(e, s, o))), r.includes(n.name) || n.name in i)
|
|
69
69
|
}), l.set(c, !1);
|
|
70
70
|
}
|
|
71
|
-
const te = () =>
|
|
71
|
+
const te = () => x.baseTheme({
|
|
72
72
|
"& .hr": { position: "relative" },
|
|
73
73
|
"& .hr > .mk": { fontSize: "0" },
|
|
74
74
|
"& .hr.sw > .mk": { fontSize: "inherit" },
|
|
@@ -82,28 +82,28 @@ const te = () => T.baseTheme({
|
|
|
82
82
|
height: ".2ch"
|
|
83
83
|
}
|
|
84
84
|
}), ne = () => [
|
|
85
|
-
|
|
85
|
+
y(ee, {}),
|
|
86
86
|
te()
|
|
87
87
|
];
|
|
88
|
-
function
|
|
89
|
-
const
|
|
90
|
-
StrongEmphasis: (
|
|
91
|
-
Strikethrough: (
|
|
92
|
-
InlineCode: (
|
|
93
|
-
Emphasis: (
|
|
94
|
-
Mark: (
|
|
88
|
+
function re(e, t) {
|
|
89
|
+
const r = ["FencedCode"], i = {
|
|
90
|
+
StrongEmphasis: (n = !0, s, o) => l.mark({ class: "il st " + (n ? "sw" : "") }).range(s, o),
|
|
91
|
+
Strikethrough: (n = !0, s, o) => l.mark({ class: "il sk " + (n ? "sw" : "") }).range(s, o),
|
|
92
|
+
InlineCode: (n = !0, s, o) => l.mark({ class: "il ic " + (n ? "sw" : "") }).range(s, o),
|
|
93
|
+
Emphasis: (n = !0, s, o) => l.mark({ class: "il it " + (n ? "sw" : "") }).range(s, o),
|
|
94
|
+
Mark: (n, s) => l.mark({ class: "mkl" }).range(n, s)
|
|
95
95
|
}, a = ["EmphasisMark", "CodeMark", "StrikethroughMark"], c = [];
|
|
96
|
-
return
|
|
97
|
-
enter: ({ type: { name:
|
|
98
|
-
|
|
99
|
-
M(e,
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
return v(e, {
|
|
97
|
+
enter: ({ type: { name: n }, from: s, to: o }) => a.includes(n) ? (c.push(i.Mark(s, o)), !1) : (n in i && c.push(
|
|
98
|
+
i[n](
|
|
99
|
+
M(e, s, o),
|
|
100
|
+
s,
|
|
101
|
+
o
|
|
102
102
|
)
|
|
103
|
-
), !
|
|
103
|
+
), !r.includes(n))
|
|
104
104
|
}), l.set(c, !1);
|
|
105
105
|
}
|
|
106
|
-
const
|
|
106
|
+
const se = x.baseTheme({
|
|
107
107
|
"& .it ": { fontStyle: "italic" },
|
|
108
108
|
"& .st ": { fontWeight: "bold" },
|
|
109
109
|
"& .sk ": { textDecoration: "line-through" },
|
|
@@ -113,38 +113,151 @@ const re = T.baseTheme({
|
|
|
113
113
|
borderRadius: ".6ch",
|
|
114
114
|
backgroundColor: "var(--cm-ic-background, hsl(from black h s l / .2))"
|
|
115
115
|
}
|
|
116
|
-
}), oe =
|
|
116
|
+
}), oe = x.baseTheme({
|
|
117
117
|
".il .mkl": { fontSize: "0" },
|
|
118
118
|
"&.cm-focused .il.sw > .mkl": { fontSize: "inherit" }
|
|
119
119
|
}), ie = () => [
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
y(re, {}),
|
|
121
|
+
se,
|
|
122
122
|
oe
|
|
123
|
+
], N = (e, t, r) => {
|
|
124
|
+
const i = e.state.sliceDoc(t, r), a = i.match(/\[(.*)\]/);
|
|
125
|
+
return a !== null && a.length > 1 ? {
|
|
126
|
+
text: a[1],
|
|
127
|
+
from: t + i.indexOf(a[1]),
|
|
128
|
+
to: t + 1 + a[1].length
|
|
129
|
+
} : { text: null };
|
|
130
|
+
};
|
|
131
|
+
function ae(e, t) {
|
|
132
|
+
const r = ["FencedCode", "Image", "Link"], i = {
|
|
133
|
+
Link: {
|
|
134
|
+
marks: ["LinkMark"],
|
|
135
|
+
url: "URL"
|
|
136
|
+
}
|
|
137
|
+
}, a = {
|
|
138
|
+
Link: (n, s, o) => l.mark({ class: "link " + (o ? "sw" : "") }).range(n, s),
|
|
139
|
+
LinkMark: (n, s) => l.mark({ class: "lk-mk" }).range(n, s),
|
|
140
|
+
TextDec: (n, s, o) => l.mark({
|
|
141
|
+
class: "lk-text url",
|
|
142
|
+
tagName: "a",
|
|
143
|
+
attributes: { href: o, target: "_blank" }
|
|
144
|
+
}).range(n, s),
|
|
145
|
+
URL: (n, s, o) => l.mark({
|
|
146
|
+
class: "lk-url url",
|
|
147
|
+
tagName: "a",
|
|
148
|
+
attributes: { href: o, target: "_blank" }
|
|
149
|
+
}).range(n, s)
|
|
150
|
+
}, c = [];
|
|
151
|
+
return v(e, {
|
|
152
|
+
enter: ({ type: { name: n }, from: s, to: o, node: d }) => {
|
|
153
|
+
if (n === "URL" && c.push(a.URL(s, o, e.state.sliceDoc(s, o))), !(n in i)) return !r.includes(n);
|
|
154
|
+
c.push(a.Link(s, o, M(e, s, o)));
|
|
155
|
+
const u = i[n].marks.flatMap((w) => d.getChildren(w));
|
|
156
|
+
c.push(...u.map(({ from: w, to: p }) => a.LinkMark(w, p)));
|
|
157
|
+
const g = d.getChild(i[n].url);
|
|
158
|
+
let m = null;
|
|
159
|
+
if (g !== null) {
|
|
160
|
+
const { from: w, to: p } = g;
|
|
161
|
+
m = e.state.sliceDoc(w, p), c.push(a.URL(w, p, m));
|
|
162
|
+
}
|
|
163
|
+
if (d.getChild("Image") === null) {
|
|
164
|
+
const { text: w, from: p, to: T } = N(e, s, o);
|
|
165
|
+
w !== null && m !== null && c.push(a.TextDec(p, T, m));
|
|
166
|
+
}
|
|
167
|
+
return !1;
|
|
168
|
+
}
|
|
169
|
+
}), l.set(c, !0);
|
|
170
|
+
}
|
|
171
|
+
const ce = (e, t) => e.ctrlKey ? le(
|
|
172
|
+
e.target
|
|
173
|
+
/* as HTMLElement */
|
|
174
|
+
) : !1, le = (e) => {
|
|
175
|
+
if (e.nodeName === "A" && e.href && e.classList.contains("url"))
|
|
176
|
+
return window.open(e.href, e.target), !0;
|
|
177
|
+
}, de = x.baseTheme({
|
|
178
|
+
".lk-mk, .link > .lk-url": { display: "none" },
|
|
179
|
+
"&.cm-focused .link.sw .lk-mk, &.cm-focused .link.sw .lk-url": { display: "inherit" }
|
|
180
|
+
}), ue = () => [
|
|
181
|
+
y(ae, {}, { eventHandlers: { mousedown: ce } }),
|
|
182
|
+
de
|
|
123
183
|
];
|
|
124
|
-
class
|
|
125
|
-
constructor(
|
|
184
|
+
class ge extends $ {
|
|
185
|
+
constructor(t, r = null, i = "[image]") {
|
|
186
|
+
super(), this.img = t, this.url = r, this.alt = i;
|
|
187
|
+
}
|
|
188
|
+
toDOM() {
|
|
189
|
+
let t = document.createElement("img");
|
|
190
|
+
if (t.src = this.img, t.alt = this.alt, t.style.minWidth = "100px", this.url) {
|
|
191
|
+
let r = document.createElement("a");
|
|
192
|
+
return r.href = this.url, r.target = "_blank", r.classList.add("url"), r.appendChild(t), r;
|
|
193
|
+
} else
|
|
194
|
+
return t;
|
|
195
|
+
}
|
|
196
|
+
eq(t) {
|
|
197
|
+
return this.img === t.img;
|
|
198
|
+
}
|
|
199
|
+
ignoreEvent() {
|
|
200
|
+
return !1;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function he(e, t) {
|
|
204
|
+
const r = ["FencedCode", "Image"], i = [];
|
|
205
|
+
return v(e, {
|
|
206
|
+
enter: ({ type: { name: a }, from: c, to: n, node: s }) => {
|
|
207
|
+
if (a === "Image" && !M(e, c, n)) {
|
|
208
|
+
const { from: o, to: d } = s.getChild("URL"), u = e.state.sliceDoc(o, d), { text: g } = N(e, c, n);
|
|
209
|
+
i.push(
|
|
210
|
+
l.replace({
|
|
211
|
+
widget: new ge(u, me(e, s), g)
|
|
212
|
+
}).range(c, n)
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
return !r.includes(a);
|
|
216
|
+
}
|
|
217
|
+
}), l.set(i, !1);
|
|
218
|
+
}
|
|
219
|
+
const me = (e, t) => {
|
|
220
|
+
const i = t.parent.getChild("URL");
|
|
221
|
+
if (i !== null) {
|
|
222
|
+
const { from: a, to: c } = i;
|
|
223
|
+
return e.state.sliceDoc(a, c);
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
}, pe = (e, t) => e.ctrlKey ? fe(
|
|
227
|
+
e.target
|
|
228
|
+
/* as HTMLElement */
|
|
229
|
+
) : !1, fe = (e) => {
|
|
230
|
+
const t = e.parentElement ?? !1;
|
|
231
|
+
if (e.nodeName === "IMG" && t && t.nodeName === "A" && t.classList.contains("url"))
|
|
232
|
+
return !0;
|
|
233
|
+
}, ke = x.baseTheme({}), Ce = () => [
|
|
234
|
+
y(he, {}, { eventHandlers: { mousedown: pe } }),
|
|
235
|
+
ke
|
|
236
|
+
];
|
|
237
|
+
class be extends $ {
|
|
238
|
+
constructor(r) {
|
|
126
239
|
super();
|
|
127
|
-
|
|
128
|
-
this.checked =
|
|
240
|
+
S(this, "checked", !1);
|
|
241
|
+
this.checked = r;
|
|
129
242
|
}
|
|
130
243
|
// eq(other) { return other.checked == this.checked }
|
|
131
244
|
toDOM() {
|
|
132
|
-
let
|
|
133
|
-
|
|
134
|
-
let
|
|
135
|
-
return
|
|
245
|
+
let r = document.createElement("span");
|
|
246
|
+
r.setAttribute("aria-hidden", "true"), r.className = "TaskMark";
|
|
247
|
+
let i = r.appendChild(document.createElement("input"));
|
|
248
|
+
return i.type = "checkbox", i.checked = this.checked, r;
|
|
136
249
|
}
|
|
137
250
|
ignoreEvent() {
|
|
138
251
|
return !1;
|
|
139
252
|
}
|
|
140
253
|
}
|
|
141
|
-
function
|
|
142
|
-
const
|
|
254
|
+
function we(e, t) {
|
|
255
|
+
const r = [
|
|
143
256
|
"Document",
|
|
144
257
|
"ListItem",
|
|
145
258
|
"Task",
|
|
146
259
|
"Blockquote"
|
|
147
|
-
],
|
|
260
|
+
], i = {
|
|
148
261
|
BulletList: {
|
|
149
262
|
class: "bl",
|
|
150
263
|
offset: 2
|
|
@@ -154,57 +267,66 @@ function ce(e, t) {
|
|
|
154
267
|
offset: 3
|
|
155
268
|
}
|
|
156
269
|
}, a = {
|
|
157
|
-
ListMark: (
|
|
158
|
-
TaskMarker: (
|
|
159
|
-
const
|
|
160
|
-
return g ? l.mark({ class: `tm ${
|
|
161
|
-
widget: new
|
|
162
|
-
}).range(
|
|
270
|
+
ListMark: (o, d, u, g = !0) => l.mark({ class: `${u.class} lm ${g ? "sw" : ""}` }).range(o, d),
|
|
271
|
+
TaskMarker: (o, d, u, g = !0) => {
|
|
272
|
+
const m = e.state.doc.sliceString(o + 1, d - 1) === "x";
|
|
273
|
+
return g ? l.mark({ class: `tm ${m ? "ck" : ""}` }).range(o, d) : l.replace({
|
|
274
|
+
widget: new be(m)
|
|
275
|
+
}).range(o, d);
|
|
163
276
|
}
|
|
164
277
|
}, c = {
|
|
165
|
-
ListItem: (
|
|
166
|
-
const
|
|
278
|
+
ListItem: (o, d, u, g, m) => {
|
|
279
|
+
const w = u.offset + (g ? 4 : 0), p = o + w, T = `calc(100% - ${Math.max(0, w + m) + 4}ch)`;
|
|
167
280
|
return p >= d ? [] : [
|
|
168
281
|
l.mark({
|
|
169
282
|
class: "ls-text-line",
|
|
170
|
-
attributes: { style: `width: ${
|
|
283
|
+
attributes: { style: `width: ${T}` }
|
|
171
284
|
}).range(p, d)
|
|
172
285
|
];
|
|
173
286
|
}
|
|
174
|
-
},
|
|
175
|
-
return
|
|
176
|
-
enter: ({ name:
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
o
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
o
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
287
|
+
}, n = [], s = [];
|
|
288
|
+
return v(e, {
|
|
289
|
+
enter: ({ name: o, from: d, to: u, node: g }) => {
|
|
290
|
+
if (o in i)
|
|
291
|
+
return s.push({ name: o, from: d, to: u }), !0;
|
|
292
|
+
if (o in a && n.push(a[o](
|
|
293
|
+
d,
|
|
294
|
+
u,
|
|
295
|
+
i[s.slice(-1)[0].name],
|
|
296
|
+
M(e, d, u)
|
|
297
|
+
)), o in c) {
|
|
298
|
+
const m = e.state.doc.lineAt(d);
|
|
299
|
+
n.push(...c[o](
|
|
300
|
+
d,
|
|
301
|
+
m.to,
|
|
302
|
+
i[s.slice(-1)[0].name],
|
|
303
|
+
g.getChild("Task") !== null,
|
|
304
|
+
d - m.from
|
|
305
|
+
));
|
|
306
|
+
}
|
|
307
|
+
return r.includes(o);
|
|
308
|
+
},
|
|
309
|
+
leave: ({ name: o, from: d, to: u }) => {
|
|
310
|
+
const g = s.slice(-1)[0];
|
|
311
|
+
g && g.name === o && g.from === d && g.to === u && s.pop();
|
|
190
312
|
}
|
|
191
|
-
}), l.set(
|
|
313
|
+
}), l.set(n, !0);
|
|
192
314
|
}
|
|
193
|
-
const
|
|
194
|
-
var
|
|
195
|
-
let
|
|
196
|
-
if (
|
|
197
|
-
},
|
|
198
|
-
const
|
|
199
|
-
let a = e.state.doc.sliceString(Math.max(0,
|
|
200
|
-
if (a === "x") c = { from:
|
|
201
|
-
else if (a === " ") c = { from:
|
|
315
|
+
const Le = (e, t) => {
|
|
316
|
+
var i;
|
|
317
|
+
let r = e.target;
|
|
318
|
+
if (r.nodeName === "INPUT" && ((i = r.parentElement) != null && i.classList.contains("TaskMark"))) return Te(t, t.posAtDOM(r));
|
|
319
|
+
}, Te = (e, t) => {
|
|
320
|
+
const r = t - 2, i = t - 1;
|
|
321
|
+
let a = e.state.doc.sliceString(Math.max(0, r), i), c;
|
|
322
|
+
if (a === "x") c = { from: r, to: i, insert: " " };
|
|
323
|
+
else if (a === " ") c = { from: r, to: i, insert: "x" };
|
|
202
324
|
else return !1;
|
|
203
325
|
return e.dispatch({ changes: c }), !0;
|
|
204
|
-
},
|
|
326
|
+
}, qe = () => x.baseTheme({
|
|
205
327
|
"& .lm.bl": {
|
|
206
328
|
position: "relative",
|
|
207
|
-
paddingInlineStart: "1ch",
|
|
329
|
+
// paddingInlineStart: "1ch",
|
|
208
330
|
color: "transparent"
|
|
209
331
|
},
|
|
210
332
|
"& .lm.bl::before": {
|
|
@@ -213,8 +335,8 @@ const le = (e, t) => {
|
|
|
213
335
|
position: "absolute",
|
|
214
336
|
borderRadius: "50%",
|
|
215
337
|
top: "50%",
|
|
216
|
-
left: "
|
|
217
|
-
transform: "translate(
|
|
338
|
+
left: "50%",
|
|
339
|
+
transform: "translate(-50%, -50%)",
|
|
218
340
|
height: ".4em",
|
|
219
341
|
width: ".4em"
|
|
220
342
|
},
|
|
@@ -239,163 +361,189 @@ const le = (e, t) => {
|
|
|
239
361
|
"& .cb-content .ls-text-line, & .cb-spacer .ls-text-line": {
|
|
240
362
|
width: "unset !important"
|
|
241
363
|
}
|
|
242
|
-
}),
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
],
|
|
246
|
-
var
|
|
247
|
-
let
|
|
248
|
-
if (
|
|
364
|
+
}), xe = () => [
|
|
365
|
+
y(we, {}, { eventHandlers: { mousedown: Le } }),
|
|
366
|
+
qe()
|
|
367
|
+
], ye = (e, t) => {
|
|
368
|
+
var i;
|
|
369
|
+
let r = e.target;
|
|
370
|
+
if (r.nodeName === "BUTTON" && ((i = r.parentElement) != null && i.classList.contains("wg-codeblock"))) {
|
|
249
371
|
const a = ["FencedCode", "CodeBlock"];
|
|
250
372
|
let c = "";
|
|
251
|
-
const
|
|
252
|
-
enter: ({ type: { name:
|
|
373
|
+
const n = {
|
|
374
|
+
enter: ({ type: { name: s }, from: o, to: d, node: u }) => (a.includes(s) && (c = Me(t, u.toTree(), o, d)), !a.includes(s))
|
|
253
375
|
};
|
|
254
|
-
return
|
|
255
|
-
...
|
|
256
|
-
from: t.posAtDOM(
|
|
257
|
-
to: t.posAtDOM(
|
|
376
|
+
return I(t.state).iterate({
|
|
377
|
+
...n,
|
|
378
|
+
from: t.posAtDOM(r),
|
|
379
|
+
to: t.posAtDOM(r) + 2
|
|
258
380
|
}), navigator.clipboard.writeText(c), !0;
|
|
259
381
|
}
|
|
260
|
-
},
|
|
382
|
+
}, Me = (e, t, r, i) => {
|
|
261
383
|
const a = ["CodeMark", "CodeInfo"];
|
|
262
|
-
let c = e.state.doc.sliceString(
|
|
384
|
+
let c = e.state.doc.sliceString(r, i), n = /* @__PURE__ */ new Set();
|
|
263
385
|
t.iterate({
|
|
264
|
-
enter({ type: { name: u }, from: g, node:
|
|
265
|
-
a.includes(u) &&
|
|
386
|
+
enter({ type: { name: u }, from: g, node: m }) {
|
|
387
|
+
a.includes(u) && n.add(e.state.doc.lineAt(g + r).number);
|
|
266
388
|
}
|
|
267
389
|
});
|
|
268
|
-
const
|
|
390
|
+
const s = e.state.doc.lineAt(r), o = r - s.from, d = [];
|
|
269
391
|
return c.split(`
|
|
270
392
|
`).forEach((u, g) => {
|
|
271
|
-
|
|
393
|
+
n.has(g + s.number) || d.push(u.slice(o));
|
|
272
394
|
}), d.join(`
|
|
273
395
|
`);
|
|
274
396
|
};
|
|
275
|
-
class
|
|
276
|
-
constructor(
|
|
397
|
+
class B extends $ {
|
|
398
|
+
constructor(r, i, a, c = 1) {
|
|
277
399
|
super();
|
|
278
|
-
|
|
279
|
-
this.classes =
|
|
400
|
+
S(this, "classes", "");
|
|
401
|
+
this.classes = r, this.width = i, this.marginLeft = a, this.spaces = c;
|
|
280
402
|
}
|
|
281
403
|
toDOM() {
|
|
282
|
-
let
|
|
283
|
-
return
|
|
404
|
+
let r = document.createElement("span");
|
|
405
|
+
return r.setAttribute("aria-hidden", "true"), r.className = this.classes + " empty", r.textContent = " ".repeat(this.spaces), r.style.width = this.width, r.style.marginLeft = this.marginLeft, r;
|
|
284
406
|
}
|
|
285
407
|
ignoreEvent() {
|
|
286
408
|
return !1;
|
|
287
409
|
}
|
|
288
410
|
}
|
|
289
|
-
const
|
|
411
|
+
const ve = (e) => `<svg class="cb-icon" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
290
412
|
<path class="cb-icon-path cb.i1" fill-rule="evenodd" clip-rule="evenodd" d="M15 0C15.5304 0 16.0391 0.210714 16.4142 0.585786C16.7893 0.960859 17 1.46957 17 2V12C17 12.5304 16.7893 13.0391 16.4142 13.4142C16.0391 13.7893 15.5304 14 15 14H14V6C14 4.93913 13.5786 3.92172 12.8284 3.17157C12.0783 2.42143 11.0609 2 10 2H7C6.64895 1.99924 6.30395 2.09135 6 2.267V2C6 1.46957 6.21071 0.960859 6.58579 0.585786C6.96086 0.210714 7.46957 0 8 0H15Z"/>
|
|
291
413
|
<path class="cb-icon-path cb.i1" fill-rule="evenodd" clip-rule="evenodd" d="M5 4.054V8H1.2C1.27464 7.84448 1.3691 7.69928 1.481 7.568L3.941 4.698C4.2169 4.37661 4.58771 4.15111 5 4.054ZM7 4V8C7 8.53043 6.78929 9.03914 6.41421 9.41421C6.03914 9.78929 5.53043 10 5 10H1V16C1 16.5304 1.21071 17.0391 1.58579 17.4142C1.96086 17.7893 2.46957 18 3 18H10C10.5304 18 11.0391 17.7893 11.4142 17.4142C11.7893 17.0391 12 16.5304 12 16V6C12 5.46957 11.7893 4.96086 11.4142 4.58579C11.0391 4.21071 10.5304 4 10 4H7Z"/>
|
|
292
414
|
</svg>`;
|
|
293
|
-
class
|
|
294
|
-
constructor(t,
|
|
295
|
-
super(), this.type = t, this.code =
|
|
415
|
+
class He extends $ {
|
|
416
|
+
constructor(t, r) {
|
|
417
|
+
super(), this.type = t, this.code = r;
|
|
296
418
|
}
|
|
297
419
|
toDOM() {
|
|
298
420
|
let t = document.createElement("span");
|
|
299
421
|
t.setAttribute("aria-hidden", "true"), t.className = "wg-codeblock";
|
|
300
|
-
let
|
|
301
|
-
return
|
|
422
|
+
let r = document.createElement("button");
|
|
423
|
+
return r.className = "wg-codeblock-btn", r.innerHTML = ve(), t.appendChild(r), t;
|
|
302
424
|
}
|
|
303
425
|
ignoreEvent() {
|
|
304
426
|
return !1;
|
|
305
427
|
}
|
|
306
428
|
}
|
|
307
|
-
const
|
|
429
|
+
const E = [];
|
|
308
430
|
function D(e, t) {
|
|
309
431
|
const {
|
|
310
|
-
mode:
|
|
432
|
+
mode: r,
|
|
311
433
|
/* type, mark */
|
|
312
|
-
|
|
434
|
+
/**
|
|
435
|
+
* @type {object}
|
|
436
|
+
* @property {number} marginLeft - Margin left for the code block
|
|
437
|
+
* @property {number} paddingLeft - Padding left for the code block
|
|
438
|
+
*/
|
|
439
|
+
options: i
|
|
440
|
+
} = t, a = ["Document", "Blockquote", "ListItem", "BulletList", "OrderedList"], c = {
|
|
313
441
|
FencedCode: Z,
|
|
314
442
|
CodeBlock: Z
|
|
315
|
-
},
|
|
316
|
-
CodeMark: (
|
|
317
|
-
CodeInfo: (
|
|
318
|
-
},
|
|
319
|
-
return
|
|
320
|
-
enter: ({ type: { name:
|
|
321
|
-
Leave: ({ type: { name:
|
|
443
|
+
}, n = {
|
|
444
|
+
CodeMark: (o, d, u) => [l.mark({ class: "cb-mk" }).range(d, u)],
|
|
445
|
+
CodeInfo: (o, d, u) => [l.mark({ class: "cb-mi" }).range(d, u)]
|
|
446
|
+
}, s = [];
|
|
447
|
+
return v(e, {
|
|
448
|
+
enter: ({ type: { name: o }, from: d, to: u }) => (r === "type" && o in c && s.push(...c[o](e, d, u, i)), r === "mark" && o in n && s.push(...n[o](e, d, u)), a.includes(o) || o in c ? (E.push({ name: o, from: d, to: u }), !0) : !1),
|
|
449
|
+
Leave: ({ type: { name: o }, from: d, to: u }) => a.includes(o) || o in c ? (E.pop(), !0) : !1
|
|
322
450
|
}), {
|
|
323
|
-
type: l.set(
|
|
324
|
-
mark: l.set(
|
|
325
|
-
}[
|
|
451
|
+
type: l.set(s, !0),
|
|
452
|
+
mark: l.set(s, !0)
|
|
453
|
+
}[r];
|
|
326
454
|
}
|
|
327
|
-
const Z = (e, t,
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
l.widget({ widget: new
|
|
455
|
+
const Z = (e, t, r, i) => {
|
|
456
|
+
const a = i.marginLeft, c = i.paddingLeft, n = [], s = E[E.length - 1], o = ["BulletList", "OrderedList", "ListItem"].some((b) => b === s.name), d = ["Blockquote"].some((b) => b === s.name), u = e.state.doc.lineAt(t), g = t - u.from, m = g > 0, w = M(e, u.from, r);
|
|
457
|
+
n.push(
|
|
458
|
+
l.widget({ widget: new He("view.state.sliceDoc(from, to)", "code"), side: 0 }).range(t + 1)
|
|
331
459
|
);
|
|
332
|
-
const
|
|
460
|
+
const p = u.number, T = e.state.doc.sliceString(t, r).split(`
|
|
333
461
|
`).length;
|
|
334
|
-
for (let
|
|
335
|
-
const { from:
|
|
336
|
-
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
339
|
-
|
|
462
|
+
for (let b = p; b < T + p; b++) {
|
|
463
|
+
const { from: f, to: C } = e.state.doc.line(b), L = `100% - ${a + c}px`, q = ["cb-content"];
|
|
464
|
+
w && q.push("sw"), b === p && q.push("cb-start"), b === T + p - 1 && q.push("cb-end");
|
|
465
|
+
const k = Math.max(f + g, 0);
|
|
466
|
+
if (C < k)
|
|
467
|
+
n.push(l.widget({
|
|
468
|
+
widget: new B(
|
|
469
|
+
["left", "cb-error"].join(" "),
|
|
470
|
+
"0.1px"
|
|
471
|
+
),
|
|
472
|
+
side: 0
|
|
473
|
+
}).range(C), l.widget({
|
|
474
|
+
widget: new B(
|
|
475
|
+
["cb-error", "right"].join(" "),
|
|
476
|
+
"",
|
|
477
|
+
"",
|
|
478
|
+
k - C
|
|
479
|
+
),
|
|
480
|
+
side: 1
|
|
481
|
+
}).range(C));
|
|
482
|
+
else if (f === C && f === k)
|
|
483
|
+
n.push(l.widget({
|
|
484
|
+
widget: new B(
|
|
485
|
+
[...q, "left"].join(" "),
|
|
486
|
+
"0"
|
|
487
|
+
),
|
|
488
|
+
side: 0
|
|
489
|
+
}).range(C), l.widget({
|
|
490
|
+
widget: new B(
|
|
491
|
+
q.join(" "),
|
|
492
|
+
`calc(${L} - ${c}px)`,
|
|
493
|
+
"0"
|
|
494
|
+
),
|
|
495
|
+
side: 1
|
|
496
|
+
}).range(k));
|
|
497
|
+
else if (k === C)
|
|
498
|
+
q.push("wg"), n.push(
|
|
340
499
|
l.widget({
|
|
341
|
-
widget: new
|
|
342
|
-
|
|
343
|
-
`calc(${L} - ${
|
|
344
|
-
`calc(${f - k}ch + 2px)`
|
|
500
|
+
widget: new B(
|
|
501
|
+
q.join(" "),
|
|
502
|
+
`calc(${L} - ${k - f}ch)`
|
|
345
503
|
),
|
|
346
504
|
side: 1
|
|
347
505
|
}).range(k)
|
|
348
|
-
), console.log("Hello World");
|
|
349
|
-
else if (f === k)
|
|
350
|
-
b.push("wg"), o.push(
|
|
351
|
-
l.widget({
|
|
352
|
-
widget: new A(
|
|
353
|
-
b.join(" "),
|
|
354
|
-
`calc(${L} - ${f - h}ch)`
|
|
355
|
-
),
|
|
356
|
-
side: 1
|
|
357
|
-
}).range(f)
|
|
358
506
|
);
|
|
359
|
-
else if (
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
} else if (
|
|
363
|
-
const
|
|
364
|
-
|
|
507
|
+
else if (o || d || m) {
|
|
508
|
+
const H = { style: `width: calc(${L} - ${k - f}ch)` };
|
|
509
|
+
C > k && n.push(l.mark({ class: q.join(" "), attributes: H }).range(k, C)), f !== k && o && n.push(l.mark({ class: "cb-listsp" }).range(f, k)), f !== k && m && n.push(l.mark({ class: "cb-spacer" }).range(f, k)), f !== k && d && n.push(l.mark({ class: "cb-quote bq" }).range(f, k));
|
|
510
|
+
} else if (f !== C) {
|
|
511
|
+
const H = { style: `width: calc(${L})` };
|
|
512
|
+
n.push(l.mark({ class: q.join(" "), attributes: H }).range(f, C));
|
|
365
513
|
}
|
|
366
|
-
|
|
514
|
+
n.push(l.line({ class: "cb-line" }).range(f));
|
|
367
515
|
}
|
|
368
|
-
return
|
|
369
|
-
},
|
|
370
|
-
const
|
|
371
|
-
return
|
|
372
|
-
".cb-start": { borderRadius: `${
|
|
373
|
-
".cb-end ": { borderRadius: `0 0 ${
|
|
374
|
-
".cb-start.cb-end": { borderRadius: `${
|
|
375
|
-
".cb-content": {
|
|
516
|
+
return n;
|
|
517
|
+
}, $e = (e) => {
|
|
518
|
+
const t = e.marginLeft, r = e.paddingLeft, i = 0, a = "4px", c = "1lh";
|
|
519
|
+
return x.baseTheme({
|
|
520
|
+
"& .cb-start": { borderRadius: `${a} ${a} 0 0` },
|
|
521
|
+
"& .cb-end ": { borderRadius: `0 0 ${a} ${a}` },
|
|
522
|
+
"& .cb-start.cb-end": { borderRadius: `${a}` },
|
|
523
|
+
"& .cm-line .cb-content": {
|
|
376
524
|
display: "inline-block",
|
|
377
|
-
marginLeft:
|
|
378
|
-
paddingLeft:
|
|
379
|
-
paddingRigth:
|
|
525
|
+
marginLeft: `${t}px`,
|
|
526
|
+
paddingLeft: `${r}px`,
|
|
527
|
+
paddingRigth: `${i}px`,
|
|
380
528
|
position: "relative"
|
|
381
529
|
},
|
|
382
|
-
".cb-content.wg": { cursor: "text" },
|
|
383
|
-
".cb-content.wg.start": {
|
|
530
|
+
"& .cb-content.wg": { cursor: "text" },
|
|
531
|
+
"& .cb-content.wg.start": {
|
|
384
532
|
maxWidth: "1px",
|
|
385
533
|
Width: "1px",
|
|
386
|
-
paddingLeft:
|
|
534
|
+
paddingLeft: `${r - 1}px`
|
|
387
535
|
},
|
|
388
|
-
".cb-content.wg.end": {
|
|
536
|
+
"& .cb-content.wg.end": {
|
|
389
537
|
marginLeft: "0",
|
|
390
538
|
paddingLeft: "0"
|
|
391
539
|
},
|
|
392
|
-
".cb-mi
|
|
540
|
+
"& .cb-mi,& .cb-mk": { color: "transparent" },
|
|
393
541
|
"&.cm-focused .cb-content.sw > .cb-mi, &.cm-focused .cb-content.sw > .cb-mk": { color: "inherit" },
|
|
394
542
|
"&.cm-focused .cb-content.sw .wg-codeblock": {
|
|
395
543
|
display: "none",
|
|
396
544
|
opacity: "0"
|
|
397
545
|
},
|
|
398
|
-
".wg-codeblock": {
|
|
546
|
+
"& .wg-codeblock": {
|
|
399
547
|
display: "inline-block",
|
|
400
548
|
position: "absolute",
|
|
401
549
|
top: "0",
|
|
@@ -403,7 +551,7 @@ const Z = (e, t, s) => {
|
|
|
403
551
|
zIndex: "100",
|
|
404
552
|
margin: ".05lh"
|
|
405
553
|
},
|
|
406
|
-
".wg-codeblock-btn": {
|
|
554
|
+
"& .wg-codeblock-btn": {
|
|
407
555
|
padding: "0",
|
|
408
556
|
display: "inline-flex",
|
|
409
557
|
borderRadius: "999999px",
|
|
@@ -412,80 +560,101 @@ const Z = (e, t, s) => {
|
|
|
412
560
|
outline: "none",
|
|
413
561
|
justifyContent: "center",
|
|
414
562
|
alignItems: "center",
|
|
415
|
-
height: `calc(${
|
|
563
|
+
height: `calc(${c} + 4px )`,
|
|
416
564
|
width: "5ch"
|
|
417
565
|
},
|
|
418
|
-
".cb-icon": {
|
|
419
|
-
width:
|
|
420
|
-
height:
|
|
566
|
+
"& .cb-icon": {
|
|
567
|
+
width: c,
|
|
568
|
+
height: c,
|
|
421
569
|
pointerEvents: "none",
|
|
422
570
|
fill: "currentColor",
|
|
423
571
|
opacity: "0.7"
|
|
424
572
|
},
|
|
425
|
-
".wg-codeblock-btn:hover": { background: "rgba(0, 0, 0, 0.07)" },
|
|
426
|
-
".wg-codeblock-btn:hover .cb-icon": { opacity: "1" },
|
|
427
|
-
".cb-content.cb-start.cb-end .wg-codeblock": {
|
|
573
|
+
"& .wg-codeblock-btn:hover": { background: "rgba(0, 0, 0, 0.07)" },
|
|
574
|
+
"& .wg-codeblock-btn:hover .cb-icon": { opacity: "1" },
|
|
575
|
+
"& .cb-content.cb-start.cb-end .wg-codeblock": {
|
|
428
576
|
marginTop: "0",
|
|
429
577
|
marginBottom: "0",
|
|
430
578
|
top: "0",
|
|
431
579
|
bottom: "0"
|
|
432
580
|
},
|
|
433
|
-
".cb-content.cb-start.cb-end .wg-codeblock-btn": {
|
|
581
|
+
"& .cb-content.cb-start.cb-end .wg-codeblock-btn": {
|
|
434
582
|
boxSizing: "border-box",
|
|
435
583
|
maxHeight: "100%",
|
|
436
584
|
width: "5ch"
|
|
437
585
|
},
|
|
438
586
|
"& .cb-content": {
|
|
439
|
-
backgroundColor: "var(--cm-ic-background, hsl(from black h s l / .1))"
|
|
587
|
+
backgroundColor: "var(--cm-ic-background, hsl(from black h s l / .1))",
|
|
588
|
+
cursor: "text"
|
|
589
|
+
},
|
|
590
|
+
"& .cb-error.left": { padding: "0" },
|
|
591
|
+
"& .cb-error.right": { paddingRight: `${t}px` },
|
|
592
|
+
"& .cb-error": {
|
|
593
|
+
display: "inline-block",
|
|
594
|
+
backgroundColor: "var(--cm-ic-error, hsl(from red h s l / .5))",
|
|
595
|
+
cursor: "text"
|
|
440
596
|
}
|
|
441
597
|
});
|
|
442
|
-
},
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
598
|
+
}, Se = () => {
|
|
599
|
+
const e = {
|
|
600
|
+
marginLeft: 2,
|
|
601
|
+
paddingLeft: 6
|
|
602
|
+
};
|
|
603
|
+
return [
|
|
604
|
+
y(D, { mode: "mark" }),
|
|
605
|
+
y(D, { mode: "type", options: e }, { eventHandlers: { mousedown: ye } }),
|
|
606
|
+
$e(e)
|
|
607
|
+
];
|
|
608
|
+
};
|
|
609
|
+
function Be(e, t) {
|
|
610
|
+
const r = ["Document"], i = {
|
|
611
|
+
ATXHeading1: (n, s = !0) => l.line({ class: "h1 hg " + (s ? "sw" : "") }).range(n),
|
|
612
|
+
ATXHeading2: (n, s = !0) => l.line({ class: "h2 hg " + (s ? "sw" : "") }).range(n),
|
|
613
|
+
ATXHeading3: (n, s = !0) => l.line({ class: "h3 hg " + (s ? "sw" : "") }).range(n),
|
|
614
|
+
ATXHeading4: (n, s = !0) => l.line({ class: "h4 hg " + (s ? "sw" : "") }).range(n),
|
|
615
|
+
ATXHeading5: (n, s = !0) => l.line({ class: "h5 hg " + (s ? "sw" : "") }).range(n),
|
|
616
|
+
ATXHeading6: (n, s = !0) => l.line({ class: "h6 hg " + (s ? "sw" : "") }).range(n)
|
|
455
617
|
}, a = {
|
|
456
|
-
HeaderMark: (
|
|
618
|
+
HeaderMark: (n, s) => l.mark({ class: "mk" }).range(n, s)
|
|
457
619
|
}, c = [];
|
|
458
|
-
return
|
|
459
|
-
enter: ({ type:
|
|
620
|
+
return v(e, {
|
|
621
|
+
enter: ({ type: n, from: s, to: o }) => (n.name in i && c.push(i[n.name](s, M(e, s, o))), n.name in a && c.push(a[n.name](s, o + 1)), r.includes(n.name) || n.name in i)
|
|
460
622
|
}), l.set(c, !1);
|
|
461
623
|
}
|
|
462
|
-
const
|
|
624
|
+
const Ee = x.baseTheme({
|
|
463
625
|
"& .h1 ": { fontSize: "2.00em", fontWeight: "bolder" },
|
|
464
626
|
"& .h2 ": { fontSize: "1.55em", fontWeight: "bolder" },
|
|
465
627
|
"& .h3 ": { fontSize: "1.35em", fontWeight: "bolder" },
|
|
466
628
|
"& .h4 ": { fontSize: "1.25em", fontWeight: "bolder" },
|
|
467
629
|
"& .h5 ": { fontSize: "1.25em", fontWeight: "semi-bold" },
|
|
468
630
|
"& .h6 ": { fontSize: "1.25em", fontWeight: "normal" },
|
|
469
|
-
"& .hg ": { lineHeight: "
|
|
470
|
-
|
|
471
|
-
"& .
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
631
|
+
"& .hg ": { lineHeight: "2.4lh" },
|
|
632
|
+
"& .h1, & .h2": { paddingBottom: "16px", position: "relative" },
|
|
633
|
+
"& .h1::after, & .h2::after": {
|
|
634
|
+
content: '""',
|
|
635
|
+
display: "block",
|
|
636
|
+
height: "1px",
|
|
637
|
+
borderBottom: "1px solid var(--cm-border, light-dark(#ddd, #555))"
|
|
638
|
+
}
|
|
639
|
+
}), Ae = x.baseTheme({
|
|
640
|
+
"& .hg .mk": { display: "none" },
|
|
641
|
+
"&.cm-focused .hg.sw .mk": { display: "inline" }
|
|
642
|
+
}), Ie = () => [
|
|
643
|
+
y(Be, {}),
|
|
644
|
+
Ee,
|
|
645
|
+
Ae
|
|
646
|
+
], De = (e) => `<svg class="qt-icon qt-caution" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
478
647
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M196.094 54.176C191.229 54.988 188.782 56.222 167.834 68.423C158.562 73.823 147.197 80.435 142.578 83.117C137.959 85.799 129.961 90.458 124.805 93.47C119.648 96.482 111.211 101.406 106.055 104.413C84.503 116.982 82.78 118.066 79.627 121.029C76.043 124.397 73.548 127.986 71.861 132.199C69.426 138.28 69.543 135.024 69.435 199.872L69.336 259.18L70.21 263.086C72.901 275.106 75.333 277.456 99.826 291.697C130.626 309.606 166.896 330.685 175.781 335.841C190.902 344.615 195.154 346.196 201.915 345.563C208.158 344.978 210.107 344.123 225.391 335.264C255.218 317.977 294.844 294.867 311.417 285.093C322.591 278.504 327.153 273.047 329.413 263.569L330.273 259.961V199.609V139.258L329.396 135.938C327.721 129.594 324.327 124.148 319.504 120.066C316.509 117.531 317.424 118.075 248.047 77.651C205.151 52.657 205.162 52.662 196.094 54.176ZM206.746 110.34C212.104 111.475 216.464 114.838 218.945 119.75C220.313 122.457 220.428 126.187 219.575 140.039C219.323 144.121 218.592 157.129 217.95 168.945C214.743 227.944 214.663 228.952 212.917 232.683C208.369 242.403 195.202 244.021 188.814 235.646C185.935 231.872 185.59 229.751 184.375 208.398C183.935 200.664 182.688 180.01 181.605 162.5C178.965 119.84 178.966 119.825 183.963 114.828C188.541 110.25 197.755 108.434 206.746 110.34ZM205.105 254.139C220.433 258.641 225.321 277.899 213.857 288.623C198.306 303.17 174.003 287.211 181.04 267.073C184.452 257.309 195.564 251.336 205.105 254.139Z"/>
|
|
479
|
-
</svg>`,
|
|
648
|
+
</svg>`, Ze = (e) => `<svg class="qt-icon qt-warning" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
480
649
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M195.982 53.527C185.35 55.195 178.527 60.217 172.381 70.898C165.461 82.925 148.022 114.138 122.184 160.742C115.633 172.559 100.427 199.98 88.394 221.68C57.505 277.38 55.934 280.238 54.25 283.76C45.588 301.882 55.075 322.592 74.884 328.805L78.32 329.883L198.438 329.99C278.577 330.062 319.42 329.965 321.154 329.699C337.809 327.15 349.594 312.698 348.718 295.898C348.297 287.827 348.329 287.895 328.438 252.148C310.272 219.501 297.79 196.996 280.665 166.016C235.38 84.092 225.675 66.998 222.278 63.175C216.156 56.285 204.847 52.136 195.982 53.527ZM209.263 116.46C218.176 119.751 220.681 125.503 219.95 141.003C219.711 146.059 219.256 155.732 218.938 162.5C218.62 169.268 218.011 180.43 217.584 187.305C216.759 200.593 216.366 207.385 215.42 224.66C215.058 231.282 214.609 236.196 214.259 237.373C210.281 250.771 189.551 250.542 185.792 237.058C185.226 235.025 184.802 229.702 183.979 214.258C183.761 210.176 183.323 202.881 183.006 198.047C182.213 185.991 181.756 178.028 181.054 164.063C180.724 157.51 180.287 149.424 180.081 146.094C178.833 125.858 181.444 119.151 191.797 115.99C194.231 115.247 206.901 115.588 209.263 116.46ZM205.893 260.709C224.265 266.28 227.749 290.936 211.55 300.733C192.458 312.28 170.521 292.287 180.334 272.284C184.884 263.009 196.351 257.816 205.893 260.709Z"/>
|
|
481
|
-
</svg>`,
|
|
650
|
+
</svg>`, Qe = (e) => `<svg class="qt-icon qt-important" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
482
651
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M190.234 64.334C153.518 67.16 117.751 87.08 95.346 117.181C46.258 183.13 68.9 277.91 142.564 314.837C228.927 358.129 330.405 294.361 330.594 196.68C330.742 119.807 265.747 58.523 190.234 64.334ZM219.531 126.465C220.494 126.947 221.218 127.78 221.98 129.284L223.062 131.421L222.957 139.621L222.852 147.822L221.875 148.263C213.74 151.931 214.67 145.87 214.532 196.094C214.395 245.634 214.025 242.228 219.783 244.354C223.193 245.613 223.047 245.172 223.047 254.214C223.047 263.28 222.791 264.649 220.681 266.868L219.262 268.359H200.09H180.919L179.769 267.392C177.295 265.31 176.926 263.501 177.043 254.054C177.131 246.999 177.246 245.543 177.734 245.295C178.057 245.131 179.5 244.445 180.943 243.77C182.568 243.01 183.905 242.067 184.459 241.291L185.352 240.039L185.456 197.305C185.559 155.268 185.548 154.545 184.78 152.959C183.999 151.347 181.2 149.279 178.906 148.622C176.957 148.063 176.953 148.047 176.953 139.659C176.953 129.986 177.595 127.658 180.624 126.34C182.693 125.439 217.703 125.552 219.531 126.465Z"/>
|
|
483
|
-
</svg>`,
|
|
652
|
+
</svg>`, Re = (e) => `<svg class="qt-icon qt-note" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
484
653
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M107.227 63.8769C101.558 65.1289 95.375 67.9369 91.406 71.0639C90.01 72.1639 88.215 73.5439 87.417 74.1299C86.62 74.7159 85.96 75.3819 85.952 75.6099C85.944 75.8379 85.612 76.3739 85.214 76.8009C81.982 80.2699 78.079 87.8199 76.776 93.1259L75.781 97.1769V198.907C75.781 262.894 75.922 301.425 76.16 302.76C76.368 303.928 76.623 305.38 76.726 305.987C78.4 315.889 87.879 327.367 98.558 332.423C107.578 336.694 98.739 336.366 201.563 336.242L291.602 336.133L294.27 335.228C309.157 330.183 318.557 320.61 322.536 306.445L323.633 302.539V228.516C323.633 144.681 323.906 151.756 320.402 144.774L318.615 141.211L286.943 109.57C269.523 92.1679 253.932 76.5229 252.297 74.8049C246.111 68.3049 241.836 65.3209 236.902 64.0589C233.006 63.0629 111.686 62.8929 107.227 63.8769ZM233.77 78.3359C236.715 80.5619 300.292 144.132 300.799 145.356C301.574 147.227 300.841 149.245 299.01 150.282L297.461 151.159L274.127 151.165C258.248 151.17 250.198 151.032 248.931 150.734C240.06 148.649 234.561 144.527 231.043 137.327C228.119 131.344 228.085 130.936 228.21 104.035L228.32 80.5309L229.275 79.5149C229.801 78.9559 230.767 78.3419 231.424 78.1519C233.014 77.6899 232.904 77.6809 233.77 78.3359ZM192.354 175.195C194.09 176.288 194.73 177.166 196.549 180.952C197.924 183.813 194.551 189.489 190.695 190.803C187.744 191.808 132.089 191.686 129.883 190.669C122.396 187.22 123.011 176.607 130.837 174.194C131.386 174.024 145.033 173.917 161.164 173.954L190.492 174.023L192.354 175.195ZM269.587 217.641C271.831 218.313 276.709 223.047 275.158 223.047C275.018 223.047 275.115 223.301 275.373 223.611C277.4 226.054 274.593 231.969 270.523 233.832L268.466 234.774L199.37 234.672L130.273 234.57L128.645 233.465C122.49 229.288 123.57 220.238 130.522 217.722C132.38 217.05 267.351 216.971 269.587 217.641ZM247.509 261.237C249.631 262.341 252.9 266.371 252.223 267.048C252.125 267.146 252.179 267.824 252.344 268.555C252.508 269.285 252.542 269.985 252.417 270.109C252.293 270.233 252.148 270.627 252.096 270.984C251.721 273.539 250.106 275.678 247.498 277.074L245.898 277.93L189.258 278.036C138.155 278.132 132.426 278.082 130.664 277.516C122.018 274.742 123.019 262.33 132.031 260.562C132.783 260.414 158.711 260.317 189.648 260.347L245.898 260.4L247.509 261.237Z"/>
|
|
485
|
-
</svg>`,
|
|
654
|
+
</svg>`, ze = (e) => `<svg class="qt-icon qt-tip" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
486
655
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M197.813 54.2439C196.932 54.6529 195.79 55.5789 195.274 56.3019L194.336 57.6169L194.219 70.8359L194.102 84.0549L195.076 85.3319C197.802 88.9059 203.271 88.5369 205.364 84.6369C206.151 83.1699 206.872 60.7239 206.215 58.1479C205.842 56.6839 203.21 53.9059 202.196 53.9059C201.901 53.9059 201.155 53.8149 200.537 53.7039C199.864 53.5829 198.772 53.7989 197.813 54.2439ZM116.233 86.0419C113.323 87.6899 112.27 91.6249 113.92 94.6849C115.402 97.4339 131.364 113.194 132.973 113.496C138.573 114.546 142.477 110.343 140.971 104.883C140.465 103.049 125.118 87.2169 122.574 85.9039C120.632 84.9019 118.15 84.9559 116.233 86.0419ZM277.93 85.7559C276.466 86.4829 260.132 103.191 259.49 104.618C257.281 109.529 261.871 114.699 267.084 113.171C268.604 112.726 283.491 98.5359 285.985 95.1559C289.892 89.8619 283.853 82.8139 277.93 85.7559ZM192.578 105.326C174.207 107.647 159.188 115.505 147.608 128.855C123.664 156.459 124.119 191.541 148.828 223.047C160.759 238.26 165.383 249.444 166.996 266.992C167.829 276.054 168.682 277.986 172.825 280.204C174.652 281.182 221.998 281.773 225.389 280.86C229.012 279.884 232.583 275.584 232.967 271.735C233.077 270.63 233.363 267.529 233.603 264.844C234.904 250.229 238.454 241.734 249.573 226.622C261.236 210.772 265.303 202.299 269.01 186.133C271.624 174.731 269.08 156.872 263.028 144.145C251.295 119.471 219.462 101.931 192.578 105.326ZM88.992 165.981C83.602 166.183 82.734 166.309 81.765 167.028C77.932 169.873 77.932 174.66 81.766 177.503C83.099 178.491 104.15 178.988 108.11 178.124C114.214 176.794 115.972 170.208 111.179 166.626C109.976 165.727 101.966 165.494 88.992 165.981ZM289.847 166.481C285.102 168.919 285.171 174.882 289.974 177.45C292.2 178.64 314.187 179.022 317.07 177.921C322.542 175.831 321.886 167.919 316.118 166.457C312.336 165.498 291.723 165.517 289.847 166.481ZM132.14 230.477C129.964 231.352 113.316 248.951 113.059 250.648C112.263 255.894 117.791 260.112 122.389 257.768C124.057 256.918 139.906 240.858 140.656 239.258C143.226 233.779 137.81 228.195 132.14 230.477ZM262.386 230.871C259.487 232.447 258.349 236.857 260.122 239.648C261.348 241.579 276.261 256.486 277.701 257.219C282.933 259.885 288.816 254.457 286.416 249.179C285.559 247.294 271.67 232.693 269.4 231.29C267.429 230.071 264.211 229.879 262.386 230.871ZM174.576 292.561C170.753 293.719 169.922 295.59 169.922 303.033C169.922 310.255 170.618 312.154 173.969 314.076L175.977 315.227L200.113 315.231C223.446 315.234 224.301 315.208 225.774 314.457C229.279 312.669 230.367 309.882 230.446 302.493L230.504 297.04L229.29 295.365C226.903 292.07 228.123 292.201 200.195 292.23C186.66 292.243 175.131 292.392 174.576 292.561ZM180.946 325.217C179.882 325.963 179.759 328.554 180.683 330.774C185.032 341.224 208.831 343.084 217.528 333.654C220.185 330.773 221.108 326.967 219.531 325.391C218.456 324.315 182.465 324.154 180.946 325.217Z"/>
|
|
487
|
-
</svg>`, Q = { tip:
|
|
488
|
-
class
|
|
656
|
+
</svg>`, Q = { tip: ze, note: Re, important: Qe, warning: Ze, caution: De, none: () => "" };
|
|
657
|
+
class Ne extends $ {
|
|
489
658
|
constructor(t) {
|
|
490
659
|
super(), this.type = t;
|
|
491
660
|
}
|
|
@@ -500,8 +669,8 @@ class He extends x {
|
|
|
500
669
|
return this.type === t.type;
|
|
501
670
|
}
|
|
502
671
|
}
|
|
503
|
-
function
|
|
504
|
-
const
|
|
672
|
+
function Pe(e, t) {
|
|
673
|
+
const r = ["Document", "ListItem", "BulletList", "OrderedList"], i = {
|
|
505
674
|
none: "bq-none-mark",
|
|
506
675
|
note: "bq-note-mark",
|
|
507
676
|
tip: "bq-tip-mark",
|
|
@@ -509,61 +678,61 @@ function $e(e, t) {
|
|
|
509
678
|
important: "bq-important-mark",
|
|
510
679
|
caution: "bq-caution-mark"
|
|
511
680
|
}, a = {
|
|
512
|
-
QuoteMark: (
|
|
681
|
+
QuoteMark: (s, o, d) => {
|
|
513
682
|
const u = ["qt-mk"];
|
|
514
|
-
return d in
|
|
683
|
+
return d in i ? u.push(i[d]) : u.push(i.none), l.mark({
|
|
515
684
|
class: u.join(" ")
|
|
516
|
-
}).range(
|
|
685
|
+
}).range(s, o);
|
|
517
686
|
},
|
|
518
|
-
QuoteType: (
|
|
519
|
-
widget: new
|
|
687
|
+
QuoteType: (s, o, d) => l.widget({
|
|
688
|
+
widget: new Ne(d),
|
|
520
689
|
side: 1
|
|
521
|
-
}).range(
|
|
522
|
-
BlockquoteLine: (
|
|
523
|
-
quoteLine: (
|
|
690
|
+
}).range(s),
|
|
691
|
+
BlockquoteLine: (s, o) => l.line({ class: "bq-line " + (o ? "sw" : "") }).range(s),
|
|
692
|
+
quoteLine: (s, o, d) => {
|
|
524
693
|
const u = `calc(100% - ${Math.max(0, d) + 1.2}ch)`;
|
|
525
694
|
return l.mark({
|
|
526
695
|
class: "bq-text-line",
|
|
527
696
|
attributes: { style: `width: ${u}` }
|
|
528
|
-
}).range(
|
|
697
|
+
}).range(s, o);
|
|
529
698
|
}
|
|
530
|
-
}, c = (
|
|
531
|
-
const g = [],
|
|
532
|
-
let
|
|
533
|
-
const
|
|
534
|
-
let
|
|
699
|
+
}, c = (s, o, d, u) => {
|
|
700
|
+
const g = [], m = d.number, w = (p, T) => {
|
|
701
|
+
let b = 0;
|
|
702
|
+
const f = [];
|
|
703
|
+
let C = 0;
|
|
535
704
|
return {
|
|
536
|
-
enter({ name:
|
|
537
|
-
|
|
705
|
+
enter({ name: L, node: q, from: k, to: H }) {
|
|
706
|
+
L === "Blockquote" && f.push(_e(s, q)), L === "QuoteMark" && (g.push(a[L](k, H, f[b])), C = H, b++), L === "QuoteType" && g.push(a[L](k, H, f[b - 1]));
|
|
538
707
|
},
|
|
539
|
-
leave({ name:
|
|
540
|
-
|
|
708
|
+
leave({ name: L, from: q, to: k }) {
|
|
709
|
+
L === "Paragraph" && C < T && g.push(a.quoteLine(C, T, C - p));
|
|
541
710
|
}
|
|
542
711
|
};
|
|
543
712
|
};
|
|
544
|
-
for (let
|
|
545
|
-
const { from:
|
|
546
|
-
g.push(a.BlockquoteLine(
|
|
713
|
+
for (let p = m; p < u + m; p++) {
|
|
714
|
+
const { from: T, to: b } = s.state.doc.line(p), { from: f, to: C } = o, L = M(s, f, C);
|
|
715
|
+
g.push(a.BlockquoteLine(T, L)), I(s.state).iterate({ from: T, to: b, ...w(T, b) });
|
|
547
716
|
}
|
|
548
717
|
return g;
|
|
549
|
-
},
|
|
550
|
-
return
|
|
551
|
-
enter: ({ name:
|
|
552
|
-
if (
|
|
553
|
-
const g = e.state.sliceDoc(
|
|
554
|
-
`),
|
|
555
|
-
|
|
718
|
+
}, n = [];
|
|
719
|
+
return v(e, {
|
|
720
|
+
enter: ({ name: s, from: o, to: d, node: u }) => {
|
|
721
|
+
if (s === "Blockquote") {
|
|
722
|
+
const g = e.state.sliceDoc(o, d).split(`
|
|
723
|
+
`), m = e.state.doc.lineAt(o);
|
|
724
|
+
n.push(...c(e, u, m, g.length));
|
|
556
725
|
}
|
|
557
|
-
return
|
|
726
|
+
return r.includes(s);
|
|
558
727
|
}
|
|
559
|
-
}), l.set(
|
|
728
|
+
}), l.set(n, !0);
|
|
560
729
|
}
|
|
561
|
-
const
|
|
562
|
-
const
|
|
563
|
-
if (!
|
|
564
|
-
const
|
|
565
|
-
return
|
|
566
|
-
},
|
|
730
|
+
const _e = (e, t) => {
|
|
731
|
+
const r = t.getChild("QuoteType");
|
|
732
|
+
if (!r) return "none";
|
|
733
|
+
const i = r.getChild("QuoteTypeText");
|
|
734
|
+
return i ? e.state.sliceDoc(i.from, i.to).toLowerCase() : "none";
|
|
735
|
+
}, Oe = () => x.baseTheme({
|
|
567
736
|
"& .qt-mk": {
|
|
568
737
|
// outline: "1px red solid",
|
|
569
738
|
position: "relative",
|
|
@@ -612,160 +781,47 @@ const Se = (e, t) => {
|
|
|
612
781
|
"& .wg-qt-icon > .qt-important": { fill: "var(--bq-important-mark, rebeccapurple)" },
|
|
613
782
|
"& .wg-qt-icon > .qt-warning": { fill: "var(--bq-warning-mark, peru)" },
|
|
614
783
|
"& .wg-qt-icon > .qt-caution": { fill: "var(--bq-caution-mark, red)" }
|
|
615
|
-
}),
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
],
|
|
784
|
+
}), Ve = () => [
|
|
785
|
+
y(Pe, {}),
|
|
786
|
+
Oe()
|
|
787
|
+
], We = {
|
|
619
788
|
name: "QuoteTypeParser",
|
|
620
789
|
parse(e, t) {
|
|
621
790
|
if ((() => {
|
|
622
|
-
for (let
|
|
623
|
-
if (e.parentType(
|
|
791
|
+
for (let i = 0; i < e.depth; i++)
|
|
792
|
+
if (e.parentType(i).name === "Blockquote") return !0;
|
|
624
793
|
return !1;
|
|
625
794
|
})()) {
|
|
626
|
-
const
|
|
627
|
-
if (
|
|
628
|
-
const a =
|
|
629
|
-
|
|
795
|
+
const i = t.text.match(/^(\s*>\s*)+(\[!\w+\])\s*$/);
|
|
796
|
+
if (i && i[2]) {
|
|
797
|
+
const a = i[2], c = t.text.indexOf(a), n = c + a.length, s = e.elt("QuoteType", e.lineStart + c, e.lineStart + n);
|
|
798
|
+
s.children = [
|
|
630
799
|
e.elt("QuoteTypeMark", e.lineStart + c, e.lineStart + c + 2),
|
|
631
|
-
e.elt("QuoteTypeText", e.lineStart + c + 2, e.lineStart +
|
|
632
|
-
e.elt("QuoteTypeMark", e.lineStart +
|
|
633
|
-
], e.addElement(
|
|
800
|
+
e.elt("QuoteTypeText", e.lineStart + c + 2, e.lineStart + n - 1),
|
|
801
|
+
e.elt("QuoteTypeMark", e.lineStart + n - 1, e.lineStart + n)
|
|
802
|
+
], e.addElement(s);
|
|
634
803
|
}
|
|
635
804
|
}
|
|
636
805
|
return !1;
|
|
637
806
|
}
|
|
638
|
-
},
|
|
807
|
+
}, Fe = {
|
|
639
808
|
defineNodes: [
|
|
640
|
-
{ name: "QuoteType", style: { "QuoteType/...":
|
|
641
|
-
{ name: "QuoteTypeMark", style:
|
|
642
|
-
{ name: "QuoteTypeText", style:
|
|
809
|
+
{ name: "QuoteType", style: { "QuoteType/...": A.content } },
|
|
810
|
+
{ name: "QuoteTypeMark", style: A.processingInstruction },
|
|
811
|
+
{ name: "QuoteTypeText", style: A.bool }
|
|
643
812
|
],
|
|
644
|
-
parseBlock: [
|
|
645
|
-
}, N = (e, t, s) => {
|
|
646
|
-
const o = e.state.sliceDoc(t, s), a = o.match(/\[(.*)\]/);
|
|
647
|
-
return a !== null && a.length > 1 ? {
|
|
648
|
-
text: a[1],
|
|
649
|
-
from: t + o.indexOf(a[1]),
|
|
650
|
-
to: t + 1 + a[1].length
|
|
651
|
-
} : { text: null };
|
|
813
|
+
parseBlock: [We]
|
|
652
814
|
};
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
marks: ["LinkMark"],
|
|
657
|
-
url: "URL"
|
|
658
|
-
}
|
|
659
|
-
}, a = {
|
|
660
|
-
Link: (r, n, i) => l.mark({ class: "link " + (i ? "sw" : "") }).range(r, n),
|
|
661
|
-
LinkMark: (r, n) => l.mark({ class: "lk-mk" }).range(r, n),
|
|
662
|
-
TextDec: (r, n, i) => l.mark({
|
|
663
|
-
class: "lk-text url",
|
|
664
|
-
tagName: "a",
|
|
665
|
-
attributes: { href: i, target: "_blank" }
|
|
666
|
-
}).range(r, n),
|
|
667
|
-
URL: (r, n, i) => l.mark({
|
|
668
|
-
class: "lk-url url",
|
|
669
|
-
tagName: "a",
|
|
670
|
-
attributes: { href: i, target: "_blank" }
|
|
671
|
-
}).range(r, n)
|
|
672
|
-
}, c = [];
|
|
673
|
-
return y(e, {
|
|
674
|
-
enter: ({ type: { name: r }, from: n, to: i, node: d }) => {
|
|
675
|
-
if (r === "URL" && c.push(a.URL(n, i, e.state.sliceDoc(n, i))), !(r in o)) return !s.includes(r);
|
|
676
|
-
c.push(a.Link(n, i, M(e, n, i)));
|
|
677
|
-
const u = o[r].marks.flatMap((p) => d.getChildren(p));
|
|
678
|
-
c.push(...u.map(({ from: p, to: h }) => a.LinkMark(p, h)));
|
|
679
|
-
const g = d.getChild(o[r].url);
|
|
680
|
-
let C = null;
|
|
681
|
-
if (g !== null) {
|
|
682
|
-
const { from: p, to: h } = g;
|
|
683
|
-
C = e.state.sliceDoc(p, h), c.push(a.URL(p, h, C));
|
|
684
|
-
}
|
|
685
|
-
if (d.getChild("Image") === null) {
|
|
686
|
-
const { text: p, from: h, to: k } = N(e, n, i);
|
|
687
|
-
p !== null && C !== null && c.push(a.TextDec(h, k, C));
|
|
688
|
-
}
|
|
689
|
-
return !1;
|
|
690
|
-
}
|
|
691
|
-
}), l.set(c, !0);
|
|
692
|
-
}
|
|
693
|
-
const Ze = (e, t) => e.ctrlKey ? Qe(
|
|
694
|
-
e.target
|
|
695
|
-
/* as HTMLElement */
|
|
696
|
-
) : !1, Qe = (e) => {
|
|
697
|
-
if (e.nodeName === "A" && e.href && e.classList.contains("url"))
|
|
698
|
-
return window.open(e.href, e.target), !0;
|
|
699
|
-
}, ze = T.baseTheme({
|
|
700
|
-
".lk-mk, .link > .lk-url": { display: "none" },
|
|
701
|
-
"&.cm-focused .link.sw .lk-mk, &.cm-focused .link.sw .lk-url": { display: "inherit" }
|
|
702
|
-
}), Re = () => [
|
|
703
|
-
q(De, {}, { eventHandlers: { mousedown: Ze } }),
|
|
704
|
-
ze
|
|
705
|
-
];
|
|
706
|
-
class Ne extends x {
|
|
707
|
-
constructor(t, s = null, o = "[image]") {
|
|
708
|
-
super(), this.img = t, this.url = s, this.alt = o;
|
|
709
|
-
}
|
|
710
|
-
toDOM() {
|
|
711
|
-
let t = document.createElement("img");
|
|
712
|
-
if (t.src = this.img, t.alt = this.alt, t.style.minWidth = "100px", this.url) {
|
|
713
|
-
let s = document.createElement("a");
|
|
714
|
-
return s.href = this.url, s.target = "_blank", s.classList.add("url"), s.appendChild(t), s;
|
|
715
|
-
} else
|
|
716
|
-
return t;
|
|
717
|
-
}
|
|
718
|
-
eq(t) {
|
|
719
|
-
return this.img === t.img;
|
|
720
|
-
}
|
|
721
|
-
ignoreEvent() {
|
|
722
|
-
return !1;
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
function Pe(e, t) {
|
|
726
|
-
const s = ["FencedCode", "Image"], o = [];
|
|
727
|
-
return y(e, {
|
|
728
|
-
enter: ({ type: { name: a }, from: c, to: r, node: n }) => {
|
|
729
|
-
if (a === "Image" && !M(e, c, r)) {
|
|
730
|
-
const { from: i, to: d } = n.getChild("URL"), u = e.state.sliceDoc(i, d), { text: g } = N(e, c, r);
|
|
731
|
-
o.push(
|
|
732
|
-
l.replace({
|
|
733
|
-
widget: new Ne(u, _e(e, n), g)
|
|
734
|
-
}).range(c, r)
|
|
735
|
-
);
|
|
736
|
-
}
|
|
737
|
-
return !s.includes(a);
|
|
738
|
-
}
|
|
739
|
-
}), l.set(o, !1);
|
|
740
|
-
}
|
|
741
|
-
const _e = (e, t) => {
|
|
742
|
-
const o = t.parent.getChild("URL");
|
|
743
|
-
if (o !== null) {
|
|
744
|
-
const { from: a, to: c } = o;
|
|
745
|
-
return e.state.sliceDoc(a, c);
|
|
746
|
-
}
|
|
747
|
-
return null;
|
|
748
|
-
}, Oe = (e, t) => e.ctrlKey ? We(
|
|
749
|
-
e.target
|
|
750
|
-
/* as HTMLElement */
|
|
751
|
-
) : !1, We = (e) => {
|
|
752
|
-
const t = e.parentElement ?? !1;
|
|
753
|
-
if (e.nodeName === "IMG" && t && t.nodeName === "A" && t.classList.contains("url"))
|
|
754
|
-
return !0;
|
|
755
|
-
}, Ve = T.baseTheme({}), Fe = () => [
|
|
756
|
-
q(Pe, {}, { eventHandlers: { mousedown: Oe } }),
|
|
757
|
-
Ve
|
|
758
|
-
];
|
|
759
|
-
class z extends x {
|
|
760
|
-
constructor(t, s = !1) {
|
|
761
|
-
super(), this.content = t, this.tag = s;
|
|
815
|
+
class R extends $ {
|
|
816
|
+
constructor(t, r = !1) {
|
|
817
|
+
super(), this.content = t, this.tag = r;
|
|
762
818
|
}
|
|
763
819
|
toDOM() {
|
|
764
820
|
const t = document.createElement("div");
|
|
765
821
|
t.className = "cm-html-widget", t.setAttribute("aria-hidden", "true");
|
|
766
|
-
const
|
|
767
|
-
return t.innerHTML = (this.tag ? '<span class="cm-rendered-tag">RTAG</span>' : "") +
|
|
768
|
-
|
|
822
|
+
const r = this.content.replace(/^```html\n?/, "").replace(/```$/, "").trim();
|
|
823
|
+
return t.innerHTML = (this.tag ? '<span class="cm-rendered-tag">RTAG</span>' : "") + r, t.querySelectorAll("script").forEach((i) => {
|
|
824
|
+
i.parentNode.removeChild(i);
|
|
769
825
|
}), t;
|
|
770
826
|
}
|
|
771
827
|
ignoreEvent(t) {
|
|
@@ -781,42 +837,42 @@ const P = G.define(), Ue = K.define({
|
|
|
781
837
|
},
|
|
782
838
|
update(e, t) {
|
|
783
839
|
e = e.map(t.changes);
|
|
784
|
-
for (let
|
|
785
|
-
if (
|
|
786
|
-
return
|
|
840
|
+
for (let r of t.effects)
|
|
841
|
+
if (r.is(P))
|
|
842
|
+
return r.value;
|
|
787
843
|
return e;
|
|
788
844
|
},
|
|
789
|
-
provide: (e) =>
|
|
845
|
+
provide: (e) => z.decorations.from(e)
|
|
790
846
|
});
|
|
791
847
|
function Xe(e) {
|
|
792
848
|
const t = [
|
|
793
849
|
/<br>/,
|
|
794
850
|
/<img .*\/>/
|
|
795
|
-
],
|
|
851
|
+
], r = {
|
|
796
852
|
HTMLBlock: (a, c) => {
|
|
797
|
-
const
|
|
853
|
+
const n = e.state.doc.sliceString(a, c);
|
|
798
854
|
return [l.replace({
|
|
799
|
-
widget: new
|
|
855
|
+
widget: new R(n),
|
|
800
856
|
inclusive: !1
|
|
801
857
|
}).range(a, c)];
|
|
802
858
|
},
|
|
803
859
|
HTMLTag: (a, c) => {
|
|
804
|
-
const
|
|
805
|
-
return console.log(
|
|
860
|
+
const n = e.state.doc.sliceString(a, c);
|
|
861
|
+
return console.log(n), t.some((s) => s.test(n)) ? (console.log(n), [
|
|
806
862
|
l.replace({
|
|
807
|
-
widget: new
|
|
863
|
+
widget: new R(n, !0),
|
|
808
864
|
inclusive: !1
|
|
809
865
|
}).range(a, c)
|
|
810
866
|
]) : [];
|
|
811
867
|
}
|
|
812
|
-
},
|
|
813
|
-
return
|
|
814
|
-
enter: ({ type: a, from: c, to:
|
|
815
|
-
a.name in
|
|
868
|
+
}, i = [];
|
|
869
|
+
return v(e, {
|
|
870
|
+
enter: ({ type: a, from: c, to: n, node: s }) => {
|
|
871
|
+
a.name in r && (!M(e, c, n) || !e.hasFocus) && i.push(...r[a.name](c, n));
|
|
816
872
|
}
|
|
817
|
-
}), l.set(
|
|
873
|
+
}), l.set(i);
|
|
818
874
|
}
|
|
819
|
-
const je =
|
|
875
|
+
const je = x.baseTheme({
|
|
820
876
|
"& .cm-html-widget": {
|
|
821
877
|
all: "unset"
|
|
822
878
|
// outline: "red solid 2px",
|
|
@@ -828,7 +884,7 @@ const je = T.baseTheme({
|
|
|
828
884
|
marginTop: "0"
|
|
829
885
|
},
|
|
830
886
|
"& .cm-widgetBuffer": { display: "none" }
|
|
831
|
-
}), Ge =
|
|
887
|
+
}), Ge = z.updateListener.of((e) => {
|
|
832
888
|
if (e.selectionSet || e.docChanged || e.focusChanged || e.geometryChanged) {
|
|
833
889
|
const t = Xe(e.view);
|
|
834
890
|
e.view.dispatch({ effects: P.of(t) });
|
|
@@ -841,47 +897,47 @@ const je = T.baseTheme({
|
|
|
841
897
|
const {
|
|
842
898
|
markdown: {
|
|
843
899
|
defaultCodeLanguage: t,
|
|
844
|
-
codeLanguages:
|
|
845
|
-
addKeymap:
|
|
900
|
+
codeLanguages: r,
|
|
901
|
+
addKeymap: i,
|
|
846
902
|
base: a,
|
|
847
903
|
completeHTMLTags: c,
|
|
848
|
-
htmlTagLanguage:
|
|
849
|
-
extensions:
|
|
904
|
+
htmlTagLanguage: n,
|
|
905
|
+
extensions: s = []
|
|
850
906
|
} = {}
|
|
851
907
|
// theme
|
|
852
|
-
} = e ?? {},
|
|
908
|
+
} = e ?? {}, o = {
|
|
853
909
|
defaultCodeLanguage: t,
|
|
854
|
-
codeLanguages:
|
|
855
|
-
addKeymap:
|
|
910
|
+
codeLanguages: r || V,
|
|
911
|
+
addKeymap: i,
|
|
856
912
|
base: a,
|
|
857
913
|
completeHTMLTags: c,
|
|
858
|
-
htmlTagLanguage:
|
|
859
|
-
extensions: [...
|
|
914
|
+
htmlTagLanguage: n,
|
|
915
|
+
extensions: [...s, F, J, Fe]
|
|
860
916
|
};
|
|
861
917
|
return [
|
|
862
|
-
|
|
918
|
+
W(o),
|
|
863
919
|
ne(),
|
|
864
920
|
ie(),
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
921
|
+
ue(),
|
|
922
|
+
Ce(),
|
|
923
|
+
xe(),
|
|
924
|
+
Se(),
|
|
925
|
+
Ie(),
|
|
926
|
+
Ve(),
|
|
871
927
|
Ke()
|
|
872
928
|
// (theme) ? themeVariant.of(catppuccin(theme)) : [],
|
|
873
929
|
];
|
|
874
930
|
};
|
|
875
931
|
export {
|
|
876
|
-
|
|
877
|
-
|
|
932
|
+
Se as CodePlugin,
|
|
933
|
+
Ie as HeadingPlugin,
|
|
878
934
|
ne as HrPlugin,
|
|
879
935
|
Ke as HtmlPlugin,
|
|
880
|
-
|
|
936
|
+
Ce as ImagePlugin,
|
|
881
937
|
ie as InlinePlugin,
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
938
|
+
ue as LinkPlugin,
|
|
939
|
+
xe as ListPlugin,
|
|
940
|
+
Ve as QuotePlugin,
|
|
941
|
+
Fe as QuoteType,
|
|
886
942
|
ct as gnosis
|
|
887
943
|
};
|