Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
windowResizeForSplit(){
const win = remote.getCurrentWindow()
if(win._isFullScreen){
if(isDarwin){
win.setFullScreen(!win._isFullScreen)
}
else{
ipc.send('toggle-fullscreen')
}
}
else if(win.isMaximized()){
// win.unmaximize()
if(win.nativeWindow.hidePanel) return
win.nativeWindow.showWindow(9)
}
}
}
import { State, Getter, Mutation } from 'vuex-class';
import startCase from 'lodash/startCase';
import styled, { css } from 'vue-emotion';
import anime from 'animejs';
import * as tjs from 'translation.js';
import Layout, { Main } from 'components/Layout';
import Header from 'components/Header';
import Icon, { IconProps } from 'components/Icon';
import Language from 'components/Language';
import Progress, { Spin } from 'components/Progress';
import * as Tools from '@/utils';
import { IState, ILang } from '@/store';
const isDevelopment = process.env.NODE_ENV !== 'production';
const { app, Menu, MenuItem, Notification } = remote;
const window = remote.getCurrentWindow();
const notice = new Notification({
title: 'Google 翻译',
body: 'Google 翻译已是最新版本',
});
const errMsg: {
[index: string]: string;
} = {
NETWORK_ERROR: '网络繁忙,请稍后再试',
API_SERVER_ERROR: '当前翻译接口不可用',
UNSUPPORTED_LANG: '当前引擎不支持翻译该语种',
NETWORK_TIMEOUT: '翻译接口超时',
};
// #region stylesheet
const header = css`
.icon-fixed {
const fs = require('fs')
const os = require('os')
const path = require('path')
const { remote, ipcRenderer } = require('electron')
const loader = require('monaco-loader')
const rendererWindow = remote.getCurrentWindow()
let monaco = null
let editor = null
let currentUrl = null
async function openFile(filePath) {
const extension = path.extname(filePath)
const filetypes = {
'.js': 'javascript',
'.css': 'css'
}
const filetype = filetypes[extension] || 'text'
currentUrl = filePath
if (monaco && editor) {
try {
click () {
removeOtherTabs(id)
}
}, {
label: 'Close Tabs To The Left',
enabled: canCloseToTheLeft,
click () {
removeTabsToTheLeft(id)
}
}, {
label: 'Close Tabs To The Right',
enabled: canCloseToTheRight,
click () {
removeTabsToTheRight(id)
}
}]).popup(remote.getCurrentWindow())
}
function* issueWindow(url) {
let win = null;
try {
win = yield eff.call(
windowsManagerSagas.forkNewWindow,
{
url,
showOnReady: false,
BrowserWindow: remote.BrowserWindow,
options: {
backgroundColor: 'white',
show: false,
modal: true,
parent: remote.getCurrentWindow(),
useContentSize: true,
center: true,
title: 'Issue window',
webPreferences: {
webSecurity: false,
nodeIntegration: false,
preload: getPreload('issueFormPreload'),
devTools: (
config.issueWindowDevTools
|| process.env.DEBUG_PROD === 'true'
),
},
},
},
);
while (true) {
setTimeout(() => {
webview.focus();
webview.addEventListener('did-navigate', savePage);
webview.addEventListener('did-navigate-in-page', savePage);
const focusWebview = () => {
document.querySelector('webview::shadow object').focus();
};
window.addEventListener('beforeunload', () => {
remote.getCurrentWindow().removeListener('focus', focusWebview);
});
remote.getCurrentWindow().on('focus', focusWebview);
}, 700);
});
public constructor() {
super();
this.currentWindow = remote.getCurrentWindow();
}
window.onload =() => {
var frame = document.getElementById('content_frame')
frame.src = remote.getCurrentWindow().url
//Remove HTML titlebar on Windows/Linux
var titlebar = document.getElementById('titlebar')
if (remote.getCurrentWindow().os != 'darwin') {
titlebar.parentNode.removeChild(titlebar)
}
}
ipcRenderer.on('refreshMain', function(event) {
remote.getCurrentWindow().reload();
});
IO (async () => remote.dialog.showSaveDialog (
remote .getCurrentWindow (),
options
)
.then (res => then (guard (!res .canceled)) (normalize (res .filePath))))