1
0
mirror of https://github.com/BoostIo/Boostnote synced 2026-06-07 15:13:25 +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
@@ -196,6 +196,10 @@ class MarkdownNoteDetail extends React.Component {
} }
} }
handleFullScreenButton (e) {
ee.emit('editor:fullscreen')
}
handleLockButtonMouseDown (e) { handleLockButtonMouseDown (e) {
e.preventDefault() e.preventDefault()
ee.emit('editor:lock') ee.emit('editor:lock')
@@ -287,6 +291,11 @@ class MarkdownNoteDetail extends React.Component {
</g> </g>
</svg> </svg>
</button> </button>
<button styleName='control-fullScreenButton'
onMouseDown={(e) => this.handleFullScreenButton(e)}
>
<i className='fa fa-arrows-alt' styleName='fullScreen-button' />
</button>
</div> </div>
</div> </div>
@@ -31,6 +31,10 @@
float right float right
topBarButtonLight() topBarButtonLight()
.control-fullScreenButton
float right
topBarButtonLight()
.body .body
absolute left right absolute left right
left $note-detail-left-margin left $note-detail-left-margin
@@ -55,3 +59,6 @@ body[data-theme="dark"]
.control-trashButton .control-trashButton
topBarButtonDark() topBarButtonDark()
.control-fullScreenButton
topBarButtonDark()
+9
View File
@@ -190,6 +190,10 @@ class SnippetNoteDetail extends React.Component {
} }
} }
handleFullScreenButton (e) {
ee.emit('editor:fullscreen')
}
handleTabPlusButtonClick (e) { handleTabPlusButtonClick (e) {
this.addSnippet() this.addSnippet()
} }
@@ -527,6 +531,11 @@ class SnippetNoteDetail extends React.Component {
</g> </g>
</svg> </svg>
</button> </button>
<button styleName='control-fullScreenButton'
onMouseDown={(e) => this.handleFullScreenButton(e)}
>
<i className='fa fa-arrows-alt' styleName='fullScreen-button' />
</button>
</div> </div>
</div> </div>
@@ -70,6 +70,10 @@
float right float right
topBarButtonLight() topBarButtonLight()
.control-fullScreenButton
float right
topBarButtonLight()
body[data-theme="dark"] body[data-theme="dark"]
.root .root
border-color $ui-dark-borderColor border-color $ui-dark-borderColor
@@ -102,3 +106,6 @@ body[data-theme="dark"]
.control-trashButton .control-trashButton
topBarButtonDark() topBarButtonDark()
.control-fullScreenButton
topBarButtonDark()
+35 -1
View File
@@ -13,6 +13,7 @@ import modal from 'browser/main/lib/modal'
import InitModal from 'browser/main/modals/InitModal' import InitModal from 'browser/main/modals/InitModal'
import mixpanel from 'browser/main/lib/mixpanel' import mixpanel from 'browser/main/lib/mixpanel'
import mobileAnalytics from 'browser/main/lib/awsMobileAnalyticsConfig' import mobileAnalytics from 'browser/main/lib/awsMobileAnalyticsConfig'
import eventEmitter from 'browser/main/lib/eventEmitter'
function focused () { function focused () {
mixpanel.track('MAIN_FOCUSED') mixpanel.track('MAIN_FOCUSED')
@@ -30,8 +31,13 @@ class Main extends React.Component {
isRightSliderFocused: false, isRightSliderFocused: false,
listWidth: config.listWidth, listWidth: config.listWidth,
navWidth: config.navWidth, navWidth: config.navWidth,
isLeftSliderFocused: false isLeftSliderFocused: false,
fullScreen: false,
noteDetailWidth: 0,
mainBodyWidth: 0
} }
this.toggleFullScreen = () => this.handleFullScreenButton()
} }
getChildContext () { getChildContext () {
@@ -66,11 +72,13 @@ class Main extends React.Component {
} }
}) })
eventEmitter.on('editor:fullscreen', this.toggleFullScreen)
window.addEventListener('focus', focused) window.addEventListener('focus', focused)
} }
componentWillUnmount () { componentWillUnmount () {
window.removeEventListener('focus', focused) window.removeEventListener('focus', focused)
eventEmitter.off('editor:fullscreen', this.toggleFullScreen)
} }
handleLeftSlideMouseDown (e) { 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 () { render () {
let { config } = this.props let { config } = this.props
@@ -176,6 +209,7 @@ class Main extends React.Component {
</div> </div>
} }
<div styleName={config.isSideNavFolded ? 'body--expanded' : 'body'} <div styleName={config.isSideNavFolded ? 'body--expanded' : 'body'}
id='main-body'
ref='body' ref='body'
style={{left: config.isSideNavFolded ? 44 : this.state.navWidth}} style={{left: config.isSideNavFolded ? 44 : this.state.navWidth}}
> >
+2
View File
@@ -13,10 +13,12 @@
absolute top bottom absolute top bottom
top -2px top -2px
width 0 width 0
z-index 0
.slider-right .slider-right
@extend .slider @extend .slider
width 1px width 1px
z-index 0
.slider--active .slider--active
@extend .slider @extend .slider