This commit is contained in:
Vanessa 2022-08-04 00:11:11 +08:00
parent c211137af7
commit 2b91919103
2 changed files with 9 additions and 21 deletions

View file

@ -204,6 +204,8 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
size: Constants.SIZE_GET,
}, getResponse => {
onGet(getResponse, editor.editor.protyle, options.action);
// 大纲点击折叠标题下的内容时,需更新反链面板
updateBacklinkGraph(allModels, editor.editor.protyle);
});
} else {
if (options.action.includes(Constants.CB_GET_HL)) {

View file

@ -94,27 +94,13 @@ export class Outline extends Model {
element: options.tab.panelElement.lastElementChild as HTMLElement,
data: null,
click: (element: HTMLElement) => {
const models = getAllModels();
models.editor.find(item => {
if (this.blockId === item.editor.protyle.block.rootID && !item.element.classList.contains("fn__none")) {
const id = element.getAttribute("data-node-id");
const targetElement = item.editor.protyle.wysiwyg.element.querySelector(`[data-node-id="${id}"]`);
if (targetElement) {
targetElement.scrollIntoView();
focusBlock(targetElement);
pushBack(item.editor.protyle, undefined, targetElement);
} else {
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
openFileById({
id,
hasContext: !foldResponse.data,
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID],
});
updateBacklinkGraph(models, item.editor.protyle);
});
}
return true;
}
const id = element.getAttribute("data-node-id");
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
openFileById({
id,
hasContext: !foldResponse.data,
action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID],
});
});
}
});