@milkdown/crepe 7.3.4 → 7.3.5
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/lib/feature/block-edit/handle/index.d.ts.map +1 -1
- package/lib/feature/block-edit/menu/index.d.ts.map +1 -1
- package/lib/feature/toolbar/index.d.ts.map +1 -1
- package/lib/{index-YMk3n5vO.js → index-1KQHo-44.js} +4 -4
- package/lib/{index-TsIsEZU1.js → index-4p4g7ekJ.js} +1 -1
- package/lib/{index-h_6aZnx8.js → index-4uesIuIi.js} +4 -4
- package/lib/{index-3qfZtuPz.js → index-51ybuhXd.js} +1 -1
- package/lib/{index-2Cm9HHYj.js → index-96I5UgEh.js} +1 -1
- package/lib/{index-Gz6CQY-t.js → index-C17brGmy.js} +4 -4
- package/lib/{index-b2y_N_O5.js → index-EhPVaWMa.js} +7 -7
- package/lib/{index-j2S9Lybz.js → index-IKzcztdD.js} +1 -1
- package/lib/{index-TRbxSkC1.js → index-KDuMRRPt.js} +4 -4
- package/lib/{index-H0TD0r41.js → index-K_kBonEs.js} +1 -1
- package/lib/{index-JGveSciI.js → index-Mwqn_gij.js} +7 -7
- package/lib/{index-5QLddZAp.js → index-P2HixfB4.js} +4 -4
- package/lib/{index-8NLp8LdC.js → index-PwfWCMtB.js} +9 -9
- package/lib/{index-yP4hAgM2.js → index-S3dtETwZ.js} +46 -45
- package/lib/{index-Gg_apETx.js → index-T6CCBIrO.js} +5 -5
- package/lib/{index-Zxe2neJQ.js → index-UdINtlLB.js} +148 -146
- package/lib/{index-kwrazjQE.js → index-WpINpUas.js} +7 -7
- package/lib/{index-wbiYuOxV.js → index-YjIgdsm-.js} +93 -89
- package/lib/{index-oOHgRzEu.js → index-ZyvuYqIf.js} +21 -20
- package/lib/{index-kJIKUIIa.js → index-brbFUWoa.js} +18 -18
- package/lib/{index-fJFWq6Y-.js → index-cAviWcah.js} +7 -7
- package/lib/{index-KpfNv3rh.js → index-f8O1bHwz.js} +4 -4
- package/lib/{index-0c09be_R.js → index-f_vMXWyc.js} +4 -4
- package/lib/{index-xkrG0YF8.js → index-gRh597MD.js} +5 -5
- package/lib/{index-WAhmZOxr.js → index-gaQ0Jeve.js} +4 -4
- package/lib/{index-ffdCLz6T.js → index-hcG6NuOF.js} +2 -2
- package/lib/{index-qQMehYhQ.js → index-iECr6hjv.js} +24 -24
- package/lib/{index-7mRbGzci.js → index-iHi9E5fI.js} +5 -5
- package/lib/{index-bnwzlBfQ.js → index-sAnPFt21.js} +6 -6
- package/lib/{index-Ic30Lzgg.js → index-wD9meLYq.js} +4 -4
- package/lib/{index-hNRb95TL.js → index-zY_Ffd-9.js} +4 -4
- package/lib/index.es.js +1 -1
- package/lib/{schema-t8-IDHY6.js → schema-PTbL6iMu.js} +1 -1
- package/lib/{tippy.esm-xX0Dh8mH.js → tippy.esm-lHdsQkl8.js} +33 -33
- package/lib/{tooltip-plugin-0UgO85XO.js → tooltip-plugin-Pjm6nx6a.js} +17 -17
- package/package.json +14 -14
- package/src/feature/block-edit/handle/index.ts +2 -1
- package/src/feature/block-edit/menu/index.ts +2 -0
- package/src/feature/toolbar/index.ts +2 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { L as P, a as q, s as g, t as r, p as l } from "./index-
|
|
2
|
-
import { html as c } from "./index-
|
|
3
|
-
import { javascriptLanguage as s } from "./index-
|
|
4
|
-
import { L as m, E as p } from "./index-
|
|
1
|
+
import { L as P, a as q, s as g, t as r, p as l } from "./index-iECr6hjv.js";
|
|
2
|
+
import { html as c } from "./index-sAnPFt21.js";
|
|
3
|
+
import { javascriptLanguage as s } from "./index-f8O1bHwz.js";
|
|
4
|
+
import { L as m, E as p } from "./index-4p4g7ekJ.js";
|
|
5
5
|
import "./meta-tAGyVRPE.js";
|
|
6
6
|
import "./icons-HYkfuR-O.js";
|
|
7
|
-
import "./index-
|
|
7
|
+
import "./index-S3dtETwZ.js";
|
|
8
8
|
import "./hooks-82sqkbtE.js";
|
|
9
|
-
import "./index-
|
|
9
|
+
import "./index-K_kBonEs.js";
|
|
10
10
|
import "./clsx-7d8NmkQq.js";
|
|
11
|
-
import "./index-
|
|
11
|
+
import "./index-zY_Ffd-9.js";
|
|
12
12
|
const R = 1, b = 33, $ = 34, v = 35, x = 36, W = /* @__PURE__ */ new p((O) => {
|
|
13
13
|
let t = O.pos;
|
|
14
14
|
for (; ; ) {
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
var
|
|
1
|
+
var O = (n, t, r) => {
|
|
2
2
|
if (!t.has(n))
|
|
3
3
|
throw TypeError("Cannot " + r);
|
|
4
4
|
};
|
|
5
|
-
var i = (n, t, r) => (
|
|
5
|
+
var i = (n, t, r) => (O(n, t, "read from private field"), r ? r.call(n) : t.get(n)), c = (n, t, r) => {
|
|
6
6
|
if (t.has(n))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
8
|
t instanceof WeakSet ? t.add(n) : t.set(n, r);
|
|
9
|
-
},
|
|
10
|
-
import { t as
|
|
11
|
-
import { w as
|
|
12
|
-
import { d as R, f as _, T as
|
|
13
|
-
import { d as
|
|
14
|
-
import { u as
|
|
15
|
-
import { c as
|
|
9
|
+
}, d = (n, t, r, e) => (O(n, t, "write to private field"), e ? e.call(n, r) : t.set(n, r), r);
|
|
10
|
+
import { t as j, l as D, a as B, b as H, T as z } from "./tooltip-plugin-Pjm6nx6a.js";
|
|
11
|
+
import { w as V, c as K, h as M, u as Q, a as U } from "./meta-tAGyVRPE.js";
|
|
12
|
+
import { d as R, f as Y, g as _, T as tt, i as et } from "./index-S3dtETwZ.js";
|
|
13
|
+
import { d as it, p as q } from "./tippy.esm-lHdsQkl8.js";
|
|
14
|
+
import { u as nt } from "./hooks-82sqkbtE.js";
|
|
15
|
+
import { c as ot } from "./clsx-7d8NmkQq.js";
|
|
16
16
|
import "./icons-HYkfuR-O.js";
|
|
17
|
-
const $ =
|
|
18
|
-
|
|
17
|
+
const $ = j("LINK_PREVIEW");
|
|
18
|
+
V($[0], {
|
|
19
19
|
displayName: "PreviewTooltipSpec<link-tooltip>",
|
|
20
20
|
group: "LinkTooltip"
|
|
21
21
|
});
|
|
22
|
-
|
|
22
|
+
V($[1], {
|
|
23
23
|
displayName: "PreviewTooltipPlugin<link-tooltip>",
|
|
24
24
|
group: "LinkTooltip"
|
|
25
25
|
});
|
|
26
|
-
const Z =
|
|
27
|
-
|
|
26
|
+
const Z = j("LINK_EDIT");
|
|
27
|
+
V(Z[0], {
|
|
28
28
|
displayName: "EditTooltipSpec<link-tooltip>",
|
|
29
29
|
group: "LinkTooltip"
|
|
30
30
|
});
|
|
31
|
-
|
|
31
|
+
V(Z[1], {
|
|
32
32
|
displayName: "EditTooltipPlugin<link-tooltip>",
|
|
33
33
|
group: "LinkTooltip"
|
|
34
34
|
});
|
|
35
|
-
function
|
|
35
|
+
function st(n, t, r, e) {
|
|
36
36
|
let o = { start: -1, end: -1 };
|
|
37
37
|
return t.nodesBetween(r, e, (s, p) => {
|
|
38
38
|
if (o.start > -1)
|
|
@@ -43,18 +43,18 @@ function ot(n, t, r, e) {
|
|
|
43
43
|
});
|
|
44
44
|
}), o;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function rt(n, t, r) {
|
|
47
47
|
const e = t.posAtCoords({ left: r.clientX, top: r.clientY });
|
|
48
48
|
if (!e)
|
|
49
49
|
return;
|
|
50
50
|
const { pos: o } = e, s = t.state.doc.nodeAt(o);
|
|
51
51
|
if (!s)
|
|
52
52
|
return;
|
|
53
|
-
const p = s.marks.find((
|
|
53
|
+
const p = s.marks.find((a) => a.type === R.mark.type(n));
|
|
54
54
|
if (!(!p || !$.pluginKey()))
|
|
55
55
|
return { show: !0, pos: o, node: s, mark: p };
|
|
56
56
|
}
|
|
57
|
-
const
|
|
57
|
+
const W = ({ config: n, src: t, onEdit: r, onRemove: e }) => {
|
|
58
58
|
const o = (l) => {
|
|
59
59
|
l.stopPropagation(), l.preventDefault(), r == null || r();
|
|
60
60
|
}, s = (l) => {
|
|
@@ -65,8 +65,8 @@ const q = ({ config: n, src: t, onEdit: r, onRemove: e }) => {
|
|
|
65
65
|
<div class="link-preview" onmousedown=${(l) => {
|
|
66
66
|
l.preventDefault(), navigator.clipboard && t && navigator.clipboard.writeText(t).then(() => {
|
|
67
67
|
n == null || n.onCopyLink(t);
|
|
68
|
-
}).catch((
|
|
69
|
-
throw
|
|
68
|
+
}).catch((a) => {
|
|
69
|
+
throw a;
|
|
70
70
|
});
|
|
71
71
|
}}>
|
|
72
72
|
<span class="link-icon">
|
|
@@ -83,15 +83,15 @@ const q = ({ config: n, src: t, onEdit: r, onRemove: e }) => {
|
|
|
83
83
|
</host>
|
|
84
84
|
`;
|
|
85
85
|
};
|
|
86
|
-
|
|
86
|
+
W.props = {
|
|
87
87
|
config: Object,
|
|
88
88
|
src: String,
|
|
89
89
|
onEdit: Function,
|
|
90
90
|
onRemove: Function
|
|
91
91
|
};
|
|
92
|
-
const
|
|
92
|
+
const X = K(W);
|
|
93
93
|
var u, w, f, x, T, L, b, C, y;
|
|
94
|
-
class
|
|
94
|
+
class lt {
|
|
95
95
|
constructor(t, r) {
|
|
96
96
|
c(this, x);
|
|
97
97
|
c(this, u, void 0);
|
|
@@ -101,53 +101,56 @@ class rt {
|
|
|
101
101
|
c(this, b, void 0);
|
|
102
102
|
c(this, C, void 0);
|
|
103
103
|
c(this, y, void 0);
|
|
104
|
-
this.ctx = t,
|
|
105
|
-
debounce: 0,
|
|
106
|
-
content: i(this, u),
|
|
107
|
-
shouldShow: () => !1
|
|
108
|
-
})), a(this, f, !1), this.setRect = (e) => {
|
|
104
|
+
this.ctx = t, d(this, u, new X()), d(this, f, !1), this.setRect = (e) => {
|
|
109
105
|
var o;
|
|
110
106
|
(o = i(this, w).getInstance()) == null || o.setProps({
|
|
111
107
|
getReferenceClientRect: () => e
|
|
112
108
|
});
|
|
113
|
-
},
|
|
109
|
+
}, d(this, L, ({ mode: e }) => {
|
|
114
110
|
e === "edit" && i(this, y).call(this);
|
|
115
|
-
}),
|
|
116
|
-
|
|
117
|
-
}),
|
|
118
|
-
|
|
119
|
-
}),
|
|
111
|
+
}), d(this, b, () => {
|
|
112
|
+
d(this, f, !0);
|
|
113
|
+
}), d(this, C, () => {
|
|
114
|
+
d(this, f, !1);
|
|
115
|
+
}), d(this, y, () => {
|
|
120
116
|
var e, o;
|
|
121
117
|
i(this, w).hide(), (e = i(this, x, T)) == null || e.popper.addEventListener("mouseenter", i(this, b)), (o = i(this, x, T)) == null || o.popper.addEventListener("mouseleave", i(this, C));
|
|
122
118
|
}), this.show = (e, o, s) => {
|
|
123
|
-
var l,
|
|
124
|
-
const p = this.ctx.get(
|
|
119
|
+
var l, a;
|
|
120
|
+
const p = this.ctx.get(D.key);
|
|
125
121
|
i(this, u).config = p, i(this, u).src = e.attrs.href, i(this, u).onEdit = () => {
|
|
126
122
|
this.ctx.get(B.key).editLink(e, o, s);
|
|
127
123
|
}, i(this, u).onRemove = () => {
|
|
128
124
|
this.ctx.get(B.key).removeLink(o, s), i(this, y).call(this);
|
|
129
|
-
}, i(this, w).show(), (l = i(this, x, T)) == null || l.popper.addEventListener("mouseenter", i(this, b)), (
|
|
125
|
+
}, i(this, w).show(), (l = i(this, x, T)) == null || l.popper.addEventListener("mouseenter", i(this, b)), (a = i(this, x, T)) == null || a.popper.addEventListener("mouseleave", i(this, C));
|
|
130
126
|
}, this.hide = () => {
|
|
131
127
|
i(this, f) || i(this, y).call(this);
|
|
132
128
|
}, this.update = () => {
|
|
133
129
|
}, this.destroy = () => {
|
|
134
130
|
this.ctx.use(H.key).off(i(this, L)), i(this, w).destroy(), i(this, u).remove();
|
|
135
|
-
},
|
|
131
|
+
}, d(this, w, new z({
|
|
132
|
+
debounce: 0,
|
|
133
|
+
content: i(this, u),
|
|
134
|
+
shouldShow: () => !1,
|
|
135
|
+
tippyOptions: {
|
|
136
|
+
appendTo: () => t.get(Y)
|
|
137
|
+
}
|
|
138
|
+
})), i(this, w).update(r), t.use(H.key).on(i(this, L));
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
141
|
u = new WeakMap(), w = new WeakMap(), f = new WeakMap(), x = new WeakSet(), T = function() {
|
|
139
142
|
return i(this, w).getInstance();
|
|
140
143
|
}, L = new WeakMap(), b = new WeakMap(), C = new WeakMap(), y = new WeakMap();
|
|
141
|
-
customElements.define("milkdown-link-preview",
|
|
142
|
-
function
|
|
144
|
+
customElements.define("milkdown-link-preview", X);
|
|
145
|
+
function pt(n) {
|
|
143
146
|
let t;
|
|
144
|
-
const e =
|
|
147
|
+
const e = it((s, p) => {
|
|
145
148
|
if (!t || !s.hasFocus() || n.get(H.key).mode === "edit")
|
|
146
149
|
return;
|
|
147
|
-
const
|
|
148
|
-
if (
|
|
149
|
-
const h = s.state.doc.resolve(
|
|
150
|
-
t.setRect(
|
|
150
|
+
const a = rt(n, s, p);
|
|
151
|
+
if (a) {
|
|
152
|
+
const h = s.state.doc.resolve(a.pos), E = st(a.mark, s.state.doc, h.before(), h.after()), F = E.start, A = E.end;
|
|
153
|
+
t.setRect(q(s, F, A)), t.show(a.mark, F, A);
|
|
151
154
|
return;
|
|
152
155
|
}
|
|
153
156
|
t.hide();
|
|
@@ -163,23 +166,23 @@ function lt(n) {
|
|
|
163
166
|
mouseleave: o
|
|
164
167
|
}
|
|
165
168
|
},
|
|
166
|
-
view: (s) => (t = new
|
|
169
|
+
view: (s) => (t = new lt(n, s), t)
|
|
167
170
|
});
|
|
168
171
|
}
|
|
169
|
-
const
|
|
172
|
+
const G = ({
|
|
170
173
|
src: n,
|
|
171
174
|
onConfirm: t,
|
|
172
175
|
onCancel: r,
|
|
173
176
|
config: e
|
|
174
177
|
}) => {
|
|
175
|
-
const o =
|
|
176
|
-
|
|
178
|
+
const o = Q(), [s, p] = nt(n);
|
|
179
|
+
U(() => {
|
|
177
180
|
p(n ?? "");
|
|
178
181
|
}, [n]);
|
|
179
182
|
const l = () => {
|
|
180
183
|
var h;
|
|
181
184
|
t == null || t(((h = o.current) == null ? void 0 : h.value) ?? "");
|
|
182
|
-
},
|
|
185
|
+
}, a = (h) => {
|
|
183
186
|
var E;
|
|
184
187
|
h.stopPropagation(), h.key === "Enter" && (t == null || t(((E = o.current) == null ? void 0 : E.value) ?? ""), h.preventDefault()), h.key === "Escape" && (r == null || r(), h.preventDefault());
|
|
185
188
|
};
|
|
@@ -190,30 +193,30 @@ const X = ({
|
|
|
190
193
|
class="input-area"
|
|
191
194
|
placeholder=${e == null ? void 0 : e.inputPlaceholder}
|
|
192
195
|
ref=${o}
|
|
193
|
-
onkeydown=${
|
|
196
|
+
onkeydown=${a}
|
|
194
197
|
oninput=${(h) => p(h.target.value)}
|
|
195
198
|
value=${s}
|
|
196
199
|
/>
|
|
197
|
-
<span class=${
|
|
200
|
+
<span class=${ot("button confirm", s.length === 0 && "hidden")} onclick=${l}>
|
|
198
201
|
${e == null ? void 0 : e.confirmButton()}
|
|
199
202
|
</span>
|
|
200
203
|
</div>
|
|
201
204
|
</host>
|
|
202
205
|
`;
|
|
203
206
|
};
|
|
204
|
-
|
|
207
|
+
G.props = {
|
|
205
208
|
config: Object,
|
|
206
209
|
src: String,
|
|
207
210
|
onConfirm: Function,
|
|
208
211
|
onCancel: Function
|
|
209
212
|
};
|
|
210
|
-
const
|
|
213
|
+
const J = K(G), N = {
|
|
211
214
|
from: -1,
|
|
212
215
|
to: -1,
|
|
213
216
|
mark: null
|
|
214
217
|
};
|
|
215
218
|
var k, m, v, g, I, S, P;
|
|
216
|
-
class
|
|
219
|
+
class at {
|
|
217
220
|
constructor(t, r) {
|
|
218
221
|
c(this, k, void 0);
|
|
219
222
|
c(this, m, void 0);
|
|
@@ -222,34 +225,34 @@ class pt {
|
|
|
222
225
|
c(this, I, void 0);
|
|
223
226
|
c(this, S, void 0);
|
|
224
227
|
c(this, P, void 0);
|
|
225
|
-
this.ctx = t,
|
|
228
|
+
this.ctx = t, d(this, k, new J()), d(this, v, { ...N }), d(this, g, () => {
|
|
226
229
|
i(this, m).hide(), this.ctx.update(H.key, (e) => ({
|
|
227
230
|
...e,
|
|
228
231
|
mode: "preview"
|
|
229
|
-
})),
|
|
230
|
-
}),
|
|
232
|
+
})), d(this, v, { ...N });
|
|
233
|
+
}), d(this, I, (e) => {
|
|
231
234
|
var o;
|
|
232
235
|
(o = i(this, m).getInstance()) == null || o.setProps({
|
|
233
236
|
getReferenceClientRect: () => e
|
|
234
237
|
});
|
|
235
|
-
}),
|
|
236
|
-
const o = this.ctx.get(_), { from: s, to: p, mark: l } = i(this, v),
|
|
238
|
+
}), d(this, S, (e) => {
|
|
239
|
+
const o = this.ctx.get(_), { from: s, to: p, mark: l } = i(this, v), a = R.type(this.ctx);
|
|
237
240
|
if (l && l.attrs.href === e) {
|
|
238
241
|
i(this, g).call(this);
|
|
239
242
|
return;
|
|
240
243
|
}
|
|
241
244
|
const h = o.state.tr;
|
|
242
|
-
l && h.removeMark(s, p, l), h.addMark(s, p,
|
|
243
|
-
}),
|
|
244
|
-
const p = this.ctx.get(
|
|
245
|
-
i(this, k).config = p, i(this, k).src = e, this.ctx.update(H.key, (
|
|
246
|
-
...
|
|
245
|
+
l && h.removeMark(s, p, l), h.addMark(s, p, a.create({ href: e })), o.dispatch(h), i(this, g).call(this);
|
|
246
|
+
}), d(this, P, (e, o, s) => {
|
|
247
|
+
const p = this.ctx.get(D.key);
|
|
248
|
+
i(this, k).config = p, i(this, k).src = e, this.ctx.update(H.key, (a) => ({
|
|
249
|
+
...a,
|
|
247
250
|
mode: "edit"
|
|
248
251
|
}));
|
|
249
252
|
const l = this.ctx.get(_);
|
|
250
|
-
i(this, I).call(this,
|
|
251
|
-
var
|
|
252
|
-
(
|
|
253
|
+
i(this, I).call(this, q(l, o, s)), l.dispatch(l.state.tr.setSelection(tt.create(l.state.doc, o, s))), i(this, m).show(), requestAnimationFrame(() => {
|
|
254
|
+
var a;
|
|
255
|
+
(a = i(this, k).querySelector("input")) == null || a.focus();
|
|
253
256
|
});
|
|
254
257
|
}), this.update = (e) => {
|
|
255
258
|
const { state: o } = e, { selection: s } = o, { from: p, to: l } = s;
|
|
@@ -257,13 +260,13 @@ class pt {
|
|
|
257
260
|
}, this.destroy = () => {
|
|
258
261
|
i(this, m).destroy(), i(this, k).remove();
|
|
259
262
|
}, this.addLink = (e, o) => {
|
|
260
|
-
|
|
263
|
+
d(this, v, {
|
|
261
264
|
from: e,
|
|
262
265
|
to: o,
|
|
263
266
|
mark: null
|
|
264
267
|
}), i(this, P).call(this, "", e, o);
|
|
265
268
|
}, this.editLink = (e, o, s) => {
|
|
266
|
-
|
|
269
|
+
d(this, v, {
|
|
267
270
|
from: o,
|
|
268
271
|
to: s,
|
|
269
272
|
mark: e
|
|
@@ -271,11 +274,12 @@ class pt {
|
|
|
271
274
|
}, this.removeLink = (e, o) => {
|
|
272
275
|
const s = this.ctx.get(_), p = s.state.tr;
|
|
273
276
|
p.removeMark(e, o, R.type(this.ctx)), s.dispatch(p), i(this, g).call(this);
|
|
274
|
-
},
|
|
277
|
+
}, d(this, m, new z({
|
|
275
278
|
content: i(this, k),
|
|
276
279
|
debounce: 0,
|
|
277
280
|
shouldShow: () => !1,
|
|
278
281
|
tippyOptions: {
|
|
282
|
+
appendTo: () => t.get(Y),
|
|
279
283
|
onHidden: () => {
|
|
280
284
|
i(this, k).update().catch((e) => {
|
|
281
285
|
throw e;
|
|
@@ -286,7 +290,7 @@ class pt {
|
|
|
286
290
|
}
|
|
287
291
|
}
|
|
288
292
|
k = new WeakMap(), m = new WeakMap(), v = new WeakMap(), g = new WeakMap(), I = new WeakMap(), S = new WeakMap(), P = new WeakMap();
|
|
289
|
-
customElements.define("milkdown-link-edit",
|
|
293
|
+
customElements.define("milkdown-link-edit", J);
|
|
290
294
|
function dt(n) {
|
|
291
295
|
let t;
|
|
292
296
|
n.update(B.key, (r) => ({
|
|
@@ -301,17 +305,17 @@ function dt(n) {
|
|
|
301
305
|
t == null || t.removeLink(e, o);
|
|
302
306
|
}
|
|
303
307
|
})), n.set(Z.key, {
|
|
304
|
-
view: (r) => (t = new
|
|
308
|
+
view: (r) => (t = new at(n, r), t)
|
|
305
309
|
});
|
|
306
310
|
}
|
|
307
|
-
function
|
|
308
|
-
|
|
311
|
+
function ht(n) {
|
|
312
|
+
pt(n), dt(n);
|
|
309
313
|
}
|
|
310
|
-
const
|
|
314
|
+
const ct = [H, B, D, $, Z].flat(), kt = M`
|
|
311
315
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
312
316
|
<path d="M17.0385 19.5003V16.5388H14.0769V15.0388H17.0385V12.0773H18.5384V15.0388H21.5V16.5388H18.5384V19.5003H17.0385ZM10.8077 16.5388H7.03845C5.78282 16.5388 4.7125 16.0963 3.8275 15.2114C2.9425 14.3266 2.5 13.2564 2.5 12.0009C2.5 10.7454 2.9425 9.67504 3.8275 8.78979C4.7125 7.90454 5.78282 7.46191 7.03845 7.46191H10.8077V8.96186H7.03845C6.1987 8.96186 5.48235 9.25834 4.8894 9.85129C4.29645 10.4442 3.99998 11.1606 3.99998 12.0003C3.99998 12.8401 4.29645 13.5564 4.8894 14.1494C5.48235 14.7423 6.1987 15.0388 7.03845 15.0388H10.8077V16.5388ZM8.25 12.7503V11.2504H15.75V12.7503H8.25ZM21.5 12.0003H20C20 11.1606 19.7035 10.4442 19.1106 9.85129C18.5176 9.25834 17.8013 8.96186 16.9615 8.96186H13.1923V7.46191H16.9615C18.2171 7.46191 19.2875 7.90441 20.1725 8.78939C21.0575 9.67439 21.5 10.7447 21.5 12.0003Z" fill="#817567"/>
|
|
313
317
|
</svg>
|
|
314
|
-
`,
|
|
318
|
+
`, ut = M`
|
|
315
319
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
316
320
|
<g clip-path="url(#clip0_1013_1585)">
|
|
317
321
|
<path d="M14.06 9.02L14.98 9.94L5.92 19H5V18.08L14.06 9.02ZM17.66 3C17.41 3 17.15 3.1 16.96 3.29L15.13 5.12L18.88 8.87L20.71 7.04C21.1 6.65 21.1 6.02 20.71 5.63L18.37 3.29C18.17 3.09 17.92 3 17.66 3ZM14.06 6.19L3 17.25V21H6.75L17.81 9.94L14.06 6.19Z" fill="#817567"/>
|
|
@@ -322,7 +326,7 @@ const ht = [H, B, V, $, Z].flat(), ct = M`
|
|
|
322
326
|
</clipPath>
|
|
323
327
|
</defs>
|
|
324
328
|
</svg>
|
|
325
|
-
`,
|
|
329
|
+
`, wt = M`
|
|
326
330
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
327
331
|
<g clip-path="url(#clip0_1013_1627)">
|
|
328
332
|
<path d="M6 19C6 20.1 6.9 21 8 21H16C17.1 21 18 20.1 18 19V9C18 7.9 17.1 7 16 7H8C6.9 7 6 7.9 6 9V19ZM9 9H15C15.55 9 16 9.45 16 10V18C16 18.55 15.55 19 15 19H9C8.45 19 8 18.55 8 18V10C8 9.45 8.45 9 9 9ZM15.5 4L14.79 3.29C14.61 3.11 14.35 3 14.09 3H9.91C9.65 3 9.39 3.11 9.21 3.29L8.5 4H6C5.45 4 5 4.45 5 5C5 5.55 5.45 6 6 6H18C18.55 6 19 5.55 19 5C19 4.45 18.55 4 18 4H15.5Z" fill="#817567"/>
|
|
@@ -333,7 +337,7 @@ const ht = [H, B, V, $, Z].flat(), ct = M`
|
|
|
333
337
|
</clipPath>
|
|
334
338
|
</defs>
|
|
335
339
|
</svg>
|
|
336
|
-
`,
|
|
340
|
+
`, vt = M`
|
|
337
341
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
338
342
|
<g clip-path="url(#clip0_1013_1545)">
|
|
339
343
|
<path d="M9.00012 16.1998L5.50012 12.6998C5.11012 12.3098 4.49012 12.3098 4.10012 12.6998C3.71012 13.0898 3.71012 13.7098 4.10012 14.0998L8.29012 18.2898C8.68012 18.6798 9.31012 18.6798 9.70012 18.2898L20.3001 7.69982C20.6901 7.30982 20.6901 6.68982 20.3001 6.29982C19.9101 5.90982 19.2901 5.90982 18.9001 6.29982L9.00012 16.1998Z" fill="#817567"/>
|
|
@@ -344,17 +348,17 @@ const ht = [H, B, V, $, Z].flat(), ct = M`
|
|
|
344
348
|
</clipPath>
|
|
345
349
|
</defs>
|
|
346
350
|
</svg>
|
|
347
|
-
`,
|
|
348
|
-
n.config(
|
|
349
|
-
t.update(
|
|
351
|
+
`, mt = '.milkdown milkdown-link-preview>.link-preview{height:32px;display:flex;justify-content:center;padding:4px 10px;background:var(--crepe-color-surface);gap:10px;border-radius:8px;cursor:pointer;box-shadow:var(--crepe-shadow-1)}.milkdown milkdown-link-preview>.link-preview>.link-display:hover:before{display:block}.milkdown milkdown-link-preview>.link-preview>.link-display:before{content:"click to copy link";position:absolute;transform:translate(50%,-120%);padding:3px 10px;font-size:12px;border-radius:8px;color:color-mix(in srgb,var(--crepe-color-on-background),transparent 60%);background:var(--crepe-color-background);text-align:center;display:none}.milkdown milkdown-link-preview>.link-preview>.link-icon{padding:3px;line-height:24px}.milkdown milkdown-link-preview>.link-preview>.link-icon>svg{width:18px;height:18px}.milkdown milkdown-link-preview>.link-preview>.link-display{width:240px;line-height:24px;overflow:hidden;text-overflow:ellipsis;font-size:14px}.milkdown milkdown-link-preview>.link-preview>.link-display:hover{text-decoration:underline}.milkdown milkdown-link-preview>.link-preview>.button{padding:3px;border-radius:8px;line-height:24px}.milkdown milkdown-link-preview>.link-preview>.button>svg{width:18px;height:18px;color:var(--crepe-color-outline)}.milkdown milkdown-link-preview>.link-preview>.button:hover{background:var(--crepe-color-hover)}.milkdown milkdown-link-edit>.link-edit{height:32px;display:flex;justify-content:center;padding:4px 10px 4px 20px;background:var(--crepe-color-surface);gap:8px;border-radius:8px;box-shadow:var(--crepe-shadow-1)}.milkdown milkdown-link-edit>.link-edit>.input-area{outline:none;background:transparent;width:200px;font-size:14px;color:var(--crepe-color-on-background)}.milkdown milkdown-link-edit>.link-edit>.button{padding:3px;cursor:pointer;border-radius:8px;font-size:12px;line-height:24px}.milkdown milkdown-link-edit>.link-edit>.button>svg{width:18px;height:18px;color:var(--crepe-color-outline)}.milkdown milkdown-link-edit>.link-edit>.button:hover{background:var(--crepe-color-hover)}.milkdown milkdown-link-edit>.link-edit>.button.hidden{visibility:hidden}', Ht = (n) => {
|
|
352
|
+
n.config(et(mt)).config(ht).config((t) => {
|
|
353
|
+
t.update(D.key, (r) => ({
|
|
350
354
|
...r,
|
|
351
|
-
linkIcon: () =>
|
|
352
|
-
editButton: () =>
|
|
353
|
-
removeButton: () =>
|
|
354
|
-
confirmButton: () =>
|
|
355
|
+
linkIcon: () => kt,
|
|
356
|
+
editButton: () => ut,
|
|
357
|
+
removeButton: () => wt,
|
|
358
|
+
confirmButton: () => vt
|
|
355
359
|
}));
|
|
356
|
-
}).use(
|
|
360
|
+
}).use(ct);
|
|
357
361
|
};
|
|
358
362
|
export {
|
|
359
|
-
|
|
363
|
+
Ht as defineFeature
|
|
360
364
|
};
|
|
@@ -7,31 +7,31 @@ var a = (o, t, n) => (v(o, t, "read from private field"), n ? n.call(o) : t.get(
|
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
8
|
t instanceof WeakSet ? t.add(o) : t.set(o, n);
|
|
9
9
|
}, g = (o, t, n, c) => (v(o, t, "write to private field"), c ? c.call(o, n) : t.set(o, n), n);
|
|
10
|
-
import {
|
|
11
|
-
import { h as m, c as
|
|
10
|
+
import { Q as B, R as S, U as E, d as b, g as f, V as u, W as I, X as F, Y as O, i as P, f as R, T as k } from "./index-S3dtETwZ.js";
|
|
11
|
+
import { h as m, c as A, f as j, a as D } from "./meta-tAGyVRPE.js";
|
|
12
12
|
import { c as p } from "./clsx-7d8NmkQq.js";
|
|
13
|
-
import { a as H, t as U, T as
|
|
13
|
+
import { a as H, t as U, T as N } from "./tooltip-plugin-Pjm6nx6a.js";
|
|
14
14
|
import "./icons-HYkfuR-O.js";
|
|
15
|
-
import "./tippy.esm-
|
|
16
|
-
const
|
|
15
|
+
import "./tippy.esm-lHdsQkl8.js";
|
|
16
|
+
const Q = m`
|
|
17
17
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
18
18
|
<path d="M8.85758 18.625C8.4358 18.625 8.07715 18.4772 7.78163 18.1817C7.48613 17.8862 7.33838 17.5275 7.33838 17.1058V6.8942C7.33838 6.47242 7.48613 6.11377 7.78163 5.81825C8.07715 5.52275 8.4358 5.375 8.85758 5.375H12.1999C13.2191 5.375 14.1406 5.69231 14.9643 6.32693C15.788 6.96154 16.1999 7.81603 16.1999 8.89038C16.1999 9.63779 16.0194 10.2471 15.6585 10.7183C15.2976 11.1894 14.9088 11.5314 14.4922 11.7442C15.005 11.9211 15.4947 12.2708 15.9614 12.7933C16.428 13.3157 16.6614 14.0192 16.6614 14.9038C16.6614 16.182 16.1902 17.1217 15.2479 17.723C14.3056 18.3243 13.3563 18.625 12.3999 18.625H8.85758ZM9.4883 16.6327H12.3191C13.1063 16.6327 13.6627 16.4141 13.9884 15.9769C14.314 15.5397 14.4768 15.1205 14.4768 14.7192C14.4768 14.3179 14.314 13.8987 13.9884 13.4615C13.6627 13.0243 13.0909 12.8057 12.273 12.8057H9.4883V16.6327ZM9.4883 10.875H12.0826C12.6903 10.875 13.172 10.7013 13.5278 10.3539C13.8836 10.0064 14.0615 9.59037 14.0615 9.10575C14.0615 8.59035 13.8733 8.16918 13.497 7.84225C13.1207 7.51533 12.6595 7.35188 12.1133 7.35188H9.4883V10.875Z" fill="#817567"/>
|
|
19
19
|
</svg>
|
|
20
|
-
`,
|
|
20
|
+
`, W = m`
|
|
21
21
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
22
22
|
<path d="M6.29811 18.625C6.04505 18.625 5.83115 18.5375 5.65641 18.3626C5.48166 18.1877 5.39429 17.9736 5.39429 17.7203C5.39429 17.467 5.48166 17.2532 5.65641 17.0788C5.83115 16.9045 6.04505 16.8173 6.29811 16.8173H9.21159L12.452 7.18265H9.53851C9.28545 7.18265 9.07155 7.0952 8.89681 6.9203C8.72206 6.7454 8.63469 6.5313 8.63469 6.278C8.63469 6.02472 8.72206 5.81089 8.89681 5.63652C9.07155 5.46217 9.28545 5.375 9.53851 5.375H16.8847C17.1377 5.375 17.3516 5.46245 17.5264 5.63735C17.7011 5.81225 17.7885 6.02634 17.7885 6.27962C17.7885 6.53293 17.7011 6.74676 17.5264 6.92113C17.3516 7.09548 17.1377 7.18265 16.8847 7.18265H14.2789L11.0385 16.8173H13.6443C13.8973 16.8173 14.1112 16.9048 14.286 17.0797C14.4607 17.2546 14.5481 17.4687 14.5481 17.722C14.5481 17.9752 14.4607 18.1891 14.286 18.3634C14.1112 18.5378 13.8973 18.625 13.6443 18.625H6.29811Z" fill="#817567"/>
|
|
23
23
|
</svg>
|
|
24
|
-
`,
|
|
24
|
+
`, X = m`
|
|
25
25
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
26
26
|
<path d="M4.46924 12.0158L8.52694 16.0735C8.66541 16.212 8.73624 16.386 8.73944 16.5956C8.74266 16.8052 8.67183 16.9824 8.52694 17.1273C8.38208 17.2722 8.20644 17.3446 8.00004 17.3446C7.79364 17.3446 7.61801 17.2722 7.47315 17.1273L2.97892 12.6331C2.88532 12.5395 2.81929 12.4408 2.78084 12.3369C2.74238 12.2331 2.72314 12.1209 2.72314 12.0004C2.72314 11.8799 2.74238 11.7677 2.78084 11.6639C2.81929 11.56 2.88532 11.4613 2.97892 11.3677L7.47315 6.87351C7.62184 6.72479 7.79844 6.64882 8.00292 6.6456C8.2074 6.6424 8.38721 6.71837 8.54234 6.87351C8.69746 7.02862 8.77502 7.20682 8.77502 7.4081C8.77502 7.60937 8.69746 7.78757 8.54234 7.94271L4.46924 12.0158ZM19.5308 11.985L15.4731 7.9273C15.3347 7.78885 15.2638 7.61482 15.2606 7.40521C15.2574 7.19561 15.3283 7.01837 15.4731 6.87351C15.618 6.72862 15.7936 6.65618 16 6.65618C16.2064 6.65618 16.3821 6.72862 16.5269 6.87351L21.0212 11.3677C21.1148 11.4613 21.1808 11.56 21.2192 11.6639C21.2577 11.7677 21.2769 11.8799 21.2769 12.0004C21.2769 12.1209 21.2577 12.2331 21.2192 12.3369C21.1808 12.4408 21.1148 12.5395 21.0212 12.6331L16.5269 17.1273C16.3782 17.276 16.2042 17.3494 16.0048 17.3475C15.8055 17.3456 15.6283 17.2671 15.4731 17.1119C15.318 16.9568 15.2404 16.7786 15.2404 16.5773C15.2404 16.376 15.318 16.1978 15.4731 16.0427L19.5308 11.985Z" fill="#817567"/>
|
|
27
27
|
</svg>
|
|
28
|
-
`,
|
|
28
|
+
`, Y = m`
|
|
29
29
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
30
30
|
<path d="M17.0385 19.5003V16.5388H14.0769V15.0388H17.0385V12.0773H18.5384V15.0388H21.5V16.5388H18.5384V19.5003H17.0385ZM10.8077 16.5388H7.03845C5.78282 16.5388 4.7125 16.0963 3.8275 15.2114C2.9425 14.3266 2.5 13.2564 2.5 12.0009C2.5 10.7454 2.9425 9.67504 3.8275 8.78979C4.7125 7.90454 5.78282 7.46191 7.03845 7.46191H10.8077V8.96186H7.03845C6.1987 8.96186 5.48235 9.25834 4.8894 9.85129C4.29645 10.4442 3.99998 11.1606 3.99998 12.0003C3.99998 12.8401 4.29645 13.5564 4.8894 14.1494C5.48235 14.7423 6.1987 15.0388 7.03845 15.0388H10.8077V16.5388ZM8.25 12.7503V11.2504H15.75V12.7503H8.25ZM21.5 12.0003H20C20 11.1606 19.7035 10.4442 19.1106 9.85129C18.5176 9.25834 17.8013 8.96186 16.9615 8.96186H13.1923V7.46191H16.9615C18.2171 7.46191 19.2875 7.90441 20.1725 8.78939C21.0575 9.67439 21.5 10.7447 21.5 12.0003Z" fill="#817567"/>
|
|
31
31
|
</svg>
|
|
32
32
|
`, V = ({ ctx: o, hide: t, show: n }) => {
|
|
33
|
-
const c =
|
|
34
|
-
|
|
33
|
+
const c = j();
|
|
34
|
+
D(() => {
|
|
35
35
|
c();
|
|
36
36
|
}, [n]);
|
|
37
37
|
const s = (e) => (i) => {
|
|
@@ -49,7 +49,7 @@ const N = m`
|
|
|
49
49
|
e.get(u).call(I.key);
|
|
50
50
|
})}
|
|
51
51
|
>
|
|
52
|
-
${
|
|
52
|
+
${Q}
|
|
53
53
|
</button>
|
|
54
54
|
<button
|
|
55
55
|
class=${p("toolbar-item", o && r(S.type(o)) && "active")}
|
|
@@ -57,7 +57,7 @@ const N = m`
|
|
|
57
57
|
e.get(u).call(F.key);
|
|
58
58
|
})}
|
|
59
59
|
>
|
|
60
|
-
${
|
|
60
|
+
${W}
|
|
61
61
|
</button>
|
|
62
62
|
<div class="divider"></div>
|
|
63
63
|
<button
|
|
@@ -66,7 +66,7 @@ const N = m`
|
|
|
66
66
|
e.get(u).call(O.key);
|
|
67
67
|
})}
|
|
68
68
|
>
|
|
69
|
-
${
|
|
69
|
+
${X}
|
|
70
70
|
</button>
|
|
71
71
|
<button
|
|
72
72
|
class=${p("toolbar-item", o && r(b.type(o)) && "active")}
|
|
@@ -79,7 +79,7 @@ const N = m`
|
|
|
79
79
|
e.get(H.key).addLink(d.from, d.to), t == null || t();
|
|
80
80
|
})}
|
|
81
81
|
>
|
|
82
|
-
${
|
|
82
|
+
${Y}
|
|
83
83
|
</button>
|
|
84
84
|
</host>`;
|
|
85
85
|
};
|
|
@@ -88,7 +88,7 @@ V.props = {
|
|
|
88
88
|
hide: Function,
|
|
89
89
|
show: Boolean
|
|
90
90
|
};
|
|
91
|
-
const x =
|
|
91
|
+
const x = A(V), _ = ".milkdown milkdown-toolbar{display:flex;background:var(--crepe-color-surface);box-shadow:var(--crepe-shadow-1);border-radius:8px;overflow:hidden}.milkdown milkdown-toolbar .divider{width:1px;background:color-mix(in srgb,var(--crepe-color-outline),transparent 80%);height:24px;margin:10px}.milkdown milkdown-toolbar .toolbar-item{width:44px;height:44px;padding:10px;cursor:pointer}.milkdown milkdown-toolbar .toolbar-item:hover{background:var(--crepe-color-hover)}.milkdown milkdown-toolbar .toolbar-item.active{background:var(--crepe-color-selected)}.milkdown milkdown-toolbar .toolbar-item svg{height:24px;width:24px;color:var(--crepe-color-outline)}", y = U("CREPE_TOOLBAR");
|
|
92
92
|
var C, l;
|
|
93
93
|
class q {
|
|
94
94
|
constructor(t, n) {
|
|
@@ -102,10 +102,11 @@ class q {
|
|
|
102
102
|
a(this, C).hide();
|
|
103
103
|
};
|
|
104
104
|
const c = new x();
|
|
105
|
-
g(this, l, c), a(this, l).ctx = t, a(this, l).hide = this.hide, g(this, C, new
|
|
105
|
+
g(this, l, c), a(this, l).ctx = t, a(this, l).hide = this.hide, g(this, C, new N({
|
|
106
106
|
content: a(this, l),
|
|
107
107
|
debounce: 20,
|
|
108
108
|
tippyOptions: {
|
|
109
|
+
appendTo: () => t.get(R),
|
|
109
110
|
onShow: () => {
|
|
110
111
|
a(this, l).show = !0;
|
|
111
112
|
},
|
|
@@ -114,15 +115,15 @@ class q {
|
|
|
114
115
|
}
|
|
115
116
|
},
|
|
116
117
|
shouldShow(s) {
|
|
117
|
-
const { doc: r, selection: e } = s.state, { empty: i, from: d, to: h } = e, L = !r.textBetween(d, h).length && e instanceof k,
|
|
118
|
-
return !(
|
|
118
|
+
const { doc: r, selection: e } = s.state, { empty: i, from: d, to: h } = e, L = !r.textBetween(d, h).length && e instanceof k, M = !(e instanceof k), T = c.contains(document.activeElement), $ = !s.hasFocus() && !T, Z = !s.editable;
|
|
119
|
+
return !($ || M || i || L || Z);
|
|
119
120
|
}
|
|
120
121
|
})), this.update(n);
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
C = new WeakMap(), l = new WeakMap();
|
|
124
125
|
customElements.define("milkdown-toolbar", x);
|
|
125
|
-
const
|
|
126
|
+
const n1 = (o) => {
|
|
126
127
|
o.config(P(_)).config((t) => {
|
|
127
128
|
t.set(y.key, {
|
|
128
129
|
view: (n) => new q(t, n)
|
|
@@ -130,5 +131,5 @@ const e1 = (o) => {
|
|
|
130
131
|
}).use(y);
|
|
131
132
|
};
|
|
132
133
|
export {
|
|
133
|
-
|
|
134
|
+
n1 as defineFeature
|
|
134
135
|
};
|