🚨
This commit is contained in:
parent
b859b5b237
commit
3e57c2155d
6 changed files with 32 additions and 35 deletions
|
@ -625,7 +625,7 @@ export const initKeyboardToolbar = () => {
|
|||
}
|
||||
// appearance
|
||||
if (["clear", "style2", "style4", "color", "backgroundColor", "fontSize", "style1"].includes(type)) {
|
||||
const nodeElements = getFontNodeElements(protyle)
|
||||
const nodeElements = getFontNodeElements(protyle);
|
||||
if (type === "style1") {
|
||||
fontEvent(protyle, nodeElements, type, buttonElement.firstElementChild.style.backgroundColor + Constants.ZWSP + buttonElement.firstElementChild.style.color);
|
||||
} else if (type === "fontSize") {
|
||||
|
|
|
@ -426,6 +426,19 @@ export class Gutter {
|
|||
};
|
||||
}
|
||||
|
||||
private showMobileAppearance(protyle: IProtyle) {
|
||||
const toolbarElement = document.getElementById("keyboardToolbar");
|
||||
const dynamicElements = toolbarElement.querySelectorAll("#keyboardToolbar .keyboard__dynamic");
|
||||
dynamicElements[0].classList.add("fn__none");
|
||||
dynamicElements[1].classList.remove("fn__none");
|
||||
toolbarElement.querySelector('.keyboard__action[data-type="text"]').classList.add("protyle-toolbar__item--current");
|
||||
toolbarElement.querySelector('.keyboard__action[data-type="done"] use').setAttribute("xlink:href", "#iconCloseRound");
|
||||
const oldScrollTop = protyle.contentElement.scrollTop;
|
||||
renderTextMenu(protyle, toolbarElement);
|
||||
showKeyboardToolbarUtil(oldScrollTop);
|
||||
toolbarElement.classList.remove("fn__none");
|
||||
}
|
||||
|
||||
public renderMultipleMenu(protyle: IProtyle, selectsElement: Element[]) {
|
||||
let isList = false;
|
||||
let isContinue = false;
|
||||
|
@ -680,17 +693,9 @@ export class Gutter {
|
|||
label: window.siyuan.languages.appearance,
|
||||
icon: "iconFont",
|
||||
accelerator: window.siyuan.config.keymap.editor.insert.appearance.custom,
|
||||
click() {
|
||||
click: () => {
|
||||
/// #if MOBILE
|
||||
const toolbarElement = document.getElementById("keyboardToolbar");
|
||||
const dynamicElements = toolbarElement.querySelectorAll("#keyboardToolbar .keyboard__dynamic");
|
||||
dynamicElements[0].classList.add("fn__none");
|
||||
dynamicElements[1].classList.remove("fn__none");
|
||||
toolbarElement.querySelector('.keyboard__action[data-type="text"]').classList.add("protyle-toolbar__item--current");
|
||||
toolbarElement.querySelector('.keyboard__action[data-type="done"] use').setAttribute("xlink:href", "#iconCloseRound");
|
||||
const oldScrollTop = protyle.contentElement.scrollTop;
|
||||
renderTextMenu(protyle, toolbarElement);
|
||||
showKeyboardToolbarUtil(oldScrollTop);
|
||||
this.showMobileAppearance(protyle);
|
||||
/// #else
|
||||
protyle.toolbar.element.classList.add("fn__none");
|
||||
protyle.toolbar.subElement.innerHTML = "";
|
||||
|
@ -754,7 +759,7 @@ export class Gutter {
|
|||
|
||||
public renderMenu(protyle: IProtyle, buttonElement: Element) {
|
||||
if (!buttonElement) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
hideElements(["util", "toolbar", "hint"], protyle);
|
||||
window.siyuan.menus.menu.remove();
|
||||
|
@ -1501,17 +1506,9 @@ export class Gutter {
|
|||
label: window.siyuan.languages.appearance,
|
||||
icon: "iconFont",
|
||||
accelerator: window.siyuan.config.keymap.editor.insert.appearance.custom,
|
||||
click() {
|
||||
click: () => {
|
||||
/// #if MOBILE
|
||||
const toolbarElement = document.getElementById("keyboardToolbar");
|
||||
const dynamicElements = toolbarElement.querySelectorAll("#keyboardToolbar .keyboard__dynamic");
|
||||
dynamicElements[0].classList.add("fn__none");
|
||||
dynamicElements[1].classList.remove("fn__none");
|
||||
toolbarElement.querySelector('.keyboard__action[data-type="text"]').classList.add("protyle-toolbar__item--current");
|
||||
toolbarElement.querySelector('.keyboard__action[data-type="done"] use').setAttribute("xlink:href", "#iconCloseRound");
|
||||
const oldScrollTop = protyle.contentElement.scrollTop;
|
||||
renderTextMenu(protyle, toolbarElement);
|
||||
showKeyboardToolbarUtil(oldScrollTop);
|
||||
this.showMobileAppearance(protyle);
|
||||
/// #else
|
||||
protyle.toolbar.element.classList.add("fn__none");
|
||||
protyle.toolbar.subElement.innerHTML = "";
|
||||
|
|
|
@ -2,5 +2,5 @@ export const genIconHTML = () => {
|
|||
return `<div class="protyle-icons">
|
||||
<span aria-label="${window.siyuan.languages.edit}" class="b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--first protyle-action__edit"><svg><use xlink:href="#iconEdit"></use></svg></span>
|
||||
<span aria-label="${window.siyuan.languages.more}" class="b3-tooltips__nw b3-tooltips protyle-icon protyle-action__menu protyle-icon--last"><svg><use xlink:href="#iconMore"></use></svg></span>
|
||||
</div>`
|
||||
}
|
||||
</div>`;
|
||||
};
|
||||
|
|
|
@ -421,4 +421,4 @@ export const getFontNodeElements = (protyle: IProtyle) => {
|
|||
}
|
||||
}
|
||||
return nodeElements;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -2007,7 +2007,7 @@ export class WYSIWYG {
|
|||
if (protyle.options.render.breadcrumb) {
|
||||
setTimeout(() => {
|
||||
protyle.breadcrumb.render(protyle);
|
||||
}, Constants.TIMEOUT_TRANSITION)
|
||||
}, Constants.TIMEOUT_TRANSITION);
|
||||
}
|
||||
} else if (lastEditElement) {
|
||||
range.selectNodeContents(lastEditElement);
|
||||
|
|
|
@ -41,7 +41,7 @@ const toggleReplaceHistory = (replaceHistoryElement: Element, historyElement: El
|
|||
replaceHistoryElement.classList.add("fn__none");
|
||||
}
|
||||
historyElement.classList.add("fn__none");
|
||||
}
|
||||
};
|
||||
|
||||
const toggleSearchHistory = (historyElement: Element, replaceHistoryElement: Element, searchInputElement: HTMLInputElement) => {
|
||||
if (historyElement.classList.contains("fn__none")) {
|
||||
|
@ -64,7 +64,7 @@ const toggleSearchHistory = (historyElement: Element, replaceHistoryElement: Ele
|
|||
historyElement.classList.add("fn__none");
|
||||
}
|
||||
replaceHistoryElement.classList.add("fn__none");
|
||||
}
|
||||
};
|
||||
|
||||
const saveKeyList = (type: "keys" | "replaceKeys", value: string) => {
|
||||
let list: string[] = window.siyuan.storage[Constants.LOCAL_SEARCHKEYS][type];
|
||||
|
@ -609,12 +609,12 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
|
|||
event.preventDefault();
|
||||
break;
|
||||
} else if (target.id === "searchHistoryBtn") {
|
||||
toggleSearchHistory(historyElement, replaceHistoryElement, searchInputElement)
|
||||
toggleSearchHistory(historyElement, replaceHistoryElement, searchInputElement);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return;
|
||||
} else if (target.id === "replaceHistoryBtn") {
|
||||
toggleReplaceHistory(replaceHistoryElement, historyElement, replaceInputElement)
|
||||
toggleReplaceHistory(replaceHistoryElement, historyElement, replaceInputElement);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return;
|
||||
|
@ -756,7 +756,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
|
|||
return;
|
||||
}
|
||||
const focusIsNew = currentList.getAttribute("data-type") === "search-new";
|
||||
const isHistory = !historyElement.classList.contains("fn__none")
|
||||
const isHistory = !historyElement.classList.contains("fn__none");
|
||||
if (event.key === "Enter") {
|
||||
if (!isHistory) {
|
||||
if (focusIsNew) {
|
||||
|
@ -779,7 +779,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
|
|||
searchInputElement.value = historyElement.querySelector(".b3-list-item--focus").textContent.trim();
|
||||
config.page = 1;
|
||||
inputTimeout = inputEvent(element, config, inputTimeout, edit);
|
||||
toggleSearchHistory(historyElement, replaceHistoryElement, searchInputElement)
|
||||
toggleSearchHistory(historyElement, replaceHistoryElement, searchInputElement);
|
||||
}
|
||||
event.preventDefault();
|
||||
}
|
||||
|
@ -789,7 +789,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
|
|||
}
|
||||
if (isHistory) {
|
||||
if (event.key === "Escape") {
|
||||
toggleSearchHistory(historyElement, replaceHistoryElement, searchInputElement)
|
||||
toggleSearchHistory(historyElement, replaceHistoryElement, searchInputElement);
|
||||
} else {
|
||||
upDownHint(historyElement, event);
|
||||
}
|
||||
|
@ -860,7 +860,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
|
|||
if (event.isComposing) {
|
||||
return;
|
||||
}
|
||||
const isHistory = !replaceHistoryElement.classList.contains("fn__none")
|
||||
const isHistory = !replaceHistoryElement.classList.contains("fn__none");
|
||||
if (event.key === "Enter") {
|
||||
if (isHistory) {
|
||||
replaceInputElement.value = replaceHistoryElement.querySelector(".b3-list-item--focus").textContent.trim();
|
||||
|
@ -876,7 +876,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
|
|||
}
|
||||
if (isHistory) {
|
||||
if (event.key === "Escape") {
|
||||
toggleReplaceHistory(replaceHistoryElement, historyElement, replaceInputElement)
|
||||
toggleReplaceHistory(replaceHistoryElement, historyElement, replaceInputElement);
|
||||
} else {
|
||||
upDownHint(replaceHistoryElement, event);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue