1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

Going LIte

This commit is contained in:
Rokt33r
2015-10-30 14:53:09 +09:00
parent ba0daf4452
commit d9442aa23c
40 changed files with 978 additions and 853 deletions

View File

@@ -1,5 +1,5 @@
import React from 'react'
let ReactDOM = require('react-dom')
import ReactDOM from 'react-dom'
var ace = window.ace
module.exports = React.createClass({
@@ -15,17 +15,21 @@ module.exports = React.createClass({
readOnly: false
}
},
componentWillReceiveProps: function (nextProps) {
if (nextProps.readOnly !== this.props.readOnly) {
this.editor.setReadOnly(!!nextProps.readOnly)
}
},
componentDidMount: function () {
var el = ReactDOM.findDOMNode(this.refs.target)
var editor = ace.edit(el)
var editor = this.editor = ace.edit(el)
editor.$blockScrolling = Infinity
editor.setValue(this.props.code)
editor.renderer.setShowGutter(true)
editor.setTheme('ace/theme/xcode')
editor.clearSelection()
if (this.props.readOnly) {
editor.setReadOnly(true)
}
editor.setReadOnly(!!this.props.readOnly)
var session = editor.getSession()
if (this.props.mode != null && this.props.mode.length > 0) {