You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-20 16:22:28 +03:00
make file pasting work again
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user