Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-ace

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-ace - npm Package Compare versions

Comparing version 6.5.0 to 6.6.0

.nyc_output/03f0a6ad-14ab-435e-9f00-6bf5e1a4bd18.json

2

.nyc_output/processinfo/index.json

@@ -1,1 +0,1 @@

{"processes":{"17eabc8e-c273-4d65-ad8b-2162d4b41c6c":{"parent":"9778c40b-918e-4730-af92-d392fdf80b78","children":["f9e62bf5-afee-418c-8408-912565bea8ad"]},"9778c40b-918e-4730-af92-d392fdf80b78":{"parent":null,"children":["17eabc8e-c273-4d65-ad8b-2162d4b41c6c"]},"f9e62bf5-afee-418c-8408-912565bea8ad":{"parent":"17eabc8e-c273-4d65-ad8b-2162d4b41c6c","children":[]}},"files":{"/home/travis/build/securingsincity/react-ace/src/ace.js":["f9e62bf5-afee-418c-8408-912565bea8ad"],"/home/travis/build/securingsincity/react-ace/src/editorOptions.js":["f9e62bf5-afee-418c-8408-912565bea8ad"],"/home/travis/build/securingsincity/react-ace/src/split.js":["f9e62bf5-afee-418c-8408-912565bea8ad"]},"externalIds":{}}
{"processes":{"03f0a6ad-14ab-435e-9f00-6bf5e1a4bd18":{"parent":"d939d46c-bac6-4f92-9df9-26b34f691424","children":["126eee32-7b65-4508-bcd1-d158367fe2ec"]},"126eee32-7b65-4508-bcd1-d158367fe2ec":{"parent":"03f0a6ad-14ab-435e-9f00-6bf5e1a4bd18","children":[]},"d939d46c-bac6-4f92-9df9-26b34f691424":{"parent":null,"children":["03f0a6ad-14ab-435e-9f00-6bf5e1a4bd18"]}},"files":{"/home/travis/build/securingsincity/react-ace/src/ace.js":["126eee32-7b65-4508-bcd1-d158367fe2ec"],"/home/travis/build/securingsincity/react-ace/src/editorOptions.js":["126eee32-7b65-4508-bcd1-d158367fe2ec"],"/home/travis/build/securingsincity/react-ace/src/split.js":["126eee32-7b65-4508-bcd1-d158367fe2ec"]},"externalIds":{}}

@@ -163,3 +163,3 @@ /* eslint-disable */

}
loadColumns();
cols = loadColumns();
loadData();

@@ -166,0 +166,0 @@ addSortIndicators();

@@ -163,3 +163,3 @@ /* eslint-disable */

}
loadColumns();
cols = loadColumns();
loadData();

@@ -166,0 +166,0 @@ addSortIndicators();

