Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: https://github.com/siyuan-note/siyuan/issues/2955

Vanessa09155c78e918
diff --git a/app/.eslintrc.js b/app/.eslintrc.js
index 9743aefdb1..48cf5feab3 100644
--- a/app/.eslintrc.js
+++ b/app/.eslintrc.js
@@ -9,11 +9,12 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
],
rules: {
- semi:[2, "always"],
- quotes:[2, "double", { "avoidEscape": true }],
- 'no-prototype-builtins': "off",
- 'no-useless-escape': "off",
- 'no-irregular-whitespace': "off",
+ semi: [2, 'always'],
+ quotes: [2, 'double', {'avoidEscape': true}],
+ 'no-prototype-builtins': 'off',
+ 'no-useless-escape': 'off',
+ 'no-irregular-whitespace': 'off',
+ '@typescript-eslint/no-this-alia': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
diff --git a/app/electron/main.js b/app/electron/main.js
index 1c82199d95..3525a5289c 100644
--- a/app/electron/main.js
+++ b/app/electron/main.js
@@ -805,7 +805,7 @@ app.whenReady().then(() => {
})
ipcMain.on('siyuan-lock-screen', () => {
- workspaces.forEach(item => {
+ BrowserWindow.getAllWindows().forEach(item => {
item.browserWindow.webContents.send('siyuan-lock-screen')
})
})
diff --git a/app/src/assets/scss/_reset.scss b/app/src/assets/scss/_reset.scss
index 053260050a..c0687c61e5 100644
--- a/app/src/assets/scss/_reset.scss
+++ b/app/src/assets/scss/_reset.scss
@@ -67,17 +67,23 @@ body {
}
}
- &.body--window.body--win32 .fullscreen {
- & > .protyle-breadcrumb,
- & > .block__icons {
- padding-right: 126px;
+ &.body--window {
+ .fullscreen {
+ & > .protyle-breadcrumb,
+ & > .block__icons {
+ height: 42px;
+ }
+ }
+
+ &.body--win32 .fullscreen {
+ & > .protyle-breadcrumb,
+ & > .block__icons {
+ padding-right: 126px;
+ }
}
- }
- &.body--window .fullscreen {
- & > .protyle-breadcrumb,
- & > .block__icons {
- height: 42px;
+ &.body--blur .layout-tab-bar {
+ background-color: var(--b3-toolbar-blur-background);
}
}
}
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index e63ab4adad..bd30bdaa05 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -146,7 +146,8 @@ export class Wnd {
it.style.opacity = ".1";
return;
}
- if (!event.dataTransfer.types.includes(Constants.SIYUAN_DROP_TAB) || !window.siyuan.dragElement) {
+ // 不能使用 !window.siyuan.dragElement,因为移动页签到新窗口后,再把主窗口页签拖拽新窗口页签上时,该值为空
+ if (!event.dataTransfer.types.includes(Constants.SIYUAN_DROP_TAB)) {
return;
}
event.preventDefault();
@@ -160,10 +161,10 @@ export class Wnd {
return true;
}
});
- if (!newTabHeaderElement && !oldTabHeaderElement.classList.contains("item--pin")) {
+ if (!newTabHeaderElement && oldTabHeaderElement && !oldTabHeaderElement.classList.contains("item--pin")) {
it.classList.add("layout-tab-bar--drag");
}
- if (!exitDrag) {
+ if (!exitDrag && oldTabHeaderElement) {
if (oldTabHeaderElement.classList.contains("item--pin")) {
return;
}
@@ -171,6 +172,12 @@ export class Wnd {
oldTabHeaderElement.setAttribute("data-clone", "true");
it.append(oldTabHeaderElement);
return;
+ } else if (!exitDrag && !oldTabHeaderElement) { // 拖拽到新窗口
+ oldTabHeaderElement = document.createElement("li")
+ oldTabHeaderElement.style.opacity = "0.1"
+ oldTabHeaderElement.innerHTML = '<svg class="svg"><use xlink:href="#iconFile"></use></svg>'
+ oldTabHeaderElement.setAttribute("data-clone", "true");
+ it.append(oldTabHeaderElement);
}
if (!newTabHeaderElement) {
return;
@@ -199,6 +206,7 @@ export class Wnd {
});
it.style.opacity = "";
});
+ const that = this;
this.headersElement.addEventListener("drop", function (event: DragEvent & { target: HTMLElement }) {
const it = this as HTMLElement;
if (event.dataTransfer.types.includes(Constants.SIYUAN_DROP_FILE)) {
@@ -216,7 +224,20 @@ export class Wnd {
it.style.opacity = "";
return;
}
- const oldTab = getInstanceById(event.dataTransfer.getData(Constants.SIYUAN_DROP_TAB)) as Tab;
+ const tabId = event.dataTransfer.getData(Constants.SIYUAN_DROP_TAB)
+ let oldTab = getInstanceById(tabId) as Tab;
+ /// #if !BROWSER
+ if (!oldTab) { // 从主窗口拖拽到页签新窗口
+ JSONToCenter(JSON.parse(event.dataTransfer.getData(Constants.SIYUAN_DROP_TABTOWINDOW)), that);
+ oldTab = that.children[that.children.length - 1];
+ ipcRenderer.send(Constants.SIYUAN_CLOSETAB, tabId);
+ it.querySelector("li[data-clone='true']").remove();
+ that.switchTab(oldTab.headElement);
+ }
+ /// #endif
+ if (!oldTab) {
+ return;
+ }
it.classList.remove("layout-tab-bar--drag");
const nextTabHeaderElement = (Array.from(it.childNodes).find((item: HTMLElement) => {