This commit is contained in:
Vanessa 2023-10-13 11:34:19 +08:00
parent 673c952f07
commit af810b279d
2 changed files with 16 additions and 14 deletions

View file

@ -156,7 +156,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
const cellElement = hasClosestByClassName(event.target, "av__cell");
if (cellElement && !cellElement.parentElement.classList.contains("av__row--header")) {
const type = cellElement.parentElement.parentElement.firstElementChild.querySelector(`[data-col-id="${cellElement.getAttribute("data-col-id")}"]`).getAttribute("data-dtype") as TAVCol;
if (type === "updated" || type === "created") {
if (type === "updated" || type === "created" || (type === "block" && !cellElement.getAttribute("data-detached"))) {
selectRow(cellElement.parentElement.querySelector(".av__firstcol"), "toggle");
} else {
selectRow(cellElement.parentElement.querySelector(".av__firstcol"), "unselect");

View file

@ -457,19 +457,21 @@ const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElem
if (type === "template") {
const colId = cellElements[0].getAttribute("data-col-id");
const textElement = avMaskElement.querySelector(".b3-text-field") as HTMLInputElement;
transaction(protyle, [{
action: "updateAttrViewColTemplate",
id: colId,
avID,
data: textElement.value,
type: "template",
}], [{
action: "updateAttrViewColTemplate",
id: colId,
avID,
data: textElement.dataset.template,
type: "template",
}]);
if (textElement.value !== textElement.dataset.template) {
transaction(protyle, [{
action: "updateAttrViewColTemplate",
id: colId,
avID,
data: textElement.value,
type: "template",
}], [{
action: "updateAttrViewColTemplate",
id: colId,
avID,
data: textElement.dataset.template,
type: "template",
}]);
}
} else {
cellElements.forEach((item) => {
const rowElement = hasClosestByClassName(item, "av__row");