@milkdown/preset-gfm 6.5.4 → 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 +8 -0
- package/lib/composed/commands.d.ts.map +1 -0
- package/lib/composed/index.d.ts +6 -0
- package/lib/composed/index.d.ts.map +1 -0
- package/lib/composed/inputrules.d.ts +3 -0
- package/lib/composed/inputrules.d.ts.map +1 -0
- package/lib/composed/keymap.d.ts +3 -0
- package/lib/composed/keymap.d.ts.map +1 -0
- package/lib/composed/plugins.d.ts +3 -0
- package/lib/composed/plugins.d.ts.map +1 -0
- package/lib/composed/schema.d.ts +3 -0
- package/lib/composed/schema.d.ts.map +1 -0
- package/lib/index.d.ts +4 -34
- package/lib/index.d.ts.map +1 -1
- package/lib/index.es.js +634 -2328
- package/lib/index.es.js.map +1 -1
- package/lib/mark/index.d.ts +2 -0
- package/lib/mark/index.d.ts.map +1 -0
- package/lib/mark/strike-through.d.ts +5 -0
- package/lib/mark/strike-through.d.ts.map +1 -0
- package/lib/node/footnote/definition.d.ts +2 -0
- package/lib/node/footnote/definition.d.ts.map +1 -0
- package/lib/{footnote → node/footnote}/index.d.ts +0 -0
- package/lib/node/footnote/index.d.ts.map +1 -0
- package/lib/node/footnote/reference.d.ts +2 -0
- package/lib/node/footnote/reference.d.ts.map +1 -0
- package/lib/node/index.d.ts +4 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/table/index.d.ts +32 -0
- package/lib/node/table/index.d.ts.map +1 -0
- package/lib/node/table/utils.d.ts +26 -0
- package/lib/node/table/utils.d.ts.map +1 -0
- package/lib/node/task-list-item.d.ts +2 -0
- package/lib/node/task-list-item.d.ts.map +1 -0
- package/lib/plugin/auto-insert-zero-space-plugin.d.ts +2 -0
- package/lib/plugin/auto-insert-zero-space-plugin.d.ts.map +1 -0
- package/lib/plugin/column-resizing-plugin.d.ts +2 -0
- package/lib/plugin/column-resizing-plugin.d.ts.map +1 -0
- package/lib/plugin/index.d.ts +5 -0
- package/lib/plugin/index.d.ts.map +1 -0
- package/lib/plugin/remark-gfm-plugin.d.ts +2 -0
- package/lib/plugin/remark-gfm-plugin.d.ts.map +1 -0
- package/lib/plugin/table-editing-plugin.d.ts +2 -0
- package/lib/plugin/table-editing-plugin.d.ts.map +1 -0
- package/package.json +13 -10
- package/src/composed/commands.ts +24 -0
- package/src/composed/index.ts +6 -0
- package/src/composed/inputrules.ts +8 -0
- package/src/composed/keymap.ts +10 -0
- package/src/composed/plugins.ts +11 -0
- package/src/composed/schema.ts +20 -0
- package/src/index.ts +6 -89
- package/src/mark/index.ts +2 -0
- package/src/mark/strike-through.ts +46 -0
- package/src/node/footnote/definition.ts +70 -0
- package/src/{footnote → node/footnote}/index.ts +0 -0
- package/src/node/footnote/reference.ts +60 -0
- package/src/node/index.ts +4 -0
- package/src/node/table/index.ts +318 -0
- package/src/node/table/utils.ts +509 -0
- package/src/node/task-list-item.ts +88 -0
- package/src/{table/plugin/auto-insert-zero-space.ts → plugin/auto-insert-zero-space-plugin.ts} +14 -15
- package/src/plugin/column-resizing-plugin.ts +6 -0
- package/src/plugin/index.ts +5 -0
- package/src/plugin/remark-gfm-plugin.ts +6 -0
- package/src/plugin/table-editing-plugin.ts +6 -0
- package/lib/footnote/definition.d.ts +0 -3
- package/lib/footnote/definition.d.ts.map +0 -1
- package/lib/footnote/index.d.ts.map +0 -1
- package/lib/footnote/reference.d.ts +0 -3
- package/lib/footnote/reference.d.ts.map +0 -1
- package/lib/footnote/utils.d.ts +0 -3
- package/lib/footnote/utils.d.ts.map +0 -1
- package/lib/strike-through.d.ts +0 -3
- package/lib/strike-through.d.ts.map +0 -1
- package/lib/supported-keys.d.ts +0 -28
- package/lib/supported-keys.d.ts.map +0 -1
- package/lib/table/command.d.ts +0 -4
- package/lib/table/command.d.ts.map +0 -1
- package/lib/table/index.d.ts +0 -10
- package/lib/table/index.d.ts.map +0 -1
- package/lib/table/nodes/index.d.ts +0 -12
- package/lib/table/nodes/index.d.ts.map +0 -1
- package/lib/table/operator-plugin/actions.d.ts +0 -20
- package/lib/table/operator-plugin/actions.d.ts.map +0 -1
- package/lib/table/operator-plugin/calc-pos.d.ts +0 -3
- package/lib/table/operator-plugin/calc-pos.d.ts.map +0 -1
- package/lib/table/operator-plugin/constant.d.ts +0 -6
- package/lib/table/operator-plugin/constant.d.ts.map +0 -1
- package/lib/table/operator-plugin/helper.d.ts +0 -7
- package/lib/table/operator-plugin/helper.d.ts.map +0 -1
- package/lib/table/operator-plugin/index.d.ts +0 -6
- package/lib/table/operator-plugin/index.d.ts.map +0 -1
- package/lib/table/operator-plugin/style.d.ts +0 -3
- package/lib/table/operator-plugin/style.d.ts.map +0 -1
- package/lib/table/operator-plugin/widget.d.ts +0 -8
- package/lib/table/operator-plugin/widget.d.ts.map +0 -1
- package/lib/table/plugin/auto-insert-zero-space.d.ts +0 -3
- package/lib/table/plugin/auto-insert-zero-space.d.ts.map +0 -1
- package/lib/table/plugin/cell-selection.d.ts +0 -40
- package/lib/table/plugin/cell-selection.d.ts.map +0 -1
- package/lib/table/plugin/column-resizing.d.ts +0 -18
- package/lib/table/plugin/column-resizing.d.ts.map +0 -1
- package/lib/table/plugin/commands.d.ts +0 -30
- package/lib/table/plugin/commands.d.ts.map +0 -1
- package/lib/table/plugin/copy-paste.d.ts +0 -14
- package/lib/table/plugin/copy-paste.d.ts.map +0 -1
- package/lib/table/plugin/fix-tables.d.ts +0 -7
- package/lib/table/plugin/fix-tables.d.ts.map +0 -1
- package/lib/table/plugin/index.d.ts +0 -4
- package/lib/table/plugin/index.d.ts.map +0 -1
- package/lib/table/plugin/schema.d.ts +0 -4
- package/lib/table/plugin/schema.d.ts.map +0 -1
- package/lib/table/plugin/table-editing.d.ts +0 -9
- package/lib/table/plugin/table-editing.d.ts.map +0 -1
- package/lib/table/plugin/table-map.d.ts +0 -44
- package/lib/table/plugin/table-map.d.ts.map +0 -1
- package/lib/table/plugin/table-view.d.ts +0 -15
- package/lib/table/plugin/table-view.d.ts.map +0 -1
- package/lib/table/plugin/types.d.ts +0 -15
- package/lib/table/plugin/types.d.ts.map +0 -1
- package/lib/table/plugin/util.d.ts +0 -16
- package/lib/table/plugin/util.d.ts.map +0 -1
- package/lib/table/utils.d.ts +0 -21
- package/lib/table/utils.d.ts.map +0 -1
- package/lib/task-list-item.d.ts +0 -9
- package/lib/task-list-item.d.ts.map +0 -1
- package/src/footnote/definition.ts +0 -187
- package/src/footnote/reference.ts +0 -178
- package/src/footnote/utils.ts +0 -4
- package/src/strike-through.ts +0 -43
- package/src/supported-keys.ts +0 -13
- package/src/table/command.ts +0 -20
- package/src/table/index.ts +0 -13
- package/src/table/nodes/index.ts +0 -189
- package/src/table/operator-plugin/actions.ts +0 -116
- package/src/table/operator-plugin/calc-pos.ts +0 -36
- package/src/table/operator-plugin/constant.ts +0 -7
- package/src/table/operator-plugin/helper.ts +0 -39
- package/src/table/operator-plugin/index.ts +0 -110
- package/src/table/operator-plugin/style.ts +0 -123
- package/src/table/operator-plugin/widget.ts +0 -57
- package/src/table/plugin/cell-selection.ts +0 -381
- package/src/table/plugin/column-resizing.ts +0 -288
- package/src/table/plugin/commands.ts +0 -594
- package/src/table/plugin/copy-paste.ts +0 -322
- package/src/table/plugin/fix-tables.ts +0 -132
- package/src/table/plugin/index.ts +0 -4
- package/src/table/plugin/schema.ts +0 -120
- package/src/table/plugin/table-editing.ts +0 -369
- package/src/table/plugin/table-map.ts +0 -345
- package/src/table/plugin/table-view.ts +0 -80
- package/src/table/plugin/types.ts +0 -16
- package/src/table/plugin/util.ts +0 -119
- package/src/table/utils.ts +0 -165
- package/src/task-list-item.ts +0 -159
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mark/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const strikethroughAttr: import("@milkdown/utils").$MarkAttr;
|
|
2
|
+
export declare const strikethroughSchema: import("@milkdown/utils").$MarkSchema;
|
|
3
|
+
export declare const toggleStrikethroughCommand: import("@milkdown/utils").$Command<unknown>;
|
|
4
|
+
export declare const strikethroughKeymap: import("@milkdown/utils").$UserKeymap<"strikeThroughKeymap", "ToggleStrikethrough">;
|
|
5
|
+
//# sourceMappingURL=strike-through.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strike-through.d.ts","sourceRoot":"","sources":["../../src/mark/strike-through.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB,qCAA8B,CAAA;AAG5D,eAAO,MAAM,mBAAmB,uCAqB7B,CAAA;AAGH,eAAO,MAAM,0BAA0B,6CAAsF,CAAA;AAI7H,eAAO,MAAM,mBAAmB,qFAQ9B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/node/footnote/definition.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,wBAAwB,8DA4DlC,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/footnote/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/node/footnote/reference.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,uBAAuB,6DAmDjC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const tableSchema: import("@milkdown/utils").$NodeSchema<"table">;
|
|
2
|
+
export declare const tableRowSchema: import("@milkdown/utils").$NodeSchema<"table_row">;
|
|
3
|
+
export declare const tableCellSchema: import("@milkdown/utils").$NodeSchema<"table_cell">;
|
|
4
|
+
export declare const tableHeaderSchema: import("@milkdown/utils").$NodeSchema<"table_header">;
|
|
5
|
+
export declare const insertTableInputRule: import("@milkdown/utils").$InputRule;
|
|
6
|
+
export declare const goToPrevTableCellCommand: import("@milkdown/utils").$Command<unknown>;
|
|
7
|
+
export declare const goToNextTableCellCommand: import("@milkdown/utils").$Command<unknown>;
|
|
8
|
+
export declare const breakTableCommand: import("@milkdown/utils").$Command<unknown>;
|
|
9
|
+
export declare const insertTableCommand: import("@milkdown/utils").$Command<{
|
|
10
|
+
row?: number | undefined;
|
|
11
|
+
col?: number | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const moveRowCommand: import("@milkdown/utils").$Command<{
|
|
14
|
+
from?: number | undefined;
|
|
15
|
+
to?: number | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const moveColCommand: import("@milkdown/utils").$Command<{
|
|
18
|
+
from?: number | undefined;
|
|
19
|
+
to?: number | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const selectRowCommand: import("@milkdown/utils").$Command<number>;
|
|
22
|
+
export declare const selectColCommand: import("@milkdown/utils").$Command<number>;
|
|
23
|
+
export declare const selectTableCommand: import("@milkdown/utils").$Command<unknown>;
|
|
24
|
+
export declare const deleteSelectedCellsCommand: import("@milkdown/utils").$Command<unknown>;
|
|
25
|
+
export declare const addColBeforeCommand: import("@milkdown/utils").$Command<unknown>;
|
|
26
|
+
export declare const addColAfterCommand: import("@milkdown/utils").$Command<unknown>;
|
|
27
|
+
export declare const addRowBeforeCommand: import("@milkdown/utils").$Command<unknown>;
|
|
28
|
+
export declare const addRowAfterCommand: import("@milkdown/utils").$Command<unknown>;
|
|
29
|
+
export declare const setAlignCommand: import("@milkdown/utils").$Command<"center" | "left" | "right">;
|
|
30
|
+
export declare const tableKeymap: import("@milkdown/utils").$UserKeymap<"tableKeymap", "NextCell" | "PrevCell" | "ExitTable">;
|
|
31
|
+
export * from './utils';
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/table/index.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,WAAW,gDAiCrB,CAAA;AAGH,eAAO,MAAM,cAAc,oDAwBxB,CAAA;AAGH,eAAO,MAAM,eAAe,qDAoBzB,CAAA;AAGH,eAAO,MAAM,iBAAiB,uDAqB3B,CAAA;AAIH,eAAO,MAAM,oBAAoB,sCAa/B,CAAA;AAGF,eAAO,MAAM,wBAAwB,6CAA8D,CAAA;AAGnG,eAAO,MAAM,wBAAwB,6CAA6D,CAAA;AAKlG,eAAO,MAAM,iBAAiB,6CAY5B,CAAA;AAKF,eAAO,MAAM,kBAAkB;;;EAU7B,CAAA;AAIF,eAAO,MAAM,cAAc;;;EAKzB,CAAA;AAIF,eAAO,MAAM,cAAc;;;EAKzB,CAAA;AAGF,eAAO,MAAM,gBAAgB,4CAK3B,CAAA;AAGF,eAAO,MAAM,gBAAgB,4CAK3B,CAAA;AAGF,eAAO,MAAM,kBAAkB,6CAK7B,CAAA;AAKF,eAAO,MAAM,0BAA0B,6CAgBrC,CAAA;AAGF,eAAO,MAAM,mBAAmB,6CAAwD,CAAA;AAGxF,eAAO,MAAM,kBAAkB,6CAAsD,CAAA;AAGrF,eAAO,MAAM,mBAAmB,6CAQ9B,CAAA;AAGF,eAAO,MAAM,kBAAkB,6CAQ7B,CAAA;AAKF,eAAO,MAAM,eAAe,iEAAmI,CAAA;AAM/J,eAAO,MAAM,WAAW,6FAyBtB,CAAA;AAEF,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ContentNodeWithPos } from '@milkdown/prose';
|
|
2
|
+
import type { Node } from '@milkdown/prose/model';
|
|
3
|
+
import type { Selection, Transaction } from '@milkdown/prose/state';
|
|
4
|
+
import type { TableRect } from '@milkdown/prose/tables';
|
|
5
|
+
export interface CellPos {
|
|
6
|
+
pos: number;
|
|
7
|
+
start: number;
|
|
8
|
+
node: Node;
|
|
9
|
+
}
|
|
10
|
+
export declare const createTable: (rowsCount?: number, colsCount?: number) => Node;
|
|
11
|
+
export declare const findTable: (selection: Selection) => ContentNodeWithPos | undefined;
|
|
12
|
+
export declare const getCellsInCol: (columnIndex: number, selection: Selection) => CellPos[] | undefined;
|
|
13
|
+
export declare const getCellsInRow: (rowIndex: number, selection: Selection) => CellPos[] | undefined;
|
|
14
|
+
export declare const getAllCellsInTable: (selection: Selection) => {
|
|
15
|
+
pos: number;
|
|
16
|
+
start: number;
|
|
17
|
+
node: Node | null;
|
|
18
|
+
}[] | undefined;
|
|
19
|
+
export declare const selectTable: (tr: Transaction) => Transaction;
|
|
20
|
+
export declare function addRowWithAlignment(tr: Transaction, { map, tableStart, table }: TableRect, row: number): Transaction;
|
|
21
|
+
export declare const selectLine: (type: 'row' | 'col') => (index: number) => (tr: Transaction) => Transaction;
|
|
22
|
+
export declare const selectRow: (index: number) => (tr: Transaction) => Transaction;
|
|
23
|
+
export declare const selectCol: (index: number) => (tr: Transaction) => Transaction;
|
|
24
|
+
export declare function moveCol(tr: Transaction, origin: number, target: number, select?: boolean): Transaction;
|
|
25
|
+
export declare function moveRow(tr: Transaction, origin: number, target: number, select?: boolean): Transaction;
|
|
26
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/node/table/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAMvD,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,IAAI,CAAA;CACX;AAGD,eAAO,MAAM,WAAW,8CAAmC,IAc1D,CAAA;AAGD,eAAO,MAAM,SAAS,cAAe,SAAS,mCAC2B,CAAA;AAGzE,eAAO,MAAM,aAAa,gBAAiB,MAAM,aAAa,SAAS,KAAG,OAAO,EAAE,GAAG,SAsBrF,CAAA;AAGD,eAAO,MAAM,aAAa,aAAc,MAAM,aAAa,SAAS,KAAG,OAAO,EAAE,GAAG,SAsBlF,CAAA;AAGD,eAAO,MAAM,kBAAkB,cAAe,SAAS;;;;eAiBtD,CAAA;AAGD,eAAO,MAAM,WAAW,OAAQ,WAAW,gBAW1C,CAAA;AAGD,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,eAgBtG;AAGD,eAAO,MAAM,UAAU,SAAU,KAAK,GAAG,KAAK,aAAa,MAAM,UAAU,WAAW,gBAuBrF,CAAA;AAID,eAAO,MAAM,SAAS,UA3BqC,MAAM,UAAU,WAAW,gBA2B5C,CAAA;AAI1C,eAAO,MAAM,SAAS,UA/BqC,MAAM,UAAU,WAAW,gBA+B5C,CAAA;AA2P1C,wBAAgB,OAAO,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAO,eAuCrF;AAKD,wBAAgB,OAAO,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAO,eAuCrF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-list-item.d.ts","sourceRoot":"","sources":["../../src/node/task-list-item.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,2BAA2B,wCAkFtC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-insert-zero-space-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/auto-insert-zero-space-plugin.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,gCAAgC,kCAuC3C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-resizing-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/column-resizing-plugin.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB,kCAAmC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AACA,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remark-gfm-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/remark-gfm-plugin.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe,mCAA2B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-editing-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/table-editing-plugin.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB,kCAA+B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milkdown/preset-gfm",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "7.0.0-next.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -22,21 +22,24 @@
|
|
|
22
22
|
"src"
|
|
23
23
|
],
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@milkdown/core": "^
|
|
26
|
-
"@milkdown/
|
|
27
|
-
"@milkdown/
|
|
25
|
+
"@milkdown/core": "^7.0.0-next.0",
|
|
26
|
+
"@milkdown/ctx": "^7.0.0-next.0",
|
|
27
|
+
"@milkdown/preset-commonmark": "^7.0.0-next.0",
|
|
28
|
+
"@milkdown/prose": "^7.0.0-next.0",
|
|
29
|
+
"@milkdown/transformer": "^7.0.0-next.0"
|
|
28
30
|
},
|
|
29
31
|
"dependencies": {
|
|
30
32
|
"remark-gfm": "^3.0.0",
|
|
31
33
|
"tslib": "^2.4.0",
|
|
32
|
-
"@milkdown/exception": "
|
|
33
|
-
"@milkdown/utils": "
|
|
34
|
+
"@milkdown/exception": "7.0.0-next.1",
|
|
35
|
+
"@milkdown/utils": "7.0.0-next.1"
|
|
34
36
|
},
|
|
35
37
|
"devDependencies": {
|
|
36
|
-
"@milkdown/core": "
|
|
37
|
-
"@milkdown/
|
|
38
|
-
"@milkdown/preset-commonmark": "
|
|
39
|
-
"@milkdown/prose": "
|
|
38
|
+
"@milkdown/core": "7.0.0-next.1",
|
|
39
|
+
"@milkdown/ctx": "7.0.0-next.1",
|
|
40
|
+
"@milkdown/preset-commonmark": "7.0.0-next.1",
|
|
41
|
+
"@milkdown/prose": "7.0.0-next.1",
|
|
42
|
+
"@milkdown/transformer": "7.0.0-next.1"
|
|
40
43
|
},
|
|
41
44
|
"nx": {
|
|
42
45
|
"targets": {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
|
+
import { toggleStrikethroughCommand } from '../mark'
|
|
3
|
+
import { addColAfterCommand, addColBeforeCommand, addRowAfterCommand, addRowBeforeCommand, breakTableCommand, deleteSelectedCellsCommand, goToNextTableCellCommand, goToPrevTableCellCommand, insertTableCommand, moveColCommand, moveRowCommand, selectColCommand, selectRowCommand, selectTableCommand, setAlignCommand } from '../node'
|
|
4
|
+
|
|
5
|
+
/// @internal
|
|
6
|
+
export const commands = [
|
|
7
|
+
goToNextTableCellCommand,
|
|
8
|
+
goToPrevTableCellCommand,
|
|
9
|
+
breakTableCommand,
|
|
10
|
+
insertTableCommand,
|
|
11
|
+
moveRowCommand,
|
|
12
|
+
moveColCommand,
|
|
13
|
+
selectRowCommand,
|
|
14
|
+
selectColCommand,
|
|
15
|
+
selectTableCommand,
|
|
16
|
+
deleteSelectedCellsCommand,
|
|
17
|
+
addRowBeforeCommand,
|
|
18
|
+
addRowAfterCommand,
|
|
19
|
+
addColBeforeCommand,
|
|
20
|
+
addColAfterCommand,
|
|
21
|
+
setAlignCommand,
|
|
22
|
+
|
|
23
|
+
toggleStrikethroughCommand,
|
|
24
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
|
+
import type { MilkdownPlugin } from '@milkdown/ctx'
|
|
3
|
+
import { strikethroughKeymap } from '../mark'
|
|
4
|
+
import { tableKeymap } from '../node'
|
|
5
|
+
|
|
6
|
+
/// @internal
|
|
7
|
+
export const keymap: MilkdownPlugin[] = [
|
|
8
|
+
strikethroughKeymap,
|
|
9
|
+
tableKeymap,
|
|
10
|
+
].flat()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
|
+
import type { MilkdownPlugin } from '@milkdown/ctx'
|
|
3
|
+
import { autoInsertZeroSpaceInTablePlugin, columnResizingPlugin, remarkGFMPlugin, tableEditingPlugin } from '../plugin'
|
|
4
|
+
|
|
5
|
+
/// @internal
|
|
6
|
+
export const plugins: MilkdownPlugin[] = [
|
|
7
|
+
autoInsertZeroSpaceInTablePlugin,
|
|
8
|
+
columnResizingPlugin,
|
|
9
|
+
tableEditingPlugin,
|
|
10
|
+
remarkGFMPlugin,
|
|
11
|
+
]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
|
+
import type { MilkdownPlugin } from '@milkdown/ctx'
|
|
3
|
+
import { strikethroughAttr, strikethroughSchema } from '../mark'
|
|
4
|
+
import { extendListItemSchemaForTask, footnoteDefinitionSchema, footnoteReferenceSchema, tableCellSchema, tableHeaderSchema, tableRowSchema, tableSchema } from '../node'
|
|
5
|
+
|
|
6
|
+
/// @internal
|
|
7
|
+
export const schema: MilkdownPlugin[] = [
|
|
8
|
+
extendListItemSchemaForTask,
|
|
9
|
+
|
|
10
|
+
tableSchema,
|
|
11
|
+
tableRowSchema,
|
|
12
|
+
tableHeaderSchema,
|
|
13
|
+
tableCellSchema,
|
|
14
|
+
|
|
15
|
+
footnoteDefinitionSchema,
|
|
16
|
+
footnoteReferenceSchema,
|
|
17
|
+
|
|
18
|
+
strikethroughAttr,
|
|
19
|
+
strikethroughSchema,
|
|
20
|
+
].flat()
|
package/src/index.ts
CHANGED
|
@@ -1,93 +1,10 @@
|
|
|
1
1
|
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
|
-
import { commonmark, commands as commonmarkCommands } from '@milkdown/preset-commonmark'
|
|
3
|
-
import { $remark, AtomList } from '@milkdown/utils'
|
|
4
|
-
import remarkGFM from 'remark-gfm'
|
|
5
2
|
|
|
6
|
-
import {
|
|
7
|
-
import { footnoteDefinition } from './footnote/definition'
|
|
8
|
-
import { ToggleStrikeThrough, strikeThrough } from './strike-through'
|
|
9
|
-
import { table } from './table'
|
|
10
|
-
import {
|
|
11
|
-
LiftTaskListItem,
|
|
12
|
-
SinkTaskListItem,
|
|
13
|
-
SplitTaskListItem,
|
|
14
|
-
TurnIntoTaskList,
|
|
15
|
-
taskListItem,
|
|
16
|
-
} from './task-list-item'
|
|
3
|
+
import { commands, inputrules, keymap, plugins, schema } from './composed'
|
|
17
4
|
|
|
18
|
-
export * from './
|
|
19
|
-
export * from './
|
|
20
|
-
export
|
|
21
|
-
export {
|
|
22
|
-
BreakTable,
|
|
23
|
-
// command
|
|
24
|
-
createTable,
|
|
25
|
-
InsertTable,
|
|
26
|
-
NextCell,
|
|
27
|
-
PrevCell,
|
|
28
|
-
// gather
|
|
29
|
-
table,
|
|
30
|
-
} from './table'
|
|
31
|
-
export * from './task-list-item'
|
|
32
|
-
export {
|
|
33
|
-
blockquote,
|
|
34
|
-
bulletList,
|
|
35
|
-
codeFence,
|
|
36
|
-
codeInline,
|
|
37
|
-
commonmark,
|
|
38
|
-
// gather
|
|
39
|
-
commonmarkNodes,
|
|
40
|
-
commonmarkPlugins,
|
|
41
|
-
// node
|
|
42
|
-
doc,
|
|
43
|
-
em,
|
|
44
|
-
HardbreakFilterPluginKey as hardbreak,
|
|
45
|
-
heading,
|
|
46
|
-
hr,
|
|
47
|
-
image,
|
|
48
|
-
// command
|
|
49
|
-
InsertHardbreak,
|
|
50
|
-
InsertHr,
|
|
51
|
-
InsertImage,
|
|
52
|
-
LiftListItem,
|
|
53
|
-
link,
|
|
54
|
-
listItem,
|
|
55
|
-
ModifyImage,
|
|
56
|
-
ModifyLink,
|
|
57
|
-
orderedList,
|
|
58
|
-
paragraph,
|
|
59
|
-
SinkListItem,
|
|
60
|
-
SplitListItem,
|
|
61
|
-
strong,
|
|
62
|
-
text,
|
|
63
|
-
ToggleBold,
|
|
64
|
-
ToggleInlineCode,
|
|
65
|
-
ToggleItalic,
|
|
66
|
-
ToggleLink,
|
|
67
|
-
TurnIntoCodeFence,
|
|
68
|
-
TurnIntoHeading,
|
|
69
|
-
TurnIntoText,
|
|
70
|
-
WrapInBlockquote,
|
|
71
|
-
WrapInBulletList,
|
|
72
|
-
WrapInOrderedList,
|
|
73
|
-
} from '@milkdown/preset-commonmark'
|
|
5
|
+
export * from './node'
|
|
6
|
+
export * from './mark'
|
|
7
|
+
export * from './composed'
|
|
74
8
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
$remark(() => remarkGFM),
|
|
78
|
-
table(),
|
|
79
|
-
strikeThrough(),
|
|
80
|
-
taskListItem(),
|
|
81
|
-
footnoteReference(),
|
|
82
|
-
footnoteDefinition(),
|
|
83
|
-
])
|
|
84
|
-
|
|
85
|
-
export const commands = {
|
|
86
|
-
...commonmarkCommands,
|
|
87
|
-
ToggleStrikeThrough,
|
|
88
|
-
TurnIntoTaskList,
|
|
89
|
-
SinkTaskListItem,
|
|
90
|
-
LiftTaskListItem,
|
|
91
|
-
SplitTaskListItem,
|
|
92
|
-
} as const
|
|
93
|
-
export type Commands = typeof commands
|
|
9
|
+
/// The GFM preset, includes all the plugins.
|
|
10
|
+
export const gfm = [schema, inputrules, keymap, plugins, commands].flat()
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
|
+
import { commandsCtx } from '@milkdown/core'
|
|
3
|
+
import { toggleMark } from '@milkdown/prose/commands'
|
|
4
|
+
import { $command, $markAttr, $markSchema, $useKeymap } from '@milkdown/utils'
|
|
5
|
+
|
|
6
|
+
/// HTML attributes for the strikethrough mark.
|
|
7
|
+
export const strikethroughAttr = $markAttr('strike_through')
|
|
8
|
+
|
|
9
|
+
/// Strikethrough mark schema.
|
|
10
|
+
export const strikethroughSchema = $markSchema('strike_through', ctx => ({
|
|
11
|
+
inclusive: false,
|
|
12
|
+
parseDOM: [
|
|
13
|
+
{ tag: 'del' },
|
|
14
|
+
{ style: 'text-decoration', getAttrs: value => (value === 'line-through') as false },
|
|
15
|
+
],
|
|
16
|
+
toDOM: mark => ['del', ctx.get(strikethroughAttr.key)(mark)],
|
|
17
|
+
parseMarkdown: {
|
|
18
|
+
match: node => node.type === 'delete',
|
|
19
|
+
runner: (state, node, markType) => {
|
|
20
|
+
state.openMark(markType)
|
|
21
|
+
state.next(node.children)
|
|
22
|
+
state.closeMark(markType)
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
toMarkdown: {
|
|
26
|
+
match: mark => mark.type.name === 'strike_through',
|
|
27
|
+
runner: (state, mark) => {
|
|
28
|
+
state.withMark(mark, 'delete')
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
}))
|
|
32
|
+
|
|
33
|
+
/// A command to toggle the strikethrough mark.
|
|
34
|
+
export const toggleStrikethroughCommand = $command('ToggleStrikeThrough', () => () => toggleMark(strikethroughSchema.type()))
|
|
35
|
+
|
|
36
|
+
/// Keymap for the strikethrough mark.
|
|
37
|
+
/// - `Mod-Alt-x` - Toggle the strikethrough mark.
|
|
38
|
+
export const strikethroughKeymap = $useKeymap('strikeThroughKeymap', {
|
|
39
|
+
ToggleStrikethrough: {
|
|
40
|
+
shortcuts: 'Mod-Alt-x',
|
|
41
|
+
command: (ctx) => {
|
|
42
|
+
const commands = ctx.get(commandsCtx)
|
|
43
|
+
return () => commands.call(toggleStrikethroughCommand.key)
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
})
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
|
+
|
|
3
|
+
import { expectDomTypeError } from '@milkdown/exception'
|
|
4
|
+
import { $nodeSchema } from '@milkdown/utils'
|
|
5
|
+
|
|
6
|
+
const id = 'footnote_definition'
|
|
7
|
+
const markdownId = 'footnoteDefinition'
|
|
8
|
+
|
|
9
|
+
/// Footnote definition node schema.
|
|
10
|
+
export const footnoteDefinitionSchema = $nodeSchema('footnote_definition', () => ({
|
|
11
|
+
group: 'block',
|
|
12
|
+
content: 'block+',
|
|
13
|
+
defining: true,
|
|
14
|
+
attrs: {
|
|
15
|
+
label: {
|
|
16
|
+
default: '',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
parseDOM: [
|
|
20
|
+
{
|
|
21
|
+
tag: `dl[data-type="${id}"]`,
|
|
22
|
+
getAttrs: (dom) => {
|
|
23
|
+
if (!(dom instanceof HTMLElement))
|
|
24
|
+
throw expectDomTypeError(dom)
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
label: dom.dataset.label,
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
contentElement: 'dd',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
toDOM: (node) => {
|
|
34
|
+
const label = node.attrs.label
|
|
35
|
+
|
|
36
|
+
return [
|
|
37
|
+
'dl',
|
|
38
|
+
{
|
|
39
|
+
// TODO: add a prosemirror plugin to sync label on change
|
|
40
|
+
'data-label': label,
|
|
41
|
+
'data-type': id,
|
|
42
|
+
},
|
|
43
|
+
['dt', label],
|
|
44
|
+
['dd', 0],
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
parseMarkdown: {
|
|
48
|
+
match: ({ type }) => type === markdownId,
|
|
49
|
+
runner: (state, node, type) => {
|
|
50
|
+
state
|
|
51
|
+
.openNode(type, {
|
|
52
|
+
label: node.label as string,
|
|
53
|
+
})
|
|
54
|
+
.next(node.children)
|
|
55
|
+
.closeNode()
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
toMarkdown: {
|
|
59
|
+
match: node => node.type.name === id,
|
|
60
|
+
runner: (state, node) => {
|
|
61
|
+
state
|
|
62
|
+
.openNode(markdownId, undefined, {
|
|
63
|
+
label: node.attrs.label,
|
|
64
|
+
identifier: node.attrs.label,
|
|
65
|
+
})
|
|
66
|
+
.next(node.content)
|
|
67
|
+
.closeNode()
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
}))
|
|
File without changes
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* Copyright 2021, Milkdown by Mirone. */
|
|
2
|
+
|
|
3
|
+
import { expectDomTypeError } from '@milkdown/exception'
|
|
4
|
+
import { $nodeSchema } from '@milkdown/utils'
|
|
5
|
+
|
|
6
|
+
const id = 'footnote_reference'
|
|
7
|
+
|
|
8
|
+
/// Footnote reference node schema.
|
|
9
|
+
export const footnoteReferenceSchema = $nodeSchema('footnote_reference', () => ({
|
|
10
|
+
group: 'inline',
|
|
11
|
+
inline: true,
|
|
12
|
+
atom: true,
|
|
13
|
+
attrs: {
|
|
14
|
+
label: {
|
|
15
|
+
default: '',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
parseDOM: [
|
|
19
|
+
{
|
|
20
|
+
tag: `sup[data-type="${id}"]`,
|
|
21
|
+
getAttrs: (dom) => {
|
|
22
|
+
if (!(dom instanceof HTMLElement))
|
|
23
|
+
throw expectDomTypeError(dom)
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
label: dom.dataset.label,
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
toDOM: (node) => {
|
|
32
|
+
const label = node.attrs.label
|
|
33
|
+
return [
|
|
34
|
+
'sup',
|
|
35
|
+
{
|
|
36
|
+
// TODO: add a prosemirror plugin to sync label on change
|
|
37
|
+
'data-label': label,
|
|
38
|
+
'data-type': id,
|
|
39
|
+
},
|
|
40
|
+
label,
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
parseMarkdown: {
|
|
44
|
+
match: ({ type }) => type === 'footnoteReference',
|
|
45
|
+
runner: (state, node, type) => {
|
|
46
|
+
state.addNode(type, {
|
|
47
|
+
label: node.label as string,
|
|
48
|
+
})
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
toMarkdown: {
|
|
52
|
+
match: node => node.type.name === id,
|
|
53
|
+
runner: (state, node) => {
|
|
54
|
+
state.addNode('footnoteReference', undefined, undefined, {
|
|
55
|
+
label: node.attrs.label,
|
|
56
|
+
identifier: node.attrs.label,
|
|
57
|
+
})
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
}))
|