Vanessa 2024-05-17 23:35:36 +08:00
parent 0ad0d416c4
commit f6a4ccfc7d
2 changed files with 14 additions and 12 deletions

View file

@ -272,13 +272,6 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi
type: "submenu",
submenu: copySubMenu(blockId)
});
menu.addItem({
label: window.siyuan.languages.unbindBlock,
icon: "iconLinkOff",
click() {
updateCellsValue(protyle, blockElement, keyCellElement.querySelector(".av__celltext").textContent, [keyCellElement]);
}
});
}
if (!protyle.disabled) {
menu.addItem({
@ -366,6 +359,15 @@ ${window.siyuan.languages.insertRowAfter.replace("${x}", '<span class="fn__space
}
});
menu.addSeparator();
if (keyCellElement.getAttribute("data-detached") !== "true") {
menu.addItem({
label: window.siyuan.languages.unbindBlock,
icon: "iconLinkOff",
click() {
updateCellsValue(protyle, blockElement, keyCellElement.querySelector(".av__celltext").textContent, [keyCellElement]);
}
});
}
}
menu.addItem({
icon: "iconTrashcan",

View file

@ -537,7 +537,7 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
});
}
}
const isCustomAttr = !hasClosestByClassName(cellElements[0], "custom-attr");
const isCustomAttr = hasClosestByClassName(cellElements[0], "custom-attr");
cellElements.forEach((item: HTMLElement, elementIndex) => {
const rowElement = hasClosestByClassName(item, "av__row");
if (!rowElement) {
@ -588,7 +588,7 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
(cellValue.type === "relation" && typeof cellValue.relation === "string")) {
return;
}
if (type === "select" || type === "mSelect") {
if (columns && (type === "select" || type === "mSelect")) {
const operations = mergeAddOption(columns.find(e => e.id === colId), cellValue, avID);
doOperations.push(...operations.doOperations);
undoOperations.push(...operations.undoOperations);
@ -624,10 +624,10 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
rowID,
data: oldValue
});
if (!isCustomAttr) {
updateAttrViewCellAnimation(item, cellValue);
} else {
if (isCustomAttr) {
item.innerHTML = genAVValueHTML(cellValue);
} else {
updateAttrViewCellAnimation(item, cellValue);
}
});
if (doOperations.length > 0) {