diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index 168c1c4e8..6781f4faa 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -54,6 +54,7 @@ const updateCellValue = (protyle: IProtyle, cellElement: HTMLElement, type: TAVC if (!blockElement) { return; } + const rowID = rowElement.getAttribute("data-id"); const avMaskElement = document.querySelector(".av__mask"); const cellId = cellElement.getAttribute("data-id"); const colId = cellElement.getAttribute("data-col-id"); @@ -69,6 +70,7 @@ const updateCellValue = (protyle: IProtyle, cellElement: HTMLElement, type: TAVC id: cellId, avID, keyID: colId, + rowID, data: { [type]: {content: inputValue} } @@ -77,6 +79,7 @@ const updateCellValue = (protyle: IProtyle, cellElement: HTMLElement, type: TAVC id: cellId, avID, keyID: colId, + rowID, data: { [type]: {content: oldValue} } diff --git a/app/src/protyle/render/av/select.ts b/app/src/protyle/render/av/select.ts index fd301de5b..6855d07d7 100644 --- a/app/src/protyle/render/av/select.ts +++ b/app/src/protyle/render/av/select.ts @@ -48,7 +48,7 @@ export const removeSelectCell = (protyle: IProtyle, data: IAVTable, options: { if (!target) { return; } - const rowId = options.cellElement.parentElement.dataset.id; + const rowID = options.cellElement.parentElement.dataset.id; const colId = options.cellElement.dataset.colId; const cellId = options.cellElement.dataset.id; let colData: IAVColumn; @@ -63,7 +63,7 @@ export const removeSelectCell = (protyle: IProtyle, data: IAVTable, options: { } let cellData: IAVCell; data.rows.find(row => { - if (row.id === rowId) { + if (row.id === rowID) { row.cells.find(cell => { if (cell.id === cellId) { cellData = cell; @@ -86,12 +86,14 @@ export const removeSelectCell = (protyle: IProtyle, data: IAVTable, options: { action: "updateAttrViewCell", id: cellId, keyID: colId, + rowID, parentID: data.id, data: cellData.value }], [{ action: "updateAttrViewCell", id: cellId, keyID: colId, + rowID, parentID: data.id, data: { [colData.type]: oldValue @@ -348,7 +350,7 @@ export const bindSelectEvent = (protyle: IProtyle, data: IAVTable, menuElement: export const addSelectColAndCell = (protyle: IProtyle, data: IAVTable, options: { cellElement: HTMLElement }, currentElement: HTMLElement, menuElement: HTMLElement) => { - const rowId = options.cellElement.parentElement.dataset.id; + const rowID = options.cellElement.parentElement.dataset.id; const colId = options.cellElement.dataset.colId; const cellId = options.cellElement.dataset.id; let colData: IAVColumn; @@ -363,7 +365,7 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAVTable, options: } let cellData: IAVCell; data.rows.find(row => { - if (row.id === rowId) { + if (row.id === rowID) { row.cells.find(cell => { if (cell.id === cellId) { cellData = cell; @@ -404,6 +406,7 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAVTable, options: action: "updateAttrViewCell", id: cellId, keyID: colId, + rowID, parentID: data.id, data: cellData.value }], [{ @@ -417,12 +420,14 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAVTable, options: action: "updateAttrViewCell", id: cellId, keyID: colId, + rowID, parentID: data.id, data: cellData.value }], [{ action: "updateAttrViewCell", id: cellId, keyID: colId, + rowID, parentID: data.id, data: { [colData.type]: oldValue diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index 114592a80..af44aec7d 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -309,6 +309,7 @@ interface IOperation { id?: string, avID?: string, // av keyID?: string // updateAttrViewCell 专享 + rowID?: string // updateAttrViewCell 专享 data?: any, // updateAttr 时为 { old: IObject, new: IObject }, updateAttrViewCell 时为 {TAVCol: {content: string}} parentID?: string previousID?: string