Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
Fixes #365
  • Loading branch information
jbalsas authored and ipeychev committed Nov 5, 2015
1 parent e063fd8 commit 3bf98d9
Show file tree
Hide file tree
Showing 17 changed files with 44 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"esnext": true,
"evil": false,
"expr": false,
"predef": ["React", "global", "YUI", "CKEDITOR", "AlloyEditor", "bender", "chai", "it", "describe", "before", "after", "beforeEach", "afterEach", "fixture", "assert", "Utils", "TestUtils", "Simulate"],
"predef": ["React", "ReactDOM", "global", "YUI", "CKEDITOR", "AlloyEditor", "bender", "chai", "it", "describe", "before", "after", "beforeEach", "afterEach", "fixture", "assert", "Utils", "TestUtils", "Simulate"],
"unused": true,
"indent": 4,
"funcscope": false,
Expand Down
4 changes: 2 additions & 2 deletions src/ui/react/src/adapter/alloy-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
*/
destructor: function() {
if (this._editorUIElement) {
React.unmountComponentAtNode(this._editorUIElement);
ReactDOM.unmountComponentAtNode(this._editorUIElement);
this._editorUIElement.parentNode.removeChild(this._editorUIElement);
}

Expand Down Expand Up @@ -106,7 +106,7 @@

uiNode.appendChild(editorUIElement);

this._mainUI = React.render(React.createElement(AlloyEditor.UI, {
this._mainUI = ReactDOM.render(React.createElement(AlloyEditor.UI, {
editor: this,
eventsDelay: this.get('eventsDelay'),
toolbars: this.get('toolbars')
Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/src/components/base/widget-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
if (this.moveFocus) {
this.moveFocus(toggleDirection);
} else {
React.findDOMNode(this).focus();
ReactDOM.findDOMNode(this).focus();
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/src/components/base/widget-focus-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
* @method _refresh
*/
_refresh: function() {
var domNode = React.findDOMNode(this);
var domNode = ReactDOM.findDOMNode(this);

if (domNode) {
var descendants = domNode.querySelectorAll(this.props.descendants);
Expand Down
10 changes: 5 additions & 5 deletions src/ui/react/src/components/base/widget-position.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
* @return {Array} An Array with left and top offsets in page coordinates.
*/
getWidgetXYPoint: function(left, top, direction) {
var domNode = React.findDOMNode(this);
var domNode = ReactDOM.findDOMNode(this);

var gutter = this.props.gutter;

Expand Down Expand Up @@ -147,7 +147,7 @@
* @return {Boolean} True if the widget is visible, false otherwise
*/
isVisible: function() {
var domNode = this.getDOMNode();
var domNode = ReactDOM.findDOMNode(this);

if (domNode) {
var domElement = new CKEDITOR.dom.element(domNode);
Expand All @@ -166,7 +166,7 @@
* @param {Object} endPoint The destination point for the movement.
*/
moveToPoint: function(startPoint, endPoint) {
var domElement = new CKEDITOR.dom.element(this.getDOMNode());
var domElement = new CKEDITOR.dom.element(ReactDOM.findDOMNode(this));

domElement.setStyles({
left: startPoint[0] + 'px',
Expand All @@ -193,7 +193,7 @@
* @method show
*/
show: function() {
var domNode = React.findDOMNode(this);
var domNode = ReactDOM.findDOMNode(this);

if (!this.isVisible() && domNode) {
var interactionPoint = this.getInteractionPoint();
Expand Down Expand Up @@ -240,7 +240,7 @@
updatePosition: function() {
var interactionPoint = this.getInteractionPoint();

var domNode = React.findDOMNode(this);
var domNode = ReactDOM.findDOMNode(this);

if (interactionPoint && domNode) {
var xy = this.getWidgetXYPoint(interactionPoint.x, interactionPoint.y, interactionPoint.direction);
Expand Down
12 changes: 6 additions & 6 deletions src/ui/react/src/components/buttons/button-camera-image.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* @method componentDidMount
*/
componentDidMount: function () {
React.findDOMNode(this.refs.buttonTakePhoto).focus();
ReactDOM.findDOMNode(this.refs.buttonTakePhoto).focus();
},

/**
Expand Down Expand Up @@ -85,8 +85,8 @@
* @method takePhoto
*/
takePhoto: function() {
var videoEl = React.findDOMNode(this.refs.videoContainer);
var canvasEl = React.findDOMNode(this.refs.canvasContainer);
var videoEl = ReactDOM.findDOMNode(this.refs.videoContainer);
var canvasEl = ReactDOM.findDOMNode(this.refs.canvasContainer);

var context = canvasEl.getContext('2d');

Expand Down Expand Up @@ -134,8 +134,8 @@
* @param {Object} stream The video stream
*/
_handleStreamSuccess: function(stream) {
var videoEl = React.findDOMNode(this.refs.videoContainer);
var canvasEl = React.findDOMNode(this.refs.canvasContainer);
var videoEl = ReactDOM.findDOMNode(this.refs.videoContainer);
var canvasEl = ReactDOM.findDOMNode(this.refs.canvasContainer);

videoEl.addEventListener('canplay', function(event) {
var height = videoEl.videoHeight / (videoEl.videoWidth/this.props.videoWidth);
Expand All @@ -162,7 +162,7 @@

videoEl.play();

React.findDOMNode(this.refs.buttonTakePhoto).disabled = false;
ReactDOM.findDOMNode(this.refs.buttonTakePhoto).disabled = false;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
* @method componentDidMount
*/
componentDidMount: function () {
React.findDOMNode(this).focus();
ReactDOM.findDOMNode(this).focus();
},

/**
Expand Down
4 changes: 2 additions & 2 deletions src/ui/react/src/components/buttons/button-image.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
* @param {SyntheticEvent} event The received click event on the button.
*/
handleClick: function(event) {
React.findDOMNode(this.refs.fileInput).click();
ReactDOM.findDOMNode(this.refs.fileInput).click();
},

/**
Expand All @@ -86,7 +86,7 @@
*/
_onInputChange: function() {
var reader = new FileReader();
var inputEl = React.findDOMNode(this.refs.fileInput);
var inputEl = ReactDOM.findDOMNode(this.refs.fileInput);

reader.onload = function(event) {
var editor = this.props.editor.get('nativeEditor');
Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/src/components/buttons/button-link-edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
* @method _focusLinkInput
*/
_focusLinkInput: function() {
React.findDOMNode(this.refs.linkInput).focus();
ReactDOM.findDOMNode(this.refs.linkInput).focus();
},

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/src/components/buttons/button-styles-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @method componentDidMount
*/
componentDidMount: function () {
React.findDOMNode(this).focus();
ReactDOM.findDOMNode(this).focus();
},

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/src/components/buttons/button-table-edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
* @method componentDidMount
*/
componentDidMount: function () {
React.findDOMNode(this.refs.rows).focus();
ReactDOM.findDOMNode(this.refs.rows).focus();
},

/**
Expand Down
4 changes: 2 additions & 2 deletions src/ui/react/src/components/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
* @method componentDidUpdate
*/
componentDidUpdate: function (prevProps, prevState) {
var domNode = React.findDOMNode(this);
var domNode = ReactDOM.findDOMNode(this);

var editor = this.props.editor.get('nativeEditor');

Expand Down Expand Up @@ -314,7 +314,7 @@
* @param {DOMElement} target The DOM element with which user interacted lastly.
*/
_setUIHidden: function(target) {
var domNode = React.findDOMNode(this);
var domNode = ReactDOM.findDOMNode(this);

if (domNode) {
var editable = this.props.editor.get('nativeEditor').editable();
Expand Down
4 changes: 2 additions & 2 deletions src/ui/react/src/components/toolbars/toolbar-add.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
*/
_updatePosition: function() {
// If component is not mounted, there is nothing to do
if (!React.findDOMNode(this)) {
if (!ReactDOM.findDOMNode(this)) {
return;
}

Expand All @@ -220,7 +220,7 @@
}

if (region) {
var domNode = React.findDOMNode(this);
var domNode = ReactDOM.findDOMNode(this);
var domElement = new CKEDITOR.dom.element(domNode);

var startRect = region.startRect || region;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/src/components/toolbars/toolbar-styles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
*/
_updatePosition: function() {
// If component is not mounted, there is nothing to do
if (!React.findDOMNode(this)) {
if (!ReactDOM.findDOMNode(this)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/src/selections/selection-position.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var table = new CKEDITOR.Table(nativeEditor).getFromSelection();
var clientRect = table.getClientRect();

var toolbarNode = this.getDOMNode();
var toolbarNode = ReactDOM.findDOMNode(this);
var halfToolbarWidth = toolbarNode.offsetWidth / 2;
var scrollPos = new CKEDITOR.dom.window(window).getScrollPosition();

Expand Down
8 changes: 8 additions & 0 deletions src/ui/react/template/alloy-editor-core.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
React = AlloyEditor.React;
}

var ReactDOM = (function() {
return (0, eval)('this').ReactDOM;
}());

if (typeof React === 'undefined') {
ReactDOM = AlloyEditor.ReactDOM;
}

if (typeof window !== 'undefined') {
<%= ui %>
}
Expand Down
8 changes: 8 additions & 0 deletions src/ui/react/template/alloy-editor.template
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
React = AlloyEditor.React;
}

var ReactDOM = (function() {
return (0, eval)('this').ReactDOM;
}());

if (typeof ReactDOM === 'undefined' && typeof AlloyEditor !== 'undefined') {
ReactDOM = AlloyEditor.ReactDOM;
}

if (typeof window !== 'undefined') {
deployCKEditor();

Expand Down

0 comments on commit 3bf98d9

Please sign in to comment.