mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-17 09:30:48 +08:00
🚨
This commit is contained in:
parent
ae960beb47
commit
085b4a5ec4
@ -180,12 +180,12 @@ export const progressStatus = (data: IWebSocketData) => {
|
|||||||
statusElement.innerHTML = data.msg;
|
statusElement.innerHTML = data.msg;
|
||||||
statusElement.classList.remove("status--hide");
|
statusElement.classList.remove("status--hide");
|
||||||
if (document.querySelector("keyboardToolbar").classList.contains("fn__none")) {
|
if (document.querySelector("keyboardToolbar").classList.contains("fn__none")) {
|
||||||
statusElement.style.bottom = "0"
|
statusElement.style.bottom = "0";
|
||||||
} else {
|
} else {
|
||||||
statusElement.style.bottom = "30px"
|
statusElement.style.bottom = "30px";
|
||||||
}
|
}
|
||||||
progressStatusTimeoutId = window.setTimeout(() => {
|
progressStatusTimeoutId = window.setTimeout(() => {
|
||||||
statusElement.style.bottom = ""
|
statusElement.style.bottom = "";
|
||||||
}, 6000);
|
}, 6000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6,34 +6,34 @@ export const showKeyboardToolbar = (bottom = 0) => {
|
|||||||
const toolbarElement = document.getElementById("keyboardToolbar");
|
const toolbarElement = document.getElementById("keyboardToolbar");
|
||||||
toolbarElement.classList.remove("fn__none");
|
toolbarElement.classList.remove("fn__none");
|
||||||
toolbarElement.style.bottom = bottom + "px";
|
toolbarElement.style.bottom = bottom + "px";
|
||||||
}
|
};
|
||||||
|
|
||||||
export const hideKeyboardToolbar = () => {
|
export const hideKeyboardToolbar = () => {
|
||||||
const toolbarElement = document.getElementById("keyboardToolbar");
|
const toolbarElement = document.getElementById("keyboardToolbar");
|
||||||
toolbarElement.classList.add("fn__none");
|
toolbarElement.classList.add("fn__none");
|
||||||
}
|
};
|
||||||
|
|
||||||
export const initKeyboardToolbar = () => {
|
export const initKeyboardToolbar = () => {
|
||||||
const toolbarElement = document.getElementById("keyboardToolbar");
|
const toolbarElement = document.getElementById("keyboardToolbar");
|
||||||
toolbarElement.addEventListener(getEventName(), (event) => {
|
toolbarElement.addEventListener(getEventName(), (event) => {
|
||||||
const target = event.target as HTMLElement
|
const target = event.target as HTMLElement;
|
||||||
const buttonElement = hasClosestByMatchTag(target, "BUTTON")
|
const buttonElement = hasClosestByMatchTag(target, "BUTTON");
|
||||||
if (!buttonElement || !window.siyuan.mobileEditor) {
|
if (!buttonElement || !window.siyuan.mobileEditor) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const type = buttonElement.getAttribute("data-type");
|
const type = buttonElement.getAttribute("data-type");
|
||||||
const protyle = window.siyuan.mobileEditor.protyle
|
const protyle = window.siyuan.mobileEditor.protyle;
|
||||||
if (type === "undo") {
|
if (type === "undo") {
|
||||||
protyle.undo.undo(protyle)
|
protyle.undo.undo(protyle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type === "redo") {
|
if (type === "redo") {
|
||||||
protyle.undo.redo(protyle)
|
protyle.undo.redo(protyle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let range: Range
|
let range: Range;
|
||||||
if (getSelection().rangeCount > 0) {
|
if (getSelection().rangeCount > 0) {
|
||||||
range = getSelection().getRangeAt(0)
|
range = getSelection().getRangeAt(0);
|
||||||
}
|
}
|
||||||
if (!range) {
|
if (!range) {
|
||||||
return;
|
return;
|
||||||
@ -50,5 +50,5 @@ export const initKeyboardToolbar = () => {
|
|||||||
} else if (type === "indent") {
|
} else if (type === "indent") {
|
||||||
listIndent(protyle, [nodeElement.parentElement], range);
|
listIndent(protyle, [nodeElement.parentElement], range);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user