diff --git a/ElectronClient/app/ElectronAppWrapper.js b/ElectronClient/app/ElectronAppWrapper.js index f61b49045..850d0c9b8 100644 --- a/ElectronClient/app/ElectronAppWrapper.js +++ b/ElectronClient/app/ElectronAppWrapper.js @@ -63,7 +63,7 @@ class ElectronAppWrapper { })) // Uncomment this to view errors if the application does not start - if (this.env_ === 'dev') this.win_.webContents.openDevTools(); + // if (this.env_ === 'dev') this.win_.webContents.openDevTools(); this.win_.on('close', (event) => { // If it's on macOS, the app is completely closed only if the user chooses to close the app (willQuitApp_ will be true) diff --git a/ElectronClient/app/app.js b/ElectronClient/app/app.js index eecfd8544..85a03797e 100644 --- a/ElectronClient/app/app.js +++ b/ElectronClient/app/app.js @@ -200,6 +200,7 @@ class Application extends BaseApplication { } }, { label: _('New notebook'), + accelerator: 'CommandOrControl+B', screens: ['Main'], click: () => { this.dispatch({ @@ -228,6 +229,14 @@ class Application extends BaseApplication { }, }); } + }, { + type: 'separator', + platforms: ['darwin'], + }, { + label: _('Hide %s', 'Joplin'), + platforms: ['darwin'], + accelerator: 'CommandOrControl+H', + click: () => { bridge().window().hide() } }, { type: 'separator', }, { @@ -266,6 +275,19 @@ class Application extends BaseApplication { }); }, }], + }, { + label: _('View'), + submenu: [{ + label: _('Toggle editor layout'), + screens: ['Main'], + accelerator: 'CommandOrControl+L', + click: () => { + this.dispatch({ + type: 'WINDOW_COMMAND', + name: 'toggleVisiblePanes', + }); + } + }], }, { label: _('Tools'), submenu: [{ @@ -289,6 +311,7 @@ class Application extends BaseApplication { } },{ label: _('General Options'), + accelerator: 'CommandOrControl+,', click: () => { this.dispatch({ type: 'NAV_GO', @@ -334,10 +357,13 @@ class Application extends BaseApplication { } function removeUnwantedItems(template, screen) { + const platform = shim.platformName(); + let output = []; for (let i = 0; i < template.length; i++) { const t = Object.assign({}, template[i]); if (t.screens && t.screens.indexOf(screen) < 0) continue; + if (t.platforms && t.platforms.indexOf(platform) < 0) continue; if (t.submenu) t.submenu = removeUnwantedItems(t.submenu, screen); if (('submenu' in t) && isEmptyMenu(t.submenu)) continue; output.push(t); diff --git a/ElectronClient/app/checkForUpdates.js b/ElectronClient/app/checkForUpdates.js index 7e20c3f06..af1687af1 100644 --- a/ElectronClient/app/checkForUpdates.js +++ b/ElectronClient/app/checkForUpdates.js @@ -50,14 +50,47 @@ autoUpdater.on('error', (error) => { onCheckEnded(); }) +function findDownloadFilename_(info) { + // { version: '1.0.64', + // files: + // [ { url: 'Joplin-1.0.64-mac.zip', + // sha512: 'OlemXqhq/fSifx7EutvMzfoCI/1kGNl10i8nkvACEDfVXwP8hankDBXEC0+GxSArsZuxOh3U1+C+4j72SfIUew==' }, + // { url: 'Joplin-1.0.64.dmg', + // sha512: 'jAewQQoJ3nCaOj8hWDgf0sc3LBbAWQtiKqfTflK8Hc3Dh7fAy9jRHfFAZKFUZ9ll95Bun0DVsLq8wLSUrdsMXw==', + // size: 77104485 } ], + // path: 'Joplin-1.0.64-mac.zip', + // sha512: 'OlemXqhq/fSifx7EutvMzfoCI/1kGNl10i8nkvACEDfVXwP8hankDBXEC0+GxSArsZuxOh3U1+C+4j72SfIUew==', + // releaseDate: '2018-02-16T00:13:01.634Z', + // releaseName: 'v1.0.64', + // releaseNotes: '
Still more fixes and im...' } + + if (!info) return null; + + if (!info.files) { + // info.path seems to contain a default, though not a good one, + // so the loop below if preferable to find the right file. + return info.path; + } + + for (let i = 0; i < info.files.length; i++) { + const f = info.files[i].url; // Annoyingly this is called "url" but it's obviously not a url, so hopefully it won't change later on and become one. + if (f.indexOf('.exe') >= 0) return f; + if (f.indexOf('.dmg') >= 0) return f; + } + + return info.path; +} + autoUpdater.on('update-available', (info) => { - if (!info.version || !info.path) { + const filename = findDownloadFilename_(info); + + if (!info.version || !filename) { if (checkInBackground_) return onCheckEnded(); showErrorMessageBox(('Could not get version info: ' + JSON.stringify(info))); return onCheckEnded(); } - const downloadUrl = 'https://github.com/laurent22/joplin/releases/download/v' + info.version + '/' + info.path; + const downloadUrl = 'https://github.com/laurent22/joplin/releases/download/v' + info.version + '/' + filename; let releaseNotes = info.releaseNotes + ''; if (releaseNotes) releaseNotes = '\n\n' + _('Release notes:\n\n%s', htmlToText_(releaseNotes)); diff --git a/ElectronClient/app/gui/MainScreen.jsx b/ElectronClient/app/gui/MainScreen.jsx index 843359060..ff68ec042 100644 --- a/ElectronClient/app/gui/MainScreen.jsx +++ b/ElectronClient/app/gui/MainScreen.jsx @@ -163,6 +163,8 @@ class MainScreenComponent extends React.Component { } }, }); + } else if (command.name === 'toggleVisiblePanes') { + this.toggleVisiblePanes(); } else if (command.name === 'editAlarm') { const note = await Note.load(command.noteId); @@ -309,9 +311,7 @@ class MainScreenComponent extends React.Component { title: _('Layout'), iconName: 'fa-columns', enabled: !!notes.length, - onClick: () => { - this.toggleVisiblePanes(); - }, + onClick: () => { this.doCommand({ name: 'toggleVisiblePanes' }) }, }); if (!this.promptOnClose_) { diff --git a/ReactNativeClient/lib/shim.js b/ReactNativeClient/lib/shim.js index 13b9b0785..b20e603b7 100644 --- a/ReactNativeClient/lib/shim.js +++ b/ReactNativeClient/lib/shim.js @@ -22,6 +22,14 @@ shim.isMac = () => { return process && process.platform === 'darwin'; } +shim.platformName = function() { + if (shim.isReactNative()) return 'mobile'; + if (shim.isMac()) return 'darwin'; + if (shim.isWindows()) return 'win32'; + if (shim.isLinux()) return 'linux'; + throw new Error('Cannot determine platform'); +} + // https://github.com/cheton/is-electron shim.isElectron = () => { // Renderer process diff --git a/joplin.sublime-project b/joplin.sublime-project index 1c24e1815..9ccfd432c 100755 --- a/joplin.sublime-project +++ b/joplin.sublime-project @@ -20,6 +20,7 @@ "ElectronClient/app/css/font-awesome.min.css", "docs/*.html", "docs/*.svg", + "ReactNativeClient/lib/mime-utils.js", ], "folder_exclude_patterns": [ @@ -52,7 +53,8 @@ "tests/logs", "ReactNativeClient/ios/build", "ElectronClient/app/dist", - "_releases" + "_releases", + "ReactNativeClient/lib/csstojs", ], "path": "." },