Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:rotating_light:

Vanessa8a4ab0daff15
diff --git a/app/src/menus/navigation.ts b/app/src/menus/navigation.ts
index 01fcce4465..9c8923d7e7 100644
--- a/app/src/menus/navigation.ts
+++ b/app/src/menus/navigation.ts
@@ -472,7 +472,7 @@ export const initFileMenu = (app: App, notebookId: string, pathString: string, l
}).element);
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
}
- openEditorTab(app, id, notebookId, pathString)
+ openEditorTab(app, id, notebookId, pathString);
if (!window.siyuan.config.readonly) {
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.fileHistory,
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts
index 2960ab15b6..10c5e5d99a 100644
--- a/app/src/protyle/render/av/action.ts
+++ b/app/src/protyle/render/av/action.ts
@@ -7,7 +7,7 @@ import {copySubMenu} from "../../../menus/commonMenuItem";
import {popTextCell} from "./cell";
const showHeaderCellMenu = (protyle: IProtyle, blockElement: HTMLElement, cellElement: HTMLElement) => {
- const type = cellElement.getAttribute("data-dtype") as TAVCol
+ const type = cellElement.getAttribute("data-dtype") as TAVCol;
const menu = new Menu("av-header-cell");
menu.addItem({
icon: getIconByType(type),
@@ -67,7 +67,7 @@ const showHeaderCellMenu = (protyle: IProtyle, blockElement: HTMLElement, cellEl
icon: "iconTrashcan",
label: window.siyuan.languages.delete,
click() {
- const id = cellElement.getAttribute("data-id")
+ const id = cellElement.getAttribute("data-id");
transaction(protyle, [{
action: "removeAttrViewCol",
id,
@@ -79,7 +79,7 @@ const showHeaderCellMenu = (protyle: IProtyle, blockElement: HTMLElement, cellEl
type: type,
id
}]);
- removeCol(cellElement)
+ removeCol(cellElement);
}
});
menu.addSeparator();
@@ -123,7 +123,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
id,
parentID: blockElement.getAttribute("data-av-id"),
}]);
- addCol(protyle, blockElement, id, type)
+ addCol(protyle, blockElement, id, type);
}
});
const addRect = addElement.getBoundingClientRect();
@@ -140,11 +140,11 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
const cellElement = hasClosestByClassName(event.target, "av__cell");
if (cellElement && blockElement) {
if (cellElement.parentElement.classList.contains("av__row--header")) {
- showHeaderCellMenu(protyle, blockElement, cellElement)
+ showHeaderCellMenu(protyle, blockElement, cellElement);
event.preventDefault();
event.stopPropagation();
} else {
- popTextCell(protyle, cellElement)
+ popTextCell(protyle, cellElement);
}
return true;
}
@@ -202,22 +202,22 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
click() {
}
- })
- const editAttrSubmenu: IMenu[] = []
+ });
+ const editAttrSubmenu: IMenu[] = [];
rowElement.parentElement.querySelectorAll(".av__row--header .av__cell").forEach((cellElement) => {
editAttrSubmenu.push({
icon: getIconByType(cellElement.getAttribute("data-dtype") as TAVCol),
label: cellElement.textContent.trim(),
click() {
}
- })
+ });
});
menu.addItem({
icon: "iconList",
label: window.siyuan.languages.attr,
type: "submenu",
submenu: editAttrSubmenu
- })
+ });
menu.open({
x: event.clientX,
y: event.clientY,
@@ -225,55 +225,55 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
event.preventDefault();
event.stopPropagation();
return true;
-}
+};
const addCol = (protyle: IProtyle, blockElement: HTMLElement, id: string, type: TAVCol) => {
- let index = "0"
+ let index = "0";
blockElement.querySelectorAll(".av__row--header .av__cell").forEach((item) => {
- const dataIndex = item.getAttribute("data-index")
+ const dataIndex = item.getAttribute("data-index");
if (dataIndex > index) {
- index = dataIndex
+ index = dataIndex;
}
- })
+ });
blockElement.querySelectorAll(".av__row").forEach((item, index) => {
- let html = ''
+ let html = "";
if (index === 0) {
html = `<div class="av__cell" data-index="${index}" data-id="${id}" data-dtype="${type}" data-wrap="false" style="width: 200px;">
<svg><use xlink:href="#iconAlignLeft"></use></svg>
<span>Text</span>
-</div>`
+</div>`;
} else {
- html = `<div class="av__cell" data-index="${index}" style="width: 200px;"></div>`
+ html = `<div class="av__cell" data-index="${index}" style="width: 200px;"></div>`;
}
- item.lastElementChild.insertAdjacentHTML("beforebegin", html)
- })
- showHeaderCellMenu(protyle, blockElement, blockElement.querySelector(".av__row--header").lastElementChild.previousElementSibling as HTMLElement)
-}
+ item.lastElementChild.insertAdjacentHTML("beforebegin", html);
+ });
+ showHeaderCellMenu(protyle, blockElement, blockElement.querySelector(".av__row--header").lastElementChild.previousElementSibling as HTMLElement);
+};
const removeCol = (cellElement: HTMLElement) => {
- const index = cellElement.getAttribute("data-index")
+ const index = cellElement.getAttribute("data-index");
const blockElement = hasClosestBlock(cellElement);
if (!blockElement) {
return false;
}
blockElement.querySelectorAll(".av__row").forEach((item) => {
item.querySelector(`[data-index="${index}"]`).remove;
- })
-}
+ });
+};
export const addAVRow = (blockElement: HTMLElement, ids: string[], previousID: string) => {
- const rowElement = previousID ? blockElement.querySelector(`[data-id=${previousID}]`) : blockElement.querySelector(".av__row--header")
- let html = ''
+ const rowElement = previousID ? blockElement.querySelector(`[data-id=${previousID}]`) : blockElement.querySelector(".av__row--header");
+ let html = "";
ids.forEach((id) => {
- html += `<div class="av__row"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>`;
+ html += "<div class=\"av__row\"><div class=\"av__firstcol\"><svg><use xlink:href=\"#iconUncheck\"></use></svg></div>";
Array.from(rowElement.children).forEach((item: HTMLElement, index) => {
if (index === 0 || index === rowElement.childElementCount - 1) {
- return
+ return;
}
html += `<div class="av__cell" data-index="${index}" style="width: ${item.style.width};>${id}</div>`;
- })
+ });
html += "<div></div></div>";
- })
+ });
rowElement.insertAdjacentHTML("afterend", html);
-}
+};
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index 45dce8b7a4..7259eebadc 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -3,8 +3,8 @@ import {hasClosestBlock} from "../../util/hasClosest";
export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => {
const type = cellElement.parentElement.parentElement.firstElementChild.children[parseInt(cellElement.getAttribute("data-index")) + 1].getAttribute("data-dtype") as TAVCol;
- const cellRect = cellElement.getBoundingClientRect()
- let html = ""
+ const cellRect = cellElement.getBoundingClientRect();
+ let html = "";
if (type === "block") {
html = `<textarea style="position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px" class="b3-text-field fn__size200">${cellElement.textContent}</textarea>`;
}
@@ -16,33 +16,33 @@ export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => {
if (inputElement) {
inputElement.select();
inputElement.addEventListener("blur", () => {
- updateCellValue(protyle, cellElement, type)
- })
+ updateCellValue(protyle, cellElement, type);
+ });
inputElement.addEventListener("keydown", (event) => {
if (event.isComposing) {
- return
+ return;
}
if (event.key === "Escape" || event.key === "Enter") {
- updateCellValue(protyle, cellElement, type)
+ updateCellValue(protyle, cellElement, type);
event.preventDefault();
event.stopPropagation();
}
- })
+ });
}
avMaskElement.addEventListener("click", (event) => {
if ((event.target as HTMLElement).classList.contains("av__mask")) {
avMaskElement?.remove();
}
- })
+ });
};
const updateCellValue = (protyle: IProtyle, cellElement: HTMLElement, type: TAVCol) => {
const avMaskElement = document.querySelector(".av__mask");
const inputElement = avMaskElement.querySelector(".b3-text-field") as HTMLInputElement;
- const blockElement = hasClosestBlock(cellElement)
+ const blockElement = hasClosestBlock(cellElement);
if (!blockElement) {
- return
+ return;
}
transaction(protyle, [{
action: "updateAttrViewCell",
@@ -60,5 +60,5 @@ const updateCellValue = (protyle: IProtyle, cellElement: HTMLElement, type: TAVC
cellElement.textContent = inputElement.value;
setTimeout(() => {
avMaskElement.remove();
- })
-}
+ });
+};
diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts
index 6aa1973e77..fe71dd1c67 100644
--- a/app/src/protyle/render/av/render.ts
+++ b/app/src/protyle/render/av/render.ts
@@ -29,7 +29,7 @@ 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
+ let index = 0;
data.columns.forEach((column: IAVColumn) => {
if (column.hidden) {
return;
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index 83dbb0509f..3ed964e757 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -814,7 +814,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
id: targetElement.getAttribute("data-node-id"),
parentID: targetElement.getAttribute("data-av-id"),
}]);
- addAVRow(blockElement, sourceIds, previousID)
+ addAVRow(blockElement, sourceIds, previousID);
}
return;
}