This commit is contained in:
Vanessa 2023-02-23 13:26:34 +08:00
parent c538c0a9e3
commit 52e1cc7957
7 changed files with 12 additions and 12 deletions

View file

@ -801,7 +801,7 @@ export class Wnd {
} }
tab.parent = this; tab.parent = this;
resizeTabs(); resizeTabs();
hideAllElements(["toolbar"]) hideAllElements(["toolbar"]);
} }
public split(direction: TDirection) { public split(direction: TDirection) {

View file

@ -430,7 +430,7 @@ export class Files extends Model {
} }
} }
if (gutterType && newElement.classList.contains("dragover")) { if (gutterType && newElement.classList.contains("dragover")) {
const gutterTypes = gutterType.replace(Constants.SIYUAN_DROP_GUTTER, "").split(Constants.ZWSP) const gutterTypes = gutterType.replace(Constants.SIYUAN_DROP_GUTTER, "").split(Constants.ZWSP);
if (["nodelistitem", "nodeheading"].includes(gutterTypes[0])) { if (["nodelistitem", "nodeheading"].includes(gutterTypes[0])) {
// 块标拖拽 // 块标拖拽
if (gutterTypes[0] === "nodeheading") { if (gutterTypes[0] === "nodeheading") {

View file

@ -30,19 +30,19 @@ export class Dock {
this.layout = window.siyuan.layout.layout.children[0].children[0] as Layout; this.layout = window.siyuan.layout.layout.children[0].children[0] as Layout;
this.resizeElement = this.layout.element.nextElementSibling as HTMLElement; this.resizeElement = this.layout.element.nextElementSibling as HTMLElement;
this.layout.element.classList.add("layout__dockl"); this.layout.element.classList.add("layout__dockl");
this.layout.element.insertAdjacentHTML("beforeend", `<div class="layout__dockresize layout__dockresize--lr"></div>`); this.layout.element.insertAdjacentHTML("beforeend", "<div class=\"layout__dockresize layout__dockresize--lr\"></div>");
break; break;
case "Right": case "Right":
this.layout = window.siyuan.layout.layout.children[0].children[2] as Layout; this.layout = window.siyuan.layout.layout.children[0].children[2] as Layout;
this.resizeElement = this.layout.element.previousElementSibling as HTMLElement; this.resizeElement = this.layout.element.previousElementSibling as HTMLElement;
this.layout.element.classList.add("layout__dockr"); this.layout.element.classList.add("layout__dockr");
this.layout.element.insertAdjacentHTML("beforeend", `<div class="layout__dockresize layout__dockresize--lr"></div>`); this.layout.element.insertAdjacentHTML("beforeend", "<div class=\"layout__dockresize layout__dockresize--lr\"></div>");
break; break;
case "Bottom": case "Bottom":
this.layout = window.siyuan.layout.layout.children[1] as Layout; this.layout = window.siyuan.layout.layout.children[1] as Layout;
this.resizeElement = this.layout.element.previousElementSibling as HTMLElement; this.resizeElement = this.layout.element.previousElementSibling as HTMLElement;
this.layout.element.classList.add("layout__dockb"); this.layout.element.classList.add("layout__dockb");
this.layout.element.insertAdjacentHTML("beforeend", `<div class="layout__dockresize"></div>`); this.layout.element.insertAdjacentHTML("beforeend", "<div class=\"layout__dockresize\"></div>");
break; break;
} }
this.element = document.getElementById("dock" + options.position); this.element = document.getElementById("dock" + options.position);
@ -121,7 +121,7 @@ export class Dock {
documentSelf.onmousemove = (moveEvent: MouseEvent) => { documentSelf.onmousemove = (moveEvent: MouseEvent) => {
moveEvent.preventDefault(); moveEvent.preventDefault();
moveEvent.stopPropagation(); moveEvent.stopPropagation();
let currentNowSize let currentNowSize;
if (this.position === "Left") { if (this.position === "Left") {
currentNowSize = (currentSize + (moveEvent.clientX - x)); currentNowSize = (currentSize + (moveEvent.clientX - x));
} else if (this.position === "Right") { } else if (this.position === "Right") {
@ -424,7 +424,7 @@ export class Dock {
if (anotherIndex === 0) { if (anotherIndex === 0) {
anotherWnd.element.nextElementSibling.classList.remove("fn__none"); anotherWnd.element.nextElementSibling.classList.remove("fn__none");
} else { } else {
lastWnd = anotherWnd lastWnd = anotherWnd;
anotherWnd.element.previousElementSibling.classList.remove("fn__none"); anotherWnd.element.previousElementSibling.classList.remove("fn__none");
} }
const lastActiveElement = this.element.querySelector('.dock__item--active[data-index="1"]'); const lastActiveElement = this.element.querySelector('.dock__item--active[data-index="1"]');

View file

@ -509,7 +509,7 @@ export const resizeTabs = () => {
}); });
}); });
pdfResize(); pdfResize();
hideAllElements(["gutter"]) hideAllElements(["gutter"]);
}, 200); }, 200);
}; };

View file

@ -63,4 +63,4 @@ export const hideAllElements = (types: string[]) => {
item.innerHTML = ""; item.innerHTML = "";
}); });
} }
} };

View file

@ -813,7 +813,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
const ids = event.dataTransfer.getData(Constants.SIYUAN_DROP_FILE).split(","); const ids = event.dataTransfer.getData(Constants.SIYUAN_DROP_FILE).split(",");
for (let i = 0; i < ids.length; i++) { for (let i = 0; i < ids.length; i++) {
if (ids[i]) { if (ids[i]) {
const response = await fetchSyncPost("/api/filetree/doc2Heading", { await fetchSyncPost("/api/filetree/doc2Heading", {
srcID: ids[i], srcID: ids[i],
after: targetElement.classList.contains("dragover__bottom"), after: targetElement.classList.contains("dragover__bottom"),
targetID: targetElement.getAttribute("data-node-id"), targetID: targetElement.getAttribute("data-node-id"),

View file

@ -825,10 +825,10 @@ export const globalShortcut = () => {
} }
// protyle.toolbar 点击空白处时进行隐藏 // protyle.toolbar 点击空白处时进行隐藏
if (!hasClosestByClassName(event.target, "protyle-toolbar")) { if (!hasClosestByClassName(event.target, "protyle-toolbar")) {
hideAllElements(["toolbar"]) hideAllElements(["toolbar"]);
} }
if (!hasClosestByClassName(event.target, "pdf__outer")) { if (!hasClosestByClassName(event.target, "pdf__outer")) {
hideAllElements(["pdfutil"]) hideAllElements(["pdfutil"]);
} }
// dock float 时,点击空白处,隐藏 dock // dock float 时,点击空白处,隐藏 dock
const floatDockLayoutElement = hasClosestByClassName(event.target, "layout--float", true); const floatDockLayoutElement = hasClosestByClassName(event.target, "layout--float", true);