Skip to content

Config open assets#17698

Open
mdzz2048 wants to merge 2 commits into
siyuan-note:devfrom
mdzz2048:config-open-assets
Open

Config open assets#17698
mdzz2048 wants to merge 2 commits into
siyuan-note:devfrom
mdzz2048:config-open-assets

Conversation

@mdzz2048

@mdzz2048 mdzz2048 commented May 16, 2026

Copy link
Copy Markdown
Contributor

Description / 描述

#10641

  1. 添加四个配置项用于区分不同的打开方式(editor.openLink
"openLink": {
    "click": "right-tab",
    "ctrlClick": "show-folder",
    "altClick": "current-tab",
    "shiftClick": "open-app"
},
  1. 支持插件通过监听 open-link 自定义链接打开方式

Type of change / 变更类型

  • Bug fix
    缺陷修复
  • Refactoring
    代码重构
  • New feature
    新功能
  • Text updates or new language additions
    修改文案或增加新语言

Checklist / 检查清单

  • I have performed a self-review of my own code (tested on windows11)
    我对自己的代码进行了自我审查
  • I have full rights to the submitted code and agree to license it under this project's AGPL-3.0 license
    我拥有所提交代码的完整权利,并同意其以本项目的 AGPL-3.0 许可证授权
  • PR is submitted to the dev branch and has no merge conflicts
    PR 提交到 dev 分支,并且没有合并冲突

@TCOTC

TCOTC commented May 20, 2026

Copy link
Copy Markdown
Contributor

我觉得可以再加上:

  • 下侧 bottom-tab
  • 新页签但不分屏 new-tab
  • 在后台打开页签 background-tab(目前 Ctrl+点击 块引用的行为)
  • 新窗口 new-window

@Vanessa219 Vanessa219 requested review from 88250, Vanessa219 and Copilot and removed request for Vanessa219 May 26, 2026 02:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds configurable link/asset opening behavior via a new editor.openLink configuration object, and exposes a cancellable open-link plugin event so plugins can override link opening behavior (per #10641 / #17690).

Changes:

  • Introduce Editor.OpenLink config (kernel) with defaults + nil-migration on config load.
  • Extend frontend config/types to include editor.openLink and new open-link event bus type.
  • Update openLink handling to resolve action from config/modifier keys and notify plugins before opening.

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
kernel/model/conf.go Ensure Conf.Editor.OpenLink is defaulted when missing (migration).
kernel/conf/editor.go Add OpenLink config struct and default openLink values in NewEditor().
app/src/types/index.d.ts Add open-link to the plugin TEventBus union.
app/src/types/config.d.ts Add TLinkOpenAction + IOpenLink and editor.openLink typing.
app/src/editor/openLink.ts Resolve open action from config/modifiers; emit open-link; route opening logic via switch(action).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +153 to +156
case "right-tab":
const isOpenRight = !window.siyuan.config.fileTree.noSplitScreenWhenOpenTab ? "right" : null
openAsset(protyle.app, linkAddress, pdfParams, isOpenRight);
break;
@Vanessa219 Vanessa219 requested review from Copilot and removed request for 88250 and Vanessa219 May 26, 2026 06:25
@Vanessa219 Vanessa219 requested review from 88250 and Vanessa219 May 26, 2026 06:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 5 changed files in this pull request and generated 3 comments.

Comment on lines +153 to +156
case "right-tab":
const isOpenRight = !window.siyuan.config.fileTree.noSplitScreenWhenOpenTab ? "right" : null
openAsset(protyle.app, linkAddress, pdfParams, isOpenRight);
break;
Comment on lines +149 to +152
switch (action) {
case "current-tab":
openAsset(protyle.app, linkAddress, pdfParams);
break;
Comment thread kernel/model/conf.go
Comment on lines +293 to +295
if nil == Conf.Editor.OpenLink {
Conf.Editor.OpenLink = defaultEditor.OpenLink
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants