@glifox/gnosis 0.0.18 → 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/dist/exports.d.ts +3 -3
- package/dist/gnosis.mjs +229 -220
- package/dist/gnosis.umd.js +6 -6
- package/package.json +1 -1
package/dist/exports.d.ts
CHANGED
|
@@ -3,13 +3,13 @@ import { MarkdownExtension } from '@lezer/markdown';
|
|
|
3
3
|
import { Extension } from '@codemirror/state';
|
|
4
4
|
import { HrPlugin } from '../src/plugins/block/hr/plugin';
|
|
5
5
|
import { InlinePlugin } from '../src/plugins/inline/plugin';
|
|
6
|
+
import { LinkPlugin } from './plugins/links/link/plugin';
|
|
7
|
+
import { ImagePlugin } from './plugins/links/image/plugin';
|
|
6
8
|
import { ListPlugin } from '../src/plugins/block/list/plugin';
|
|
7
9
|
import { CodePlugin } from '../src/plugins/block/code/plugin';
|
|
8
10
|
import { HeadingPlugin } from '../src/plugins/block/heading/plugin';
|
|
9
11
|
import { QuotePlugin } from './plugins/block/quotes/plugin';
|
|
10
12
|
import { QuoteType } from './plugins/block/quotes/extension';
|
|
11
|
-
import { LinkPlugin } from './plugins/links/link/plugin';
|
|
12
|
-
import { ImagePlugin } from './plugins/links/image/plugin';
|
|
13
13
|
import { HtmlPlugin } from './plugins/block/html/plugin';
|
|
14
14
|
interface MarkdownConfig {
|
|
15
15
|
defaultCodeLanguage?: Language | LanguageSupport;
|
|
@@ -24,4 +24,4 @@ interface GnosisConfig {
|
|
|
24
24
|
markdown?: MarkdownConfig;
|
|
25
25
|
}
|
|
26
26
|
declare const gnosis: (conf?: GnosisConfig) => Extension[];
|
|
27
|
-
export { gnosis, HrPlugin, InlinePlugin, ListPlugin, CodePlugin, HeadingPlugin,
|
|
27
|
+
export { gnosis, HrPlugin, InlinePlugin, LinkPlugin, ImagePlugin, ListPlugin, CodePlugin, HeadingPlugin, QuotePlugin, QuoteType, HtmlPlugin, };
|
package/dist/gnosis.mjs
CHANGED
|
@@ -5,9 +5,9 @@ import { languages as V } from "@codemirror/language-data";
|
|
|
5
5
|
import { markdown as W } from "@codemirror/lang-markdown";
|
|
6
6
|
import { GFM as F } from "@lezer/markdown";
|
|
7
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
|
|
8
|
+
import { ViewPlugin as j, Decoration as l, WidgetType as $, EditorView as z } from "@codemirror/view";
|
|
9
9
|
import { syntaxTree as I } from "@codemirror/language";
|
|
10
|
-
import { EditorView as
|
|
10
|
+
import { EditorView as x } from "codemirror";
|
|
11
11
|
import { StateEffect as G, StateField as K } from "@codemirror/state";
|
|
12
12
|
const h = U.define("none"), Y = X({
|
|
13
13
|
"Blockquote/...": h,
|
|
@@ -47,7 +47,7 @@ const h = U.define("none"), Y = X({
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
return j.fromClass(i, { decorations: (a) => a.decorations, ...r });
|
|
50
|
-
},
|
|
50
|
+
}, M = (e, t, r) => {
|
|
51
51
|
const i = e.state.selection.ranges;
|
|
52
52
|
for (let a of i)
|
|
53
53
|
if (a.from >= t && a.from <= r || a.to >= t && a.to <= r || a.from <= t && a.to >= r)
|
|
@@ -65,10 +65,10 @@ function ee(e, t) {
|
|
|
65
65
|
]
|
|
66
66
|
}, c = [];
|
|
67
67
|
return v(e, {
|
|
68
|
-
enter: ({ type: n, from: s, to: o }) => (n.name in a && c.push(...a[n.name](s, o,
|
|
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" },
|
|
@@ -96,14 +96,14 @@ function re(e, t) {
|
|
|
96
96
|
return v(e, {
|
|
97
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
98
|
i[n](
|
|
99
|
-
|
|
99
|
+
M(e, s, o),
|
|
100
100
|
s,
|
|
101
101
|
o
|
|
102
102
|
)
|
|
103
103
|
), !r.includes(n))
|
|
104
104
|
}), l.set(c, !1);
|
|
105
105
|
}
|
|
106
|
-
const se =
|
|
106
|
+
const se = x.baseTheme({
|
|
107
107
|
"& .it ": { fontStyle: "italic" },
|
|
108
108
|
"& .st ": { fontWeight: "bold" },
|
|
109
109
|
"& .sk ": { textDecoration: "line-through" },
|
|
@@ -113,15 +113,128 @@ const se = M.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
120
|
y(re, {}),
|
|
121
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
|
|
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 $ {
|
|
125
238
|
constructor(r) {
|
|
126
239
|
super();
|
|
127
240
|
S(this, "checked", !1);
|
|
@@ -138,7 +251,7 @@ class ae extends $ {
|
|
|
138
251
|
return !1;
|
|
139
252
|
}
|
|
140
253
|
}
|
|
141
|
-
function
|
|
254
|
+
function we(e, t) {
|
|
142
255
|
const r = [
|
|
143
256
|
"Document",
|
|
144
257
|
"ListItem",
|
|
@@ -158,7 +271,7 @@ function ce(e, t) {
|
|
|
158
271
|
TaskMarker: (o, d, u, g = !0) => {
|
|
159
272
|
const m = e.state.doc.sliceString(o + 1, d - 1) === "x";
|
|
160
273
|
return g ? l.mark({ class: `tm ${m ? "ck" : ""}` }).range(o, d) : l.replace({
|
|
161
|
-
widget: new
|
|
274
|
+
widget: new be(m)
|
|
162
275
|
}).range(o, d);
|
|
163
276
|
}
|
|
164
277
|
}, c = {
|
|
@@ -180,7 +293,7 @@ function ce(e, t) {
|
|
|
180
293
|
d,
|
|
181
294
|
u,
|
|
182
295
|
i[s.slice(-1)[0].name],
|
|
183
|
-
|
|
296
|
+
M(e, d, u)
|
|
184
297
|
)), o in c) {
|
|
185
298
|
const m = e.state.doc.lineAt(d);
|
|
186
299
|
n.push(...c[o](
|
|
@@ -199,18 +312,18 @@ function ce(e, t) {
|
|
|
199
312
|
}
|
|
200
313
|
}), l.set(n, !0);
|
|
201
314
|
}
|
|
202
|
-
const
|
|
315
|
+
const Le = (e, t) => {
|
|
203
316
|
var i;
|
|
204
317
|
let r = e.target;
|
|
205
|
-
if (r.nodeName === "INPUT" && ((i = r.parentElement) != null && i.classList.contains("TaskMark"))) return
|
|
206
|
-
},
|
|
318
|
+
if (r.nodeName === "INPUT" && ((i = r.parentElement) != null && i.classList.contains("TaskMark"))) return Te(t, t.posAtDOM(r));
|
|
319
|
+
}, Te = (e, t) => {
|
|
207
320
|
const r = t - 2, i = t - 1;
|
|
208
321
|
let a = e.state.doc.sliceString(Math.max(0, r), i), c;
|
|
209
322
|
if (a === "x") c = { from: r, to: i, insert: " " };
|
|
210
323
|
else if (a === " ") c = { from: r, to: i, insert: "x" };
|
|
211
324
|
else return !1;
|
|
212
325
|
return e.dispatch({ changes: c }), !0;
|
|
213
|
-
},
|
|
326
|
+
}, qe = () => x.baseTheme({
|
|
214
327
|
"& .lm.bl": {
|
|
215
328
|
position: "relative",
|
|
216
329
|
// paddingInlineStart: "1ch",
|
|
@@ -222,8 +335,8 @@ const le = (e, t) => {
|
|
|
222
335
|
position: "absolute",
|
|
223
336
|
borderRadius: "50%",
|
|
224
337
|
top: "50%",
|
|
225
|
-
left: "
|
|
226
|
-
transform: "translate(
|
|
338
|
+
left: "50%",
|
|
339
|
+
transform: "translate(-50%, -50%)",
|
|
227
340
|
height: ".4em",
|
|
228
341
|
width: ".4em"
|
|
229
342
|
},
|
|
@@ -248,17 +361,17 @@ const le = (e, t) => {
|
|
|
248
361
|
"& .cb-content .ls-text-line, & .cb-spacer .ls-text-line": {
|
|
249
362
|
width: "unset !important"
|
|
250
363
|
}
|
|
251
|
-
}),
|
|
252
|
-
y(
|
|
253
|
-
|
|
254
|
-
],
|
|
364
|
+
}), xe = () => [
|
|
365
|
+
y(we, {}, { eventHandlers: { mousedown: Le } }),
|
|
366
|
+
qe()
|
|
367
|
+
], ye = (e, t) => {
|
|
255
368
|
var i;
|
|
256
369
|
let r = e.target;
|
|
257
370
|
if (r.nodeName === "BUTTON" && ((i = r.parentElement) != null && i.classList.contains("wg-codeblock"))) {
|
|
258
371
|
const a = ["FencedCode", "CodeBlock"];
|
|
259
372
|
let c = "";
|
|
260
373
|
const n = {
|
|
261
|
-
enter: ({ type: { name: s }, from: o, to: d, node: u }) => (a.includes(s) && (c =
|
|
374
|
+
enter: ({ type: { name: s }, from: o, to: d, node: u }) => (a.includes(s) && (c = Me(t, u.toTree(), o, d)), !a.includes(s))
|
|
262
375
|
};
|
|
263
376
|
return I(t.state).iterate({
|
|
264
377
|
...n,
|
|
@@ -266,7 +379,7 @@ const le = (e, t) => {
|
|
|
266
379
|
to: t.posAtDOM(r) + 2
|
|
267
380
|
}), navigator.clipboard.writeText(c), !0;
|
|
268
381
|
}
|
|
269
|
-
},
|
|
382
|
+
}, Me = (e, t, r, i) => {
|
|
270
383
|
const a = ["CodeMark", "CodeInfo"];
|
|
271
384
|
let c = e.state.doc.sliceString(r, i), n = /* @__PURE__ */ new Set();
|
|
272
385
|
t.iterate({
|
|
@@ -295,11 +408,11 @@ class B extends $ {
|
|
|
295
408
|
return !1;
|
|
296
409
|
}
|
|
297
410
|
}
|
|
298
|
-
const
|
|
411
|
+
const ve = (e) => `<svg class="cb-icon" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
299
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"/>
|
|
300
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"/>
|
|
301
414
|
</svg>`;
|
|
302
|
-
class
|
|
415
|
+
class He extends $ {
|
|
303
416
|
constructor(t, r) {
|
|
304
417
|
super(), this.type = t, this.code = r;
|
|
305
418
|
}
|
|
@@ -307,7 +420,7 @@ class fe extends $ {
|
|
|
307
420
|
let t = document.createElement("span");
|
|
308
421
|
t.setAttribute("aria-hidden", "true"), t.className = "wg-codeblock";
|
|
309
422
|
let r = document.createElement("button");
|
|
310
|
-
return r.className = "wg-codeblock-btn", r.innerHTML =
|
|
423
|
+
return r.className = "wg-codeblock-btn", r.innerHTML = ve(), t.appendChild(r), t;
|
|
311
424
|
}
|
|
312
425
|
ignoreEvent() {
|
|
313
426
|
return !1;
|
|
@@ -340,70 +453,70 @@ function D(e, t) {
|
|
|
340
453
|
}[r];
|
|
341
454
|
}
|
|
342
455
|
const Z = (e, t, r, i) => {
|
|
343
|
-
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 =
|
|
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);
|
|
344
457
|
n.push(
|
|
345
|
-
l.widget({ widget: new
|
|
458
|
+
l.widget({ widget: new He("view.state.sliceDoc(from, to)", "code"), side: 0 }).range(t + 1)
|
|
346
459
|
);
|
|
347
460
|
const p = u.number, T = e.state.doc.sliceString(t, r).split(`
|
|
348
461
|
`).length;
|
|
349
462
|
for (let b = p; b < T + p; b++) {
|
|
350
|
-
const { from: f, to:
|
|
463
|
+
const { from: f, to: C } = e.state.doc.line(b), L = `100% - ${a + c}px`, q = ["cb-content"];
|
|
351
464
|
w && q.push("sw"), b === p && q.push("cb-start"), b === T + p - 1 && q.push("cb-end");
|
|
352
|
-
const
|
|
353
|
-
if (
|
|
465
|
+
const k = Math.max(f + g, 0);
|
|
466
|
+
if (C < k)
|
|
354
467
|
n.push(l.widget({
|
|
355
468
|
widget: new B(
|
|
356
469
|
["left", "cb-error"].join(" "),
|
|
357
470
|
"0.1px"
|
|
358
471
|
),
|
|
359
472
|
side: 0
|
|
360
|
-
}).range(
|
|
473
|
+
}).range(C), l.widget({
|
|
361
474
|
widget: new B(
|
|
362
475
|
["cb-error", "right"].join(" "),
|
|
363
476
|
"",
|
|
364
477
|
"",
|
|
365
|
-
|
|
478
|
+
k - C
|
|
366
479
|
),
|
|
367
480
|
side: 1
|
|
368
|
-
}).range(
|
|
369
|
-
else if (f ===
|
|
481
|
+
}).range(C));
|
|
482
|
+
else if (f === C && f === k)
|
|
370
483
|
n.push(l.widget({
|
|
371
484
|
widget: new B(
|
|
372
485
|
[...q, "left"].join(" "),
|
|
373
486
|
"0"
|
|
374
487
|
),
|
|
375
488
|
side: 0
|
|
376
|
-
}).range(
|
|
489
|
+
}).range(C), l.widget({
|
|
377
490
|
widget: new B(
|
|
378
491
|
q.join(" "),
|
|
379
492
|
`calc(${L} - ${c}px)`,
|
|
380
493
|
"0"
|
|
381
494
|
),
|
|
382
495
|
side: 1
|
|
383
|
-
}).range(
|
|
384
|
-
else if (
|
|
496
|
+
}).range(k));
|
|
497
|
+
else if (k === C)
|
|
385
498
|
q.push("wg"), n.push(
|
|
386
499
|
l.widget({
|
|
387
500
|
widget: new B(
|
|
388
501
|
q.join(" "),
|
|
389
|
-
`calc(${L} - ${
|
|
502
|
+
`calc(${L} - ${k - f}ch)`
|
|
390
503
|
),
|
|
391
504
|
side: 1
|
|
392
|
-
}).range(
|
|
505
|
+
}).range(k)
|
|
393
506
|
);
|
|
394
507
|
else if (o || d || m) {
|
|
395
|
-
const H = { style: `width: calc(${L} - ${
|
|
396
|
-
|
|
397
|
-
} else if (f !==
|
|
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) {
|
|
398
511
|
const H = { style: `width: calc(${L})` };
|
|
399
|
-
n.push(l.mark({ class: q.join(" "), attributes: H }).range(f,
|
|
512
|
+
n.push(l.mark({ class: q.join(" "), attributes: H }).range(f, C));
|
|
400
513
|
}
|
|
401
514
|
n.push(l.line({ class: "cb-line" }).range(f));
|
|
402
515
|
}
|
|
403
516
|
return n;
|
|
404
|
-
},
|
|
517
|
+
}, $e = (e) => {
|
|
405
518
|
const t = e.marginLeft, r = e.paddingLeft, i = 0, a = "4px", c = "1lh";
|
|
406
|
-
return
|
|
519
|
+
return x.baseTheme({
|
|
407
520
|
"& .cb-start": { borderRadius: `${a} ${a} 0 0` },
|
|
408
521
|
"& .cb-end ": { borderRadius: `0 0 ${a} ${a}` },
|
|
409
522
|
"& .cb-start.cb-end": { borderRadius: `${a}` },
|
|
@@ -471,27 +584,29 @@ const Z = (e, t, r, i) => {
|
|
|
471
584
|
width: "5ch"
|
|
472
585
|
},
|
|
473
586
|
"& .cb-content": {
|
|
474
|
-
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"
|
|
475
589
|
},
|
|
476
590
|
"& .cb-error.left": { padding: "0" },
|
|
477
591
|
"& .cb-error.right": { paddingRight: `${t}px` },
|
|
478
592
|
"& .cb-error": {
|
|
479
593
|
display: "inline-block",
|
|
480
|
-
backgroundColor: "var(--cm-ic-error, hsl(from red h s l / .5))"
|
|
594
|
+
backgroundColor: "var(--cm-ic-error, hsl(from red h s l / .5))",
|
|
595
|
+
cursor: "text"
|
|
481
596
|
}
|
|
482
597
|
});
|
|
483
|
-
},
|
|
598
|
+
}, Se = () => {
|
|
484
599
|
const e = {
|
|
485
600
|
marginLeft: 2,
|
|
486
601
|
paddingLeft: 6
|
|
487
602
|
};
|
|
488
603
|
return [
|
|
489
604
|
y(D, { mode: "mark" }),
|
|
490
|
-
y(D, { mode: "type", options: e }, { eventHandlers: { mousedown:
|
|
491
|
-
|
|
605
|
+
y(D, { mode: "type", options: e }, { eventHandlers: { mousedown: ye } }),
|
|
606
|
+
$e(e)
|
|
492
607
|
];
|
|
493
608
|
};
|
|
494
|
-
function
|
|
609
|
+
function Be(e, t) {
|
|
495
610
|
const r = ["Document"], i = {
|
|
496
611
|
ATXHeading1: (n, s = !0) => l.line({ class: "h1 hg " + (s ? "sw" : "") }).range(n),
|
|
497
612
|
ATXHeading2: (n, s = !0) => l.line({ class: "h2 hg " + (s ? "sw" : "") }).range(n),
|
|
@@ -503,36 +618,43 @@ function be(e, t) {
|
|
|
503
618
|
HeaderMark: (n, s) => l.mark({ class: "mk" }).range(n, s)
|
|
504
619
|
}, c = [];
|
|
505
620
|
return v(e, {
|
|
506
|
-
enter: ({ type: n, from: s, to: o }) => (n.name in i && c.push(i[n.name](s,
|
|
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)
|
|
507
622
|
}), l.set(c, !1);
|
|
508
623
|
}
|
|
509
|
-
const
|
|
624
|
+
const Ee = x.baseTheme({
|
|
510
625
|
"& .h1 ": { fontSize: "2.00em", fontWeight: "bolder" },
|
|
511
626
|
"& .h2 ": { fontSize: "1.55em", fontWeight: "bolder" },
|
|
512
627
|
"& .h3 ": { fontSize: "1.35em", fontWeight: "bolder" },
|
|
513
628
|
"& .h4 ": { fontSize: "1.25em", fontWeight: "bolder" },
|
|
514
629
|
"& .h5 ": { fontSize: "1.25em", fontWeight: "semi-bold" },
|
|
515
630
|
"& .h6 ": { fontSize: "1.25em", fontWeight: "normal" },
|
|
516
|
-
"& .hg ": { lineHeight: "
|
|
517
|
-
|
|
518
|
-
"& .
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
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">
|
|
525
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"/>
|
|
526
|
-
</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">
|
|
527
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"/>
|
|
528
|
-
</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">
|
|
529
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"/>
|
|
530
|
-
</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">
|
|
531
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"/>
|
|
532
|
-
</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">
|
|
533
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"/>
|
|
534
|
-
</svg>`, Q = { tip:
|
|
535
|
-
class
|
|
656
|
+
</svg>`, Q = { tip: ze, note: Re, important: Qe, warning: Ze, caution: De, none: () => "" };
|
|
657
|
+
class Ne extends $ {
|
|
536
658
|
constructor(t) {
|
|
537
659
|
super(), this.type = t;
|
|
538
660
|
}
|
|
@@ -547,7 +669,7 @@ class He extends $ {
|
|
|
547
669
|
return this.type === t.type;
|
|
548
670
|
}
|
|
549
671
|
}
|
|
550
|
-
function
|
|
672
|
+
function Pe(e, t) {
|
|
551
673
|
const r = ["Document", "ListItem", "BulletList", "OrderedList"], i = {
|
|
552
674
|
none: "bq-none-mark",
|
|
553
675
|
note: "bq-note-mark",
|
|
@@ -563,7 +685,7 @@ function $e(e, t) {
|
|
|
563
685
|
}).range(s, o);
|
|
564
686
|
},
|
|
565
687
|
QuoteType: (s, o, d) => l.widget({
|
|
566
|
-
widget: new
|
|
688
|
+
widget: new Ne(d),
|
|
567
689
|
side: 1
|
|
568
690
|
}).range(s),
|
|
569
691
|
BlockquoteLine: (s, o) => l.line({ class: "bq-line " + (o ? "sw" : "") }).range(s),
|
|
@@ -578,18 +700,18 @@ function $e(e, t) {
|
|
|
578
700
|
const g = [], m = d.number, w = (p, T) => {
|
|
579
701
|
let b = 0;
|
|
580
702
|
const f = [];
|
|
581
|
-
let
|
|
703
|
+
let C = 0;
|
|
582
704
|
return {
|
|
583
|
-
enter({ name: L, node: q, from:
|
|
584
|
-
L === "Blockquote" && f.push(
|
|
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]));
|
|
585
707
|
},
|
|
586
|
-
leave({ name: L, from: q, to:
|
|
587
|
-
L === "Paragraph" &&
|
|
708
|
+
leave({ name: L, from: q, to: k }) {
|
|
709
|
+
L === "Paragraph" && C < T && g.push(a.quoteLine(C, T, C - p));
|
|
588
710
|
}
|
|
589
711
|
};
|
|
590
712
|
};
|
|
591
713
|
for (let p = m; p < u + m; p++) {
|
|
592
|
-
const { from: T, to: b } = s.state.doc.line(p), { from: f, to:
|
|
714
|
+
const { from: T, to: b } = s.state.doc.line(p), { from: f, to: C } = o, L = M(s, f, C);
|
|
593
715
|
g.push(a.BlockquoteLine(T, L)), I(s.state).iterate({ from: T, to: b, ...w(T, b) });
|
|
594
716
|
}
|
|
595
717
|
return g;
|
|
@@ -605,12 +727,12 @@ function $e(e, t) {
|
|
|
605
727
|
}
|
|
606
728
|
}), l.set(n, !0);
|
|
607
729
|
}
|
|
608
|
-
const
|
|
730
|
+
const _e = (e, t) => {
|
|
609
731
|
const r = t.getChild("QuoteType");
|
|
610
732
|
if (!r) return "none";
|
|
611
733
|
const i = r.getChild("QuoteTypeText");
|
|
612
734
|
return i ? e.state.sliceDoc(i.from, i.to).toLowerCase() : "none";
|
|
613
|
-
},
|
|
735
|
+
}, Oe = () => x.baseTheme({
|
|
614
736
|
"& .qt-mk": {
|
|
615
737
|
// outline: "1px red solid",
|
|
616
738
|
position: "relative",
|
|
@@ -659,10 +781,10 @@ const Se = (e, t) => {
|
|
|
659
781
|
"& .wg-qt-icon > .qt-important": { fill: "var(--bq-important-mark, rebeccapurple)" },
|
|
660
782
|
"& .wg-qt-icon > .qt-warning": { fill: "var(--bq-warning-mark, peru)" },
|
|
661
783
|
"& .wg-qt-icon > .qt-caution": { fill: "var(--bq-caution-mark, red)" }
|
|
662
|
-
}),
|
|
663
|
-
y(
|
|
664
|
-
|
|
665
|
-
],
|
|
784
|
+
}), Ve = () => [
|
|
785
|
+
y(Pe, {}),
|
|
786
|
+
Oe()
|
|
787
|
+
], We = {
|
|
666
788
|
name: "QuoteTypeParser",
|
|
667
789
|
parse(e, t) {
|
|
668
790
|
if ((() => {
|
|
@@ -682,128 +804,15 @@ const Se = (e, t) => {
|
|
|
682
804
|
}
|
|
683
805
|
return !1;
|
|
684
806
|
}
|
|
685
|
-
},
|
|
807
|
+
}, Fe = {
|
|
686
808
|
defineNodes: [
|
|
687
809
|
{ name: "QuoteType", style: { "QuoteType/...": A.content } },
|
|
688
810
|
{ name: "QuoteTypeMark", style: A.processingInstruction },
|
|
689
811
|
{ name: "QuoteTypeText", style: A.bool }
|
|
690
812
|
],
|
|
691
|
-
parseBlock: [
|
|
692
|
-
}, N = (e, t, r) => {
|
|
693
|
-
const i = e.state.sliceDoc(t, r), a = i.match(/\[(.*)\]/);
|
|
694
|
-
return a !== null && a.length > 1 ? {
|
|
695
|
-
text: a[1],
|
|
696
|
-
from: t + i.indexOf(a[1]),
|
|
697
|
-
to: t + 1 + a[1].length
|
|
698
|
-
} : { text: null };
|
|
813
|
+
parseBlock: [We]
|
|
699
814
|
};
|
|
700
|
-
|
|
701
|
-
const r = ["FencedCode", "Image", "Link"], i = {
|
|
702
|
-
Link: {
|
|
703
|
-
marks: ["LinkMark"],
|
|
704
|
-
url: "URL"
|
|
705
|
-
}
|
|
706
|
-
}, a = {
|
|
707
|
-
Link: (n, s, o) => l.mark({ class: "link " + (o ? "sw" : "") }).range(n, s),
|
|
708
|
-
LinkMark: (n, s) => l.mark({ class: "lk-mk" }).range(n, s),
|
|
709
|
-
TextDec: (n, s, o) => l.mark({
|
|
710
|
-
class: "lk-text url",
|
|
711
|
-
tagName: "a",
|
|
712
|
-
attributes: { href: o, target: "_blank" }
|
|
713
|
-
}).range(n, s),
|
|
714
|
-
URL: (n, s, o) => l.mark({
|
|
715
|
-
class: "lk-url url",
|
|
716
|
-
tagName: "a",
|
|
717
|
-
attributes: { href: o, target: "_blank" }
|
|
718
|
-
}).range(n, s)
|
|
719
|
-
}, c = [];
|
|
720
|
-
return v(e, {
|
|
721
|
-
enter: ({ type: { name: n }, from: s, to: o, node: d }) => {
|
|
722
|
-
if (n === "URL" && c.push(a.URL(s, o, e.state.sliceDoc(s, o))), !(n in i)) return !r.includes(n);
|
|
723
|
-
c.push(a.Link(s, o, x(e, s, o)));
|
|
724
|
-
const u = i[n].marks.flatMap((w) => d.getChildren(w));
|
|
725
|
-
c.push(...u.map(({ from: w, to: p }) => a.LinkMark(w, p)));
|
|
726
|
-
const g = d.getChild(i[n].url);
|
|
727
|
-
let m = null;
|
|
728
|
-
if (g !== null) {
|
|
729
|
-
const { from: w, to: p } = g;
|
|
730
|
-
m = e.state.sliceDoc(w, p), c.push(a.URL(w, p, m));
|
|
731
|
-
}
|
|
732
|
-
if (d.getChild("Image") === null) {
|
|
733
|
-
const { text: w, from: p, to: T } = N(e, s, o);
|
|
734
|
-
w !== null && m !== null && c.push(a.TextDec(p, T, m));
|
|
735
|
-
}
|
|
736
|
-
return !1;
|
|
737
|
-
}
|
|
738
|
-
}), l.set(c, !0);
|
|
739
|
-
}
|
|
740
|
-
const Ze = (e, t) => e.ctrlKey ? Qe(
|
|
741
|
-
e.target
|
|
742
|
-
/* as HTMLElement */
|
|
743
|
-
) : !1, Qe = (e) => {
|
|
744
|
-
if (e.nodeName === "A" && e.href && e.classList.contains("url"))
|
|
745
|
-
return window.open(e.href, e.target), !0;
|
|
746
|
-
}, ze = M.baseTheme({
|
|
747
|
-
".lk-mk, .link > .lk-url": { display: "none" },
|
|
748
|
-
"&.cm-focused .link.sw .lk-mk, &.cm-focused .link.sw .lk-url": { display: "inherit" }
|
|
749
|
-
}), Re = () => [
|
|
750
|
-
y(De, {}, { eventHandlers: { mousedown: Ze } }),
|
|
751
|
-
ze
|
|
752
|
-
];
|
|
753
|
-
class Ne extends $ {
|
|
754
|
-
constructor(t, r = null, i = "[image]") {
|
|
755
|
-
super(), this.img = t, this.url = r, this.alt = i;
|
|
756
|
-
}
|
|
757
|
-
toDOM() {
|
|
758
|
-
let t = document.createElement("img");
|
|
759
|
-
if (t.src = this.img, t.alt = this.alt, t.style.minWidth = "100px", this.url) {
|
|
760
|
-
let r = document.createElement("a");
|
|
761
|
-
return r.href = this.url, r.target = "_blank", r.classList.add("url"), r.appendChild(t), r;
|
|
762
|
-
} else
|
|
763
|
-
return t;
|
|
764
|
-
}
|
|
765
|
-
eq(t) {
|
|
766
|
-
return this.img === t.img;
|
|
767
|
-
}
|
|
768
|
-
ignoreEvent() {
|
|
769
|
-
return !1;
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
function Pe(e, t) {
|
|
773
|
-
const r = ["FencedCode", "Image"], i = [];
|
|
774
|
-
return v(e, {
|
|
775
|
-
enter: ({ type: { name: a }, from: c, to: n, node: s }) => {
|
|
776
|
-
if (a === "Image" && !x(e, c, n)) {
|
|
777
|
-
const { from: o, to: d } = s.getChild("URL"), u = e.state.sliceDoc(o, d), { text: g } = N(e, c, n);
|
|
778
|
-
i.push(
|
|
779
|
-
l.replace({
|
|
780
|
-
widget: new Ne(u, _e(e, s), g)
|
|
781
|
-
}).range(c, n)
|
|
782
|
-
);
|
|
783
|
-
}
|
|
784
|
-
return !r.includes(a);
|
|
785
|
-
}
|
|
786
|
-
}), l.set(i, !1);
|
|
787
|
-
}
|
|
788
|
-
const _e = (e, t) => {
|
|
789
|
-
const i = t.parent.getChild("URL");
|
|
790
|
-
if (i !== null) {
|
|
791
|
-
const { from: a, to: c } = i;
|
|
792
|
-
return e.state.sliceDoc(a, c);
|
|
793
|
-
}
|
|
794
|
-
return null;
|
|
795
|
-
}, Oe = (e, t) => e.ctrlKey ? Ve(
|
|
796
|
-
e.target
|
|
797
|
-
/* as HTMLElement */
|
|
798
|
-
) : !1, Ve = (e) => {
|
|
799
|
-
const t = e.parentElement ?? !1;
|
|
800
|
-
if (e.nodeName === "IMG" && t && t.nodeName === "A" && t.classList.contains("url"))
|
|
801
|
-
return !0;
|
|
802
|
-
}, We = M.baseTheme({}), Fe = () => [
|
|
803
|
-
y(Pe, {}, { eventHandlers: { mousedown: Oe } }),
|
|
804
|
-
We
|
|
805
|
-
];
|
|
806
|
-
class z extends $ {
|
|
815
|
+
class R extends $ {
|
|
807
816
|
constructor(t, r = !1) {
|
|
808
817
|
super(), this.content = t, this.tag = r;
|
|
809
818
|
}
|
|
@@ -833,7 +842,7 @@ const P = G.define(), Ue = K.define({
|
|
|
833
842
|
return r.value;
|
|
834
843
|
return e;
|
|
835
844
|
},
|
|
836
|
-
provide: (e) =>
|
|
845
|
+
provide: (e) => z.decorations.from(e)
|
|
837
846
|
});
|
|
838
847
|
function Xe(e) {
|
|
839
848
|
const t = [
|
|
@@ -843,7 +852,7 @@ function Xe(e) {
|
|
|
843
852
|
HTMLBlock: (a, c) => {
|
|
844
853
|
const n = e.state.doc.sliceString(a, c);
|
|
845
854
|
return [l.replace({
|
|
846
|
-
widget: new
|
|
855
|
+
widget: new R(n),
|
|
847
856
|
inclusive: !1
|
|
848
857
|
}).range(a, c)];
|
|
849
858
|
},
|
|
@@ -851,7 +860,7 @@ function Xe(e) {
|
|
|
851
860
|
const n = e.state.doc.sliceString(a, c);
|
|
852
861
|
return console.log(n), t.some((s) => s.test(n)) ? (console.log(n), [
|
|
853
862
|
l.replace({
|
|
854
|
-
widget: new
|
|
863
|
+
widget: new R(n, !0),
|
|
855
864
|
inclusive: !1
|
|
856
865
|
}).range(a, c)
|
|
857
866
|
]) : [];
|
|
@@ -859,11 +868,11 @@ function Xe(e) {
|
|
|
859
868
|
}, i = [];
|
|
860
869
|
return v(e, {
|
|
861
870
|
enter: ({ type: a, from: c, to: n, node: s }) => {
|
|
862
|
-
a.name in r && (!
|
|
871
|
+
a.name in r && (!M(e, c, n) || !e.hasFocus) && i.push(...r[a.name](c, n));
|
|
863
872
|
}
|
|
864
873
|
}), l.set(i);
|
|
865
874
|
}
|
|
866
|
-
const je =
|
|
875
|
+
const je = x.baseTheme({
|
|
867
876
|
"& .cm-html-widget": {
|
|
868
877
|
all: "unset"
|
|
869
878
|
// outline: "red solid 2px",
|
|
@@ -875,7 +884,7 @@ const je = M.baseTheme({
|
|
|
875
884
|
marginTop: "0"
|
|
876
885
|
},
|
|
877
886
|
"& .cm-widgetBuffer": { display: "none" }
|
|
878
|
-
}), Ge =
|
|
887
|
+
}), Ge = z.updateListener.of((e) => {
|
|
879
888
|
if (e.selectionSet || e.docChanged || e.focusChanged || e.geometryChanged) {
|
|
880
889
|
const t = Xe(e.view);
|
|
881
890
|
e.view.dispatch({ effects: P.of(t) });
|
|
@@ -903,32 +912,32 @@ const je = M.baseTheme({
|
|
|
903
912
|
base: a,
|
|
904
913
|
completeHTMLTags: c,
|
|
905
914
|
htmlTagLanguage: n,
|
|
906
|
-
extensions: [...s, F, J,
|
|
915
|
+
extensions: [...s, F, J, Fe]
|
|
907
916
|
};
|
|
908
917
|
return [
|
|
909
918
|
W(o),
|
|
910
919
|
ne(),
|
|
911
920
|
ie(),
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
921
|
+
ue(),
|
|
922
|
+
Ce(),
|
|
923
|
+
xe(),
|
|
924
|
+
Se(),
|
|
925
|
+
Ie(),
|
|
926
|
+
Ve(),
|
|
918
927
|
Ke()
|
|
919
928
|
// (theme) ? themeVariant.of(catppuccin(theme)) : [],
|
|
920
929
|
];
|
|
921
930
|
};
|
|
922
931
|
export {
|
|
923
|
-
|
|
924
|
-
|
|
932
|
+
Se as CodePlugin,
|
|
933
|
+
Ie as HeadingPlugin,
|
|
925
934
|
ne as HrPlugin,
|
|
926
935
|
Ke as HtmlPlugin,
|
|
927
|
-
|
|
936
|
+
Ce as ImagePlugin,
|
|
928
937
|
ie as InlinePlugin,
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
938
|
+
ue as LinkPlugin,
|
|
939
|
+
xe as ListPlugin,
|
|
940
|
+
Ve as QuotePlugin,
|
|
941
|
+
Fe as QuoteType,
|
|
933
942
|
ct as gnosis
|
|
934
943
|
};
|
package/dist/gnosis.umd.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(function(h,q){typeof exports=="object"&&typeof module<"u"?q(exports,require("@codemirror/language-data"),require("@codemirror/lang-markdown"),require("@lezer/markdown"),require("@lezer/highlight"),require("@codemirror/view"),require("@codemirror/language"),require("codemirror"),require("@codemirror/state")):typeof define=="function"&&define.amd?define(["exports","@codemirror/language-data","@codemirror/lang-markdown","@lezer/markdown","@lezer/highlight","@codemirror/view","@codemirror/language","codemirror","@codemirror/state"],q):(h=typeof globalThis<"u"?globalThis:h||self,q(h.gnosis={},h.languageData,h.langMarkdown,h.markdown,h.highlight,h.view,h.language,h.CodeMirror,h.state))})(this,function(h,q,B,ee,I,l,
|
|
1
|
+
(function(h,q){typeof exports=="object"&&typeof module<"u"?q(exports,require("@codemirror/language-data"),require("@codemirror/lang-markdown"),require("@lezer/markdown"),require("@lezer/highlight"),require("@codemirror/view"),require("@codemirror/language"),require("codemirror"),require("@codemirror/state")):typeof define=="function"&&define.amd?define(["exports","@codemirror/language-data","@codemirror/lang-markdown","@lezer/markdown","@lezer/highlight","@codemirror/view","@codemirror/language","codemirror","@codemirror/state"],q):(h=typeof globalThis<"u"?globalThis:h||self,q(h.gnosis={},h.languageData,h.langMarkdown,h.markdown,h.highlight,h.view,h.language,h.CodeMirror,h.state))})(this,function(h,q,B,ee,I,l,z,D,Z){"use strict";var Re=Object.defineProperty;var We=(h,q,B)=>q in h?Re(h,q,{enumerable:!0,configurable:!0,writable:!0,value:B}):h[q]=B;var P=(h,q,B)=>We(h,typeof q!="symbol"?q+"":q,B);const m=I.Tag.define("none"),te={props:[I.styleTags({"Blockquote/...":m,HorizontalRule:m,"ATXHeading1/... SetextHeading1/...":m,"ATXHeading2/... SetextHeading2/...":m,"ATXHeading3/...":m,"ATXHeading4/...":m,"ATXHeading5/...":m,"ATXHeading6/...":m,"Comment CommentBlock":m,Escape:m,Entity:m,"Emphasis/...":m,"StrongEmphasis/...":m,"Strikethrough/...":m,"TableHeader/...":m,"Link/... Image/...":m,"OrderedList/... BulletList/...":m,"BlockQuote/...":m,"InlineCode CodeText":m,"URL Autolink":m,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark StrikethroughMark":m,"CodeInfo LinkLabel TaskMarker TableDelimiter":m,LinkTitle:m,Paragraph:m,"QuoteType/.. QuoteTypeMark QuoteTypeText":m})]},x=(e,n,r={})=>{const i=class{constructor(c){P(this,"decorations");P(this,"conf");this.conf=n,this.decorations=e(c,this.conf)}update(c){(c.docChanged||c.viewportChanged||c.selectionSet)&&(this.decorations=e(c.view,this.conf))}};return l.ViewPlugin.fromClass(i,{decorations:a=>a.decorations,...r})},H=(e,n,r)=>{const i=e.state.selection.ranges;for(let a of i)if(a.from>=n&&a.from<=r||a.to>=n&&a.to<=r||a.from<=n&&a.to>=r)return!0;return!1},E=(e,n)=>{for(const{from:r,to:i}of e.visibleRanges)z.syntaxTree(e.state).iterate({...n,from:r,to:i})};function ne(e,n){const r=["Document"],i={},a={HorizontalRule:(t,o,s=!0)=>[l.Decoration.line({class:"hr "+(s?"sw":"")}).range(t),l.Decoration.mark({class:"mk"}).range(t,o)]},c=[];return E(e,{enter:({type:t,from:o,to:s})=>(t.name in a&&c.push(...a[t.name](o,s,H(e,o,s))),r.includes(t.name)||t.name in i)}),l.Decoration.set(c,!1)}const re=()=>D.EditorView.baseTheme({"& .hr":{position:"relative"},"& .hr > .mk":{fontSize:"0"},"& .hr.sw > .mk":{fontSize:"inherit"},"&light .hr::before ":{backgroundColor:"var(--cm-hr, black)"},"&dark .hr::before ":{backgroundColor:"var(--cm-hr, white)"},"&.cm-focused .hr.sw::before":{width:"0",height:"0"},"& .hr::before":{content:'""',position:"absolute",width:"calc(100% - 12px)",height:".2ch"}}),V=()=>[x(ne,{}),re()];function oe(e,n){const r=["FencedCode"],i={StrongEmphasis:(t=!0,o,s)=>l.Decoration.mark({class:"il st "+(t?"sw":"")}).range(o,s),Strikethrough:(t=!0,o,s)=>l.Decoration.mark({class:"il sk "+(t?"sw":"")}).range(o,s),InlineCode:(t=!0,o,s)=>l.Decoration.mark({class:"il ic "+(t?"sw":"")}).range(o,s),Emphasis:(t=!0,o,s)=>l.Decoration.mark({class:"il it "+(t?"sw":"")}).range(o,s),Mark:(t,o)=>l.Decoration.mark({class:"mkl"}).range(t,o)},a=["EmphasisMark","CodeMark","StrikethroughMark"],c=[];return E(e,{enter:({type:{name:t},from:o,to:s})=>a.includes(t)?(c.push(i.Mark(o,s)),!1):(t in i&&c.push(i[t](H(e,o,s),o,s)),!r.includes(t))}),l.Decoration.set(c,!1)}const se=D.EditorView.baseTheme({"& .it ":{fontStyle:"italic"},"& .st ":{fontWeight:"bold"},"& .sk ":{textDecoration:"line-through"},"& .ic ":{fontFamily:"monospace",paddingInline:".6ch",borderRadius:".6ch",backgroundColor:"var(--cm-ic-background, hsl(from black h s l / .2))"}}),ie=D.EditorView.baseTheme({".il .mkl":{fontSize:"0"},"&.cm-focused .il.sw > .mkl":{fontSize:"inherit"}}),$=()=>[x(oe,{}),se,ie],R=(e,n,r)=>{const i=e.state.sliceDoc(n,r),a=i.match(/\[(.*)\]/);return a!==null&&a.length>1?{text:a[1],from:n+i.indexOf(a[1]),to:n+1+a[1].length}:{text:null}};function ae(e,n){const r=["FencedCode","Image","Link"],i={Link:{marks:["LinkMark"],url:"URL"}},a={Link:(t,o,s)=>l.Decoration.mark({class:"link "+(s?"sw":"")}).range(t,o),LinkMark:(t,o)=>l.Decoration.mark({class:"lk-mk"}).range(t,o),TextDec:(t,o,s)=>l.Decoration.mark({class:"lk-text url",tagName:"a",attributes:{href:s,target:"_blank"}}).range(t,o),URL:(t,o,s)=>l.Decoration.mark({class:"lk-url url",tagName:"a",attributes:{href:s,target:"_blank"}}).range(t,o)},c=[];return E(e,{enter:({type:{name:t},from:o,to:s,node:d})=>{if(t==="URL"&&c.push(a.URL(o,s,e.state.sliceDoc(o,s))),!(t in i))return!r.includes(t);c.push(a.Link(o,s,H(e,o,s)));const u=i[t].marks.flatMap(w=>d.getChildren(w));c.push(...u.map(({from:w,to:f})=>a.LinkMark(w,f)));const g=d.getChild(i[t].url);let p=null;if(g!==null){const{from:w,to:f}=g;p=e.state.sliceDoc(w,f),c.push(a.URL(w,f,p))}if(d.getChild("Image")===null){const{text:w,from:f,to:y}=R(e,o,s);w!==null&&p!==null&&c.push(a.TextDec(f,y,p))}return!1}}),l.Decoration.set(c,!0)}const ce=(e,n)=>e.ctrlKey?le(e.target):!1,le=e=>{if(e.nodeName==="A"&&e.href&&e.classList.contains("url"))return window.open(e.href,e.target),!0},de=D.EditorView.baseTheme({".lk-mk, .link > .lk-url":{display:"none"},"&.cm-focused .link.sw .lk-mk, &.cm-focused .link.sw .lk-url":{display:"inherit"}}),W=()=>[x(ae,{},{eventHandlers:{mousedown:ce}}),de];class ue extends l.WidgetType{constructor(n,r=null,i="[image]"){super(),this.img=n,this.url=r,this.alt=i}toDOM(){let n=document.createElement("img");if(n.src=this.img,n.alt=this.alt,n.style.minWidth="100px",this.url){let r=document.createElement("a");return r.href=this.url,r.target="_blank",r.classList.add("url"),r.appendChild(n),r}else return n}eq(n){return this.img===n.img}ignoreEvent(){return!1}}function ge(e,n){const r=["FencedCode","Image"],i=[];return E(e,{enter:({type:{name:a},from:c,to:t,node:o})=>{if(a==="Image"&&!H(e,c,t)){const{from:s,to:d}=o.getChild("URL"),u=e.state.sliceDoc(s,d),{text:g}=R(e,c,t);i.push(l.Decoration.replace({widget:new ue(u,he(e,o),g)}).range(c,t))}return!r.includes(a)}}),l.Decoration.set(i,!1)}const he=(e,n)=>{const i=n.parent.getChild("URL");if(i!==null){const{from:a,to:c}=i;return e.state.sliceDoc(a,c)}return null},me=(e,n)=>e.ctrlKey?pe(e.target):!1,pe=e=>{const n=e.parentElement??!1;if(e.nodeName==="IMG"&&n&&n.nodeName==="A"&&n.classList.contains("url"))return!0},fe=D.EditorView.baseTheme({}),N=()=>[x(ge,{},{eventHandlers:{mousedown:me}}),fe];class ke extends l.WidgetType{constructor(r){super();P(this,"checked",!1);this.checked=r}toDOM(){let r=document.createElement("span");r.setAttribute("aria-hidden","true"),r.className="TaskMark";let i=r.appendChild(document.createElement("input"));return i.type="checkbox",i.checked=this.checked,r}ignoreEvent(){return!1}}function Ce(e,n){const r=["Document","ListItem","Task","Blockquote"],i={BulletList:{class:"bl",offset:2},OrderedList:{class:"ol",offset:3}},a={ListMark:(s,d,u,g=!0)=>l.Decoration.mark({class:`${u.class} lm ${g?"sw":""}`}).range(s,d),TaskMarker:(s,d,u,g=!0)=>{const p=e.state.doc.sliceString(s+1,d-1)==="x";return g?l.Decoration.mark({class:`tm ${p?"ck":""}`}).range(s,d):l.Decoration.replace({widget:new ke(p)}).range(s,d)}},c={ListItem:(s,d,u,g,p)=>{const w=u.offset+(g?4:0),f=s+w,y=`calc(100% - ${Math.max(0,w+p)+4}ch)`;return f>=d?[]:[l.Decoration.mark({class:"ls-text-line",attributes:{style:`width: ${y}`}}).range(f,d)]}},t=[],o=[];return E(e,{enter:({name:s,from:d,to:u,node:g})=>{if(s in i)return o.push({name:s,from:d,to:u}),!0;if(s in a&&t.push(a[s](d,u,i[o.slice(-1)[0].name],H(e,d,u))),s in c){const p=e.state.doc.lineAt(d);t.push(...c[s](d,p.to,i[o.slice(-1)[0].name],g.getChild("Task")!==null,d-p.from))}return r.includes(s)},leave:({name:s,from:d,to:u})=>{const g=o.slice(-1)[0];g&&g.name===s&&g.from===d&&g.to===u&&o.pop()}}),l.Decoration.set(t,!0)}const be=(e,n)=>{var i;let r=e.target;if(r.nodeName==="INPUT"&&((i=r.parentElement)!=null&&i.classList.contains("TaskMark")))return Le(n,n.posAtDOM(r))},Le=(e,n)=>{const r=n-2,i=n-1;let a=e.state.doc.sliceString(Math.max(0,r),i),c;if(a==="x")c={from:r,to:i,insert:" "};else if(a===" ")c={from:r,to:i,insert:"x"};else return!1;return e.dispatch({changes:c}),!0},we=()=>D.EditorView.baseTheme({"& .lm.bl":{position:"relative",color:"transparent"},"& .lm.bl::before":{content:'""',display:"inline",position:"absolute",borderRadius:"50%",top:"50%",left:"50%",transform:"translate(-50%, -50%)",height:".4em",width:".4em"},"&light .lm.bl::before":{backgroundColor:"var(--cm-list-bullet, light-dark(black, white))"},"&dark .lm.bl::before":{backgroundColor:"var(--cm-list-bullet, light-dark(black, white))"},"&.cm-focused .lm.bl.sw, &.cm-focused .lm.bl.sw::before":{backgroundColor:"transparent",color:"inherit"},"& .ls-text-line":{display:"inline-block",ariaHidden:"true"},"& .cm-line .lm, & .cm-line .TaskMark, & .cm-line .tm, & .cm-line .ls-text-line":{verticalAlign:"top"},"& .cb-content .ls-text-line, & .cb-spacer .ls-text-line":{width:"unset !important"}}),O=()=>[x(Ce,{},{eventHandlers:{mousedown:be}}),we()],Te=(e,n)=>{var i;let r=e.target;if(r.nodeName==="BUTTON"&&((i=r.parentElement)!=null&&i.classList.contains("wg-codeblock"))){const a=["FencedCode","CodeBlock"];let c="";const t={enter:({type:{name:o},from:s,to:d,node:u})=>(a.includes(o)&&(c=qe(n,u.toTree(),s,d)),!a.includes(o))};return z.syntaxTree(n.state).iterate({...t,from:n.posAtDOM(r),to:n.posAtDOM(r)+2}),navigator.clipboard.writeText(c),!0}},qe=(e,n,r,i)=>{const a=["CodeMark","CodeInfo"];let c=e.state.doc.sliceString(r,i),t=new Set;n.iterate({enter({type:{name:u},from:g,node:p}){a.includes(u)&&t.add(e.state.doc.lineAt(g+r).number)}});const o=e.state.doc.lineAt(r),s=r-o.from,d=[];return c.split(`
|
|
2
2
|
`).forEach((u,g)=>{t.has(g+o.number)||d.push(u.slice(s))}),d.join(`
|
|
3
|
-
`)};class A extends l.WidgetType{constructor(r,i,a,c=1){super();
|
|
3
|
+
`)};class A extends l.WidgetType{constructor(r,i,a,c=1){super();P(this,"classes","");this.classes=r,this.width=i,this.marginLeft=a,this.spaces=c}toDOM(){let r=document.createElement("span");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}ignoreEvent(){return!1}}const ye=e=>`<svg class="cb-icon" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
4
|
<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"/>
|
|
5
5
|
<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"/>
|
|
6
|
-
</svg>`;class
|
|
7
|
-
`).length;for(let L=f;L<y+f;L++){const{from:k,to:b}=e.state.doc.line(L),T=`100% - ${a+c}px`,M=["cb-content"];w&&M.push("sw"),L===f&&M.push("cb-start"),L===y+f-1&&M.push("cb-end");const C=Math.max(k+g,0);if(b<C)t.push(l.Decoration.widget({widget:new A(["left","cb-error"].join(" "),"0.1px"),side:0}).range(b),l.Decoration.widget({widget:new A(["cb-error","right"].join(" "),"","",C-b),side:1}).range(b));else if(k===b&&k===C)t.push(l.Decoration.widget({widget:new A([...M,"left"].join(" "),"0"),side:0}).range(b),l.Decoration.widget({widget:new A(M.join(" "),`calc(${T} - ${c}px)`,"0"),side:1}).range(C));else if(C===b)M.push("wg"),t.push(l.Decoration.widget({widget:new A(M.join(" "),`calc(${T} - ${C-k}ch)`),side:1}).range(C));else if(s||d||p){const
|
|
6
|
+
</svg>`;class Me extends l.WidgetType{constructor(n,r){super(),this.type=n,this.code=r}toDOM(){let n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.className="wg-codeblock";let r=document.createElement("button");return r.className="wg-codeblock-btn",r.innerHTML=ye(),n.appendChild(r),n}ignoreEvent(){return!1}}const Q=[];function _(e,n){const{mode:r,options:i}=n,a=["Document","Blockquote","ListItem","BulletList","OrderedList"],c={FencedCode:j,CodeBlock:j},t={CodeMark:(s,d,u)=>[l.Decoration.mark({class:"cb-mk"}).range(d,u)],CodeInfo:(s,d,u)=>[l.Decoration.mark({class:"cb-mi"}).range(d,u)]},o=[];return E(e,{enter:({type:{name:s},from:d,to:u})=>(r==="type"&&s in c&&o.push(...c[s](e,d,u,i)),r==="mark"&&s in t&&o.push(...t[s](e,d,u)),a.includes(s)||s in c?(Q.push({name:s,from:d,to:u}),!0):!1),Leave:({type:{name:s},from:d,to:u})=>a.includes(s)||s in c?(Q.pop(),!0):!1}),{type:l.Decoration.set(o,!0),mark:l.Decoration.set(o,!0)}[r]}const j=(e,n,r,i)=>{const a=i.marginLeft,c=i.paddingLeft,t=[],o=Q[Q.length-1],s=["BulletList","OrderedList","ListItem"].some(L=>L===o.name),d=["Blockquote"].some(L=>L===o.name),u=e.state.doc.lineAt(n),g=n-u.from,p=g>0,w=H(e,u.from,r);t.push(l.Decoration.widget({widget:new Me("view.state.sliceDoc(from, to)","code"),side:0}).range(n+1));const f=u.number,y=e.state.doc.sliceString(n,r).split(`
|
|
7
|
+
`).length;for(let L=f;L<y+f;L++){const{from:k,to:b}=e.state.doc.line(L),T=`100% - ${a+c}px`,M=["cb-content"];w&&M.push("sw"),L===f&&M.push("cb-start"),L===y+f-1&&M.push("cb-end");const C=Math.max(k+g,0);if(b<C)t.push(l.Decoration.widget({widget:new A(["left","cb-error"].join(" "),"0.1px"),side:0}).range(b),l.Decoration.widget({widget:new A(["cb-error","right"].join(" "),"","",C-b),side:1}).range(b));else if(k===b&&k===C)t.push(l.Decoration.widget({widget:new A([...M,"left"].join(" "),"0"),side:0}).range(b),l.Decoration.widget({widget:new A(M.join(" "),`calc(${T} - ${c}px)`,"0"),side:1}).range(C));else if(C===b)M.push("wg"),t.push(l.Decoration.widget({widget:new A(M.join(" "),`calc(${T} - ${C-k}ch)`),side:1}).range(C));else if(s||d||p){const S={style:`width: calc(${T} - ${C-k}ch)`};b>C&&t.push(l.Decoration.mark({class:M.join(" "),attributes:S}).range(C,b)),k!==C&&s&&t.push(l.Decoration.mark({class:"cb-listsp"}).range(k,C)),k!==C&&p&&t.push(l.Decoration.mark({class:"cb-spacer"}).range(k,C)),k!==C&&d&&t.push(l.Decoration.mark({class:"cb-quote bq"}).range(k,C))}else if(k!==b){const S={style:`width: calc(${T})`};t.push(l.Decoration.mark({class:M.join(" "),attributes:S}).range(k,b))}t.push(l.Decoration.line({class:"cb-line"}).range(k))}return t},De=e=>{const n=e.marginLeft,r=e.paddingLeft,i=0,a="4px",c="1lh";return D.EditorView.baseTheme({"& .cb-start":{borderRadius:`${a} ${a} 0 0`},"& .cb-end ":{borderRadius:`0 0 ${a} ${a}`},"& .cb-start.cb-end":{borderRadius:`${a}`},"& .cm-line .cb-content":{display:"inline-block",marginLeft:`${n}px`,paddingLeft:`${r}px`,paddingRigth:`${i}px`,position:"relative"},"& .cb-content.wg":{cursor:"text"},"& .cb-content.wg.start":{maxWidth:"1px",Width:"1px",paddingLeft:`${r-1}px`},"& .cb-content.wg.end":{marginLeft:"0",paddingLeft:"0"},"& .cb-mi,& .cb-mk":{color:"transparent"},"&.cm-focused .cb-content.sw > .cb-mi, &.cm-focused .cb-content.sw > .cb-mk":{color:"inherit"},"&.cm-focused .cb-content.sw .wg-codeblock":{display:"none",opacity:"0"},"& .wg-codeblock":{display:"inline-block",position:"absolute",top:"0",right:"0",zIndex:"100",margin:".05lh"},"& .wg-codeblock-btn":{padding:"0",display:"inline-flex",borderRadius:"999999px",background:"transparent",border:"none",outline:"none",justifyContent:"center",alignItems:"center",height:`calc(${c} + 4px )`,width:"5ch"},"& .cb-icon":{width:c,height:c,pointerEvents:"none",fill:"currentColor",opacity:"0.7"},"& .wg-codeblock-btn:hover":{background:"rgba(0, 0, 0, 0.07)"},"& .wg-codeblock-btn:hover .cb-icon":{opacity:"1"},"& .cb-content.cb-start.cb-end .wg-codeblock":{marginTop:"0",marginBottom:"0",top:"0",bottom:"0"},"& .cb-content.cb-start.cb-end .wg-codeblock-btn":{boxSizing:"border-box",maxHeight:"100%",width:"5ch"},"& .cb-content":{backgroundColor:"var(--cm-ic-background, hsl(from black h s l / .1))",cursor:"text"},"& .cb-error.left":{padding:"0"},"& .cb-error.right":{paddingRight:`${n}px`},"& .cb-error":{display:"inline-block",backgroundColor:"var(--cm-ic-error, hsl(from red h s l / .5))",cursor:"text"}})},F=()=>{const e={marginLeft:2,paddingLeft:6};return[x(_,{mode:"mark"}),x(_,{mode:"type",options:e},{eventHandlers:{mousedown:Te}}),De(e)]};function xe(e,n){const r=["Document"],i={ATXHeading1:(t,o=!0)=>l.Decoration.line({class:"h1 hg "+(o?"sw":"")}).range(t),ATXHeading2:(t,o=!0)=>l.Decoration.line({class:"h2 hg "+(o?"sw":"")}).range(t),ATXHeading3:(t,o=!0)=>l.Decoration.line({class:"h3 hg "+(o?"sw":"")}).range(t),ATXHeading4:(t,o=!0)=>l.Decoration.line({class:"h4 hg "+(o?"sw":"")}).range(t),ATXHeading5:(t,o=!0)=>l.Decoration.line({class:"h5 hg "+(o?"sw":"")}).range(t),ATXHeading6:(t,o=!0)=>l.Decoration.line({class:"h6 hg "+(o?"sw":"")}).range(t)},a={HeaderMark:(t,o)=>l.Decoration.mark({class:"mk"}).range(t,o)},c=[];return E(e,{enter:({type:t,from:o,to:s})=>(t.name in i&&c.push(i[t.name](o,H(e,o,s))),t.name in a&&c.push(a[t.name](o,s+1)),r.includes(t.name)||t.name in i)}),l.Decoration.set(c,!1)}const He=D.EditorView.baseTheme({"& .h1 ":{fontSize:"2.00em",fontWeight:"bolder"},"& .h2 ":{fontSize:"1.55em",fontWeight:"bolder"},"& .h3 ":{fontSize:"1.35em",fontWeight:"bolder"},"& .h4 ":{fontSize:"1.25em",fontWeight:"bolder"},"& .h5 ":{fontSize:"1.25em",fontWeight:"semi-bold"},"& .h6 ":{fontSize:"1.25em",fontWeight:"normal"},"& .hg ":{lineHeight:"2.4lh"},"& .h1, & .h2":{paddingBottom:"16px",position:"relative"},"& .h1::after, & .h2::after":{content:'""',display:"block",height:"1px",borderBottom:"1px solid var(--cm-border, light-dark(#ddd, #555))"}}),Ee=D.EditorView.baseTheme({"& .hg .mk":{display:"none"},"&.cm-focused .hg.sw .mk":{display:"inline"}}),U=()=>[x(xe,{}),He,Ee],X={tip: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">
|
|
8
8
|
<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"/>
|
|
9
9
|
</svg>`,note: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">
|
|
10
10
|
<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"/>
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
<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"/>
|
|
15
15
|
</svg>`,caution: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">
|
|
16
16
|
<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"/>
|
|
17
|
-
</svg>`,none:()=>""};class
|
|
18
|
-
`),p=e.state.doc.lineAt(s);t.push(...c(e,u,p,g.length))}return r.includes(o)}}),l.Decoration.set(t,!0)}const
|
|
17
|
+
</svg>`,none:()=>""};class Se extends l.WidgetType{constructor(n){super(),this.type=n}toDOM(){let n=document.createElement("span");return n.setAttribute("aria-hidden","true"),n.className="wg-qt-icon",n.innerHTML=this.type in X?X[this.type]():"",n}ignoreEvent(){return!1}eq(n){return this.type===n.type}}function Be(e,n){const r=["Document","ListItem","BulletList","OrderedList"],i={none:"bq-none-mark",note:"bq-note-mark",tip:"bq-tip-mark",warning:"bq-warning-mark",important:"bq-important-mark",caution:"bq-caution-mark"},a={QuoteMark:(o,s,d)=>{const u=["qt-mk"];return d in i?u.push(i[d]):u.push(i.none),l.Decoration.mark({class:u.join(" ")}).range(o,s)},QuoteType:(o,s,d)=>l.Decoration.widget({widget:new Se(d),side:1}).range(o),BlockquoteLine:(o,s)=>l.Decoration.line({class:"bq-line "+(s?"sw":"")}).range(o),quoteLine:(o,s,d)=>{const u=`calc(100% - ${Math.max(0,d)+1.2}ch)`;return l.Decoration.mark({class:"bq-text-line",attributes:{style:`width: ${u}`}}).range(o,s)}},c=(o,s,d,u)=>{const g=[],p=d.number,w=(f,y)=>{let L=0;const k=[];let b=0;return{enter({name:T,node:M,from:C,to:S}){T==="Blockquote"&&k.push(Ie(o,M)),T==="QuoteMark"&&(g.push(a[T](C,S,k[L])),b=S,L++),T==="QuoteType"&&g.push(a[T](C,S,k[L-1]))},leave({name:T,from:M,to:C}){T==="Paragraph"&&b<y&&g.push(a.quoteLine(b,y,b-f))}}};for(let f=p;f<u+p;f++){const{from:y,to:L}=o.state.doc.line(f),{from:k,to:b}=s,T=H(o,k,b);g.push(a.BlockquoteLine(y,T)),z.syntaxTree(o.state).iterate({from:y,to:L,...w(y,L)})}return g},t=[];return E(e,{enter:({name:o,from:s,to:d,node:u})=>{if(o==="Blockquote"){const g=e.state.sliceDoc(s,d).split(`
|
|
18
|
+
`),p=e.state.doc.lineAt(s);t.push(...c(e,u,p,g.length))}return r.includes(o)}}),l.Decoration.set(t,!0)}const Ie=(e,n)=>{const r=n.getChild("QuoteType");if(!r)return"none";const i=r.getChild("QuoteTypeText");return i?e.state.sliceDoc(i.from,i.to).toLowerCase():"none"},Ae=()=>D.EditorView.baseTheme({"& .qt-mk":{position:"relative",color:"transparent",verticalAlign:"top"},"& .qt-mk::after":{position:"absolute",content:'" "',backgroundColor:"currentColor",top:"-100vh",width:"4px",height:"200vh",zIndex:"-1"},"&.cm-focused .bq-line.sw .qt-mk::after":{opacity:.3},"& .bq-line":{lineHeight:"1.2lh",overflowY:"hidden"},"& .bq-line.sw .bq-none-mark, .bq-none-mark::after":{color:"var(--bq-none-mark, light-dark(black, white))"},"&.cm-focused .bq-line.sw .bq-note-mark, .bq-note-mark::after":{color:"var(--bq-note-mark, blue)"},"&.cm-focused .bq-line.sw .bq-tip-mark, .bq-tip-mark::after":{color:"var(--bq-tip-mark, green)"},"&.cm-focused .bq-line.sw .bq-warning-mark, .bq-warning-mark::after":{color:"var(--bq-warning-mark, peru)"},"&.cm-focused .bq-line.sw .bq-important-mark, .bq-important-mark::after":{color:"var(--bq-important-mark, rebeccapurple)"},"&.cm-focused .bq-line.sw .bq-caution-mark, .bq-caution-mark::after":{color:"var(--bq-caution-mark, red)"},"& .bq-text-line":{lineHeight:"1lh",display:"inline-block",paddingLeft:"6px",textIndent:"-7px",ariaHidden:"true"},"& .bq-text-line *":{verticalAlign:"middle"},"& .wg-qt-icon":{display:"inline-block"},"& .wg-qt-icon > .qt-icon":{paddingLeft:"1ch",width:"2em",height:"2em"},"& .wg-qt-icon > .qt-tip":{fill:"var(--bq-tip-mark, green)"},"& .wg-qt-icon > .qt-note":{fill:"var(--bq-note-mark, blue)"},"& .wg-qt-icon > .qt-important":{fill:"var(--bq-important-mark, rebeccapurple)"},"& .wg-qt-icon > .qt-warning":{fill:"var(--bq-warning-mark, peru)"},"& .wg-qt-icon > .qt-caution":{fill:"var(--bq-caution-mark, red)"}}),v=()=>[x(Be,{}),Ae()],Pe={name:"QuoteTypeParser",parse(e,n){if((()=>{for(let i=0;i<e.depth;i++)if(e.parentType(i).name==="Blockquote")return!0;return!1})()){const i=n.text.match(/^(\s*>\s*)+(\[!\w+\])\s*$/);if(i&&i[2]){const a=i[2],c=n.text.indexOf(a),t=c+a.length,o=e.elt("QuoteType",e.lineStart+c,e.lineStart+t);o.children=[e.elt("QuoteTypeMark",e.lineStart+c,e.lineStart+c+2),e.elt("QuoteTypeText",e.lineStart+c+2,e.lineStart+t-1),e.elt("QuoteTypeMark",e.lineStart+t-1,e.lineStart+t)],e.addElement(o)}}return!1}},G={defineNodes:[{name:"QuoteType",style:{"QuoteType/...":I.tags.content}},{name:"QuoteTypeMark",style:I.tags.processingInstruction},{name:"QuoteTypeText",style:I.tags.bool}],parseBlock:[Pe]};class K extends l.WidgetType{constructor(n,r=!1){super(),this.content=n,this.tag=r}toDOM(){const n=document.createElement("div");n.className="cm-html-widget",n.setAttribute("aria-hidden","true");const r=this.content.replace(/^```html\n?/,"").replace(/```$/,"").trim();return n.innerHTML=(this.tag?'<span class="cm-rendered-tag">RTAG</span>':"")+r,n.querySelectorAll("script").forEach(i=>{i.parentNode.removeChild(i)}),n}ignoreEvent(n){return n.type==="click"}eq(n){return n.content===this.content}}const Y=Z.StateEffect.define(),Qe=Z.StateField.define({create(e){return l.Decoration.none},update(e,n){e=e.map(n.changes);for(let r of n.effects)if(r.is(Y))return r.value;return e},provide:e=>l.EditorView.decorations.from(e)});function ze(e){const n=[/<br>/,/<img .*\/>/],r={HTMLBlock:(a,c)=>{const t=e.state.doc.sliceString(a,c);return[l.Decoration.replace({widget:new K(t),inclusive:!1}).range(a,c)]},HTMLTag:(a,c)=>{const t=e.state.doc.sliceString(a,c);return console.log(t),n.some(o=>o.test(t))?(console.log(t),[l.Decoration.replace({widget:new K(t,!0),inclusive:!1}).range(a,c)]):[]}},i=[];return E(e,{enter:({type:a,from:c,to:t,node:o})=>{a.name in r&&(!H(e,c,t)||!e.hasFocus)&&i.push(...r[a.name](c,t))}}),l.Decoration.set(i)}const Ze=D.EditorView.baseTheme({"& .cm-html-widget":{all:"unset"},"& .cm-html-widget > *":{paddingTop:"0",paddingBottom:"0",marginBottom:"0",marginTop:"0"},"& .cm-widgetBuffer":{display:"none"}}),Ve=l.EditorView.updateListener.of(e=>{if(e.selectionSet||e.docChanged||e.focusChanged||e.geometryChanged){const n=ze(e.view);e.view.dispatch({effects:Y.of(n)})}}),J=()=>[Qe,Ve,Ze],$e=e=>{const{markdown:{defaultCodeLanguage:n,codeLanguages:r,addKeymap:i,base:a,completeHTMLTags:c,htmlTagLanguage:t,extensions:o=[]}={}}=e??{},s={defaultCodeLanguage:n,codeLanguages:r||q.languages,addKeymap:i,base:a,completeHTMLTags:c,htmlTagLanguage:t,extensions:[...o,ee.GFM,te,G]};return[B.markdown(s),V(),$(),W(),N(),O(),F(),U(),v(),J()]};h.CodePlugin=F,h.HeadingPlugin=U,h.HrPlugin=V,h.HtmlPlugin=J,h.ImagePlugin=N,h.InlinePlugin=$,h.LinkPlugin=W,h.ListPlugin=O,h.QuotePlugin=v,h.QuoteType=G,h.gnosis=$e,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|