This commit is contained in:
Vanessa 2022-10-06 21:08:32 +08:00
parent ae960beb47
commit 085b4a5ec4
2 changed files with 14 additions and 14 deletions

View File

@ -180,12 +180,12 @@ export const progressStatus = (data: IWebSocketData) => {
statusElement.innerHTML = data.msg;
statusElement.classList.remove("status--hide");
if (document.querySelector("keyboardToolbar").classList.contains("fn__none")) {
statusElement.style.bottom = "0"
statusElement.style.bottom = "0";
} else {
statusElement.style.bottom = "30px"
statusElement.style.bottom = "30px";
}
progressStatusTimeoutId = window.setTimeout(() => {
statusElement.style.bottom = ""
statusElement.style.bottom = "";
}, 6000);
return;
}

View File

@ -6,34 +6,34 @@ export const showKeyboardToolbar = (bottom = 0) => {
const toolbarElement = document.getElementById("keyboardToolbar");
toolbarElement.classList.remove("fn__none");
toolbarElement.style.bottom = bottom + "px";
}
};
export const hideKeyboardToolbar = () => {
const toolbarElement = document.getElementById("keyboardToolbar");
toolbarElement.classList.add("fn__none");
}
};
export const initKeyboardToolbar = () => {
const toolbarElement = document.getElementById("keyboardToolbar");
toolbarElement.addEventListener(getEventName(), (event) => {
const target = event.target as HTMLElement
const buttonElement = hasClosestByMatchTag(target, "BUTTON")
const target = event.target as HTMLElement;
const buttonElement = hasClosestByMatchTag(target, "BUTTON");
if (!buttonElement || !window.siyuan.mobileEditor) {
return;
}
const type = buttonElement.getAttribute("data-type");
const protyle = window.siyuan.mobileEditor.protyle
const protyle = window.siyuan.mobileEditor.protyle;
if (type === "undo") {
protyle.undo.undo(protyle)
protyle.undo.undo(protyle);
return;
}
if (type === "redo") {
protyle.undo.redo(protyle)
protyle.undo.redo(protyle);
return;
}
let range: Range
let range: Range;
if (getSelection().rangeCount > 0) {
range = getSelection().getRangeAt(0)
range = getSelection().getRangeAt(0);
}
if (!range) {
return;
@ -50,5 +50,5 @@ export const initKeyboardToolbar = () => {
} else if (type === "indent") {
listIndent(protyle, [nodeElement.parentElement], range);
}
})
}
});
};