dsh-chat-link-actions 0.2.10 → 0.2.12

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 (2) hide show
  1. package/client.js +5 -5
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -187,7 +187,7 @@ window.__ModuleLoader__.load({
187
187
  candidate = decodePercent(candidate);
188
188
  if (/^\/[A-Za-z]:[\\/]/.test(candidate)) candidate = candidate.slice(1);
189
189
  }
190
- if (/^[A-Za-z]:(?!\/)/.test(candidate)) candidate = candidate.slice(0, 2) + "/" + candidate.slice(2);
190
+ if (/^[A-Za-z]:(?![\\/])/u.test(candidate)) candidate = candidate.slice(0, 2) + "/" + candidate.slice(2);
191
191
  return looksAbsolute(candidate) ? candidate : null;
192
192
  }
193
193
 
@@ -247,10 +247,10 @@ window.__ModuleLoader__.load({
247
247
  }
248
248
 
249
249
  /** An absolute path written as plain text inside the clicked element. */
250
- var PATH_IN_TEXT = /(?:^|[\s"'“”「」()()\[\]<>])(@?"?(?:\/|[A-Za-z]:[\\/]|\\\\[^\\\s]+\\|~\/(?!\/))[^\s"'“”「」<>,。;:!?]*)/u;
250
+ var PATH_IN_TEXT = /(?:^|[\s"'“”「」()()\[\]<>])(@?"?(?:\/|[A-Za-z]:[\\/]|\\\\[^\\\s]+\\|~\/(?!\/))[^\s"'“”「」<>,。;:!?()【】《》]*)/u;
251
251
 
252
252
  /** 路径结尾成立的样子:有扩展名,或以分隔符收尾。 */
253
- var PATH_TAIL = /(?:\.[A-Za-z0-9]{1,8}|[\\/])$/u;
253
+ var PATH_TAIL = /(?:\.[A-Za-z0-9]{1,8}(?:#L\d+(?:-L?\d+)?(?::\d+)?)?|#L\d+(?::\d+)?|[\\/])$/u;
254
254
 
255
255
  /** 一段词像不像同一路径的下一段:不以分隔符或盘符开头,也不带句子标点。 */
256
256
  function continuesPath(word) {
@@ -269,7 +269,7 @@ window.__ModuleLoader__.load({
269
269
  for (var round = 0; round < 3; round += 1) {
270
270
  var space = /^[ \t]+/u.exec(remaining);
271
271
  if (space === null) break;
272
- var word = /^[^ \t"'\u201c\u201d\u300c\u300d<>\u3001\uff0c\u3002\uff1b\uff1a\uff01\uff1f]+/u.exec(remaining.slice(space[0].length));
272
+ var word = /^[^ \t"'“”「」<>,。;:!?、()【】《》]+/u.exec(remaining.slice(space[0].length));
273
273
  if (word === null) break;
274
274
  remaining = remaining.slice(space[0].length + word[0].length);
275
275
  if (!continuesPath(word[0])) break;
@@ -337,7 +337,7 @@ window.__ModuleLoader__.load({
337
337
  /** Strip the line suffix a Markdown file link carries (`path#L12`). */
338
338
  function stripLineSuffix(value) {
339
339
  if (typeof value !== "string") return value;
340
- return value.replace(/#L[0-9]+(?:-L[0-9]+)?$/u, "");
340
+ return value.replace(/#L[0-9]+(?:-L?[0-9]+)?(?::[0-9]+)?$/u, "");
341
341
  }
342
342
 
343
343
  /** Read the path a component's props carry, if any. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-chat-link-actions",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "Right-click actions on file links in the DSH transcript: quote the path into the composer, or reveal the file in the OS file manager. Menus are drawn in the app's own style, never the system one.",
5
5
  "type": "module",
6
6
  "main": "index.js",