@milkdown/preset-gfm 6.4.0 → 6.5.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/nodes/index.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AACX,oBAAY,aAAa,GAAG,OAAO,aAAa,CAAC;AAIjD,eAAO,MAAM,QAAQ,4CAA2B,CAAC;AACjD,eAAO,MAAM,QAAQ,4CAA2B,CAAC;AACjD,eAAO,MAAM,UAAU,4CAA6B,CAAC;AACrD,eAAO,MAAM,WAAW,4CAA8B,CAAC;AAEvD,eAAO,MAAM,KAAK,iTA8IhB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/nodes/index.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AACX,oBAAY,aAAa,GAAG,OAAO,aAAa,CAAC;AAIjD,eAAO,MAAM,QAAQ,4CAA2B,CAAC;AACjD,eAAO,MAAM,QAAQ,4CAA2B,CAAC;AACjD,eAAO,MAAM,UAAU,4CAA6B,CAAC;AACrD,eAAO,MAAM,WAAW,4CAA8B,CAAC;AAEvD,eAAO,MAAM,KAAK,iTA2JhB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milkdown/preset-gfm",
3
- "version": "6.4.0",
3
+ "version": "6.5.0",
4
4
  "type": "module",
5
5
  "main": "./lib/index.es.js",
6
6
  "types": "./lib/index.d.ts",
@@ -17,10 +17,10 @@
17
17
  "gfm"
18
18
  ],
19
19
  "devDependencies": {
20
- "@milkdown/core": "6.4.0",
21
- "@milkdown/design-system": "6.4.0",
22
- "@milkdown/preset-commonmark": "6.4.0",
23
- "@milkdown/prose": "6.4.0"
20
+ "@milkdown/core": "6.5.0",
21
+ "@milkdown/design-system": "6.5.0",
22
+ "@milkdown/preset-commonmark": "6.5.0",
23
+ "@milkdown/prose": "6.5.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@milkdown/core": "^6.0.1",
@@ -28,8 +28,8 @@
28
28
  "@milkdown/prose": "^6.0.1"
29
29
  },
30
30
  "dependencies": {
31
- "@milkdown/utils": "6.4.0",
32
- "@milkdown/exception": "6.4.0",
31
+ "@milkdown/utils": "6.5.0",
32
+ "@milkdown/exception": "6.5.0",
33
33
  "remark-gfm": "^3.0.0",
34
34
  "tslib": "^2.4.0"
35
35
  },
@@ -144,6 +144,19 @@ export const table = createPlugin<Keys, Record<string, unknown>, keyof typeof sc
144
144
  const tr = state.tr.replaceRangeWith(start, end, tableNode).scrollIntoView();
145
145
  return tr.setSelection(TextSelection.create(tr.doc, start + 3));
146
146
  }),
147
+ new InputRule(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/, (state, match, start, end) => {
148
+ const $start = state.doc.resolve(start);
149
+ if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), nodeType.table))
150
+ return null;
151
+
152
+ const tableNode = createTable(
153
+ ctx.get(schemaCtx),
154
+ Number(match.groups?.['row']),
155
+ Number(match.groups?.['col']),
156
+ );
157
+ const tr = state.tr.replaceRangeWith(start, end, tableNode).scrollIntoView();
158
+ return tr.setSelection(TextSelection.create(tr.doc, start + 3));
159
+ }),
147
160
  ],
148
161
  commands: (_, ctx) => [
149
162
  createCmd(PrevCell, () => goToNextCell(-1)),