Skip to content

Commit

Permalink
re-layout after focus mode change (#2371)
Browse files Browse the repository at this point in the history
  • Loading branch information
codebykat authored Sep 30, 2020
1 parent b325afc commit 386c322
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/note-content-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type OwnProps = {
type StateProps = {
editorSelection: [number, number, 'RTL' | 'LTR'];
fontSize: number;
isFocusMode: boolean;
keyboardShortcuts: boolean;
lineLength: T.LineLength;
noteId: T.EntityId;
Expand Down Expand Up @@ -220,7 +221,10 @@ class NoteContentEditor extends Component<Props> {
this.editor?.setSelection(new this.monaco.Range(0, 0, 0, 0));
}

if (this.props.lineLength !== prevProps.lineLength) {
if (
this.props.lineLength !== prevProps.lineLength ||
this.props.isFocusMode !== prevProps.isFocusMode
) {
// @TODO: This timeout is necessary for no apparent reason
// Figure out why and take it out!
setTimeout(() => {
Expand Down Expand Up @@ -965,6 +969,7 @@ const mapStateToProps: S.MapState<StateProps> = (state) => ({
'LTR',
],
fontSize: state.settings.fontSize,
isFocusMode: state.settings.focusModeEnabled,
keyboardShortcuts: state.settings.keyboardShortcuts,
lineLength: state.settings.lineLength,
noteId: state.ui.openedNote,
Expand Down

0 comments on commit 386c322

Please sign in to comment.