dsh-chat-link-actions 0.2.11 → 0.2.13
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.
- package/client.js +11 -7
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -250,7 +250,7 @@ window.__ModuleLoader__.load({
|
|
|
250
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}
|
|
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) {
|
|
@@ -332,21 +332,25 @@ window.__ModuleLoader__.load({
|
|
|
332
332
|
var FIBER_KEY = /^__(?:reactFiber|reactInternalInstance)\$/;
|
|
333
333
|
|
|
334
334
|
/** 可能带文件的属性名。 */
|
|
335
|
-
var PROP_KEYS = ["destination", "path", "src", "href"];
|
|
335
|
+
var PROP_KEYS = ["destination", "path", "absolutePath", "filePath", "localPath", "assetPath", "sourcePath", "src", "href"];
|
|
336
|
+
var PROP_CONTAINERS = ["file", "asset", "attachment", "source", "item"];
|
|
336
337
|
|
|
337
338
|
/** Strip the line suffix a Markdown file link carries (`path#L12`). */
|
|
338
339
|
function stripLineSuffix(value) {
|
|
339
340
|
if (typeof value !== "string") return value;
|
|
340
|
-
return value.replace(/#L[0-9]+(?:-L[0-9]+)?$/u, "");
|
|
341
|
+
return value.replace(/#L[0-9]+(?:-L?[0-9]+)?(?::[0-9]+)?$/u, "");
|
|
341
342
|
}
|
|
342
343
|
|
|
343
344
|
/** Read the path a component's props carry, if any. */
|
|
344
345
|
function pathFromProps(props) {
|
|
345
346
|
if (props === null || typeof props !== "object") return null;
|
|
346
|
-
var
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
347
|
+
for (var c = 0; c < PROP_CONTAINERS.length; c += 1) {
|
|
348
|
+
var box = props[PROP_CONTAINERS[c]];
|
|
349
|
+
if (box === null || typeof box !== "object") continue;
|
|
350
|
+
for (var k = 0; k < PROP_KEYS.length; k += 1) {
|
|
351
|
+
var nested = normalizeCandidate(stripLineSuffix(box[PROP_KEYS[k]]));
|
|
352
|
+
if (nested !== null) return nested;
|
|
353
|
+
}
|
|
350
354
|
}
|
|
351
355
|
for (var i = 0; i < PROP_KEYS.length; i += 1) {
|
|
352
356
|
var fromProp = normalizeCandidate(stripLineSuffix(props[PROP_KEYS[i]]));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-chat-link-actions",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
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",
|