react-ace
Advanced tools
Comparing version 5.4.0 to 5.5.0
# Changelog | ||
## Next Minor Release - TBD | ||
## Future Release - TBD | ||
@@ -8,2 +8,6 @@ * Fully move to TypeScript interally | ||
## 5.5.0 | ||
* Adds the onInput event | ||
## 5.4.0 | ||
@@ -10,0 +14,0 @@ |
@@ -72,2 +72,3 @@ # Ace Editor | ||
|onBlur| | Function | triggered by editor `blur` event| | ||
|onInput| | Function | triggered by editor `input` event| | ||
|onScroll| | Function | triggered by editor `scroll` event| | ||
@@ -74,0 +75,0 @@ |onValidate| | Function | triggered, when annotations are changed| |
@@ -94,2 +94,9 @@ # Frequently Asked Questions | ||
## How do I get selected text ? | ||
```javascript | ||
const selectedText = this.refs.aceEditor.editor.getSelectedText(); | ||
// selectedText contains the selected text. | ||
} | ||
``` | ||
## How do I add markers? | ||
@@ -96,0 +103,0 @@ ```javascript |
@@ -5,7 +5,7 @@ # Split Editor | ||
## Demo | ||
## Demo | ||
http://securingsincity.github.io/react-ace/split.html | ||
## Example Code | ||
## Example Code | ||
@@ -43,3 +43,3 @@ ```javascript | ||
|splits| 2 | Number | Number of views to have | | ||
|orientation| 'beside' | String | The orientation of the splits either `beside` or `below` | | ||
|orientation| 'beside' | String | The orientation of the splits either `beside` or `below` | | ||
|theme| ''| String |theme to use| | ||
@@ -72,2 +72,3 @@ |value | ''| Array of Strings | value you want to populate in each code editor| | ||
|onBlur| | Function | triggered by editor `blur` event| | ||
|onInput| | Function | triggered by editor `input` event| | ||
|onScroll| | Function | triggered by editor `scroll` event| | ||
@@ -74,0 +75,0 @@ |editorProps| | Object | properties to apply directly to the Ace editor instance| |
@@ -106,2 +106,3 @@ 'use strict'; | ||
this.editor.on('change', this.onChange); | ||
this.editor.on('input', this.onInput); | ||
this.editor.getSession().selection.on('changeSelection', this.onSelectionChange); | ||
@@ -272,2 +273,9 @@ if (onValidate) { | ||
}, { | ||
key: 'onInput', | ||
value: function onInput(event) { | ||
if (this.props.onInput) { | ||
this.props.onInput(event); | ||
} | ||
} | ||
}, { | ||
key: 'onFocus', | ||
@@ -391,2 +399,3 @@ value: function onFocus(event) { | ||
onFocus: _propTypes2.default.func, | ||
onInput: _propTypes2.default.func, | ||
onBlur: _propTypes2.default.func, | ||
@@ -393,0 +402,0 @@ onScroll: _propTypes2.default.func, |
@@ -8,5 +8,5 @@ 'use strict'; | ||
var editorEvents = ['onChange', 'onFocus', 'onBlur', 'onCopy', 'onPaste', 'onSelectionChange', 'onScroll', 'handleOptions', 'updateRef']; | ||
var editorEvents = ['onChange', 'onFocus', 'onInput', 'onBlur', 'onCopy', 'onPaste', 'onSelectionChange', 'onScroll', 'handleOptions', 'updateRef']; | ||
exports.editorOptions = editorOptions; | ||
exports.editorEvents = editorEvents; |
@@ -124,2 +124,3 @@ 'use strict'; | ||
editor.on('blur', _this2.onBlur); | ||
editor.on('input', _this2.onInput); | ||
editor.on('copy', _this2.onCopy); | ||
@@ -303,12 +304,19 @@ editor.on('paste', _this2.onPaste); | ||
key: 'onFocus', | ||
value: function onFocus() { | ||
value: function onFocus(event) { | ||
if (this.props.onFocus) { | ||
this.props.onFocus(); | ||
this.props.onFocus(event); | ||
} | ||
} | ||
}, { | ||
key: 'onInput', | ||
value: function onInput(event) { | ||
if (this.props.onInput) { | ||
this.props.onInput(event); | ||
} | ||
} | ||
}, { | ||
key: 'onBlur', | ||
value: function onBlur() { | ||
value: function onBlur(event) { | ||
if (this.props.onBlur) { | ||
this.props.onBlur(); | ||
this.props.onBlur(event); | ||
} | ||
@@ -421,2 +429,3 @@ } | ||
onFocus: _propTypes2.default.func, | ||
onInput: _propTypes2.default.func, | ||
onBlur: _propTypes2.default.func, | ||
@@ -423,0 +432,0 @@ onScroll: _propTypes2.default.func, |
{ | ||
"name": "react-ace", | ||
"version": "5.4.0", | ||
"version": "5.5.0", | ||
"description": "A react component for Ace Editor", | ||
@@ -21,3 +21,3 @@ "main": "lib/index.js", | ||
"prepublishOnly": "npm run clean && npm run build", | ||
"test": "mocha --compilers js:babel-core/register --require tests/setup.js --recursive tests/**/*.spec.js", | ||
"test": "mocha --require babel-register --require tests/setup.js tests/**/*.spec.js --exit", | ||
"coverage": "nyc npm run test" | ||
@@ -50,3 +50,3 @@ }, | ||
"enzyme-adapter-react-16": "^1.0.1", | ||
"eslint": "4.8.0", | ||
"eslint": "4.10.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
@@ -56,3 +56,3 @@ "eslint-plugin-jsx-a11y": "^6.0.0", | ||
"jsdom": "^11.0.0", | ||
"mocha": "3.5.3", | ||
"mocha": "4.0.1", | ||
"nyc": "11.2.1", | ||
@@ -63,5 +63,5 @@ "react": "^16.0.0", | ||
"rimraf": "2.6.2", | ||
"sinon": "4.0.1", | ||
"webpack": "3.5.6", | ||
"webpack-dev-server": "2.9.1" | ||
"sinon": "4.0.2", | ||
"webpack": "3.8.1", | ||
"webpack-dev-server": "2.9.3" | ||
}, | ||
@@ -68,0 +68,0 @@ "keywords": [ |
@@ -64,2 +64,3 @@ import ace from 'brace' | ||
this.editor.on('change', this.onChange); | ||
this.editor.on('input', this.onInput); | ||
this.editor.getSession().selection.on('changeSelection', this.onSelectionChange); | ||
@@ -222,3 +223,7 @@ if (onValidate) { | ||
} | ||
onInput(event) { | ||
if (this.props.onInput) { | ||
this.props.onInput(event) | ||
} | ||
} | ||
onFocus(event) { | ||
@@ -317,2 +322,3 @@ if (this.props.onFocus) { | ||
onFocus: PropTypes.func, | ||
onInput: PropTypes.func, | ||
onBlur: PropTypes.func, | ||
@@ -319,0 +325,0 @@ onScroll: PropTypes.func, |
@@ -15,2 +15,3 @@ const editorOptions = [ | ||
'onFocus', | ||
'onInput', | ||
'onBlur', | ||
@@ -17,0 +18,0 @@ 'onCopy', |
@@ -77,2 +77,3 @@ import ace from 'brace' | ||
editor.on('blur', this.onBlur); | ||
editor.on('input', this.onInput); | ||
editor.on('copy', this.onCopy); | ||
@@ -251,11 +252,17 @@ editor.on('paste', this.onPaste); | ||
onFocus() { | ||
onFocus(event) { | ||
if (this.props.onFocus) { | ||
this.props.onFocus(); | ||
this.props.onFocus(event); | ||
} | ||
} | ||
onBlur() { | ||
onInput(event) { | ||
if (this.props.onInput) { | ||
this.props.onInput(event); | ||
} | ||
} | ||
onBlur(event) { | ||
if (this.props.onBlur) { | ||
this.props.onBlur(); | ||
this.props.onBlur(event); | ||
} | ||
@@ -347,2 +354,3 @@ } | ||
onFocus: PropTypes.func, | ||
onInput: PropTypes.func, | ||
onBlur: PropTypes.func, | ||
@@ -349,0 +357,0 @@ onScroll: PropTypes.func, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2034616
37993