mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
24c57bc647
commit
ac61d16520
6 changed files with 105 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue