mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
🚨
This commit is contained in:
parent
86fab2b36a
commit
d1851255af
4 changed files with 15 additions and 15 deletions
|
|
@ -416,7 +416,7 @@ export class Wnd {
|
||||||
|
|
||||||
public switchTab(target: HTMLElement, pushBack = false, update = true, resize = true, isSaveLayout = true) {
|
public switchTab(target: HTMLElement, pushBack = false, update = true, resize = true, isSaveLayout = true) {
|
||||||
let currentTab: Tab;
|
let currentTab: Tab;
|
||||||
let isInitActive = false
|
let isInitActive = false;
|
||||||
this.children.forEach((item) => {
|
this.children.forEach((item) => {
|
||||||
if (target === item.headElement) {
|
if (target === item.headElement) {
|
||||||
if (item.headElement && item.headElement.classList.contains("fn__none")) {
|
if (item.headElement && item.headElement.classList.contains("fn__none")) {
|
||||||
|
|
|
||||||
|
|
@ -493,13 +493,13 @@ export const JSONToLayout = (app: App, isStart: boolean) => {
|
||||||
zoomIn: idZoomIn.isZoomIn
|
zoomIn: idZoomIn.isZoomIn
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let latestTabHeaderElement:HTMLElement
|
let latestTabHeaderElement:HTMLElement;
|
||||||
document.querySelectorAll('li[data-type="tab-header"][data-init-active="true"]').forEach((item: HTMLElement) => {
|
document.querySelectorAll('li[data-type="tab-header"][data-init-active="true"]').forEach((item: HTMLElement) => {
|
||||||
if (!latestTabHeaderElement) {
|
if (!latestTabHeaderElement) {
|
||||||
latestTabHeaderElement = item
|
latestTabHeaderElement = item;
|
||||||
} else {
|
} else {
|
||||||
if (item.dataset.activetime > latestTabHeaderElement.dataset.activetime) {
|
if (item.dataset.activetime > latestTabHeaderElement.dataset.activetime) {
|
||||||
latestTabHeaderElement = item
|
latestTabHeaderElement = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const tab = getInstanceById(item.getAttribute("data-id")) as Tab;
|
const tab = getInstanceById(item.getAttribute("data-id")) as Tab;
|
||||||
|
|
|
||||||
|
|
@ -848,12 +848,12 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
||||||
label: window.siyuan.languages.delete,
|
label: window.siyuan.languages.delete,
|
||||||
async click() {
|
async click() {
|
||||||
if (type === "relation") {
|
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: {
|
const colData = response.data.av.keyValues.find((item: {
|
||||||
key: { id: string }
|
key: { id: string }
|
||||||
}) => item.key.id === colId);
|
}) => item.key.id === colId);
|
||||||
if (colData.key.relation?.isTwoWay) {
|
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({
|
const dialog = new Dialog({
|
||||||
title: window.siyuan.languages.removeCol.replace("${x}", colData.key.name),
|
title: window.siyuan.languages.removeCol.replace("${x}", colData.key.name),
|
||||||
content: `<div class="b3-dialog__content">
|
content: `<div class="b3-dialog__content">
|
||||||
|
|
@ -880,7 +880,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
||||||
cellElement,
|
cellElement,
|
||||||
blockElement,
|
blockElement,
|
||||||
removeDest: true
|
removeDest: true
|
||||||
})
|
});
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
break;
|
break;
|
||||||
} else if (target.classList.contains("b3-button--warning")) {
|
} else if (target.classList.contains("b3-button--warning")) {
|
||||||
|
|
@ -894,7 +894,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
||||||
cellElement,
|
cellElement,
|
||||||
blockElement,
|
blockElement,
|
||||||
removeDest: false
|
removeDest: false
|
||||||
})
|
});
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
break;
|
break;
|
||||||
} else if (target.classList.contains("b3-button--info")) {
|
} else if (target.classList.contains("b3-button--info")) {
|
||||||
|
|
@ -903,8 +903,8 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
||||||
}
|
}
|
||||||
target = target.parentElement;
|
target = target.parentElement;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
removeColByMenu({
|
removeColByMenu({
|
||||||
|
|
@ -917,7 +917,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
||||||
cellElement,
|
cellElement,
|
||||||
blockElement,
|
blockElement,
|
||||||
removeDest: false
|
removeDest: false
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
@ -992,7 +992,7 @@ const removeColByMenu = (options: {
|
||||||
}]);
|
}]);
|
||||||
removeAttrViewColAnimation(options.blockElement, options.colId);
|
removeAttrViewColAnimation(options.blockElement, options.colId);
|
||||||
options.blockElement.setAttribute("updated", newUpdated);
|
options.blockElement.setAttribute("updated", newUpdated);
|
||||||
}
|
};
|
||||||
|
|
||||||
export const removeCol = (options: {
|
export const removeCol = (options: {
|
||||||
protyle: IProtyle,
|
protyle: IProtyle,
|
||||||
|
|
@ -1048,7 +1048,7 @@ export const removeCol = (options: {
|
||||||
options.tabRect.right - options.menuElement.clientWidth, options.tabRect.bottom,
|
options.tabRect.right - options.menuElement.clientWidth, options.tabRect.bottom,
|
||||||
options.tabRect.height);
|
options.tabRect.height);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const genUpdateColItem = (type: TAVCol, oldType: TAVCol) => {
|
const genUpdateColItem = (type: TAVCol, oldType: TAVCol) => {
|
||||||
return `<button class="b3-menu__item" data-type="updateColType" data-old-type="${oldType}" data-new-type="${type}">
|
return `<button class="b3-menu__item" data-type="updateColType" data-old-type="${oldType}" data-new-type="${type}">
|
||||||
|
|
|
||||||
|
|
@ -1092,7 +1092,7 @@ export const openMenuPanel = (options: {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const isTwoWay = colData.type === "relation" && colData.relation?.isTwoWay
|
const isTwoWay = colData.type === "relation" && colData.relation?.isTwoWay;
|
||||||
if (isCustomAttr || isTwoWay) {
|
if (isCustomAttr || isTwoWay) {
|
||||||
const dialog = new Dialog({
|
const dialog = new Dialog({
|
||||||
title: isTwoWay ? window.siyuan.languages.removeCol.replace("${x}", menuElement.querySelector("input").value) : window.siyuan.languages.deleteOpConfirm,
|
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;
|
target = target.parentElement;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
removeCol({
|
removeCol({
|
||||||
protyle: options.protyle,
|
protyle: options.protyle,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue