This commit is contained in:
Vanessa 2023-01-28 00:45:18 +08:00
parent bd2b35320f
commit 8176ba40a8
4 changed files with 10 additions and 10 deletions

View file

@ -81,8 +81,8 @@ export class Tab {
if (tabElement) { if (tabElement) {
event.dataTransfer.setData("text/html", tabElement.outerHTML); event.dataTransfer.setData("text/html", tabElement.outerHTML);
event.dataTransfer.setData(Constants.SIYUAN_DROP_TAB, this.id); event.dataTransfer.setData(Constants.SIYUAN_DROP_TAB, this.id);
const modeJSON = {} const modeJSON = {};
layoutToJSON(this, modeJSON) layoutToJSON(this, modeJSON);
event.dataTransfer.setData(Constants.SIYUAN_DROP_TABTOWINDOW, JSON.stringify(modeJSON)); event.dataTransfer.setData(Constants.SIYUAN_DROP_TABTOWINDOW, JSON.stringify(modeJSON));
event.dataTransfer.dropEffect = "move"; event.dataTransfer.dropEffect = "move";
tabElement.style.opacity = "0.1"; tabElement.style.opacity = "0.1";
@ -103,10 +103,10 @@ export class Tab {
if (!this.headElement.style.maxWidth) { if (!this.headElement.style.maxWidth) {
const windowBounds = getCurrentWindow().getBounds(); const windowBounds = getCurrentWindow().getBounds();
if (event.clientX < 0 || event.clientY < 0 || event.clientX > windowBounds.width || event.clientY > windowBounds.height) { if (event.clientX < 0 || event.clientY < 0 || event.clientX > windowBounds.width || event.clientY > windowBounds.height) {
openNewWindow(this) openNewWindow(this);
} }
} }
}, Constants.TIMEOUT_BLOCKLOAD) // 等待主进程发送关闭消息 }, Constants.TIMEOUT_BLOCKLOAD); // 等待主进程发送关闭消息
/// #endif /// #endif
window.siyuan.dragElement = undefined; window.siyuan.dragElement = undefined;
if (event.dataTransfer.dropEffect === "none") { if (event.dataTransfer.dropEffect === "none") {

View file

@ -173,9 +173,9 @@ export class Wnd {
it.append(oldTabHeaderElement); it.append(oldTabHeaderElement);
return; return;
} else if (!exitDrag && !oldTabHeaderElement) { // 拖拽到新窗口 } else if (!exitDrag && !oldTabHeaderElement) { // 拖拽到新窗口
oldTabHeaderElement = document.createElement("li") oldTabHeaderElement = document.createElement("li");
oldTabHeaderElement.style.opacity = "0.1" oldTabHeaderElement.style.opacity = "0.1";
oldTabHeaderElement.innerHTML = '<svg class="svg"><use xlink:href="#iconFile"></use></svg>' oldTabHeaderElement.innerHTML = '<svg class="svg"><use xlink:href="#iconFile"></use></svg>';
oldTabHeaderElement.setAttribute("data-clone", "true"); oldTabHeaderElement.setAttribute("data-clone", "true");
it.append(oldTabHeaderElement); it.append(oldTabHeaderElement);
} }
@ -224,7 +224,7 @@ export class Wnd {
it.style.opacity = ""; it.style.opacity = "";
return; return;
} }
const tabId = event.dataTransfer.getData(Constants.SIYUAN_DROP_TAB) const tabId = event.dataTransfer.getData(Constants.SIYUAN_DROP_TAB);
let oldTab = getInstanceById(tabId) as Tab; let oldTab = getInstanceById(tabId) as Tab;
/// #if !BROWSER /// #if !BROWSER
if (!oldTab) { // 从主窗口拖拽到页签新窗口 if (!oldTab) { // 从主窗口拖拽到页签新窗口

View file

@ -903,7 +903,7 @@ ${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE, false, "b3-list-item__
}); });
let dockHtml = ""; let dockHtml = "";
if (!isWindow()) { if (!isWindow()) {
dockHtml = '<ul class="b3-list b3-list--background" style="max-height: calc(70vh - 35px)">' dockHtml = '<ul class="b3-list b3-list--background" style="max-height: calc(70vh - 35px)">';
getAllDocks().forEach((item, index) => { getAllDocks().forEach((item, index) => {
dockHtml += `<li data-type="${item.type}" data-index="${index}" class="b3-list-item${(!tabHtml && !dockHtml) ? " b3-list-item--focus" : ""}"> dockHtml += `<li data-type="${item.type}" data-index="${index}" class="b3-list-item${(!tabHtml && !dockHtml) ? " b3-list-item--focus" : ""}">
<svg class="b3-list-item__graphic"><use xlink:href="#${item.icon}"></use></svg> <svg class="b3-list-item__graphic"><use xlink:href="#${item.icon}"></use></svg>

View file

@ -26,4 +26,4 @@ export const openNewWindow = (tab: Tab) => {
layoutToJSON(tab, json); layoutToJSON(tab, json);
win.loadURL(`${window.location.protocol}//${window.location.host}/stage/build/app/window.html?v=${Constants.SIYUAN_VERSION}&json=${JSON.stringify(json)}`); win.loadURL(`${window.location.protocol}//${window.location.host}/stage/build/app/window.html?v=${Constants.SIYUAN_VERSION}&json=${JSON.stringify(json)}`);
tab.parent.removeTab(tab.id); tab.parent.removeTab(tab.id);
} };