mirror of https://github.com/vector-im/riot-web
make file pasting work again
parent
d426c3474f
commit
1536ab433a
|
@ -20,6 +20,7 @@ import PropTypes from 'prop-types';
|
||||||
import type SyntheticKeyboardEvent from 'react/lib/SyntheticKeyboardEvent';
|
import type SyntheticKeyboardEvent from 'react/lib/SyntheticKeyboardEvent';
|
||||||
|
|
||||||
import { Editor } from 'slate-react';
|
import { Editor } from 'slate-react';
|
||||||
|
import { getEventTransfer } from 'slate-react';
|
||||||
import { Value, Document, Event, Inline, Text, Range, Node } from 'slate';
|
import { Value, Document, Event, Inline, Text, Range, Node } from 'slate';
|
||||||
|
|
||||||
import Html from 'slate-html-serializer';
|
import Html from 'slate-html-serializer';
|
||||||
|
@ -755,6 +756,18 @@ export default class MessageComposerInput extends React.Component {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onPaste = (event: Event, change: Change, editor: Editor): Change => {
|
||||||
|
const transfer = getEventTransfer(event);
|
||||||
|
|
||||||
|
if (transfer.type === "files") {
|
||||||
|
return this.props.onFilesPasted(transfer.files);
|
||||||
|
}
|
||||||
|
if (transfer.type === "html") {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
onTextPasted = (text: string, html?: string) => {
|
onTextPasted = (text: string, html?: string) => {
|
||||||
const currentSelection = this.state.editorState.getSelection();
|
const currentSelection = this.state.editorState.getSelection();
|
||||||
|
@ -1331,14 +1344,10 @@ export default class MessageComposerInput extends React.Component {
|
||||||
value={this.state.editorState}
|
value={this.state.editorState}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
onKeyDown={this.onKeyDown}
|
onKeyDown={this.onKeyDown}
|
||||||
|
onPaste={this.onPaste}
|
||||||
renderNode={this.renderNode}
|
renderNode={this.renderNode}
|
||||||
renderMark={this.renderMark}
|
renderMark={this.renderMark}
|
||||||
spellCheck={true}
|
spellCheck={true}
|
||||||
/*
|
|
||||||
handlePastedText={this.onTextPasted}
|
|
||||||
handlePastedFiles={this.props.onFilesPasted}
|
|
||||||
stripPastedStyles={!this.state.isRichtextEnabled}
|
|
||||||
*/
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue