zt-react-milkdown 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +149 -0
- package/dist/commands-CDrea4WB.cjs +1 -0
- package/dist/commands-DoqeX5uJ.js +36 -0
- package/dist/debounce-Bqj_3iJs.cjs +1 -0
- package/dist/debounce-Cuk3VGPr.js +118 -0
- package/dist/dist-BCCSKc3M.cjs +5 -0
- package/dist/dist-C0PSMrs7.cjs +37 -0
- package/dist/dist-CPVooDwj.cjs +2 -0
- package/dist/dist-CxZn1qUo.js +1584 -0
- package/dist/dist-Cxaq2crg.js +409 -0
- package/dist/dist-DaM7GJv6.js +3499 -0
- package/dist/dist-Dhukmh4L.js +7562 -0
- package/dist/dist-mOpTMw1E.cjs +1 -0
- package/dist/floating-ui.dom-CKbcbmJV.js +883 -0
- package/dist/floating-ui.dom-VaZZ2gzS.cjs +1 -0
- package/dist/index.browser-5LtNN9G9.cjs +1 -0
- package/dist/index.browser-D2DmEB8o.js +26 -0
- package/dist/index.cjs +393 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +43325 -0
- package/dist/lib-38nxOnTd.cjs +4 -0
- package/dist/lib-8Tr6mAln.cjs +1 -0
- package/dist/lib-B0rHJ9lJ.js +28 -0
- package/dist/lib-BJgvZywM.cjs +3 -0
- package/dist/lib-BNOSyYeU.cjs +3 -0
- package/dist/lib-C5AzmhNY.cjs +5 -0
- package/dist/lib-C8xOD1Bp.cjs +1 -0
- package/dist/lib-CCUU16r8.js +1081 -0
- package/dist/lib-CK9MEMX-.js +73 -0
- package/dist/lib-D4HMdvmK.cjs +1 -0
- package/dist/lib-DWZA8C0h.cjs +1 -0
- package/dist/lib-Dbe-cVjv.js +367 -0
- package/dist/lib-DkE7Uq2b.js +1886 -0
- package/dist/lib-DzK_kn7a.js +21 -0
- package/dist/lib-IahjxPWM.cjs +3 -0
- package/dist/lib-m8lKZKxK.js +80 -0
- package/dist/lib-r5eNG0sa.js +754 -0
- package/dist/lib-wmHesNI0.js +2223 -0
- package/dist/rolldown-runtime-CerMd-t8.cjs +1 -0
- package/dist/rolldown-runtime-DnwLefa7.js +23 -0
- package/dist/schema-list-DSdBEAWW.js +171 -0
- package/dist/schema-list-bL8FNes5.cjs +1 -0
- package/dist/src/components/ui/button.d.ts +16 -0
- package/dist/src/components/ui/button.d.ts.map +1 -0
- package/dist/src/components/ui/dialog.d.ts +36 -0
- package/dist/src/components/ui/dialog.d.ts.map +1 -0
- package/dist/src/components/ui/popover.d.ts +14 -0
- package/dist/src/components/ui/popover.d.ts.map +1 -0
- package/dist/src/core/commands.d.ts +7 -0
- package/dist/src/core/commands.d.ts.map +1 -0
- package/dist/src/core/createEditor.d.ts +6 -0
- package/dist/src/core/createEditor.d.ts.map +1 -0
- package/dist/src/core/schema.d.ts +8 -0
- package/dist/src/core/schema.d.ts.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/editor-overlay-position.d.ts +83 -0
- package/dist/src/lib/editor-overlay-position.d.ts.map +1 -0
- package/dist/src/lib/global-scroll-listener.d.ts +9 -0
- package/dist/src/lib/global-scroll-listener.d.ts.map +1 -0
- package/dist/src/lib/utils.d.ts +6 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/src/local/en-US.d.ts +6 -0
- package/dist/src/local/en-US.d.ts.map +1 -0
- package/dist/src/local/i18n.d.ts +10 -0
- package/dist/src/local/i18n.d.ts.map +1 -0
- package/dist/src/local/zh-CN.d.ts +6 -0
- package/dist/src/local/zh-CN.d.ts.map +1 -0
- package/dist/src/plugins/custom/blockquote/blockquote-backspace-lift.d.ts +5 -0
- package/dist/src/plugins/custom/blockquote/blockquote-backspace-lift.d.ts.map +1 -0
- package/dist/src/plugins/custom/blockquote/index.d.ts +3 -0
- package/dist/src/plugins/custom/blockquote/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/code-block/code-block-editable.d.ts +7 -0
- package/dist/src/plugins/custom/code-block/code-block-editable.d.ts.map +1 -0
- package/dist/src/plugins/custom/code-block/code-block-language-picker.d.ts +7 -0
- package/dist/src/plugins/custom/code-block/code-block-language-picker.d.ts.map +1 -0
- package/dist/src/plugins/custom/code-block/code-block-mod-a-select.d.ts +5 -0
- package/dist/src/plugins/custom/code-block/code-block-mod-a-select.d.ts.map +1 -0
- package/dist/src/plugins/custom/code-block/code-block-prism.d.ts +5 -0
- package/dist/src/plugins/custom/code-block/code-block-prism.d.ts.map +1 -0
- package/dist/src/plugins/custom/code-block/index.d.ts +9 -0
- package/dist/src/plugins/custom/code-block/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/cursor/drop-cursor.d.ts +5 -0
- package/dist/src/plugins/custom/cursor/drop-cursor.d.ts.map +1 -0
- package/dist/src/plugins/custom/cursor/gap-cursor.d.ts +5 -0
- package/dist/src/plugins/custom/cursor/gap-cursor.d.ts.map +1 -0
- package/dist/src/plugins/custom/cursor/index.d.ts +5 -0
- package/dist/src/plugins/custom/cursor/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/image/image-editable.d.ts +7 -0
- package/dist/src/plugins/custom/image/image-editable.d.ts.map +1 -0
- package/dist/src/plugins/custom/image/image-resizable-schema.d.ts +41 -0
- package/dist/src/plugins/custom/image/image-resizable-schema.d.ts.map +1 -0
- package/dist/src/plugins/custom/image/image-upload-dialog/ImageUploadDialog.d.ts +31 -0
- package/dist/src/plugins/custom/image/image-upload-dialog/ImageUploadDialog.d.ts.map +1 -0
- package/dist/src/plugins/custom/image/image-upload-dialog/index.d.ts +20 -0
- package/dist/src/plugins/custom/image/image-upload-dialog/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/image/index.d.ts +7 -0
- package/dist/src/plugins/custom/image/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/indent/index.d.ts +3 -0
- package/dist/src/plugins/custom/indent/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/indent/tab-space-indent.d.ts +5 -0
- package/dist/src/plugins/custom/indent/tab-space-indent.d.ts.map +1 -0
- package/dist/src/plugins/custom/list/index.d.ts +3 -0
- package/dist/src/plugins/custom/list/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/list/task-list-toggle.d.ts +5 -0
- package/dist/src/plugins/custom/list/task-list-toggle.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/index.d.ts +7 -0
- package/dist/src/plugins/custom/math/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/math-backspace-entry.d.ts +5 -0
- package/dist/src/plugins/custom/math/math-backspace-entry.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/math-block-editable.d.ts +7 -0
- package/dist/src/plugins/custom/math/math-block-editable.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/math-plugin.d.ts +47 -0
- package/dist/src/plugins/custom/math/math-plugin.d.ts.map +1 -0
- package/dist/src/plugins/custom/selection-tooltip/constants.d.ts +7 -0
- package/dist/src/plugins/custom/selection-tooltip/constants.d.ts.map +1 -0
- package/dist/src/plugins/custom/selection-tooltip/index.d.ts +7 -0
- package/dist/src/plugins/custom/selection-tooltip/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/selection-tooltip/mark-logic.d.ts +25 -0
- package/dist/src/plugins/custom/selection-tooltip/mark-logic.d.ts.map +1 -0
- package/dist/src/plugins/custom/selection-tooltip/tooltip-view.d.ts +21 -0
- package/dist/src/plugins/custom/selection-tooltip/tooltip-view.d.ts.map +1 -0
- package/dist/src/plugins/custom/selection-tooltip/types.d.ts +58 -0
- package/dist/src/plugins/custom/selection-tooltip/types.d.ts.map +1 -0
- package/dist/src/plugins/custom/slash-menu/index.d.ts +9 -0
- package/dist/src/plugins/custom/slash-menu/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/slash-menu/slash-menu-commands.d.ts +6 -0
- package/dist/src/plugins/custom/slash-menu/slash-menu-commands.d.ts.map +1 -0
- package/dist/src/plugins/custom/slash-menu/slash-menu-logic.d.ts +23 -0
- package/dist/src/plugins/custom/slash-menu/slash-menu-logic.d.ts.map +1 -0
- package/dist/src/plugins/custom/slash-menu/slash-menu-view.d.ts +50 -0
- package/dist/src/plugins/custom/slash-menu/slash-menu-view.d.ts.map +1 -0
- package/dist/src/plugins/custom/slash-menu/slash-menu.d.ts +15 -0
- package/dist/src/plugins/custom/slash-menu/slash-menu.d.ts.map +1 -0
- package/dist/src/plugins/custom/table/index.d.ts +13 -0
- package/dist/src/plugins/custom/table/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/table/table-arrow-entry.d.ts +5 -0
- package/dist/src/plugins/custom/table/table-arrow-entry.d.ts.map +1 -0
- package/dist/src/plugins/custom/table/table-deletion-actions.d.ts +10 -0
- package/dist/src/plugins/custom/table/table-deletion-actions.d.ts.map +1 -0
- package/dist/src/plugins/custom/table/table-focus-actions.d.ts +7 -0
- package/dist/src/plugins/custom/table/table-focus-actions.d.ts.map +1 -0
- package/dist/src/plugins/custom/table/table-more-actions.d.ts +37 -0
- package/dist/src/plugins/custom/table/table-more-actions.d.ts.map +1 -0
- package/dist/src/plugins/custom/table/table-row-insertion.d.ts +35 -0
- package/dist/src/plugins/custom/table/table-row-insertion.d.ts.map +1 -0
- package/dist/src/plugins/custom/table/table-selection.d.ts +30 -0
- package/dist/src/plugins/custom/table/table-selection.d.ts.map +1 -0
- package/dist/src/plugins/preset-common.d.ts +56 -0
- package/dist/src/plugins/preset-common.d.ts.map +1 -0
- package/dist/src/react/components/MilkdownEditor.d.ts +7 -0
- package/dist/src/react/components/MilkdownEditor.d.ts.map +1 -0
- package/dist/src/react/components/index.d.ts +2 -0
- package/dist/src/react/components/index.d.ts.map +1 -0
- package/dist/src/react/context/EditorContext.d.ts +16 -0
- package/dist/src/react/context/EditorContext.d.ts.map +1 -0
- package/dist/src/react/hooks/useCloseOnGlobalScroll.d.ts +5 -0
- package/dist/src/react/hooks/useCloseOnGlobalScroll.d.ts.map +1 -0
- package/dist/src/react/hooks/useControlledState.d.ts +9 -0
- package/dist/src/react/hooks/useControlledState.d.ts.map +1 -0
- package/dist/src/react/hooks/useMilkdownEditor.d.ts +35 -0
- package/dist/src/react/hooks/useMilkdownEditor.d.ts.map +1 -0
- package/dist/src/types/editor.d.ts +233 -0
- package/dist/src/types/editor.d.ts.map +1 -0
- package/dist/src/types/plugin.d.ts +10 -0
- package/dist/src/types/plugin.d.ts.map +1 -0
- package/dist/src/utils/guard.d.ts +5 -0
- package/dist/src/utils/guard.d.ts.map +1 -0
- package/dist/src/utils/markdown.d.ts +9 -0
- package/dist/src/utils/markdown.d.ts.map +1 -0
- package/dist/state-CHAiIqOA.cjs +1 -0
- package/dist/state-DNxqltZl.js +16 -0
- package/dist/style.css +3 -0
- package/package.json +89 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { S as e, a as t, c as n, i as r, x as i } from "./dist-DaM7GJv6.js";
|
|
2
|
+
import { a, c as o, i as s, l as c, n as l, o as u, s as d } from "./lib-r5eNG0sa.js";
|
|
3
|
+
//#region node_modules/.pnpm/@milkdown+plugin-clipboard@7.21.0/node_modules/@milkdown/plugin-clipboard/lib/index.js
|
|
4
|
+
function f(e) {
|
|
5
|
+
if (!e) return !1;
|
|
6
|
+
if (Array.isArray(e)) return e.length > 1 ? !1 : f(e[0]);
|
|
7
|
+
let t = e.content;
|
|
8
|
+
return t ? f(t) : e.type === "text";
|
|
9
|
+
}
|
|
10
|
+
function p(e, t) {
|
|
11
|
+
return Object.assign(e, { meta: {
|
|
12
|
+
package: "@milkdown/plugin-clipboard",
|
|
13
|
+
...t
|
|
14
|
+
} }), e;
|
|
15
|
+
}
|
|
16
|
+
function m(e, t) {
|
|
17
|
+
let n = c(t);
|
|
18
|
+
if (n) return e.dispatch(e.state.tr.replaceSelectionWith(n, !0)), !0;
|
|
19
|
+
try {
|
|
20
|
+
return e.dispatch(e.state.tr.replaceSelection(t)), !0;
|
|
21
|
+
} catch {
|
|
22
|
+
return !1;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
var h = l((c) => {
|
|
26
|
+
let l = c.get(u);
|
|
27
|
+
return c.update(s, (e) => ({
|
|
28
|
+
...e,
|
|
29
|
+
editable: e.editable ?? (() => !0),
|
|
30
|
+
transformPastedHTML: (t, n) => {
|
|
31
|
+
let r = e.transformPastedHTML;
|
|
32
|
+
return r && (t = r(t, n)), t.includes("docs-internal-guid") && (t = t.replace(/<b[^>]*id="docs-internal-guid[^"]*"[^>]*>([\s\S]*)<\/b>/, "$1"), t = t.replace(/<div[^>]*>(<table[\s\S]*?<\/table>)<\/div>/g, "$1")), t;
|
|
33
|
+
}
|
|
34
|
+
})), new r({
|
|
35
|
+
key: new t("MILKDOWN_CLIPBOARD"),
|
|
36
|
+
props: {
|
|
37
|
+
handlePaste: (t, r, s) => {
|
|
38
|
+
let u = c.get(a), d = t.props.editable?.(t.state), { clipboardData: f } = r;
|
|
39
|
+
if (!d || !f || t.state.selection.$from.node().type.spec.code) return !1;
|
|
40
|
+
let p = f.getData("text/plain"), h = f.getData("vscode-editor-data");
|
|
41
|
+
if (h) {
|
|
42
|
+
let e = JSON.parse(h)?.mode;
|
|
43
|
+
if (p && e) {
|
|
44
|
+
let { tr: r } = t.state, i = o("code_block", l);
|
|
45
|
+
return r.replaceSelectionWith(i.create({ language: e })).setSelection(n.near(r.doc.resolve(Math.max(0, r.selection.from - 2)))).insertText(p.replace(/\r\n?/g, "\n")), t.dispatch(r), !0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
let g = f.getData("text/html");
|
|
49
|
+
if (g.length === 0 && p.length === 0) return !1;
|
|
50
|
+
if (g.length > 0 && s) return m(t, s);
|
|
51
|
+
let _ = i.fromSchema(l), v;
|
|
52
|
+
if (g.length === 0) {
|
|
53
|
+
let t = u(p);
|
|
54
|
+
if (!t || typeof t == "string") return !1;
|
|
55
|
+
v = e.fromSchema(l).serializeFragment(t.content);
|
|
56
|
+
} else {
|
|
57
|
+
let e = document.createElement("template");
|
|
58
|
+
e.innerHTML = g, v = e.content.cloneNode(!0), e.remove();
|
|
59
|
+
}
|
|
60
|
+
return m(t, _.parseSlice(v));
|
|
61
|
+
},
|
|
62
|
+
clipboardTextSerializer: (e) => {
|
|
63
|
+
let t = c.get(d);
|
|
64
|
+
if (f(e.content.toJSON())) return e.content.textBetween(0, e.content.size, "\n\n");
|
|
65
|
+
let n = l.topNodeType.createAndFill(void 0, e.content);
|
|
66
|
+
return n ? t(n) : "";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
p(h, { displayName: "Prose<clipboard>" });
|
|
72
|
+
//#endregion
|
|
73
|
+
export { h as clipboard };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./dist-BCCSKc3M.cjs`),t=require(`./lib-DWZA8C0h.cjs`);function n(n){let r=t.n({},`${n}_SLASH_SPEC`),i=t.u(t=>{let i=t.get(r.key);return new e.i({key:new e.a(`${n}_SLASH`),...i})}),a=[r,i];return a.key=r.key,a.pluginKey=i.key,r.meta={package:`@milkdown/plugin-slash`,displayName:`Ctx<slashSpec>|${n}`},i.meta={package:`@milkdown/plugin-slash`,displayName:`Prose<slash>|${n}`},a}exports.slashFactory=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./rolldown-runtime-CerMd-t8.cjs`),t=require(`./dist-BCCSKc3M.cjs`),n=require(`./lib-IahjxPWM.cjs`),r=require(`./index.browser-5LtNN9G9.cjs`);var i=e.n({$command:()=>s,$commandAsync:()=>c,$ctx:()=>C,$inputRule:()=>l,$inputRuleAsync:()=>u,$mark:()=>p,$markAsync:()=>m,$markAttr:()=>O,$markSchema:()=>T,$node:()=>h,$nodeAsync:()=>g,$nodeAttr:()=>D,$nodeSchema:()=>w,$pasteRule:()=>d,$pasteRuleAsync:()=>f,$prose:()=>_,$proseAsync:()=>v,$remark:()=>k,$shortcut:()=>y,$shortcutAsync:()=>b,$useKeymap:()=>E,$view:()=>x,$viewAsync:()=>S,addTimer:()=>o,callCommand:()=>A,forceUpdate:()=>j,getHTML:()=>M,getMarkdown:()=>N,insert:()=>P,insertPos:()=>z,markdownToSlice:()=>R,nanoid:()=>a,outline:()=>F,pipe:()=>V,replaceAll:()=>I,replaceRange:()=>B,setAttr:()=>L}),a=r.t(`abcedfghicklmn`,10);function o(e,t,r){let i=n.B(r||a()),o=!1,s=n=>(n.record(i),n.update(t,e=>e.concat(i)),async()=>{let r=await e(n,s,()=>{n.done(i),o=!0});return o||n.done(i),()=>{if(n.update(t,e=>e.filter(e=>e!==i)),n.clearTimer(i),r){let e=r();e&&`then`in e&&e.catch(console.error)}}});return s.timer=i,s}function s(e,t){let r=n.l(e),i=a=>async()=>{i.key=r,await a.wait(n.t);let o=t(a);return a.get(n.s).create(r,o),i.run=t=>a.get(n.s).call(e,t),()=>{a.get(n.s).remove(r)}};return i}function c(e,t,r){let i=n.l(e);return o(async(r,a)=>{await r.wait(n.t);let o=await t(r);return r.get(n.s).create(i,o),a.run=t=>r.get(n.s).call(e,t),a.key=i,()=>{r.get(n.s).remove(i)}},n.c,r)}function l(e){let t=r=>async()=>{await r.wait(n.a);let i=e(r);return r.update(n.m,e=>[...e,i]),t.inputRule=i,()=>{r.update(n.m,e=>e.filter(e=>e!==i))}};return t}function u(e,t){return o(async(t,r)=>{await t.wait(n.a);let i=await e(t);return t.update(n.m,e=>[...e,i]),r.inputRule=i,()=>{t.update(n.m,e=>e.filter(e=>e!==i))}},n.d,t)}function d(e){let t=r=>async()=>{await r.wait(n.a);let i=e(r);return r.update(n.S,e=>[...e,i]),t.pasteRule=i,()=>{r.update(n.S,e=>e.filter(e=>e!==i))}};return t}function f(e,t){return o(async(t,r)=>{await t.wait(n.a);let i=await e(t);return t.update(n.S,e=>[...e,i]),r.pasteRule=i,()=>{t.update(n.S,e=>e.filter(e=>e!==i))}},n.C,t)}function p(e,t){let r=i=>async()=>{let a=t(i);return i.update(n.v,t=>[...t.filter(t=>t[0]!==e),[e,a]]),r.id=e,r.schema=a,()=>{i.update(n.v,t=>t.filter(([t])=>t!==e))}};return r.type=t=>{let r=t.get(n.D).marks[e];if(!r)throw n.H(e);return r},r}function m(e,t,r){let i=o(async(r,i,a)=>{let o=await t(r);return r.update(n.v,t=>[...t.filter(t=>t[0]!==e),[e,o]]),i.id=e,i.schema=o,a(),()=>{r.update(n.v,t=>t.filter(([t])=>t!==e))}},n.O,r);return i.type=t=>{let r=t.get(n.D).marks[e];if(!r)throw n.H(e);return r},i}function h(e,t){let r=i=>async()=>{let a=t(i);return i.update(n.b,t=>[...t.filter(t=>t[0]!==e),[e,a]]),r.id=e,r.schema=a,()=>{i.update(n.b,t=>t.filter(([t])=>t!==e))}};return r.type=t=>{let r=t.get(n.D).nodes[e];if(!r)throw n.U(e);return r},r}function g(e,t,r){let i=o(async(r,i,a)=>{let o=await t(r);return r.update(n.b,t=>[...t.filter(t=>t[0]!==e),[e,o]]),i.id=e,i.schema=o,a(),()=>{r.update(n.b,t=>t.filter(([t])=>t!==e))}},n.O,r);return i.type=t=>{let r=t.get(n.D).nodes[e];if(!r)throw n.U(e);return r},i}function _(e){let t,r=r=>async()=>(await r.wait(n.a),t=e(r),r.update(n.w,e=>[...e,t]),()=>{r.update(n.w,e=>e.filter(e=>e!==t))});return r.plugin=()=>t,r.key=()=>t.spec.key,r}function v(e,t){let r,i=o(async t=>(await t.wait(n.a),r=await e(t),t.update(n.w,e=>[...e,r]),()=>{t.update(n.w,e=>e.filter(e=>e!==r))}),n.d,t);return i.plugin=()=>r,i.key=()=>r.spec.key,i}function y(e){let t=r=>async()=>{await r.wait(n.i);let i=r.get(n.h),a=e(r),o=i.addObjectKeymap(a);return t.keymap=a,()=>{o()}};return t}function b(e,t){return o(async(t,r)=>{await t.wait(n.i);let i=t.get(n.h),a=await e(t),o=i.addObjectKeymap(a);return r.keymap=a,()=>{o()}},n.d,t)}function x(e,r){let i=a=>async()=>{await a.wait(n.a);let o=r(a);return e.type(a)instanceof t.D?a.update(n.y,t=>[...t,[e.id,o]]):a.update(n._,t=>[...t,[e.id,o]]),i.view=o,i.type=e,()=>{e.type(a)instanceof t.D?a.update(n.y,t=>t.filter(t=>t[0]!==e.id)):a.update(n._,t=>t.filter(t=>t[0]!==e.id))}};return i}function S(e,r,i){return o(async(i,a)=>{await i.wait(n.a);let o=await r(i);return e.type(i)instanceof t.D?i.update(n.y,t=>[...t,[e.id,o]]):i.update(n._,t=>[...t,[e.id,o]]),a.view=o,a.type=e,()=>{e.type(i)instanceof t.D?i.update(n.y,t=>t.filter(t=>t[0]!==e.id)):i.update(n._,t=>t.filter(t=>t[0]!==e.id))}},n.p,i)}function C(e,t){let r=n.z(e,t),i=e=>(e.inject(r),()=>()=>{e.remove(r)});return i.key=r,i}function w(e,t){let n=C(t,e),r=h(e,e=>e.get(n.key)(e)),i=[n,r];return i.id=r.id,i.node=r,i.type=e=>r.type(e),i.ctx=n,i.key=n.key,i.extendSchema=n=>w(e,n(t)),i}function T(e,t){let n=C(t,e),r=p(e,e=>e.get(n.key)(e)),i=[n,r];return i.id=r.id,i.mark=r,i.type=e=>r.type(e),i.ctx=n,i.key=n.key,i.extendSchema=n=>T(e,n(t)),i}function E(e,t){let n=C(Object.fromEntries(Object.entries(t).map(([e,{shortcuts:t,priority:n}])=>[e,{shortcuts:t,priority:n}])),`${e}Keymap`),r=y(e=>{let r=e.get(n.key),i=Object.entries(t).flatMap(([e,{command:t}])=>{let n=r[e],i=[n.shortcuts].flat(),a=n.priority;return i.map(e=>[e,{key:e,onRun:t,priority:a}])});return Object.fromEntries(i)}),i=[n,r];return i.ctx=n,i.shortcuts=r,i.key=n.key,i.keymap=r.keymap,i}var D=(e,t=()=>({}))=>C(t,`${e}Attr`),O=(e,t=()=>({}))=>C(t,`${e}Attr`);function k(e,t,r){let i=C(r??{},e),a=e=>async()=>{await e.wait(n.r);let r={plugin:t(e),options:e.get(i.key)};return e.update(n.T,e=>[...e,r]),()=>{e.update(n.T,e=>e.filter(e=>e!==r))}},o=[i,a];return o.id=e,o.plugin=a,o.options=i,o}function A(e,t){return r=>r.get(n.s).call(e,t)}function j(){return e=>{let t=e.get(n.f),{tr:r}=t.state,i=Object.assign(Object.create(r),r).setTime(Date.now());return t.dispatch(i)}}function M(){return e=>{let r=document.createElement(`div`),i=e.get(n.D),a=e.get(n.f),o=t.S.fromSchema(i).serializeFragment(a.state.doc.content);return r.appendChild(o),r.innerHTML}}function N(e){return t=>{let r=t.get(n.f),i=t.get(n.D),a=t.get(n.k);if(!e)return a(r.state.doc);let o=r.state.doc.slice(e.from,e.to,!0),s=i.topNodeType.createAndFill(null,o.content);return s?a(s):(console.error(`No document found`),``)}}function P(e,r=!1){return i=>{let a=i.get(n.f),o=i.get(n.x)(e);if(!o)return;if(!r){let e=a.state.selection.content();return a.dispatch(a.state.tr.replaceSelection(new t.k(o.content,e.openStart,e.openEnd)).scrollIntoView())}let s=i.get(n.D),c=t.S.fromSchema(s).serializeFragment(o.content),l=t.x.fromSchema(s).parseSlice(c),u=n.I(l);if(u){a.dispatch(a.state.tr.replaceSelectionWith(u,!0));return}a.dispatch(a.state.tr.replaceSelection(l))}}function F(){return e=>{let t=e.get(n.f),r=[];return t.state.doc.descendants(e=>{e.type.name===`heading`&&e.attrs.level&&r.push({text:e.textContent,level:e.attrs.level,id:e.attrs.id})}),r}}function I(e,r=!1){return i=>{let a=i.get(n.f),o=i.get(n.x)(e);if(!o)return;if(!r){let{state:e}=a;return a.dispatch(e.tr.replace(0,e.doc.content.size,new t.k(o.content,0,0)))}let s=i.get(n.D),c=i.get(n.u)({schema:s,doc:o,plugins:i.get(n.w)}),l=t.n.create(c);a.updateState(l)}}function L(e,t){return r=>{let i=r.get(n.f),{tr:a}=i.state,o=a.doc.nodeAt(e);if(!o)return;let s=t(o.attrs);return i.dispatch(a.setNodeMarkup(e,void 0,s))}}function R(e){return r=>{let i=r.get(n.x)(e),a=r.get(n.D),o=t.S.fromSchema(a).serializeFragment(i.content);return t.x.fromSchema(a).parseSlice(o)}}function z(e,t,r=!1){return i=>{let a=R(e)(i),o=i.get(n.f),s=o.state.doc.resolve(t),c=o.state.doc.content.size,l=r?s.pos:s.after(s.depth-1),u=Math.min(Math.max(l,0),c);o.dispatch(o.state.tr.replace(l,u,a))}}function B(e,t){return r=>{let i=r.get(n.f),a=R(e)(r);i.dispatch(i.state.tr.replace(t.from,t.to,a))}}var V=(...e)=>{let t=e.length,n=t;for(;n--;)if(typeof e[n]!=`function`)throw TypeError(`Expected a function`);return(...n)=>{let r=0,i=t?e[r](...n):n[0];for(;++r<t;)i=e[r](i);return i}};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return _}});
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DnwLefa7.js";
|
|
2
|
+
import { D as t, S as n, k as r, n as i, x as a } from "./dist-DaM7GJv6.js";
|
|
3
|
+
import { B as o, C as s, D as c, H as l, I as u, O as d, S as f, T as p, U as m, _ as h, a as g, b as _, c as ee, d as v, f as y, h as b, i as x, k as te, l as S, m as C, p as ne, r as re, s as w, t as T, u as E, v as D, w as O, x as k, y as A, z as ie } from "./lib-CCUU16r8.js";
|
|
4
|
+
import { t as j } from "./index.browser-D2DmEB8o.js";
|
|
5
|
+
//#region node_modules/.pnpm/@milkdown+utils@7.20.0/node_modules/@milkdown/utils/lib/index.js
|
|
6
|
+
var M = /* @__PURE__ */ e({
|
|
7
|
+
$command: () => F,
|
|
8
|
+
$commandAsync: () => ae,
|
|
9
|
+
$ctx: () => G,
|
|
10
|
+
$inputRule: () => I,
|
|
11
|
+
$inputRuleAsync: () => oe,
|
|
12
|
+
$mark: () => R,
|
|
13
|
+
$markAsync: () => ce,
|
|
14
|
+
$markAttr: () => X,
|
|
15
|
+
$markSchema: () => q,
|
|
16
|
+
$node: () => z,
|
|
17
|
+
$nodeAsync: () => B,
|
|
18
|
+
$nodeAttr: () => Y,
|
|
19
|
+
$nodeSchema: () => K,
|
|
20
|
+
$pasteRule: () => L,
|
|
21
|
+
$pasteRuleAsync: () => se,
|
|
22
|
+
$prose: () => V,
|
|
23
|
+
$proseAsync: () => H,
|
|
24
|
+
$remark: () => Z,
|
|
25
|
+
$shortcut: () => U,
|
|
26
|
+
$shortcutAsync: () => W,
|
|
27
|
+
$useKeymap: () => J,
|
|
28
|
+
$view: () => le,
|
|
29
|
+
$viewAsync: () => ue,
|
|
30
|
+
addTimer: () => P,
|
|
31
|
+
callCommand: () => de,
|
|
32
|
+
forceUpdate: () => fe,
|
|
33
|
+
getHTML: () => pe,
|
|
34
|
+
getMarkdown: () => me,
|
|
35
|
+
insert: () => Q,
|
|
36
|
+
insertPos: () => ve,
|
|
37
|
+
markdownToSlice: () => $,
|
|
38
|
+
nanoid: () => N,
|
|
39
|
+
outline: () => he,
|
|
40
|
+
pipe: () => be,
|
|
41
|
+
replaceAll: () => ge,
|
|
42
|
+
replaceRange: () => ye,
|
|
43
|
+
setAttr: () => _e
|
|
44
|
+
}), N = j("abcedfghicklmn", 10);
|
|
45
|
+
function P(e, t, n) {
|
|
46
|
+
let r = o(n || N()), i = !1, a = (n) => (n.record(r), n.update(t, (e) => e.concat(r)), async () => {
|
|
47
|
+
let o = await e(n, a, () => {
|
|
48
|
+
n.done(r), i = !0;
|
|
49
|
+
});
|
|
50
|
+
return i || n.done(r), () => {
|
|
51
|
+
if (n.update(t, (e) => e.filter((e) => e !== r)), n.clearTimer(r), o) {
|
|
52
|
+
let e = o();
|
|
53
|
+
e && "then" in e && e.catch(console.error);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
return a.timer = r, a;
|
|
58
|
+
}
|
|
59
|
+
function F(e, t) {
|
|
60
|
+
let n = S(e), r = (i) => async () => {
|
|
61
|
+
r.key = n, await i.wait(T);
|
|
62
|
+
let a = t(i);
|
|
63
|
+
return i.get(w).create(n, a), r.run = (t) => i.get(w).call(e, t), () => {
|
|
64
|
+
i.get(w).remove(n);
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
return r;
|
|
68
|
+
}
|
|
69
|
+
function ae(e, t, n) {
|
|
70
|
+
let r = S(e);
|
|
71
|
+
return P(async (n, i) => {
|
|
72
|
+
await n.wait(T);
|
|
73
|
+
let a = await t(n);
|
|
74
|
+
return n.get(w).create(r, a), i.run = (t) => n.get(w).call(e, t), i.key = r, () => {
|
|
75
|
+
n.get(w).remove(r);
|
|
76
|
+
};
|
|
77
|
+
}, ee, n);
|
|
78
|
+
}
|
|
79
|
+
function I(e) {
|
|
80
|
+
let t = (n) => async () => {
|
|
81
|
+
await n.wait(g);
|
|
82
|
+
let r = e(n);
|
|
83
|
+
return n.update(C, (e) => [...e, r]), t.inputRule = r, () => {
|
|
84
|
+
n.update(C, (e) => e.filter((e) => e !== r));
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
return t;
|
|
88
|
+
}
|
|
89
|
+
function oe(e, t) {
|
|
90
|
+
return P(async (t, n) => {
|
|
91
|
+
await t.wait(g);
|
|
92
|
+
let r = await e(t);
|
|
93
|
+
return t.update(C, (e) => [...e, r]), n.inputRule = r, () => {
|
|
94
|
+
t.update(C, (e) => e.filter((e) => e !== r));
|
|
95
|
+
};
|
|
96
|
+
}, v, t);
|
|
97
|
+
}
|
|
98
|
+
function L(e) {
|
|
99
|
+
let t = (n) => async () => {
|
|
100
|
+
await n.wait(g);
|
|
101
|
+
let r = e(n);
|
|
102
|
+
return n.update(f, (e) => [...e, r]), t.pasteRule = r, () => {
|
|
103
|
+
n.update(f, (e) => e.filter((e) => e !== r));
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
return t;
|
|
107
|
+
}
|
|
108
|
+
function se(e, t) {
|
|
109
|
+
return P(async (t, n) => {
|
|
110
|
+
await t.wait(g);
|
|
111
|
+
let r = await e(t);
|
|
112
|
+
return t.update(f, (e) => [...e, r]), n.pasteRule = r, () => {
|
|
113
|
+
t.update(f, (e) => e.filter((e) => e !== r));
|
|
114
|
+
};
|
|
115
|
+
}, s, t);
|
|
116
|
+
}
|
|
117
|
+
function R(e, t) {
|
|
118
|
+
let n = (r) => async () => {
|
|
119
|
+
let i = t(r);
|
|
120
|
+
return r.update(D, (t) => [...t.filter((t) => t[0] !== e), [e, i]]), n.id = e, n.schema = i, () => {
|
|
121
|
+
r.update(D, (t) => t.filter(([t]) => t !== e));
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
return n.type = (t) => {
|
|
125
|
+
let n = t.get(c).marks[e];
|
|
126
|
+
if (!n) throw l(e);
|
|
127
|
+
return n;
|
|
128
|
+
}, n;
|
|
129
|
+
}
|
|
130
|
+
function ce(e, t, n) {
|
|
131
|
+
let r = P(async (n, r, i) => {
|
|
132
|
+
let a = await t(n);
|
|
133
|
+
return n.update(D, (t) => [...t.filter((t) => t[0] !== e), [e, a]]), r.id = e, r.schema = a, i(), () => {
|
|
134
|
+
n.update(D, (t) => t.filter(([t]) => t !== e));
|
|
135
|
+
};
|
|
136
|
+
}, d, n);
|
|
137
|
+
return r.type = (t) => {
|
|
138
|
+
let n = t.get(c).marks[e];
|
|
139
|
+
if (!n) throw l(e);
|
|
140
|
+
return n;
|
|
141
|
+
}, r;
|
|
142
|
+
}
|
|
143
|
+
function z(e, t) {
|
|
144
|
+
let n = (r) => async () => {
|
|
145
|
+
let i = t(r);
|
|
146
|
+
return r.update(_, (t) => [...t.filter((t) => t[0] !== e), [e, i]]), n.id = e, n.schema = i, () => {
|
|
147
|
+
r.update(_, (t) => t.filter(([t]) => t !== e));
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
return n.type = (t) => {
|
|
151
|
+
let n = t.get(c).nodes[e];
|
|
152
|
+
if (!n) throw m(e);
|
|
153
|
+
return n;
|
|
154
|
+
}, n;
|
|
155
|
+
}
|
|
156
|
+
function B(e, t, n) {
|
|
157
|
+
let r = P(async (n, r, i) => {
|
|
158
|
+
let a = await t(n);
|
|
159
|
+
return n.update(_, (t) => [...t.filter((t) => t[0] !== e), [e, a]]), r.id = e, r.schema = a, i(), () => {
|
|
160
|
+
n.update(_, (t) => t.filter(([t]) => t !== e));
|
|
161
|
+
};
|
|
162
|
+
}, d, n);
|
|
163
|
+
return r.type = (t) => {
|
|
164
|
+
let n = t.get(c).nodes[e];
|
|
165
|
+
if (!n) throw m(e);
|
|
166
|
+
return n;
|
|
167
|
+
}, r;
|
|
168
|
+
}
|
|
169
|
+
function V(e) {
|
|
170
|
+
let t, n = (n) => async () => (await n.wait(g), t = e(n), n.update(O, (e) => [...e, t]), () => {
|
|
171
|
+
n.update(O, (e) => e.filter((e) => e !== t));
|
|
172
|
+
});
|
|
173
|
+
return n.plugin = () => t, n.key = () => t.spec.key, n;
|
|
174
|
+
}
|
|
175
|
+
function H(e, t) {
|
|
176
|
+
let n, r = P(async (t) => (await t.wait(g), n = await e(t), t.update(O, (e) => [...e, n]), () => {
|
|
177
|
+
t.update(O, (e) => e.filter((e) => e !== n));
|
|
178
|
+
}), v, t);
|
|
179
|
+
return r.plugin = () => n, r.key = () => n.spec.key, r;
|
|
180
|
+
}
|
|
181
|
+
function U(e) {
|
|
182
|
+
let t = (n) => async () => {
|
|
183
|
+
await n.wait(x);
|
|
184
|
+
let r = n.get(b), i = e(n), a = r.addObjectKeymap(i);
|
|
185
|
+
return t.keymap = i, () => {
|
|
186
|
+
a();
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
return t;
|
|
190
|
+
}
|
|
191
|
+
function W(e, t) {
|
|
192
|
+
return P(async (t, n) => {
|
|
193
|
+
await t.wait(x);
|
|
194
|
+
let r = t.get(b), i = await e(t), a = r.addObjectKeymap(i);
|
|
195
|
+
return n.keymap = i, () => {
|
|
196
|
+
a();
|
|
197
|
+
};
|
|
198
|
+
}, v, t);
|
|
199
|
+
}
|
|
200
|
+
function le(e, n) {
|
|
201
|
+
let r = (i) => async () => {
|
|
202
|
+
await i.wait(g);
|
|
203
|
+
let a = n(i);
|
|
204
|
+
return e.type(i) instanceof t ? i.update(A, (t) => [...t, [e.id, a]]) : i.update(h, (t) => [...t, [e.id, a]]), r.view = a, r.type = e, () => {
|
|
205
|
+
e.type(i) instanceof t ? i.update(A, (t) => t.filter((t) => t[0] !== e.id)) : i.update(h, (t) => t.filter((t) => t[0] !== e.id));
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
return r;
|
|
209
|
+
}
|
|
210
|
+
function ue(e, n, r) {
|
|
211
|
+
return P(async (r, i) => {
|
|
212
|
+
await r.wait(g);
|
|
213
|
+
let a = await n(r);
|
|
214
|
+
return e.type(r) instanceof t ? r.update(A, (t) => [...t, [e.id, a]]) : r.update(h, (t) => [...t, [e.id, a]]), i.view = a, i.type = e, () => {
|
|
215
|
+
e.type(r) instanceof t ? r.update(A, (t) => t.filter((t) => t[0] !== e.id)) : r.update(h, (t) => t.filter((t) => t[0] !== e.id));
|
|
216
|
+
};
|
|
217
|
+
}, ne, r);
|
|
218
|
+
}
|
|
219
|
+
function G(e, t) {
|
|
220
|
+
let n = ie(e, t), r = (e) => (e.inject(n), () => () => {
|
|
221
|
+
e.remove(n);
|
|
222
|
+
});
|
|
223
|
+
return r.key = n, r;
|
|
224
|
+
}
|
|
225
|
+
function K(e, t) {
|
|
226
|
+
let n = G(t, e), r = z(e, (e) => e.get(n.key)(e)), i = [n, r];
|
|
227
|
+
return i.id = r.id, i.node = r, i.type = (e) => r.type(e), i.ctx = n, i.key = n.key, i.extendSchema = (n) => K(e, n(t)), i;
|
|
228
|
+
}
|
|
229
|
+
function q(e, t) {
|
|
230
|
+
let n = G(t, e), r = R(e, (e) => e.get(n.key)(e)), i = [n, r];
|
|
231
|
+
return i.id = r.id, i.mark = r, i.type = (e) => r.type(e), i.ctx = n, i.key = n.key, i.extendSchema = (n) => q(e, n(t)), i;
|
|
232
|
+
}
|
|
233
|
+
function J(e, t) {
|
|
234
|
+
let n = G(Object.fromEntries(Object.entries(t).map(([e, { shortcuts: t, priority: n }]) => [e, {
|
|
235
|
+
shortcuts: t,
|
|
236
|
+
priority: n
|
|
237
|
+
}])), `${e}Keymap`), r = U((e) => {
|
|
238
|
+
let r = e.get(n.key), i = Object.entries(t).flatMap(([e, { command: t }]) => {
|
|
239
|
+
let n = r[e], i = [n.shortcuts].flat(), a = n.priority;
|
|
240
|
+
return i.map((e) => [e, {
|
|
241
|
+
key: e,
|
|
242
|
+
onRun: t,
|
|
243
|
+
priority: a
|
|
244
|
+
}]);
|
|
245
|
+
});
|
|
246
|
+
return Object.fromEntries(i);
|
|
247
|
+
}), i = [n, r];
|
|
248
|
+
return i.ctx = n, i.shortcuts = r, i.key = n.key, i.keymap = r.keymap, i;
|
|
249
|
+
}
|
|
250
|
+
var Y = (e, t = () => ({})) => G(t, `${e}Attr`), X = (e, t = () => ({})) => G(t, `${e}Attr`);
|
|
251
|
+
function Z(e, t, n) {
|
|
252
|
+
let r = G(n ?? {}, e), i = (e) => async () => {
|
|
253
|
+
await e.wait(re);
|
|
254
|
+
let n = {
|
|
255
|
+
plugin: t(e),
|
|
256
|
+
options: e.get(r.key)
|
|
257
|
+
};
|
|
258
|
+
return e.update(p, (e) => [...e, n]), () => {
|
|
259
|
+
e.update(p, (e) => e.filter((e) => e !== n));
|
|
260
|
+
};
|
|
261
|
+
}, a = [r, i];
|
|
262
|
+
return a.id = e, a.plugin = i, a.options = r, a;
|
|
263
|
+
}
|
|
264
|
+
function de(e, t) {
|
|
265
|
+
return (n) => n.get(w).call(e, t);
|
|
266
|
+
}
|
|
267
|
+
function fe() {
|
|
268
|
+
return (e) => {
|
|
269
|
+
let t = e.get(y), { tr: n } = t.state, r = Object.assign(Object.create(n), n).setTime(Date.now());
|
|
270
|
+
return t.dispatch(r);
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function pe() {
|
|
274
|
+
return (e) => {
|
|
275
|
+
let t = document.createElement("div"), r = e.get(c), i = e.get(y), a = n.fromSchema(r).serializeFragment(i.state.doc.content);
|
|
276
|
+
return t.appendChild(a), t.innerHTML;
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function me(e) {
|
|
280
|
+
return (t) => {
|
|
281
|
+
let n = t.get(y), r = t.get(c), i = t.get(te);
|
|
282
|
+
if (!e) return i(n.state.doc);
|
|
283
|
+
let a = n.state.doc.slice(e.from, e.to, !0), o = r.topNodeType.createAndFill(null, a.content);
|
|
284
|
+
return o ? i(o) : (console.error("No document found"), "");
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function Q(e, t = !1) {
|
|
288
|
+
return (i) => {
|
|
289
|
+
let o = i.get(y), s = i.get(k)(e);
|
|
290
|
+
if (!s) return;
|
|
291
|
+
if (!t) {
|
|
292
|
+
let e = o.state.selection.content();
|
|
293
|
+
return o.dispatch(o.state.tr.replaceSelection(new r(s.content, e.openStart, e.openEnd)).scrollIntoView());
|
|
294
|
+
}
|
|
295
|
+
let l = i.get(c), d = n.fromSchema(l).serializeFragment(s.content), f = a.fromSchema(l).parseSlice(d), p = u(f);
|
|
296
|
+
if (p) {
|
|
297
|
+
o.dispatch(o.state.tr.replaceSelectionWith(p, !0));
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
o.dispatch(o.state.tr.replaceSelection(f));
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
function he() {
|
|
304
|
+
return (e) => {
|
|
305
|
+
let t = e.get(y), n = [];
|
|
306
|
+
return t.state.doc.descendants((e) => {
|
|
307
|
+
e.type.name === "heading" && e.attrs.level && n.push({
|
|
308
|
+
text: e.textContent,
|
|
309
|
+
level: e.attrs.level,
|
|
310
|
+
id: e.attrs.id
|
|
311
|
+
});
|
|
312
|
+
}), n;
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
function ge(e, t = !1) {
|
|
316
|
+
return (n) => {
|
|
317
|
+
let a = n.get(y), o = n.get(k)(e);
|
|
318
|
+
if (!o) return;
|
|
319
|
+
if (!t) {
|
|
320
|
+
let { state: e } = a;
|
|
321
|
+
return a.dispatch(e.tr.replace(0, e.doc.content.size, new r(o.content, 0, 0)));
|
|
322
|
+
}
|
|
323
|
+
let s = n.get(c), l = n.get(E)({
|
|
324
|
+
schema: s,
|
|
325
|
+
doc: o,
|
|
326
|
+
plugins: n.get(O)
|
|
327
|
+
}), u = i.create(l);
|
|
328
|
+
a.updateState(u);
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function _e(e, t) {
|
|
332
|
+
return (n) => {
|
|
333
|
+
let r = n.get(y), { tr: i } = r.state, a = i.doc.nodeAt(e);
|
|
334
|
+
if (!a) return;
|
|
335
|
+
let o = t(a.attrs);
|
|
336
|
+
return r.dispatch(i.setNodeMarkup(e, void 0, o));
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
function $(e) {
|
|
340
|
+
return (t) => {
|
|
341
|
+
let r = t.get(k)(e), i = t.get(c), o = n.fromSchema(i).serializeFragment(r.content);
|
|
342
|
+
return a.fromSchema(i).parseSlice(o);
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function ve(e, t, n = !1) {
|
|
346
|
+
return (r) => {
|
|
347
|
+
let i = $(e)(r), a = r.get(y), o = a.state.doc.resolve(t), s = a.state.doc.content.size, c = n ? o.pos : o.after(o.depth - 1), l = Math.min(Math.max(c, 0), s);
|
|
348
|
+
a.dispatch(a.state.tr.replace(c, l, i));
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function ye(e, t) {
|
|
352
|
+
return (n) => {
|
|
353
|
+
let r = n.get(y), i = $(e)(n);
|
|
354
|
+
r.dispatch(r.state.tr.replace(t.from, t.to, i));
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
var be = (...e) => {
|
|
358
|
+
let t = e.length, n = t;
|
|
359
|
+
for (; n--;) if (typeof e[n] != "function") throw TypeError("Expected a function");
|
|
360
|
+
return (...n) => {
|
|
361
|
+
let r = 0, i = t ? e[r](...n) : n[0];
|
|
362
|
+
for (; ++r < t;) i = e[r](i);
|
|
363
|
+
return i;
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
//#endregion
|
|
367
|
+
export { q as a, K as c, Z as d, J as f, X as i, L as l, G as n, z as o, M as p, I as r, Y as s, F as t, V as u };
|