💄 hint

This commit is contained in:
Vanessa 2023-07-28 17:33:35 +08:00
parent 9ee922794e
commit a29b31067a
6 changed files with 21 additions and 17 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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>`;

View file

@ -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) {

View file

@ -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;
};

View file

@ -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>