@milkdown/preset-commonmark 7.4.0 → 7.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":"hardbreak.d.ts","sourceRoot":"","sources":["../../src/node/hardbreak.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,aAAa,qCAIxB,CAAA;AAQF,eAAO,MAAM,eAAe,oDA4BzB,CAAA;AAaH,eAAO,MAAM,sBAAsB,6CAoBjC,CAAA;AASF,eAAO,MAAM,eAAe,6EAQ1B,CAAA"}
1
+ {"version":3,"file":"hardbreak.d.ts","sourceRoot":"","sources":["../../src/node/hardbreak.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,aAAa,qCAKxB,CAAA;AAQF,eAAO,MAAM,eAAe,oDA4BzB,CAAA;AAaH,eAAO,MAAM,sBAAsB,6CAoBjC,CAAA;AASF,eAAO,MAAM,eAAe,6EAQ1B,CAAA"}
@@ -1 +1 @@
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"}
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,kCAgD9B,CAAA"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@milkdown/preset-commonmark",
3
3
  "type": "module",
4
- "version": "7.4.0",
4
+ "version": "7.5.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/Milkdown/milkdown.git",
9
- "directory": "packages/preset-commonmark"
9
+ "directory": "packages/plugins/preset-commonmark"
10
10
  },
11
11
  "keywords": [
12
12
  "milkdown",
@@ -37,14 +37,14 @@
37
37
  "remark-inline-links": "^7.0.0",
38
38
  "tslib": "^2.5.0",
39
39
  "unist-util-visit": "^5.0.0",
40
- "@milkdown/exception": "7.4.0",
41
- "@milkdown/utils": "7.4.0"
40
+ "@milkdown/exception": "7.5.0",
41
+ "@milkdown/utils": "7.5.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@milkdown/core": "7.4.0",
45
- "@milkdown/ctx": "7.4.0",
46
- "@milkdown/prose": "7.4.0",
47
- "@milkdown/transformer": "7.4.0"
44
+ "@milkdown/core": "7.5.0",
45
+ "@milkdown/ctx": "7.5.0",
46
+ "@milkdown/prose": "7.5.0",
47
+ "@milkdown/transformer": "7.5.0"
48
48
  },
49
49
  "nx": {
50
50
  "targets": {
@@ -53,19 +53,13 @@
53
53
  "{projectRoot}/lib"
54
54
  ],
55
55
  "dependsOn": [
56
- {
57
- "target": "build",
58
- "projects": "dependencies"
59
- }
56
+ "build"
60
57
  ]
61
58
  },
62
59
  "tsc": {
63
60
  "outputs": [],
64
61
  "dependsOn": [
65
- {
66
- "target": "build",
67
- "projects": "dependencies"
68
- }
62
+ "build"
69
63
  ]
70
64
  }
71
65
  }
@@ -9,6 +9,7 @@ import { withMeta } from '../__internal__'
9
9
  /// - `data-is-inline` - Whether the hardbreak is inline.
10
10
  export const hardbreakAttr = $nodeAttr('hardbreak', (node) => {
11
11
  return {
12
+ 'data-type': 'hardbreak',
12
13
  'data-is-inline': node.attrs.isInline,
13
14
  }
14
15
  })
@@ -28,8 +29,8 @@ export const hardbreakSchema = $nodeSchema('hardbreak', ctx => ({
28
29
  },
29
30
  },
30
31
  selectable: false,
31
- parseDOM: [{ tag: 'br' }],
32
- toDOM: node => ['br', ctx.get(hardbreakAttr.key)(node)],
32
+ parseDOM: [{ tag: 'br' }, { tag: 'span[data-type="hardbreak"]', getAttrs: () => ({ isInline: true }) }],
33
+ toDOM: node => node.attrs.isInline ? ['span', ctx.get(hardbreakAttr.key)(node), ' '] : ['br', ctx.get(hardbreakAttr.key)(node)],
33
34
  parseMarkdown: {
34
35
  match: ({ type }) => type === 'break',
35
36
  runner: (state, node, type) => {
package/src/node/html.ts CHANGED
@@ -32,7 +32,7 @@ export const htmlSchema = $nodeSchema('html', (ctx) => {
32
32
  tag: 'span[data-type="html"]',
33
33
  getAttrs: (dom) => {
34
34
  return {
35
- value: (dom as HTMLElement).dataset.value ?? '',
35
+ value: dom.dataset.value ?? '',
36
36
  }
37
37
  },
38
38
  }],
@@ -46,7 +46,9 @@ export const syncHeadingIdPlugin = $prose((ctx) => {
46
46
  updateId(view)
47
47
 
48
48
  return {
49
- update: (view) => {
49
+ update: (view, prevState) => {
50
+ if (view.state.doc.eq(prevState.doc))
51
+ return
50
52
  updateId(view)
51
53
  },
52
54
  }