mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-09 02:08:50 +01:00
This commit is contained in:
parent
84f3da2ae8
commit
afd1ea9dc2
2 changed files with 13 additions and 2 deletions
|
|
@ -103,6 +103,7 @@ export const updateAssetCell = (options: {
|
|||
const colId = options.cellElements[0].dataset.colId;
|
||||
const cellDoOperations: IOperation[] = [];
|
||||
const cellUndoOperations: IOperation[] = [];
|
||||
let mAssetValue: IAVCellAssetValue[]
|
||||
options.cellElements.forEach((item, elementIndex) => {
|
||||
if (!options.blockElement.contains(item)) {
|
||||
const rowElement = hasClosestByClassName(item, "av__row");
|
||||
|
|
@ -151,6 +152,9 @@ export const updateAssetCell = (options: {
|
|||
} else {
|
||||
cellValue.mAsset = options.replaceValue;
|
||||
}
|
||||
mAssetValue = cellValue.mAsset
|
||||
} else {
|
||||
cellValue.mAsset = mAssetValue
|
||||
}
|
||||
cellDoOperations.push({
|
||||
action: "updateAttrViewCell",
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ export const removeCellOption = (protyle: IProtyle, data: IAV, cellElements: HTM
|
|||
const colId = cellElements[0].dataset.colId;
|
||||
const doOperations: IOperation[] = [];
|
||||
const undoOperations: IOperation[] = [];
|
||||
let mSelectValue: IAVCellSelectValue[];
|
||||
cellElements.forEach((item, elementIndex) => {
|
||||
if (!blockElement.contains(item)) {
|
||||
item = cellElements[elementIndex] = blockElement.querySelector(`.av__cell[data-id="${item.dataset.id}"]`) as HTMLElement;
|
||||
|
|
@ -62,14 +63,16 @@ export const removeCellOption = (protyle: IProtyle, data: IAV, cellElements: HTM
|
|||
const cellValue = genCellValueByElement(getTypeByCellElement(item) || item.dataset.type as TAVCol, item);
|
||||
const oldValue = JSON.parse(JSON.stringify(cellValue));
|
||||
if (elementIndex === 0) {
|
||||
cellValue.mSelect?.find((item: { content: string }, index: number) => {
|
||||
cellValue.mSelect?.find((item, index) => {
|
||||
if (item.content === target.dataset.content) {
|
||||
cellValue.mSelect.splice(index, 1);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mSelectValue = cellValue.mSelect;
|
||||
} else {
|
||||
cellValue.mSelect = mSelectValue;
|
||||
}
|
||||
|
||||
doOperations.push({
|
||||
action: "updateAttrViewCell",
|
||||
id: cellValue.id,
|
||||
|
|
@ -455,6 +458,7 @@ export const addColOptionOrCell = (protyle: IProtyle, data: IAV, cellElements: H
|
|||
|
||||
const cellDoOperations: IOperation[] = [];
|
||||
const cellUndoOperations: IOperation[] = [];
|
||||
let mSelectValue: IAVCellSelectValue[];
|
||||
cellElements.forEach((item, index) => {
|
||||
const itemRowElement = hasClosestByClassName(item, "av__row");
|
||||
if (!itemRowElement) {
|
||||
|
|
@ -483,6 +487,9 @@ export const addColOptionOrCell = (protyle: IProtyle, data: IAV, cellElements: H
|
|||
content: currentElement.dataset.name
|
||||
}];
|
||||
}
|
||||
mSelectValue = cellValue.mSelect;
|
||||
} else {
|
||||
cellValue.mSelect = mSelectValue;
|
||||
}
|
||||
const rowID = itemRowElement.dataset.id;
|
||||
cellDoOperations.push({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue