I'm using Draft.js to implement a text editor. I want to save the content of the editor to a DB and later retrieve it and inject it in an editor again, e.g. when revisiting the editor page. First, these are the relevant imports import { Content...
I am attempting to implement a DraftJS editor that highlights words in a transcription while its recorded audio is playing (kind of like karaoke). I receive the data in this format: [ { transcript: "This is the first block", times...
I'm wondering how to align text in Draft.js just like on the picture below. I have searched this several days, but I haven't found the solution....
Is there a "correct way" to detect if I lose focus of a Draft.js editor? The use case is, that I want "quit editor mode" if the user clicks elsewhere which means that I toggle the readOnly prop of the editor. How can I do this ideall...
Here is my code trying to insert an image in the draft.js editor. But I failed. When I clicked on the button, only several empty lines were inserted, what's the problem? MyEditor.js import React from 'react'; import {Editor, EditorState...
I'm trying to have a function run only when the contentState itself has changed, not just the editorState. My idea right now would be to store the old contentState as a string and compare it to the new contentState as a string, but this seems aw...
From official docs I know about 2 methods: get entity by its key and get last created entity. In my case, I also need a method to access all entities from current ContentState. Is there any method that could perform this? If not, is there a one that...
I'm using Draft.js Editor component. I have a custom block renderer specified correctly via blockRendererFn prop. The component renders the EditorBlock imported from draft-js as advised in the Draft documentation. In the props I get in my custom...
I'm learning React: totally newbie. If I save in DB the HTML directly from draft.js (or it's variants always based on it) and then in a view page of my React SPA I retrieve HTML from DB through my API: QUESTIONS: how can I render that HTM...
Let's go straight to the problem. I have editor full of entities, custom renderers etc and I'm trying to add Background color functionality. I'm looking for a way to render selected block inside custom block. App flow should look like...
©2020 All rights reserved.