0

I am using draft-js, with React as a text editor and trying to update the content state with a youtube link (which i'll later thread up to an input/on-change event).

But right now the added-in entity map isn't carrying through from the convertFromRaw function.

for context - taking a (convertToRaw) object and replacing the .blocks (text) objects, works fine.

But adding an entity in the same way, does not.

enter image description here

Aid19801
  • 1,175
  • 1
  • 17
  • 30
  • Draft docs don't show an `EditorState.createContent()` function - did you mean `EditorState.createWithContent()`? https://draftjs.org/docs/api-reference-editor-state#createwithcontent – Duncan Thacker Feb 05 '19 at 11:33
  • @DuncanThacker yes, `createWithContent` is correct, updated the Q. This is not the root of the problem though, sadly. :( – Aid19801 Feb 05 '19 at 11:39

1 Answers1

0

this page have a very clear instruction on how to create entity, link

why convertFromRaw though? it doesn't make sense, did you even look at the document carefully before asking the question, I suggest you to look it up first, then write code.

plat123456789
  • 385
  • 3
  • 12