|
@@ -58,7 +58,7 @@ import {blockRender} from "../render/blockRender";
|
|
|
/// #if !MOBILE
|
|
|
import {getAllModels} from "../../layout/getAll";
|
|
|
import {pushBack} from "../../util/backForward";
|
|
|
-import {openAsset, openBy, openFileById} from "../../editor/util";
|
|
|
+import {checkFold, openAsset, openBy, openFileById} from "../../editor/util";
|
|
|
import {openGlobalSearch} from "../../search/util";
|
|
|
/// #else
|
|
|
import {popSearch} from "../../mobile/menu/search";
|
|
@@ -1691,12 +1691,12 @@ export class WYSIWYG {
|
|
|
const breadcrumbId = backlinkBreadcrumbItemElement.getAttribute("data-id");
|
|
|
if (breadcrumbId) {
|
|
|
if (ctrlIsPressed) {
|
|
|
- fetchPost("/api/block/checkBlockFold", {id: breadcrumbId}, (foldResponse) => {
|
|
|
+ checkFold(breadcrumbId, (zoomIn) => {
|
|
|
openFileById({
|
|
|
app: protyle.app,
|
|
|
id: breadcrumbId,
|
|
|
- action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT],
|
|
|
- zoomIn: foldResponse.data
|
|
|
+ action: zoomIn ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT],
|
|
|
+ zoomIn
|
|
|
});
|
|
|
});
|
|
|
} else {
|
|
@@ -1754,10 +1754,9 @@ export class WYSIWYG {
|
|
|
} else if (aElement) {
|
|
|
refBlockId = aLink.substring(16, 38);
|
|
|
}
|
|
|
-
|
|
|
- fetchPost("/api/block/checkBlockFold", {id: refBlockId}, (foldResponse) => {
|
|
|
+ checkFold(refBlockId, (zoomIn, action) => {
|
|
|
/// #if MOBILE
|
|
|
- openMobileFileById(protyle.app, refBlockId, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]);
|
|
|
+ openMobileFileById(protyle.app, refBlockId, zoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
|
|
|
activeBlur();
|
|
|
hideKeyboardToolbar();
|
|
|
/// #else
|
|
@@ -1766,35 +1765,35 @@ export class WYSIWYG {
|
|
|
app: protyle.app,
|
|
|
id: refBlockId,
|
|
|
position: "bottom",
|
|
|
- action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],
|
|
|
- zoomIn: foldResponse.data
|
|
|
+ action,
|
|
|
+ zoomIn
|
|
|
});
|
|
|
} else if (event.altKey) {
|
|
|
openFileById({
|
|
|
app: protyle.app,
|
|
|
id: refBlockId,
|
|
|
position: "right",
|
|
|
- action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],
|
|
|
- zoomIn: foldResponse.data
|
|
|
+ action,
|
|
|
+ zoomIn
|
|
|
});
|
|
|
} else if (ctrlIsPressed) {
|
|
|
openFileById({
|
|
|
app: protyle.app,
|
|
|
id: refBlockId,
|
|
|
- action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],
|
|
|
keepCursor: true,
|
|
|
- zoomIn: foldResponse.data
|
|
|
+ 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: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],
|
|
|
- zoomIn: foldResponse.data
|
|
|
+ action,
|
|
|
+ zoomIn
|
|
|
});
|
|
|
}
|
|
|
/// #endif
|
|
|
- });
|
|
|
+ })
|
|
|
/// #if !MOBILE
|
|
|
if (protyle.model) {
|
|
|
// 打开双链需记录到后退中 https://github.com/siyuan-note/insider/issues/801
|
|
@@ -1903,9 +1902,9 @@ export class WYSIWYG {
|
|
|
const embedItemElement = hasClosestByClassName(event.target, "protyle-wysiwyg__embed");
|
|
|
if (embedItemElement) {
|
|
|
const embedId = embedItemElement.getAttribute("data-id");
|
|
|
- fetchPost("/api/block/checkBlockFold", {id: embedId}, (foldResponse) => {
|
|
|
+ checkFold(embedId, (zoomIn, action) => {
|
|
|
/// #if MOBILE
|
|
|
- openMobileFileById(protyle.app, embedId, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]);
|
|
|
+ openMobileFileById(protyle.app, embedId, zoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_HL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
|
|
|
activeBlur();
|
|
|
hideKeyboardToolbar();
|
|
|
/// #else
|
|
@@ -1914,23 +1913,23 @@ export class WYSIWYG {
|
|
|
app: protyle.app,
|
|
|
id: embedId,
|
|
|
position: "bottom",
|
|
|
- action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],
|
|
|
- zoomIn: foldResponse.data
|
|
|
+ action,
|
|
|
+ zoomIn
|
|
|
});
|
|
|
} else if (event.altKey) {
|
|
|
openFileById({
|
|
|
app: protyle.app,
|
|
|
id: embedId,
|
|
|
position: "right",
|
|
|
- action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],
|
|
|
- zoomIn: foldResponse.data
|
|
|
+ action,
|
|
|
+ zoomIn
|
|
|
});
|
|
|
} else if (ctrlIsPressed) {
|
|
|
openFileById({
|
|
|
app: protyle.app,
|
|
|
id: embedId,
|
|
|
- action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],
|
|
|
- zoomIn: foldResponse.data,
|
|
|
+ action: zoomIn ? [Constants.CB_GET_HL, Constants.CB_GET_ALL] : [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT],
|
|
|
+ zoomIn,
|
|
|
keepCursor: true,
|
|
|
});
|
|
|
} else if (!protyle.disabled) {
|
|
@@ -1942,7 +1941,7 @@ export class WYSIWYG {
|
|
|
}));
|
|
|
}
|
|
|
/// #endif
|
|
|
- });
|
|
|
+ })
|
|
|
event.stopPropagation();
|
|
|
return;
|
|
|
}
|