📱 键盘收起

This commit is contained in:
Vanessa 2022-10-06 22:45:30 +08:00
parent fbf1b632ee
commit 2c0d2ed934
2 changed files with 8 additions and 2 deletions

View file

@ -257,6 +257,7 @@
background: var(--b3-theme-background);
z-index: 221;
display: flex;
border-top: 1px solid var(--b3-border-color);
button {
background: transparent;

View file

@ -19,12 +19,17 @@ export const hideKeyboardToolbar = () => {
export const initKeyboardToolbar = () => {
const toolbarElement = document.getElementById("keyboardToolbar");
toolbarElement.addEventListener(getEventName(), (event) => {
toolbarElement.addEventListener("click", (event) => {
const target = event.target as HTMLElement;
const buttonElement = hasClosestByMatchTag(target, "BUTTON");
if (!buttonElement || !window.siyuan.mobileEditor) {
return;
}
if (window.siyuan.mobileEditor.protyle.disabled) {
return;
}
event.preventDefault();
event.stopPropagation();
const type = buttonElement.getAttribute("data-type");
const protyle = window.siyuan.mobileEditor.protyle;
if (type === "undo") {
@ -75,8 +80,8 @@ export const initKeyboardToolbar = () => {
range.collapse(false);
range.insertNode(document.createTextNode(Constants.ZWSP));
range.collapse(false);
focusByRange(range);
}
focusByRange(range);
return;
}