mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 08:30:12 +01:00
This commit is contained in:
parent
edbe4da57e
commit
a5bee1533b
6 changed files with 20 additions and 21 deletions
|
|
@ -19,7 +19,7 @@
|
||||||
<div id="layouts" class="layout fn__flex-1"></div>
|
<div id="layouts" class="layout fn__flex-1"></div>
|
||||||
<div id="dockRight" class="dock dock--vertical"></div>
|
<div id="dockRight" class="dock dock--vertical"></div>
|
||||||
</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="status" class="fn__flex status"></div>
|
||||||
<div id="commonMenu" class="b3-menu fn__none"></div>
|
<div id="commonMenu" class="b3-menu fn__none"></div>
|
||||||
<div id="message" class="b3-snackbars"></div>
|
<div id="message" class="b3-snackbars"></div>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
<div id="layouts" class="layout fn__flex-1"></div>
|
<div id="layouts" class="layout fn__flex-1"></div>
|
||||||
<div id="dockRight" class="dock dock--vertical"></div>
|
<div id="dockRight" class="dock dock--vertical"></div>
|
||||||
</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="status" class="fn__flex status"></div>
|
||||||
<div id="commonMenu" class="b3-menu fn__none"></div>
|
<div id="commonMenu" class="b3-menu fn__none"></div>
|
||||||
<div id="message" class="b3-snackbars"></div>
|
<div id="message" class="b3-snackbars"></div>
|
||||||
|
|
|
||||||
|
|
@ -313,13 +313,13 @@ export abstract class Constants {
|
||||||
data: [
|
data: [
|
||||||
[{
|
[{
|
||||||
type: "file",
|
type: "file",
|
||||||
size: {width: 224, height: 0},
|
size: {width: 227, height: 0},
|
||||||
show: true,
|
show: true,
|
||||||
icon: "iconFiles",
|
icon: "iconFiles",
|
||||||
hotkeyLangId: "fileTree",
|
hotkeyLangId: "fileTree",
|
||||||
}, {
|
}, {
|
||||||
type: "outline",
|
type: "outline",
|
||||||
size: {width: 224, height: 0},
|
size: {width: 227, height: 0},
|
||||||
show: false,
|
show: false,
|
||||||
icon: "iconAlignCenter",
|
icon: "iconAlignCenter",
|
||||||
hotkeyLangId: "outline",
|
hotkeyLangId: "outline",
|
||||||
|
|
@ -331,13 +331,13 @@ export abstract class Constants {
|
||||||
hotkeyLangId: "inbox",
|
hotkeyLangId: "inbox",
|
||||||
}], [{
|
}], [{
|
||||||
type: "bookmark",
|
type: "bookmark",
|
||||||
size: {width: 224, height: 0},
|
size: {width: 227, height: 0},
|
||||||
show: false,
|
show: false,
|
||||||
icon: "iconBookmark",
|
icon: "iconBookmark",
|
||||||
hotkeyLangId: "bookmark",
|
hotkeyLangId: "bookmark",
|
||||||
}, {
|
}, {
|
||||||
type: "tag",
|
type: "tag",
|
||||||
size: {width: 224, height: 0},
|
size: {width: 227, height: 0},
|
||||||
show: false,
|
show: false,
|
||||||
icon: "iconTags",
|
icon: "iconTags",
|
||||||
hotkeyLangId: "tag",
|
hotkeyLangId: "tag",
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ export class Wnd {
|
||||||
this.element = document.createElement("div");
|
this.element = document.createElement("div");
|
||||||
this.element.classList.add("fn__flex-1", "fn__flex");
|
this.element.classList.add("fn__flex-1", "fn__flex");
|
||||||
let dragHTML = '<div class="layout-tab-container__drag fn__none"></div>';
|
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 = "";
|
dragHTML = "";
|
||||||
}
|
}
|
||||||
this.element.innerHTML = `<div data-type="wnd" data-id="${this.id}" class="fn__flex-column fn__flex fn__flex-1">
|
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) {
|
if (this.children.length === 1) {
|
||||||
this.destroyModel(this.children[0].model);
|
this.destroyModel(this.children[0].model);
|
||||||
this.children = [];
|
this.children = [];
|
||||||
if (["top", "bottom", "left", "right"].includes(this.parent.type)) {
|
if (["bottom", "left", "right"].includes(this.parent.type)) {
|
||||||
item.panelElement.remove();
|
item.panelElement.remove();
|
||||||
} else {
|
} else {
|
||||||
this.remove();
|
this.remove();
|
||||||
|
|
|
||||||
|
|
@ -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 instanceof Wnd) {
|
||||||
if (layout instanceof Layout &&
|
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 数据
|
// 四周布局使用默认值,清空内容,重置时使用 dock 数据
|
||||||
if (layout.type === "top" || layout.type === "bottom") {
|
if (layout.type === "bottom") {
|
||||||
json.children = [{
|
json.children = [{
|
||||||
"instance": "Wnd",
|
"instance": "Wnd",
|
||||||
"children": []
|
"children": []
|
||||||
|
|
@ -604,7 +604,7 @@ export const addResize = (obj: Layout | Wnd) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const getMinSize = (element: HTMLElement) => {
|
const getMinSize = (element: HTMLElement) => {
|
||||||
let minSize = 224;
|
let minSize = 227;
|
||||||
Array.from(element.querySelectorAll(".file-tree")).find((item) => {
|
Array.from(element.querySelectorAll(".file-tree")).find((item) => {
|
||||||
if (item.classList.contains("sy__backlink") || item.classList.contains("sy__graph")
|
if (item.classList.contains("sy__backlink") || item.classList.contains("sy__graph")
|
||||||
|| item.classList.contains("sy__globalGraph") || item.classList.contains("sy__inbox")) {
|
|| 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;
|
const previousElement = resizeElement.previousElementSibling as HTMLElement;
|
||||||
nextElement.style.overflow = "auto"; // 拖动时 layout__resize 会出现 https://github.com/siyuan-note/siyuan/issues/6221
|
nextElement.style.overflow = "auto"; // 拖动时 layout__resize 会出现 https://github.com/siyuan-note/siyuan/issues/6221
|
||||||
previousElement.style.overflow = "auto";
|
previousElement.style.overflow = "auto";
|
||||||
if (!nextElement.nextElementSibling) {
|
if (!nextElement.nextElementSibling || nextElement.nextElementSibling.classList.contains("layout__dockresize")) {
|
||||||
if (!previousElement.previousElementSibling) {
|
|
||||||
setSize(previousElement, direction);
|
|
||||||
} else {
|
|
||||||
setSize(nextElement, direction);
|
setSize(nextElement, direction);
|
||||||
}
|
} else {
|
||||||
} else if (nextElement.nextElementSibling?.nextElementSibling &&
|
|
||||||
nextElement.parentElement.lastElementChild.isSameNode(nextElement.nextElementSibling.nextElementSibling)) {
|
|
||||||
setSize(previousElement, direction);
|
setSize(previousElement, direction);
|
||||||
}
|
}
|
||||||
const x = event[direction === "lr" ? "clientX" : "clientY"];
|
const x = event[direction === "lr" ? "clientX" : "clientY"];
|
||||||
|
|
@ -684,6 +679,10 @@ export const addResize = (obj: Layout | Wnd) => {
|
||||||
nextNowSize < getMinSize(nextElement)) {
|
nextNowSize < getMinSize(nextElement)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (window.siyuan.layout.bottomDock?.layout.element.isSameNode(nextElement) &&
|
||||||
|
nextNowSize < 64) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!previousElement.classList.contains("fn__flex-1")) {
|
if (!previousElement.classList.contains("fn__flex-1")) {
|
||||||
previousElement.style[direction === "lr" ? "width" : "height"] = previousNowSize + "px";
|
previousElement.style[direction === "lr" ? "width" : "height"] = previousNowSize + "px";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
app/src/types/index.d.ts
vendored
4
app/src/types/index.d.ts
vendored
|
|
@ -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"
|
type TSearchFilter = "mathBlock" | "table" | "blockquote" | "superBlock" | "paragraph" | "document" | "heading"
|
||||||
| "list" | "listItem" | "codeBlock" | "htmlBlock"
|
| "list" | "listItem" | "codeBlock" | "htmlBlock"
|
||||||
type TDirection = "lr" | "tb"
|
type TDirection = "lr" | "tb"
|
||||||
|
|
@ -12,7 +12,7 @@ type TDockType =
|
||||||
| "backlink"
|
| "backlink"
|
||||||
| "backlinkOld"
|
| "backlinkOld"
|
||||||
| "inbox"
|
| "inbox"
|
||||||
type TDockPosition = "Left" | "Right" | "Top" | "Bottom"
|
type TDockPosition = "Left" | "Right" | "Bottom"
|
||||||
type TWS = "main" | "filetree" | "protyle"
|
type TWS = "main" | "filetree" | "protyle"
|
||||||
type TEditorMode = "preview" | "wysiwyg"
|
type TEditorMode = "preview" | "wysiwyg"
|
||||||
type TOperation =
|
type TOperation =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue