dsh-plugin-workbench 0.0.7 → 0.0.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,33 @@
4
4
  格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),
5
5
  版本号遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/)。
6
6
 
7
+ ## [0.0.9] - 2026-08-21
8
+
9
+ ### Added
10
+
11
+ - **布局补丁自动修复(自愈)**:插件 host 端在启动时自动检测
12
+ `dsh-client-ui-layout` 客户端 bundle 是否还带 explorer 列补丁;若已被
13
+ DSH 升级 / `pnpm install` 覆盖还原(这正是 workbench 列无声消失的根因),
14
+ 会自动重跑 `scripts/patch-layout.mjs` 重打。幂等(已打则跳过)、非阻塞
15
+ (spawn 后台执行,不影响启动)、安全(锚点不匹配时脚本 abort 不写文件,
16
+ 仅记录警告,插件照常启动)。
17
+
18
+ ## [0.0.8] - 2026-08-20
19
+
20
+ ### Fixed
21
+
22
+ - **删除/复制被占用文件夹不再报裸 "permission denied"**:Windows 上文件夹或其
23
+ 内部任一文件被其他程序占用(编辑器、资源管理器、终端 cd 其中、杀毒扫描)时,
24
+ 改名/删除会以 EPERM/EBUSY 失败。host 端 `rename` / `delete` / `copy` 端点
25
+ 现在先做**有界重试**(3 次、150/300ms 间隔),可自动扛过索引器/杀毒的瞬时
26
+ 占用;仍失败时返回可操作的提示「`名称` is in use by another program —
27
+ close any editor/Explorer view of it (or a terminal inside it) and retry」,
28
+ 替代原先无指引的 "permission denied"
29
+ - **树内复制文本不再误触发文件复制**:在树中选中文件/文件夹后,再去选中树内
30
+ 的实际文本(如行内错误提示)按 Ctrl/Cmd+C/X 时,此前会拦截浏览器原生复制、
31
+ 把选中的文件放进插件剪贴板。现改为:存在非空文本选区或焦点在可编辑元素时,
32
+ 快捷键交给浏览器原生处理,复制的是文字而非文件
33
+
7
34
  ## [0.0.7] - 2026-08-19
8
35
 
9
36
  ### Fixed