@@ -6,29 +6,38 @@ "use strict";

});
exports["default"] = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = _interopRequireWildcard(require("react"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react = require("react");
var _lodash = _interopRequireDefault(require("lodash.isequal"));
var _react2 = _interopRequireDefault(_react);
var _editorOptions = require("./editorOptions.js");
var _propTypes = require("prop-types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
var _lodash = require("lodash.isequal");
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _lodash2 = _interopRequireDefault(_lodash);
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
var _editorOptions = require("./editorOptions.js");
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var ace = (0, _editorOptions.getAceInstance)();

@@ -39,13 +48,18 @@

var ReactAce = function (_Component) {
var ReactAce =
/*#__PURE__*/
function (_Component) {
_inherits(ReactAce, _Component);
function ReactAce(props) {
var _this;
_classCallCheck(this, ReactAce);
var _this = _possibleConstructorReturn(this, (ReactAce.__proto__ || Object.getPrototypeOf(ReactAce)).call(this, props));
_this = _possibleConstructorReturn(this, _getPrototypeOf(ReactAce).call(this, props));
_editorOptions.editorEvents.forEach(function (method) {
_this[method] = _this[method].bind(_this);
_this[method] = _this[method].bind(_assertThisInitialized(_this));
});
_this.debounce = _editorOptions.debounce;

@@ -60,26 +74,24 @@ return _this;

var _props = this.props,
className = _props.className,
onBeforeLoad = _props.onBeforeLoad,
onValidate = _props.onValidate,
mode = _props.mode,
focus = _props.focus,
theme = _props.theme,
fontSize = _props.fontSize,
value = _props.value,
defaultValue = _props.defaultValue,
cursorStart = _props.cursorStart,
showGutter = _props.showGutter,
wrapEnabled = _props.wrapEnabled,
showPrintMargin = _props.showPrintMargin,
_props$scrollMargin = _props.scrollMargin,
scrollMargin = _props$scrollMargin === undefined ? [0, 0, 0, 0] : _props$scrollMargin,
keyboardHandler = _props.keyboardHandler,
onLoad = _props.onLoad,
commands = _props.commands,
annotations = _props.annotations,
markers = _props.markers,
placeholder = _props.placeholder;
var _this$props = this.props,
className = _this$props.className,
onBeforeLoad = _this$props.onBeforeLoad,
onValidate = _this$props.onValidate,
mode = _this$props.mode,
focus = _this$props.focus,
theme = _this$props.theme,
fontSize = _this$props.fontSize,
value = _this$props.value,
defaultValue = _this$props.defaultValue,
cursorStart = _this$props.cursorStart,
showGutter = _this$props.showGutter,
wrapEnabled = _this$props.wrapEnabled,
showPrintMargin = _this$props.showPrintMargin,
_this$props$scrollMar = _this$props.scrollMargin,
scrollMargin = _this$props$scrollMar === void 0 ? [0, 0, 0, 0] : _this$props$scrollMar,
keyboardHandler = _this$props.keyboardHandler,
onLoad = _this$props.onLoad,
commands = _this$props.commands,
annotations = _this$props.annotations,
markers = _this$props.markers,
placeholder = _this$props.placeholder;
this.editor = ace.edit(this.refEditor);

@@ -92,16 +104,21 @@

var editorProps = Object.keys(this.props.editorProps);
for (var i = 0; i < editorProps.length; i++) {
this.editor[editorProps[i]] = this.props.editorProps[editorProps[i]];
}
if (this.props.debounceChangePeriod) {
this.onChange = this.debounce(this.onChange, this.props.debounceChangePeriod);
}
this.editor.renderer.setScrollMargin(scrollMargin[0], scrollMargin[1], scrollMargin[2], scrollMargin[3]);
this.editor.getSession().setMode("ace/mode/" + mode);
this.editor.setTheme("ace/theme/" + theme);
this.editor.getSession().setMode("ace/mode/".concat(mode));
this.editor.setTheme("ace/theme/".concat(theme));
this.editor.setFontSize(fontSize);
this.editor.getSession().setValue(!defaultValue ? value : defaultValue, cursorStart);
if (this.props.navigateToFileEnd) {
this.editor.navigateFileEnd();
}
this.editor.renderer.setShowGutter(showGutter);

@@ -116,29 +133,38 @@ this.editor.getSession().setUseWrapMode(wrapEnabled);

this.editor.on("input", this.onInput);
if (placeholder) {
this.updatePlaceholder(this.editor, placeholder);
}
this.editor.getSession().selection.on("changeSelection", this.onSelectionChange);
this.editor.getSession().selection.on("changeCursor", this.onCursorChange);
if (onValidate) {
this.editor.getSession().on("changeAnnotation", function () {
var annotations = _this2.editor.getSession().getAnnotations();
_this2.props.onValidate(annotations);
});
}
this.editor.session.on("changeScrollTop", this.onScroll);
this.editor.getSession().setAnnotations(annotations || []);
if (markers && markers.length > 0) {
this.handleMarkers(markers);
}
} // get a list of possible options to avoid 'misspelled option errors'
// get a list of possible options to avoid 'misspelled option errors'
var availableOptions = this.editor.$options;
for (var _i = 0; _i < _editorOptions.editorOptions.length; _i++) {
var option = _editorOptions.editorOptions[_i];
if (availableOptions.hasOwnProperty(option)) {
this.editor.setOption(option, this.props[option]);
} else if (this.props[option]) {
console.warn("ReactAce: editor option " + option + " was activated but not found. Did you need to import a related tool or did you possibly mispell the option?");
console.warn("ReactAce: editor option ".concat(option, " was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"));
}
}
this.handleOptions(this.props);

@@ -182,2 +208,3 @@

var option = _editorOptions.editorOptions[i];
if (nextProps[option] !== oldProps[option]) {

@@ -197,5 +224,5 @@ this.editor.setOption(option, nextProps[option]);

this.refEditor.className = " " + nextProps.className + " " + appliedClassesArray.join(" ");
}
} // First process editor value, as it may create a new session (see issue #300)
// First process editor value, as it may create a new session (see issue #300)
if (this.editor && this.editor.getValue() !== nextProps.value) {

@@ -213,8 +240,11 @@ // editor.setValue is a synchronous function call, change event is emitted before setValue return.

}
if (nextProps.mode !== oldProps.mode) {
this.editor.getSession().setMode("ace/mode/" + nextProps.mode);
}
if (nextProps.theme !== oldProps.theme) {
this.editor.setTheme("ace/theme/" + nextProps.theme);
}
if (nextProps.keyboardHandler !== oldProps.keyboardHandler) {

@@ -227,26 +257,33 @@ if (nextProps.keyboardHandler) {

}
if (nextProps.fontSize !== oldProps.fontSize) {
this.editor.setFontSize(nextProps.fontSize);
}
if (nextProps.wrapEnabled !== oldProps.wrapEnabled) {
this.editor.getSession().setUseWrapMode(nextProps.wrapEnabled);
}
if (nextProps.showPrintMargin !== oldProps.showPrintMargin) {
this.editor.setShowPrintMargin(nextProps.showPrintMargin);
}
if (nextProps.showGutter !== oldProps.showGutter) {
this.editor.renderer.setShowGutter(nextProps.showGutter);
}
if (!(0, _lodash2.default)(nextProps.setOptions, oldProps.setOptions)) {
if (!(0, _lodash["default"])(nextProps.setOptions, oldProps.setOptions)) {
this.handleOptions(nextProps);
}
if (!(0, _lodash2.default)(nextProps.annotations, oldProps.annotations)) {
if (!(0, _lodash["default"])(nextProps.annotations, oldProps.annotations)) {
this.editor.getSession().setAnnotations(nextProps.annotations || []);
}
if (!(0, _lodash2.default)(nextProps.markers, oldProps.markers) && Array.isArray(nextProps.markers)) {
if (!(0, _lodash["default"])(nextProps.markers, oldProps.markers) && Array.isArray(nextProps.markers)) {
this.handleMarkers(nextProps.markers);
}
} // this doesn't look like it works at all....
// this doesn't look like it works at all....
if (!(0, _lodash2.default)(nextProps.scrollMargin, oldProps.scrollMargin)) {
if (!(0, _lodash["default"])(nextProps.scrollMargin, oldProps.scrollMargin)) {
this.handleScrollMargins(nextProps.scrollMargin);

@@ -258,2 +295,3 @@ }

}
if (this.props.focus && !prevProps.focus) {

@@ -267,3 +305,2 @@ this.editor.focus();

var margins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [0, 0, 0, 0];
this.editor.renderer.setScrollMargins(margins[0], margins[1], margins[2], margins[3]);

@@ -307,2 +344,3 @@ }

}
if (this.props.placeholder) {

@@ -351,2 +389,3 @@ this.updatePlaceholder();

var setOptions = Object.keys(props.setOptions);
for (var y = 0; y < setOptions.length; y++) {

@@ -363,2 +402,3 @@ this.editor.setOption(setOptions[y], props.setOptions[setOptions[y]]);

var currentMarkers = this.editor.getSession().getMarkers(true);
for (var i in currentMarkers) {

@@ -368,5 +408,7 @@ if (currentMarkers.hasOwnProperty(i)) {

}
}
// remove background markers except active line marker and selected word marker
} // remove background markers except active line marker and selected word marker
currentMarkers = this.editor.getSession().getMarkers(false);
for (var _i2 in currentMarkers) {

@@ -376,4 +418,5 @@ if (currentMarkers.hasOwnProperty(_i2) && currentMarkers[_i2].clazz !== "ace_active-line" && currentMarkers[_i2].clazz !== "ace_selected-word") {

}
}
// add new markers
} // add new markers
markers.forEach(function (_ref) {

@@ -387,5 +430,5 @@ var startRow = _ref.startRow,

_ref$inFront = _ref.inFront,
inFront = _ref$inFront === undefined ? false : _ref$inFront;
inFront = _ref$inFront === void 0 ? false : _ref$inFront;
var range = new Range(startRow, startCol, endRow, endCol);
var range = new Range(startRow, startCol, endRow, endCol);
_this3.editor.getSession().addMarker(range, className, type, inFront);

@@ -398,9 +441,7 @@ });

// Adapted from https://stackoverflow.com/questions/26695708/how-can-i-add-placeholder-text-when-the-editor-is-empty
var editor = this.editor;
var placeholder = this.props.placeholder;
var showPlaceholder = !editor.session.getValue().length;
var node = editor.renderer.placeholderNode;
if (!showPlaceholder && node) {

@@ -429,10 +470,18 @@ editor.renderer.scroller.removeChild(editor.renderer.placeholderNode);

value: function render() {
var _props2 = this.props,
name = _props2.name,
width = _props2.width,
height = _props2.height,
style = _props2.style;
var _this$props2 = this.props,
name = _this$props2.name,
width = _this$props2.width,
height = _this$props2.height,
style = _this$props2.style;
var divStyle = _extends({ width: width, height: height }, style);
return _react2.default.createElement("div", { ref: this.updateRef, id: name, style: divStyle });
var divStyle = _objectSpread({
width: width,
height: height
}, style);
return _react["default"].createElement("div", {
ref: this.updateRef,
id: name,
style: divStyle
});
}

@@ -444,52 +493,49 @@ }]);

exports.default = ReactAce;
exports["default"] = ReactAce;
ReactAce.propTypes = {
mode: _propTypes2.default.string,
focus: _propTypes2.default.bool,
theme: _propTypes2.default.string,
name: _propTypes2.default.string,
className: _propTypes2.default.string,
height: _propTypes2.default.string,
width: _propTypes2.default.string,
fontSize: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
showGutter: _propTypes2.default.bool,
onChange: _propTypes2.default.func,
onCopy: _propTypes2.default.func,
onPaste: _propTypes2.default.func,
onFocus: _propTypes2.default.func,
onInput: _propTypes2.default.func,
onBlur: _propTypes2.default.func,
onScroll: _propTypes2.default.func,
value: _propTypes2.default.string,
defaultValue: _propTypes2.default.string,
onLoad: _propTypes2.default.func,
onSelectionChange: _propTypes2.default.func,
onCursorChange: _propTypes2.default.func,
onBeforeLoad: _propTypes2.default.func,
onValidate: _propTypes2.default.func,
minLines: _propTypes2.default.number,
maxLines: _propTypes2.default.number,
readOnly: _propTypes2.default.bool,
highlightActiveLine: _propTypes2.default.bool,
tabSize: _propTypes2.default.number,
showPrintMargin: _propTypes2.default.bool,
cursorStart: _propTypes2.default.number,
debounceChangePeriod: _propTypes2.default.number,
editorProps: _propTypes2.default.object,
setOptions: _propTypes2.default.object,
style: _propTypes2.default.object,
scrollMargin: _propTypes2.default.array,
annotations: _propTypes2.default.array,
markers: _propTypes2.default.array,
keyboardHandler: _propTypes2.default.string,
wrapEnabled: _propTypes2.default.bool,
enableBasicAutocompletion: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.array]),
enableLiveAutocompletion: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.array]),
navigateToFileEnd: _propTypes2.default.bool,
commands: _propTypes2.default.array,
placeholder: _propTypes2.default.string
mode: _propTypes["default"].string,
focus: _propTypes["default"].bool,
theme: _propTypes["default"].string,
name: _propTypes["default"].string,
className: _propTypes["default"].string,
height: _propTypes["default"].string,
width: _propTypes["default"].string,
fontSize: _propTypes["default"].oneOfType([_propTypes["default"].number, _propTypes["default"].string]),
showGutter: _propTypes["default"].bool,
onChange: _propTypes["default"].func,
onCopy: _propTypes["default"].func,
onPaste: _propTypes["default"].func,
onFocus: _propTypes["default"].func,
onInput: _propTypes["default"].func,
onBlur: _propTypes["default"].func,
onScroll: _propTypes["default"].func,
value: _propTypes["default"].string,
defaultValue: _propTypes["default"].string,
onLoad: _propTypes["default"].func,
onSelectionChange: _propTypes["default"].func,
onCursorChange: _propTypes["default"].func,
onBeforeLoad: _propTypes["default"].func,
onValidate: _propTypes["default"].func,
minLines: _propTypes["default"].number,
maxLines: _propTypes["default"].number,
readOnly: _propTypes["default"].bool,
highlightActiveLine: _propTypes["default"].bool,
tabSize: _propTypes["default"].number,
showPrintMargin: _propTypes["default"].bool,
cursorStart: _propTypes["default"].number,
debounceChangePeriod: _propTypes["default"].number,
editorProps: _propTypes["default"].object,
setOptions: _propTypes["default"].object,
style: _propTypes["default"].object,
scrollMargin: _propTypes["default"].array,
annotations: _propTypes["default"].array,
markers: _propTypes["default"].array,
keyboardHandler: _propTypes["default"].string,
wrapEnabled: _propTypes["default"].bool,
enableBasicAutocompletion: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].array]),
enableLiveAutocompletion: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].array]),
navigateToFileEnd: _propTypes["default"].bool,
commands: _propTypes["default"].array,
placeholder: _propTypes["default"].string
};
ReactAce.defaultProps = {

@@ -496,0 +542,0 @@ name: "brace-editor",

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,42 +6,50 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _split = _interopRequireDefault(require("./split.js"));
var _split = require('./split.js');
var _react = _interopRequireWildcard(require("react"));
var _split2 = _interopRequireDefault(_split);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react = require('react');
var _diffMatchPatch = _interopRequireDefault(require("diff-match-patch"));
var _react2 = _interopRequireDefault(_react);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
var _propTypes = require('prop-types');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _propTypes2 = _interopRequireDefault(_propTypes);
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _diffMatchPatch = require('diff-match-patch');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _diffMatchPatch2 = _interopRequireDefault(_diffMatchPatch);
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
var DiffComponent = function (_Component) {
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var DiffComponent =
/*#__PURE__*/
function (_Component) {
_inherits(DiffComponent, _Component);
function DiffComponent(props) {
var _this;
_classCallCheck(this, DiffComponent);
var _this = _possibleConstructorReturn(this, (DiffComponent.__proto__ || Object.getPrototypeOf(DiffComponent)).call(this, props));
_this = _possibleConstructorReturn(this, _getPrototypeOf(DiffComponent).call(this, props));
_this.state = {
value: _this.props.value
};
_this.onChange = _this.onChange.bind(_this);
_this.diff = _this.diff.bind(_this);
_this.onChange = _this.onChange.bind(_assertThisInitialized(_this));
_this.diff = _this.diff.bind(_assertThisInitialized(_this));
return _this;

@@ -51,13 +59,14 @@ }

_createClass(DiffComponent, [{
key: 'componentDidUpdate',
key: "componentDidUpdate",
value: function componentDidUpdate() {
var value = this.props.value;
if (value !== this.state.value) {
this.setState({ value: value });
this.setState({
value: value
});
}
}
}, {
key: 'onChange',
key: "onChange",
value: function onChange(value) {

@@ -67,2 +76,3 @@ this.setState({

});
if (this.props.onChange) {

@@ -73,5 +83,5 @@ this.props.onChange(value);

}, {
key: 'diff',
key: "diff",
value: function diff() {
var dmp = new _diffMatchPatch2.default();
var dmp = new _diffMatchPatch["default"]();
var lhString = this.state.value[0];

@@ -86,3 +96,2 @@ var rhString = this.state.value[1];

dmp.diff_cleanupSemantic(diff);
var diffedLines = this.generateDiffedLines(diff);

@@ -93,3 +102,3 @@ var codeEditorSettings = this.setCodeMarkers(diffedLines);

}, {
key: 'generateDiffedLines',
key: "generateDiffedLines",
value: function generateDiffedLines(diff) {

@@ -101,3 +110,2 @@ var C = {

};
var diffedLines = {

@@ -107,3 +115,2 @@ left: [],

};
var cursor = {

@@ -113,9 +120,7 @@ left: 1,

};
diff.forEach(function (chunk) {
var chunkType = chunk[0];
var text = chunk[1];
var lines = text.split('\n').length - 1;
var lines = text.split('\n').length - 1; // diff-match-patch sometimes returns empty strings at random
// diff-match-patch sometimes returns empty strings at random
if (text.length === 0) {

@@ -133,4 +138,4 @@ return;

cursor.right += lines;
break;
break;
case C.DIFF_DELETE:

@@ -143,5 +148,4 @@ // If the deletion starts with a newline, push the cursor down to that line

linesToHighlight = lines;
linesToHighlight = lines; // If the deletion does not include a newline, highlight the same line on the right
// If the deletion does not include a newline, highlight the same line on the right
if (linesToHighlight === 0) {

@@ -152,5 +156,5 @@ diffedLines.right.push({

});
}
} // If the last character is a newline, we don't want to highlight that line
// If the last character is a newline, we don't want to highlight that line
if (lastChar === '\n') {

@@ -164,5 +168,5 @@ linesToHighlight -= 1;

});
cursor.left += lines;
break;
case C.DIFF_INSERT:

@@ -175,5 +179,4 @@ // If the insertion starts with a newline, push the cursor down to that line

linesToHighlight = lines;
linesToHighlight = lines; // If the insertion does not include a newline, highlight the same line on the left
// If the insertion does not include a newline, highlight the same line on the left
if (linesToHighlight === 0) {

@@ -184,5 +187,5 @@ diffedLines.left.push({

});
}
} // If the last character is a newline, we don't want to highlight that line
// If the last character is a newline, we don't want to highlight that line
if (lastChar === '\n') {

@@ -196,5 +199,5 @@ linesToHighlight -= 1;

});
cursor.right += lines;
break;
default:

@@ -205,14 +208,13 @@ throw new Error('Diff type was not defined.');

return diffedLines;
}
// Receives a collection of line numbers and iterates through them to highlight appropriately
} // Receives a collection of line numbers and iterates through them to highlight appropriately
// Returns an object that tells the render() method how to display the code editors
}, {
key: 'setCodeMarkers',
key: "setCodeMarkers",
value: function setCodeMarkers() {
var diffedLines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { left: [], right: [] };
var diffedLines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
left: [],
right: []
};
var codeEditorSettings = [];
var newMarkerSet = {

@@ -245,10 +247,9 @@ left: [],

codeEditorSettings[1] = newMarkerSet.right;
return codeEditorSettings;
}
}, {
key: 'render',
key: "render",
value: function render() {
var markers = this.diff();
return _react2.default.createElement(_split2.default, {
return _react["default"].createElement(_split["default"], {
name: this.props.name,

@@ -292,38 +293,35 @@ className: this.props.className,

exports.default = DiffComponent;
exports["default"] = DiffComponent;
DiffComponent.propTypes = {
cursorStart: _propTypes2.default.number,
editorProps: _propTypes2.default.object,
enableBasicAutocompletion: _propTypes2.default.bool,
enableLiveAutocompletion: _propTypes2.default.bool,
focus: _propTypes2.default.bool,
fontSize: _propTypes2.default.number,
height: _propTypes2.default.string,
highlightActiveLine: _propTypes2.default.bool,
maxLines: _propTypes2.default.func,
minLines: _propTypes2.default.func,
mode: _propTypes2.default.string,
name: _propTypes2.default.string,
className: _propTypes2.default.string,
onLoad: _propTypes2.default.func,
onPaste: _propTypes2.default.func,
onScroll: _propTypes2.default.func,
onChange: _propTypes2.default.func,
orientation: _propTypes2.default.string,
readOnly: _propTypes2.default.bool,
scrollMargin: _propTypes2.default.array,
setOptions: _propTypes2.default.object,
showGutter: _propTypes2.default.bool,
showPrintMargin: _propTypes2.default.bool,
splits: _propTypes2.default.number,
style: _propTypes2.default.object,
tabSize: _propTypes2.default.number,
theme: _propTypes2.default.string,
value: _propTypes2.default.array,
width: _propTypes2.default.string,
wrapEnabled: _propTypes2.default.bool
cursorStart: _propTypes["default"].number,
editorProps: _propTypes["default"].object,
enableBasicAutocompletion: _propTypes["default"].bool,
enableLiveAutocompletion: _propTypes["default"].bool,
focus: _propTypes["default"].bool,
fontSize: _propTypes["default"].number,
height: _propTypes["default"].string,
highlightActiveLine: _propTypes["default"].bool,
maxLines: _propTypes["default"].func,
minLines: _propTypes["default"].func,
mode: _propTypes["default"].string,
name: _propTypes["default"].string,
className: _propTypes["default"].string,
onLoad: _propTypes["default"].func,
onPaste: _propTypes["default"].func,
onScroll: _propTypes["default"].func,
onChange: _propTypes["default"].func,
orientation: _propTypes["default"].string,
readOnly: _propTypes["default"].bool,
scrollMargin: _propTypes["default"].array,
setOptions: _propTypes["default"].object,
showGutter: _propTypes["default"].bool,
showPrintMargin: _propTypes["default"].bool,
splits: _propTypes["default"].number,
style: _propTypes["default"].object,
tabSize: _propTypes["default"].number,
theme: _propTypes["default"].string,
value: _propTypes["default"].array,
width: _propTypes["default"].string,
wrapEnabled: _propTypes["default"].bool
};
DiffComponent.defaultProps = {

@@ -330,0 +328,0 @@ cursorStart: 1,

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,8 +6,11 @@ Object.defineProperty(exports, "__esModule", {

});
exports.getAceInstance = exports.debounce = exports.editorEvents = exports.editorOptions = void 0;
var editorOptions = ['minLines', 'maxLines', 'readOnly', 'highlightActiveLine', 'tabSize', 'enableBasicAutocompletion', 'enableLiveAutocompletion', 'enableSnippets'];
exports.editorOptions = editorOptions;
var editorEvents = ['onChange', 'onFocus', 'onInput', 'onBlur', 'onCopy', 'onPaste', 'onSelectionChange', 'onCursorChange', 'onScroll', 'handleOptions', 'updateRef'];
exports.editorEvents = editorEvents;
var editorEvents = ['onChange', 'onFocus', 'onInput', 'onBlur', 'onCopy', 'onPaste', 'onSelectionChange', 'onCursorChange', 'onScroll', 'handleOptions', 'updateRef'];
var getAceInstance = function getAceInstance() {
var ace = void 0;
// Fallback for ace.require when vanilla ACE is hosted over a CDN
var ace; // Fallback for ace.require when vanilla ACE is hosted over a CDN
if (window.ace) {

@@ -19,5 +22,8 @@ ace = window.ace;

}
return ace;
};
exports.getAceInstance = getAceInstance;
var debounce = function debounce(fn, delay) {

@@ -34,5 +40,3 @@ var timer = null;

};
exports.editorOptions = editorOptions;
exports.editorEvents = editorEvents;
exports.debounce = debounce;
exports.getAceInstance = getAceInstance;
exports.debounce = debounce;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,20 +6,25 @@ Object.defineProperty(exports, "__esModule", {

});
exports.diff = exports.split = undefined;
Object.defineProperty(exports, "split", {
enumerable: true,
get: function get() {
return _split["default"];
}
});
Object.defineProperty(exports, "diff", {
enumerable: true,
get: function get() {
return _diff["default"];
}
});
exports["default"] = void 0;
var _ace = require('./ace.js');
var _ace = _interopRequireDefault(require("./ace.js"));
var _ace2 = _interopRequireDefault(_ace);
var _split = _interopRequireDefault(require("./split.js"));
var _split = require('./split.js');
var _diff = _interopRequireDefault(require("./diff.js"));
var _split2 = _interopRequireDefault(_split);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _diff = require('./diff.js');
var _diff2 = _interopRequireDefault(_diff);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.split = _split2.default;
exports.diff = _diff2.default;
exports.default = _ace2.default;
var _default = _ace["default"];
exports["default"] = _default;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,37 +6,44 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _editorOptions = require("./editorOptions.js");
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
require("brace");
var _editorOptions = require('./editorOptions.js');
var _react = _interopRequireWildcard(require("react"));
require('brace');
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react = require('react');
var _lodash = _interopRequireDefault(require("lodash.isequal"));
var _react2 = _interopRequireDefault(_react);
var _lodash2 = _interopRequireDefault(require("lodash.get"));
var _propTypes = require('prop-types');
require("brace/ext/split");
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _lodash = require('lodash.isequal');
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
var _lodash2 = _interopRequireDefault(_lodash);
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _lodash3 = require('lodash.get');
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
var _lodash4 = _interopRequireDefault(_lodash3);
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
require('brace/ext/split');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var ace = (0, _editorOptions.getAceInstance)();

@@ -50,13 +57,18 @@

var SplitComponent = function (_Component) {
var SplitComponent =
/*#__PURE__*/
function (_Component) {
_inherits(SplitComponent, _Component);
function SplitComponent(props) {
var _this;
_classCallCheck(this, SplitComponent);
var _this = _possibleConstructorReturn(this, (SplitComponent.__proto__ || Object.getPrototypeOf(SplitComponent)).call(this, props));
_this = _possibleConstructorReturn(this, _getPrototypeOf(SplitComponent).call(this, props));
_editorOptions.editorEvents.forEach(function (method) {
_this[method] = _this[method].bind(_this);
_this[method] = _this[method].bind(_assertThisInitialized(_this));
});
_this.debounce = _editorOptions.debounce;

@@ -67,29 +79,27 @@ return _this;

_createClass(SplitComponent, [{
key: 'componentDidMount',
key: "componentDidMount",
value: function componentDidMount() {
var _this2 = this;
var _props = this.props,
className = _props.className,
onBeforeLoad = _props.onBeforeLoad,
mode = _props.mode,
focus = _props.focus,
theme = _props.theme,
fontSize = _props.fontSize,
value = _props.value,
defaultValue = _props.defaultValue,
cursorStart = _props.cursorStart,
showGutter = _props.showGutter,
wrapEnabled = _props.wrapEnabled,
showPrintMargin = _props.showPrintMargin,
_props$scrollMargin = _props.scrollMargin,
scrollMargin = _props$scrollMargin === undefined ? [0, 0, 0, 0] : _props$scrollMargin,
keyboardHandler = _props.keyboardHandler,
onLoad = _props.onLoad,
commands = _props.commands,
annotations = _props.annotations,
markers = _props.markers,
splits = _props.splits;
var _this$props = this.props,
className = _this$props.className,
onBeforeLoad = _this$props.onBeforeLoad,
mode = _this$props.mode,
focus = _this$props.focus,
theme = _this$props.theme,
fontSize = _this$props.fontSize,
value = _this$props.value,
defaultValue = _this$props.defaultValue,
cursorStart = _this$props.cursorStart,
showGutter = _this$props.showGutter,
wrapEnabled = _this$props.wrapEnabled,
showPrintMargin = _this$props.showPrintMargin,
_this$props$scrollMar = _this$props.scrollMargin,
scrollMargin = _this$props$scrollMar === void 0 ? [0, 0, 0, 0] : _this$props$scrollMar,
keyboardHandler = _this$props.keyboardHandler,
onLoad = _this$props.onLoad,
commands = _this$props.commands,
annotations = _this$props.annotations,
markers = _this$props.markers,
splits = _this$props.splits;
this.editor = ace.edit(this.refEditor);

@@ -102,16 +112,16 @@

var editorProps = Object.keys(this.props.editorProps);
var split = new Split(this.editor.container, 'ace/theme/' + theme, splits);
var split = new Split(this.editor.container, "ace/theme/".concat(theme), splits);
this.editor.env.split = split;
this.splitEditor = split.getEditor(0);
this.split = split; // in a split scenario we don't want a print margin for the entire application
this.splitEditor = split.getEditor(0);
this.split = split;
// in a split scenario we don't want a print margin for the entire application
this.editor.setShowPrintMargin(false);
this.editor.renderer.setShowGutter(false);
// get a list of possible options to avoid 'misspelled option errors'
this.editor.renderer.setShowGutter(false); // get a list of possible options to avoid 'misspelled option errors'
var availableOptions = this.splitEditor.$options;
if (this.props.debounceChangePeriod) {
this.onChange = this.debounce(this.onChange, this.props.debounceChangePeriod);
}
split.forEach(function (editor, index) {

@@ -121,8 +131,9 @@ for (var i = 0; i < editorProps.length; i++) {

}
var defaultValueForEditor = (0, _lodash4.default)(defaultValue, index);
var valueForEditor = (0, _lodash4.default)(value, index, '');
var defaultValueForEditor = (0, _lodash2["default"])(defaultValue, index);
var valueForEditor = (0, _lodash2["default"])(value, index, '');
editor.session.setUndoManager(new ace.UndoManager());
editor.setTheme('ace/theme/' + theme);
editor.setTheme("ace/theme/".concat(theme));
editor.renderer.setScrollMargin(scrollMargin[0], scrollMargin[1], scrollMargin[2], scrollMargin[3]);
editor.getSession().setMode('ace/mode/' + mode);
editor.getSession().setMode("ace/mode/".concat(mode));
editor.setFontSize(fontSize);

@@ -142,5 +153,6 @@ editor.renderer.setShowGutter(showGutter);

editor.setValue(defaultValueForEditor === undefined ? valueForEditor : defaultValueForEditor, cursorStart);
var newAnnotations = (0, _lodash4.default)(annotations, index, []);
var newMarkers = (0, _lodash4.default)(markers, index, []);
var newAnnotations = (0, _lodash2["default"])(annotations, index, []);
var newMarkers = (0, _lodash2["default"])(markers, index, []);
editor.getSession().setAnnotations(newAnnotations);
if (newMarkers && newMarkers.length > 0) {

@@ -152,8 +164,10 @@ _this2.handleMarkers(newMarkers, editor);

var option = _editorOptions.editorOptions[_i];
if (availableOptions.hasOwnProperty(option)) {
editor.setOption(option, _this2.props[option]);
} else if (_this2.props[option]) {
console.warn('ReaceAce: editor option ' + option + ' was activated but not found. Did you need to import a related tool or did you possibly mispell the option?');
console.warn("ReaceAce: editor option ".concat(option, " was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"));
}
}
_this2.handleOptions(_this2.props, editor);

@@ -187,2 +201,3 @@

sp.resize(true);
if (onLoad) {

@@ -193,3 +208,3 @@ onLoad(sp);

}, {
key: 'componentDidUpdate',
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {

@@ -200,3 +215,2 @@ var _this3 = this;

var nextProps = this.props;
var split = this.editor.env.split;

@@ -216,2 +230,3 @@

}
if (nextProps.keyboardHandler !== oldProps.keyboardHandler) {

@@ -224,11 +239,15 @@ if (nextProps.keyboardHandler) {

}
if (nextProps.fontSize !== oldProps.fontSize) {
editor.setFontSize(nextProps.fontSize);
}
if (nextProps.wrapEnabled !== oldProps.wrapEnabled) {
editor.getSession().setUseWrapMode(nextProps.wrapEnabled);
}
if (nextProps.showPrintMargin !== oldProps.showPrintMargin) {
editor.setShowPrintMargin(nextProps.showPrintMargin);
}
if (nextProps.showGutter !== oldProps.showGutter) {

@@ -240,2 +259,3 @@ editor.renderer.setShowGutter(nextProps.showGutter);

var option = _editorOptions.editorOptions[i];
if (nextProps[option] !== oldProps[option]) {

@@ -245,6 +265,9 @@ editor.setOption(option, nextProps[option]);

}
if (!(0, _lodash2.default)(nextProps.setOptions, oldProps.setOptions)) {
if (!(0, _lodash["default"])(nextProps.setOptions, oldProps.setOptions)) {
_this3.handleOptions(nextProps, editor);
}
var nextValue = (0, _lodash4.default)(nextProps.value, index, '');
var nextValue = (0, _lodash2["default"])(nextProps.value, index, '');
if (editor.getValue() !== nextValue) {

@@ -258,11 +281,14 @@ // editor.setValue is a synchronous function call, change event is emitted before setValue return.

}
var newAnnotations = (0, _lodash4.default)(nextProps.annotations, index, []);
var oldAnnotations = (0, _lodash4.default)(oldProps.annotations, index, []);
if (!(0, _lodash2.default)(newAnnotations, oldAnnotations)) {
var newAnnotations = (0, _lodash2["default"])(nextProps.annotations, index, []);
var oldAnnotations = (0, _lodash2["default"])(oldProps.annotations, index, []);
if (!(0, _lodash["default"])(newAnnotations, oldAnnotations)) {
editor.getSession().setAnnotations(newAnnotations);
}
var newMarkers = (0, _lodash4.default)(nextProps.markers, index, []);
var oldMarkers = (0, _lodash4.default)(oldProps.markers, index, []);
if (!(0, _lodash2.default)(newMarkers, oldMarkers) && Array.isArray(newMarkers)) {
var newMarkers = (0, _lodash2["default"])(nextProps.markers, index, []);
var oldMarkers = (0, _lodash2["default"])(oldProps.markers, index, []);
if (!(0, _lodash["default"])(newMarkers, oldMarkers) && Array.isArray(newMarkers)) {
_this3.handleMarkers(newMarkers, editor);

@@ -290,2 +316,3 @@ }

}
if (nextProps.height !== this.props.height || nextProps.width !== this.props.width) {

@@ -296,3 +323,3 @@ this.editor.resize();

}, {
key: 'componentWillUnmount',
key: "componentWillUnmount",
value: function componentWillUnmount() {

@@ -303,3 +330,3 @@ this.editor.destroy();

}, {
key: 'onChange',
key: "onChange",
value: function onChange(event) {

@@ -315,3 +342,3 @@ if (this.props.onChange && !this.silent) {

}, {
key: 'onSelectionChange',
key: "onSelectionChange",
value: function onSelectionChange(event) {

@@ -327,3 +354,3 @@ if (this.props.onSelectionChange) {

}, {
key: 'onCursorChange',
key: "onCursorChange",
value: function onCursorChange(event) {

@@ -339,3 +366,3 @@ if (this.props.onCursorChange) {

}, {
key: 'onFocus',
key: "onFocus",
value: function onFocus(event) {

@@ -347,3 +374,3 @@ if (this.props.onFocus) {

}, {
key: 'onInput',
key: "onInput",
value: function onInput(event) {

@@ -355,3 +382,3 @@ if (this.props.onInput) {

}, {
key: 'onBlur',
key: "onBlur",
value: function onBlur(event) {

@@ -363,3 +390,3 @@ if (this.props.onBlur) {

}, {
key: 'onCopy',
key: "onCopy",
value: function onCopy(text) {

@@ -371,3 +398,3 @@ if (this.props.onCopy) {

}, {
key: 'onPaste',
key: "onPaste",
value: function onPaste(text) {

@@ -379,3 +406,3 @@ if (this.props.onPaste) {

}, {
key: 'onScroll',
key: "onScroll",
value: function onScroll() {

@@ -387,5 +414,6 @@ if (this.props.onScroll) {

}, {
key: 'handleOptions',
key: "handleOptions",
value: function handleOptions(props, editor) {
var setOptions = Object.keys(props.setOptions);
for (var y = 0; y < setOptions.length; y++) {

@@ -396,6 +424,7 @@ editor.setOption(setOptions[y], props.setOptions[setOptions[y]]);

}, {
key: 'handleMarkers',
key: "handleMarkers",
value: function handleMarkers(markers, editor) {
// remove foreground markers
var currentMarkers = editor.getSession().getMarkers(true);
for (var i in currentMarkers) {

@@ -405,5 +434,7 @@ if (currentMarkers.hasOwnProperty(i)) {

}
}
// remove background markers
} // remove background markers
currentMarkers = editor.getSession().getMarkers(false);
for (var _i2 in currentMarkers) {

@@ -413,4 +444,5 @@ if (currentMarkers.hasOwnProperty(_i2)) {

}
}
// add new markers
} // add new markers
markers.forEach(function (_ref) {

@@ -424,4 +456,3 @@ var startRow = _ref.startRow,

_ref$inFront = _ref.inFront,
inFront = _ref$inFront === undefined ? false : _ref$inFront;
inFront = _ref$inFront === void 0 ? false : _ref$inFront;
var range = new Range(startRow, startCol, endRow, endCol);

@@ -432,3 +463,3 @@ editor.getSession().addMarker(range, className, type, inFront);

}, {
key: 'updateRef',
key: "updateRef",
value: function updateRef(item) {

@@ -438,12 +469,20 @@ this.refEditor = item;

}, {
key: 'render',
key: "render",
value: function render() {
var _props2 = this.props,
name = _props2.name,
width = _props2.width,
height = _props2.height,
style = _props2.style;
var _this$props2 = this.props,
name = _this$props2.name,
width = _this$props2.width,
height = _this$props2.height,
style = _this$props2.style;
var divStyle = _extends({ width: width, height: height }, style);
return _react2.default.createElement('div', { ref: this.updateRef, id: name, style: divStyle });
var divStyle = _objectSpread({
width: width,
height: height
}, style);
return _react["default"].createElement("div", {
ref: this.updateRef,
id: name,
style: divStyle
});
}

@@ -455,51 +494,48 @@ }]);

exports.default = SplitComponent;
exports["default"] = SplitComponent;
SplitComponent.propTypes = {
mode: _propTypes2.default.string,
splits: _propTypes2.default.number,
orientation: _propTypes2.default.string,
focus: _propTypes2.default.bool,
theme: _propTypes2.default.string,
name: _propTypes2.default.string,
className: _propTypes2.default.string,
height: _propTypes2.default.string,
width: _propTypes2.default.string,
fontSize: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
showGutter: _propTypes2.default.bool,
onChange: _propTypes2.default.func,
onCopy: _propTypes2.default.func,
onPaste: _propTypes2.default.func,
onFocus: _propTypes2.default.func,
onInput: _propTypes2.default.func,
onBlur: _propTypes2.default.func,
onScroll: _propTypes2.default.func,
value: _propTypes2.default.arrayOf(_propTypes2.default.string),
defaultValue: _propTypes2.default.arrayOf(_propTypes2.default.string),
debounceChangePeriod: _propTypes2.default.number,
onLoad: _propTypes2.default.func,
onSelectionChange: _propTypes2.default.func,
onCursorChange: _propTypes2.default.func,
onBeforeLoad: _propTypes2.default.func,
minLines: _propTypes2.default.number,
maxLines: _propTypes2.default.number,
readOnly: _propTypes2.default.bool,
highlightActiveLine: _propTypes2.default.bool,
tabSize: _propTypes2.default.number,
showPrintMargin: _propTypes2.default.bool,
cursorStart: _propTypes2.default.number,
editorProps: _propTypes2.default.object,
setOptions: _propTypes2.default.object,
style: _propTypes2.default.object,
scrollMargin: _propTypes2.default.array,
annotations: _propTypes2.default.array,
markers: _propTypes2.default.array,
keyboardHandler: _propTypes2.default.string,
wrapEnabled: _propTypes2.default.bool,
enableBasicAutocompletion: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.array]),
enableLiveAutocompletion: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.array]),
commands: _propTypes2.default.array
mode: _propTypes["default"].string,
splits: _propTypes["default"].number,
orientation: _propTypes["default"].string,
focus: _propTypes["default"].bool,
theme: _propTypes["default"].string,
name: _propTypes["default"].string,
className: _propTypes["default"].string,
height: _propTypes["default"].string,
width: _propTypes["default"].string,
fontSize: _propTypes["default"].oneOfType([_propTypes["default"].number, _propTypes["default"].string]),
showGutter: _propTypes["default"].bool,
onChange: _propTypes["default"].func,
onCopy: _propTypes["default"].func,
onPaste: _propTypes["default"].func,
onFocus: _propTypes["default"].func,
onInput: _propTypes["default"].func,
onBlur: _propTypes["default"].func,
onScroll: _propTypes["default"].func,
value: _propTypes["default"].arrayOf(_propTypes["default"].string),
defaultValue: _propTypes["default"].arrayOf(_propTypes["default"].string),
debounceChangePeriod: _propTypes["default"].number,
onLoad: _propTypes["default"].func,
onSelectionChange: _propTypes["default"].func,
onCursorChange: _propTypes["default"].func,
onBeforeLoad: _propTypes["default"].func,
minLines: _propTypes["default"].number,
maxLines: _propTypes["default"].number,
readOnly: _propTypes["default"].bool,
highlightActiveLine: _propTypes["default"].bool,
tabSize: _propTypes["default"].number,
showPrintMargin: _propTypes["default"].bool,
cursorStart: _propTypes["default"].number,
editorProps: _propTypes["default"].object,
setOptions: _propTypes["default"].object,
style: _propTypes["default"].object,
scrollMargin: _propTypes["default"].array,
annotations: _propTypes["default"].array,
markers: _propTypes["default"].array,
keyboardHandler: _propTypes["default"].string,
wrapEnabled: _propTypes["default"].bool,
enableBasicAutocompletion: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].array]),
enableLiveAutocompletion: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].array]),
commands: _propTypes["default"].array
};
SplitComponent.defaultProps = {

@@ -506,0 +542,0 @@ name: 'brace-editor',

{
"name": "react-ace",
"version": "6.5.0",
"version": "6.6.0",
"description": "A react component for Ace Editor",

@@ -22,3 +22,3 @@ "main": "lib/index.js",

"prepublishOnly": "npm run clean && npm run build",
"test": "mocha --require babel-register --require tests/setup.js tests/**/*.spec.js --exit",
"test": "mocha --require @babel/register --require @babel/polyfill --require tests/setup.js tests/**/*.spec.js --exit",
"coverage": "nyc npm run test"

@@ -29,32 +29,31 @@ },

"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.4.4",
"babel-eslint": "^10.0.1",
"babel-loader": "^7.0.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"chai": "^4.1.2",
"babel-loader": "^8.0.6",
"chai": "^4.2.0",
"coveralls": "^3.0.2",
"enzyme": "^3.6.0",
"enzyme-adapter-react-16": "^1.5.0",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.13.1",
"eslint": "5.16.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "7.11.1",
"husky": "^1.3.1",
"jsdom": "^14.0.0",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.13.0",
"husky": "^2.3.0",
"jsdom": "^15.1.0",
"mocha": "6.1.4",
"nyc": "14.0.0",
"prettier": "^1.14.3",
"pretty-quick": "^1.7.0",
"react": "^16.8.3",
"react-dom": "^16.8.3",
"react-test-renderer": "^16.7.0",
"nyc": "14.1.1",
"prettier": "^1.17.1",
"pretty-quick": "^1.11.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-test-renderer": "^16.8.6",
"rimraf": "2.6.3",
"sinon": "7.3.2",
"webpack": "4.30.0",
"webpack-cli": "^3.1.0",
"webpack-dev-server": ">=3.1.11"
"webpack": "4.32.2",
"webpack-cli": "^3.3.2",
"webpack-dev-server": ">=3.4.1"
},

@@ -69,2 +68,3 @@ "keywords": [

"dependencies": {
"@babel/polyfill": "^7.4.4",
"brace": "^0.11.1",

@@ -74,3 +74,3 @@ "diff-match-patch": "^1.0.4",

"lodash.isequal": "^4.5.0",
"prop-types": "^15.6.2"
"prop-types": "^15.7.2"
},

@@ -77,0 +77,0 @@ "husky": {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc