Skip to content

Handling pull 602 #632

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

Merged
merged 13 commits into from
Jun 12, 2017
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions browser/main/Detail/MarkdownNoteDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ class MarkdownNoteDetail extends React.Component {
}
}

handleFullScreenButton (e) {
ee.emit('editor:fullscreen')
}

handleLockButtonMouseDown (e) {
e.preventDefault()
ee.emit('editor:lock')
Expand Down Expand Up @@ -287,6 +291,11 @@ class MarkdownNoteDetail extends React.Component {
</g>
</svg>
</button>
<button styleName='control-fullScreenButton'
onMouseDown={(e) => this.handleFullScreenButton(e)}
>
<i className='fa fa-arrows-alt' styleName='fullScreen-button' />
</button>
</div>
</div>

Expand Down
7 changes: 7 additions & 0 deletions browser/main/Detail/MarkdownNoteDetail.styl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
float right
topBarButtonLight()

.control-fullScreenButton
float right
topBarButtonLight()

.body
absolute left right
left $note-detail-left-margin
Expand All @@ -55,3 +59,6 @@ body[data-theme="dark"]

.control-trashButton
topBarButtonDark()

.control-fullScreenButton
topBarButtonDark()
9 changes: 9 additions & 0 deletions browser/main/Detail/SnippetNoteDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ class SnippetNoteDetail extends React.Component {
}
}

handleFullScreenButton (e) {
ee.emit('editor:fullscreen')
}

handleTabPlusButtonClick (e) {
this.addSnippet()
}
Expand Down Expand Up @@ -527,6 +531,11 @@ class SnippetNoteDetail extends React.Component {
</g>
</svg>
</button>
<button styleName='control-fullScreenButton'
onMouseDown={(e) => this.handleFullScreenButton(e)}
>
<i className='fa fa-arrows-alt' styleName='fullScreen-button' />
</button>
</div>
</div>

Expand Down
7 changes: 7 additions & 0 deletions browser/main/Detail/SnippetNoteDetail.styl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
float right
topBarButtonLight()

.control-fullScreenButton
float right
topBarButtonLight()

body[data-theme="dark"]
.root
border-color $ui-dark-borderColor
Expand Down Expand Up @@ -102,3 +106,6 @@ body[data-theme="dark"]

.control-trashButton
topBarButtonDark()

.control-fullScreenButton
topBarButtonDark()
36 changes: 35 additions & 1 deletion browser/main/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import modal from 'browser/main/lib/modal'
import InitModal from 'browser/main/modals/InitModal'
import mixpanel from 'browser/main/lib/mixpanel'
import mobileAnalytics from 'browser/main/lib/awsMobileAnalyticsConfig'
import eventEmitter from 'browser/main/lib/eventEmitter'

function focused () {
mixpanel.track('MAIN_FOCUSED')
Expand All @@ -30,8 +31,13 @@ class Main extends React.Component {
isRightSliderFocused: false,
listWidth: config.listWidth,
navWidth: config.navWidth,
isLeftSliderFocused: false
isLeftSliderFocused: false,
fullScreen: false,
noteDetailWidth: 0,
mainBodyWidth: 0
}

this.toggleFullScreen = () => this.handleFullScreenButton()
}

getChildContext () {
Expand Down Expand Up @@ -66,11 +72,13 @@ class Main extends React.Component {
}
})

eventEmitter.on('editor:fullscreen', this.toggleFullScreen)
window.addEventListener('focus', focused)
}

componentWillUnmount () {
window.removeEventListener('focus', focused)
eventEmitter.off('editor:fullscreen', this.toggleFullScreen)
}

handleLeftSlideMouseDown (e) {
Expand Down Expand Up @@ -147,6 +155,31 @@ class Main extends React.Component {
}
}

handleFullScreenButton (e) {
this.setState({ fullScreen: !this.state.fullScreen }, () => {
const noteDetail = document.querySelector('.NoteDetail')
const mainBody = document.querySelector('#main-body')

if (this.state.fullScreen) {
this.hideLeftLists(noteDetail, mainBody)
} else {
this.showLeftLists(noteDetail, mainBody)
}
})
}

hideLeftLists (noteDetail, mainBody) {
this.state.noteDetailWidth = noteDetail.style.left
this.state.mainBodyWidth = mainBody.style.left
noteDetail.style.left = '0px'
mainBody.style.left = '0px'
}

showLeftLists (noteDetail, mainBody) {
noteDetail.style.left = this.state.noteDetailWidth
mainBody.style.left = this.state.mainBodyWidth
}

render () {
let { config } = this.props

Expand Down Expand Up @@ -176,6 +209,7 @@ class Main extends React.Component {
</div>
}
<div styleName={config.isSideNavFolded ? 'body--expanded' : 'body'}
id='main-body'
ref='body'
style={{left: config.isSideNavFolded ? 44 : this.state.navWidth}}
>
Expand Down
2 changes: 2 additions & 0 deletions browser/main/Main.styl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
absolute top bottom
top -2px
width 0
z-index 0

.slider-right
@extend .slider
width 1px
z-index 0

.slider--active
@extend .slider
Expand Down