提交 2b4d3e99 编写于 作者: E Eugene Pankov

multi-window fixes

上级 39458730
......@@ -117,6 +117,9 @@ export class Window {
}
send (event, ...args) {
if (!this.window) {
return
}
this.window.webContents.send(event, ...args)
}
......@@ -154,19 +157,31 @@ export class Window {
}
})
ipcMain.on('window-focus', () => {
ipcMain.on('window-focus', event => {
if (event.sender !== this.window.webContents) {
return
}
this.window.focus()
})
ipcMain.on('window-maximize', () => {
ipcMain.on('window-maximize', event => {
if (event.sender !== this.window.webContents) {
return
}
this.window.maximize()
})
ipcMain.on('window-unmaximize', () => {
ipcMain.on('window-unmaximize', event => {
if (event.sender !== this.window.webContents) {
return
}
this.window.unmaximize()
})
ipcMain.on('window-toggle-maximize', () => {
ipcMain.on('window-toggle-maximize', event => {
if (event.sender !== this.window.webContents) {
return
}
if (this.window.isMaximized()) {
this.window.unmaximize()
} else {
......@@ -174,23 +189,38 @@ export class Window {
}
})
ipcMain.on('window-minimize', () => {
ipcMain.on('window-minimize', event => {
if (event.sender !== this.window.webContents) {
return
}
this.window.minimize()
})
ipcMain.on('window-set-bounds', (_event, bounds) => {
ipcMain.on('window-set-bounds', (event, bounds) => {
if (event.sender !== this.window.webContents) {
return
}
this.window.setBounds(bounds)
})
ipcMain.on('window-set-always-on-top', (_event, flag) => {
ipcMain.on('window-set-always-on-top', (event, flag) => {
if (event.sender !== this.window.webContents) {
return
}
this.window.setAlwaysOnTop(flag)
})
ipcMain.on('window-set-vibrancy', (_event, enabled, type) => {
ipcMain.on('window-set-vibrancy', (event, enabled, type) => {
if (event.sender !== this.window.webContents) {
return
}
this.setVibrancy(enabled, type)
})
ipcMain.on('window-set-title', (_event, title) => {
ipcMain.on('window-set-title', (event, title) => {
if (event.sender !== this.window.webContents) {
return
}
this.window.setTitle(title)
})
......
......@@ -26,7 +26,7 @@
"file-loader": "^0.11.2",
"rage-edit-tmp": "^1.1.0",
"uuid": "^3.3.2",
"xterm": "^3.6.0"
"xterm": "^3.8.0"
},
"peerDependencies": {
"@angular/common": "4.0.1",
......
......@@ -20,6 +20,18 @@ export class XTermFrontend extends Frontend {
allowTransparency: true,
enableBold: true,
})
const initGlobal = (this.xterm as any)._core._initGlobal.bind((this.xterm as any)._core);
(this.xterm as any)._core._initGlobal = () => {
this.xterm.textarea.addEventListener('paste', e => {
e.clipboardData = null
})
this.xterm.element.addEventListener('paste', e => {
e.clipboardData = null
})
initGlobal()
}
this.xterm.on('data', data => {
this.input.next(data)
})
......@@ -34,7 +46,7 @@ export class XTermFrontend extends Frontend {
attach (host: HTMLElement): void {
this.xterm.open(host)
this.ready.next(null)
this.ready.complete()
this.ready.complete();
this.resizeHandler = () => (this.xterm as any).fit()
window.addEventListener('resize', this.resizeHandler)
......
......@@ -173,7 +173,7 @@ uuid@^3.3.2:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==
xterm@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.6.0.tgz#9b95cd23a338e5842343aec1a104f094c5153e7c"
integrity sha512-D/7/fm7oGzZksLFQdpn1TD63V+T4Ad3LZR2JfZ1QrPZ1yDjKedIKWAZXgzeHQw8S/5HYD08GdkLnjeLm/e6Yog==
xterm@^3.8.0:
version "3.8.0"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.8.0.tgz#55d1de518bdc9c9793823f5e4e97d6898972938d"
integrity sha512-rS3HLryuMWbLsv98+jVVSUXCxmoyXPwqwJNC0ad0VSMdXgl65LefPztQVwfurkaF7kM7ZSgM8eJjnJ9kkdoR1w==
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册