mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 17:56:01 +03:00
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 = {
|
||||
componentDidMount: function() {
|
||||
linkifyElement(this.refs.content.getDOMNode(), linkifyMatrix.options);
|
||||
linkifyElement(this.refs.content, linkifyMatrix.options);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -23,6 +23,6 @@ linkifyMatrix(linkify);
|
|||
|
||||
module.exports = {
|
||||
componentDidMount: function() {
|
||||
linkifyElement(this.refs.content.getDOMNode(), linkifyMatrix.options);
|
||||
linkifyElement(this.refs.content, linkifyMatrix.options);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@ linkifyMatrix(linkify);
|
|||
|
||||
module.exports = {
|
||||
componentDidMount: function() {
|
||||
linkifyElement(this.refs.content.getDOMNode(), linkifyMatrix.options);
|
||||
linkifyElement(this.refs.content, linkifyMatrix.options);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ module.exports = {
|
|||
componentDidMount: function() {
|
||||
this.dispatcherRef = dis.register(this.onAction);
|
||||
this.sentHistory.init(
|
||||
this.refs.textarea.getDOMNode(),
|
||||
this.refs.textarea,
|
||||
this.props.room.roomId
|
||||
);
|
||||
},
|
||||
|
@ -143,14 +143,14 @@ module.exports = {
|
|||
onAction: function(payload) {
|
||||
switch (payload.action) {
|
||||
case 'focus_composer':
|
||||
this.refs.textarea.getDOMNode().focus();
|
||||
this.refs.textarea.focus();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
onKeyDown: function (ev) {
|
||||
if (ev.keyCode === KeyCode.ENTER) {
|
||||
var input = this.refs.textarea.getDOMNode().value;
|
||||
var input = this.refs.textarea.value;
|
||||
if (input.length === 0) {
|
||||
ev.preventDefault();
|
||||
return;
|
||||
|
@ -179,7 +179,7 @@ module.exports = {
|
|||
|
||||
var self = this;
|
||||
setTimeout(function() {
|
||||
if (self.refs.textarea && self.refs.textarea.getDOMNode().value != '') {
|
||||
if (self.refs.textarea && self.refs.textarea.value != '') {
|
||||
self.onTypingActivity();
|
||||
} else {
|
||||
self.onFinishedTyping();
|
||||
|
@ -188,13 +188,13 @@ module.exports = {
|
|||
},
|
||||
|
||||
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);
|
||||
if (cmd) {
|
||||
ev.preventDefault();
|
||||
if (!cmd.error) {
|
||||
this.refs.textarea.getDOMNode().value = '';
|
||||
this.refs.textarea.value = '';
|
||||
}
|
||||
if (cmd.promise) {
|
||||
cmd.promise.done(function() {
|
||||
|
@ -241,12 +241,12 @@ module.exports = {
|
|||
action: 'message_send_failed'
|
||||
});
|
||||
});
|
||||
this.refs.textarea.getDOMNode().value = '';
|
||||
this.refs.textarea.value = '';
|
||||
ev.preventDefault();
|
||||
},
|
||||
|
||||
onTab: function(ev, sortedMembers) {
|
||||
var textArea = this.refs.textarea.getDOMNode();
|
||||
var textArea = this.refs.textarea;
|
||||
if (!this.tabStruct.completing) {
|
||||
this.tabStruct.completing = true;
|
||||
this.tabStruct.index = 0;
|
||||
|
|
|
@ -49,7 +49,7 @@ module.exports = {
|
|||
|
||||
componentWillUnmount: function() {
|
||||
if (this.refs.messageWrapper) {
|
||||
var messageWrapper = this.refs.messageWrapper.getDOMNode();
|
||||
var messageWrapper = this.refs.messageWrapper;
|
||||
messageWrapper.removeEventListener('drop', this.onDrop);
|
||||
messageWrapper.removeEventListener('dragover', this.onDragOver);
|
||||
messageWrapper.removeEventListener('dragleave', this.onDragLeaveOrEnd);
|
||||
|
@ -83,7 +83,7 @@ module.exports = {
|
|||
// scroll to bottom
|
||||
var messageWrapper = this.refs.messageWrapper;
|
||||
if (messageWrapper) {
|
||||
messageWrapper = messageWrapper.getDOMNode();
|
||||
messageWrapper = messageWrapper;
|
||||
messageWrapper.scrollTop = messageWrapper.scrollHeight;
|
||||
}
|
||||
break;
|
||||
|
@ -111,7 +111,7 @@ module.exports = {
|
|||
if (room.roomId != this.props.roomId) return;
|
||||
|
||||
if (this.refs.messageWrapper) {
|
||||
var messageWrapper = this.refs.messageWrapper.getDOMNode();
|
||||
var messageWrapper = this.refs.messageWrapper;
|
||||
this.atBottom = (
|
||||
messageWrapper.scrollHeight - messageWrapper.scrollTop <=
|
||||
(messageWrapper.clientHeight + 150)
|
||||
|
@ -155,7 +155,7 @@ module.exports = {
|
|||
|
||||
componentDidMount: function() {
|
||||
if (this.refs.messageWrapper) {
|
||||
var messageWrapper = this.refs.messageWrapper.getDOMNode();
|
||||
var messageWrapper = this.refs.messageWrapper;
|
||||
|
||||
messageWrapper.addEventListener('drop', this.onDrop);
|
||||
messageWrapper.addEventListener('dragover', this.onDragOver);
|
||||
|
@ -171,7 +171,7 @@ module.exports = {
|
|||
componentDidUpdate: function() {
|
||||
if (!this.refs.messageWrapper) return;
|
||||
|
||||
var messageWrapper = this.refs.messageWrapper.getDOMNode();
|
||||
var messageWrapper = this.refs.messageWrapper;
|
||||
|
||||
if (this.state.paginating && !this.waiting_for_paginate) {
|
||||
var heightGained = messageWrapper.scrollHeight - this.oldScrollHeight;
|
||||
|
@ -190,7 +190,7 @@ module.exports = {
|
|||
|
||||
fillSpace: function() {
|
||||
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) {
|
||||
this.setState({paginating: true});
|
||||
|
||||
|
@ -241,7 +241,7 @@ module.exports = {
|
|||
|
||||
onMessageListScroll: function(ev) {
|
||||
if (this.refs.messageWrapper) {
|
||||
var messageWrapper = this.refs.messageWrapper.getDOMNode();
|
||||
var messageWrapper = this.refs.messageWrapper;
|
||||
var wasAtBottom = this.atBottom;
|
||||
this.atBottom = messageWrapper.scrollHeight - messageWrapper.scrollTop <= messageWrapper.clientHeight;
|
||||
if (this.atBottom && !wasAtBottom) {
|
||||
|
|
|
@ -87,7 +87,7 @@ module.exports = {
|
|||
var scriptTag = document.createElement('script');
|
||||
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");
|
||||
this.refs.recaptchaContainer.getDOMNode().appendChild(scriptTag);
|
||||
this.refs.recaptchaContainer.appendChild(scriptTag);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue