mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
This commit is contained in:
parent
0f0461dc09
commit
950aab4449
3 changed files with 13 additions and 4 deletions
|
|
@ -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}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue