Vanessa 2023-06-10 16:40:44 +08:00
parent 23c6d5d17b
commit 5acd3aae08
4 changed files with 26 additions and 10 deletions

View file

@ -47,11 +47,11 @@ export const hintSlash = (key: string, protyle: IProtyle) => {
value: Constants.ZWSP + 5,
html: '<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconSparkles"></use></svg><span class="b3-list-item__text">AI Chat</span></div>',
},
// {
// filter: ["属性视图", "shuxingshitu", "sxst", "attribute view"],
// value: '<div data-type="NodeAttributeView" data-av-type="table"></div>',
// html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconDatabase"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.attributeView}</span></div>`,
// },
{
filter: ["属性视图", "shuxingshitu", "sxst", "attribute view"],
value: '<div data-type="NodeAttributeView" data-av-type="table"></div>',
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconDatabase"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.attributeView}</span></div>`,
},
{
filter: ["文档", "子文档", "wendang", "wd", "ziwendang", "zwd", "xjwd"],
value: Constants.ZWSP + 4,

View file

@ -222,3 +222,20 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
const addRow = () => {
}
const addCol = () => {
}
const removeRow = () => {
}
const removeCol = () => {
}
const updateCel = () => {
}

View file

@ -2,10 +2,7 @@ import {transaction} from "../../wysiwyg/transaction";
import {hasClosestBlock} from "../../util/hasClosest";
export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => {
const index = parseInt(cellElement.getAttribute("data-index"))
const tableElement = cellElement.parentElement.parentElement
const colCellElement = tableElement.firstElementChild.children[index + 1];
const type = colCellElement.getAttribute("data-dtype") as TAVCol;
const type = cellElement.parentElement.parentElement.firstElementChild.children[parseInt(cellElement.getAttribute("data-index")) + 1].getAttribute("data-dtype") as TAVCol;
const cellRect = cellElement.getBoundingClientRect()
let html = ""
if (type === "block") {

View file

@ -29,14 +29,16 @@ export const avRender = (element: Element) => {
const data = response.data.av;
// header
let tableHTML = '<div class="av__row av__row--header"><div class="av__firstcol"><svg style="height: 42px"><use xlink:href="#iconUncheck"></use></svg></div>';
let index = 0
data.columns.forEach((column: IAVColumn) => {
if (column.hidden) {
return;
}
tableHTML += `<div class="av__cell" data-id="${column.id}" data-dtype="${column.type}" data-wrap="${column.wrap}" style="width: ${column.width || 200}px;">
tableHTML += `<div class="av__cell" data-index="${index}" data-id="${column.id}" data-dtype="${column.type}" data-wrap="${column.wrap}" style="width: ${column.width || 200}px;">
<svg><use xlink:href="#${column.icon || getIconByType(column.type)}"></use></svg>
<span>${column.name}</span>
</div>`;
index++;
});
tableHTML += `<div class="block__icons">
<div class="block__icon block__icon--show" data-type="av-header-add"><svg><use xlink:href="#iconAdd"></use></svg></div>