mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
a3e3a0aeed
commit
1d176d5a09
7 changed files with 45 additions and 33 deletions
|
|
@ -31,6 +31,7 @@ import {bindRollupData, getRollupHTML, goSearchRollupCol} from "./rollup";
|
|||
import {updateCellsValue} from "./cell";
|
||||
import {openCalcMenu} from "./calc";
|
||||
import * as dayjs from "dayjs";
|
||||
import {confirmDialog} from "../../../dialog/confirmDialog";
|
||||
|
||||
export const openMenuPanel = (options: {
|
||||
protyle: IProtyle,
|
||||
|
|
@ -1025,38 +1026,40 @@ export const openMenuPanel = (options: {
|
|||
event.stopPropagation();
|
||||
break;
|
||||
} else if (type === "removeCol") {
|
||||
const colId = menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id");
|
||||
let previousID: string;
|
||||
const colData = data.view.columns.find((item: IAVColumn, index) => {
|
||||
if (item.id === colId) {
|
||||
previousID = data.view.columns[index - 1]?.id;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
const newUpdated = dayjs().format("YYYYMMDDHHmmss");
|
||||
transaction(options.protyle, [{
|
||||
action: "removeAttrViewCol",
|
||||
id: colId,
|
||||
avID,
|
||||
}, {
|
||||
action: "doUpdateUpdated",
|
||||
id: blockID,
|
||||
data: newUpdated,
|
||||
}], [{
|
||||
action: "addAttrViewCol",
|
||||
name: colData.name,
|
||||
avID,
|
||||
type: colData.type,
|
||||
id: colId,
|
||||
previousID
|
||||
}, {
|
||||
action: "doUpdateUpdated",
|
||||
id: blockID,
|
||||
data: options.blockElement.getAttribute("updated")
|
||||
}]);
|
||||
removeAttrViewColAnimation(options.blockElement, colId);
|
||||
options.blockElement.setAttribute("updated", newUpdated);
|
||||
avPanelElement.remove();
|
||||
confirmDialog(isCustomAttr ? window.siyuan.languages.deleteOpConfirm : "", isCustomAttr ? window.siyuan.languages.removeCol.replace("${x}", menuElement.querySelector("input").value) : "", () => {
|
||||
const colId = menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id");
|
||||
let previousID: string;
|
||||
const colData = data.view.columns.find((item: IAVColumn, index) => {
|
||||
if (item.id === colId) {
|
||||
previousID = data.view.columns[index - 1]?.id;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
const newUpdated = dayjs().format("YYYYMMDDHHmmss");
|
||||
transaction(options.protyle, [{
|
||||
action: "removeAttrViewCol",
|
||||
id: colId,
|
||||
avID,
|
||||
}, {
|
||||
action: "doUpdateUpdated",
|
||||
id: blockID,
|
||||
data: newUpdated,
|
||||
}], [{
|
||||
action: "addAttrViewCol",
|
||||
name: colData.name,
|
||||
avID,
|
||||
type: colData.type,
|
||||
id: colId,
|
||||
previousID
|
||||
}, {
|
||||
action: "doUpdateUpdated",
|
||||
id: blockID,
|
||||
data: options.blockElement.getAttribute("updated")
|
||||
}]);
|
||||
removeAttrViewColAnimation(options.blockElement, colId);
|
||||
options.blockElement.setAttribute("updated", newUpdated);
|
||||
avPanelElement.remove();
|
||||
})
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue