mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
fixes
This commit is contained in:
parent
07c981c1ac
commit
7eecb38c60
6 changed files with 31 additions and 16 deletions
19
electron.js
19
electron.js
|
@ -88,13 +88,6 @@ nativeTheme.on('updated', () => {
|
|||
});
|
||||
|
||||
function createWindow () {
|
||||
ipcMain.handle('Api', (e, cmd, args) => {
|
||||
args = args || [];
|
||||
args.unshift(e.sender);
|
||||
|
||||
Api[cmd].apply(Api, args);
|
||||
});
|
||||
|
||||
mainWindow = WindowManager.createMain({ route: Util.getRouteFromUrl(deeplinkingUrl), isChild: false });
|
||||
|
||||
if (process.env.ELECTRON_DEV_EXTENSIONS) {
|
||||
|
@ -130,6 +123,18 @@ function createWindow () {
|
|||
MenuManager.setWindow(mainWindow);
|
||||
MenuManager.initMenu();
|
||||
MenuManager.initTray();
|
||||
|
||||
ipcMain.handle('Api', (e, cmd, args) => {
|
||||
args = args || [];
|
||||
args.unshift(BrowserWindow.fromId(e.sender.id));
|
||||
|
||||
const Api = require('./electron/js/api.js');
|
||||
if (Api[cmd]) {
|
||||
Api[cmd].apply(Api, args);
|
||||
} else {
|
||||
console.error('Api method not defined:', cmd, Api);
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
app.on('ready', () => {
|
||||
|
|
|
@ -23,7 +23,7 @@ contextBridge.exposeInMainWorld('Electron', {
|
|||
tmpPath: path.join(userPath, 'tmp'),
|
||||
getPath: (fp, fn) => path.join(fp, fn),
|
||||
|
||||
isMaximized: () => BrowserWindow.getFocusedWindow().isMaximized(),
|
||||
isMaximized: () => BrowserWindow.getFocusedWindow()?.isMaximized(),
|
||||
getGlobal: (key) => getGlobal(key),
|
||||
showOpenDialog: dialog.showOpenDialog,
|
||||
|
||||
|
@ -31,7 +31,7 @@ contextBridge.exposeInMainWorld('Electron', {
|
|||
readChunk,
|
||||
fileType,
|
||||
|
||||
on: ipcRenderer.on,
|
||||
removeAllListeners: ipcRenderer.removeAllListeners,
|
||||
on: (event, callBack) => ipcRenderer.on(event, callBack),
|
||||
removeAllListeners: (event) => ipcRenderer.removeAllListeners(event),
|
||||
Api: (cmd, args) => ipcRenderer.invoke('Api', cmd, args),
|
||||
});
|
|
@ -116,6 +116,10 @@
|
|||
.controlButtons { left: 114px !important; text-align: left !important; }
|
||||
}
|
||||
|
||||
.editorWrapper.isNote {
|
||||
.editorControls { margin-bottom: 16px; }
|
||||
}
|
||||
|
||||
/* Human */
|
||||
|
||||
.editorWrapper.isHuman.withIcon {
|
||||
|
|
|
@ -173,7 +173,7 @@ const EditorPage = observer(class EditorPage extends React.Component<Props, {}>
|
|||
|
||||
Storage.set('askSurvey', 1);
|
||||
|
||||
Renderer.removeAllListeners('commandEditor');
|
||||
Renderer.remove('commandEditor');
|
||||
Renderer.on('commandEditor', (e: any, cmd: string, arg: any) => { this.onCommand(cmd, arg); });
|
||||
};
|
||||
|
||||
|
@ -202,7 +202,7 @@ const EditorPage = observer(class EditorPage extends React.Component<Props, {}>
|
|||
|
||||
focus.clear(false);
|
||||
window.clearInterval(this.timeoutScreen);
|
||||
Renderer.removeAllListeners('commandEditor');
|
||||
Renderer.remove('commandEditor');
|
||||
};
|
||||
|
||||
getWrapper () {
|
||||
|
|
|
@ -52,7 +52,7 @@ class Keyboard {
|
|||
Util.previewHide(true);
|
||||
});
|
||||
|
||||
Renderer.removeAllListeners('commandGlobal');
|
||||
Renderer.remove('commandGlobal');
|
||||
Renderer.on('commandGlobal', (e: any, cmd: string, arg: any) => { this.onCommand(cmd, arg); });
|
||||
};
|
||||
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
class Renderer {
|
||||
|
||||
send (...args: any[]) {
|
||||
window.Electron.Api(args);
|
||||
args = args || [];
|
||||
|
||||
const cmd = args[0];
|
||||
args.shift();
|
||||
|
||||
window.Electron.Api(cmd, args);
|
||||
};
|
||||
|
||||
on (event: string, callBack: any) {
|
||||
this.remove(event);
|
||||
window.Electron.on(event, callBack);
|
||||
};
|
||||
|
||||
removeAllListeners (...args: any[]) {
|
||||
window.Electron.removeAllListeners.apply(null, args);
|
||||
remove (event: string) {
|
||||
window.Electron.removeAllListeners(event);
|
||||
};
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue