@wrdagency/blockout 1.0.9 → 1.0.11
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/assets/index11.css +1 -1
- package/dist/assets/style13.css +1 -1
- package/dist/assets/style21.css +1 -1
- package/dist/components/controls/markdown-control/editor.d.ts +5 -3
- package/dist/components/controls/markdown-control/editor.js +140 -128
- package/dist/components/controls/markdown-control/index.d.ts +4 -2
- package/dist/components/controls/markdown-control/toolbar.d.ts +2 -2
- package/dist/components/controls/markdown-control/toolbar.js +1 -1
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.js +11 -8
- package/dist/hooks/keyboard.js +1 -1
- package/dist/hooks/theme.d.ts +9 -0
- package/dist/hooks/theme.js +19 -0
- package/dist/index.js +57 -54
- package/dist/{toolbar-j1SJvq8D.js → toolbar-CCiZ_PIy.js} +241 -237
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as L, jsxs as ge } from "react/jsx-runtime";
|
|
2
2
|
import { cn as ye } from "../../../utils/css.js";
|
|
3
|
-
import { r as T, w as ve, c as we, d as be, a as
|
|
4
|
-
import { $ as X, d as
|
|
5
|
-
import { l as
|
|
3
|
+
import { r as T, w as ve, c as we, d as be, a as W, h as S, b as F, p as Me, E as Ie, l as ke, e as Ee, f as Le } from "../../../toolbar-CCiZ_PIy.js";
|
|
4
|
+
import { $ as X, d as Pe, T as Y, a as ee, s as Ce, g as Oe, b as j, P as z, h as te, i as Te, j as Se, k as _e, l as Ae, m as De, M as je, n as Ne, o as ne, q as G, r as xe, I as Ue, S as Fe, t as Be, E as qe, u as ze, v as $e, w as He } from "../../../index-EPj3dCzl.js";
|
|
5
|
+
import { l as Ke, c as Re, g as We, w as Ge } from "../../../commands-IQnqt4xL.js";
|
|
6
6
|
import '../../../assets/prosemirror.css';/* empty css */
|
|
7
|
-
import { d as
|
|
7
|
+
import { d as Ve, M as Je, a as Ze, b as Qe } from "../../../index-CwFPDtaz.js";
|
|
8
8
|
import { P as Xe } from "../../../base-jB1DIMnz.js";
|
|
9
9
|
import "react";
|
|
10
10
|
import { useMentionsPlugin as Ye } from "./slash/mentions.js";
|
|
11
|
-
var et = Object.defineProperty,
|
|
11
|
+
var et = Object.defineProperty, V = Object.getOwnPropertySymbols, tt = Object.prototype.hasOwnProperty, nt = Object.prototype.propertyIsEnumerable, J = (n, e, t) => e in n ? et(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, rt = (n, e) => {
|
|
12
12
|
for (var t in e || (e = {}))
|
|
13
13
|
tt.call(e, t) && J(n, t, e[t]);
|
|
14
|
-
if (
|
|
15
|
-
for (var t of
|
|
14
|
+
if (V)
|
|
15
|
+
for (var t of V(e))
|
|
16
16
|
nt.call(e, t) && J(n, t, e[t]);
|
|
17
17
|
return n;
|
|
18
18
|
};
|
|
@@ -100,31 +100,31 @@ const it = be({
|
|
|
100
100
|
readonly: r,
|
|
101
101
|
setAttr: i,
|
|
102
102
|
onMount: o,
|
|
103
|
-
selected:
|
|
103
|
+
selected: a
|
|
104
104
|
}) {
|
|
105
|
-
const
|
|
105
|
+
const l = (u) => {
|
|
106
106
|
u != null && u instanceof Element && o(u);
|
|
107
|
-
},
|
|
107
|
+
}, c = (u) => {
|
|
108
108
|
u.stopPropagation(), u.preventDefault(), e.value != null && i("checked", !e.value);
|
|
109
|
-
}, f =
|
|
109
|
+
}, f = W(() => s.renderLabel({
|
|
110
110
|
label: n.value,
|
|
111
111
|
listType: t.value,
|
|
112
112
|
checked: e.value,
|
|
113
113
|
readonly: r.value
|
|
114
|
-
})), p =
|
|
114
|
+
})), p = W(() => e.value == null ? t.value === "bullet" ? "bullet" : "ordered" : e.value ? "checked" : "unchecked");
|
|
115
115
|
return () => /* @__PURE__ */ S(
|
|
116
116
|
"li",
|
|
117
117
|
{
|
|
118
118
|
class: F(
|
|
119
119
|
"list-item",
|
|
120
|
-
|
|
120
|
+
a.value && "ProseMirror-selectednode"
|
|
121
121
|
)
|
|
122
122
|
},
|
|
123
123
|
/* @__PURE__ */ S(
|
|
124
124
|
"div",
|
|
125
125
|
{
|
|
126
126
|
class: "label-wrapper",
|
|
127
|
-
onPointerdown:
|
|
127
|
+
onPointerdown: c,
|
|
128
128
|
contenteditable: !1
|
|
129
129
|
},
|
|
130
130
|
/* @__PURE__ */ S(
|
|
@@ -139,35 +139,35 @@ const it = be({
|
|
|
139
139
|
}
|
|
140
140
|
)
|
|
141
141
|
),
|
|
142
|
-
/* @__PURE__ */ S("div", { class: "children", ref:
|
|
142
|
+
/* @__PURE__ */ S("div", { class: "children", ref: l })
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
|
-
}), ie =
|
|
146
|
-
|
|
145
|
+
}), ie = Pe(
|
|
146
|
+
Ke.node,
|
|
147
147
|
(n) => (e, t, s) => {
|
|
148
148
|
const r = document.createElement("div");
|
|
149
149
|
r.className = "milkdown-list-item-block";
|
|
150
150
|
const i = document.createElement("div");
|
|
151
151
|
i.setAttribute("data-content-dom", "true"), i.classList.add("content-dom");
|
|
152
|
-
const o = T(e.attrs.label),
|
|
152
|
+
const o = T(e.attrs.label), a = T(e.attrs.checked), l = T(e.attrs.listType), c = T(!t.editable), f = n.get(N.key), p = T(!1), u = (d, E) => {
|
|
153
153
|
if (!t.editable) return;
|
|
154
154
|
const w = s();
|
|
155
|
-
w != null && (t.hasFocus() || t.focus(), t.dispatch(t.state.tr.setNodeAttribute(w,
|
|
155
|
+
w != null && (t.hasFocus() || t.focus(), t.dispatch(t.state.tr.setNodeAttribute(w, d, E)));
|
|
156
156
|
}, h = ve(() => {
|
|
157
157
|
p.value ? r.classList.add("selected") : r.classList.remove("selected");
|
|
158
158
|
});
|
|
159
159
|
let g = 0;
|
|
160
160
|
const b = we(it, {
|
|
161
161
|
label: o,
|
|
162
|
-
checked:
|
|
163
|
-
listType:
|
|
164
|
-
readonly:
|
|
162
|
+
checked: a,
|
|
163
|
+
listType: l,
|
|
164
|
+
readonly: c,
|
|
165
165
|
config: f,
|
|
166
166
|
selected: p,
|
|
167
167
|
setAttr: u,
|
|
168
|
-
onMount: (
|
|
168
|
+
onMount: (d) => {
|
|
169
169
|
const { anchor: E, head: w } = t.state.selection;
|
|
170
|
-
|
|
170
|
+
d.appendChild(i);
|
|
171
171
|
const _ = t.state.doc.resolve(E), he = t.state.doc.resolve(w);
|
|
172
172
|
g = requestAnimationFrame(() => {
|
|
173
173
|
if (cancelAnimationFrame(g), !_.doc.eq(t.state.doc)) return;
|
|
@@ -177,16 +177,16 @@ const it = be({
|
|
|
177
177
|
}
|
|
178
178
|
});
|
|
179
179
|
b.mount(r);
|
|
180
|
-
const O = (
|
|
181
|
-
|
|
180
|
+
const O = (d) => {
|
|
181
|
+
l.value = d.attrs.listType, o.value = d.attrs.label, a.value = d.attrs.checked, c.value = !t.editable;
|
|
182
182
|
};
|
|
183
183
|
O(e);
|
|
184
184
|
let k = e;
|
|
185
185
|
return {
|
|
186
186
|
dom: r,
|
|
187
187
|
contentDOM: i,
|
|
188
|
-
update: (
|
|
189
|
-
ignoreMutation: (
|
|
188
|
+
update: (d) => d.type !== e.type ? !1 : (d.sameMarkup(k) && d.content.eq(k.content) || (k = d, O(d)), !0),
|
|
189
|
+
ignoreMutation: (d) => !r || !i ? !0 : d.type === "selection" ? !1 : i === d.target && d.type === "attributes" ? !0 : !i.contains(d.target),
|
|
190
190
|
selectNode: () => {
|
|
191
191
|
p.value = !0;
|
|
192
192
|
},
|
|
@@ -223,7 +223,7 @@ function at(n, e) {
|
|
|
223
223
|
}), n;
|
|
224
224
|
}
|
|
225
225
|
const oe = ee((n) => {
|
|
226
|
-
const e = n.get(
|
|
226
|
+
const e = n.get(Ce);
|
|
227
227
|
n.update(Oe, (r) => ({
|
|
228
228
|
...r,
|
|
229
229
|
editable: r.editable ?? (() => !0)
|
|
@@ -234,11 +234,11 @@ const oe = ee((n) => {
|
|
|
234
234
|
props: {
|
|
235
235
|
handlePaste: (r, i) => {
|
|
236
236
|
var O, k;
|
|
237
|
-
const o = n.get(Te),
|
|
238
|
-
if (!
|
|
239
|
-
const f =
|
|
237
|
+
const o = n.get(Te), a = (k = (O = r.props).editable) == null ? void 0 : k.call(O, r.state), { clipboardData: l } = i;
|
|
238
|
+
if (!a || !l || r.state.selection.$from.node().type.spec.code) return !1;
|
|
239
|
+
const f = l.getData("text/plain"), p = l.getData("vscode-editor-data");
|
|
240
240
|
if (p) {
|
|
241
|
-
const
|
|
241
|
+
const d = JSON.parse(p), E = d == null ? void 0 : d.mode;
|
|
242
242
|
if (f && E) {
|
|
243
243
|
const { tr: w } = r.state, _ = Se("code_block", e);
|
|
244
244
|
return w.replaceSelectionWith(_.create({ language: E })).setSelection(
|
|
@@ -249,25 +249,25 @@ const oe = ee((n) => {
|
|
|
249
249
|
`)), r.dispatch(w), !0;
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
const u =
|
|
252
|
+
const u = l.getData("text/html");
|
|
253
253
|
if (u.length === 0 && f.length === 0) return !1;
|
|
254
254
|
const h = _e.fromSchema(e);
|
|
255
255
|
let g;
|
|
256
256
|
if (u.length === 0) {
|
|
257
|
-
const
|
|
258
|
-
if (!
|
|
257
|
+
const d = o(f);
|
|
258
|
+
if (!d || typeof d == "string") return !1;
|
|
259
259
|
g = Ae.fromSchema(e).serializeFragment(
|
|
260
|
-
|
|
260
|
+
d.content
|
|
261
261
|
);
|
|
262
262
|
} else {
|
|
263
|
-
const
|
|
264
|
-
|
|
263
|
+
const d = document.createElement("template");
|
|
264
|
+
d.innerHTML = u, g = d.content.cloneNode(!0), d.remove();
|
|
265
265
|
}
|
|
266
|
-
const
|
|
266
|
+
const C = h.parseSlice(g), b = De(C);
|
|
267
267
|
if (b)
|
|
268
268
|
return r.dispatch(r.state.tr.replaceSelectionWith(b, !0)), !0;
|
|
269
269
|
try {
|
|
270
|
-
return r.dispatch(r.state.tr.replaceSelection(
|
|
270
|
+
return r.dispatch(r.state.tr.replaceSelection(C)), !0;
|
|
271
271
|
} catch {
|
|
272
272
|
return !1;
|
|
273
273
|
}
|
|
@@ -282,8 +282,8 @@ const oe = ee((n) => {
|
|
|
282
282
|
|
|
283
283
|
`
|
|
284
284
|
);
|
|
285
|
-
const
|
|
286
|
-
return
|
|
285
|
+
const a = e.topNodeType.createAndFill(void 0, r.content);
|
|
286
|
+
return a ? i(a) : "";
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
});
|
|
@@ -332,13 +332,13 @@ var ae = /* @__PURE__ */ function(n) {
|
|
|
332
332
|
return r == 0 && i == this.length ? this : new e(this.values.slice(r, i));
|
|
333
333
|
}, e.prototype.getInner = function(r) {
|
|
334
334
|
return this.values[r];
|
|
335
|
-
}, e.prototype.forEachInner = function(r, i, o,
|
|
336
|
-
for (var
|
|
337
|
-
if (r(this.values[
|
|
335
|
+
}, e.prototype.forEachInner = function(r, i, o, a) {
|
|
336
|
+
for (var l = i; l < o; l++)
|
|
337
|
+
if (r(this.values[l], a + l) === !1)
|
|
338
338
|
return !1;
|
|
339
|
-
}, e.prototype.forEachInvertedInner = function(r, i, o,
|
|
340
|
-
for (var
|
|
341
|
-
if (r(this.values[
|
|
339
|
+
}, e.prototype.forEachInvertedInner = function(r, i, o, a) {
|
|
340
|
+
for (var l = i - 1; l >= o; l--)
|
|
341
|
+
if (r(this.values[l], a + l) === !1)
|
|
342
342
|
return !1;
|
|
343
343
|
}, e.prototype.leafAppend = function(r) {
|
|
344
344
|
if (this.length + r.length <= D)
|
|
@@ -362,12 +362,12 @@ var lt = /* @__PURE__ */ function(n) {
|
|
|
362
362
|
}, e.prototype.getInner = function(s) {
|
|
363
363
|
return s < this.left.length ? this.left.get(s) : this.right.get(s - this.left.length);
|
|
364
364
|
}, e.prototype.forEachInner = function(s, r, i, o) {
|
|
365
|
-
var
|
|
366
|
-
if (r <
|
|
365
|
+
var a = this.left.length;
|
|
366
|
+
if (r < a && this.left.forEachInner(s, r, Math.min(i, a), o) === !1 || i > a && this.right.forEachInner(s, Math.max(r - a, 0), Math.min(this.length, i) - a, o + a) === !1)
|
|
367
367
|
return !1;
|
|
368
368
|
}, e.prototype.forEachInvertedInner = function(s, r, i, o) {
|
|
369
|
-
var
|
|
370
|
-
if (r >
|
|
369
|
+
var a = this.left.length;
|
|
370
|
+
if (r > a && this.right.forEachInvertedInner(s, r - a, Math.max(i, a) - a, o + a) === !1 || i < a && this.left.forEachInvertedInner(s, Math.min(r, a), i, o) === !1)
|
|
371
371
|
return !1;
|
|
372
372
|
}, e.prototype.sliceInner = function(s, r) {
|
|
373
373
|
if (s == 0 && r == this.length)
|
|
@@ -404,7 +404,7 @@ class y {
|
|
|
404
404
|
}
|
|
405
405
|
let r, i;
|
|
406
406
|
t && (r = this.remapping(s, this.items.length), i = r.maps.length);
|
|
407
|
-
let o = e.tr,
|
|
407
|
+
let o = e.tr, a, l, c = [], f = [];
|
|
408
408
|
return this.items.forEach((p, u) => {
|
|
409
409
|
if (!p.step) {
|
|
410
410
|
r || (r = this.remapping(s, u + 1), i = r.maps.length), i--, f.push(p);
|
|
@@ -413,22 +413,22 @@ class y {
|
|
|
413
413
|
if (r) {
|
|
414
414
|
f.push(new v(p.map));
|
|
415
415
|
let h = p.step.map(r.slice(i)), g;
|
|
416
|
-
h && o.maybeStep(h).doc && (g = o.mapping.maps[o.mapping.maps.length - 1],
|
|
416
|
+
h && o.maybeStep(h).doc && (g = o.mapping.maps[o.mapping.maps.length - 1], c.push(new v(g, void 0, void 0, c.length + f.length))), i--, g && r.appendMap(g, i);
|
|
417
417
|
} else
|
|
418
418
|
o.maybeStep(p.step);
|
|
419
419
|
if (p.selection)
|
|
420
|
-
return
|
|
421
|
-
}, this.items.length, 0), { remaining:
|
|
420
|
+
return a = r ? p.selection.map(r.slice(i)) : p.selection, l = new y(this.items.slice(0, s).append(f.reverse().concat(c)), this.eventCount - 1), !1;
|
|
421
|
+
}, this.items.length, 0), { remaining: l, transform: o, selection: a };
|
|
422
422
|
}
|
|
423
423
|
// Create a new branch with the given transform added.
|
|
424
424
|
addTransform(e, t, s, r) {
|
|
425
|
-
let i = [], o = this.eventCount,
|
|
425
|
+
let i = [], o = this.eventCount, a = this.items, l = !r && a.length ? a.get(a.length - 1) : null;
|
|
426
426
|
for (let f = 0; f < e.steps.length; f++) {
|
|
427
427
|
let p = e.steps[f].invert(e.docs[f]), u = new v(e.mapping.maps[f], p, t), h;
|
|
428
|
-
(h =
|
|
428
|
+
(h = l && l.merge(u)) && (u = h, f ? i.pop() : a = a.slice(0, a.length - 1)), i.push(u), t && (o++, t = void 0), r || (l = u);
|
|
429
429
|
}
|
|
430
|
-
let
|
|
431
|
-
return
|
|
430
|
+
let c = o - s.depth;
|
|
431
|
+
return c > ct && (a = ut(a, c), o -= c), new y(a.append(i), o);
|
|
432
432
|
}
|
|
433
433
|
remapping(e, t) {
|
|
434
434
|
let s = new je();
|
|
@@ -447,27 +447,27 @@ class y {
|
|
|
447
447
|
rebased(e, t) {
|
|
448
448
|
if (!this.eventCount)
|
|
449
449
|
return this;
|
|
450
|
-
let s = [], r = Math.max(0, this.items.length - t), i = e.mapping, o = e.steps.length,
|
|
450
|
+
let s = [], r = Math.max(0, this.items.length - t), i = e.mapping, o = e.steps.length, a = this.eventCount;
|
|
451
451
|
this.items.forEach((u) => {
|
|
452
|
-
u.selection &&
|
|
452
|
+
u.selection && a--;
|
|
453
453
|
}, r);
|
|
454
|
-
let
|
|
454
|
+
let l = t;
|
|
455
455
|
this.items.forEach((u) => {
|
|
456
|
-
let h = i.getMirror(--
|
|
456
|
+
let h = i.getMirror(--l);
|
|
457
457
|
if (h == null)
|
|
458
458
|
return;
|
|
459
459
|
o = Math.min(o, h);
|
|
460
460
|
let g = i.maps[h];
|
|
461
461
|
if (u.step) {
|
|
462
|
-
let
|
|
463
|
-
b &&
|
|
462
|
+
let C = e.steps[h].invert(e.docs[h]), b = u.selection && u.selection.map(i.slice(l + 1, h));
|
|
463
|
+
b && a++, s.push(new v(g, C, b));
|
|
464
464
|
} else
|
|
465
465
|
s.push(new v(g));
|
|
466
466
|
}, r);
|
|
467
|
-
let
|
|
467
|
+
let c = [];
|
|
468
468
|
for (let u = t; u < o; u++)
|
|
469
|
-
|
|
470
|
-
let f = this.items.slice(0, r).append(
|
|
469
|
+
c.push(new v(i.maps[u]));
|
|
470
|
+
let f = this.items.slice(0, r).append(c).append(s), p = new y(f, a);
|
|
471
471
|
return p.emptyItemCount() > pt && (p = p.compress(this.items.length - s.length)), p;
|
|
472
472
|
}
|
|
473
473
|
emptyItemCount() {
|
|
@@ -484,15 +484,15 @@ class y {
|
|
|
484
484
|
// order to associate old items with rebased steps.
|
|
485
485
|
compress(e = this.items.length) {
|
|
486
486
|
let t = this.remapping(0, e), s = t.maps.length, r = [], i = 0;
|
|
487
|
-
return this.items.forEach((o,
|
|
488
|
-
if (
|
|
487
|
+
return this.items.forEach((o, a) => {
|
|
488
|
+
if (a >= e)
|
|
489
489
|
r.push(o), o.selection && i++;
|
|
490
490
|
else if (o.step) {
|
|
491
|
-
let
|
|
492
|
-
if (s--,
|
|
491
|
+
let l = o.step.map(t.slice(s)), c = l && l.getMap();
|
|
492
|
+
if (s--, c && t.appendMap(c, s), l) {
|
|
493
493
|
let f = o.selection && o.selection.map(t.slice(s));
|
|
494
494
|
f && i++;
|
|
495
|
-
let p = new v(
|
|
495
|
+
let p = new v(c.invert(), l, f), u, h = r.length - 1;
|
|
496
496
|
(u = r.length && r[h].merge(p)) ? r[h] = u : r.push(p);
|
|
497
497
|
}
|
|
498
498
|
} else o.map && s--;
|
|
@@ -536,8 +536,8 @@ function dt(n, e, t, s) {
|
|
|
536
536
|
if (o && o.getMeta(I))
|
|
537
537
|
return o.getMeta(I).redo ? new M(n.done.addTransform(t, void 0, s, A(e)), n.undone, Z(t.mapping.maps), n.prevTime, n.prevComposition) : new M(n.done, n.undone.addTransform(t, void 0, s, A(e)), null, n.prevTime, n.prevComposition);
|
|
538
538
|
if (t.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
539
|
-
let
|
|
540
|
-
return new M(n.done.addTransform(t,
|
|
539
|
+
let a = t.getMeta("composition"), l = n.prevTime == 0 || !o && n.prevComposition != a && (n.prevTime < (t.time || 0) - s.newGroupDelay || !ft(t, n.prevRanges)), c = o ? x(n.prevRanges, t.mapping) : Z(t.mapping.maps);
|
|
540
|
+
return new M(n.done.addTransform(t, l ? e.selection.getBookmark() : void 0, s, A(e)), y.empty, c, t.time, a ?? n.prevComposition);
|
|
541
541
|
} else return (i = t.getMeta("rebased")) ? new M(n.done.rebased(t, i), n.undone.rebased(t, i), x(n.prevRanges, t.mapping), n.prevTime, n.prevComposition) : new M(n.done.addMaps(t.mapping.maps), n.undone.addMaps(t.mapping.maps), x(n.prevRanges, t.mapping), n.prevTime, n.prevComposition);
|
|
542
542
|
}
|
|
543
543
|
function ft(n, e) {
|
|
@@ -571,8 +571,8 @@ function ht(n, e, t) {
|
|
|
571
571
|
let s = A(e), r = I.get(e).spec.config, i = (t ? n.undone : n.done).popEvent(e, s);
|
|
572
572
|
if (!i)
|
|
573
573
|
return null;
|
|
574
|
-
let o = i.selection.resolve(i.transform.doc),
|
|
575
|
-
return i.transform.setSelection(o).setMeta(I, { redo: t, historyState:
|
|
574
|
+
let o = i.selection.resolve(i.transform.doc), a = (t ? n.done : n.undone).addTransform(i.transform, e.selection.getBookmark(), r, s), l = new M(t ? a : i.remaining, t ? i.remaining : a, null, 0, -1);
|
|
575
|
+
return i.transform.setSelection(o).setMeta(I, { redo: t, historyState: l });
|
|
576
576
|
}
|
|
577
577
|
let U = !1, Q = null;
|
|
578
578
|
function A(n) {
|
|
@@ -626,7 +626,7 @@ function le(n, e) {
|
|
|
626
626
|
};
|
|
627
627
|
}
|
|
628
628
|
const pe = le(!1, !0), ue = le(!0, !0);
|
|
629
|
-
function
|
|
629
|
+
function P(n, e) {
|
|
630
630
|
return Object.assign(n, {
|
|
631
631
|
meta: {
|
|
632
632
|
package: "@milkdown/plugin-history",
|
|
@@ -634,52 +634,52 @@ function L(n, e) {
|
|
|
634
634
|
}
|
|
635
635
|
}), n;
|
|
636
636
|
}
|
|
637
|
-
const
|
|
638
|
-
|
|
637
|
+
const $ = ne("Undo", () => () => pe);
|
|
638
|
+
P($, {
|
|
639
639
|
displayName: "Command<undo>"
|
|
640
640
|
});
|
|
641
|
-
const
|
|
642
|
-
|
|
641
|
+
const H = ne("Redo", () => () => ue);
|
|
642
|
+
P(H, {
|
|
643
643
|
displayName: "Command<redo>"
|
|
644
644
|
});
|
|
645
|
-
const
|
|
646
|
-
|
|
645
|
+
const K = X({}, "historyProviderConfig");
|
|
646
|
+
P(K, {
|
|
647
647
|
displayName: "Ctx<historyProviderConfig>"
|
|
648
648
|
});
|
|
649
649
|
const ce = ee(
|
|
650
|
-
(n) => gt(n.get(
|
|
650
|
+
(n) => gt(n.get(K.key))
|
|
651
651
|
);
|
|
652
|
-
|
|
652
|
+
P(ce, {
|
|
653
653
|
displayName: "Ctx<historyProviderPlugin>"
|
|
654
654
|
});
|
|
655
|
-
const
|
|
655
|
+
const R = Ne("historyKeymap", {
|
|
656
656
|
Undo: {
|
|
657
657
|
shortcuts: "Mod-z",
|
|
658
658
|
command: (n) => {
|
|
659
|
-
const e = n.get(
|
|
660
|
-
return () => e.call(
|
|
659
|
+
const e = n.get(G);
|
|
660
|
+
return () => e.call($.key);
|
|
661
661
|
}
|
|
662
662
|
},
|
|
663
663
|
Redo: {
|
|
664
664
|
shortcuts: ["Mod-y", "Shift-Mod-z"],
|
|
665
665
|
command: (n) => {
|
|
666
|
-
const e = n.get(
|
|
667
|
-
return () => e.call(
|
|
666
|
+
const e = n.get(G);
|
|
667
|
+
return () => e.call(H.key);
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
670
|
});
|
|
671
|
-
|
|
671
|
+
P(R.ctx, {
|
|
672
672
|
displayName: "KeymapCtx<history>"
|
|
673
673
|
});
|
|
674
|
-
|
|
674
|
+
P(R.shortcuts, {
|
|
675
675
|
displayName: "Keymap<history>"
|
|
676
676
|
});
|
|
677
677
|
const yt = [
|
|
678
|
-
|
|
678
|
+
K,
|
|
679
679
|
ce,
|
|
680
|
+
R,
|
|
680
681
|
$,
|
|
681
|
-
H
|
|
682
|
-
K
|
|
682
|
+
H
|
|
683
683
|
].flat();
|
|
684
684
|
class de {
|
|
685
685
|
constructor() {
|
|
@@ -731,32 +731,32 @@ const q = xe(
|
|
|
731
731
|
), vt = new j("MILKDOWN_LISTENER"), fe = (n) => (n.inject(q, new de()), async () => {
|
|
732
732
|
await n.wait(Ue);
|
|
733
733
|
const e = n.get(q), { listeners: t } = e;
|
|
734
|
-
t.beforeMount.forEach((
|
|
734
|
+
t.beforeMount.forEach((l) => l(n)), await n.wait(Fe);
|
|
735
735
|
const s = n.get(te);
|
|
736
736
|
let r = null, i = null, o = null;
|
|
737
|
-
const
|
|
737
|
+
const a = new z({
|
|
738
738
|
key: vt,
|
|
739
739
|
view: () => ({
|
|
740
740
|
destroy: () => {
|
|
741
|
-
t.destroy.forEach((
|
|
741
|
+
t.destroy.forEach((l) => l(n));
|
|
742
742
|
}
|
|
743
743
|
}),
|
|
744
744
|
props: {
|
|
745
745
|
handleDOMEvents: {
|
|
746
|
-
focus: () => (t.focus.forEach((
|
|
747
|
-
blur: () => (t.blur.forEach((
|
|
746
|
+
focus: () => (t.focus.forEach((l) => l(n)), !1),
|
|
747
|
+
blur: () => (t.blur.forEach((l) => l(n)), !1)
|
|
748
748
|
}
|
|
749
749
|
},
|
|
750
750
|
state: {
|
|
751
|
-
init: (
|
|
752
|
-
r =
|
|
751
|
+
init: (l, c) => {
|
|
752
|
+
r = c.doc, i = s(c.doc);
|
|
753
753
|
},
|
|
754
|
-
apply: (
|
|
755
|
-
const
|
|
756
|
-
return (!o &&
|
|
757
|
-
p(n,
|
|
758
|
-
}), o =
|
|
759
|
-
const { doc: p } =
|
|
754
|
+
apply: (l) => {
|
|
755
|
+
const c = l.selection;
|
|
756
|
+
return (!o && c || o && !c.eq(o)) && (t.selectionUpdated.forEach((p) => {
|
|
757
|
+
p(n, c, o);
|
|
758
|
+
}), o = c), !(l.docChanged || l.storedMarksSet) || l.getMeta("addToHistory") === !1 ? void 0 : Ve(() => {
|
|
759
|
+
const { doc: p } = l;
|
|
760
760
|
if (t.updated.length > 0 && r && !r.eq(p) && t.updated.forEach((u) => {
|
|
761
761
|
u(n, p, r);
|
|
762
762
|
}), t.markdownUpdated.length > 0 && r && !r.eq(p)) {
|
|
@@ -770,7 +770,7 @@ const q = xe(
|
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
772
|
});
|
|
773
|
-
n.update(Be, (
|
|
773
|
+
n.update(Be, (l) => l.concat(a)), await n.wait(qe), t.mounted.forEach((l) => l(n));
|
|
774
774
|
});
|
|
775
775
|
fe.meta = {
|
|
776
776
|
package: "@milkdown/plugin-listener",
|
|
@@ -779,29 +779,41 @@ fe.meta = {
|
|
|
779
779
|
const wt = ({
|
|
780
780
|
className: n,
|
|
781
781
|
value: e,
|
|
782
|
-
onChangeValue: t
|
|
782
|
+
onChangeValue: t,
|
|
783
|
+
children: s,
|
|
784
|
+
toolbar: r = "top"
|
|
783
785
|
}) => {
|
|
784
|
-
const
|
|
786
|
+
const i = Ye();
|
|
785
787
|
return Ze(
|
|
786
|
-
(
|
|
787
|
-
|
|
788
|
-
t(
|
|
789
|
-
}),
|
|
788
|
+
(o) => ze.make().config((a) => {
|
|
789
|
+
a.set($e, o), a.set(He, e || ""), a.get(q).markdownUpdated((c, f) => {
|
|
790
|
+
t == null || t(f);
|
|
791
|
+
}), a.set(N.key, {
|
|
790
792
|
renderLabel: () => ""
|
|
791
|
-
}),
|
|
792
|
-
...
|
|
793
|
+
}), a.update(ke.key, (c) => ({
|
|
794
|
+
...c,
|
|
793
795
|
linkIcon: "",
|
|
794
796
|
editButton: "",
|
|
795
797
|
removeButton: "",
|
|
796
798
|
confirmButton: "",
|
|
797
799
|
inputPlaceholder: "Enter a URL..."
|
|
798
|
-
})),
|
|
799
|
-
}).use(fe).use(
|
|
800
|
-
), /* @__PURE__ */ ge(
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
800
|
+
})), i.config(a);
|
|
801
|
+
}).use(fe).use(Re).use(We).use(oe).use(yt).use(ot).use(Ge).config(Ee).use(Le).use(i.plugin)
|
|
802
|
+
), /* @__PURE__ */ ge(
|
|
803
|
+
"div",
|
|
804
|
+
{
|
|
805
|
+
className: ye(
|
|
806
|
+
"component-markdown-editor",
|
|
807
|
+
r && `component-markdown-editor--toolbar-${r}`,
|
|
808
|
+
n
|
|
809
|
+
),
|
|
810
|
+
children: [
|
|
811
|
+
r && /* @__PURE__ */ L(Ie, { className: "component-markdown-editor__toolbar", children: s }),
|
|
812
|
+
/* @__PURE__ */ L("div", { className: "component-markdown-editor__content", children: /* @__PURE__ */ L(Qe, {}) })
|
|
813
|
+
]
|
|
814
|
+
}
|
|
815
|
+
);
|
|
816
|
+
}, St = (n) => /* @__PURE__ */ L(Je, { children: /* @__PURE__ */ L(Xe, { children: /* @__PURE__ */ L(wt, { ...n }) }) });
|
|
805
817
|
export {
|
|
806
818
|
St as MarkdownEditor
|
|
807
819
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
1
2
|
import { ControlFC } from '../base-control/props';
|
|
2
|
-
interface MarkdownControlProps {
|
|
3
|
+
interface MarkdownControlProps extends PropsWithChildren {
|
|
3
4
|
value?: string;
|
|
4
|
-
onChangeValue
|
|
5
|
+
onChangeValue?: (value: string) => void;
|
|
6
|
+
toolbar?: "top" | "bottom" | false;
|
|
5
7
|
}
|
|
6
8
|
export declare const MarkdownControl: ControlFC<MarkdownControlProps>;
|
|
7
9
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../../toolbar/index.js";
|
|
3
3
|
import "../../../index-CwFPDtaz.js";
|
|
4
|
-
import { E as b } from "../../../toolbar-
|
|
4
|
+
import { E as b } from "../../../toolbar-CCiZ_PIy.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "../../../commands-IQnqt4xL.js";
|
|
7
7
|
import "../../../index-EPj3dCzl.js";
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { useSplitInput } from './input';
|
|
2
|
-
export { useModifiers } from './keyboard';
|
|
2
|
+
export { useHotkey, useModifiers } from './keyboard';
|
|
3
3
|
export { useSelection, type Selection, type SelectionMode } from './selection';
|
|
4
4
|
export { useObjectState } from './state';
|
|
5
5
|
export { useTemporaryChange } from './temporary';
|
|
6
|
+
export { useTheme } from './theme';
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { useSplitInput as r } from "./input.js";
|
|
2
|
-
import {
|
|
3
|
-
import { useSelection as
|
|
4
|
-
import { useObjectState as
|
|
5
|
-
import { useTemporaryChange as
|
|
2
|
+
import { useHotkey as p, useModifiers as m } from "./keyboard.js";
|
|
3
|
+
import { useSelection as u } from "./selection.js";
|
|
4
|
+
import { useObjectState as x } from "./state.js";
|
|
5
|
+
import { useTemporaryChange as a } from "./temporary.js";
|
|
6
|
+
import { useTheme as S } from "./theme.js";
|
|
6
7
|
export {
|
|
7
|
-
p as
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
p as useHotkey,
|
|
9
|
+
m as useModifiers,
|
|
10
|
+
x as useObjectState,
|
|
11
|
+
u as useSelection,
|
|
10
12
|
r as useSplitInput,
|
|
11
|
-
|
|
13
|
+
a as useTemporaryChange,
|
|
14
|
+
S as useTheme
|
|
12
15
|
};
|
package/dist/hooks/keyboard.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { u as m } from "../index-D7vLJIGX.js";
|
|
2
|
+
import { useEffect as r } from "react";
|
|
3
|
+
function h() {
|
|
4
|
+
const [e, t] = m("blockout__theme", "light");
|
|
5
|
+
return r(() => {
|
|
6
|
+
document.documentElement.dataset.colourScheme = e;
|
|
7
|
+
}, [e]), {
|
|
8
|
+
theme: e,
|
|
9
|
+
isDark: e === "dark",
|
|
10
|
+
isLight: e === "light",
|
|
11
|
+
toggle: () => {
|
|
12
|
+
t((o) => o === "light" ? "dark" : "light");
|
|
13
|
+
},
|
|
14
|
+
set: t
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
h as useTheme
|
|
19
|
+
};
|