@milkdown/preset-gfm 5.3.0 → 5.3.1
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/package.json +11 -17
- package/lib/index.cjs.js +0 -49
- package/lib/index.cjs.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milkdown/preset-gfm",
|
|
3
|
-
"version": "5.3.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "5.3.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./lib/index.es.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"import": "./lib/index.es.js",
|
|
10
|
-
"require": "./lib/index.cjs.js"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
7
|
"sideEffects": false,
|
|
14
8
|
"license": "MIT",
|
|
15
9
|
"files": [
|
|
@@ -27,21 +21,21 @@
|
|
|
27
21
|
},
|
|
28
22
|
"dependencies": {
|
|
29
23
|
"@emotion/css": "^11.1.3",
|
|
30
|
-
"@milkdown/plugin-table": "5.3.
|
|
31
|
-
"@milkdown/preset-commonmark": "5.3.
|
|
32
|
-
"@milkdown/utils": "5.3.
|
|
24
|
+
"@milkdown/plugin-table": "5.3.1",
|
|
25
|
+
"@milkdown/preset-commonmark": "5.3.1",
|
|
26
|
+
"@milkdown/utils": "5.3.1",
|
|
33
27
|
"tslib": "^2.3.1"
|
|
34
28
|
},
|
|
35
29
|
"devDependencies": {
|
|
36
|
-
"@milkdown/prose": "5.3.
|
|
37
|
-
"@milkdown/core": "5.3.
|
|
38
|
-
"@milkdown/utils": "5.3.
|
|
39
|
-
"@milkdown/design-system": "5.3.
|
|
30
|
+
"@milkdown/prose": "5.3.1",
|
|
31
|
+
"@milkdown/core": "5.3.1",
|
|
32
|
+
"@milkdown/utils": "5.3.1",
|
|
33
|
+
"@milkdown/design-system": "5.3.1"
|
|
40
34
|
},
|
|
41
35
|
"scripts": {
|
|
42
36
|
"start": "vite",
|
|
43
37
|
"watch": "vite build --watch",
|
|
44
|
-
"test": "
|
|
38
|
+
"test": "vitest",
|
|
45
39
|
"tsc": "tsc --noEmit",
|
|
46
40
|
"build": "vite build && tsc --emitDeclarationOnly"
|
|
47
41
|
},
|
package/lib/index.cjs.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";var B=Object.defineProperty,H=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var w=(c,n,o)=>n in c?B(c,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):c[n]=o,k=(c,n)=>{for(var o in n||(n={}))_.call(n,o)&&w(c,o,n[o]);if(x)for(var o of x(n))$.call(n,o)&&w(c,o,n[o]);return c},j=(c,n)=>H(c,R(n));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var d=require("@milkdown/plugin-table"),t=require("@milkdown/preset-commonmark"),m=require("@milkdown/utils"),l=require("@milkdown/prose"),v=require("@emotion/css"),i=require("@milkdown/core");const D=/(https?:\/\/)?www\.[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)$/,z=()=>l.inputRules({rules:[new l.InputRule(D,(c,n,o,e)=>{const{schema:r}=c,[u]=n;return u?c.tr.replaceWith(o,e,r.text(u)).addMark(o,u.length+o,r.marks.link.create({href:u.startsWith("www")?`https://${u}`:u})):null})]}),F=m.createPlugin(()=>({prosePlugins:()=>[z()]})),g=j(k(k({},t.SupportedKeys),d.SupportedKeys),{StrikeThrough:"StrikeThrough",TaskList:"TaskList"}),h=i.createCmdKey(),A=m.createMark(c=>{const n="strike_through",o=c.getStyle(e=>v.css`
|
|
2
|
-
text-decoration-color: ${e.palette("secondary")};
|
|
3
|
-
`);return{id:n,schema:()=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",{class:c.getClassName(e.attrs,"strike-through",o)}],parseMarkdown:{match:e=>e.type==="delete",runner:(e,r,u)=>{e.openMark(u),e.next(r.children),e.closeMark(u)}},toMarkdown:{match:e=>e.type.name===n,runner:(e,r)=>{e.withMark(r,"delete")}}}),inputRules:e=>[l.markRule(/(?:~~)([^~]+)(?:~~)$/,e),l.markRule(/(?:^|[^~])(~([^~]+)~)$/,e)],commands:e=>[i.createCmd(h,()=>l.toggleMark(e))],shortcuts:{[g.StrikeThrough]:m.createShortcut(h,"Mod-Alt-x")}}}),y=i.createCmdKey(),I=i.createCmdKey(),P=i.createCmdKey(),O=i.createCmdKey(),E=m.createNode(c=>{const n="task_list_item",o=c.getStyle(({palette:e,size:r})=>v.css`
|
|
4
|
-
list-style-type: none;
|
|
5
|
-
position: relative;
|
|
6
|
-
|
|
7
|
-
& > div {
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
padding: 0 2px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
label {
|
|
13
|
-
position: absolute;
|
|
14
|
-
top: 0;
|
|
15
|
-
left: -2rem;
|
|
16
|
-
display: inline-block;
|
|
17
|
-
width: 1.5rem;
|
|
18
|
-
height: 1.5rem;
|
|
19
|
-
margin: 0.5rem 0;
|
|
20
|
-
input {
|
|
21
|
-
visibility: hidden;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
label:before {
|
|
25
|
-
position: absolute;
|
|
26
|
-
top: 0;
|
|
27
|
-
right: 0;
|
|
28
|
-
bottom: 0;
|
|
29
|
-
left: 0;
|
|
30
|
-
border-radius: ${r.radius};
|
|
31
|
-
}
|
|
32
|
-
label:hover:before {
|
|
33
|
-
background: ${e("background")};
|
|
34
|
-
}
|
|
35
|
-
&[data-checked='true'] {
|
|
36
|
-
label {
|
|
37
|
-
color: ${e("primary")};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
&[data-checked='false'] {
|
|
41
|
-
label {
|
|
42
|
-
color: ${e("solid",.87)};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
.paragraph {
|
|
46
|
-
margin: 0.5rem 0;
|
|
47
|
-
}
|
|
48
|
-
`);return{id:n,schema:()=>({group:"listItem",content:"paragraph block*",defining:!0,attrs:{checked:{default:!1}},parseDOM:[{tag:'li[data-type="task-list-item"]',getAttrs:e=>{if(!(e instanceof HTMLElement))throw new Error;return{checked:e.dataset.checked==="true"}}}],toDOM:e=>["li",{"data-type":"task-item","data-checked":e.attrs.checked?"true":"false",class:c.getClassName(e.attrs,"task-list-item",o)},0],parseMarkdown:{match:({type:e,checked:r})=>e==="listItem"&&r!==null,runner:(e,r,u)=>{e.openNode(u,{checked:r.checked}),e.next(r.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name===n,runner:(e,r)=>{e.openNode("listItem",void 0,{checked:r.attrs.checked}),e.next(r.content),e.closeNode()}}}),inputRules:e=>[l.wrappingInputRule(/^\s*(\[([ |x])\])\s$/,e,r=>({checked:r[r.length-1]==="x"}))],commands:e=>[i.createCmd(y,()=>l.splitListItem(e)),i.createCmd(I,()=>l.sinkListItem(e)),i.createCmd(P,()=>l.liftListItem(e)),i.createCmd(O,()=>l.wrapIn(e))],shortcuts:{[g.NextListItem]:m.createShortcut(y,"Enter"),[g.SinkListItem]:m.createShortcut(I,"Mod-]"),[g.LiftListItem]:m.createShortcut(P,"Mod-["),[g.TaskList]:m.createShortcut(O,"Mod-Alt-9")},view:e=>(r,u,N)=>{const T=e.get(i.themeToolCtx).slots.icon,f=document.createElement("li"),p=document.createElement("label"),q=document.createElement("span"),s=document.createElement("input"),M=document.createElement("div");let L=T("unchecked");p.appendChild(L);const S=a=>{const b=T(a);p.replaceChild(b,L),L=b};p.contentEditable="false",s.type="checkbox";const C=a=>{const b=a.target;if(!(b instanceof HTMLInputElement))return;if(!u.editable){s.checked=!s.checked;return}const{tr:W}=u.state;u.dispatch(W.setNodeMarkup(N(),void 0,{checked:b.checked}))};s.addEventListener("change",C),f.dataset.checked=r.attrs.checked,r.attrs.checked&&s.setAttribute("checked","checked"),p.append(s,q),f.append(p,M);const K={"data-type":"task-item","data-checked":r.attrs.checked?"true":"false",class:c.getClassName(r.attrs,"task-list-item",o)};return Object.entries(K).forEach(([a,b])=>{f.setAttribute(a,b)}),S(r.attrs.checked?"checked":"unchecked"),{dom:f,contentDOM:M,update:a=>a.type.name!==n?!1:(f.dataset.checked=a.attrs.checked,a.attrs.checked?s.setAttribute("checked","checked"):s.removeAttribute("checked"),S(a.attrs.checked?"checked":"unchecked"),!0),destroy:()=>{s.removeEventListener("change",C)}}}}}),Z=m.AtomList.create([...t.commonmark,d.tablePlugin(),F(),A(),E()]),U=j(k({},t.commands),{ToggleStrikeThrough:h,TurnIntoTaskList:O,SinkTaskListItem:I,LiftTaskListItem:P,SplitTaskListItem:y});Object.defineProperty(exports,"BreakTable",{enumerable:!0,get:function(){return d.BreakTable}});Object.defineProperty(exports,"InsertTable",{enumerable:!0,get:function(){return d.InsertTable}});Object.defineProperty(exports,"NextCell",{enumerable:!0,get:function(){return d.NextCell}});Object.defineProperty(exports,"PrevCell",{enumerable:!0,get:function(){return d.PrevCell}});Object.defineProperty(exports,"createTable",{enumerable:!0,get:function(){return d.createTable}});Object.defineProperty(exports,"table",{enumerable:!0,get:function(){return d.table}});Object.defineProperty(exports,"tablePlugin",{enumerable:!0,get:function(){return d.tablePlugin}});Object.defineProperty(exports,"InsertHardbreak",{enumerable:!0,get:function(){return t.InsertHardbreak}});Object.defineProperty(exports,"InsertHr",{enumerable:!0,get:function(){return t.InsertHr}});Object.defineProperty(exports,"InsertImage",{enumerable:!0,get:function(){return t.InsertImage}});Object.defineProperty(exports,"LiftListItem",{enumerable:!0,get:function(){return t.LiftListItem}});Object.defineProperty(exports,"ModifyImage",{enumerable:!0,get:function(){return t.ModifyImage}});Object.defineProperty(exports,"ModifyLink",{enumerable:!0,get:function(){return t.ModifyLink}});Object.defineProperty(exports,"SinkListItem",{enumerable:!0,get:function(){return t.SinkListItem}});Object.defineProperty(exports,"SplitListItem",{enumerable:!0,get:function(){return t.SplitListItem}});Object.defineProperty(exports,"ToggleBold",{enumerable:!0,get:function(){return t.ToggleBold}});Object.defineProperty(exports,"ToggleInlineCode",{enumerable:!0,get:function(){return t.ToggleInlineCode}});Object.defineProperty(exports,"ToggleItalic",{enumerable:!0,get:function(){return t.ToggleItalic}});Object.defineProperty(exports,"ToggleLink",{enumerable:!0,get:function(){return t.ToggleLink}});Object.defineProperty(exports,"TurnIntoCodeFence",{enumerable:!0,get:function(){return t.TurnIntoCodeFence}});Object.defineProperty(exports,"TurnIntoHeading",{enumerable:!0,get:function(){return t.TurnIntoHeading}});Object.defineProperty(exports,"TurnIntoText",{enumerable:!0,get:function(){return t.TurnIntoText}});Object.defineProperty(exports,"WrapInBlockquote",{enumerable:!0,get:function(){return t.WrapInBlockquote}});Object.defineProperty(exports,"WrapInBulletList",{enumerable:!0,get:function(){return t.WrapInBulletList}});Object.defineProperty(exports,"WrapInOrderedList",{enumerable:!0,get:function(){return t.WrapInOrderedList}});Object.defineProperty(exports,"blockquote",{enumerable:!0,get:function(){return t.blockquote}});Object.defineProperty(exports,"bulletList",{enumerable:!0,get:function(){return t.bulletList}});Object.defineProperty(exports,"codeFence",{enumerable:!0,get:function(){return t.codeFence}});Object.defineProperty(exports,"codeInline",{enumerable:!0,get:function(){return t.codeInline}});Object.defineProperty(exports,"commonmark",{enumerable:!0,get:function(){return t.commonmark}});Object.defineProperty(exports,"commonmarkNodes",{enumerable:!0,get:function(){return t.commonmarkNodes}});Object.defineProperty(exports,"commonmarkPlugins",{enumerable:!0,get:function(){return t.commonmarkPlugins}});Object.defineProperty(exports,"doc",{enumerable:!0,get:function(){return t.doc}});Object.defineProperty(exports,"em",{enumerable:!0,get:function(){return t.em}});Object.defineProperty(exports,"hardbreak",{enumerable:!0,get:function(){return t.hardbreak}});Object.defineProperty(exports,"heading",{enumerable:!0,get:function(){return t.heading}});Object.defineProperty(exports,"hr",{enumerable:!0,get:function(){return t.hr}});Object.defineProperty(exports,"image",{enumerable:!0,get:function(){return t.image}});Object.defineProperty(exports,"link",{enumerable:!0,get:function(){return t.link}});Object.defineProperty(exports,"listItem",{enumerable:!0,get:function(){return t.listItem}});Object.defineProperty(exports,"orderedList",{enumerable:!0,get:function(){return t.orderedList}});Object.defineProperty(exports,"paragraph",{enumerable:!0,get:function(){return t.paragraph}});Object.defineProperty(exports,"strong",{enumerable:!0,get:function(){return t.strong}});Object.defineProperty(exports,"text",{enumerable:!0,get:function(){return t.text}});exports.LiftTaskListItem=P;exports.SinkTaskListItem=I;exports.SplitTaskListItem=y;exports.SupportedKeys=g;exports.ToggleStrikeThrough=h;exports.TurnIntoTaskList=O;exports.commands=U;exports.gfm=Z;exports.strikeThrough=A;exports.taskListItem=E;
|
|
49
|
-
//# sourceMappingURL=index.cjs.js.map
|
package/lib/index.cjs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/auto-link.ts","../src/supported-keys.ts","../src/strike-through.ts","../src/task-list-item.ts","../src/index.ts"],"sourcesContent":["/* Copyright 2021, Milkdown by Mirone. */\nimport { InputRule, inputRules } from '@milkdown/prose';\nimport { createPlugin } from '@milkdown/utils';\n\nconst urlRegex =\n /(https?:\\/\\/)?www\\.[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z]{2,}\\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)$/;\n\nconst proseUrlPlugin = () =>\n inputRules({\n rules: [\n new InputRule(urlRegex, (state, match, start, end) => {\n const { schema } = state;\n const [text] = match;\n if (!text) return null;\n\n return state.tr\n .replaceWith(start, end, schema.text(text))\n .addMark(\n start,\n text.length + start,\n schema.marks.link.create({ href: text.startsWith('www') ? `https://${text}` : text }),\n );\n }),\n ],\n });\n\nexport const urlPlugin = createPlugin(() => ({ prosePlugins: () => [proseUrlPlugin()] }));\n","/* Copyright 2021, Milkdown by Mirone. */\nimport { SupportedKeys as TableKeys } from '@milkdown/plugin-table';\nimport { SupportedKeys as CommonmarkKeys } from '@milkdown/preset-commonmark';\n\nexport const SupportedKeys = {\n ...CommonmarkKeys,\n ...TableKeys,\n StrikeThrough: 'StrikeThrough',\n TaskList: 'TaskList',\n} as const;\nexport type SupportedKeys = typeof SupportedKeys;\n","/* Copyright 2021, Milkdown by Mirone. */\nimport { css } from '@emotion/css';\nimport { createCmd, createCmdKey } from '@milkdown/core';\nimport { markRule, toggleMark } from '@milkdown/prose';\nimport { createMark, createShortcut } from '@milkdown/utils';\n\nimport { SupportedKeys } from './supported-keys';\n\ntype Keys = SupportedKeys['StrikeThrough'];\n\nexport const ToggleStrikeThrough = createCmdKey();\n\nexport const strikeThrough = createMark<Keys>((utils) => {\n const id = 'strike_through';\n const style = utils.getStyle(\n (themeTool) =>\n css`\n text-decoration-color: ${themeTool.palette('secondary')};\n `,\n );\n\n return {\n id,\n schema: () => ({\n parseDOM: [\n { tag: 'del' },\n { style: 'text-decoration', getAttrs: (value) => (value === 'line-through') as false },\n ],\n toDOM: (mark) => ['del', { class: utils.getClassName(mark.attrs, 'strike-through', style) }],\n parseMarkdown: {\n match: (node) => node.type === 'delete',\n runner: (state, node, markType) => {\n state.openMark(markType);\n state.next(node.children);\n state.closeMark(markType);\n },\n },\n toMarkdown: {\n match: (mark) => mark.type.name === id,\n runner: (state, mark) => {\n state.withMark(mark, 'delete');\n },\n },\n }),\n inputRules: (markType) => [\n markRule(/(?:~~)([^~]+)(?:~~)$/, markType),\n markRule(/(?:^|[^~])(~([^~]+)~)$/, markType),\n ],\n commands: (markType) => [createCmd(ToggleStrikeThrough, () => toggleMark(markType))],\n shortcuts: {\n [SupportedKeys.StrikeThrough]: createShortcut(ToggleStrikeThrough, 'Mod-Alt-x'),\n },\n };\n});\n","/* Copyright 2021, Milkdown by Mirone. */\nimport { css } from '@emotion/css';\nimport { createCmd, createCmdKey, themeToolCtx } from '@milkdown/core';\nimport type { Icon } from '@milkdown/design-system';\nimport { liftListItem, sinkListItem, splitListItem, wrapIn, wrappingInputRule } from '@milkdown/prose';\nimport { createNode, createShortcut } from '@milkdown/utils';\n\nimport { SupportedKeys } from './supported-keys';\n\ntype Keys = Extract<keyof SupportedKeys, 'SinkListItem' | 'LiftListItem' | 'NextListItem' | 'TaskList'>;\n\nexport const SplitTaskListItem = createCmdKey();\nexport const SinkTaskListItem = createCmdKey();\nexport const LiftTaskListItem = createCmdKey();\nexport const TurnIntoTaskList = createCmdKey();\n\nexport const taskListItem = createNode<Keys>((utils) => {\n const id = 'task_list_item';\n const style = utils.getStyle(\n ({ palette, size }) =>\n css`\n list-style-type: none;\n position: relative;\n\n & > div {\n overflow: hidden;\n padding: 0 2px;\n }\n\n label {\n position: absolute;\n top: 0;\n left: -2rem;\n display: inline-block;\n width: 1.5rem;\n height: 1.5rem;\n margin: 0.5rem 0;\n input {\n visibility: hidden;\n }\n }\n label:before {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: ${size.radius};\n }\n label:hover:before {\n background: ${palette('background')};\n }\n &[data-checked='true'] {\n label {\n color: ${palette('primary')};\n }\n }\n &[data-checked='false'] {\n label {\n color: ${palette('solid', 0.87)};\n }\n }\n .paragraph {\n margin: 0.5rem 0;\n }\n `,\n );\n\n return {\n id,\n schema: () => ({\n group: 'listItem',\n content: 'paragraph block*',\n defining: true,\n attrs: {\n checked: {\n default: false,\n },\n },\n parseDOM: [\n {\n tag: 'li[data-type=\"task-list-item\"]',\n getAttrs: (dom) => {\n if (!(dom instanceof HTMLElement)) {\n throw new Error();\n }\n return { checked: dom.dataset.checked === 'true' };\n },\n },\n ],\n toDOM: (node) => [\n 'li',\n {\n 'data-type': 'task-item',\n 'data-checked': node.attrs.checked ? 'true' : 'false',\n class: utils.getClassName(node.attrs, 'task-list-item', style),\n },\n 0,\n ],\n parseMarkdown: {\n match: ({ type, checked }) => {\n return type === 'listItem' && checked !== null;\n },\n runner: (state, node, type) => {\n state.openNode(type, { checked: node.checked as boolean });\n state.next(node.children);\n state.closeNode();\n },\n },\n toMarkdown: {\n match: (node) => node.type.name === id,\n runner: (state, node) => {\n state.openNode('listItem', undefined, { checked: node.attrs.checked });\n state.next(node.content);\n state.closeNode();\n },\n },\n }),\n inputRules: (nodeType) => [\n wrappingInputRule(/^\\s*(\\[([ |x])\\])\\s$/, nodeType, (match) => ({\n checked: match[match.length - 1] === 'x',\n })),\n ],\n commands: (nodeType) => [\n createCmd(SplitTaskListItem, () => splitListItem(nodeType)),\n createCmd(SinkTaskListItem, () => sinkListItem(nodeType)),\n createCmd(LiftTaskListItem, () => liftListItem(nodeType)),\n createCmd(TurnIntoTaskList, () => wrapIn(nodeType)),\n ],\n shortcuts: {\n [SupportedKeys.NextListItem]: createShortcut(SplitTaskListItem, 'Enter'),\n [SupportedKeys.SinkListItem]: createShortcut(SinkTaskListItem, 'Mod-]'),\n [SupportedKeys.LiftListItem]: createShortcut(LiftTaskListItem, 'Mod-['),\n [SupportedKeys.TaskList]: createShortcut(TurnIntoTaskList, 'Mod-Alt-9'),\n },\n view: (ctx) => (node, view, getPos) => {\n const createIcon = ctx.get(themeToolCtx).slots.icon;\n\n const listItem = document.createElement('li');\n const checkboxWrapper = document.createElement('label');\n const checkboxStyler = document.createElement('span');\n const checkbox = document.createElement('input');\n const content = document.createElement('div');\n\n let icon = createIcon('unchecked');\n checkboxWrapper.appendChild(icon);\n const setIcon = (name: Icon) => {\n const nextIcon = createIcon(name);\n checkboxWrapper.replaceChild(nextIcon, icon);\n icon = nextIcon;\n };\n\n checkboxWrapper.contentEditable = 'false';\n checkbox.type = 'checkbox';\n const onChange = (event: Event) => {\n const target = event.target;\n if (!(target instanceof HTMLInputElement)) return;\n\n if (!view.editable) {\n checkbox.checked = !checkbox.checked;\n\n return;\n }\n\n const { tr } = view.state;\n\n view.dispatch(\n tr.setNodeMarkup(getPos(), undefined, {\n checked: target.checked,\n }),\n );\n };\n checkbox.addEventListener('change', onChange);\n\n listItem.dataset.checked = node.attrs.checked;\n if (node.attrs.checked) {\n checkbox.setAttribute('checked', 'checked');\n }\n\n checkboxWrapper.append(checkbox, checkboxStyler);\n listItem.append(checkboxWrapper, content);\n\n const attributes = {\n 'data-type': 'task-item',\n 'data-checked': node.attrs.checked ? 'true' : 'false',\n class: utils.getClassName(node.attrs, 'task-list-item', style),\n };\n Object.entries(attributes).forEach(([key, value]) => {\n listItem.setAttribute(key, value);\n });\n setIcon(node.attrs.checked ? 'checked' : 'unchecked');\n\n return {\n dom: listItem,\n contentDOM: content,\n update: (updatedNode) => {\n if (updatedNode.type.name !== id) return false;\n\n listItem.dataset.checked = updatedNode.attrs.checked;\n if (updatedNode.attrs.checked) {\n checkbox.setAttribute('checked', 'checked');\n } else {\n checkbox.removeAttribute('checked');\n }\n setIcon(updatedNode.attrs.checked ? 'checked' : 'unchecked');\n\n return true;\n },\n destroy: () => {\n checkbox.removeEventListener('change', onChange);\n },\n };\n },\n };\n});\n","/* Copyright 2021, Milkdown by Mirone. */\nimport { tablePlugin } from '@milkdown/plugin-table';\nimport { commands as commonmarkCommands, commonmark } from '@milkdown/preset-commonmark';\nimport { AtomList } from '@milkdown/utils';\n\nimport { urlPlugin } from './auto-link';\nimport { strikeThrough, ToggleStrikeThrough } from './strike-through';\nimport {\n LiftTaskListItem,\n SinkTaskListItem,\n SplitTaskListItem,\n taskListItem,\n TurnIntoTaskList,\n} from './task-list-item';\n\nexport * from './strike-through';\nexport { SupportedKeys } from './supported-keys';\nexport * from './task-list-item';\nexport {\n BreakTable,\n // command\n createTable,\n InsertTable,\n NextCell,\n PrevCell,\n // gather\n table,\n tablePlugin,\n} from '@milkdown/plugin-table';\nexport {\n blockquote,\n bulletList,\n codeFence,\n codeInline,\n commonmark,\n // gather\n commonmarkNodes,\n commonmarkPlugins,\n // node\n doc,\n em,\n hardbreak,\n heading,\n hr,\n image,\n // command\n InsertHardbreak,\n InsertHr,\n InsertImage,\n LiftListItem,\n link,\n listItem,\n ModifyImage,\n ModifyLink,\n orderedList,\n paragraph,\n SinkListItem,\n SplitListItem,\n strong,\n text,\n ToggleBold,\n ToggleInlineCode,\n ToggleItalic,\n ToggleLink,\n TurnIntoCodeFence,\n TurnIntoHeading,\n TurnIntoText,\n WrapInBlockquote,\n WrapInBulletList,\n WrapInOrderedList,\n} from '@milkdown/preset-commonmark';\n\nexport const gfm = AtomList.create([...commonmark, tablePlugin(), urlPlugin(), strikeThrough(), taskListItem()]);\n\nexport const commands = {\n ...commonmarkCommands,\n ToggleStrikeThrough,\n TurnIntoTaskList,\n SinkTaskListItem,\n LiftTaskListItem,\n SplitTaskListItem,\n} as const;\nexport type Commands = typeof commands;\n"],"names":["inputRules","InputRule","createPlugin","CommonmarkKeys","TableKeys","createCmdKey","createMark","utils","css","markRule","createCmd","toggleMark","createShortcut","createNode","wrappingInputRule","splitListItem","sinkListItem","liftListItem","wrapIn","themeToolCtx","AtomList","commonmark","tablePlugin","commonmarkCommands"],"mappings":"utBAIA,KAAM,GACF,+HAEE,EAAiB,IACnBA,aAAW,CACP,MAAO,CACH,GAAIC,aAAU,EAAU,CAAC,EAAO,EAAO,EAAO,IAAQ,MAC5C,CAAE,UAAW,EACb,CAAC,GAAQ,QACV,GAEE,EAAM,GACR,YAAY,EAAO,EAAK,EAAO,KAAK,IACpC,QACG,EACA,EAAK,OAAS,EACd,EAAO,MAAM,KAAK,OAAO,CAAE,KAAM,EAAK,WAAW,OAAS,WAAW,IAAS,KAPpE,UAarB,EAAYC,eAAa,MAAS,aAAc,IAAM,CAAC,QCtBvD,EAAgB,SACtBC,iBACAC,iBAFsB,CAGzB,cAAe,gBACf,SAAU,aCED,EAAsBC,iBAEtB,EAAgBC,aAAiB,AAACC,GAAU,MAC/C,GAAK,iBACL,EAAQA,EAAM,SACh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