sforkowany z mirror/soapbox
debugging drag drop
rodzic
e57b4dbe00
commit
10f84911e5
|
@ -318,7 +318,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, children } = this.props;
|
const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, children } = this.props;
|
||||||
const { suggestionsHidden } = this.state;
|
const { draggingOver, suggestionsHidden } = this.state;
|
||||||
const style = { direction: 'ltr' };
|
const style = { direction: 'ltr' };
|
||||||
|
|
||||||
if (isRtl(value)) {
|
if (isRtl(value)) {
|
||||||
|
|
|
@ -42,6 +42,7 @@ class ChatBox extends ImmutablePureComponent {
|
||||||
onSetInputRef: PropTypes.func,
|
onSetInputRef: PropTypes.func,
|
||||||
me: PropTypes.node,
|
me: PropTypes.node,
|
||||||
onAttachment: PropTypes.func,
|
onAttachment: PropTypes.func,
|
||||||
|
windowState: PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
initialState = () => ({
|
initialState = () => ({
|
||||||
|
@ -200,7 +201,6 @@ class ChatBox extends ImmutablePureComponent {
|
||||||
|
|
||||||
if (e.dataTransfer && e.dataTransfer.files.length >= 1) {
|
if (e.dataTransfer && e.dataTransfer.files.length >= 1) {
|
||||||
this.handleFiles(e.dataTransfer.files);
|
this.handleFiles(e.dataTransfer.files);
|
||||||
// this.props.dispatch(uploadCompose(e.dataTransfer.files));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,6 +242,16 @@ class ChatBox extends ImmutablePureComponent {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderUploadArea = () => {
|
||||||
|
const { windowState } = this.props;
|
||||||
|
const { draggingOver } = this.state;
|
||||||
|
if (windowState !== 'open') return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<UploadArea active={draggingOver} onClose={this.closeUploadModal} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
renderAttachment = () => {
|
renderAttachment = () => {
|
||||||
const { attachment } = this.state;
|
const { attachment } = this.state;
|
||||||
if (!attachment) return null;
|
if (!attachment) return null;
|
||||||
|
@ -271,9 +281,9 @@ class ChatBox extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { chatMessageIds, chatId, intl } = this.props;
|
const { chatMessageIds, chatId, intl, windowState } = this.props;
|
||||||
const { content, isUploading, uploadProgress } = this.state;
|
const { content, isUploading, uploadProgress } = this.state;
|
||||||
const { draggingOver } = this.state;
|
console.log('window state: ' + windowState + ', chatID: ' + chatId);
|
||||||
if (!chatMessageIds) return null;
|
if (!chatMessageIds) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -281,7 +291,7 @@ class ChatBox extends ImmutablePureComponent {
|
||||||
<ChatMessageList chatMessageIds={chatMessageIds} chatId={chatId} />
|
<ChatMessageList chatMessageIds={chatMessageIds} chatId={chatId} />
|
||||||
{this.renderAttachment()}
|
{this.renderAttachment()}
|
||||||
<UploadProgress active={isUploading} progress={uploadProgress*100} />
|
<UploadProgress active={isUploading} progress={uploadProgress*100} />
|
||||||
<UploadArea active={draggingOver} onClose={this.closeUploadModal} />
|
{this.renderUploadArea()}
|
||||||
<div className='chat-box__actions simple_form'>
|
<div className='chat-box__actions simple_form'>
|
||||||
{this.renderActionButton()}
|
{this.renderActionButton()}
|
||||||
<textarea
|
<textarea
|
||||||
|
|
|
@ -108,6 +108,7 @@ class ChatWindow extends ImmutablePureComponent {
|
||||||
<div className='pane__content'>
|
<div className='pane__content'>
|
||||||
<ChatBox
|
<ChatBox
|
||||||
chatId={chat.get('id')}
|
chatId={chat.get('id')}
|
||||||
|
windowState={pane.get('state')}
|
||||||
onSetInputRef={this.handleInputRef}
|
onSetInputRef={this.handleInputRef}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
Ładowanie…
Reference in New Issue