Vanessa 2023-07-10 11:18:59 +08:00
parent 64c4bec75f
commit 5d1a9de70d

View File

@ -113,12 +113,14 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: {
cellElement: HTMLElement; cellElement: HTMLElement;
}, target: HTMLElement,) => { }, target: HTMLElement,) => {
const name = target.parentElement.dataset.name; const name = target.parentElement.dataset.name;
const color = target.parentElement.dataset.color;
const menu = new Menu("av-select-option", () => { const menu = new Menu("av-select-option", () => {
transaction(protyle, [{ transaction(protyle, [{
action: "updateAttrViewColOption", action: "updateAttrViewColOption",
id: colId, id: colId,
parentID: data.id, parentID: data.id,
data: { data: {
newColor: color,
oldName: name, oldName: name,
newName: inputElement.value newName: inputElement.value
}, },
@ -127,6 +129,7 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: {
id: colId, id: colId,
parentID: data.id, parentID: data.id,
data: { data: {
newColor: color,
oldName: inputElement.value, oldName: inputElement.value,
newName: name newName: name
}, },
@ -139,7 +142,6 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: {
if (!menuElement) { if (!menuElement) {
return; return;
} }
const color = target.parentElement.dataset.color;
const colId = options.cellElement.dataset.colId; const colId = options.cellElement.dataset.colId;
menu.addItem({ menu.addItem({
iconHTML: "", iconHTML: "",
@ -194,6 +196,8 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: {
id: colId, id: colId,
parentID: data.id, parentID: data.id,
data: { data: {
oldName: name,
newName: inputElement.value,
oldColor: color, oldColor: color,
newColor: (index + 1).toString() newColor: (index + 1).toString()
}, },
@ -202,6 +206,8 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: {
id: colId, id: colId,
parentID: data.id, parentID: data.id,
data: { data: {
oldName: inputElement.value,
newName: name,
oldColor: (index + 1).toString(), oldColor: (index + 1).toString(),
newColor: color newColor: color
}, },
@ -213,6 +219,7 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: {
menu.open({ menu.open({
x: rect.left, x: rect.left,
y: rect.bottom, y: rect.bottom,
w: rect.width,
h: rect.height, h: rect.height,
}); });
const inputElement = window.siyuan.menus.menu.element.querySelector("input"); const inputElement = window.siyuan.menus.menu.element.querySelector("input");