mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 07:18:49 +01:00
🚨
This commit is contained in:
parent
89c93f8ce8
commit
2474db3ab8
16 changed files with 38 additions and 40 deletions
|
|
@ -214,7 +214,7 @@ export class Wnd {
|
|||
it.classList.remove("layout-tab-bars--drag");
|
||||
return;
|
||||
}
|
||||
const tabData = JSON.parse(event.dataTransfer.getData(Constants.SIYUAN_DROP_TAB))
|
||||
const tabData = JSON.parse(event.dataTransfer.getData(Constants.SIYUAN_DROP_TAB));
|
||||
let oldTab = getInstanceById(tabData.id) as Tab;
|
||||
const wnd = getInstanceById(it.parentElement.getAttribute("data-id")) as Wnd;
|
||||
/// #if !BROWSER
|
||||
|
|
@ -324,7 +324,7 @@ export class Wnd {
|
|||
dragElement.classList.add("fn__none");
|
||||
const targetWndElement = event.target.parentElement.parentElement;
|
||||
const targetWnd = getInstanceById(targetWndElement.getAttribute("data-id")) as Wnd;
|
||||
const tabData = JSON.parse(event.dataTransfer.getData(Constants.SIYUAN_DROP_TAB))
|
||||
const tabData = JSON.parse(event.dataTransfer.getData(Constants.SIYUAN_DROP_TAB));
|
||||
let oldTab = getInstanceById(tabData.id) as Tab;
|
||||
/// #if !BROWSER
|
||||
if (!oldTab) { // 从主窗口拖拽到页签新窗口
|
||||
|
|
|
|||
|
|
@ -28,22 +28,22 @@ export class Dock {
|
|||
case "Left":
|
||||
this.layout = window.siyuan.layout.layout.children[1].children[0] as Layout;
|
||||
this.resizeElement = this.layout.element.nextElementSibling as HTMLElement;
|
||||
this.layout.element.classList.add("layout--floatl")
|
||||
this.layout.element.classList.add("layout--floatl");
|
||||
break;
|
||||
case "Right":
|
||||
this.layout = window.siyuan.layout.layout.children[1].children[2] as Layout;
|
||||
this.resizeElement = this.layout.element.previousElementSibling as HTMLElement;
|
||||
this.layout.element.classList.add("layout--floatr")
|
||||
this.layout.element.classList.add("layout--floatr");
|
||||
break;
|
||||
case "Top":
|
||||
this.layout = window.siyuan.layout.layout.children[0] as Layout;
|
||||
this.resizeElement = this.layout.element.nextElementSibling as HTMLElement;
|
||||
this.layout.element.classList.add("layout--floatt")
|
||||
this.layout.element.classList.add("layout--floatt");
|
||||
break;
|
||||
case "Bottom":
|
||||
this.layout = window.siyuan.layout.layout.children[2] as Layout;
|
||||
this.resizeElement = this.layout.element.previousElementSibling as HTMLElement;
|
||||
this.layout.element.classList.add("layout--floatb")
|
||||
this.layout.element.classList.add("layout--floatb");
|
||||
break;
|
||||
}
|
||||
this.element = document.getElementById("dock" + options.position);
|
||||
|
|
@ -112,7 +112,7 @@ export class Dock {
|
|||
}
|
||||
if (!this.pin) {
|
||||
setTimeout(() => {
|
||||
this.resetDockPosition(false)
|
||||
this.resetDockPosition(false);
|
||||
this.hideDock(true);
|
||||
this.layout.element.classList.add("layout--float");
|
||||
this.resizeElement.classList.add("fn__none");
|
||||
|
|
@ -502,7 +502,7 @@ ${this.position === "Top" ? "top" : "bottom"}:0`);
|
|||
}
|
||||
|
||||
private genButton(data: IDockTab[], index: number) {
|
||||
let html = ""
|
||||
let html = "";
|
||||
data.forEach(item => {
|
||||
html += `<span data-height="${item.size.height}" data-width="${item.size.width}" data-type="${item.type}" data-index="${index}" data-hotkeylangid="${item.hotkeyLangId}" class="dock__item${item.show ? " dock__item--active" : ""} b3-tooltips b3-tooltips__${this.getClassDirect(index)}" aria-label="${window.siyuan.languages[item.hotkeyLangId] + " " + updateHotkeyTip(window.siyuan.config.keymap.general[item.hotkeyLangId].custom)}${window.siyuan.languages.dockTip}">
|
||||
<svg><use xlink:href="#${item.icon}"></use></svg>
|
||||
|
|
|
|||
|
|
@ -94,9 +94,9 @@ export const resetFloatDockSize = () => {
|
|||
window.siyuan.layout.rightDock.showDock(true);
|
||||
}
|
||||
if (!window.siyuan.layout.topDock.pin && window.siyuan.layout.topDock.layout.element.style.opacity === "1") {
|
||||
window.siyuan.layout.topDock.showDock(true)
|
||||
window.siyuan.layout.topDock.showDock(true);
|
||||
}
|
||||
if (!window.siyuan.layout.bottomDock.pin && window.siyuan.layout.bottomDock.layout.element.style.opacity === "1") {
|
||||
window.siyuan.layout.bottomDock.showDock(true)
|
||||
window.siyuan.layout.bottomDock.showDock(true);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/// #if !MOBILE
|
||||
import {getAllDocks} from "./getAll";
|
||||
import {updateHotkeyTip} from "../protyle/util/compatibility";
|
||||
import {getDockByType, resizeTabs} from "./util";
|
||||
import {hasClosestByClassName} from "../protyle/util/hasClosest";
|
||||
import {fetchPost} from "../util/fetch";
|
||||
|
|
|
|||
|
|
@ -599,7 +599,7 @@ export const getInstanceById = (id: string, layout = window.siyuan.layout.center
|
|||
|
||||
export const addResize = (obj: Layout | Wnd) => {
|
||||
if (!obj.resize) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
const resizeWnd = (resizeElement: HTMLElement, direction: string) => {
|
||||
const setSize = (item: HTMLElement, direction: string) => {
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement:
|
|||
click() {
|
||||
openNewWindowById(id);
|
||||
}
|
||||
})
|
||||
});
|
||||
/// #endif
|
||||
openSubmenus.push({type: "separator"});
|
||||
openSubmenus.push({
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ const togglePinDock = (dock: Dock, icon: string) => {
|
|||
dock.layout.element.classList.toggle("layout--float");
|
||||
resizeTabs();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const workspaceMenu = (rect: DOMRect) => {
|
||||
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
|
||||
|
|
|
|||
|
|
@ -645,10 +645,10 @@ const initAbout = () => {
|
|||
break;
|
||||
} else if (target.id === "openWorkspace") {
|
||||
fetchPost("/api/system/getMobileWorkspaces", {}, (response) => {
|
||||
let selectHTML = ""
|
||||
let selectHTML = "";
|
||||
response.data.forEach((item: string, index: number) => {
|
||||
selectHTML += `<option value="${item}"${index === 0 ? ' selected="selected"' : ""}>${pathPosix().basename(item)}</option>`
|
||||
})
|
||||
selectHTML += `<option value="${item}"${index === 0 ? ' selected="selected"' : ""}>${pathPosix().basename(item)}</option>`;
|
||||
});
|
||||
const openWorkspaceDialog = new Dialog({
|
||||
title: window.siyuan.languages.openBy,
|
||||
content: `<div class="b3-dialog__content">
|
||||
|
|
@ -678,7 +678,7 @@ const initAbout = () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
|
|
@ -746,4 +746,4 @@ const initAbout = () => {
|
|||
exitSiYuan();
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -62,14 +62,14 @@ export const fullscreen = (element: Element, btnElement?: Element) => {
|
|||
} else {
|
||||
btnElement.querySelector("use").setAttribute("xlink:href", "#iconContract");
|
||||
}
|
||||
const dockLayoutElement = hasClosestByClassName(element, "layout--float")
|
||||
const dockLayoutElement = hasClosestByClassName(element, "layout--float");
|
||||
if (dockLayoutElement) {
|
||||
if (isFullscreen) {
|
||||
dockLayoutElement.setAttribute("data-temp", dockLayoutElement.style.transform)
|
||||
dockLayoutElement.style.transform = "none"
|
||||
dockLayoutElement.setAttribute("data-temp", dockLayoutElement.style.transform);
|
||||
dockLayoutElement.style.transform = "none";
|
||||
} else {
|
||||
dockLayoutElement.style.transform = dockLayoutElement.getAttribute("data-temp")
|
||||
dockLayoutElement.removeAttribute("data-temp")
|
||||
dockLayoutElement.style.transform = dockLayoutElement.getAttribute("data-temp");
|
||||
dockLayoutElement.removeAttribute("data-temp");
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export class Gutter {
|
|||
if (window.siyuan.dragElement) {
|
||||
this.element.querySelectorAll("button").forEach((item) => {
|
||||
item.style.opacity = "";
|
||||
})
|
||||
});
|
||||
window.siyuan.dragElement = undefined;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ export class Protyle {
|
|||
}
|
||||
});
|
||||
}
|
||||
this.protyle.contentElement.classList.add("protyle-content--transition")
|
||||
this.protyle.contentElement.classList.add("protyle-content--transition");
|
||||
}
|
||||
|
||||
private init() {
|
||||
|
|
|
|||
|
|
@ -737,7 +737,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
if (gutterType) {
|
||||
// gutter 或反链面板拖拽
|
||||
const sourceElements: Element[] = [];
|
||||
const gutterTypes = gutterType.replace(Constants.SIYUAN_DROP_GUTTER, "").split(Constants.ZWSP)
|
||||
const gutterTypes = gutterType.replace(Constants.SIYUAN_DROP_GUTTER, "").split(Constants.ZWSP);
|
||||
const selectedIds = gutterTypes[2].split(",");
|
||||
if (event.altKey) {
|
||||
focusByRange(document.caretRangeFromPoint(event.clientX, event.clientY));
|
||||
|
|
@ -756,9 +756,9 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
insertHTML(protyle.lute.SpinBlockDOM(html), protyle, true);
|
||||
blockRender(protyle, protyle.wysiwyg.element);
|
||||
} else if (targetElement) {
|
||||
let queryClass = ''
|
||||
let queryClass = "";
|
||||
selectedIds.forEach(item => {
|
||||
queryClass = `[data-node-id="${item}"],`
|
||||
queryClass = `[data-node-id="${item}"],`;
|
||||
});
|
||||
if (window.siyuan.dragElement) {
|
||||
window.siyuan.dragElement.querySelectorAll(queryClass.substring(0, queryClass.length - 1)).forEach(elementItem => {
|
||||
|
|
@ -768,7 +768,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
}
|
||||
});
|
||||
} else { // 跨窗口拖拽
|
||||
const targetProtyleElement = document.createElement("template")
|
||||
const targetProtyleElement = document.createElement("template");
|
||||
targetProtyleElement.innerHTML = event.dataTransfer.getData(gutterType);
|
||||
targetProtyleElement.content.querySelectorAll(queryClass.substring(0, queryClass.length - 1)).forEach(elementItem => {
|
||||
if (elementItem.getAttribute("data-type") === "NodeBlockQueryEmbed" ||
|
||||
|
|
@ -932,7 +932,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
disabledPosition = "";
|
||||
// gutter 文档内拖拽限制
|
||||
// 排除自己及子孙
|
||||
const gutterTypes = gutterType.replace(Constants.SIYUAN_DROP_GUTTER, "").split(Constants.ZWSP)
|
||||
const gutterTypes = gutterType.replace(Constants.SIYUAN_DROP_GUTTER, "").split(Constants.ZWSP);
|
||||
const isSelf = gutterTypes[2].split(",").find((item: string) => {
|
||||
if (item && hasClosestByAttribute(targetElement, "data-node-id", item)) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
insertHTML(code, protyle, true);
|
||||
highlightRender(protyle.wysiwyg.element);
|
||||
}
|
||||
hideElements(["hint"], protyle)
|
||||
hideElements(["hint"], protyle);
|
||||
} else {
|
||||
let isHTML = false;
|
||||
if (textHTML.replace("<!--StartFragment--><!--EndFragment-->", "").trim() !== "") {
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ const syncNow = () => {
|
|||
fetchPost("/api/sync/performSync", {upload: uploadElement.value === "true"});
|
||||
manualDialog.destroy();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const setSync = (key?: string, dialog?: Dialog) => {
|
||||
if (key) {
|
||||
|
|
|
|||
|
|
@ -469,15 +469,15 @@ export const initWindow = () => {
|
|||
<use xlink:href="#iconPin"></use>
|
||||
</svg>
|
||||
</div></div>`);
|
||||
const pinElement = document.getElementById("pinWindow")
|
||||
const pinElement = document.getElementById("pinWindow");
|
||||
pinElement.addEventListener("click", () => {
|
||||
pinElement.classList.toggle("toolbar__item--active")
|
||||
pinElement.classList.toggle("toolbar__item--active");
|
||||
if (pinElement.classList.contains("toolbar__item--active")) {
|
||||
pinElement.setAttribute("aria-label", window.siyuan.languages.unpin);
|
||||
currentWindow.setAlwaysOnTop(true, "pop-up-menu")
|
||||
currentWindow.setAlwaysOnTop(true, "pop-up-menu");
|
||||
} else {
|
||||
pinElement.setAttribute("aria-label", window.siyuan.languages.pin);
|
||||
currentWindow.setAlwaysOnTop(false)
|
||||
currentWindow.setAlwaysOnTop(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export const setTabPosition = () => {
|
|||
// @ts-ignore
|
||||
dragElement.style.WebkitAppRegion = "";
|
||||
}
|
||||
const headersLastElement = headerElement.lastElementChild as HTMLElement
|
||||
const headersLastElement = headerElement.lastElementChild as HTMLElement;
|
||||
if ("darwin" === window.siyuan.config.system.os) {
|
||||
if (rect.top <= 0 && rect.left <= 0 && !getCurrentWindow().isFullScreen()) {
|
||||
item.headersElement.style.paddingLeft = "69px";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue