feat(editor): 文件树「在应用中打开」子菜单(外部编辑器/图钉固定/SSH 远端/自定义编辑器) (#334)

* feat(editor): file tree 'open with' submenu (external editors, pin, SSH-remote, custom editors)

The file tree right-click menu gains an 'Open with >' submenu with the
resource manager (reveal in file manager), VS Code, Cursor and Zed, plus
user-defined custom editors (name + URL template + VSCode-family flag).
Each submenu row carries a pushpin that promotes the target to a direct
top-level menu item.

A configurable SSH host (settings: Files card gear) switches VSCode-family
openers to <scheme>://vscode-remote/ssh-remote+<host>/<path> and hides
host-local targets (file manager / Zed / non-VSCode custom editors).

External opens run through the new fenced /sidebar/api/open.external route
which spawns the platform opener with an argv array (no shell); the client
never navigates raw scheme URLs itself. The settings seam's render panel now
appends after the declarative rows instead of replacing them.

* feat(editor): polish open-with menu UI — brand icons, pushpin, chevron, row alignment

- Submenu rows: the custom label is now a block-level flex row filling the
  primitives itemLabel, so the pushpin docks at the row's far right (matching
  the trailing check of every other menu); menu row icons normalized to 16px
  (DSH native menus use 16, ours were 14).
- The submenu parent row gains a right-aligned chevron (the primitives Menu
  renders no arrow for submenu parents).
- Icons via react-icons: codicons VscPin/VscPinned pushpins (replacing the
  hand-drawn pin), VscFile/VscFolder/VscFolderOpened tree glyphs (replacing
  the </> file mark), VscLinkExternal for the open-with parent and the
  browser tab's open-external button (globally), SiCursor/SiZedindustries
  brand silhouettes; the VS Code mark is inlined from simple-icons@11.0.0
  (CC0) as IconVscode16 since later simple-icons releases dropped it. All
  monochrome currentColor to follow the active skin.
- tsdown: pin react-icons si/vsc to their ESM entries via resolve.alias —
  the package's exports map lists require before import, so the shared
  conditionNames picked the unshakeable CJS entry and bloated the core
  bundle by ~6.4 MB; tree-shaken it now adds only ~12 KB.
This commit is contained in:
Atlas Zeng
2026-08-22 23:19:17 +08:00
committed by GitHub
parent f36afc0180
commit 22a5d372be
27 changed files with 1662 additions and 65 deletions
+65
View File
@@ -893,3 +893,68 @@
color: var(--dsw-alias-label-secondary);
padding: 2px 2px 0;
}
/* Open-with settings panel: one custom editor row (name + URL template +
VSCode-family checkbox + remove) and the row-validity hint. */
.openWithEditorRow {
display: grid;
grid-template-columns: 1fr 1.5fr auto auto;
gap: 8px;
align-items: center;
min-width: 0;
}
.openWithEditorInput,
.openWithEditorTemplate {
width: 100%;
min-width: 0;
box-sizing: border-box;
padding: 5px 8px;
border: 1px solid var(--dsw-alias-border-l2);
border-radius: 8px;
background: var(--dsw-alias-bg-layer-3);
color: var(--dsw-alias-label-primary);
font: inherit;
font-size: 13px;
line-height: 20px;
}
.openWithEditorInput:focus-visible,
.openWithEditorTemplate:focus-visible {
outline: 2px solid var(--dsw-alias-state-business-primary);
outline-offset: 1px;
}
.openWithFamily {
display: inline-flex;
align-items: center;
gap: 5px;
font-size: 12px;
color: var(--dsw-alias-label-secondary);
white-space: nowrap;
cursor: pointer;
}
.openWithRemove {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 4px;
border: none;
border-radius: 8px;
background: none;
color: var(--dsw-alias-label-tertiary);
cursor: pointer;
}
.openWithRemove:hover {
color: var(--dsw-alias-state-error-primary);
background: var(--dsw-alias-bg-layer-2);
}
.openWithHint {
font-size: 12px;
line-height: 17px;
color: var(--dsw-alias-state-error-primary);
padding: 0 2px;
}