Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Electron 4.0.2 #1172

Merged
merged 18 commits into from
Feb 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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