Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/12900

Vanessaf09c10a097e5
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 91f4c407be..1e48c9c4a2 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -2126,76 +2126,74 @@ export class WYSIWYG {
event.stopPropagation();
event.preventDefault();
hideElements(["dialog", "toolbar"], protyle);
- if (range.toString() !== "" && !event.shiftKey) {
- // 选择不打开引用
- return;
- }
- let refBlockId: string;
- if (blockRefElement) {
- refBlockId = blockRefElement.getAttribute("data-id");
- } else if (aElement) {
- refBlockId = aLink.substring(16, 38);
- }
- checkFold(refBlockId, (zoomIn, action, isRoot) => {
- // 块引用跳转后需要短暂高亮目标块 https://github.com/siyuan-note/siyuan/issues/11542
- if (!isRoot) {
- action.push(Constants.CB_GET_HL);
- }
- /// #if MOBILE
- openMobileFileById(protyle.app, refBlockId, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
- activeBlur();
- hideKeyboardToolbar();
- /// #else
- if (event.shiftKey) {
- openFileById({
- app: protyle.app,
- id: refBlockId,
- position: "bottom",
- action,
- zoomIn
- });
- window.dispatchEvent(new KeyboardEvent("keydown", {key: "Escape"}));
- } else if (event.altKey) {
- openFileById({
- app: protyle.app,
- id: refBlockId,
- position: "right",
- action,
- zoomIn
- });
- } else if (ctrlIsPressed) {
- openFileById({
- app: protyle.app,
- id: refBlockId,
- keepCursor: true,
- action: zoomIn ? [Constants.CB_GET_HL, Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],
- zoomIn
- });
- } else {
- openFileById({
- app: protyle.app,
- id: refBlockId,
- action,
- zoomIn
- });
- }
- /// #endif
- });
- /// #if !MOBILE
- if (protyle.model) {
- // 打开双链需记录到后退中 https://github.com/siyuan-note/insider/issues/801
- let blockElement: HTMLElement | false;
+ if (range.toString() === "" || event.shiftKey) {
+ let refBlockId: string;
if (blockRefElement) {
- blockElement = hasClosestBlock(blockRefElement);
+ refBlockId = blockRefElement.getAttribute("data-id");
} else if (aElement) {
- blockElement = hasClosestBlock(aElement);
+ refBlockId = aLink.substring(16, 38);
}
- if (blockElement) {
- pushBack(protyle, getEditorRange(this.element), blockElement);
+ checkFold(refBlockId, (zoomIn, action, isRoot) => {
+ // 块引用跳转后需要短暂高亮目标块 https://github.com/siyuan-note/siyuan/issues/11542
+ if (!isRoot) {
+ action.push(Constants.CB_GET_HL);
+ }
+ /// #if MOBILE
+ openMobileFileById(protyle.app, refBlockId, zoomIn ? [Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
+ activeBlur();
+ hideKeyboardToolbar();
+ /// #else
+ if (event.shiftKey) {
+ openFileById({
+ app: protyle.app,
+ id: refBlockId,
+ position: "bottom",
+ action,
+ zoomIn
+ });
+ window.dispatchEvent(new KeyboardEvent("keydown", {key: "Escape"}));
+ } else if (event.altKey) {
+ openFileById({
+ app: protyle.app,
+ id: refBlockId,
+ position: "right",
+ action,
+ zoomIn
+ });
+ } else if (ctrlIsPressed) {
+ openFileById({
+ app: protyle.app,
+ id: refBlockId,
+ keepCursor: true,
+ action: zoomIn ? [Constants.CB_GET_HL, Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],
+ zoomIn
+ });
+ } else {
+ openFileById({
+ app: protyle.app,
+ id: refBlockId,
+ action,
+ zoomIn
+ });
+ }
+ /// #endif
+ });
+ /// #if !MOBILE
+ if (protyle.model) {
+ // 打开双链需记录到后退中 https://github.com/siyuan-note/insider/issues/801
+ let blockElement: HTMLElement | false;
+ if (blockRefElement) {
+ blockElement = hasClosestBlock(blockRefElement);
+ } else if (aElement) {
+ blockElement = hasClosestBlock(aElement);
+ }
+ if (blockElement) {
+ pushBack(protyle, getEditorRange(this.element), blockElement);
+ }
}
+ /// #endif
+ return;
}
- /// #endif
- return;
}
/// #if MOBILE
// https://github.com/siyuan-note/siyuan/issues/10513