Skip to content

Commit

Permalink
Merge pull request #205 from securingsincity/split-out-export
Browse files Browse the repository at this point in the history
Split out export and initial v5.0 work.
  • Loading branch information
securingsincity authored May 26, 2017
2 parents 41ae361 + bc7a677 commit 0de324f
Show file tree
Hide file tree
Showing 13 changed files with 1,241 additions and 41 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- Love react-ace? Please consider supporting our collective: 👉 https://opencollective.com/react-ace/donate -->
56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# React-Ace

[![Greenkeeper badge](https://badges.greenkeeper.io/securingsincity/react-ace.svg)](https://greenkeeper.io/)
[![Backers on Open Collective](https://opencollective.com/react-ace/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/react-ace/sponsors/badge.svg)](#sponsors) [![Greenkeeper badge](https://badges.greenkeeper.io/securingsincity/react-ace.svg)](https://greenkeeper.io/)

[![npm version](https://badge.fury.io/js/react-ace.svg)](http://badge.fury.io/js/react-ace)
[![Build Status](https://travis-ci.org/securingsincity/react-ace.svg)](https://travis-ci.org/securingsincity/react-ace)
Expand Down Expand Up @@ -132,3 +132,57 @@ All modes, themes, and keyboard handlers should be required through ```brace```

* vim
* emacs


## Backers

Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/react-ace#backer)]

<a href="https://opencollective.com/react-ace/backer/0/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/1/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/1/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/2/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/2/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/3/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/3/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/4/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/4/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/5/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/5/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/6/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/6/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/7/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/7/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/8/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/8/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/9/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/9/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/10/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/10/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/11/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/11/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/12/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/12/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/13/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/13/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/14/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/14/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/15/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/15/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/16/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/16/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/17/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/17/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/18/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/18/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/19/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/19/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/20/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/20/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/21/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/21/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/22/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/22/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/23/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/23/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/24/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/24/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/25/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/25/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/26/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/26/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/27/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/27/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/28/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/backer/29/website" target="_blank"><img src="https://opencollective.com/react-ace/backer/29/avatar.svg"></a>


## Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/react-ace#sponsor)]

<a href="https://opencollective.com/react-ace/sponsor/0/website" target="_blank"><img src="https://opencollective.com/react-ace/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/sponsor/1/website" target="_blank"><img src="https://opencollective.com/react-ace/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/sponsor/2/website" target="_blank"><img src="https://opencollective.com/react-ace/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/sponsor/3/website" target="_blank"><img src="https://opencollective.com/react-ace/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/sponsor/4/website" target="_blank"><img src="https://opencollective.com/react-ace/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/sponsor/5/website" target="_blank"><img src="https://opencollective.com/react-ace/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/sponsor/6/website" target="_blank"><img src="https://opencollective.com/react-ace/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/sponsor/7/website" target="_blank"><img src="https://opencollective.com/react-ace/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/sponsor/8/website" target="_blank"><img src="https://opencollective.com/react-ace/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/react-ace/sponsor/9/website" target="_blank"><img src="https://opencollective.com/react-ace/sponsor/9/avatar.svg"></a>


2 changes: 1 addition & 1 deletion example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ <h1>React-Ace</h1>
<div id="example"></div>
</div>
</div>
<script src="./static/bundle.js"></script>
<script src="./static/index.js"></script>
</body>
</html>
4 changes: 0 additions & 4 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import React, { Component } from 'react';
import { render } from 'react-dom';
import AceEditor from '../src/ace.jsx';
import brace from 'brace';


import 'brace/mode/jsx';


const languages = [
'javascript',
'java',
Expand Down
17 changes: 17 additions & 0 deletions example/split.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Split Editor</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.4.1/css/bulma.min.css"></link>
</head>
<body>
<div class="container">
<div class="content">
<h1>React-Ace: Split Editor Example</h1>
<div id="example"></div>
</div>
</div>
<script src="./static/split.js"></script>
</body>
</html>
286 changes: 286 additions & 0 deletions example/split.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
import React, { Component } from 'react';
import { render } from 'react-dom';
import SplitAceEditor from '../src/split.jsx';

import 'brace/mode/jsx';


const languages = [
'javascript',
'java',
'python',
'xml',
'ruby',
'sass',
'markdown',
'mysql',
'json',
'html',
'handlebars',
'golang',
'csharp',
'elixir',
'typescript',
'css'
]

const themes = [
'monokai',
'github',
'tomorrow',
'kuroir',
'twilight',
'xcode',
'textmate',
'solarized_dark',
'solarized_light',
'terminal',
]

languages.forEach((lang) => {
require(`brace/mode/${lang}`)
})

themes.forEach((theme) => {
require(`brace/theme/${theme}`)
})
/*eslint-disable no-alert, no-console */
import 'brace/ext/language_tools';


const defaultValue = [
`function onLoad(editor) {
console.log(\"i\'ve loaded\");
}`,
'const secondInput = "me i am the second input";'
];
class App extends Component {
onLoad() {
console.log('i\'ve loaded');
}
onChange(newValue) {
console.log('change', newValue);
this.setState({
value: newValue
})
}

onSelectionChange(newValue, event) {
console.log('select-change', newValue);
console.log('select-change-event', event);
}
setTheme(e) {
this.setState({
theme: e.target.value
})
}
setMode(e) {
this.setState({
mode: e.target.value
})
}
setBoolean(name, value) {
this.setState({
[name]: value
})
}
setFontSize(e) {
this.setState({
fontSize: parseInt(e.target.value,10)
})
}
setSplits(e) {
this.setState({
splits: parseInt(e.target.value,10)
})
}
setOrientation(e) {
this.setState({
orientation: e.target.value
})
}
constructor(props) {
super(props);
this.state = {
splits: 2,
orientation: 'beside',
value: defaultValue,
theme: 'github',
mode: 'javascript',
enableBasicAutocompletion: false,
enableLiveAutocompletion: false,
fontSize: 14,
showGutter: true,
showPrintMargin: true,
highlightActiveLine: true,
enableSnippets: false,
showLineNumbers: true,
};
this.setTheme = this.setTheme.bind(this);
this.setMode = this.setMode.bind(this);
this.onChange = this.onChange.bind(this);
this.setFontSize = this.setFontSize.bind(this);
this.setBoolean = this.setBoolean.bind(this);
this.setSplits = this.setSplits.bind(this);
this.setOrientation = this.setOrientation.bind(this);
}
render() {
return (
<div className="columns">
<div className="column">
<div className="field">
<label>
Mode:
</label>
<p className="control">
<span className="select">
<select name="mode" onChange={this.setMode} value={this.state.mode}>
{languages.map((lang) => <option key={lang} value={lang}>{lang}</option>)}
</select>
</span>
</p>
</div>

<div className="field">
<label>
Theme:
</label>
<p className="control">
<span className="select">
<select name="Theme" onChange={this.setTheme} value={this.state.theme}>
{themes.map((lang) => <option key={lang} value={lang}>{lang}</option>)}
</select></span>
</p>
</div>

<div className="field">
<label>
Font Size:
</label>
<p className="control">
<span className="select">
<select name="Font Size" onChange={this.setFontSize} value={this.state.fontSize}>
{[10,12,14,16,18,20,24,28,32,40].map((lang) => <option key={lang} value={lang}>{lang}</option>)}
</select></span>
</p>
</div>

<div className="field">
<label>
Number of Splits:
</label>
<p className="control">
<span className="select">
<select name="splits" onChange={this.setSplits} value={this.state.splits}>
{[1,2,3,4].map((lang) => <option key={lang} value={lang}>{lang}</option>)}
</select></span>
</p>
</div>

<div className="field">
<label>
Orientation:
</label>
<p className="control">
<span className="select">
<select name="orientation" onChange={this.setOrientation} value={this.state.orientation}>
{['beside', 'below'].map((lang) => <option key={lang} value={lang}>{lang}</option>)}
</select></span>
</p>
</div>
<div className="field">
<p className="control">
<label className="checkbox">
<input type="checkbox" checked={this.state.enableBasicAutocompletion} onChange={(e) => this.setBoolean('enableBasicAutocompletion', e.target.checked)} />
Enable Basic Autocomplete
</label>
</p>
</div>
<div className="field">
<p className="control">
<label className="checkbox">
<input type="checkbox" checked={this.state.enableLiveAutocompletion} onChange={(e) => this.setBoolean('enableLiveAutocompletion', e.target.checked)} />
Enable Live Autocomplete
</label>
</p>
</div>
<div className="field">
<p className="control">
<label className="checkbox">
<input type="checkbox" checked={this.state.showGutter} onChange={(e) => this.setBoolean('showGutter', e.target.checked)} />
Show Gutter
</label>
</p>
</div>
<div className="field">
<p className="control">
<label className="checkbox">
<input type="checkbox" checked={this.state.showPrintMargin} onChange={(e) => this.setBoolean('showPrintMargin', e.target.checked)} />
Show Print Margin
</label>
</p>
</div>
<div className="field">
<p className="control">
<label className="checkbox">
<input type="checkbox" checked={this.state.highlightActiveLine} onChange={(e) => this.setBoolean('highlightActiveLine', e.target.checked)} />
Highlight Active Line
</label>
</p>
</div>
<div className="field">
<p className="control">
<label className="checkbox">
<input type="checkbox" checked={this.state.enableSnippets} onChange={(e) => this.setBoolean('enableSnippets', e.target.checked)} />
Enable Snippets
</label>
</p>
</div>
<div className="field">
<p className="control">
<label className="checkbox">
<input type="checkbox" checked={this.state.showLineNumbers} onChange={(e) => this.setBoolean('showLineNumbers', e.target.checked)} />
Show Line Numbers
</label>
</p>
</div>


</div>
<div className="examples column">
<h2>Editor</h2>
<SplitAceEditor
mode={this.state.mode}
orientation={this.state.orientation}
splits={this.state.splits}
theme={this.state.theme}
name="blah2"
onLoad={this.onLoad}
onChange={this.onChange}
onSelectionChange={this.onSelectionChange}
fontSize={this.state.fontSize}
height="1000px"
width="1000px"
showPrintMargin={this.state.showPrintMargin}
showGutter={this.state.showGutter}
highlightActiveLine={this.state.highlightActiveLine}
value={this.state.value}
setOptions={{
displayIndentGuides: false,
enableBasicAutocompletion: this.state.enableBasicAutocompletion,
enableLiveAutocompletion: this.state.enableLiveAutocompletion,
enableSnippets: this.state.enableSnippets,
showLineNumbers: this.state.showLineNumbers,
tabSize: 2,
}}/>
</div>
</div>
);
}
}


render(
<App />,
document.getElementById('example')
);
Loading

0 comments on commit 0de324f

Please sign in to comment.