1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-27 08:31:50 +00:00

Merge pull request #632 from asmsuechan/handling-pull-602

Handling pull 602
This commit is contained in:
SuenagaRyota
2017-06-12 17:43:42 +09:00
committed by GitHub
6 changed files with 69 additions and 1 deletions

View File

@@ -196,6 +196,10 @@ class MarkdownNoteDetail extends React.Component {
}
}
handleFullScreenButton (e) {
ee.emit('editor:fullscreen')
}
handleLockButtonMouseDown (e) {
e.preventDefault()
ee.emit('editor:lock')
@@ -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>

View File

@@ -31,6 +31,10 @@
float right
topBarButtonLight()
.control-fullScreenButton
float right
topBarButtonLight()
.body
absolute left right
left $note-detail-left-margin
@@ -55,3 +59,6 @@ body[data-theme="dark"]
.control-trashButton
topBarButtonDark()
.control-fullScreenButton
topBarButtonDark()

View File

@@ -190,6 +190,10 @@ class SnippetNoteDetail extends React.Component {
}
}
handleFullScreenButton (e) {
ee.emit('editor:fullscreen')
}
handleTabPlusButtonClick (e) {
this.addSnippet()
}
@@ -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>

View File

@@ -70,6 +70,10 @@
float right
topBarButtonLight()
.control-fullScreenButton
float right
topBarButtonLight()
body[data-theme="dark"]
.root
border-color $ui-dark-borderColor
@@ -102,3 +106,6 @@ body[data-theme="dark"]
.control-trashButton
topBarButtonDark()
.control-fullScreenButton
topBarButtonDark()

View File

@@ -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')
@@ -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 () {
@@ -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) {
@@ -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
@@ -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}}
>

View File

@@ -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