diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts index 61f3e3f43..d84666e02 100644 --- a/app/src/protyle/render/av/action.ts +++ b/app/src/protyle/render/av/action.ts @@ -275,43 +275,43 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi } }); } - menu.addItem({ - label: window.siyuan.languages.addToDatabase, - icon: "iconDatabase", - click() { - openSearchAV(blockElement.getAttribute("data-av-id"), rowElements[0] as HTMLElement, (listItemElement) => { - const srcs: IOperationSrcs[] = []; - const sourceIds: string[] = []; - rowElements.forEach(item => { - const rowId = item.getAttribute("data-id"); - const blockValue = genCellValueByElement("block", item.querySelector(".av__cell[data-block-id]")); - srcs.push({ - content: blockValue.block.content, - id: rowId, - isDetached: blockValue.isDetached, - }); - sourceIds.push(rowId); - }); - const avID = listItemElement.dataset.avId; - transaction(protyle, [{ - action: "insertAttrViewBlock", - avID, - ignoreFillFilter: true, - srcs, - blockID: listItemElement.dataset.blockId - }, { - action: "doUpdateUpdated", - id: listItemElement.dataset.blockId, - data: dayjs().format("YYYYMMDDHHmmss"), - }], [{ - action: "removeAttrViewBlock", - srcIDs: sourceIds, - avID, - }]); - }); - } - }); if (!protyle.disabled) { + menu.addItem({ + label: window.siyuan.languages.addToDatabase, + icon: "iconDatabase", + click() { + openSearchAV(blockElement.getAttribute("data-av-id"), rowElements[0] as HTMLElement, (listItemElement) => { + const srcs: IOperationSrcs[] = []; + const sourceIds: string[] = []; + rowElements.forEach(item => { + const rowId = item.getAttribute("data-id"); + const blockValue = genCellValueByElement("block", item.querySelector(".av__cell[data-block-id]")); + srcs.push({ + content: blockValue.block.content, + id: rowId, + isDetached: blockValue.isDetached, + }); + sourceIds.push(rowId); + }); + const avID = listItemElement.dataset.avId; + transaction(protyle, [{ + action: "insertAttrViewBlock", + avID, + ignoreFillFilter: true, + srcs, + blockID: listItemElement.dataset.blockId + }, { + action: "doUpdateUpdated", + id: listItemElement.dataset.blockId, + data: dayjs().format("YYYYMMDDHHmmss"), + }], [{ + action: "removeAttrViewBlock", + srcIDs: sourceIds, + avID, + }]); + }); + } + }); if (rowElements.length === 1) { if (keyCellElement.getAttribute("data-detached") !== "true") { menu.addSeparator(); diff --git a/app/src/protyle/render/av/row.ts b/app/src/protyle/render/av/row.ts index 4107b1f64..aabccabf0 100644 --- a/app/src/protyle/render/av/row.ts +++ b/app/src/protyle/render/av/row.ts @@ -108,9 +108,16 @@ export const insertAttrViewBlockAnimation = (protyle: IProtyle, blockElement: El colHTML = '
'; } previousElement.querySelectorAll(".av__cell").forEach((item: HTMLElement, index) => { + let lineNumber = "" + if (getTypeByCellElement(item) === "lineNumber") { + const lineNumberValue = item.querySelector(".av__celltext")?.getAttribute("data-value") + if (lineNumberValue) { + lineNumber = (parseInt(lineNumberValue) + 1).toString(); + } + } colHTML += `
`; +${getTypeByCellElement(item) === "block" ? ' data-detached="true"' : ""}>${lineNumber}
`; if (pinIndex === index) { colHTML += ""; } @@ -160,7 +167,54 @@ ${getTypeByCellElement(item) === "block" ? ' data-detached="true"' : ""}>