Skip to content

Commit a7ead67

Browse files
author
Callum Booth
committed
moves orientation button to view menu
1 parent 2f16784 commit a7ead67

File tree

4 files changed

+19
-78
lines changed

4 files changed

+19
-78
lines changed

browser/main/Detail/MarkdownNoteDetail.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import RestoreButton from './RestoreButton'
2323
import PermanentDeleteButton from './PermanentDeleteButton'
2424
import InfoButton from './InfoButton'
2525
import ToggleModeButton from './ToggleModeButton'
26-
import ToggleStackDirectionButton from './ToggleStackDirectionButton'
2726
import InfoPanel from './InfoPanel'
2827
import InfoPanelTrashed from './InfoPanelTrashed'
2928
import { formatDate } from 'browser/lib/date-formatter'
@@ -60,13 +59,15 @@ class MarkdownNoteDetail extends React.Component {
6059
this.toggleLockButton = this.handleToggleLockButton.bind(this)
6160
this.generateToc = this.handleGenerateToc.bind(this)
6261
this.handleUpdateContent = this.handleUpdateContent.bind(this)
62+
this.handleSwitchStackDirection = this.handleSwitchStackDirection.bind(this)
6363
}
6464

6565
focus() {
6666
this.refs.content.focus()
6767
}
6868

6969
componentDidMount() {
70+
ee.on('editor:orientation', this.handleSwitchStackDirection)
7071
ee.on('topbar:togglelockbutton', this.toggleLockButton)
7172
ee.on('topbar:toggledirectionbutton', () => this.handleSwitchDirection())
7273
ee.on('topbar:togglemodebutton', () => {
@@ -393,13 +394,16 @@ class MarkdownNoteDetail extends React.Component {
393394
)
394395
}
395396

396-
handleSwitchStackDirection(type) {
397-
this.setState({ isStacking: type }, () => {
398-
this.focus()
399-
const newConfig = Object.assign({}, this.props.config)
400-
newConfig.ui.isStacking = type
401-
ConfigManager.set(newConfig)
402-
})
397+
handleSwitchStackDirection() {
398+
this.setState(
399+
prevState => ({ isStacking: !prevState.isStacking }),
400+
() => {
401+
this.focus()
402+
const newConfig = Object.assign({}, this.props.config)
403+
newConfig.ui.isStacking = this.state.isStacking
404+
ConfigManager.set(newConfig)
405+
}
406+
)
403407
}
404408

405409
handleSwitchDirection() {
@@ -476,7 +480,7 @@ class MarkdownNoteDetail extends React.Component {
476480

477481
render() {
478482
const { data, dispatch, location, config } = this.props
479-
const { note, editorType, isStacking } = this.state
483+
const { note, editorType } = this.state
480484
const storageKey = note.storage
481485
const folderKey = note.folder
482486

@@ -553,12 +557,6 @@ class MarkdownNoteDetail extends React.Component {
553557
/>
554558
</div>
555559
<div styleName='info-right'>
556-
{editorType === 'SPLIT' ? (
557-
<ToggleStackDirectionButton
558-
onClick={e => this.handleSwitchStackDirection(e)}
559-
isStacking={isStacking}
560-
/>
561-
) : null}
562560
<ToggleModeButton
563561
onClick={e => this.handleSwitchMode(e)}
564562
editorType={editorType}

browser/main/Detail/ToggleStackDirectionButton.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

browser/main/Detail/ToggleStackDirectionButton.styl

Lines changed: 0 additions & 31 deletions
This file was deleted.

lib/main-menu.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,12 @@ const view = {
314314
mainWindow.webContents.send('editor:fullscreen')
315315
}
316316
},
317+
{
318+
label: 'Toggle Editor Orientation',
319+
click() {
320+
mainWindow.webContents.send('editor:orientation')
321+
}
322+
},
317323
{
318324
type: 'separator'
319325
},

0 commit comments

Comments
 (0)