dsh-chat-link-actions 0.2.7 → 0.2.9

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 (3) hide show
  1. package/client.js +11 -4
  2. package/index.js +6 -2
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -179,6 +179,7 @@ window.__ModuleLoader__.load({
179
179
  candidate = candidate.slice(1, -1);
180
180
  }
181
181
  candidate = candidate.replace(/[.,;:!?,。;:!?]+$/u, "");
182
+ candidate = stripLineSuffix(candidate);
182
183
  if (/^file:\/\//i.test(candidate)) {
183
184
  candidate = candidate.replace(/^file:\/\/(?:localhost)?/i, "");
184
185
  candidate = decodePercent(candidate);
@@ -487,7 +488,8 @@ window.__ModuleLoader__.load({
487
488
  copiedPath: "已复制路径", // ui-copy-ignore
488
489
  copiedQuote: "已复制引用", // ui-copy-ignore
489
490
  missing: "目标文件不存在", // ui-copy-ignore
490
- managerFailed: "无法打开文件管理器" // ui-copy-ignore
491
+ managerFailed: "无法打开文件管理器",
492
+ clipboardFailed: "剪贴板不可用" // ui-copy-ignore
491
493
  },
492
494
  en: { // ui-copy-ignore
493
495
  menu: "File actions", // ui-copy-ignore
@@ -497,7 +499,8 @@ window.__ModuleLoader__.load({
497
499
  copiedPath: "Path copied", // ui-copy-ignore
498
500
  copiedQuote: "Reference copied", // ui-copy-ignore
499
501
  missing: "File not found", // ui-copy-ignore
500
- managerFailed: "Could not open the file manager" // ui-copy-ignore
502
+ managerFailed: "Could not open the file manager",
503
+ clipboardFailed: "Clipboard unavailable" // ui-copy-ignore
501
504
  }
502
505
  };
503
506
 
@@ -712,7 +715,9 @@ window.__ModuleLoader__.load({
712
715
  if (inserted) return;
713
716
  navigator.clipboard.writeText(referenceText(path)).then(function () {
714
717
  toast(strings().copiedQuote);
715
- }, function () {});
718
+ }, function () {
719
+ toast(strings().clipboardFailed);
720
+ });
716
721
  });
717
722
  } },
718
723
  { id: "reveal", label: strings().reveal, icon: "reveal", run: function () {
@@ -721,7 +726,9 @@ window.__ModuleLoader__.load({
721
726
  { id: "copy", label: strings().copy, icon: "copy", run: function () {
722
727
  navigator.clipboard.writeText(path).then(function () {
723
728
  toast(strings().copiedPath);
724
- }, function () {});
729
+ }, function () {
730
+ toast(strings().clipboardFailed);
731
+ });
725
732
  } }
726
733
  ];
727
734
 
package/index.js CHANGED
@@ -121,8 +121,12 @@ export function revealCommand(path, platform = process.platform, facts = {}) {
121
121
  case 'darwin':
122
122
  if (isDirectory && !isSymbolicLink) return { command: 'open', args: [target] }
123
123
  return { command: 'open', args: ['-R', target] }
124
- case 'win32':
125
- return { command: 'explorer.exe', args: [encodeExplorerSelect(windowsTarget(target))] }
124
+ case 'win32': {
125
+ const spelled = windowsTarget(target)
126
+ /* explorer cannot /select a drive root; open the drive itself instead. */
127
+ if (/^[A-Za-z]:\\$/u.test(spelled)) return { command: 'explorer.exe', args: [spelled] }
128
+ return { command: 'explorer.exe', args: [encodeExplorerSelect(spelled)] }
129
+ }
126
130
  case 'android':
127
131
  return { command: 'termux-open', args: [directoryOf(target, platform)] }
128
132
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-chat-link-actions",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
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",