Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

When you drag an image into the editor the console logs an error about .length not being available #2116

@jobpaardekooper

Description

@jobpaardekooper

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
The editor throws an error when you drag something in that does not have "text" as data of the drag event.

insertTextIntoContentState.js:25 Uncaught TypeError: Cannot read property 'length' of null
    at insertTextIntoContentState (insertTextIntoContentState.js:25)
    at Object.replaceText (DraftModifier.js:63)
    at Object.insertText (DraftModifier.js:67)
    at insertTextAtSelection (DraftEditorDragHandler.js:116)
    at onDrop (DraftEditorDragHandler.js:102)
    at DraftEditor.react.js:268
    at HTMLUnknownElement.callCallback (react-dom.development.js:147)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:196)
    at invokeGuardedCallback (react-dom.development.js:250)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:265)
    at executeDispatch (react-dom.development.js:571)
    at executeDispatchesInOrder (react-dom.development.js:596)
    at executeDispatchesAndRelease (react-dom.development.js:695)
    at executeDispatchesAndReleaseTopLevel (react-dom.development.js:704)
    at forEachAccumulated (react-dom.development.js:676)
    at runEventsInBatch (react-dom.development.js:844)
    at runExtractedEventsInBatch (react-dom.development.js:852)
    at handleTopLevel (react-dom.development.js:5030)
    at batchedUpdates$1 (react-dom.development.js:21469)
    at batchedUpdates (react-dom.development.js:2247)
    at dispatchEvent (react-dom.development.js:5110)
    at react-dom.development.js:21526
    at Object.unstable_runWithPriority (scheduler.development.js:255)
    at interactiveUpdates$1 (react-dom.development.js:21525)
    at interactiveUpdates (react-dom.development.js:2268)
    at dispatchInteractiveEvent (react-dom.development.js:5086)
insertTextIntoContentState @ insertTextIntoContentState.js:25
replaceText @ DraftModifier.js:63
insertText @ DraftModifier.js:67
insertTextAtSelection @ DraftEditorDragHandler.js:116
onDrop @ DraftEditorDragHandler.js:102
(anonymous) @ DraftEditor.react.js:268
callCallback @ react-dom.development.js:147
invokeGuardedCallbackDev @ react-dom.development.js:196
invokeGuardedCallback @ react-dom.development.js:250
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:265
executeDispatch @ react-dom.development.js:571
executeDispatchesInOrder @ react-dom.development.js:596
executeDispatchesAndRelease @ react-dom.development.js:695
executeDispatchesAndReleaseTopLevel @ react-dom.development.js:704
forEachAccumulated @ react-dom.development.js:676
runEventsInBatch @ react-dom.development.js:844
runExtractedEventsInBatch @ react-dom.development.js:852
handleTopLevel @ react-dom.development.js:5030
batchedUpdates$1 @ react-dom.development.js:21469
batchedUpdates @ react-dom.development.js:2247
dispatchEvent @ react-dom.development.js:5110
(anonymous) @ react-dom.development.js:21526
unstable_runWithPriority @ scheduler.development.js:255
interactiveUpdates$1 @ react-dom.development.js:21525
interactiveUpdates @ react-dom.development.js:2268
dispatchInteractiveEvent @ react-dom.development.js:5086

What is the expected behavior?
That this error does not appear

Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?
v0.10.5 and the current master version of the repo at the time of opening this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions