This commit is contained in:
Vanessa 2024-10-12 12:34:59 +08:00
parent 3c3e2b8067
commit e474ceffe1
4 changed files with 19 additions and 19 deletions

View file

@ -312,7 +312,7 @@ export const bindCardEvent = async (options: {
fetchPost("/api/riff/batchSetRiffCardsDueTime", {
cardDues: [{
id: currentCard.cardID,
due: dayjs().add(parseInt(inputElement.value), 'day').format("YYYYMMDDHHmmss")
due: dayjs().add(parseInt(inputElement.value), "day").format("YYYYMMDDHHmmss")
}]
}, () => {
actionElements[0].classList.add("fn__none");

View file

@ -309,9 +309,9 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellElement: Eleme
/// #if MOBILE
const contentElement = hasClosestByClassName(blockElement, "protyle-content", true);
if (contentElement && cellElement.getAttribute("data-dtype") !== "checkbox") {
const keyboardToolbarElement = document.getElementById("keyboardToolbar")
const keyboardH = parseInt(keyboardToolbarElement.getAttribute("data-keyboardheight")) || (window.outerHeight / 2 - 42)
console.log(keyboardH, window.innerHeight, cellRect.bottom)
const keyboardToolbarElement = document.getElementById("keyboardToolbar");
const keyboardH = parseInt(keyboardToolbarElement.getAttribute("data-keyboardheight")) || (window.outerHeight / 2 - 42);
console.log(keyboardH, window.innerHeight, cellRect.bottom);
if (cellRect.bottom > window.innerHeight - keyboardH - 42) {
contentElement.scrollTop += cellRect.bottom - window.innerHeight + 42 + keyboardH;
} else if (cellRect.top < 110) {

View file

@ -219,20 +219,20 @@ export const bindSwitcherEvent = (options: { protyle: IProtyle, menuElement: Ele
if (event.isComposing) {
return;
}
upDownHint(options.menuElement.querySelector('.fn__flex-1'), event, "b3-menu__item--current");
upDownHint(options.menuElement.querySelector(".fn__flex-1"), event, "b3-menu__item--current");
if (event.key === "Enter") {
const currentElement = options.menuElement.querySelector(".b3-menu__item--current") as HTMLElement;
if (currentElement) {
options.blockElement.removeAttribute("data-render");
avRender(options.blockElement, options.protyle, undefined, currentElement.dataset.id);
options.menuElement.remove();
focusBlock(options.blockElement)
focusBlock(options.blockElement);
}
} else if (event.key === "Escape") {
options.menuElement.remove();
focusBlock(options.blockElement)
focusBlock(options.blockElement);
}
})
});
inputElement.addEventListener("input", (event: InputEvent) => {
if (event.isComposing) {
return;
@ -242,7 +242,7 @@ export const bindSwitcherEvent = (options: { protyle: IProtyle, menuElement: Ele
inputElement.addEventListener("compositionend", () => {
filterSwitcher(options.menuElement);
});
}
};
const filterSwitcher = (menuElement: Element) => {
const inputElement = menuElement.querySelector(".b3-text-field") as HTMLInputElement;
@ -251,16 +251,16 @@ const filterSwitcher = (menuElement: Element) => {
if (!key ||
(key.toLowerCase().indexOf(item.textContent.trim().toLowerCase()) > -1 ||
item.textContent.trim().toLowerCase().indexOf(key.toLowerCase()) > -1)) {
item.classList.remove("fn__none")
item.classList.remove("fn__none");
} else {
item.classList.add("fn__none")
item.classList.remove("b3-menu__item--current")
item.classList.add("fn__none");
item.classList.remove("b3-menu__item--current");
}
})
if (!menuElement.querySelector('.b3-menu__item--current')) {
menuElement.querySelector(".fn__flex-1 .b3-menu__item:not(.fn__none)")?.classList.add("b3-menu__item--current")
});
if (!menuElement.querySelector(".b3-menu__item--current")) {
menuElement.querySelector(".fn__flex-1 .b3-menu__item:not(.fn__none)")?.classList.add("b3-menu__item--current");
}
}
};
export const getSwitcherHTML = (views: IAVView[], viewId: string) => {
let html = "";

View file

@ -352,7 +352,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
if (isUndo) {
return;
}
const embedElement = isInEmbedBlock(item)
const embedElement = isInEmbedBlock(item);
if (embedElement) {
embedElement.removeAttribute("data-render");
blockRender(protyle, embedElement);
@ -1192,7 +1192,7 @@ const processFold = (operation: IOperation, protyle: IProtyle) => {
if (operation.action === "unfoldHeading") {
const scrollTop = protyle.contentElement.scrollTop;
protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.id}"]`).forEach(item => {
const embedElement = isInEmbedBlock(item)
const embedElement = isInEmbedBlock(item);
if (embedElement) {
embedElement.removeAttribute("data-render");
blockRender(protyle, embedElement);
@ -1224,7 +1224,7 @@ const processFold = (operation: IOperation, protyle: IProtyle) => {
return;
}
protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.id}"]`).forEach(item => {
const embedElement = isInEmbedBlock(item)
const embedElement = isInEmbedBlock(item);
if (embedElement) {
embedElement.removeAttribute("data-render");
blockRender(protyle, embedElement);