port to react 0.14, removing getDOMNode()s for DOM components and turning them into ReactDOM.findDOMNode()s for React components
This commit is contained in:
parent
efd88b9a83
commit
b5402d0fa0
6 changed files with 19 additions and 19 deletions
|
@ -24,7 +24,7 @@ linkifyMatrix(linkify);
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
linkifyElement(this.refs.content.getDOMNode(), linkifyMatrix.options);
|
linkifyElement(this.refs.content, linkifyMatrix.options);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,6 @@ linkifyMatrix(linkify);
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
linkifyElement(this.refs.content.getDOMNode(), linkifyMatrix.options);
|
linkifyElement(this.refs.content, linkifyMatrix.options);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,7 +24,7 @@ linkifyMatrix(linkify);
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
linkifyElement(this.refs.content.getDOMNode(), linkifyMatrix.options);
|
linkifyElement(this.refs.content, linkifyMatrix.options);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ module.exports = {
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
this.dispatcherRef = dis.register(this.onAction);
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
this.sentHistory.init(
|
this.sentHistory.init(
|
||||||
this.refs.textarea.getDOMNode(),
|
this.refs.textarea,
|
||||||
this.props.room.roomId
|
this.props.room.roomId
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -143,14 +143,14 @@ module.exports = {
|
||||||
onAction: function(payload) {
|
onAction: function(payload) {
|
||||||
switch (payload.action) {
|
switch (payload.action) {
|
||||||
case 'focus_composer':
|
case 'focus_composer':
|
||||||
this.refs.textarea.getDOMNode().focus();
|
this.refs.textarea.focus();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onKeyDown: function (ev) {
|
onKeyDown: function (ev) {
|
||||||
if (ev.keyCode === KeyCode.ENTER) {
|
if (ev.keyCode === KeyCode.ENTER) {
|
||||||
var input = this.refs.textarea.getDOMNode().value;
|
var input = this.refs.textarea.value;
|
||||||
if (input.length === 0) {
|
if (input.length === 0) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
return;
|
return;
|
||||||
|
@ -179,7 +179,7 @@ module.exports = {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (self.refs.textarea && self.refs.textarea.getDOMNode().value != '') {
|
if (self.refs.textarea && self.refs.textarea.value != '') {
|
||||||
self.onTypingActivity();
|
self.onTypingActivity();
|
||||||
} else {
|
} else {
|
||||||
self.onFinishedTyping();
|
self.onFinishedTyping();
|
||||||
|
@ -188,13 +188,13 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
onEnter: function(ev) {
|
onEnter: function(ev) {
|
||||||
var contentText = this.refs.textarea.getDOMNode().value;
|
var contentText = this.refs.textarea.value;
|
||||||
|
|
||||||
var cmd = SlashCommands.processInput(this.props.room.roomId, contentText);
|
var cmd = SlashCommands.processInput(this.props.room.roomId, contentText);
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
if (!cmd.error) {
|
if (!cmd.error) {
|
||||||
this.refs.textarea.getDOMNode().value = '';
|
this.refs.textarea.value = '';
|
||||||
}
|
}
|
||||||
if (cmd.promise) {
|
if (cmd.promise) {
|
||||||
cmd.promise.done(function() {
|
cmd.promise.done(function() {
|
||||||
|
@ -241,12 +241,12 @@ module.exports = {
|
||||||
action: 'message_send_failed'
|
action: 'message_send_failed'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.refs.textarea.getDOMNode().value = '';
|
this.refs.textarea.value = '';
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
},
|
},
|
||||||
|
|
||||||
onTab: function(ev, sortedMembers) {
|
onTab: function(ev, sortedMembers) {
|
||||||
var textArea = this.refs.textarea.getDOMNode();
|
var textArea = this.refs.textarea;
|
||||||
if (!this.tabStruct.completing) {
|
if (!this.tabStruct.completing) {
|
||||||
this.tabStruct.completing = true;
|
this.tabStruct.completing = true;
|
||||||
this.tabStruct.index = 0;
|
this.tabStruct.index = 0;
|
||||||
|
|
|
@ -49,7 +49,7 @@ module.exports = {
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
if (this.refs.messageWrapper) {
|
if (this.refs.messageWrapper) {
|
||||||
var messageWrapper = this.refs.messageWrapper.getDOMNode();
|
var messageWrapper = this.refs.messageWrapper;
|
||||||
messageWrapper.removeEventListener('drop', this.onDrop);
|
messageWrapper.removeEventListener('drop', this.onDrop);
|
||||||
messageWrapper.removeEventListener('dragover', this.onDragOver);
|
messageWrapper.removeEventListener('dragover', this.onDragOver);
|
||||||
messageWrapper.removeEventListener('dragleave', this.onDragLeaveOrEnd);
|
messageWrapper.removeEventListener('dragleave', this.onDragLeaveOrEnd);
|
||||||
|
@ -83,7 +83,7 @@ module.exports = {
|
||||||
// scroll to bottom
|
// scroll to bottom
|
||||||
var messageWrapper = this.refs.messageWrapper;
|
var messageWrapper = this.refs.messageWrapper;
|
||||||
if (messageWrapper) {
|
if (messageWrapper) {
|
||||||
messageWrapper = messageWrapper.getDOMNode();
|
messageWrapper = messageWrapper;
|
||||||
messageWrapper.scrollTop = messageWrapper.scrollHeight;
|
messageWrapper.scrollTop = messageWrapper.scrollHeight;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -111,7 +111,7 @@ module.exports = {
|
||||||
if (room.roomId != this.props.roomId) return;
|
if (room.roomId != this.props.roomId) return;
|
||||||
|
|
||||||
if (this.refs.messageWrapper) {
|
if (this.refs.messageWrapper) {
|
||||||
var messageWrapper = this.refs.messageWrapper.getDOMNode();
|
var messageWrapper = this.refs.messageWrapper;
|
||||||
this.atBottom = (
|
this.atBottom = (
|
||||||
messageWrapper.scrollHeight - messageWrapper.scrollTop <=
|
messageWrapper.scrollHeight - messageWrapper.scrollTop <=
|
||||||
(messageWrapper.clientHeight + 150)
|
(messageWrapper.clientHeight + 150)
|
||||||
|
@ -155,7 +155,7 @@ module.exports = {
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
if (this.refs.messageWrapper) {
|
if (this.refs.messageWrapper) {
|
||||||
var messageWrapper = this.refs.messageWrapper.getDOMNode();
|
var messageWrapper = this.refs.messageWrapper;
|
||||||
|
|
||||||
messageWrapper.addEventListener('drop', this.onDrop);
|
messageWrapper.addEventListener('drop', this.onDrop);
|
||||||
messageWrapper.addEventListener('dragover', this.onDragOver);
|
messageWrapper.addEventListener('dragover', this.onDragOver);
|
||||||
|
@ -171,7 +171,7 @@ module.exports = {
|
||||||
componentDidUpdate: function() {
|
componentDidUpdate: function() {
|
||||||
if (!this.refs.messageWrapper) return;
|
if (!this.refs.messageWrapper) return;
|
||||||
|
|
||||||
var messageWrapper = this.refs.messageWrapper.getDOMNode();
|
var messageWrapper = this.refs.messageWrapper;
|
||||||
|
|
||||||
if (this.state.paginating && !this.waiting_for_paginate) {
|
if (this.state.paginating && !this.waiting_for_paginate) {
|
||||||
var heightGained = messageWrapper.scrollHeight - this.oldScrollHeight;
|
var heightGained = messageWrapper.scrollHeight - this.oldScrollHeight;
|
||||||
|
@ -190,7 +190,7 @@ module.exports = {
|
||||||
|
|
||||||
fillSpace: function() {
|
fillSpace: function() {
|
||||||
if (!this.refs.messageWrapper) return;
|
if (!this.refs.messageWrapper) return;
|
||||||
var messageWrapper = this.refs.messageWrapper.getDOMNode();
|
var messageWrapper = this.refs.messageWrapper;
|
||||||
if (messageWrapper.scrollTop < messageWrapper.clientHeight && this.state.room.oldState.paginationToken) {
|
if (messageWrapper.scrollTop < messageWrapper.clientHeight && this.state.room.oldState.paginationToken) {
|
||||||
this.setState({paginating: true});
|
this.setState({paginating: true});
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ module.exports = {
|
||||||
|
|
||||||
onMessageListScroll: function(ev) {
|
onMessageListScroll: function(ev) {
|
||||||
if (this.refs.messageWrapper) {
|
if (this.refs.messageWrapper) {
|
||||||
var messageWrapper = this.refs.messageWrapper.getDOMNode();
|
var messageWrapper = this.refs.messageWrapper;
|
||||||
var wasAtBottom = this.atBottom;
|
var wasAtBottom = this.atBottom;
|
||||||
this.atBottom = messageWrapper.scrollHeight - messageWrapper.scrollTop <= messageWrapper.clientHeight;
|
this.atBottom = messageWrapper.scrollHeight - messageWrapper.scrollTop <= messageWrapper.clientHeight;
|
||||||
if (this.atBottom && !wasAtBottom) {
|
if (this.atBottom && !wasAtBottom) {
|
||||||
|
|
|
@ -87,7 +87,7 @@ module.exports = {
|
||||||
var scriptTag = document.createElement('script');
|
var scriptTag = document.createElement('script');
|
||||||
window.mx_on_recaptcha_loaded = this.onCaptchaLoaded;
|
window.mx_on_recaptcha_loaded = this.onCaptchaLoaded;
|
||||||
scriptTag.setAttribute('src', global.location.protocol+"//www.google.com/recaptcha/api.js?onload=mx_on_recaptcha_loaded&render=explicit");
|
scriptTag.setAttribute('src', global.location.protocol+"//www.google.com/recaptcha/api.js?onload=mx_on_recaptcha_loaded&render=explicit");
|
||||||
this.refs.recaptchaContainer.getDOMNode().appendChild(scriptTag);
|
this.refs.recaptchaContainer.appendChild(scriptTag);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue