An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/17800
Vanessa9e36ce56158d
diff --git a/app/src/assets/scss/business/_block.scss b/app/src/assets/scss/business/_block.scssindex 63d5fa5dce..98070a76cf 100644--- a/app/src/assets/scss/business/_block.scss+++ b/app/src/assets/scss/business/_block.scss@@ -56,7 +56,7 @@flex-shrink: 0;&--menu {- background-color: var(--b3-menu-background);+ background-color: var(--b3-theme-surface);}&:hover .block__icon:not([disabled]) {diff --git a/app/src/protyle/render/av/gallery/render.ts b/app/src/protyle/render/av/gallery/render.tsindex c873471289..9b090ba206 100644--- a/app/src/protyle/render/av/gallery/render.ts+++ b/app/src/protyle/render/av/gallery/render.ts@@ -1,4 +1,4 @@-import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "../../../util/hasClosest";+import {hasClosestBlock, hasClosestByClassName} from "../../../util/hasClosest";import {Constants} from "../../../../constants";import {fetchSyncPost} from "../../../../util/fetch";import {focusBlock} from "../../../util/selection";@@ -78,7 +78,7 @@ const renderGroupGallery = (options: ITableOptions) => {});if (options.renderAll) {options.blockElement.firstElementChild.outerHTML = `<div class="av__container fn__block">- ${genTabHeaderHTML(options.data, isSearching || !!query, !options.protyle.disabled && !hasClosestByAttribute(options.blockElement, "data-type", "NodeBlockQueryEmbed"))}+ ${genTabHeaderHTML(options.data, isSearching || !!query, !options.protyle.disabled)}<div>${avBodyHTML}</div>@@ -264,7 +264,7 @@ export const renderGallery = async (options: {const bodyHTML = getGalleryHTML(view, options.blockElement, virtualData.all);if (options.renderAll) {options.blockElement.firstElementChild.outerHTML = `<div class="av__container fn__block">- ${genTabHeaderHTML(data, resetData.isSearching || !!resetData.query, !options.protyle.disabled && !hasClosestByAttribute(options.blockElement, "data-type", "NodeBlockQueryEmbed"))}+ ${genTabHeaderHTML(data, resetData.isSearching || !!resetData.query, !options.protyle.disabled)}<div><div class="av__body" data-group-id="" data-page-size="${view.pageSize}">${bodyHTML}diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.tsindex e7f43b0d6b..b8c6384e36 100644--- a/app/src/protyle/render/av/render.ts+++ b/app/src/protyle/render/av/render.ts@@ -4,7 +4,7 @@ import {Constants} from "../../../constants";import {addDragFill, cellScrollIntoView, popTextCell} from "./cell";import {unicode2Emoji} from "../../../emoji";import {focusBlock} from "../../util/selection";-import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "../../util/hasClosest";+import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";import {getRowHTML, stickyRow, updateHeader} from "./row";import {getCalcValue} from "./calc";import {renderAVAttribute} from "./blockAttr";@@ -264,7 +264,7 @@ const renderGroupTable = (options: ITableOptions) => {});if (options.renderAll) {options.blockElement.firstElementChild.outerHTML = `<div class="av__container">- ${genTabHeaderHTML(options.data, isSearching || !!query, !options.protyle.disabled && !hasClosestByAttribute(options.blockElement, "data-type", "NodeBlockQueryEmbed"))}+ ${genTabHeaderHTML(options.data, isSearching || !!query, !options.protyle.disabled)}<div class="av__scroll">${avBodyHTML}</div>@@ -544,7 +544,7 @@ export const avRender = async (element: Element, protyle: IProtyle, cb?: (data:</div>`;if (renderAll) {e.firstElementChild.outerHTML = `<div class="av__container">- ${genTabHeaderHTML(data, resetData.isSearching || !!resetData.query, !protyle.disabled && !hasClosestByAttribute(e, "data-type", "NodeBlockQueryEmbed"))}+ ${genTabHeaderHTML(data, resetData.isSearching || !!resetData.query, !protyle.disabled)}<div class="av__scroll">${avBodyHTML}</div>diff --git a/app/src/protyle/render/blockRender.ts b/app/src/protyle/render/blockRender.tsindex d506c632cb..df32814cc6 100644--- a/app/src/protyle/render/blockRender.ts+++ b/app/src/protyle/render/blockRender.ts@@ -110,7 +110,7 @@ const renderEmbed = (blocks: {}let popover = "";if (index !== 0) {- popover = `<div class="protyle-icons"><span data-id="${blocksItem.block.id}" aria-label="${window.siyuan.languages.refPopover}" data-position="4north" class="popover__block ariaLabel protyle-icon protyle-icon--last protyle-icon--first"><svg><use xlink:href="#iconPictureInPicture"></use></svg></span></div>`;+ popover = `<div class="protyle-icons"><span data-id="${blocksItem.block.id}" data-action="openFloat" aria-label="${window.siyuan.languages.refPopover}" data-position="4north" class="ariaLabel protyle-icon protyle-icon--last protyle-icon--first"><svg><use xlink:href="#iconPictureInPicture"></use></svg></span></div>`;} else {const popoverElement = item.querySelectorAll(".protyle-icon")[2];if (popoverElement) {diff --git a/app/src/protyle/render/util.ts b/app/src/protyle/render/util.tsindex db14806c84..6a5c505d82 100644--- a/app/src/protyle/render/util.ts+++ b/app/src/protyle/render/util.ts@@ -35,7 +35,7 @@ export const genRenderFrame = (renderElement: Element) => {renderElement.insertAdjacentHTML("afterbegin", `<div class="protyle-icons${isInEmbedBlock(renderElement) ? " fn__none" : ""}"><span aria-label="${window.siyuan.languages.refresh}" data-position="4north" class="ariaLabel protyle-icon protyle-action__reload protyle-icon--first"><svg class="fn__rotate"><use xlink:href="#iconRefresh"></use></svg></span><span aria-label="${window.siyuan.languages.update} SQL" data-position="4north" class="ariaLabel protyle-icon protyle-action__edit"><svg><use xlink:href="#iconEdit"></use></svg></span>- <span aria-label="${window.siyuan.languages.refPopover}" data-position="4north" class="popover__block ariaLabel protyle-icon"><svg><use xlink:href="#iconPictureInPicture"></use></svg></span>+ <span aria-label="${window.siyuan.languages.refPopover}" data-position="4north" data-action="openFloat" class="ariaLabel protyle-icon"><svg><use xlink:href="#iconPictureInPicture"></use></svg></span><span aria-label="${window.siyuan.languages.more}" data-position="4north" class="ariaLabel protyle-icon protyle-action__menu protyle-icon--last"><svg><use xlink:href="#iconMore"></use></svg></span></div><div class="protyle-cursor">${Constants.ZWSP}</div>`);} else if (type === "NodeMathBlock" || renderElement.getAttribute("data-subtype") === "math") {diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex f73788a7d8..292f5ac40d 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -105,6 +105,7 @@ import {reloadProtyle} from "../util/reload";import {updateCalloutType} from "./callout";import {nbsp2space, removeZWJ} from "../util/normalizeText";import {setFold} from "../util/blockFold";+import {BlockPanel} from "../../block/Panel";export class WYSIWYG {public lastHTMLs: { [key: string]: string } = {};@@ -824,7 +825,7 @@ export class WYSIWYG {// 为所有子块创建右上角百分比提示const sbChildren = Array.from(sbElement.querySelectorAll(":scope > [data-node-id]")) as HTMLElement[];const gapHalve = gapPx / 2 + 1;- const tips: {el: HTMLElement, child: HTMLElement}[] = [];+ const tips: { el: HTMLElement, child: HTMLElement }[] = [];sbChildren.forEach(child => {child.style.position = "relative";const tip = document.createElement("span");@@ -3223,6 +3224,24 @@ export class WYSIWYG {return;}+ const openFloatElement = hasClosestByAttribute(event.target, "data-action", "openFloat");+ if (openFloatElement) {+ const id = openFloatElement.getAttribute("data-id");+ /// #if MOBILE+ openMobileFileById(protyle.app, id, [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);+ /// #else+ window.siyuan.blockPanels.push(new BlockPanel({+ app: protyle.app,+ isBacklink: false,+ targetElement: openFloatElement,+ refDefs: [{refID: id}]+ }));+ /// #endif+ event.stopPropagation();+ event.preventDefault();+ return;+ }+const menuElement = hasClosestByClassName(event.target, "protyle-action__menu");if (menuElement) {protyle.gutter.renderMenu(protyle, menuElement.parentElement.parentElement);