@milkdown/preset-commonmark 7.0.0-next.0 → 7.0.0-next.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/lib/composed/commands.d.ts.map +1 -1
- package/lib/composed/inputrules.d.ts.map +1 -1
- package/lib/composed/keymap.d.ts.map +1 -1
- package/lib/composed/plugins.d.ts +2 -1
- package/lib/composed/plugins.d.ts.map +1 -1
- package/lib/composed/schema.d.ts.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.es.js +15 -17
- package/lib/index.es.js.map +1 -1
- package/lib/mark/emphasis.d.ts.map +1 -1
- package/lib/mark/inline-code.d.ts.map +1 -1
- package/lib/mark/link.d.ts.map +1 -1
- package/lib/mark/strong.d.ts.map +1 -1
- package/lib/node/blockquote.d.ts.map +1 -1
- package/lib/node/bullet-list.d.ts.map +1 -1
- package/lib/node/code-block.d.ts.map +1 -1
- package/lib/node/doc.d.ts.map +1 -1
- package/lib/node/hardbreak.d.ts.map +1 -1
- package/lib/node/heading.d.ts.map +1 -1
- package/lib/node/hr.d.ts.map +1 -1
- package/lib/node/image.d.ts.map +1 -1
- package/lib/node/list-item.d.ts +1 -1
- package/lib/node/list-item.d.ts.map +1 -1
- package/lib/node/ordered-list.d.ts.map +1 -1
- package/lib/node/paragraph.d.ts.map +1 -1
- package/lib/node/text.d.ts.map +1 -1
- package/lib/plugin/hardbreak-clear-mark-plugin.d.ts.map +1 -1
- package/lib/plugin/hardbreak-filter-plugin.d.ts.map +1 -1
- package/lib/plugin/inline-nodes-cursor-plugin.d.ts +0 -4
- package/lib/plugin/inline-nodes-cursor-plugin.d.ts.map +1 -1
- package/lib/plugin/inline-sync-plugin/config.d.ts.map +1 -1
- package/lib/plugin/inline-sync-plugin/inline-sync-plugin.d.ts.map +1 -1
- package/lib/plugin/remark-add-order-in-list-plugin.d.ts.map +1 -1
- package/lib/plugin/remark-inline-link-plugin.d.ts.map +1 -1
- package/lib/plugin/remark-line-break.d.ts.map +1 -1
- package/lib/plugin/sync-heading-id-plugin.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/composed/commands.ts +1 -0
- package/src/composed/inputrules.ts +1 -0
- package/src/composed/keymap.ts +1 -0
- package/src/composed/plugins.ts +3 -1
- package/src/composed/schema.ts +1 -0
- package/src/index.ts +1 -0
- package/src/mark/emphasis.ts +5 -0
- package/src/mark/inline-code.ts +6 -0
- package/src/mark/link.ts +9 -0
- package/src/mark/strong.ts +6 -0
- package/src/node/blockquote.ts +7 -0
- package/src/node/bullet-list.ts +7 -0
- package/src/node/code-block.ts +10 -0
- package/src/node/doc.ts +1 -0
- package/src/node/hardbreak.ts +8 -0
- package/src/node/heading.ts +16 -2
- package/src/node/hr.ts +6 -0
- package/src/node/image.ts +11 -0
- package/src/node/list-item.ts +46 -1
- package/src/node/ordered-list.ts +6 -0
- package/src/node/paragraph.ts +6 -0
- package/src/node/text.ts +1 -0
- package/src/plugin/hardbreak-clear-mark-plugin.ts +1 -0
- package/src/plugin/hardbreak-filter-plugin.ts +3 -1
- package/src/plugin/inline-nodes-cursor-plugin.ts +1 -4
- package/src/plugin/inline-sync-plugin/config.ts +15 -1
- package/src/plugin/inline-sync-plugin/inline-sync-plugin.ts +5 -0
- package/src/plugin/remark-add-order-in-list-plugin.ts +1 -0
- package/src/plugin/remark-inline-link-plugin.ts +1 -0
- package/src/plugin/remark-line-break.ts +3 -0
- package/src/plugin/sync-heading-id-plugin.ts +2 -0
- package/src/plugin/sync-list-order-plugin.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/node/heading.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../src/node/heading.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAkBjD,eAAO,MAAM,kBAAkB,wCATU,IAAI,kCAS0C,CAAA;AAGvF,eAAO,MAAM,WAAW,qCAAuB,CAAA;AAG/C,eAAO,MAAM,aAAa,kDAgExB,CAAA;AAIF,eAAO,MAAM,sBAAsB,sCAgBjC,CAAA;AAKF,eAAO,MAAM,oBAAoB,4CAS/B,CAAA;AAKF,eAAO,MAAM,uBAAuB,6CAkBhC,CAAA;AAKJ,eAAO,MAAM,aAAa,sKAkDxB,CAAA"}
|
package/lib/node/hr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hr.d.ts","sourceRoot":"","sources":["../../src/node/hr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hr.d.ts","sourceRoot":"","sources":["../../src/node/hr.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,MAAM,qCAAkB,CAAA;AAGrC,eAAO,MAAM,QAAQ,6CAgBlB,CAAA;AAIH,eAAO,MAAM,iBAAiB,sCAS5B,CAAA;AAGF,eAAO,MAAM,eAAe,6CAkB1B,CAAA"}
|
package/lib/node/image.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/node/image.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/node/image.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,SAAS,qCAAqB,CAAA;AAG3C,eAAO,MAAM,WAAW,gDAyDtB,CAAA;AAGF,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAID,eAAO,MAAM,kBAAkB,+DAa3B,CAAA;AAIJ,eAAO,MAAM,kBAAkB,+DAkB7B,CAAA;AAKF,eAAO,MAAM,oBAAoB,sCAS/B,CAAA"}
|
package/lib/node/list-item.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const listItemAttr: import("@milkdown/utils").$NodeAttr;
|
|
2
2
|
export declare const listItemSchema: import("@milkdown/utils").$NodeSchema<"list_item">;
|
|
3
3
|
export declare const sinkListItemCommand: import("@milkdown/utils").$Command<unknown>;
|
|
4
|
-
export declare const splitListItemCommand: import("@milkdown/utils").$Command<unknown>;
|
|
5
4
|
export declare const liftListItemCommand: import("@milkdown/utils").$Command<unknown>;
|
|
5
|
+
export declare const splitListItemCommand: import("@milkdown/utils").$Command<unknown>;
|
|
6
6
|
export declare const listItemKeymap: import("@milkdown/utils").$UserKeymap<"listItemKeymap", "SinkListItem" | "NextListItem" | "LiftListItem">;
|
|
7
7
|
//# sourceMappingURL=list-item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item.d.ts","sourceRoot":"","sources":["../../src/node/list-item.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list-item.d.ts","sourceRoot":"","sources":["../../src/node/list-item.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,YAAY,qCAAwB,CAAA;AAGjD,eAAO,MAAM,cAAc,oDA2DxB,CAAA;AAcH,eAAO,MAAM,mBAAmB,6CAA4E,CAAA;AAc5G,eAAO,MAAM,mBAAmB,6CAA6E,CAAA;AAe7G,eAAO,MAAM,oBAAoB,6CAA8E,CAAA;AAM/G,eAAO,MAAM,cAAc,2GAsBzB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ordered-list.d.ts","sourceRoot":"","sources":["../../src/node/ordered-list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ordered-list.d.ts","sourceRoot":"","sources":["../../src/node/ordered-list.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,qCAA2B,CAAA;AAGvD,eAAO,MAAM,iBAAiB,uDAiD3B,CAAA;AAGH,eAAO,MAAM,0BAA0B,sCAKrC,CAAA;AAGF,eAAO,MAAM,wBAAwB,6CAA8E,CAAA;AAInH,eAAO,MAAM,iBAAiB,iFAQ5B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../src/node/paragraph.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../src/node/paragraph.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,aAAa,qCAAyB,CAAA;AAGnD,eAAO,MAAM,eAAe,oDAuCzB,CAAA;AAGH,eAAO,MAAM,mBAAmB,6CAA6E,CAAA;AAI7G,eAAO,MAAM,eAAe,0EAQ1B,CAAA"}
|
package/lib/node/text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/node/text.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/node/text.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,iCAcpB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hardbreak-clear-mark-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/hardbreak-clear-mark-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hardbreak-clear-mark-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/hardbreak-clear-mark-plugin.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,wBAAwB,kCAqCnC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hardbreak-filter-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/hardbreak-filter-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hardbreak-filter-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/hardbreak-filter-plugin.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB,kEAAwD,CAAA;AAIzF,eAAO,MAAM,qBAAqB,kCAuBhC,CAAA"}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This plugin is to solve the chrome 98 bug:
|
|
3
|
-
* https://discuss.prosemirror.net/t/cursor-jumps-at-the-end-of-line-when-it-betweens-two-inline-nodes/4641
|
|
4
|
-
*/
|
|
5
1
|
export declare const inlineNodesCursorPlugin: import("@milkdown/utils").$Prose;
|
|
6
2
|
//# sourceMappingURL=inline-nodes-cursor-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-nodes-cursor-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/inline-nodes-cursor-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inline-nodes-cursor-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/inline-nodes-cursor-plugin.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,kCAmFlC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/plugin/inline-sync-plugin/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/plugin/inline-sync-plugin/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAMxD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE;IACrC,QAAQ,EAAE,IAAI,CAAA;IACd,QAAQ,EAAE,IAAI,CAAA;IACd,GAAG,EAAE,GAAG,CAAA;IACR,EAAE,EAAE,WAAW,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb,KAAK,OAAO,CAAA;AAGb,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;CACb;AAGD,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,EAAE,mBAAmB,CAAA;IACtC,cAAc,EAAE,cAAc,CAAA;IAC9B,WAAW,EAAE,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAA;IACrC,eAAe,EAAE,CAAC,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;CACrE;AAGD,eAAO,MAAM,aAAa,EAAE,gBAyB3B,CAAA;AAaD,eAAO,MAAM,gBAAgB,sEAAgF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-sync-plugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/inline-sync-plugin/inline-sync-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inline-sync-plugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/inline-sync-plugin/inline-sync-plugin.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gBAAgB,kCAkD3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-add-order-in-list-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-add-order-in-list-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remark-add-order-in-list-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-add-order-in-list-plugin.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,0BAA0B,mCASrC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-inline-link-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-inline-link-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remark-inline-link-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-inline-link-plugin.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB,mCAAmC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-line-break.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-line-break.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remark-line-break.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-line-break.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,mCAmC1B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-heading-id-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/sync-heading-id-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync-heading-id-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/sync-heading-id-plugin.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB,kCA8C9B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milkdown/preset-commonmark",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.0.0-next.
|
|
4
|
+
"version": "7.0.0-next.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"remark-inline-links": "^6.0.0",
|
|
31
31
|
"tslib": "^2.4.0",
|
|
32
32
|
"unist-util-visit": "^4.0.0",
|
|
33
|
-
"@milkdown/exception": "7.0.0-next.
|
|
34
|
-
"@milkdown/utils": "7.0.0-next.
|
|
33
|
+
"@milkdown/exception": "7.0.0-next.1",
|
|
34
|
+
"@milkdown/utils": "7.0.0-next.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/unist": "^2.0.6",
|
|
38
|
-
"@milkdown/core": "7.0.0-next.
|
|
39
|
-
"@milkdown/ctx": "7.0.0-next.
|
|
40
|
-
"@milkdown/prose": "7.0.0-next.
|
|
38
|
+
"@milkdown/core": "7.0.0-next.1",
|
|
39
|
+
"@milkdown/ctx": "7.0.0-next.1",
|
|
40
|
+
"@milkdown/prose": "7.0.0-next.1"
|
|
41
41
|
},
|
|
42
42
|
"nx": {
|
|
43
43
|
"targets": {
|
package/src/composed/commands.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { MilkdownPlugin } from '@milkdown/ctx'
|
|
|
3
3
|
import { toggleEmphasisCommand, toggleInlineCodeCommand, toggleLinkCommand, toggleStrongCommand, updateLinkCommand } from '../mark'
|
|
4
4
|
import { createCodeBlockCommand, downgradeHeadingCommand, insertHardbreakCommand, insertHrCommand, insertImageCommand, liftListItemCommand, sinkListItemCommand, splitListItemCommand, turnIntoTextCommand, updateImageCommand, wrapInBlockquoteCommand, wrapInBulletListCommand, wrapInHeadingCommand, wrapInOrderedListCommand } from '../node'
|
|
5
5
|
|
|
6
|
+
/// @internal
|
|
6
7
|
export const commands: MilkdownPlugin[] = [
|
|
7
8
|
turnIntoTextCommand,
|
|
8
9
|
wrapInBlockquoteCommand,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { MilkdownPlugin } from '@milkdown/ctx'
|
|
3
3
|
import { createCodeBlockInputRule, insertHrInputRule, wrapInBlockquoteInputRule, wrapInBulletListInputRule, wrapInHeadingInputRule, wrapInOrderedListInputRule } from '../node'
|
|
4
4
|
|
|
5
|
+
/// @internal
|
|
5
6
|
export const inputrules: MilkdownPlugin[] = [
|
|
6
7
|
wrapInBlockquoteInputRule,
|
|
7
8
|
wrapInBulletListInputRule,
|
package/src/composed/keymap.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { MilkdownPlugin } from '@milkdown/ctx'
|
|
|
3
3
|
import { emphasisKeymap, inlineCodeKeymap, strongKeymap } from '../mark'
|
|
4
4
|
import { blockquoteKeymap, bulletListKeymap, codeBlockKeymap, hardbreakKeymap, headingKeymap, listItemKeymap, orderedListKeymap, paragraphKeymap } from '../node'
|
|
5
5
|
|
|
6
|
+
/// @internal
|
|
6
7
|
export const keymap: MilkdownPlugin[] = [
|
|
7
8
|
blockquoteKeymap,
|
|
8
9
|
codeBlockKeymap,
|
package/src/composed/plugins.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
2
|
|
|
3
|
+
import type { MilkdownPlugin } from '@milkdown/ctx'
|
|
3
4
|
import { hardbreakClearMarkPlugin, hardbreakFilterNodes, hardbreakFilterPlugin, inlineNodesCursorPlugin, inlineSyncConfig, inlineSyncPlugin, remarkAddOrderInListPlugin, remarkInlineLinkPlugin, remarkLineBreak, syncHeadingIdPlugin, syncListOrderPlugin } from '../plugin'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
/// @internal
|
|
7
|
+
export const plugins: MilkdownPlugin[] = [
|
|
6
8
|
inlineSyncConfig,
|
|
7
9
|
inlineSyncPlugin,
|
|
8
10
|
|
package/src/composed/schema.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { MilkdownPlugin } from '@milkdown/ctx'
|
|
|
4
4
|
import { emphasisAttr, emphasisSchema, inlineCodeAttr, inlineCodeSchema, linkAttr, linkSchema, strongAttr, strongSchema } from '../mark'
|
|
5
5
|
import { blockquoteAttr, blockquoteSchema, bulletListAttr, bulletListSchema, codeBlockAttr, codeBlockSchema, docSchema, hardbreakAttr, hardbreakSchema, headingAttr, headingIdGenerator, headingSchema, hrAttr, hrSchema, imageAttr, imageSchema, listItemAttr, listItemSchema, orderedListAttr, orderedListSchema, paragraphAttr, paragraphSchema, textSchema } from '../node'
|
|
6
6
|
|
|
7
|
+
/// @internal
|
|
7
8
|
export const schema: MilkdownPlugin[] = [
|
|
8
9
|
docSchema,
|
|
9
10
|
|
package/src/index.ts
CHANGED
package/src/mark/emphasis.ts
CHANGED
|
@@ -3,8 +3,10 @@ import { commandsCtx } from '@milkdown/core'
|
|
|
3
3
|
import { toggleMark } from '@milkdown/prose/commands'
|
|
4
4
|
import { $command, $markAttr, $markSchema, $useKeymap } from '@milkdown/utils'
|
|
5
5
|
|
|
6
|
+
/// HTML attributes for the emphasis mark.
|
|
6
7
|
export const emphasisAttr = $markAttr('emphasis')
|
|
7
8
|
|
|
9
|
+
/// Emphasis mark schema.
|
|
8
10
|
export const emphasisSchema = $markSchema('emphasis', ctx => ({
|
|
9
11
|
inclusive: false,
|
|
10
12
|
parseDOM: [
|
|
@@ -29,8 +31,11 @@ export const emphasisSchema = $markSchema('emphasis', ctx => ({
|
|
|
29
31
|
},
|
|
30
32
|
}))
|
|
31
33
|
|
|
34
|
+
/// A command to toggle the emphasis mark.
|
|
32
35
|
export const toggleEmphasisCommand = $command('ToggleEmphasis', () => () => toggleMark(emphasisSchema.type()))
|
|
33
36
|
|
|
37
|
+
/// Keymap for the emphasis mark.
|
|
38
|
+
/// - `Mod-i` - Toggle the emphasis mark.
|
|
34
39
|
export const emphasisKeymap = $useKeymap('emphasisKeymap', {
|
|
35
40
|
ToggleEmphasis: {
|
|
36
41
|
shortcuts: 'Mod-i',
|
package/src/mark/inline-code.ts
CHANGED
|
@@ -3,7 +3,10 @@ import { commandsCtx } from '@milkdown/core'
|
|
|
3
3
|
import type { MarkType } from '@milkdown/prose/model'
|
|
4
4
|
import { $command, $markAttr, $markSchema, $useKeymap } from '@milkdown/utils'
|
|
5
5
|
|
|
6
|
+
/// HTML attributes for the inlineCode mark.
|
|
6
7
|
export const inlineCodeAttr = $markAttr('inlineCode')
|
|
8
|
+
|
|
9
|
+
/// InlineCode mark schema.
|
|
7
10
|
export const inlineCodeSchema = $markSchema('inlineCode', ctx => ({
|
|
8
11
|
priority: 100,
|
|
9
12
|
code: true,
|
|
@@ -26,6 +29,7 @@ export const inlineCodeSchema = $markSchema('inlineCode', ctx => ({
|
|
|
26
29
|
},
|
|
27
30
|
}))
|
|
28
31
|
|
|
32
|
+
/// A command to toggle the inlineCode mark.
|
|
29
33
|
export const toggleInlineCodeCommand = $command('ToggleInlineCode', () => () => (state, dispatch) => {
|
|
30
34
|
const { selection, tr } = state
|
|
31
35
|
if (selection.empty)
|
|
@@ -53,6 +57,8 @@ export const toggleInlineCodeCommand = $command('ToggleInlineCode', () => () =>
|
|
|
53
57
|
return true
|
|
54
58
|
})
|
|
55
59
|
|
|
60
|
+
/// Keymap for the inlineCode mark.
|
|
61
|
+
/// - `Mod-e` - Toggle the inlineCode mark.
|
|
56
62
|
export const inlineCodeKeymap = $useKeymap('inlineCodeKeymap', {
|
|
57
63
|
ToggleInlineCode: {
|
|
58
64
|
shortcuts: 'Mod-e',
|
package/src/mark/link.ts
CHANGED
|
@@ -5,7 +5,10 @@ import type { Node as ProseNode } from '@milkdown/prose/model'
|
|
|
5
5
|
import { TextSelection } from '@milkdown/prose/state'
|
|
6
6
|
import { $command, $markAttr, $markSchema } from '@milkdown/utils'
|
|
7
7
|
|
|
8
|
+
/// HTML attributes for the link mark.
|
|
8
9
|
export const linkAttr = $markAttr('link')
|
|
10
|
+
|
|
11
|
+
/// Link mark schema.
|
|
9
12
|
export const linkSchema = $markSchema('link', ctx => ({
|
|
10
13
|
attrs: {
|
|
11
14
|
href: {},
|
|
@@ -44,11 +47,17 @@ export const linkSchema = $markSchema('link', ctx => ({
|
|
|
44
47
|
},
|
|
45
48
|
}))
|
|
46
49
|
|
|
50
|
+
/// @internal
|
|
47
51
|
export type UpdateLinkCommandPayload = {
|
|
48
52
|
href?: string
|
|
49
53
|
title?: string
|
|
50
54
|
}
|
|
55
|
+
/// A command to toggle the link mark.
|
|
56
|
+
/// You can pass the `href` and `title` to the link.
|
|
51
57
|
export const toggleLinkCommand = $command('ToggleLink', () => (payload: UpdateLinkCommandPayload = {}) => toggleMark(linkSchema.type(), payload))
|
|
58
|
+
|
|
59
|
+
/// A command to update the link mark.
|
|
60
|
+
/// You can pass the `href` and `title` to update the link.
|
|
52
61
|
export const updateLinkCommand = $command('UpdateLink', () => (payload: UpdateLinkCommandPayload = {}) => (state, dispatch) => {
|
|
53
62
|
if (!dispatch)
|
|
54
63
|
return false
|
package/src/mark/strong.ts
CHANGED
|
@@ -3,7 +3,10 @@ import { commandsCtx } from '@milkdown/core'
|
|
|
3
3
|
import { toggleMark } from '@milkdown/prose/commands'
|
|
4
4
|
import { $command, $markAttr, $markSchema, $useKeymap } from '@milkdown/utils'
|
|
5
5
|
|
|
6
|
+
/// HTML attributes for the strong mark.
|
|
6
7
|
export const strongAttr = $markAttr('strong')
|
|
8
|
+
|
|
9
|
+
/// Strong mark schema.
|
|
7
10
|
export const strongSchema = $markSchema('strong', ctx => ({
|
|
8
11
|
inclusive: false,
|
|
9
12
|
parseDOM: [
|
|
@@ -28,8 +31,11 @@ export const strongSchema = $markSchema('strong', ctx => ({
|
|
|
28
31
|
},
|
|
29
32
|
}))
|
|
30
33
|
|
|
34
|
+
/// A command to toggle the strong mark.
|
|
31
35
|
export const toggleStrongCommand = $command('ToggleStrong', () => () => toggleMark(strongSchema.type()))
|
|
32
36
|
|
|
37
|
+
/// Keymap for the strong mark.
|
|
38
|
+
/// - `Mod-b` - Toggle the strong mark.
|
|
33
39
|
export const strongKeymap = $useKeymap('strongKeymap', {
|
|
34
40
|
ToggleBold: {
|
|
35
41
|
shortcuts: ['Mod-b'],
|
package/src/node/blockquote.ts
CHANGED
|
@@ -5,8 +5,10 @@ import { wrappingInputRule } from '@milkdown/prose/inputrules'
|
|
|
5
5
|
import type { $NodeSchema } from '@milkdown/utils'
|
|
6
6
|
import { $command, $inputRule, $nodeAttr, $nodeSchema, $useKeymap } from '@milkdown/utils'
|
|
7
7
|
|
|
8
|
+
/// HTML attributes for blockquote node.
|
|
8
9
|
export const blockquoteAttr = $nodeAttr('blockquote')
|
|
9
10
|
|
|
11
|
+
/// Schema for blockquote node.
|
|
10
12
|
export const blockquoteSchema: $NodeSchema<'blockquote'> = $nodeSchema('blockquote', ctx => ({
|
|
11
13
|
content: 'block+',
|
|
12
14
|
group: 'block',
|
|
@@ -27,10 +29,15 @@ export const blockquoteSchema: $NodeSchema<'blockquote'> = $nodeSchema('blockquo
|
|
|
27
29
|
},
|
|
28
30
|
}))
|
|
29
31
|
|
|
32
|
+
/// This input rule will convert a line that starts with `> ` into a blockquote.
|
|
33
|
+
/// You can type `> ` at the start of a line to create a blockquote.
|
|
30
34
|
export const wrapInBlockquoteInputRule = $inputRule(() => wrappingInputRule(/^\s*>\s$/, blockquoteSchema.type()))
|
|
31
35
|
|
|
36
|
+
/// This command will wrap the current selection in a blockquote.
|
|
32
37
|
export const wrapInBlockquoteCommand = $command('WrapInBlockquote', () => () => wrapIn(blockquoteSchema.type()))
|
|
33
38
|
|
|
39
|
+
/// Keymap for blockquote.
|
|
40
|
+
/// - `Mod-Shift-b`: Wrap selection in blockquote.
|
|
34
41
|
export const blockquoteKeymap = $useKeymap('blockquoteKeymap', {
|
|
35
42
|
WrapInBlockquote: {
|
|
36
43
|
shortcuts: 'Mod-Shift-b',
|
package/src/node/bullet-list.ts
CHANGED
|
@@ -5,7 +5,10 @@ import { wrapIn } from '@milkdown/prose/commands'
|
|
|
5
5
|
import { wrappingInputRule } from '@milkdown/prose/inputrules'
|
|
6
6
|
import { $command, $inputRule, $nodeAttr, $nodeSchema, $useKeymap } from '@milkdown/utils'
|
|
7
7
|
|
|
8
|
+
/// HTML attributes for bullet list node.
|
|
8
9
|
export const bulletListAttr = $nodeAttr('bulletList')
|
|
10
|
+
|
|
11
|
+
/// Schema for bullet list node.
|
|
9
12
|
export const bulletListSchema = $nodeSchema('bullet_list', (ctx) => {
|
|
10
13
|
return {
|
|
11
14
|
content: 'listItem+',
|
|
@@ -57,10 +60,14 @@ export const bulletListSchema = $nodeSchema('bullet_list', (ctx) => {
|
|
|
57
60
|
}
|
|
58
61
|
})
|
|
59
62
|
|
|
63
|
+
/// Input rule for wrapping a block in bullet list node.
|
|
60
64
|
export const wrapInBulletListInputRule = $inputRule(() => wrappingInputRule(/^\s*([-+*])\s$/, bulletListSchema.type()))
|
|
61
65
|
|
|
66
|
+
/// Command for creating bullet list node.
|
|
62
67
|
export const wrapInBulletListCommand = $command('WrapInBulletList', () => () => wrapIn(bulletListSchema.type()))
|
|
63
68
|
|
|
69
|
+
/// Keymap for bullet list node.
|
|
70
|
+
/// - `Mod-Alt-8`: Wrap a block in bullet list.
|
|
64
71
|
export const bulletListKeymap = $useKeymap('bulletListKeymap', {
|
|
65
72
|
WrapInBulletList: {
|
|
66
73
|
shortcuts: 'Mod-Alt-8',
|
package/src/node/code-block.ts
CHANGED
|
@@ -5,11 +5,13 @@ import { setBlockType } from '@milkdown/prose/commands'
|
|
|
5
5
|
import { textblockTypeInputRule } from '@milkdown/prose/inputrules'
|
|
6
6
|
import { $command, $inputRule, $nodeAttr, $nodeSchema, $useKeymap } from '@milkdown/utils'
|
|
7
7
|
|
|
8
|
+
/// HTML attributes for code block node.
|
|
8
9
|
export const codeBlockAttr = $nodeAttr('codeBlock', () => ({
|
|
9
10
|
pre: {},
|
|
10
11
|
code: {},
|
|
11
12
|
}))
|
|
12
13
|
|
|
14
|
+
/// Schema for code block node.
|
|
13
15
|
export const codeBlockSchema = $nodeSchema('code_block', (ctx) => {
|
|
14
16
|
return {
|
|
15
17
|
content: 'text*',
|
|
@@ -68,11 +70,17 @@ export const codeBlockSchema = $nodeSchema('code_block', (ctx) => {
|
|
|
68
70
|
}
|
|
69
71
|
})
|
|
70
72
|
|
|
73
|
+
/// A input rule for creating code block.
|
|
74
|
+
/// For example, ` ```javascript ` will create a code block with language javascript.
|
|
71
75
|
export const createCodeBlockInputRule = $inputRule(() => textblockTypeInputRule(/^```(?<language>[a-z]*)?[\s\n]$/, codeBlockSchema.type(), match => ({
|
|
72
76
|
language: match.groups?.language ?? '',
|
|
73
77
|
})))
|
|
74
78
|
|
|
79
|
+
/// A command for creating code block.
|
|
80
|
+
/// You can pass the language of the code block as the parameter.
|
|
75
81
|
export const createCodeBlockCommand = $command('CreateCodeBlock', () => (language = '') => setBlockType(codeBlockSchema.type(), { language }))
|
|
82
|
+
|
|
83
|
+
/// A command for updating the code block language of the target position.
|
|
76
84
|
export const updateCodeBlockLanguageCommand = $command('UpdateCodeBlockLanguage', () => ({ pos, language }: { pos: number; language: string } = { pos: -1, language: '' }) => (state, dispatch) => {
|
|
77
85
|
if (pos >= 0) {
|
|
78
86
|
dispatch?.(state.tr.setNodeAttribute(pos, 'language', language))
|
|
@@ -82,6 +90,8 @@ export const updateCodeBlockLanguageCommand = $command('UpdateCodeBlockLanguage'
|
|
|
82
90
|
return false
|
|
83
91
|
})
|
|
84
92
|
|
|
93
|
+
/// Keymap for code block.
|
|
94
|
+
/// - `Mod-Alt-c`: Create a code block.
|
|
85
95
|
export const codeBlockKeymap = $useKeymap('codeBlockKeymap', {
|
|
86
96
|
CreateCodeBlock: {
|
|
87
97
|
shortcuts: 'Mod-Alt-c',
|
package/src/node/doc.ts
CHANGED
package/src/node/hardbreak.ts
CHANGED
|
@@ -3,12 +3,17 @@ import { commandsCtx } from '@milkdown/core'
|
|
|
3
3
|
import { Selection } from '@milkdown/prose/state'
|
|
4
4
|
import { $command, $nodeAttr, $nodeSchema, $useKeymap } from '@milkdown/utils'
|
|
5
5
|
|
|
6
|
+
/// HTML attributes for the hardbreak node.
|
|
7
|
+
///
|
|
8
|
+
/// Default value:
|
|
9
|
+
/// - `data-is-inline` - Whether the hardbreak is inline.
|
|
6
10
|
export const hardbreakAttr = $nodeAttr('hardbreak', (node) => {
|
|
7
11
|
return {
|
|
8
12
|
'data-is-inline': node.attrs.isInline,
|
|
9
13
|
}
|
|
10
14
|
})
|
|
11
15
|
|
|
16
|
+
/// Hardbreak node schema.
|
|
12
17
|
export const hardbreakSchema = $nodeSchema('hardbreak', ctx => ({
|
|
13
18
|
inline: true,
|
|
14
19
|
group: 'inline',
|
|
@@ -38,6 +43,7 @@ export const hardbreakSchema = $nodeSchema('hardbreak', ctx => ({
|
|
|
38
43
|
},
|
|
39
44
|
}))
|
|
40
45
|
|
|
46
|
+
/// Command to insert a hardbreak.
|
|
41
47
|
export const insertHardbreakCommand = $command('InsertHardbreak', () => () => (state, dispatch) => {
|
|
42
48
|
const { selection, tr } = state
|
|
43
49
|
if (selection.empty) {
|
|
@@ -57,6 +63,8 @@ export const insertHardbreakCommand = $command('InsertHardbreak', () => () => (s
|
|
|
57
63
|
return true
|
|
58
64
|
})
|
|
59
65
|
|
|
66
|
+
/// Keymap for the hardbreak node.
|
|
67
|
+
/// - `Shift-Enter` - Insert a hardbreak.
|
|
60
68
|
export const hardbreakKeymap = $useKeymap('hardbreakKeymap', {
|
|
61
69
|
InsertHardbreak: {
|
|
62
70
|
shortcuts: 'Shift-Enter',
|
package/src/node/heading.ts
CHANGED
|
@@ -19,10 +19,14 @@ const defaultHeadingIdGenerator = (node: Node) =>
|
|
|
19
19
|
.toLowerCase()
|
|
20
20
|
.trim()
|
|
21
21
|
|
|
22
|
+
/// This is a slice contains a function to generate heading id.
|
|
23
|
+
/// You can configure it to generate id in your own way.
|
|
22
24
|
export const headingIdGenerator = $ctx(defaultHeadingIdGenerator, 'headingIdGenerator')
|
|
23
25
|
|
|
26
|
+
/// HTML attributes for heading node.
|
|
24
27
|
export const headingAttr = $nodeAttr('heading')
|
|
25
28
|
|
|
29
|
+
/// Schema for heading node.
|
|
26
30
|
export const headingSchema = $nodeSchema('heading', (ctx) => {
|
|
27
31
|
const getId = ctx.get(headingIdGenerator.key)
|
|
28
32
|
return {
|
|
@@ -89,6 +93,8 @@ export const headingSchema = $nodeSchema('heading', (ctx) => {
|
|
|
89
93
|
}
|
|
90
94
|
})
|
|
91
95
|
|
|
96
|
+
/// This input rule can turn the selected block into heading.
|
|
97
|
+
/// You can input numbers of `#` and a `space` to create heading.
|
|
92
98
|
export const wrapInHeadingInputRule = $inputRule((ctx) => {
|
|
93
99
|
return textblockTypeInputRule(/^(?<hashes>#+)\s$/, headingSchema.type(), (match) => {
|
|
94
100
|
const x = match.groups?.hashes?.length || 0
|
|
@@ -105,9 +111,11 @@ export const wrapInHeadingInputRule = $inputRule((ctx) => {
|
|
|
105
111
|
}
|
|
106
112
|
return { level: x }
|
|
107
113
|
})
|
|
108
|
-
}
|
|
109
|
-
)
|
|
114
|
+
})
|
|
110
115
|
|
|
116
|
+
/// This command can turn the selected block into heading.
|
|
117
|
+
/// You can pass the level of heading to this command.
|
|
118
|
+
/// By default, the level is 1, which means it will create a `h1` element.
|
|
111
119
|
export const wrapInHeadingCommand = $command('WrapInHeading', () => {
|
|
112
120
|
return (level?: number) => {
|
|
113
121
|
level ??= 1
|
|
@@ -119,6 +127,9 @@ export const wrapInHeadingCommand = $command('WrapInHeading', () => {
|
|
|
119
127
|
}
|
|
120
128
|
})
|
|
121
129
|
|
|
130
|
+
/// This command can downgrade the selected heading.
|
|
131
|
+
/// For example, if you have a `h2` element, and you call this command, you will get a `h1` element.
|
|
132
|
+
/// If the element is already a `h1` element, it will turn it into a `p` element.
|
|
122
133
|
export const downgradeHeadingCommand = $command('DowngradeHeading', () => () =>
|
|
123
134
|
(state, dispatch, view) => {
|
|
124
135
|
const { $from } = state.selection
|
|
@@ -139,6 +150,9 @@ export const downgradeHeadingCommand = $command('DowngradeHeading', () => () =>
|
|
|
139
150
|
return true
|
|
140
151
|
})
|
|
141
152
|
|
|
153
|
+
/// Keymap for heading node.
|
|
154
|
+
/// - `<Mod-Alt-{1-6}>`: Turn the selected block into `h{1-6}` element.
|
|
155
|
+
/// - `<Delete>/<Backspace>`: Downgrade the selected heading.
|
|
142
156
|
export const headingKeymap = $useKeymap('headingKeymap', {
|
|
143
157
|
TurnIntoH1: {
|
|
144
158
|
shortcuts: 'Mod-Alt-1',
|
package/src/node/hr.ts
CHANGED
|
@@ -4,7 +4,10 @@ import { Selection } from '@milkdown/prose/state'
|
|
|
4
4
|
import { $command, $inputRule, $nodeAttr, $nodeSchema } from '@milkdown/utils'
|
|
5
5
|
import { paragraphSchema } from './paragraph'
|
|
6
6
|
|
|
7
|
+
/// HTML attributes for the hr node.
|
|
7
8
|
export const hrAttr = $nodeAttr('hr')
|
|
9
|
+
|
|
10
|
+
/// Hr node schema.
|
|
8
11
|
export const hrSchema = $nodeSchema('hr', ctx => ({
|
|
9
12
|
group: 'block',
|
|
10
13
|
parseDOM: [{ tag: 'hr' }],
|
|
@@ -23,6 +26,8 @@ export const hrSchema = $nodeSchema('hr', ctx => ({
|
|
|
23
26
|
},
|
|
24
27
|
}))
|
|
25
28
|
|
|
29
|
+
/// Input rule to insert a hr.
|
|
30
|
+
/// For example, `---` will be converted to a hr.
|
|
26
31
|
export const insertHrInputRule = $inputRule(() => new InputRule(
|
|
27
32
|
/^(?:---|___\s|\*\*\*\s)$/, (state, match, start, end) => {
|
|
28
33
|
const { tr } = state
|
|
@@ -34,6 +39,7 @@ export const insertHrInputRule = $inputRule(() => new InputRule(
|
|
|
34
39
|
},
|
|
35
40
|
))
|
|
36
41
|
|
|
42
|
+
/// Command to insert a hr.
|
|
37
43
|
export const insertHrCommand = $command('InsertHr', () => () => (state, dispatch) => {
|
|
38
44
|
if (!dispatch)
|
|
39
45
|
return true
|
package/src/node/image.ts
CHANGED
|
@@ -4,8 +4,10 @@ import { findSelectedNodeOfType } from '@milkdown/prose'
|
|
|
4
4
|
import { InputRule } from '@milkdown/prose/inputrules'
|
|
5
5
|
import { $command, $inputRule, $nodeAttr, $nodeSchema } from '@milkdown/utils'
|
|
6
6
|
|
|
7
|
+
/// HTML attributes for image node.
|
|
7
8
|
export const imageAttr = $nodeAttr('image')
|
|
8
9
|
|
|
10
|
+
/// Schema for image node.
|
|
9
11
|
export const imageSchema = $nodeSchema('image', (ctx) => {
|
|
10
12
|
return {
|
|
11
13
|
inline: true,
|
|
@@ -65,11 +67,15 @@ export const imageSchema = $nodeSchema('image', (ctx) => {
|
|
|
65
67
|
}
|
|
66
68
|
})
|
|
67
69
|
|
|
70
|
+
/// @internal
|
|
68
71
|
export type UpdateImageCommandPayload = {
|
|
69
72
|
src?: string
|
|
70
73
|
title?: string
|
|
71
74
|
alt?: string
|
|
72
75
|
}
|
|
76
|
+
|
|
77
|
+
/// This command will insert a image node.
|
|
78
|
+
/// You can pass a payload to set `src`, `alt` and `title` for the image node.
|
|
73
79
|
export const insertImageCommand = $command('InsertImage', () => (payload: UpdateImageCommandPayload = {}) =>
|
|
74
80
|
(state, dispatch) => {
|
|
75
81
|
if (!dispatch)
|
|
@@ -85,6 +91,8 @@ export const insertImageCommand = $command('InsertImage', () => (payload: Update
|
|
|
85
91
|
return true
|
|
86
92
|
})
|
|
87
93
|
|
|
94
|
+
/// This command will update the selected image node.
|
|
95
|
+
/// You can pass a payload to update `src`, `alt` and `title` for the image node.
|
|
88
96
|
export const updateImageCommand = $command('UpdateImage', () => (payload: UpdateImageCommandPayload = {}) => (state, dispatch) => {
|
|
89
97
|
const nodeWithPos = findSelectedNodeOfType(state.selection, imageSchema.type())
|
|
90
98
|
if (!nodeWithPos)
|
|
@@ -105,6 +113,9 @@ export const updateImageCommand = $command('UpdateImage', () => (payload: Update
|
|
|
105
113
|
return true
|
|
106
114
|
})
|
|
107
115
|
|
|
116
|
+
/// This input rule will insert a image node.
|
|
117
|
+
/// You can input `` to insert a image node.
|
|
118
|
+
/// The `title` is optional.
|
|
108
119
|
export const insertImageInputRule = $inputRule(() => new InputRule(
|
|
109
120
|
/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,
|
|
110
121
|
(state, match, start, end) => {
|
package/src/node/list-item.ts
CHANGED
|
@@ -4,8 +4,10 @@ import { expectDomTypeError } from '@milkdown/exception'
|
|
|
4
4
|
import { liftListItem, sinkListItem, splitListItem } from '@milkdown/prose/schema-list'
|
|
5
5
|
import { $command, $nodeAttr, $nodeSchema, $useKeymap } from '@milkdown/utils'
|
|
6
6
|
|
|
7
|
+
/// HTML attributes for list item node.
|
|
7
8
|
export const listItemAttr = $nodeAttr('listItem')
|
|
8
9
|
|
|
10
|
+
/// Schema for list item node.
|
|
9
11
|
export const listItemSchema = $nodeSchema('list_item', ctx => ({
|
|
10
12
|
group: 'listItem',
|
|
11
13
|
content: 'paragraph block*',
|
|
@@ -67,10 +69,53 @@ export const listItemSchema = $nodeSchema('list_item', ctx => ({
|
|
|
67
69
|
},
|
|
68
70
|
}))
|
|
69
71
|
|
|
72
|
+
/// The command to sink list item.
|
|
73
|
+
///
|
|
74
|
+
/// For example:
|
|
75
|
+
/// ```md
|
|
76
|
+
/// * List item 1
|
|
77
|
+
/// * List item 2 <- cursor here
|
|
78
|
+
/// ```
|
|
79
|
+
/// Will get:
|
|
80
|
+
/// ```md
|
|
81
|
+
/// * List item 1
|
|
82
|
+
/// * List item 2
|
|
83
|
+
/// ```
|
|
70
84
|
export const sinkListItemCommand = $command('SinkListItem', () => () => sinkListItem(listItemSchema.type()))
|
|
71
|
-
|
|
85
|
+
|
|
86
|
+
/// The command to lift list item.
|
|
87
|
+
///
|
|
88
|
+
/// For example:
|
|
89
|
+
/// ```md
|
|
90
|
+
/// * List item 1
|
|
91
|
+
/// * List item 2 <- cursor here
|
|
92
|
+
/// ```
|
|
93
|
+
/// Will get:
|
|
94
|
+
/// ```md
|
|
95
|
+
/// * List item 1
|
|
96
|
+
/// * List item 2
|
|
97
|
+
/// ```
|
|
72
98
|
export const liftListItemCommand = $command('SplitListItem', () => () => liftListItem(listItemSchema.type()))
|
|
73
99
|
|
|
100
|
+
/// The command to split a list item.
|
|
101
|
+
///
|
|
102
|
+
/// For example:
|
|
103
|
+
/// ```md
|
|
104
|
+
/// * List item 1
|
|
105
|
+
/// * List item 2 <- cursor here
|
|
106
|
+
/// ```
|
|
107
|
+
/// Will get:
|
|
108
|
+
/// ```md
|
|
109
|
+
/// * List item 1
|
|
110
|
+
/// * List item 2
|
|
111
|
+
/// * <- cursor here
|
|
112
|
+
/// ```
|
|
113
|
+
export const splitListItemCommand = $command('SplitListItem', () => () => splitListItem(listItemSchema.type()))
|
|
114
|
+
|
|
115
|
+
/// Keymap for list item node.
|
|
116
|
+
/// - `<Enter>`: Split the current list item.
|
|
117
|
+
/// - `<Tab>/<Mod-]>`: Sink the current list item.
|
|
118
|
+
/// - `<Shift-Tab>/<Mod-[>`: Lift the current list item.
|
|
74
119
|
export const listItemKeymap = $useKeymap('listItemKeymap', {
|
|
75
120
|
NextListItem: {
|
|
76
121
|
shortcuts: 'Enter',
|