@milkdown/preset-commonmark 6.5.0 → 6.5.2

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":"link.d.ts","sourceRoot":"","sources":["../../src/mark/link.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,UAAU,yCAAqC,CAAC;AAC7D,eAAO,MAAM,UAAU,yCAAqC,CAAC;AAE7D,oBAAY,WAAW,GAAG;IACtB,KAAK,EAAE;QACH,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACL,CAAC;AACF,eAAO,MAAM,IAAI,4DAuMf,CAAC"}
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/mark/link.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,UAAU,yCAAqC,CAAC;AAC7D,eAAO,MAAM,UAAU,yCAAqC,CAAC;AAE7D,oBAAY,WAAW,GAAG;IACtB,KAAK,EAAE;QACH,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACL,CAAC;AACF,eAAO,MAAM,IAAI,4DA4Mf,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"regexp.d.ts","sourceRoot":"","sources":["../../../src/plugin/inline-sync/regexp.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,QAA+D,CAAC;AAEvF,eAAO,MAAM,iBAAiB,oBAAqB,MAAM,WACO,CAAC"}
1
+ {"version":3,"file":"regexp.d.ts","sourceRoot":"","sources":["../../../src/plugin/inline-sync/regexp.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,QAAyE,CAAC;AAEjG,eAAO,MAAM,iBAAiB,oBAAqB,MAAM,WACO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milkdown/preset-commonmark",
3
- "version": "6.5.0",
3
+ "version": "6.5.2",
4
4
  "type": "module",
5
5
  "main": "./lib/index.es.js",
6
6
  "types": "./lib/index.d.ts",
@@ -17,8 +17,8 @@
17
17
  "commonmark"
18
18
  ],
19
19
  "devDependencies": {
20
- "@milkdown/core": "6.5.0",
21
- "@milkdown/prose": "6.5.0",
20
+ "@milkdown/core": "6.5.2",
21
+ "@milkdown/prose": "6.5.2",
22
22
  "@types/unist": "^2.0.6"
23
23
  },
24
24
  "peerDependencies": {
@@ -26,8 +26,8 @@
26
26
  "@milkdown/prose": "^6.0.1"
27
27
  },
28
28
  "dependencies": {
29
- "@milkdown/utils": "6.5.0",
30
- "@milkdown/exception": "6.5.0",
29
+ "@milkdown/utils": "6.5.2",
30
+ "@milkdown/exception": "6.5.2",
31
31
  "unist-util-visit": "^4.0.0",
32
32
  "remark-inline-links": "^6.0.0",
33
33
  "tslib": "^2.4.0"
package/src/mark/link.ts CHANGED
@@ -128,6 +128,11 @@ export const link = createMark<string, LinkOptions>((utils, options) => {
128
128
 
129
129
  if (left < 0) left = 0;
130
130
 
131
+ const maxLeft = $editor.clientWidth - (target.width + 4);
132
+ if (left > maxLeft) {
133
+ left = maxLeft;
134
+ }
135
+
131
136
  return [top, left];
132
137
  });
133
138
  },
@@ -1,6 +1,6 @@
1
1
  /* Copyright 2021, Milkdown by Mirone. */
2
2
 
3
- export const linkRegexp = /\[(?<span>((www|https:\/\/|http:\/\/)\S+))]\((?<url>\S+)\)/;
3
+ export const linkRegexp = /\[(?<span>((www|https:\/\/|http:\/\/)[^\s\]]+))]\((?<url>[^\s\]]+)\)/;
4
4
 
5
5
  export const punctuationRegexp = (holePlaceholder: string) =>
6
6
  new RegExp(`\\\\(?=[^\\w\\s${holePlaceholder}\\\\]|_)`, 'g');