mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-15 00:21:00 +08:00
This commit is contained in:
parent
4193cdd0e5
commit
d9813b016f
@ -1094,7 +1094,7 @@ const editKeydown = (event: KeyboardEvent) => {
|
||||
}
|
||||
if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.editor.general.spaceRepetition.custom, event)) {
|
||||
fetchPost("/api/riff/getTreeRiffDueCards", {rootID: protyle.block.rootID}, (response) => {
|
||||
openCardByData(response.data, "doc", protyle.block.rootID, protyle.title.editElement.textContent);
|
||||
openCardByData(response.data, "doc", protyle.block.rootID, protyle.title.editElement.textContent || "Untitled");
|
||||
});
|
||||
event.preventDefault();
|
||||
return true;
|
||||
|
@ -17,12 +17,22 @@ import {needSubscribe} from "../util/needSubscribe";
|
||||
import {redirectToCheckAuth} from "../util/pathName";
|
||||
import {getAllModels} from "../layout/getAll";
|
||||
import {reloadProtyle} from "../protyle/util/reload";
|
||||
import {Tab} from "../layout/Tab";
|
||||
|
||||
export const reloadSync = (data:{upsertRootIDs: string[], removeRootIDs: string[]}) => {
|
||||
|
||||
const updateTitle = (rootID: string, tab: Tab) => {
|
||||
fetchPost("/api/block/getDocInfo", {
|
||||
id: rootID
|
||||
}, (response) => {
|
||||
tab.updateTitle(response.data.name)
|
||||
})
|
||||
}
|
||||
export const reloadSync = (data: { upsertRootIDs: string[], removeRootIDs: string[] }) => {
|
||||
const allModels = getAllModels()
|
||||
allModels.editor.forEach(item => {
|
||||
if (data.upsertRootIDs.includes(item.editor.protyle.block.rootID)) {
|
||||
reloadProtyle(item.editor.protyle)
|
||||
reloadProtyle(item.editor.protyle);
|
||||
updateTitle(item.editor.protyle.block.rootID, item.parent);
|
||||
} else if (data.removeRootIDs.includes(item.editor.protyle.block.rootID)) {
|
||||
item.parent.parent.removeTab(item.parent.id, false, false, false);
|
||||
}
|
||||
@ -30,19 +40,25 @@ export const reloadSync = (data:{upsertRootIDs: string[], removeRootIDs: string[
|
||||
allModels.graph.forEach(item => {
|
||||
if (item.type === "local" && data.removeRootIDs.includes(item.rootId)) {
|
||||
item.parent.parent.removeTab(item.parent.id, false, false, false);
|
||||
} else if (item.type !== "local" || data.upsertRootIDs.includes(item.rootId)){
|
||||
} else if (item.type !== "local" || data.upsertRootIDs.includes(item.rootId)) {
|
||||
item.searchGraph(false);
|
||||
if (item.type === "local") {
|
||||
updateTitle(item.rootId, item.parent);
|
||||
}
|
||||
}
|
||||
})
|
||||
allModels.outline.forEach(item => {
|
||||
if (item.type === "local" && data.removeRootIDs.includes(item.blockId)) {
|
||||
item.parent.parent.removeTab(item.parent.id, false, false, false);
|
||||
} else if (item.type !== "local" || data.upsertRootIDs.includes(item.blockId)){
|
||||
} else if (item.type !== "local" || data.upsertRootIDs.includes(item.blockId)) {
|
||||
fetchPost("/api/outline/getDocOutline", {
|
||||
id: item.blockId,
|
||||
}, response => {
|
||||
item.update(response);
|
||||
});
|
||||
if (item.type === "local") {
|
||||
updateTitle(item.blockId, item.parent);
|
||||
}
|
||||
}
|
||||
})
|
||||
allModels.backlink.forEach(item => {
|
||||
@ -50,6 +66,9 @@ export const reloadSync = (data:{upsertRootIDs: string[], removeRootIDs: string[
|
||||
item.parent.parent.removeTab(item.parent.id, false, false, false);
|
||||
} else {
|
||||
item.refresh();
|
||||
if (item.type === "local") {
|
||||
updateTitle(item.rootId, item.parent);
|
||||
}
|
||||
}
|
||||
})
|
||||
allModels.files.forEach(item => {
|
||||
|
@ -18,7 +18,7 @@ export const openBacklink = (protyle: IProtyle) => {
|
||||
const newWnd = protyle.model.parent.parent.split("lr");
|
||||
const tab = new Tab({
|
||||
icon: "iconLink",
|
||||
title: protyle.title.editElement.textContent,
|
||||
title: protyle.title.editElement.textContent || "Untitled",
|
||||
callback(tab: Tab) {
|
||||
tab.addModel(new Backlink({
|
||||
type: "local",
|
||||
@ -45,7 +45,7 @@ export const openGraph = (protyle: IProtyle) => {
|
||||
const wnd = protyle.model.parent.parent.split("lr");
|
||||
const tab = new Tab({
|
||||
icon: "iconGraph",
|
||||
title: protyle.title.editElement.textContent,
|
||||
title: protyle.title.editElement.textContent || "Untitled",
|
||||
callback(tab: Tab) {
|
||||
tab.addModel(new Graph({
|
||||
type: "local",
|
||||
@ -71,7 +71,7 @@ export const openOutline = (protyle: IProtyle) => {
|
||||
const newWnd = protyle.model.parent.parent.split("lr");
|
||||
const tab = new Tab({
|
||||
icon: "iconAlignCenter",
|
||||
title: protyle.title.editElement.textContent,
|
||||
title: protyle.title.editElement.textContent || "Untitled",
|
||||
callback(tab: Tab) {
|
||||
tab.addModel(new Outline({
|
||||
type: "local",
|
||||
|
Loading…
Reference in New Issue
Block a user