Skip to content

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

:art: Block icons support quickly inserting blocks above or below https://github.com/siyuan-note/siyuan/issues/17900

Daniele9a6b20a8cd7
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 915f11a28e..d1557d5642 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -225,6 +225,24 @@ export class Gutter {
event.stopPropagation();
hideTooltip();
clearSelect(["cell", "img"], protyle.wysiwyg.element);
+ // 框线点击:若鼠标在块标范围内(框线::before 截获了块标点击),转发为块标菜单;否则无操作
+ if (buttonElement.classList.contains("protyle-gutters__line")) {
+ if (activeBlockButton && !protyle.disabled) {
+ const br = activeBlockButton.getBoundingClientRect();
+ if (event.clientX >= br.left && event.clientX <= br.right &&
+ event.clientY >= br.top && event.clientY <= br.bottom) {
+ this.renderMenu(protyle, activeBlockButton as HTMLElement);
+ if (!protyle.toolbar.range) {
+ protyle.toolbar.range = getEditorRange(protyle.wysiwyg.element.querySelector(`[data-node-id="${activeBlockButton.getAttribute("data-node-id")}"]`) || protyle.wysiwyg.element.firstElementChild);
+ }
+ /// #if !MOBILE
+ window.siyuan.menus.menu.popup({x: br.left, y: br.bottom, isLeft: true});
+ focusByRange(protyle.toolbar.range);
+ /// #endif
+ }
+ }
+ return;
+ }
const id = buttonElement.getAttribute("data-node-id");
if (!id) {
if (buttonElement.getAttribute("disabled")) {