dsh-find-bar

uitested: passnpmMIT

Browser-style in-page find bar (Cmd/Ctrl+F) for the desktop app, with highlight-all, a match counter, and a scope picker for the conversation or the right panel.

下载量 / Downloads
967
依赖体积 / node_modules
0.04 MB
测试时间 / Tested
2026-11-06
DSH 版本 / Version
0.2.2-rc.1

Install

dsh plugin --profile web add dsh-find-bar

Sandbox test results

StageResult
1 install✓
2 list✓
3 mount✓
4 boot—

Four stages run in an isolated sandbox: install (network on) → list → mount → boot (last three with no network).

README

dsh-find-bar

[English](README.md) | 中文

DSH web 插件:为桌面 App(Electron 壳)补上 ⌘F / Ctrl+F 页内查找,

体验对齐浏览器原生查找条——支持全文高亮、匹配计数、回车跳转,

并可用中|右滑块选择搜索区域。

搜索范围

搜索输入框右侧叠加两段滑块,对应两个可搜索栏(选择会记忆,下次打开时保持)。

滑块显隐不会改变查找条尺寸——右侧栏收起时滑块自动隐藏。

滑块无文字——左段=对话区域(默认),右段=右侧面板;悬浮滑块会显示

共用说明气泡(500ms 延迟,样式对齐应用自带控件的悬浮提示)。

范围规则:

  • 有选择才显示选择器:右侧面板收起时只搜对话区域,滑块整体隐藏;右栏展开后自动重现。搜索中该栏收起则自动退回"中"(不覆盖已保存的选择)
  • 跳过折叠内容:对话区自动收起的操作步骤、隐藏的面板内容不参与匹配;展开后约 250ms 内自动重新计数并入结果
  • 面板全屏(覆盖中央)仍视为"右"可搜
  • 左侧栏不作为范围:dsh 工作区自带搜索

原理

Electron 没有浏览器内置查找栏。本插件在客户端实现:

  • 监听 ⌘F/Ctrl+F(capture 阶段)弹出自绘查找条(跟随主题变量)
  • 用 TreeWalker 收集文本节点(含 shadow root 内),按所选栏限定根节点

(右栏锚点 [data-rightbar-col],中央列为其前一兄弟),

命中后用 checkVisibility 过滤被折叠隐藏的文本,构建 DOM Range 匹配

  • 用 CSS Custom Highlight API(CSS.highlights + ::highlight())高亮——

只绘制不修改 DOM,与 React 渲染零冲突

  • MutationObserver(含属性变化)防抖跟随内容更新与折叠/展开
  • 不支持该 API 的环境自动退回 window.find()(该模式无范围与计数)

快捷键

键 · 功能

⌘F / Ctrl+F · 打开查找条(自动填入当前选中文本)

Enter / Shift+Enter · 下一个 / 上一个匹配

⌘G / F3(+Shift) · 下一个 / 上一个

Esc · 关闭并清除高亮

输入即搜(防抖跟随内容流式更新),计数显示 当前/总数。

安装

dsh plugin --profile <profile> add dsh-find-bar

从 npm 安装(推荐);或从源码:

git clone https://github.com/secyborg/dsh-find-bar
dsh plugin --profile <profile> add ./dsh-find-bar

安装后重启一次应用(插件清单启动时装载)。

已知限制

  • 只搜索已渲染且可见在 DOM 里的内容;未展开的会话/极长列表若被界面折叠,需先展开
  • 面板内嵌 iframe 的网页内容不在搜索范围内
  • 匹配上限 5000 条(超限显示 +)
  • 大小写不敏感,暂无"区分大小写"开关
  • 退回 window.find() 的旧环境不支持范围选择

卸载

dsh plugin --profile <profile> remove dsh-find-bar

Rendered from the README published on npm. Formatted only, not edited.

Versions

Published on npm::3,最后更新 2026-10-24

Links

GitHub · Homepage · npm

Same category