This commit is contained in:
Vanessa 2024-10-17 22:14:12 +08:00
parent 86fab2b36a
commit d1851255af
4 changed files with 15 additions and 15 deletions

View file

@ -416,7 +416,7 @@ export class Wnd {
public switchTab(target: HTMLElement, pushBack = false, update = true, resize = true, isSaveLayout = true) {
let currentTab: Tab;
let isInitActive = false
let isInitActive = false;
this.children.forEach((item) => {
if (target === item.headElement) {
if (item.headElement && item.headElement.classList.contains("fn__none")) {

View file

@ -493,13 +493,13 @@ export const JSONToLayout = (app: App, isStart: boolean) => {
zoomIn: idZoomIn.isZoomIn
});
} else {
let latestTabHeaderElement:HTMLElement
let latestTabHeaderElement:HTMLElement;
document.querySelectorAll('li[data-type="tab-header"][data-init-active="true"]').forEach((item: HTMLElement) => {
if (!latestTabHeaderElement) {
latestTabHeaderElement = item
latestTabHeaderElement = item;
} else {
if (item.dataset.activetime > latestTabHeaderElement.dataset.activetime) {
latestTabHeaderElement = item
latestTabHeaderElement = item;
}
}
const tab = getInstanceById(item.getAttribute("data-id")) as Tab;

View file

@ -848,12 +848,12 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
label: window.siyuan.languages.delete,
async click() {
if (type === "relation") {
const response = await fetchSyncPost("/api/av/getAttributeView", {id: avID})
const response = await fetchSyncPost("/api/av/getAttributeView", {id: avID});
const colData = response.data.av.keyValues.find((item: {
key: { id: string }
}) => item.key.id === colId);
if (colData.key.relation?.isTwoWay) {
const relResponse = await fetchSyncPost("/api/av/getAttributeView", {id: colData.key.relation.avID})
const relResponse = await fetchSyncPost("/api/av/getAttributeView", {id: colData.key.relation.avID});
const dialog = new Dialog({
title: window.siyuan.languages.removeCol.replace("${x}", colData.key.name),
content: `<div class="b3-dialog__content">
@ -880,7 +880,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
cellElement,
blockElement,
removeDest: true
})
});
dialog.destroy();
break;
} else if (target.classList.contains("b3-button--warning")) {
@ -894,7 +894,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
cellElement,
blockElement,
removeDest: false
})
});
dialog.destroy();
break;
} else if (target.classList.contains("b3-button--info")) {
@ -903,8 +903,8 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
}
target = target.parentElement;
}
})
return
});
return;
}
}
removeColByMenu({
@ -917,7 +917,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
cellElement,
blockElement,
removeDest: false
})
});
}
});
menu.addSeparator();
@ -992,7 +992,7 @@ const removeColByMenu = (options: {
}]);
removeAttrViewColAnimation(options.blockElement, options.colId);
options.blockElement.setAttribute("updated", newUpdated);
}
};
export const removeCol = (options: {
protyle: IProtyle,
@ -1048,7 +1048,7 @@ export const removeCol = (options: {
options.tabRect.right - options.menuElement.clientWidth, options.tabRect.bottom,
options.tabRect.height);
}
}
};
const genUpdateColItem = (type: TAVCol, oldType: TAVCol) => {
return `<button class="b3-menu__item" data-type="updateColType" data-old-type="${oldType}" data-new-type="${type}">

View file

@ -1092,7 +1092,7 @@ export const openMenuPanel = (options: {
return true;
}
});
const isTwoWay = colData.type === "relation" && colData.relation?.isTwoWay
const isTwoWay = colData.type === "relation" && colData.relation?.isTwoWay;
if (isCustomAttr || isTwoWay) {
const dialog = new Dialog({
title: isTwoWay ? window.siyuan.languages.removeCol.replace("${x}", menuElement.querySelector("input").value) : window.siyuan.languages.deleteOpConfirm,
@ -1145,7 +1145,7 @@ export const openMenuPanel = (options: {
}
target = target.parentElement;
}
})
});
} else {
removeCol({
protyle: options.protyle,