This commit is contained in:
Vanessa 2022-06-25 22:55:56 +08:00
parent 2214acd81a
commit 1047305274
3 changed files with 12 additions and 12 deletions

View file

@ -99,7 +99,7 @@ const setHTML = (options: { content: string, action?: string[] }, protyle: IProt
return; return;
} }
protyle.block.showAll = options.action.includes(Constants.CB_GET_ALL); protyle.block.showAll = options.action.includes(Constants.CB_GET_ALL);
const REMOVED_OVER_HEIGHT = protyle.contentElement.clientHeight * 8 const REMOVED_OVER_HEIGHT = protyle.contentElement.clientHeight * 8;
if (options.action.includes(Constants.CB_GET_APPEND)) { if (options.action.includes(Constants.CB_GET_APPEND)) {
// 动态加载移除 // 动态加载移除
if (protyle.contentElement.scrollHeight > REMOVED_OVER_HEIGHT) { if (protyle.contentElement.scrollHeight > REMOVED_OVER_HEIGHT) {

View file

@ -77,7 +77,7 @@ export class Search extends Model {
searchPanelElement.scrollTop > currentList.offsetTop) { searchPanelElement.scrollTop > currentList.offsetTop) {
searchPanelElement.scrollTop = currentList.offsetTop - searchPanelElement.clientHeight + lineHeight; searchPanelElement.scrollTop = currentList.offsetTop - searchPanelElement.clientHeight + lineHeight;
} }
this.getArticle(currentList.getAttribute("data-node-id"), inputElement.value) this.getArticle(currentList.getAttribute("data-node-id"), inputElement.value);
event.preventDefault(); event.preventDefault();
} else if (event.key === "ArrowUp") { } else if (event.key === "ArrowUp") {
currentList.classList.remove("b3-list-item--focus"); currentList.classList.remove("b3-list-item--focus");

View file

@ -158,9 +158,9 @@ export const onGetConfig = () => {
const initStatus = () => { const initStatus = () => {
const allDocks = getAllDocks(); const allDocks = getAllDocks();
let menuHTML = '' let menuHTML = "";
allDocks.forEach(item => { allDocks.forEach(item => {
menuHTML += `<button class="b3-menu__item" data-type="${item.type}"><svg class="b3-menu__icon""><use xlink:href="#${item.icon}"></use></svg><span class="b3-menu__label">${window.siyuan.languages[item.hotkeyLangId]}</span><span class="b3-menu__accelerator">${window.siyuan.config.keymap.general[item.hotkeyLangId].custom}</span></button>` menuHTML += `<button class="b3-menu__item" data-type="${item.type}"><svg class="b3-menu__icon""><use xlink:href="#${item.icon}"></use></svg><span class="b3-menu__label">${window.siyuan.languages[item.hotkeyLangId]}</span><span class="b3-menu__accelerator">${window.siyuan.config.keymap.general[item.hotkeyLangId].custom}</span></button>`;
}); });
document.getElementById("status").innerHTML = `<div id="barDock" class="toolbar__item b3-tooltips b3-tooltips__e${window.siyuan.config.readonly ? " fn__none" : ""}" aria-label="${window.siyuan.config.uiLayout.hideDock ? window.siyuan.languages.showDock : window.siyuan.languages.hideDock}"> document.getElementById("status").innerHTML = `<div id="barDock" class="toolbar__item b3-tooltips b3-tooltips__e${window.siyuan.config.readonly ? " fn__none" : ""}" aria-label="${window.siyuan.config.uiLayout.hideDock ? window.siyuan.languages.showDock : window.siyuan.languages.hideDock}">
<svg> <svg>
@ -183,12 +183,12 @@ const initStatus = () => {
</div> </div>
<div id="barHelp" class="toolbar__item b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.help}"> <div id="barHelp" class="toolbar__item b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.help}">
<svg><use xlink:href="#iconHelp"></use></svg> <svg><use xlink:href="#iconHelp"></use></svg>
</div>` </div>`;
document.querySelector("#status").addEventListener("click", (event) => { document.querySelector("#status").addEventListener("click", (event) => {
let target = event.target as HTMLElement let target = event.target as HTMLElement;
while (target.id !== "status") { while (target.id !== "status") {
if (target.id === 'barDock') { if (target.id === "barDock") {
const useElement = target.firstElementChild.firstElementChild const useElement = target.firstElementChild.firstElementChild;
const dockIsShow = useElement.getAttribute("xlink:href") === "#iconHideDock"; const dockIsShow = useElement.getAttribute("xlink:href") === "#iconHideDock";
if (dockIsShow) { if (dockIsShow) {
useElement.setAttribute("xlink:href", "#iconDock"); useElement.setAttribute("xlink:href", "#iconDock");
@ -226,7 +226,7 @@ const initStatus = () => {
event.stopPropagation(); event.stopPropagation();
break; break;
} else if (target.classList.contains("b3-menu__item")) { } else if (target.classList.contains("b3-menu__item")) {
const type = target.getAttribute("data-type") as TDockType const type = target.getAttribute("data-type") as TDockType;
getDockByType(type).toggleModel(type); getDockByType(type).toggleModel(type);
if (type === "file" && getSelection().rangeCount > 0) { if (type === "file" && getSelection().rangeCount > 0) {
const range = getSelection().getRangeAt(0); const range = getSelection().getRangeAt(0);
@ -262,10 +262,10 @@ const initStatus = () => {
event.stopPropagation(); event.stopPropagation();
break; break;
} }
target = target.parentElement target = target.parentElement;
} }
}) });
} };
const initBar = () => { const initBar = () => {
document.querySelector(".toolbar").innerHTML = `<div id="toolbarVIP" class="fn__flex"></div> document.querySelector(".toolbar").innerHTML = `<div id="toolbarVIP" class="fn__flex"></div>