mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
Open Preferences in Default JS Editor on Windows (#1138)
* Open Preferences in Wordpad on Windows Notepad doesn't handle `\n` line breaks, Wordpad does. Fixes #1126. * Update: Use Win editor from reg If not found, or set to notepad.exe (which can't handle line breaks), show hyper.js config file in folder so user can open in editor of their choice. * Fixes for Windows Fixed shell reference, corrected lint errors. * Fixes for Windows Fixed shell reference, corrected lint errors. * Fixes for Windows Fixed shell reference, corrected lint errors. * Always show .hyper.js in folder for prefs * Always show .hyper.js in folder for prefs * Fixed electron import
This commit is contained in:
parent
0ff1cb9584
commit
6a9b3f74c5
1 changed files with 5 additions and 24 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import {EOL} from 'os';
|
||||
import os from 'os';
|
||||
import {shell} from 'electron';
|
||||
import path from 'path';
|
||||
|
||||
import * as shellEscape from 'php-escape-shell';
|
||||
import last from '../utils/array';
|
||||
|
|
@ -210,33 +212,12 @@ export function moveTo(i) {
|
|||
}
|
||||
|
||||
export function showPreferences() {
|
||||
const isWin = process.platform === 'win32';
|
||||
// eslint-disable-next-line no-template-curly-in-string
|
||||
const command = isWin ? ' start notepad "%userprofile%\\.hyper.js"' : ' bash -c \'exec env ${EDITOR:=nano} ~/.hyper.js\'';
|
||||
const message = [];
|
||||
message.push(isWin ?
|
||||
' echo Attempting to open ^%userprofile^%\\.hyper.js with notepad' :
|
||||
' echo Attempting to open ~/.hyper.js with your \\$EDITOR');
|
||||
message.push(' echo If it fails, open it manually with your favorite editor!');
|
||||
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: UI_SHOW_PREFERENCES,
|
||||
effect() {
|
||||
dispatch(requestSession());
|
||||
// Replace this hack with an async action
|
||||
rpc.once('session add', ({uid}) => {
|
||||
rpc.once('session data', () => {
|
||||
dispatch(sendSessionData(
|
||||
uid,
|
||||
[
|
||||
...message,
|
||||
command,
|
||||
''
|
||||
].join(EOL)
|
||||
));
|
||||
});
|
||||
});
|
||||
dispatch(
|
||||
shell.showItemInFolder(path.join(os.homedir(), '.hyper.js')));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue