This commit is contained in:
Vanessa 2022-10-14 10:12:41 +08:00
parent b53cb4974b
commit ff64e5fcef
3 changed files with 15 additions and 13 deletions

4
app/pnpm-lock.yaml generated
View file

@ -1906,10 +1906,10 @@ packages:
resolution: {integrity: sha512-m0+M53+HYMzqKxwNQZT143K7WwXEGUy9LY31l8dJphXx2P/FQod615mVbxHyqbDCG4J5bHdWm21qZ0e2DVY6CQ==}
engines: {node: '>=14.0.0'}
dependencies:
7zip-bin: 5.1.1
'@develar/schema-utils': 2.6.5
'@electron/universal': 1.2.1
'@malept/flatpak-bundler': 0.4.0
7zip-bin: 5.1.1
async-exit-hook: 2.0.1
bluebird-lst: 1.0.9
builder-util: 23.3.3
@ -2193,9 +2193,9 @@ packages:
/builder-util/23.3.3:
resolution: {integrity: sha512-MJZlUiq2PY5hjYv9+XNaoYdsITqvLgRDoHSFg/4nzpInbNxNjLQOolL04Zsyp+hgfcbFvMC4h0KkR1CMPHLWbA==}
dependencies:
7zip-bin: 5.1.1
'@types/debug': 4.1.7
'@types/fs-extra': 9.0.13
7zip-bin: 5.1.1
app-builder-bin: 4.0.0
bluebird-lst: 1.0.9
builder-util-runtime: 9.0.3

View file

@ -335,15 +335,11 @@ export const updatePanelByEditor = (protyle?: IProtyle, focus = true, pushBackSt
fileModel.selectItem(protyle.notebookId, protyle.path);
}
}
const models = getAllModels();
updateOutline(models, protyle, reload);
updateBacklinkGraph(models, protyle);
} else {
// 关闭所有页签时,需更新对应的面板
const models = getAllModels();
updateOutline(models, protyle, reload);
updateBacklinkGraph(models, protyle);
}
// 切换页签或关闭所有页签时,需更新对应的面板
const models = getAllModels();
updateOutline(models, protyle, reload);
updateBacklinkGraph(models, protyle);
setTitle(title);
};
@ -373,7 +369,7 @@ const updateOutline = (models: IModels, protyle: IProtyle, reload = false) => {
fetchPost("/api/outline/getDocOutline", {
id: blockId,
}, response => {
if (!isCurrentEditor(blockId)) {
if (!isCurrentEditor(blockId) || item.blockId === blockId) {
return;
}
item.update(response, blockId);
@ -447,7 +443,7 @@ export const updateBacklinkGraph = (models: IModels, protyle: IProtyle) => {
k: item.inputsElement[0].value,
mk: item.inputsElement[1].value,
}, response => {
if (!isCurrentEditor(blockId)) {
if (!isCurrentEditor(blockId) || item.blockId === blockId) {
item.element.querySelector('.block__icon[data-type="refresh"] svg').classList.remove("fn__rotate");
return;
}

View file

@ -369,6 +369,10 @@ export class Backlink extends Model {
private toggleItem(liElement: HTMLElement, isMention: boolean) {
const svgElement = liElement.firstElementChild.firstElementChild;
if (svgElement.getAttribute("disabled")) {
return;
}
svgElement.setAttribute("disabled", "disabled");
const docId = liElement.getAttribute("data-node-id");
if (svgElement.classList.contains("b3-list-item__arrow--open")) {
svgElement.classList.remove("b3-list-item__arrow--open");
@ -380,12 +384,14 @@ export class Backlink extends Model {
}
});
liElement.nextElementSibling?.remove();
svgElement.removeAttribute("disabled");
} else {
svgElement.classList.add("b3-list-item__arrow--open");
fetchPost(isMention ? "/api/ref/getBackmentionDoc" : "/api/ref/getBacklinkDoc", {
defID: this.blockId,
refTreeID: docId
}, (response) => {
svgElement.removeAttribute("disabled");
svgElement.classList.add("b3-list-item__arrow--open");
const editorElement = document.createElement("div");
editorElement.style.minHeight = "auto";
editorElement.setAttribute("data-defid", this.blockId);