This commit is contained in:
Vanessa 2023-02-23 13:20:02 +08:00
parent edbe4da57e
commit a5bee1533b
6 changed files with 20 additions and 21 deletions

View file

@ -19,7 +19,7 @@
<div id="layouts" class="layout fn__flex-1"></div>
<div id="dockRight" class="dock dock--vertical"></div>
</div>
<div id="dockBottom" class="dock"></div>
<div id="dockBottom" class="dock fn__none"></div>
<div id="status" class="fn__flex status"></div>
<div id="commonMenu" class="b3-menu fn__none"></div>
<div id="message" class="b3-snackbars"></div>

View file

@ -21,7 +21,7 @@
<div id="layouts" class="layout fn__flex-1"></div>
<div id="dockRight" class="dock dock--vertical"></div>
</div>
<div id="dockBottom" class="dock"></div>
<div id="dockBottom" class="dock fn__none"></div>
<div id="status" class="fn__flex status"></div>
<div id="commonMenu" class="b3-menu fn__none"></div>
<div id="message" class="b3-snackbars"></div>

View file

@ -313,13 +313,13 @@ export abstract class Constants {
data: [
[{
type: "file",
size: {width: 224, height: 0},
size: {width: 227, height: 0},
show: true,
icon: "iconFiles",
hotkeyLangId: "fileTree",
}, {
type: "outline",
size: {width: 224, height: 0},
size: {width: 227, height: 0},
show: false,
icon: "iconAlignCenter",
hotkeyLangId: "outline",
@ -331,13 +331,13 @@ export abstract class Constants {
hotkeyLangId: "inbox",
}], [{
type: "bookmark",
size: {width: 224, height: 0},
size: {width: 227, height: 0},
show: false,
icon: "iconBookmark",
hotkeyLangId: "bookmark",
}, {
type: "tag",
size: {width: 224, height: 0},
size: {width: 227, height: 0},
show: false,
icon: "iconTags",
hotkeyLangId: "tag",

View file

@ -47,7 +47,7 @@ export class Wnd {
this.element = document.createElement("div");
this.element.classList.add("fn__flex-1", "fn__flex");
let dragHTML = '<div class="layout-tab-container__drag fn__none"></div>';
if (parentType === "left" || parentType === "right" || parentType === "top" || parentType === "bottom") {
if (parentType === "left" || parentType === "right" || parentType === "bottom") {
dragHTML = "";
}
this.element.innerHTML = `<div data-type="wnd" data-id="${this.id}" class="fn__flex-column fn__flex fn__flex-1">
@ -657,7 +657,7 @@ export class Wnd {
if (this.children.length === 1) {
this.destroyModel(this.children[0].model);
this.children = [];
if (["top", "bottom", "left", "right"].includes(this.parent.type)) {
if (["bottom", "left", "right"].includes(this.parent.type)) {
item.panelElement.remove();
} else {
this.remove();

View file

@ -402,9 +402,9 @@ export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any) => {
if (layout instanceof Layout || layout instanceof Wnd) {
if (layout instanceof Layout &&
(layout.type === "top" || layout.type === "bottom" || layout.type === "left" || layout.type === "right")) {
(layout.type === "bottom" || layout.type === "left" || layout.type === "right")) {
// 四周布局使用默认值,清空内容,重置时使用 dock 数据
if (layout.type === "top" || layout.type === "bottom") {
if (layout.type === "bottom") {
json.children = [{
"instance": "Wnd",
"children": []
@ -604,7 +604,7 @@ export const addResize = (obj: Layout | Wnd) => {
}
const getMinSize = (element: HTMLElement) => {
let minSize = 224;
let minSize = 227;
Array.from(element.querySelectorAll(".file-tree")).find((item) => {
if (item.classList.contains("sy__backlink") || item.classList.contains("sy__graph")
|| item.classList.contains("sy__globalGraph") || item.classList.contains("sy__inbox")) {
@ -644,14 +644,9 @@ export const addResize = (obj: Layout | Wnd) => {
const previousElement = resizeElement.previousElementSibling as HTMLElement;
nextElement.style.overflow = "auto"; // 拖动时 layout__resize 会出现 https://github.com/siyuan-note/siyuan/issues/6221
previousElement.style.overflow = "auto";
if (!nextElement.nextElementSibling) {
if (!previousElement.previousElementSibling) {
setSize(previousElement, direction);
} else {
setSize(nextElement, direction);
}
} else if (nextElement.nextElementSibling?.nextElementSibling &&
nextElement.parentElement.lastElementChild.isSameNode(nextElement.nextElementSibling.nextElementSibling)) {
if (!nextElement.nextElementSibling || nextElement.nextElementSibling.classList.contains("layout__dockresize")) {
setSize(nextElement, direction);
} else {
setSize(previousElement, direction);
}
const x = event[direction === "lr" ? "clientX" : "clientY"];
@ -684,6 +679,10 @@ export const addResize = (obj: Layout | Wnd) => {
nextNowSize < getMinSize(nextElement)) {
return;
}
if (window.siyuan.layout.bottomDock?.layout.element.isSameNode(nextElement) &&
nextNowSize < 64) {
return;
}
if (!previousElement.classList.contains("fn__flex-1")) {
previousElement.style[direction === "lr" ? "width" : "height"] = previousNowSize + "px";
}

View file

@ -1,4 +1,4 @@
type TLayout = "normal" | "top" | "bottom" | "left" | "right" | "center"
type TLayout = "normal" | "bottom" | "left" | "right" | "center"
type TSearchFilter = "mathBlock" | "table" | "blockquote" | "superBlock" | "paragraph" | "document" | "heading"
| "list" | "listItem" | "codeBlock" | "htmlBlock"
type TDirection = "lr" | "tb"
@ -12,7 +12,7 @@ type TDockType =
| "backlink"
| "backlinkOld"
| "inbox"
type TDockPosition = "Left" | "Right" | "Top" | "Bottom"
type TDockPosition = "Left" | "Right" | "Bottom"
type TWS = "main" | "filetree" | "protyle"
type TEditorMode = "preview" | "wysiwyg"
type TOperation =