Vanessa 2023-01-28 00:06:47 +08:00
parent 22a926946c
commit 09155c78e9
4 changed files with 47 additions and 19 deletions

View file

@ -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',

View file

@ -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')
})
})

View file

@ -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--window .fullscreen {
& > .protyle-breadcrumb,
& > .block__icons {
height: 42px;
&.body--win32 .fullscreen {
& > .protyle-breadcrumb,
& > .block__icons {
padding-right: 126px;
}
}
&.body--blur .layout-tab-bar {
background-color: var(--b3-toolbar-blur-background);
}
}
}

View file

@ -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) => {