This commit is contained in:
Vanessa 2023-11-20 12:27:20 +08:00
parent 53b7f45175
commit dc5551aea8
2 changed files with 26 additions and 4 deletions

View file

@ -56,6 +56,9 @@ export const genAVValueHTML = (value: IAVCellValue) => {
<span class="fn__space"></span>
<a href="tel:${value.phone.content}" target="_blank" aria-label="${window.siyuan.languages.openBy}" class="block__icon block__icon--show fn__flex-center b3-tooltips__w b3-tooltips"><svg><use xlink:href="#iconPhone"></use></svg></a>`;
break;
case "checkbox":
html = `<svg class="av__checkbox" style="height: 17px;"><use xlink:href="#icon${value.checkbox.checked?"Check":"Uncheck"}"></use></svg>`;
break;
case "template":
html = `<div class="fn__flex-1">${value.template.content}</div>`;
break;
@ -76,9 +79,17 @@ export const renderAVAttribute = (element: HTMLElement, id: string, protyle?: IP
key: {
type: TAVCol,
name: string,
options?: { name: string, color: string }[]
options?: {
name: string,
color: string
}[]
},
values: { keyID: string, id: string, blockID: string, type?: TAVCol & IAVCellValue } []
values: {
keyID: string,
id: string,
blockID: string,
type?: TAVCol & IAVCellValue
} []
}[],
blockIDs: string[],
avID: string
@ -128,6 +139,13 @@ class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone"].includes
event.preventDefault();
return;
}
const checkboxElement = hasClosestByAttribute(target, "data-type", "checkbox");
if (checkboxElement) {
popTextCell(protyle, [checkboxElement], "checkbox");
event.stopPropagation();
event.preventDefault();
return;
}
});
element.querySelectorAll(".b3-text-field--text").forEach((item: HTMLInputElement) => {
item.addEventListener("change", () => {

View file

@ -339,13 +339,17 @@ const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElem
id,
data: blockElement.getAttribute("updated"),
});
updateAttrViewCellAnimation(item);
if (!hasClosestByClassName(cellElements[0], "custom-attr")) {
updateAttrViewCellAnimation(item);
}
});
}
if (doOperations.length > 0) {
transaction(protyle, doOperations, undoOperations);
}
cellElements[0].classList.add("av__cell--select");
if (!hasClosestByClassName(cellElements[0], "custom-attr")) {
cellElements[0].classList.add("av__cell--select");
}
if (blockElement) {
focusBlock(blockElement);
}