mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
ab3550d44d
commit
523d8d762b
4 changed files with 15 additions and 10 deletions
|
|
@ -93,6 +93,7 @@ export abstract class Constants {
|
|||
public static readonly CB_GET_ROOTSCROLL = "cb-get-rootscroll"; // 如果为 rootID 就滚动到指定位置,必有 rootID
|
||||
public static readonly CB_GET_HTML = "cb-get-html"; // 直接渲染,不需要再 /api/block/getDocInfo,否则搜索表格无法定位
|
||||
public static readonly CB_GET_HISTORY = "cb-get-history"; // 历史渲染
|
||||
public static readonly CB_GET_OPENNEW = "cb-get-opennew"; // 编辑器只读后新建文件需为临时解锁状态
|
||||
|
||||
// localstorage
|
||||
public static readonly LOCAL_ZOOM = "local-zoom";
|
||||
|
|
|
|||
|
|
@ -624,12 +624,12 @@ ${genHintItemHTML(item)}
|
|||
}, () => {
|
||||
insertHTML(`<span data-type="block-ref" data-id="${newSubDocId}" data-subtype="d">Untitled</span>`, protyle);
|
||||
/// #if MOBILE
|
||||
openMobileFileById(protyle.app, newSubDocId, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]);
|
||||
openMobileFileById(protyle.app, newSubDocId, [Constants.CB_GET_CONTEXT, Constants.CB_GET_OPENNEW]);
|
||||
/// #else
|
||||
openFileById({
|
||||
app: protyle.app,
|
||||
id: newSubDocId,
|
||||
action: [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT]
|
||||
action: [Constants.CB_GET_CONTEXT, Constants.CB_GET_OPENNEW]
|
||||
});
|
||||
/// #endif
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import {showMessage} from "../../dialog/message";
|
|||
import {avRender} from "../render/av/render";
|
||||
import {hideTooltip} from "../../dialog/tooltip";
|
||||
import {stickyRow} from "../render/av/row";
|
||||
import {updateReadonly as updateReadonlyMethod} from "../breadcrumb/action";
|
||||
|
||||
export const onGet = (options: {
|
||||
data: IWebSocketData,
|
||||
|
|
@ -206,6 +207,9 @@ const setHTML = (options: {
|
|||
}
|
||||
protyle.element.removeAttribute("disabled-forever");
|
||||
setReadonlyByConfig(protyle, updateReadonly);
|
||||
if (options.action.includes(Constants.CB_GET_OPENNEW)) {
|
||||
updateReadonlyMethod(protyle.breadcrumb.element.parentElement.querySelector('.block__icon[data-type="readonly"]'), protyle);
|
||||
}
|
||||
}
|
||||
|
||||
focusElementById(protyle, options.action, options.scrollAttr);
|
||||
|
|
|
|||
|
|
@ -107,10 +107,10 @@ export const newFile = (optios: {
|
|||
openFileById({
|
||||
app: optios.app,
|
||||
id: response.data,
|
||||
action: [Constants.CB_GET_CONTEXT]
|
||||
action: [Constants.CB_GET_CONTEXT, Constants.CB_GET_OPENNEW]
|
||||
});
|
||||
/// #else
|
||||
openMobileFileById(optios.app, response.data, [Constants.CB_GET_CONTEXT]);
|
||||
openMobileFileById(optios.app, response.data, [Constants.CB_GET_CONTEXT, Constants.CB_GET_OPENNEW]);
|
||||
/// #endif
|
||||
});
|
||||
} else {
|
||||
|
|
@ -128,10 +128,10 @@ export const newFile = (optios: {
|
|||
openFileById({
|
||||
app: optios.app,
|
||||
id: response.data,
|
||||
action: [Constants.CB_GET_CONTEXT]
|
||||
action: [Constants.CB_GET_CONTEXT, Constants.CB_GET_OPENNEW]
|
||||
});
|
||||
/// #else
|
||||
openMobileFileById(optios.app, response.data, [Constants.CB_GET_CONTEXT]);
|
||||
openMobileFileById(optios.app, response.data, [Constants.CB_GET_CONTEXT, Constants.CB_GET_OPENNEW]);
|
||||
/// #endif
|
||||
});
|
||||
});
|
||||
|
|
@ -151,10 +151,10 @@ export const newFile = (optios: {
|
|||
openFileById({
|
||||
app: optios.app,
|
||||
id: response.data,
|
||||
action: [Constants.CB_GET_CONTEXT]
|
||||
action: [Constants.CB_GET_CONTEXT, Constants.CB_GET_OPENNEW]
|
||||
});
|
||||
/// #else
|
||||
openMobileFileById(optios.app, response.data, [Constants.CB_GET_CONTEXT]);
|
||||
openMobileFileById(optios.app, response.data, [Constants.CB_GET_CONTEXT, Constants.CB_GET_OPENNEW]);
|
||||
/// #endif
|
||||
});
|
||||
return;
|
||||
|
|
@ -173,9 +173,9 @@ export const newFile = (optios: {
|
|||
sorts: optios.paths
|
||||
}, () => {
|
||||
/// #if !MOBILE
|
||||
openFileById({app: optios.app, id, action: [Constants.CB_GET_CONTEXT]});
|
||||
openFileById({app: optios.app, id, action: [Constants.CB_GET_CONTEXT, Constants.CB_GET_OPENNEW]});
|
||||
/// #else
|
||||
openMobileFileById(optios.app, id, [Constants.CB_GET_CONTEXT]);
|
||||
openMobileFileById(optios.app, id, [Constants.CB_GET_CONTEXT, Constants.CB_GET_OPENNEW]);
|
||||
/// #endif
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue