Skip to content

Commit

Permalink
Update to Electron 4.0.2 (#1172)
Browse files Browse the repository at this point in the history
* Update Electron to 4.0.2

* Adapt to new makeSingleInstance API

* Remove unneeded shortcut for Search Notes

Also conflicting with the Focus Mode shortcut (⌘⇧F) here due to a change in the KeyboardEvent. (Now needs an explicit check for shiftKey)

* Fix Note List navigation shortcuts

* Fix Close Note shortcut (narrow width screens)

* Remove unneeded filter on menu array

Rendered unnecessary by electron/electron#13992

* Update electron-builder and electron-updater

# Conflicts:
#	package.json

* Fix Select All & Copy in Markdown preview

* Remove CJK crash workaround

#1171

* Try electron-builder 20.38.4

* Revert "Remove unneeded filter on menu array"

This reverts commit 90a94e7.

* Revert electron-builder to 20.28.2

* Try electron-builder 20.33.2

* Try electron-builder 20.30.0

* Try electron-builder 20.31.2

* Try electron-builder 20.32.0

* Try electron-builder 20.33.1

* Revert "Try electron-builder 20.33.1"

This reverts commit d834229.
  • Loading branch information
mirka committed Feb 5, 2019
1 parent 6805301 commit a73f3d7
Show file tree
Hide file tree
Showing 12 changed files with 555 additions and 456 deletions.
23 changes: 11 additions & 12 deletions desktop/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,20 @@ module.exports = function main() {
mainWindow.once('ready-to-show', mainWindow.show);
};

const shouldQuit = app.makeSingleInstance(() => {
if (!mainWindow) {
return;
}
const gotTheLock = app.requestSingleInstanceLock();

// Focus the main window if a second instance is attempted to be created
if (mainWindow.isMinimized()) {
mainWindow.restore();
app.on('second-instance', () => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
mainWindow.focus();
}
mainWindow.focus();
});

if (shouldQuit) {
app.quit();
return;
if (!gotTheLock) {
return app.quit();
}

// Quit when all windows are closed.
Expand Down Expand Up @@ -182,4 +181,4 @@ module.exports = function main() {
// initialization and is ready to create browser windows.
app.on('ready', activateWindow);
app.on('activate', activateWindow);
};
};
2 changes: 2 additions & 0 deletions lib/app-layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ export const AppLayout = ({
toolbar={<NoteToolbar note={note} />}
/>
<NoteEditor
isSmallScreen={isSmallScreen}
note={note}
noteBucket={noteBucket}
onNoteClosed={onNoteClosed}
onUpdateContent={onUpdateContent}
tags={
get(note, 'data.tags', []) /* flattened to trigger re-render */
Expand Down
9 changes: 0 additions & 9 deletions lib/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,6 @@ export const App = connect(mapStateToProps, mapDispatchToProps)(
return false;
}

// focus search field
if (cmdOrCtrl && 'f' === key) {
this.props.setSearchFocus();

event.stopPropagation();
event.preventDefault();
return false;
}

return true;
};

Expand Down
34 changes: 0 additions & 34 deletions lib/editor/tab-decorator.js

This file was deleted.

2 changes: 0 additions & 2 deletions lib/note-content-editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import { filterHasText, searchPattern } from './utils/filter-notes';
import matchingTextDecorator from './editor/matching-text-decorator';
import checkboxDecorator from './editor/checkbox-decorator';
import tabDecorator from './editor/tab-decorator';
import { removeCheckbox, shouldRemoveCheckbox } from './editor/checkbox-utils';
import { taskRegex } from './note-detail/toggle-task/constants';
import insertOrRemoveCheckboxes from './editor/insert-or-remove-checkboxes';
Expand Down Expand Up @@ -180,7 +179,6 @@ export default class NoteContentEditor extends Component {
compact([
filterHasText(filter) && matchingTextDecorator(searchPattern(filter)),
checkboxDecorator(this.replaceRangeWithText),
tabDecorator(),
])
)
);
Expand Down
2 changes: 0 additions & 2 deletions lib/note-detail/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@
.note-detail-markdown {
@import '../node_modules/highlight.js/styles/solarized-light.css';

user-select: text;

h1,
h2,
h3,
Expand Down
7 changes: 5 additions & 2 deletions lib/note-editor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ export class NoteEditor extends Component {
closeNote: PropTypes.func.isRequired,
editorMode: PropTypes.oneOf(['edit', 'markdown']),
isEditorActive: PropTypes.bool.isRequired,
isSmallScreen: PropTypes.bool.isRequired,
filter: PropTypes.string.isRequired,
markdownEnabled: PropTypes.bool.isRequired,
note: PropTypes.object,
noteBucket: PropTypes.object.isRequired,
fontSize: PropTypes.number,
onNoteClosed: PropTypes.func.isRequired,
onUpdateContent: PropTypes.func.isRequired,
revision: PropTypes.object,
setEditorMode: PropTypes.func.isRequired,
Expand All @@ -42,7 +44,7 @@ export class NoteEditor extends Component {
}

handleShortcut = event => {
const { ctrlKey, key, metaKey } = event;
const { ctrlKey, key, metaKey, shiftKey } = event;

const cmdOrCtrl = ctrlKey || metaKey;

Expand All @@ -59,8 +61,9 @@ export class NoteEditor extends Component {
}

// open note list - shift + n
if (cmdOrCtrl && 'N' === key) {
if (this.props.isSmallScreen && cmdOrCtrl && shiftKey && 'n' === key) {
this.props.closeNote();
this.props.onNoteClosed();

event.stopPropagation();
event.preventDefault();
Expand Down
1 change: 1 addition & 0 deletions lib/note-editor/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
display: flex;
flex-direction: column;
flex: 1 0 auto;
user-select: text;
}
4 changes: 2 additions & 2 deletions lib/note-list/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,15 @@ export class NoteList extends Component {

const cmdOrCtrl = ctrlKey || metaKey;

if (cmdOrCtrl && shiftKey && (key === 'ArrowUp' || key === 'K')) {
if (cmdOrCtrl && shiftKey && (key === 'ArrowUp' || key === 'k')) {
this.props.onSelectNote(this.props.nextNote.id);

event.stopPropagation();
event.preventDefault();
return false;
}

if (cmdOrCtrl && shiftKey && (key === 'ArrowDown' || key === 'J')) {
if (cmdOrCtrl && shiftKey && (key === 'ArrowDown' || key === 'j')) {
this.props.onSelectNote(this.props.prevNote.id);

event.stopPropagation();
Expand Down
1 change: 1 addition & 0 deletions lib/tag-input/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
display: block;
color: lighten($gray, 10%);
background: transparent;
user-select: none;
}

.tag-input__entry {
Expand Down

0 comments on commit a73f3d7

Please sign in to comment.