Skip to content

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

:lipstick: hint

Vanessaa29b31067a06
diff --git a/app/src/assets/scss/component/_menu.scss b/app/src/assets/scss/component/_menu.scss
index 8bc163a0c7..adfab498de 100644
--- a/app/src/assets/scss/component/_menu.scss
+++ b/app/src/assets/scss/component/_menu.scss
@@ -4,7 +4,7 @@
box-shadow: var(--b3-dialog-shadow);
border: 1px solid var(--b3-theme-surface-lighter);
background-color: var(--b3-menu-background);
- padding: 12px 0;
+ padding: 8px 0;
z-index: 210;
box-sizing: border-box;
diff --git a/app/src/assets/scss/protyle/_toolbar.scss b/app/src/assets/scss/protyle/_toolbar.scss
index 05db19b6d5..a1ebcb60d2 100644
--- a/app/src/assets/scss/protyle/_toolbar.scss
+++ b/app/src/assets/scss/protyle/_toolbar.scss
@@ -56,6 +56,8 @@
max-height: 402px;
box-sizing: border-box;
padding: 8px 0;
+ display: flex;
+ flex-direction: column;
}
&-util {
@@ -64,7 +66,7 @@
box-shadow: var(--b3-dialog-shadow);
border: 1px solid var(--b3-theme-surface-lighter);
background-color: var(--b3-menu-background);
- padding: 8px;
+ padding: 8px 0;
max-height: 80vh;
z-index: 4;
box-sizing: border-box;
diff --git a/app/src/protyle/header/Background.ts b/app/src/protyle/header/Background.ts
index ace7f0bb2a..cc0b39bdc0 100644
--- a/app/src/protyle/header/Background.ts
+++ b/app/src/protyle/header/Background.ts
@@ -438,7 +438,7 @@ export class Background {
html += `<div class="b3-list-item${index === 0 ? " b3-list-item--focus" : ""}">${item}</div>`;
});
window.siyuan.menus.menu.remove();
- window.siyuan.menus.menu.element.lastElementChild.innerHTML = `<div class="fn__flex-column" style="max-height:50vh"><input style="margin: 4px 8px 8px 8px" class="b3-text-field"/>
+ window.siyuan.menus.menu.element.lastElementChild.innerHTML = `<div class="fn__flex-column" style="max-height:50vh;margin: 0 -8px"><input style="margin: 0px 8px 4px 8px" class="b3-text-field"/>
<div class="b3-list fn__flex-1 b3-list--background" style="position: relative">${html}</div>
</div>`;
diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts
index 73d4de31d5..a979557ffd 100644
--- a/app/src/protyle/hint/index.ts
+++ b/app/src/protyle/hint/index.ts
@@ -239,13 +239,9 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
}
private getHTMLByData(data: IHintData[], hasSearch = false) {
- let hintsHTML = "";
+ let hintsHTML = '<div style="flex: 1;overflow:auto;">';
if (hasSearch) {
- hintsHTML = '<input style="margin: 0 4px 4px 4px" class="b3-text-field"><div style="flex: 1;overflow:auto;">';
- this.element.style.display = "flex";
- this.element.style.flexDirection = "column";
- } else {
- this.element.style.display = "";
+ hintsHTML = '<input style="margin:0 8px 4px 8px" class="b3-text-field"><div style="flex: 1;overflow:auto;">';
}
data.forEach((hintData, i) => {
// https://github.com/siyuan-note/siyuan/issues/1229 提示时,新建文件不应默认选中
@@ -260,10 +256,7 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
hintsHTML += `<button style="width: calc(100% - 16px)" class="b3-list-item b3-list-item--two${focusClass}" data-value="${encodeURIComponent(hintData.value)}">${hintData.html}</button>`;
}
});
- if (hasSearch) {
- hintsHTML = hintsHTML + "</div>";
- }
- return hintsHTML;
+ return `${hintsHTML}</div>`;
}
public genHTML(data: IHintData[], protyle: IProtyle, hide = false, hasSearch = false) {
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts
index c06882f3a2..ab1cd3a0d7 100644
--- a/app/src/protyle/render/av/action.ts
+++ b/app/src/protyle/render/av/action.ts
@@ -8,6 +8,7 @@ import {getColIconByType, showColMenu, updateHeader} from "./col";
import {emitOpenMenu} from "../../../plugin/EventBus";
import {addCol} from "./addCol";
import {openMenuPanel} from "./openMenuPanel";
+import {hintRef} from "../../hint/extend";
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
const blockElement = hasClosestBlock(event.target);
@@ -127,6 +128,14 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
event.stopPropagation();
return true;
}
+
+ const addRowElement = hasClosestByClassName(event.target, "av__row--add");
+ if (addRowElement) {
+ hintRef("", protyle, true);
+ event.preventDefault();
+ event.stopPropagation();
+ return true;
+ }
return false;
};
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 37f283c6f9..d6b52e6d75 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -1146,7 +1146,7 @@ export class Toolbar {
});
this.subElement.style.width = "";
this.subElement.style.padding = "";
- this.subElement.innerHTML = `<div class="fn__flex-column" style="max-height:50vh"><input placeholder="${window.siyuan.languages.search}" style="margin: 4px 8px 8px 8px" class="b3-text-field"/>
+ this.subElement.innerHTML = `<div class="fn__flex-column" style="max-height:50vh"><input placeholder="${window.siyuan.languages.search}" style="margin: 0 8px 4px 8px" class="b3-text-field"/>
<div class="b3-list fn__flex-1 b3-list--background" style="position: relative">${html}</div>
</div>`;
@@ -1271,7 +1271,7 @@ export class Toolbar {
this.subElement.style.padding = "";
this.subElement.innerHTML = `<div style="max-height:50vh" class="fn__flex">
<div class="fn__flex-column" style="${isMobile() ? "width: 100%" : "min-width: 260px;max-width:50vw"}">
- <div class="fn__flex" style="margin: 4px 8px 8px 8px">
+ <div class="fn__flex" style="margin: 0 8px 4px 8px">
<input class="b3-text-field fn__flex-1"/>
<span class="fn__space"></span>
<span data-type="previous" class="block__icon block__icon--show"><svg><use xlink:href="#iconLeft"></use></svg></span>
@@ -1444,7 +1444,7 @@ export class Toolbar {
window.siyuan.menus.menu.remove();
this.subElement.style.width = "";
this.subElement.style.padding = "";
- this.subElement.innerHTML = `<div class="fn__flex-column" style="max-height:50vh"><input style="margin: 4px 8px 8px 8px" class="b3-text-field"/>
+ this.subElement.innerHTML = `<div class="fn__flex-column" style="max-height:50vh"><input style="margin: 0 8px 4px 8px" class="b3-text-field"/>
<div class="b3-list fn__flex-1 b3-list--background" style="position: relative"><img style="margin: 0 auto;display: block;width: 64px;height:64px" src="/stage/loading-pure.svg"></div>
</div>`;
@@ -1511,7 +1511,7 @@ export class Toolbar {
this.subElement.style.padding = "";
this.subElement.innerHTML = `<div style="max-height:50vh" class="fn__flex">
<div class="fn__flex-column" style="${isMobile() ? "width:100%" : "min-width: 260px;max-width:50vw"}">
- <div class="fn__flex" style="margin: 4px 8px 8px 8px">
+ <div class="fn__flex" style="margin: 0 8px 4px 8px">
<input class="b3-text-field fn__flex-1"/>
<span class="fn__space"></span>
<span data-type="previous" class="block__icon block__icon--show"><svg><use xlink:href="#iconLeft"></use></svg></span>