package/README.md CHANGED
@@ -4,13 +4,15 @@
4
4
  ![License](https://img.shields.io/github/license/Pasumao/dsh-plugin-workbench)
5
5
  ![CI](https://img.shields.io/github/actions/workflow/status/Pasumao/dsh-plugin-workbench/ci.yml?branch=main)
6
6
  ![Stars](https://img.shields.io/github/stars/Pasumao/dsh-plugin-workbench?style=social)
7
+ ![AI Assisted](https://img.shields.io/badge/AI-Assisted-8A2BE2)
7
8
 
8
9
  **能直接改文件的 VS Code 风格工作台**——不是只读预览:文件树 + 可编辑代码预览
9
10
  (语法高亮、标签页、行号栏)+ 右键文件操作(新建 / 重命名 / 删除 / 复制 / 剪切 /
10
11
  粘贴 / 在系统中打开 / 在资源管理器打开)+ 图片内联预览,每个工作区独立保存状态。
11
12
  装上之后,DSH 网页就是一个轻量代码编辑器。
12
13
 
13
- > ⚠️ 安装后需打一个布局补丁(见下方安装节)。
14
+ > ⚠️ 安装后需打一个布局补丁(见下方安装节);0.0.9 起插件启动时会自动检测并重打,
15
+ > DSH 升级覆盖 bundle 后无需再手动跑。
14
16
 
15
17
  ## 功能
16
18
 
@@ -48,9 +50,21 @@
48
50
  - 磁盘变更:宿主对打开文件做 `fs.watch`(监听父目录,可存活原子重命名),
49
51
  变更经 SSE `/dsh-plugin-files/events` 推送,干净标签自动同步
50
52
 
53
+ ## 配置
54
+
55
+ 无需环境变量或配置文件,安装后打一次布局补丁即可:
56
+
57
+ - **布局补丁**:插件 host 端启动时自动检测并重跑 `scripts/patch-layout.mjs`
58
+ (幂等、非阻塞;针对 `dsh-client-ui-layout@0.1.0-rc.6` 编写)。DSH 升级覆盖
59
+ bundle 后插件会自动补回;若自动重打失败(锚点失效),可手动运行
60
+ `node node_modules/dsh-plugin-workbench/scripts/patch-layout.mjs`;
61
+ - **行为偏好**(自动换行、亮暗主题、标签布局、文件树展开状态)按工作区持久化,无需手动配置;
62
+ - **文件操作通道**:经 loopback RPC `/dsh-plugin-files`,写操作显式以 `danger-full-access` 执行,无外部配置项。
63
+
51
64
  ## 安装
52
65
 
53
66
  > 布局补丁针对 `dsh-client-ui-layout@0.1.0-rc.6` 编写,其他版本需更新锚点。
67
+ > 0.0.9 起插件启动时自动检测并重打补丁(详见「配置」节)。
54
68
 
55
69
  ```powershell
56
70
  # npm(推荐)
@@ -59,6 +73,16 @@ dsh plugin --profile web add dsh-plugin-workbench
59
73
  dsh plugin --profile web add github:Pasumao/dsh-plugin-workbench
60
74
  ```
61
75
 
76
+ 源码安装(本地开发 / 调试):
77
+
78
+ ```bash
79
+ git clone https://github.com/Pasumao/dsh-plugin-workbench.git
80
+ cd dsh-plugin-workbench
81
+ pnpm install
82
+ pnpm run build # 产出 lib/index.js 与 lib/client.js
83
+ # 以 link: 方式挂载进 profile
84
+ ```
85
+
62
86
  安装后打布局补丁并重启:
63
87
 
64
88
  ```powershell
@@ -66,6 +90,9 @@ node node_modules/dsh-plugin-workbench/scripts/patch-layout.mjs
66
90
  # 重启 dsh web
67
91
  ```
68
92
 
93
+ > 0.0.9 起插件启动时会自动检测并重打布局补丁,DSH 升级后无需再手动跑;
94
+ > 仅当自动重打失败(锚点失效)时才需手动执行上面的命令。
95
+
69
96
  ## 开发
70
97
 
71
98
  ```powershell
@@ -87,7 +114,8 @@ dsh plugin --profile web remove dsh-plugin-workbench
87
114
  右键菜单的新建/重命名/删除同样经该通道(loopback 信任,与编辑器保存一致)
88
115
  - 图片预览走同源路由 `/dsh-plugin-files/raw/<path>`:仅响应图片扩展名,
89
116
  先经 `ctx.fs.resolve → stat`(沙箱一致的路径解析)再读取字节,20MB 上限
90
- - DSH 升级会覆盖布局 bundle,需重新运行补丁脚本;锚点失效时更新 `scripts/patch-layout.mjs`
117
+ - DSH 升级会覆盖布局 bundle;0.0.9 起插件启动时自动检测并重打补丁,
118
+ 无需手动重跑;锚点失效时需更新 `scripts/patch-layout.mjs`
91
119
  - 本仓库不包含 DSH 编译产物
92
120
 
93
121
  ## 参与贡献
package/lib/client.js CHANGED
@@ -1649,6 +1649,12 @@ window.__ModuleLoader__.load({
1649
1649
  const onTreeKeyDown = (0, react.useCallback)((e) => {
1650
1650
  const mod = e.ctrlKey || e.metaKey;
1651
1651
  const key = e.key.toLowerCase();
1652
+ if (mod && (key === "c" || key === "x")) {
1653
+ const target = e.target;
1654
+ if (target !== null && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable)) return;
1655
+ const selection = window.getSelection();
1656
+ if (selection !== null && !selection.isCollapsed && selection.toString().length > 0) return;
1657
+ }
1652
1658
  if (mod && key === "c") {
1653
1659
  const items = selectedItems();
1654
1660
  if (items.length === 0) return;