1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-21 22:45:18 +02:00

Fix image example's onPaste (#1375)

* Fix image example's onPaste

* Fix lint test

* Add custom onDrop back to support files drop

* Check event type in onDropOrPaste
This commit is contained in:
来诺
2017-11-14 03:53:31 +08:00
committed by Ian Storm Taylor
parent b973580c54
commit 72f49bf6d7

View File

@@ -110,8 +110,8 @@ class Images extends React.Component {
value={this.state.value}
schema={schema}
onChange={this.onChange}
onDrop={this.onDrop}
onPaste={this.onPaste}
onDrop={this.onDropOrPaste}
onPaste={this.onDropOrPaste}
renderNode={this.renderNode}
/>
</div>
@@ -176,8 +176,8 @@ class Images extends React.Component {
*/
onDropOrPaste = (event, change, editor) => {
const target = getEventRange(event)
if (!target) return
const target = getEventRange(event, change.value)
if (!target && event.type == 'drop') return
const transfer = getEventTransfer(event)
const { type, text, files } = transfer