This commit is contained in:
Vanessa 2023-02-11 21:34:42 +08:00
parent e59c630bac
commit 6ad89c12c1
9 changed files with 35 additions and 35 deletions

View File

@ -79,7 +79,7 @@ export const lazyLoadEmojiImg = (element: Element) => {
element.querySelectorAll("img").forEach((panelElement) => {
emojiIntersectionObserver.observe(panelElement);
});
}
};
export const filterEmoji = (key = "", max?: number, assic = false) => {
let html = "";
@ -428,7 +428,7 @@ export const updateFileTreeEmoji = (unicode: string, id: string, icon = "iconFil
/// #if MOBILE
emojiElement = document.querySelector(`#sidebar [data-type="sidebar-file"] [data-node-id="${id}"] .b3-list-item__icon`);
/// #else
const dockFile = getDockByType("file")
const dockFile = getDockByType("file");
if (dockFile) {
const files = dockFile.data.file as Files;
if (icon === "iconFile") {

View File

@ -134,19 +134,19 @@ class App {
window.siyuan.config.uiLayout.left = {
pin: true,
data: response.data.conf.uiLayout.left
}
};
window.siyuan.config.uiLayout.right = {
pin: true,
data: response.data.conf.uiLayout.right
}
};
window.siyuan.config.uiLayout.top = {
pin: true,
data: response.data.conf.uiLayout.top
}
};
window.siyuan.config.uiLayout.bottom = {
pin: true,
data: response.data.conf.uiLayout.bottom
}
};
}
getLocalStorage(() => {
fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {

View File

@ -454,11 +454,11 @@ export class Backlink extends Model {
private refresh() {
const element = this.element.querySelector('.block__icon[data-type="refresh"] svg');
element.classList.add("fn__rotate")
element.classList.add("fn__rotate");
fetchPost("/api/ref/refreshBacklink", {
id: this.blockId,
}, () => {
element.classList.remove("fn__rotate")
element.classList.remove("fn__rotate");
this.searchBacklinks();
});
}

View File

@ -46,7 +46,7 @@ export class Dock {
const dockClass = (options.position === "Bottom" || options.position === "Top") ? ' class="fn__flex"' : "";
this.element.innerHTML = `<div${dockClass}></div><div class="fn__flex-1"></div><div${dockClass}></div>`;
this.position = options.position;
this.pin = options.data.pin
this.pin = options.data.pin;
this.data = {};
if (options.data.data.length === 0) {
this.element.firstElementChild.innerHTML = `<span class="dock__item ${this.pin ? "dock__item--pin " : ""}b3-tooltips b3-tooltips__${this.getClassDirect(0)}" aria-label="${this.pin ? window.siyuan.languages.unpin : window.siyuan.languages.pin}">
@ -92,9 +92,9 @@ export class Dock {
} else {
this.layout.element.setAttribute("style", `height:${this.layout.element.clientHeight}px;left:0;right:0;${this.position === "Top" ? ("top:" + (1 + this.element.clientHeight + document.getElementById("toolbar").clientHeight) + "px") : ("bottom:" + (this.element.clientHeight + document.getElementById("status").clientHeight) + "px")};`);
}
target.setAttribute("aria-label", window.siyuan.languages.pin)
target.setAttribute("aria-label", window.siyuan.languages.pin);
} else {
target.setAttribute("aria-label", window.siyuan.languages.unpin)
target.setAttribute("aria-label", window.siyuan.languages.unpin);
}
target.classList.toggle("dock__item--pin");
this.layout.element.classList.toggle("layout--float");
@ -107,7 +107,7 @@ export class Dock {
});
this.layout.element.addEventListener("mouseleave", (event) => {
if (this.pin) {
return
return;
}
if (this.position === "Left" && event.clientX < 43) {
return;
@ -121,8 +121,8 @@ export class Dock {
if (this.position === "Bottom" && event.clientY > window.innerHeight - 73) {
return;
}
this.hideDock()
})
this.hideDock();
});
if (window.siyuan.config.uiLayout.hideDock) {
this.element.classList.add("fn__none");
}
@ -131,7 +131,7 @@ export class Dock {
if (this.position === "Left" || this.position === "Right") {
this.layout.element.setAttribute("style", `opacity:0px;width:${this.layout.element.clientWidth}px;${this.position === "Right" ? "right" : "left"}:-${this.layout.element.clientWidth}px; top: ${1 + document.getElementById("toolbar").clientHeight + document.getElementById("dockTop").clientHeight}px; bottom: ${document.getElementById("status").clientHeight + document.getElementById("dockBottom").clientHeight + 1}px;`);
} else {
this.layout.element.setAttribute("style", `opacity:0px;height:${this.layout.element.clientHeight}px;left:0;right:0;${this.position === "Top" ? "top" : "bottom"}:-${this.layout.element.clientHeight}px;`)
this.layout.element.setAttribute("style", `opacity:0px;height:${this.layout.element.clientHeight}px;left:0;right:0;${this.position === "Top" ? "top" : "bottom"}:-${this.layout.element.clientHeight}px;`);
}
this.layout.element.classList.add("layout--float");
this.resizeElement.classList.add("fn__none");
@ -141,7 +141,7 @@ export class Dock {
public hideDock() {
if (this.layout.element.style.opacity === "0") {
return
return;
}
this.layout.element.style.opacity = "0";
if (this.position === "Left") {

View File

@ -91,20 +91,20 @@ export const resetFloatDockSize = () => {
window.siyuan.layout.leftDock.layout.element.style.top = (1 + document.getElementById("toolbar").clientHeight + document.getElementById("dockTop").clientHeight) + "px";
window.siyuan.layout.leftDock.layout.element.style.bottom = (document.getElementById("status").clientHeight + document.getElementById("dockBottom").clientHeight + 1) + "px";
if (window.siyuan.layout.leftDock.layout.element.style.opacity === "1") {
window.siyuan.layout.leftDock.layout.element.style.left = (window.siyuan.layout.leftDock.element.clientWidth + .5) + "px"
window.siyuan.layout.leftDock.layout.element.style.left = (window.siyuan.layout.leftDock.element.clientWidth + .5) + "px";
}
}
if (!window.siyuan.layout.rightDock.pin) {
window.siyuan.layout.rightDock.layout.element.style.top = (1 + document.getElementById("toolbar").clientHeight + document.getElementById("dockTop").clientHeight) + "px";
window.siyuan.layout.rightDock.layout.element.style.bottom = (document.getElementById("status").clientHeight + document.getElementById("dockBottom").clientHeight + 1) + "px";
if (window.siyuan.layout.rightDock.layout.element.style.opacity === "1") {
window.siyuan.layout.rightDock.layout.element.style.right = (window.siyuan.layout.rightDock.element.clientWidth + .5) + "px"
window.siyuan.layout.rightDock.layout.element.style.right = (window.siyuan.layout.rightDock.element.clientWidth + .5) + "px";
}
}
if (!window.siyuan.layout.topDock.pin && window.siyuan.layout.topDock.layout.element.style.opacity === "1") {
window.siyuan.layout.topDock.layout.element.style.top = (document.getElementById("dockTop").clientHeight + document.getElementById("toolbar").clientHeight + 1) + "px"
window.siyuan.layout.topDock.layout.element.style.top = (document.getElementById("dockTop").clientHeight + document.getElementById("toolbar").clientHeight + 1) + "px";
}
if (!window.siyuan.layout.bottomDock.pin && window.siyuan.layout.bottomDock.layout.element.style.opacity === "1") {
window.siyuan.layout.bottomDock.layout.element.style.bottom = (document.getElementById("dockBottom").clientHeight + document.getElementById("status").clientHeight + 1) + "px"
window.siyuan.layout.bottomDock.layout.element.style.bottom = (document.getElementById("dockBottom").clientHeight + document.getElementById("status").clientHeight + 1) + "px";
}
}
};

View File

@ -138,7 +138,7 @@ const dockToJSON = (dock: Dock) => {
return {
pin: dock.pin,
data: json
}
};
};
export const resetLayout = () => {

View File

@ -1478,7 +1478,7 @@ export class WYSIWYG {
let shiftStartElement: HTMLElement;
this.element.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => {
hideElements(["hint", "util"], protyle);
const ctrlIsPressed = event.metaKey || event.ctrlKey
const ctrlIsPressed = event.metaKey || event.ctrlKey;
/// #if !MOBILE
const backlinkBreadcrumbItemElement = hasClosestByClassName(event.target, "protyle-breadcrumb__item");
if (backlinkBreadcrumbItemElement) {

View File

@ -903,19 +903,19 @@ const updateConfig = (element: Element, item: ISearchOption, config: ISearchOpti
}
(element.querySelector("#searchInput") as HTMLInputElement).value = item.k;
(element.querySelector("#replaceInput") as HTMLInputElement).value = item.r;
let methodTip = window.siyuan.languages.searchMethod + " "
let methodTip = window.siyuan.languages.searchMethod + " ";
switch (item.method) {
case 0:
methodTip += window.siyuan.languages.keyword;
break;
case 1:
methodTip += window.siyuan.languages.querySyntax
methodTip += window.siyuan.languages.querySyntax;
break;
case 2:
methodTip += "SQL"
methodTip += "SQL";
break;
case 3:
methodTip += window.siyuan.languages.regex
methodTip += window.siyuan.languages.regex;
break;
}
element.querySelector("#searchSyntaxCheck").setAttribute("aria-label", methodTip);

View File

@ -103,8 +103,8 @@ export const globalShortcut = () => {
if (!hasClosestByClassName(event.target as HTMLElement, "b3-menu") &&
!hasClosestByClassName(event.target as HTMLElement, "layout--float") &&
window.siyuan.layout.leftDock.layout.element.style.opacity !== "1") {
window.siyuan.layout.leftDock.layout.element.style.left = (window.siyuan.layout.leftDock.element.clientWidth + .5) + "px"
window.siyuan.layout.leftDock.layout.element.style.opacity = "1"
window.siyuan.layout.leftDock.layout.element.style.left = (window.siyuan.layout.leftDock.element.clientWidth + .5) + "px";
window.siyuan.layout.leftDock.layout.element.style.opacity = "1";
}
} else {
window.siyuan.layout.leftDock.hideDock();
@ -115,8 +115,8 @@ export const globalShortcut = () => {
if (event.clientY > document.getElementById("toolbar").clientHeight + document.getElementById("dockTop").clientHeight &&
event.clientY < window.innerHeight - document.getElementById("status").clientHeight - document.getElementById("dockBottom").clientHeight) {
if (!hasClosestByClassName(event.target as HTMLElement, "layout--float") && window.siyuan.layout.rightDock.layout.element.style.opacity !== "1") {
window.siyuan.layout.rightDock.layout.element.style.right = (window.siyuan.layout.rightDock.element.clientWidth + .5) + "px"
window.siyuan.layout.rightDock.layout.element.style.opacity = "1"
window.siyuan.layout.rightDock.layout.element.style.right = (window.siyuan.layout.rightDock.element.clientWidth + .5) + "px";
window.siyuan.layout.rightDock.layout.element.style.opacity = "1";
}
} else {
window.siyuan.layout.rightDock.hideDock();
@ -126,13 +126,13 @@ export const globalShortcut = () => {
if (event.clientY < 75) {
if (!window.siyuan.layout.topDock.pin && window.siyuan.layout.topDock.layout.element.style.opacity !== "1") {
window.siyuan.layout.topDock.layout.element.style.top = (document.getElementById("dockTop").clientHeight + document.getElementById("toolbar").clientHeight + 1) + "px"
window.siyuan.layout.topDock.layout.element.style.opacity = "1"
window.siyuan.layout.topDock.layout.element.style.top = (document.getElementById("dockTop").clientHeight + document.getElementById("toolbar").clientHeight + 1) + "px";
window.siyuan.layout.topDock.layout.element.style.opacity = "1";
}
} else if (event.clientY > window.innerHeight - 73) {
if (!window.siyuan.layout.bottomDock.pin && window.siyuan.layout.bottomDock.layout.element.style.opacity !== "1") {
window.siyuan.layout.bottomDock.layout.element.style.bottom = (document.getElementById("dockBottom").clientHeight + document.getElementById("status").clientHeight + 1) + "px"
window.siyuan.layout.bottomDock.layout.element.style.opacity = "1"
window.siyuan.layout.bottomDock.layout.element.style.bottom = (document.getElementById("dockBottom").clientHeight + document.getElementById("status").clientHeight + 1) + "px";
window.siyuan.layout.bottomDock.layout.element.style.opacity = "1";
}
}