@wrdagency/blockout 1.0.11 → 1.0.13
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/index20.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/style10.css +1 -1
- package/dist/assets/style13.css +1 -1
- package/dist/assets/style8.css +1 -1
- package/dist/assets/style9.css +1 -1
- package/dist/components/breadcrumbs/index.js +39 -26
- package/dist/components/button/button.js +28 -15
- package/dist/components/button/icon.js +1 -1
- package/dist/components/controls/base-popover-control/index.js +1 -1
- package/dist/components/controls/checkbox-control/index.js +1 -1
- package/dist/components/controls/choice-control/choice.js +1 -1
- package/dist/components/controls/choice-control/index.js +1 -1
- package/dist/components/controls/date-control/index.js +1 -1
- package/dist/components/controls/list-control/item.js +1 -1
- package/dist/components/controls/markdown-control/editor.d.ts +3 -1
- package/dist/components/controls/markdown-control/editor.js +212 -193
- package/dist/components/controls/markdown-control/index.d.ts +3 -1
- package/dist/components/controls/recurrence-control/index.js +1 -1
- package/dist/components/controls/select-control/control.d.ts +7 -1
- package/dist/components/controls/select-control/control.js +35 -26
- package/dist/components/controls/select-control/select.js +1 -1
- package/dist/components/controls/tag-control/props.js +1 -1
- package/dist/components/controls/toggle-control/index.js +1 -1
- package/dist/components/controls/toggle-group-control/index.js +1 -1
- package/dist/components/data-form/status.js +1 -1
- package/dist/components/data-form/submit.js +1 -1
- package/dist/components/data-view/data/filter.js +2 -2
- package/dist/components/data-view/index.js +1 -1
- package/dist/components/data-view/layouts/grid/group.js +2 -2
- package/dist/components/data-view/layouts/grid/item.js +2 -2
- package/dist/components/data-view/layouts/kanban/group.js +2 -2
- package/dist/components/data-view/layouts/kanban/item.js +2 -2
- package/dist/components/data-view/layouts/kanban/root.js +1 -1
- package/dist/components/data-view/layouts/list/group.js +2 -2
- package/dist/components/data-view/layouts/list/item.js +2 -2
- package/dist/components/data-view/layouts/table/empty.js +2 -2
- package/dist/components/data-view/layouts/table/group.js +3 -3
- package/dist/components/data-view/layouts/table/item.js +3 -3
- package/dist/components/data-view/layouts/table/root.js +2 -2
- package/dist/components/data-view/parts/body/empty.js +1 -1
- package/dist/components/data-view/parts/body/index.js +4 -4
- package/dist/components/data-view/parts/controls/index.js +2 -2
- package/dist/components/data-view/parts/controls/search.js +2 -2
- package/dist/components/data-view/parts/filters/chip.js +1 -1
- package/dist/components/data-view/parts/filters/editor.js +1 -1
- package/dist/components/data-view/parts/footer/actions.js +2 -2
- package/dist/components/data-view/parts/footer/index.js +2 -2
- package/dist/components/data-view/parts/footer/selection.js +2 -2
- package/dist/components/data-view/parts/view-control/index.js +2 -2
- package/dist/components/data-view/root.js +2 -2
- package/dist/components/data-view/slots/group/checkbox.js +3 -3
- package/dist/components/data-view/slots/group/context.js +1 -1
- package/dist/components/data-view/slots/group/icon.js +1 -1
- package/dist/components/data-view/slots/group/index.js +1 -1
- package/dist/components/data-view/slots/group/label.js +1 -1
- package/dist/components/data-view/slots/index.js +3 -3
- package/dist/components/data-view/slots/item/actions.js +1 -1
- package/dist/components/data-view/slots/item/checkbox.js +2 -2
- package/dist/components/data-view/slots/item/depth.js +3 -3
- package/dist/components/data-view/slots/item/description.js +1 -1
- package/dist/components/data-view/slots/item/index.js +1 -1
- package/dist/components/data-view/slots/item/properties.js +2 -2
- package/dist/components/data-view/slots/item/relations.js +4 -4
- package/dist/components/data-view/slots/item/tags.js +1 -1
- package/dist/components/data-view/slots/item/thumbnail.js +1 -1
- package/dist/components/data-view/slots/item/title.js +2 -2
- package/dist/components/data-view/slots/item/util.js +2 -2
- package/dist/components/data-view/slots/property/field/editable.js +2 -2
- package/dist/components/data-view/slots/property/field/index.js +1 -1
- package/dist/components/data-view/slots/property/field/static.js +1 -1
- package/dist/components/data-view/slots/property/index.js +1 -1
- package/dist/components/data-view/slots/property/label.js +1 -1
- package/dist/components/data-view/slots/root/checkbox.js +2 -2
- package/dist/components/data-view/slots/root/index.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/progress/index.js +1 -1
- package/dist/components/shell/pane.js +1 -1
- package/dist/components/shell/root.js +15 -27
- package/dist/components/window/index.js +1 -1
- package/dist/{filter-GoxwLwkT.js → filter-DAMRLXNe.js} +1 -1
- package/dist/{index-C_xrLeQq.js → index-CPOlz97j.js} +3 -3
- package/dist/{index-DJ2XZnew.js → index-ClExU5xD.js} +2 -2
- package/dist/{index-DpV0obFX.js → index-CoFfLb68.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/primitives/colourway/index.js +1 -1
- package/dist/primitives/link/index.d.ts +5 -2
- package/dist/primitives/link/index.js +22 -17
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as C, 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 W, h as S, b as F, p 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 Ie, E as Me, l as ke, e as Ee, f as Ce } from "../../../toolbar-CCiZ_PIy.js";
|
|
4
|
+
import { $ as X, d as Le, T as Y, a as ee, s as Pe, g as Oe, b as N, P as z, h as te, i as Te, j as Se, k as _e, l as Ae, m as De, M as Ne, n as je, o as ne, q as G, r as xe, I as Ue, S as Fe, t as Be, E as qe, e as ze, u as $e, v as He, w as Ke } from "../../../index-EPj3dCzl.js";
|
|
5
|
+
import { l as Re, c as We, g as Ge, w as Ve } from "../../../commands-IQnqt4xL.js";
|
|
6
6
|
import '../../../assets/prosemirror.css';/* empty css */
|
|
7
|
-
import { d as
|
|
8
|
-
import { P as
|
|
9
|
-
import "react";
|
|
10
|
-
import { useMentionsPlugin as
|
|
11
|
-
var
|
|
7
|
+
import { d as Je, M as Ze, a as Qe, u as Xe, b as Ye } from "../../../index-CwFPDtaz.js";
|
|
8
|
+
import { P as et } from "../../../base-jB1DIMnz.js";
|
|
9
|
+
import { useEffect as tt } from "react";
|
|
10
|
+
import { useMentionsPlugin as nt } from "./slash/mentions.js";
|
|
11
|
+
var rt = Object.defineProperty, V = Object.getOwnPropertySymbols, st = Object.prototype.hasOwnProperty, it = Object.prototype.propertyIsEnumerable, J = (n, e, t) => e in n ? rt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, ot = (n, e) => {
|
|
12
12
|
for (var t in e || (e = {}))
|
|
13
|
-
|
|
13
|
+
st.call(e, t) && J(n, t, e[t]);
|
|
14
14
|
if (V)
|
|
15
15
|
for (var t of V(e))
|
|
16
|
-
|
|
16
|
+
it.call(e, t) && J(n, t, e[t]);
|
|
17
17
|
return n;
|
|
18
18
|
};
|
|
19
19
|
function re(n, e) {
|
|
20
20
|
return Object.assign(n, {
|
|
21
|
-
meta:
|
|
21
|
+
meta: ot({
|
|
22
22
|
package: "@milkdown/components"
|
|
23
23
|
}, e)
|
|
24
24
|
}), n;
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const at = {
|
|
27
27
|
renderLabel: ({ label: n, listType: e, checked: t }) => t == null ? e === "bullet" ? "⦿" : n : t ? "☑" : "□"
|
|
28
|
-
},
|
|
29
|
-
|
|
28
|
+
}, j = X(
|
|
29
|
+
at,
|
|
30
30
|
"listItemBlockConfigCtx"
|
|
31
31
|
);
|
|
32
|
-
re(
|
|
32
|
+
re(j, {
|
|
33
33
|
displayName: "Config<list-item-block>",
|
|
34
34
|
group: "ListItemBlock"
|
|
35
35
|
});
|
|
@@ -39,7 +39,7 @@ function se({ icon: n, class: e, onClick: t }) {
|
|
|
39
39
|
{
|
|
40
40
|
class: F("milkdown-icon", e),
|
|
41
41
|
onPointerdown: t,
|
|
42
|
-
innerHTML: n ?
|
|
42
|
+
innerHTML: n ? Ie.sanitize(n.trim()) : void 0
|
|
43
43
|
}
|
|
44
44
|
);
|
|
45
45
|
}
|
|
@@ -57,7 +57,7 @@ se.props = {
|
|
|
57
57
|
required: !1
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
const
|
|
60
|
+
const lt = be({
|
|
61
61
|
props: {
|
|
62
62
|
label: {
|
|
63
63
|
type: Object,
|
|
@@ -100,13 +100,13 @@ const it = be({
|
|
|
100
100
|
readonly: r,
|
|
101
101
|
setAttr: i,
|
|
102
102
|
onMount: o,
|
|
103
|
-
selected:
|
|
103
|
+
selected: l
|
|
104
104
|
}) {
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
},
|
|
105
|
+
const a = (c) => {
|
|
106
|
+
c != null && c instanceof Element && o(c);
|
|
107
|
+
}, u = (c) => {
|
|
108
|
+
c.stopPropagation(), c.preventDefault(), e.value != null && i("checked", !e.value);
|
|
109
|
+
}, d = W(() => s.renderLabel({
|
|
110
110
|
label: n.value,
|
|
111
111
|
listType: t.value,
|
|
112
112
|
checked: e.value,
|
|
@@ -117,14 +117,14 @@ const it = be({
|
|
|
117
117
|
{
|
|
118
118
|
class: F(
|
|
119
119
|
"list-item",
|
|
120
|
-
|
|
120
|
+
l.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: u,
|
|
128
128
|
contenteditable: !1
|
|
129
129
|
},
|
|
130
130
|
/* @__PURE__ */ S(
|
|
@@ -135,39 +135,39 @@ const it = be({
|
|
|
135
135
|
r.value && "readonly",
|
|
136
136
|
p.value
|
|
137
137
|
),
|
|
138
|
-
icon:
|
|
138
|
+
icon: d.value
|
|
139
139
|
}
|
|
140
140
|
)
|
|
141
141
|
),
|
|
142
|
-
/* @__PURE__ */ S("div", { class: "children", ref:
|
|
142
|
+
/* @__PURE__ */ S("div", { class: "children", ref: a })
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
|
-
}), ie =
|
|
146
|
-
|
|
145
|
+
}), ie = Le(
|
|
146
|
+
Re.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), l = T(e.attrs.checked), a = T(e.attrs.listType), u = T(!t.editable), d = n.get(j.key), p = T(!1), c = (f, 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, f, 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
|
-
const b = we(
|
|
160
|
+
const b = we(lt, {
|
|
161
161
|
label: o,
|
|
162
|
-
checked:
|
|
163
|
-
listType:
|
|
164
|
-
readonly:
|
|
165
|
-
config:
|
|
162
|
+
checked: l,
|
|
163
|
+
listType: a,
|
|
164
|
+
readonly: u,
|
|
165
|
+
config: d,
|
|
166
166
|
selected: p,
|
|
167
|
-
setAttr:
|
|
168
|
-
onMount: (
|
|
167
|
+
setAttr: c,
|
|
168
|
+
onMount: (f) => {
|
|
169
169
|
const { anchor: E, head: w } = t.state.selection;
|
|
170
|
-
|
|
170
|
+
f.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 = (f) => {
|
|
181
|
+
a.value = f.attrs.listType, o.value = f.attrs.label, l.value = f.attrs.checked, u.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: (f) => f.type !== e.type ? !1 : (f.sameMarkup(k) && f.content.eq(k.content) || (k = f, O(f)), !0),
|
|
189
|
+
ignoreMutation: (f) => !r || !i ? !0 : f.type === "selection" ? !1 : i === f.target && f.type === "attributes" ? !0 : !i.contains(f.target),
|
|
190
190
|
selectNode: () => {
|
|
191
191
|
p.value = !0;
|
|
192
192
|
},
|
|
@@ -203,8 +203,8 @@ re(ie, {
|
|
|
203
203
|
displayName: "NodeView<list-item-block>",
|
|
204
204
|
group: "ListItemBlock"
|
|
205
205
|
});
|
|
206
|
-
const
|
|
207
|
-
|
|
206
|
+
const pt = [
|
|
207
|
+
j,
|
|
208
208
|
ie
|
|
209
209
|
];
|
|
210
210
|
function B(n) {
|
|
@@ -214,7 +214,7 @@ function B(n) {
|
|
|
214
214
|
const e = n.content;
|
|
215
215
|
return e ? B(e) : n.type === "text";
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function ct(n, e) {
|
|
218
218
|
return Object.assign(n, {
|
|
219
219
|
meta: {
|
|
220
220
|
package: "@milkdown/plugin-clipboard",
|
|
@@ -223,51 +223,51 @@ 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(Pe);
|
|
227
227
|
n.update(Oe, (r) => ({
|
|
228
228
|
...r,
|
|
229
229
|
editable: r.editable ?? (() => !0)
|
|
230
230
|
}));
|
|
231
|
-
const t = new
|
|
231
|
+
const t = new N("MILKDOWN_CLIPBOARD");
|
|
232
232
|
return new z({
|
|
233
233
|
key: t,
|
|
234
234
|
props: {
|
|
235
235
|
handlePaste: (r, i) => {
|
|
236
236
|
var O, k;
|
|
237
|
-
const o = n.get(Te),
|
|
238
|
-
if (!
|
|
239
|
-
const
|
|
237
|
+
const o = n.get(Te), l = (k = (O = r.props).editable) == null ? void 0 : k.call(O, r.state), { clipboardData: a } = i;
|
|
238
|
+
if (!l || !a || r.state.selection.$from.node().type.spec.code) return !1;
|
|
239
|
+
const d = a.getData("text/plain"), p = a.getData("vscode-editor-data");
|
|
240
240
|
if (p) {
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
241
|
+
const f = JSON.parse(p), E = f == null ? void 0 : f.mode;
|
|
242
|
+
if (d && E) {
|
|
243
243
|
const { tr: w } = r.state, _ = Se("code_block", e);
|
|
244
244
|
return w.replaceSelectionWith(_.create({ language: E })).setSelection(
|
|
245
245
|
Y.near(
|
|
246
246
|
w.doc.resolve(Math.max(0, w.selection.from - 2))
|
|
247
247
|
)
|
|
248
|
-
).insertText(
|
|
248
|
+
).insertText(d.replace(/\r\n?/g, `
|
|
249
249
|
`)), r.dispatch(w), !0;
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
252
|
+
const c = a.getData("text/html");
|
|
253
|
+
if (c.length === 0 && d.length === 0) return !1;
|
|
254
254
|
const h = _e.fromSchema(e);
|
|
255
255
|
let g;
|
|
256
|
-
if (
|
|
257
|
-
const
|
|
258
|
-
if (!
|
|
256
|
+
if (c.length === 0) {
|
|
257
|
+
const f = o(d);
|
|
258
|
+
if (!f || typeof f == "string") return !1;
|
|
259
259
|
g = Ae.fromSchema(e).serializeFragment(
|
|
260
|
-
|
|
260
|
+
f.content
|
|
261
261
|
);
|
|
262
262
|
} else {
|
|
263
|
-
const
|
|
264
|
-
|
|
263
|
+
const f = document.createElement("template");
|
|
264
|
+
f.innerHTML = c, g = f.content.cloneNode(!0), f.remove();
|
|
265
265
|
}
|
|
266
|
-
const
|
|
266
|
+
const P = h.parseSlice(g), b = De(P);
|
|
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(P)), !0;
|
|
271
271
|
} catch {
|
|
272
272
|
return !1;
|
|
273
273
|
}
|
|
@@ -282,13 +282,13 @@ const oe = ee((n) => {
|
|
|
282
282
|
|
|
283
283
|
`
|
|
284
284
|
);
|
|
285
|
-
const
|
|
286
|
-
return
|
|
285
|
+
const l = e.topNodeType.createAndFill(void 0, r.content);
|
|
286
|
+
return l ? i(l) : "";
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
});
|
|
290
290
|
});
|
|
291
|
-
|
|
291
|
+
ct(oe, { displayName: "Prose<clipboard>" });
|
|
292
292
|
var D = 200, m = function() {
|
|
293
293
|
};
|
|
294
294
|
m.prototype.append = function(e) {
|
|
@@ -298,7 +298,7 @@ m.prototype.prepend = function(e) {
|
|
|
298
298
|
return e.length ? m.from(e).append(this) : this;
|
|
299
299
|
};
|
|
300
300
|
m.prototype.appendInner = function(e) {
|
|
301
|
-
return new
|
|
301
|
+
return new ut(this, e);
|
|
302
302
|
};
|
|
303
303
|
m.prototype.slice = function(e, t) {
|
|
304
304
|
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? m.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
@@ -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, l) {
|
|
336
|
+
for (var a = i; a < o; a++)
|
|
337
|
+
if (r(this.values[a], l + a) === !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, l) {
|
|
340
|
+
for (var a = i - 1; a >= o; a--)
|
|
341
|
+
if (r(this.values[a], l + a) === !1)
|
|
342
342
|
return !1;
|
|
343
343
|
}, e.prototype.leafAppend = function(r) {
|
|
344
344
|
if (this.length + r.length <= D)
|
|
@@ -353,7 +353,7 @@ var ae = /* @__PURE__ */ function(n) {
|
|
|
353
353
|
}, Object.defineProperties(e.prototype, t), e;
|
|
354
354
|
}(m);
|
|
355
355
|
m.empty = new ae([]);
|
|
356
|
-
var
|
|
356
|
+
var ut = /* @__PURE__ */ function(n) {
|
|
357
357
|
function e(t, s) {
|
|
358
358
|
n.call(this), this.left = t, this.right = s, this.length = t.length + s.length, this.depth = Math.max(t.depth, s.depth) + 1;
|
|
359
359
|
}
|
|
@@ -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 l = this.left.length;
|
|
366
|
+
if (r < l && this.left.forEachInner(s, r, Math.min(i, l), o) === !1 || i > l && this.right.forEachInner(s, Math.max(r - l, 0), Math.min(this.length, i) - l, o + l) === !1)
|
|
367
367
|
return !1;
|
|
368
368
|
}, e.prototype.forEachInvertedInner = function(s, r, i, o) {
|
|
369
|
-
var
|
|
370
|
-
if (r >
|
|
369
|
+
var l = this.left.length;
|
|
370
|
+
if (r > l && this.right.forEachInvertedInner(s, r - l, Math.max(i, l) - l, o + l) === !1 || i < l && this.left.forEachInvertedInner(s, Math.min(r, l), i, o) === !1)
|
|
371
371
|
return !1;
|
|
372
372
|
}, e.prototype.sliceInner = function(s, r) {
|
|
373
373
|
if (s == 0 && r == this.length)
|
|
@@ -386,7 +386,7 @@ var lt = /* @__PURE__ */ function(n) {
|
|
|
386
386
|
return this.left.depth >= Math.max(this.right.depth, s.depth) + 1 ? new e(this.left, new e(this.right, s)) : new e(this, s);
|
|
387
387
|
}, e;
|
|
388
388
|
}(m);
|
|
389
|
-
const
|
|
389
|
+
const dt = 500;
|
|
390
390
|
class y {
|
|
391
391
|
constructor(e, t) {
|
|
392
392
|
this.items = e, this.eventCount = t;
|
|
@@ -404,34 +404,34 @@ 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,
|
|
408
|
-
return this.items.forEach((p,
|
|
407
|
+
let o = e.tr, l, a, u = [], d = [];
|
|
408
|
+
return this.items.forEach((p, c) => {
|
|
409
409
|
if (!p.step) {
|
|
410
|
-
r || (r = this.remapping(s,
|
|
410
|
+
r || (r = this.remapping(s, c + 1), i = r.maps.length), i--, d.push(p);
|
|
411
411
|
return;
|
|
412
412
|
}
|
|
413
413
|
if (r) {
|
|
414
|
-
|
|
414
|
+
d.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], u.push(new v(g, void 0, void 0, u.length + d.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 l = r ? p.selection.map(r.slice(i)) : p.selection, a = new y(this.items.slice(0, s).append(d.reverse().concat(u)), this.eventCount - 1), !1;
|
|
421
|
+
}, this.items.length, 0), { remaining: a, transform: o, selection: l };
|
|
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,
|
|
426
|
-
for (let
|
|
427
|
-
let p = e.steps[
|
|
428
|
-
(h =
|
|
425
|
+
let i = [], o = this.eventCount, l = this.items, a = !r && l.length ? l.get(l.length - 1) : null;
|
|
426
|
+
for (let d = 0; d < e.steps.length; d++) {
|
|
427
|
+
let p = e.steps[d].invert(e.docs[d]), c = new v(e.mapping.maps[d], p, t), h;
|
|
428
|
+
(h = a && a.merge(c)) && (c = h, d ? i.pop() : l = l.slice(0, l.length - 1)), i.push(c), t && (o++, t = void 0), r || (a = c);
|
|
429
429
|
}
|
|
430
|
-
let
|
|
431
|
-
return
|
|
430
|
+
let u = o - s.depth;
|
|
431
|
+
return u > ht && (l = ft(l, u), o -= u), new y(l.append(i), o);
|
|
432
432
|
}
|
|
433
433
|
remapping(e, t) {
|
|
434
|
-
let s = new
|
|
434
|
+
let s = new Ne();
|
|
435
435
|
return this.items.forEach((r, i) => {
|
|
436
436
|
let o = r.mirrorOffset != null && i - r.mirrorOffset >= e ? s.maps.length - r.mirrorOffset : void 0;
|
|
437
437
|
s.appendMap(r.map, o);
|
|
@@ -447,28 +447,28 @@ 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,
|
|
451
|
-
this.items.forEach((
|
|
452
|
-
|
|
450
|
+
let s = [], r = Math.max(0, this.items.length - t), i = e.mapping, o = e.steps.length, l = this.eventCount;
|
|
451
|
+
this.items.forEach((c) => {
|
|
452
|
+
c.selection && l--;
|
|
453
453
|
}, r);
|
|
454
|
-
let
|
|
455
|
-
this.items.forEach((
|
|
456
|
-
let h = i.getMirror(--
|
|
454
|
+
let a = t;
|
|
455
|
+
this.items.forEach((c) => {
|
|
456
|
+
let h = i.getMirror(--a);
|
|
457
457
|
if (h == null)
|
|
458
458
|
return;
|
|
459
459
|
o = Math.min(o, h);
|
|
460
460
|
let g = i.maps[h];
|
|
461
|
-
if (
|
|
462
|
-
let
|
|
463
|
-
b &&
|
|
461
|
+
if (c.step) {
|
|
462
|
+
let P = e.steps[h].invert(e.docs[h]), b = c.selection && c.selection.map(i.slice(a + 1, h));
|
|
463
|
+
b && l++, s.push(new v(g, P, b));
|
|
464
464
|
} else
|
|
465
465
|
s.push(new v(g));
|
|
466
466
|
}, r);
|
|
467
|
-
let
|
|
468
|
-
for (let
|
|
469
|
-
|
|
470
|
-
let
|
|
471
|
-
return p.emptyItemCount() >
|
|
467
|
+
let u = [];
|
|
468
|
+
for (let c = t; c < o; c++)
|
|
469
|
+
u.push(new v(i.maps[c]));
|
|
470
|
+
let d = this.items.slice(0, r).append(u).append(s), p = new y(d, l);
|
|
471
|
+
return p.emptyItemCount() > dt && (p = p.compress(this.items.length - s.length)), p;
|
|
472
472
|
}
|
|
473
473
|
emptyItemCount() {
|
|
474
474
|
let e = 0;
|
|
@@ -484,23 +484,23 @@ 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, l) => {
|
|
488
|
+
if (l >= e)
|
|
489
489
|
r.push(o), o.selection && i++;
|
|
490
490
|
else if (o.step) {
|
|
491
|
-
let
|
|
492
|
-
if (s--,
|
|
493
|
-
let
|
|
494
|
-
|
|
495
|
-
let p = new v(
|
|
496
|
-
(
|
|
491
|
+
let a = o.step.map(t.slice(s)), u = a && a.getMap();
|
|
492
|
+
if (s--, u && t.appendMap(u, s), a) {
|
|
493
|
+
let d = o.selection && o.selection.map(t.slice(s));
|
|
494
|
+
d && i++;
|
|
495
|
+
let p = new v(u.invert(), a, d), c, h = r.length - 1;
|
|
496
|
+
(c = r.length && r[h].merge(p)) ? r[h] = c : r.push(p);
|
|
497
497
|
}
|
|
498
498
|
} else o.map && s--;
|
|
499
499
|
}, this.items.length, 0), new y(m.from(r.reverse()), i);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
y.empty = new y(m.empty, 0);
|
|
503
|
-
function
|
|
503
|
+
function ft(n, e) {
|
|
504
504
|
let t;
|
|
505
505
|
return n.forEach((s, r) => {
|
|
506
506
|
if (s.selection && e-- == 0)
|
|
@@ -519,28 +519,28 @@ class v {
|
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
-
class
|
|
522
|
+
class I {
|
|
523
523
|
constructor(e, t, s, r, i) {
|
|
524
524
|
this.done = e, this.undone = t, this.prevRanges = s, this.prevTime = r, this.prevComposition = i;
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
|
-
const
|
|
528
|
-
function
|
|
529
|
-
let r = t.getMeta(
|
|
527
|
+
const ht = 20;
|
|
528
|
+
function mt(n, e, t, s) {
|
|
529
|
+
let r = t.getMeta(M), i;
|
|
530
530
|
if (r)
|
|
531
531
|
return r.historyState;
|
|
532
|
-
t.getMeta(
|
|
532
|
+
t.getMeta(vt) && (n = new I(n.done, n.undone, null, 0, -1));
|
|
533
533
|
let o = t.getMeta("appendedTransaction");
|
|
534
534
|
if (t.steps.length == 0)
|
|
535
535
|
return n;
|
|
536
|
-
if (o && o.getMeta(
|
|
537
|
-
return o.getMeta(
|
|
536
|
+
if (o && o.getMeta(M))
|
|
537
|
+
return o.getMeta(M).redo ? new I(n.done.addTransform(t, void 0, s, A(e)), n.undone, Z(t.mapping.maps), n.prevTime, n.prevComposition) : new I(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
|
|
541
|
-
} else return (i = t.getMeta("rebased")) ? new
|
|
539
|
+
let l = t.getMeta("composition"), a = n.prevTime == 0 || !o && n.prevComposition != l && (n.prevTime < (t.time || 0) - s.newGroupDelay || !gt(t, n.prevRanges)), u = o ? x(n.prevRanges, t.mapping) : Z(t.mapping.maps);
|
|
540
|
+
return new I(n.done.addTransform(t, a ? e.selection.getBookmark() : void 0, s, A(e)), y.empty, u, t.time, l ?? n.prevComposition);
|
|
541
|
+
} else return (i = t.getMeta("rebased")) ? new I(n.done.rebased(t, i), n.undone.rebased(t, i), x(n.prevRanges, t.mapping), n.prevTime, n.prevComposition) : new I(n.done.addMaps(t.mapping.maps), n.undone.addMaps(t.mapping.maps), x(n.prevRanges, t.mapping), n.prevTime, n.prevComposition);
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function gt(n, e) {
|
|
544
544
|
if (!e)
|
|
545
545
|
return !1;
|
|
546
546
|
if (!n.docChanged)
|
|
@@ -567,12 +567,12 @@ function x(n, e) {
|
|
|
567
567
|
}
|
|
568
568
|
return t;
|
|
569
569
|
}
|
|
570
|
-
function
|
|
571
|
-
let s = A(e), r =
|
|
570
|
+
function yt(n, e, t) {
|
|
571
|
+
let s = A(e), r = M.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(
|
|
574
|
+
let o = i.selection.resolve(i.transform.doc), l = (t ? n.done : n.undone).addTransform(i.transform, e.selection.getBookmark(), r, s), a = new I(t ? l : i.remaining, t ? i.remaining : l, null, 0, -1);
|
|
575
|
+
return i.transform.setSelection(o).setMeta(M, { redo: t, historyState: a });
|
|
576
576
|
}
|
|
577
577
|
let U = !1, Q = null;
|
|
578
578
|
function A(n) {
|
|
@@ -587,26 +587,26 @@ function A(n) {
|
|
|
587
587
|
}
|
|
588
588
|
return U;
|
|
589
589
|
}
|
|
590
|
-
const
|
|
591
|
-
function
|
|
590
|
+
const M = new N("history"), vt = new N("closeHistory");
|
|
591
|
+
function wt(n = {}) {
|
|
592
592
|
return n = {
|
|
593
593
|
depth: n.depth || 100,
|
|
594
594
|
newGroupDelay: n.newGroupDelay || 500
|
|
595
595
|
}, new z({
|
|
596
|
-
key:
|
|
596
|
+
key: M,
|
|
597
597
|
state: {
|
|
598
598
|
init() {
|
|
599
|
-
return new
|
|
599
|
+
return new I(y.empty, y.empty, null, 0, -1);
|
|
600
600
|
},
|
|
601
601
|
apply(e, t, s) {
|
|
602
|
-
return
|
|
602
|
+
return mt(t, s, e, n);
|
|
603
603
|
}
|
|
604
604
|
},
|
|
605
605
|
config: n,
|
|
606
606
|
props: {
|
|
607
607
|
handleDOMEvents: {
|
|
608
608
|
beforeinput(e, t) {
|
|
609
|
-
let s = t.inputType, r = s == "historyUndo" ? pe : s == "historyRedo" ?
|
|
609
|
+
let s = t.inputType, r = s == "historyUndo" ? pe : s == "historyRedo" ? ce : null;
|
|
610
610
|
return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
|
|
611
611
|
}
|
|
612
612
|
}
|
|
@@ -615,18 +615,18 @@ function gt(n = {}) {
|
|
|
615
615
|
}
|
|
616
616
|
function le(n, e) {
|
|
617
617
|
return (t, s) => {
|
|
618
|
-
let r =
|
|
618
|
+
let r = M.getState(t);
|
|
619
619
|
if (!r || (n ? r.undone : r.done).eventCount == 0)
|
|
620
620
|
return !1;
|
|
621
621
|
if (s) {
|
|
622
|
-
let i =
|
|
622
|
+
let i = yt(r, t, n);
|
|
623
623
|
i && s(e ? i.scrollIntoView() : i);
|
|
624
624
|
}
|
|
625
625
|
return !0;
|
|
626
626
|
};
|
|
627
627
|
}
|
|
628
|
-
const pe = le(!1, !0),
|
|
629
|
-
function
|
|
628
|
+
const pe = le(!1, !0), ce = le(!0, !0);
|
|
629
|
+
function L(n, e) {
|
|
630
630
|
return Object.assign(n, {
|
|
631
631
|
meta: {
|
|
632
632
|
package: "@milkdown/plugin-history",
|
|
@@ -635,24 +635,24 @@ function P(n, e) {
|
|
|
635
635
|
}), n;
|
|
636
636
|
}
|
|
637
637
|
const $ = ne("Undo", () => () => pe);
|
|
638
|
-
|
|
638
|
+
L($, {
|
|
639
639
|
displayName: "Command<undo>"
|
|
640
640
|
});
|
|
641
|
-
const H = ne("Redo", () => () =>
|
|
642
|
-
|
|
641
|
+
const H = ne("Redo", () => () => ce);
|
|
642
|
+
L(H, {
|
|
643
643
|
displayName: "Command<redo>"
|
|
644
644
|
});
|
|
645
645
|
const K = X({}, "historyProviderConfig");
|
|
646
|
-
|
|
646
|
+
L(K, {
|
|
647
647
|
displayName: "Ctx<historyProviderConfig>"
|
|
648
648
|
});
|
|
649
|
-
const
|
|
650
|
-
(n) =>
|
|
649
|
+
const ue = ee(
|
|
650
|
+
(n) => wt(n.get(K.key))
|
|
651
651
|
);
|
|
652
|
-
|
|
652
|
+
L(ue, {
|
|
653
653
|
displayName: "Ctx<historyProviderPlugin>"
|
|
654
654
|
});
|
|
655
|
-
const R =
|
|
655
|
+
const R = je("historyKeymap", {
|
|
656
656
|
Undo: {
|
|
657
657
|
shortcuts: "Mod-z",
|
|
658
658
|
command: (n) => {
|
|
@@ -668,15 +668,15 @@ const R = Ne("historyKeymap", {
|
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
670
|
});
|
|
671
|
-
|
|
671
|
+
L(R.ctx, {
|
|
672
672
|
displayName: "KeymapCtx<history>"
|
|
673
673
|
});
|
|
674
|
-
|
|
674
|
+
L(R.shortcuts, {
|
|
675
675
|
displayName: "Keymap<history>"
|
|
676
676
|
});
|
|
677
|
-
const
|
|
677
|
+
const bt = [
|
|
678
678
|
K,
|
|
679
|
-
|
|
679
|
+
ue,
|
|
680
680
|
R,
|
|
681
681
|
$,
|
|
682
682
|
H
|
|
@@ -728,78 +728,90 @@ class de {
|
|
|
728
728
|
const q = xe(
|
|
729
729
|
new de(),
|
|
730
730
|
"listener"
|
|
731
|
-
),
|
|
731
|
+
), It = new N("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((a) => a(n)), await n.wait(Fe);
|
|
735
735
|
const s = n.get(te);
|
|
736
736
|
let r = null, i = null, o = null;
|
|
737
|
-
const
|
|
738
|
-
key:
|
|
737
|
+
const l = new z({
|
|
738
|
+
key: It,
|
|
739
739
|
view: () => ({
|
|
740
740
|
destroy: () => {
|
|
741
|
-
t.destroy.forEach((
|
|
741
|
+
t.destroy.forEach((a) => a(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((a) => a(n)), !1),
|
|
747
|
+
blur: () => (t.blur.forEach((a) => a(n)), !1)
|
|
748
748
|
}
|
|
749
749
|
},
|
|
750
750
|
state: {
|
|
751
|
-
init: (
|
|
752
|
-
r =
|
|
751
|
+
init: (a, u) => {
|
|
752
|
+
r = u.doc, i = s(u.doc);
|
|
753
753
|
},
|
|
754
|
-
apply: (
|
|
755
|
-
const
|
|
756
|
-
return (!o &&
|
|
757
|
-
p(n,
|
|
758
|
-
}), o =
|
|
759
|
-
const { doc: p } =
|
|
760
|
-
if (t.updated.length > 0 && r && !r.eq(p) && t.updated.forEach((
|
|
761
|
-
|
|
754
|
+
apply: (a) => {
|
|
755
|
+
const u = a.selection;
|
|
756
|
+
return (!o && u || o && !u.eq(o)) && (t.selectionUpdated.forEach((p) => {
|
|
757
|
+
p(n, u, o);
|
|
758
|
+
}), o = u), !(a.docChanged || a.storedMarksSet) || a.getMeta("addToHistory") === !1 ? void 0 : Je(() => {
|
|
759
|
+
const { doc: p } = a;
|
|
760
|
+
if (t.updated.length > 0 && r && !r.eq(p) && t.updated.forEach((c) => {
|
|
761
|
+
c(n, p, r);
|
|
762
762
|
}), t.markdownUpdated.length > 0 && r && !r.eq(p)) {
|
|
763
|
-
const
|
|
763
|
+
const c = s(p);
|
|
764
764
|
t.markdownUpdated.forEach((h) => {
|
|
765
|
-
h(n,
|
|
766
|
-
}), i =
|
|
765
|
+
h(n, c, i);
|
|
766
|
+
}), i = c;
|
|
767
767
|
}
|
|
768
768
|
r = p;
|
|
769
769
|
}, 200)();
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
772
|
});
|
|
773
|
-
n.update(Be, (
|
|
773
|
+
n.update(Be, (a) => a.concat(l)), await n.wait(qe), t.mounted.forEach((a) => a(n));
|
|
774
774
|
});
|
|
775
775
|
fe.meta = {
|
|
776
776
|
package: "@milkdown/plugin-listener",
|
|
777
777
|
displayName: "Listener"
|
|
778
778
|
};
|
|
779
|
-
const
|
|
779
|
+
const Mt = ({
|
|
780
780
|
className: n,
|
|
781
781
|
value: e,
|
|
782
782
|
onChangeValue: t,
|
|
783
783
|
children: s,
|
|
784
|
-
toolbar: r = "top"
|
|
784
|
+
toolbar: r = "top",
|
|
785
|
+
milkdownRef: i
|
|
785
786
|
}) => {
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
(
|
|
789
|
-
|
|
790
|
-
t == null || t(
|
|
791
|
-
}),
|
|
787
|
+
const o = nt();
|
|
788
|
+
Qe(
|
|
789
|
+
(d) => $e.make().config((p) => {
|
|
790
|
+
p.set(He, d), p.set(Ke, e || ""), p.get(q).markdownUpdated((h, g) => {
|
|
791
|
+
t == null || t(g);
|
|
792
|
+
}), p.set(j.key, {
|
|
792
793
|
renderLabel: () => ""
|
|
793
|
-
}),
|
|
794
|
-
...
|
|
794
|
+
}), p.update(ke.key, (h) => ({
|
|
795
|
+
...h,
|
|
795
796
|
linkIcon: "",
|
|
796
797
|
editButton: "",
|
|
797
798
|
removeButton: "",
|
|
798
799
|
confirmButton: "",
|
|
799
800
|
inputPlaceholder: "Enter a URL..."
|
|
800
|
-
})),
|
|
801
|
-
}).use(fe).use(
|
|
802
|
-
)
|
|
801
|
+
})), o.config(p);
|
|
802
|
+
}).use(fe).use(We).use(Ge).use(oe).use(bt).use(pt).use(Ve).config(Ee).use(Ce).use(o.plugin)
|
|
803
|
+
);
|
|
804
|
+
const [l, a] = Xe();
|
|
805
|
+
tt(() => {
|
|
806
|
+
i && (i.current = a());
|
|
807
|
+
}, [l, a]);
|
|
808
|
+
const u = () => {
|
|
809
|
+
var d;
|
|
810
|
+
(d = a()) == null || d.action((p) => {
|
|
811
|
+
p.get(ze).focus();
|
|
812
|
+
});
|
|
813
|
+
};
|
|
814
|
+
return /* @__PURE__ */ ge(
|
|
803
815
|
"div",
|
|
804
816
|
{
|
|
805
817
|
className: ye(
|
|
@@ -808,12 +820,19 @@ const wt = ({
|
|
|
808
820
|
n
|
|
809
821
|
),
|
|
810
822
|
children: [
|
|
811
|
-
r && /* @__PURE__ */
|
|
812
|
-
/* @__PURE__ */
|
|
823
|
+
r && /* @__PURE__ */ C(Me, { className: "component-markdown-editor__toolbar", children: s }),
|
|
824
|
+
/* @__PURE__ */ C(
|
|
825
|
+
"div",
|
|
826
|
+
{
|
|
827
|
+
className: "component-markdown-editor__content",
|
|
828
|
+
onClick: u,
|
|
829
|
+
children: /* @__PURE__ */ C(Ye, {})
|
|
830
|
+
}
|
|
831
|
+
)
|
|
813
832
|
]
|
|
814
833
|
}
|
|
815
834
|
);
|
|
816
|
-
},
|
|
835
|
+
}, Dt = (n) => /* @__PURE__ */ C(Ze, { children: /* @__PURE__ */ C(et, { children: /* @__PURE__ */ C(Mt, { ...n }) }) });
|
|
817
836
|
export {
|
|
818
|
-
|
|
837
|
+
Dt as MarkdownEditor
|
|
819
838
|
};
|