Skip to content

dsh-file-drop

Verified

@starpivot/dsh-file-drop · v0.1.1 · MIT · Web UI

Drop any non-image file into the composer as a path. Files over 256KB insert a brief summary only.

Install

dsh plugin add @starpivot/dsh-file-drop

Confirm the layer applied with dsh --profile default --dump-config — see the install guide.

Source

Published to npm without a public repository. Inspect the package contents before installing.

Tags

Readme

@starpivot/dsh-file-drop

dsh Web 对话区拖入非图片文件时,不再弹出「仅支持 PNG、JPG、WebP、GIF」。 插件在 capture 阶段接手这次拖放,把本机路径写进输入框。

行为

  • 图片(PNG / JPG / WebP / GIF)仍走官方附件栏。
  • 其它任意文件或文件夹写入输入框,一行一个摘要:路径 + 大小。含空格的路径会加引号。
  • Finder / 桌面端能给出 file://File.path 时,插入真实本机路径。
  • 超过 256 KB 只插入简要信息(路径、大小、large file),不读、不暂存、不把内容写进输入框。
  • 浏览器拿不到路径、且文件小于 256 KB 时,Host 把文件写到 ~/.dsh/dropped/<uuid>-<name>,再插入这条路径。
  • 锁定、只读或没有可用输入框时,不会插入。

安装

dsh plugin --profile web add @starpivot/dsh-file-drop
# or, from git:
dsh plugin --profile web add github:StarPivotNet/dsh-plugins-public#path:packages/file-drop

然后重启 dsh web 或桌面端。

文件

package.json        包声明 + dsh.bundle.patch + dsh.client 清单
cordis.patch.yml    bundle 挂载层(id: file-drop / ui-file-drop)
src/logic.ts        分类、路径解析、插入拼接
src/host.ts         Host RPC:stage 无路径文件
src/client.ts       capture 阶段拖放拦截
src/plugin.ts       浏览器入口
lib/                构建产物
README.md           本文件