@milkdown/preset-gfm 7.5.0 → 7.5.8

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.
Files changed (35) hide show
  1. package/lib/__internal__/with-meta.d.ts.map +1 -1
  2. package/lib/composed/commands.d.ts +6 -6
  3. package/lib/composed/commands.d.ts.map +1 -1
  4. package/lib/composed/inputrules.d.ts.map +1 -1
  5. package/lib/index.d.ts.map +1 -1
  6. package/lib/index.es.js +407 -323
  7. package/lib/index.es.js.map +1 -1
  8. package/lib/mark/strike-through.d.ts.map +1 -1
  9. package/lib/node/footnote/definition.d.ts.map +1 -1
  10. package/lib/node/footnote/reference.d.ts.map +1 -1
  11. package/lib/node/table/command.d.ts +10 -10
  12. package/lib/node/table/command.d.ts.map +1 -1
  13. package/lib/node/table/input.d.ts.map +1 -1
  14. package/lib/node/table/schema.d.ts.map +1 -1
  15. package/lib/node/table/utils.d.ts.map +1 -1
  16. package/lib/node/task-list-item.d.ts.map +1 -1
  17. package/lib/plugin/keep-table-align-plugin.d.ts.map +1 -1
  18. package/lib/plugin/remark-gfm-plugin.d.ts.map +1 -1
  19. package/lib/plugin/table-editing-plugin.d.ts.map +1 -1
  20. package/package.json +8 -8
  21. package/src/__internal__/with-meta.ts +4 -1
  22. package/src/composed/commands.ts +17 -1
  23. package/src/composed/inputrules.ts +1 -3
  24. package/src/index.ts +16 -2
  25. package/src/mark/strike-through.ts +21 -9
  26. package/src/node/footnote/definition.ts +56 -54
  27. package/src/node/footnote/reference.ts +47 -45
  28. package/src/node/table/command.ts +169 -93
  29. package/src/node/table/input.ts +32 -15
  30. package/src/node/table/schema.ts +12 -13
  31. package/src/node/table/utils.ts +120 -84
  32. package/src/node/task-list-item.ts +100 -88
  33. package/src/plugin/keep-table-align-plugin.ts +7 -14
  34. package/src/plugin/remark-gfm-plugin.ts +2 -1
  35. package/src/plugin/table-editing-plugin.ts +3 -1
@@ -9,8 +9,7 @@ const pluginKey = new PluginKey('MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN')
9
9
  function getChildIndex(node: Node, parent: Node) {
10
10
  let index = 0
11
11
  parent.forEach((child, _offset, i) => {
12
- if (child === node)
13
- index = i
12
+ if (child === node) index = i
14
13
  })
15
14
  return index
16
15
  }
@@ -21,33 +20,27 @@ export const keepTableAlignPlugin = $prose(() => {
21
20
  appendTransaction: (_tr, oldState, state) => {
22
21
  let tr: Transaction | undefined
23
22
  const check = (node: Node, pos: number) => {
24
- if (!tr)
25
- tr = state.tr
23
+ if (!tr) tr = state.tr
26
24
 
27
- if (node.type.name !== 'table_cell')
28
- return
25
+ if (node.type.name !== 'table_cell') return
29
26
 
30
27
  const $pos = state.doc.resolve(pos)
31
28
  const tableRow = $pos.node($pos.depth)
32
29
  const table = $pos.node($pos.depth - 1)
33
30
  const tableHeaderRow = table.firstChild
34
31
  // TODO: maybe consider add a header row
35
- if (!tableHeaderRow)
36
- return
32
+ if (!tableHeaderRow) return
37
33
 
38
34
  const index = getChildIndex(node, tableRow)
39
35
  const headerCell = tableHeaderRow.maybeChild(index)
40
- if (!headerCell)
41
- return
36
+ if (!headerCell) return
42
37
  const align = headerCell.attrs.alignment
43
38
  const currentAlign = node.attrs.alignment
44
- if (align === currentAlign)
45
- return
39
+ if (align === currentAlign) return
46
40
 
47
41
  tr.setNodeMarkup(pos, undefined, { ...node.attrs, alignment: align })
48
42
  }
49
- if (oldState.doc !== state.doc)
50
- state.doc.descendants(check)
43
+ if (oldState.doc !== state.doc) state.doc.descendants(check)
51
44
 
52
45
  return tr
53
46
  },
@@ -5,7 +5,8 @@ import remarkGFM from 'remark-gfm'
5
5
  import { withMeta } from '../__internal__'
6
6
 
7
7
  /// This plugin is wrapping the [remark-gfm](https://github.com/remarkjs/remark-gfm).
8
- export const remarkGFMPlugin: $Remark<'remarkGFM', Options | null | undefined> = $remark('remarkGFM', () => remarkGFM)
8
+ export const remarkGFMPlugin: $Remark<'remarkGFM', Options | null | undefined> =
9
+ $remark('remarkGFM', () => remarkGFM)
9
10
 
10
11
  withMeta(remarkGFMPlugin.plugin, {
11
12
  displayName: 'Remark<remarkGFMPlugin>',
@@ -3,7 +3,9 @@ import { $prose } from '@milkdown/utils'
3
3
  import { withMeta } from '../__internal__'
4
4
 
5
5
  /// This plugin is wrapping the `tableEditing` plugin from [prosemirror-tables](https://github.com/ProseMirror/prosemirror-tables).
6
- export const tableEditingPlugin = $prose(() => tableEditing({ allowTableNodeSelection: true }))
6
+ export const tableEditingPlugin = $prose(() =>
7
+ tableEditing({ allowTableNodeSelection: true })
8
+ )
7
9
 
8
10
  withMeta(tableEditingPlugin, {
9
11
  displayName: 'Prose<tableEditingPlugin>',