This commit is contained in:
Vanessa 2023-07-01 10:24:12 +08:00
parent 24c57bc647
commit ac61d16520
6 changed files with 105 additions and 1 deletions

View file

@ -34,6 +34,82 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
}]);
}
});
menu.addItem({
icon: "iconNumber",
label: window.siyuan.languages.number,
click() {
const id = Lute.NewNodeID();
const type = "text";
transaction(protyle, [{
action: "addAttrViewCol",
name: "Text",
parentID: blockElement.getAttribute("data-av-id"),
type,
id
}], [{
action: "removeAttrViewCol",
id,
parentID: blockElement.getAttribute("data-av-id"),
}]);
}
});
menu.addItem({
icon: "iconListItem",
label: window.siyuan.languages.select,
click() {
const id = Lute.NewNodeID();
const type = "text";
transaction(protyle, [{
action: "addAttrViewCol",
name: "Text",
parentID: blockElement.getAttribute("data-av-id"),
type,
id
}], [{
action: "removeAttrViewCol",
id,
parentID: blockElement.getAttribute("data-av-id"),
}]);
}
});
menu.addItem({
icon: "iconList",
label: window.siyuan.languages.multiSelect,
click() {
const id = Lute.NewNodeID();
const type = "text";
transaction(protyle, [{
action: "addAttrViewCol",
name: "Text",
parentID: blockElement.getAttribute("data-av-id"),
type,
id
}], [{
action: "removeAttrViewCol",
id,
parentID: blockElement.getAttribute("data-av-id"),
}]);
}
});
menu.addItem({
icon: "iconCalendar",
label: window.siyuan.languages.date,
click() {
const id = Lute.NewNodeID();
const type = "text";
transaction(protyle, [{
action: "addAttrViewCol",
name: "Text",
parentID: blockElement.getAttribute("data-av-id"),
type,
id
}], [{
action: "removeAttrViewCol",
id,
parentID: blockElement.getAttribute("data-av-id"),
}]);
}
});
const addRect = addElement.getBoundingClientRect();
menu.open({
x: addRect.left,

View file

@ -8,7 +8,7 @@ export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => {
const cellRect = cellElement.getBoundingClientRect();
let html = "";
if (type === "block" || type === "text") {
html = `<textarea style="position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 200)}px" class="b3-text-field">${cellElement.textContent}</textarea>`;
html = `<textarea style="position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 200)}px;height: ${cellRect.height}px" class="b3-text-field">${cellElement.textContent}</textarea>`;
}
document.body.insertAdjacentHTML("beforeend", `<div class="av__mask">
${html}