An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:rotating_light:
Vanessa5f44965ef364
diff --git a/app/src/card/openCard.ts b/app/src/card/openCard.tsindex bbbedbafd0..264cf32a43 100644--- a/app/src/card/openCard.ts+++ b/app/src/card/openCard.ts@@ -485,10 +485,10 @@ export const openCardByData = async (app: App, cardsData: ICardData, cardType: Tdialog});dialog.editor = editor;- const focusElement = dialog.element.querySelector('.b3-button[data-type="-1"]') as HTMLButtonElement+ const focusElement = dialog.element.querySelector('.b3-button[data-type="-1"]') as HTMLButtonElement;focusElement.focus();- const range = document.createRange()- range.selectNodeContents(focusElement)+ const range = document.createRange();+ range.selectNodeContents(focusElement);focusByRange(range);};diff --git a/app/src/history/diff.ts b/app/src/history/diff.tsindex 82e6a51b03..5f229ec6ba 100644--- a/app/src/history/diff.ts+++ b/app/src/history/diff.ts@@ -161,7 +161,7 @@ export const showDiff = (app: App, data: { id: string, time: string }[]) => {rightEditor = undefined;}});- dialog.element.setAttribute("data-key", Constants.DIALOG_HISTORYCOMPARE)+ dialog.element.setAttribute("data-key", Constants.DIALOG_HISTORYCOMPARE);dialog.element.addEventListener("click", (event) => {if (typeof event.detail === "string") {renderCompare(app, dialog.element.querySelector(".history__diff .b3-list-item--focus"));diff --git a/app/src/history/keydown.ts b/app/src/history/keydown.tsindex 53d0120f9d..5d9d374751 100644--- a/app/src/history/keydown.ts+++ b/app/src/history/keydown.ts@@ -1,8 +1,8 @@import {Dialog} from "../dialog";export const historyKeydown = (event: KeyboardEvent, dialog: Dialog) => {- let currentItem = dialog.element.querySelector(".history__diff .b3-list-item--focus")- const items = Array.from(dialog.element.querySelectorAll(".history__diff .b3-list-item[data-id]"))+ let currentItem = dialog.element.querySelector(".history__diff .b3-list-item--focus");+ const items = Array.from(dialog.element.querySelectorAll(".history__diff .b3-list-item[data-id]"));if (items.length < 2) {return;}@@ -11,9 +11,9 @@ export const historyKeydown = (event: KeyboardEvent, dialog: Dialog) => {} else {currentItem.classList.remove("b3-list-item--focus");if (event.key === "Home") {- currentItem = items[0]+ currentItem = items[0];} else if (event.key === "End") {- currentItem = items[items.length - 1]+ currentItem = items[items.length - 1];} else {items.find((item, index) => {if (item.isSameNode(currentItem)) {@@ -32,7 +32,7 @@ export const historyKeydown = (event: KeyboardEvent, dialog: Dialog) => {}return true;}- })+ });}}currentItem.classList.add("b3-list-item--focus");@@ -44,9 +44,9 @@ export const historyKeydown = (event: KeyboardEvent, dialog: Dialog) => {const historyDiffElement = dialog.element.querySelector(".history__diff");const historyDiffRect = historyDiffElement.getBoundingClientRect();if (currentItemRect.bottom > historyDiffRect.bottom) {- currentItem.scrollIntoView(false)+ currentItem.scrollIntoView(false);} else if (currentItemRect.top < historyDiffRect.top) {- currentItem.scrollIntoView()+ currentItem.scrollIntoView();}dialog.element.dispatchEvent(new CustomEvent("click", {detail: event.key.toLowerCase()}));-}+};diff --git a/app/src/layout/util.ts b/app/src/layout/util.tsindex 764bc35468..ee6ad3fb23 100644--- a/app/src/layout/util.ts+++ b/app/src/layout/util.ts@@ -875,7 +875,7 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout.item.element.style.minWidth = "";}});- let lastItem: HTMLElement+ let lastItem: HTMLElement;while (layout.element.scrollWidth > layout.element.clientWidth) {layout.children.find((item: Layout | Wnd) => {if (item.element.style.width && item.element.style.width !== "0px") {diff --git a/app/src/mobile/settings/account.ts b/app/src/mobile/settings/account.tsindex 928725ef14..8ec9b45900 100644--- a/app/src/mobile/settings/account.ts+++ b/app/src/mobile/settings/account.ts@@ -20,7 +20,7 @@ export const showAccountInfo = () => {});userTitlesHTML += "</div>";}- let subscriptionHTML = ""+ let subscriptionHTML = "";if (window.siyuan.user.userSiYuanProExpireTime === -1) {// 终身会员subscriptionHTML = `<div class="b3-chip b3-chip--secondary">${Constants.SIYUAN_IMAGE_VIP}${window.siyuan.languages.account12}</div>`;diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.tsindex 7c5b61c9dd..014172ad7d 100644--- a/app/src/protyle/index.ts+++ b/app/src/protyle/index.ts@@ -58,7 +58,7 @@ export class Protyle {if (item.protyleOptions) {pluginsOptions = merge(pluginsOptions, item.protyleOptions);}- })+ });const getOptions = new Options(pluginsOptions);const mergedOptions = getOptions.merge();this.protyle = {diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.tsindex 0d07cdb531..646a576500 100644--- a/app/src/protyle/render/av/asset.ts+++ b/app/src/protyle/render/av/asset.ts@@ -103,12 +103,12 @@ export const updateAssetCell = (options: {const colId = options.cellElements[0].dataset.colId;const cellDoOperations: IOperation[] = [];const cellUndoOperations: IOperation[] = [];- let mAssetValue: IAVCellAssetValue[]+ let mAssetValue: IAVCellAssetValue[];options.cellElements.forEach((item, elementIndex) => {if (!options.blockElement.contains(item)) {const rowElement = hasClosestByClassName(item, "av__row");if (rowElement) {- item = options.cellElements[elementIndex] = options.blockElement.querySelector(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell[data-col-id="${item.dataset.colId}"]`) as HTMLElement+ item = options.cellElements[elementIndex] = options.blockElement.querySelector(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell[data-col-id="${item.dataset.colId}"]`) as HTMLElement;}}const cellValue = genCellValueByElement(getTypeByCellElement(item) || item.dataset.type as TAVCol, item);@@ -144,9 +144,9 @@ export const updateAssetCell = (options: {} else {cellValue.mAsset = options.replaceValue;}- mAssetValue = cellValue.mAsset+ mAssetValue = cellValue.mAsset;} else {- cellValue.mAsset = mAssetValue+ cellValue.mAsset = mAssetValue;}cellDoOperations.push({action: "updateAttrViewCell",diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.tsindex e5877ebc79..e30fcd9ad9 100644--- a/app/src/protyle/render/av/cell.ts+++ b/app/src/protyle/render/av/cell.ts@@ -209,7 +209,7 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellElement: ElemecontentElement.scrollTop = contentElement.scrollTop + cellRect.top - avHeaderRect.bottom;}} else {- const footerElement = blockElement.querySelector(".av__row--footer")+ const footerElement = blockElement.querySelector(".av__row--footer");if (footerElement.querySelector(".av__calc--ashow")) {const avFooterRect = footerElement.getBoundingClientRect();if (avFooterRect.top < cellRect.bottom) {@@ -557,7 +557,7 @@ export const renderCell = (cellValue: IAVCellValue, wrap: boolean) => {} else if (cellValue.type === "checkbox") {text += `<svg class="av__checkbox"><use xlink:href="#icon${cellValue?.checkbox?.checked ? "Check" : "Uncheck"}"></use></svg>`;} else if (cellValue.type === "rollup") {- cellValue?.rollup?.contents?.forEach((item, index) => {+ cellValue?.rollup?.contents?.forEach((item) => {const rollupText = ["select", "mSelect", "mAsset", "checkbox", "relation"].includes(item.type) ? renderCell(item, wrap) : renderRollup(item);if (rollupText) {text += rollupText + ", ";diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.tsindex f96a4bc404..a61cd9a76b 100644--- a/app/src/protyle/render/av/render.ts+++ b/app/src/protyle/render/av/render.ts@@ -1,7 +1,7 @@import {fetchPost} from "../../../util/fetch";import {getColIconByType} from "./col";import {Constants} from "../../../constants";-import {popTextCell, renderCell} from "./cell";+import {renderCell} from "./cell";import {unicode2Emoji} from "../../../emoji";import {focusBlock} from "../../util/selection";import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";@@ -264,7 +264,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, data.columconst refreshTimeouts: {[key: string]: number;} = {};-export const refreshAV = (protyle: IProtyle, operation: IOperation, isUndo: boolean) => {+export const refreshAV = (protyle: IProtyle, operation: IOperation) => {if (operation.action === "setAttrViewName") {Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.id}"]`)).forEach((item: HTMLElement) => {const titleElement = item.querySelector(".av__title") as HTMLElement;diff --git a/app/src/protyle/render/av/row.ts b/app/src/protyle/render/av/row.tsindex 48bed10cbe..24d69246bc 100644--- a/app/src/protyle/render/av/row.ts+++ b/app/src/protyle/render/av/row.ts@@ -108,14 +108,14 @@ export const insertAttrViewBlockAnimation = (protyle: IProtyle, blockElement: Elconst sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`).innerHTML =renderCell(genCellValueByElement(getTypeByCellElement(sideRowCellElement), sideRowCellElement), sideRowCellElement.dataset.wrap === "true");- })+ });response.data.sorts.forEach((item: IAVSort) => {const sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`).innerHTML =renderCell(genCellValueByElement(getTypeByCellElement(sideRowCellElement), sideRowCellElement), sideRowCellElement.dataset.wrap === "true");- })+ });popTextCell(protyle, [currentRow.querySelector('.av__cell[data-detached="true"]')], "block");- })+ });} else {popTextCell(protyle, [currentRow.querySelector('.av__cell[data-detached="true"]')], "block");}diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex f3092aa89d..7771a57d57 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -1294,7 +1294,7 @@ export class Toolbar {</div>`;const listElement = this.subElement.querySelector(".b3-list");const previewElement = this.subElement.firstElementChild.lastElementChild;- let previewPath: string+ let previewPath: string;listElement.addEventListener("mouseover", (event) => {const target = event.target as HTMLElement;const hoverItemElement = hasClosestByClassName(target, "b3-list-item");diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex 37b2f9f76f..fe43f5fb77 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -725,7 +725,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:"replaceAttrViewBlock", "updateAttrViewColTemplate", "setAttrViewColPin", "addAttrViewView","removeAttrViewView", "setAttrViewViewName", "setAttrViewViewIcon", "duplicateAttrViewView", "sortAttrViewView","updateAttrViewColRelation", "setAttrViewPageSize", "updateAttrViewColRollup"].includes(operation.action)) {- refreshAV(protyle, operation, isUndo);+ refreshAV(protyle, operation);} else if (operation.action === "doUpdateUpdated") {updateElements.forEach(item => {item.setAttribute("updated", operation.data);