Questions tagged [draftjs]

Draft.js is a framework for building rich text editors in React, powered by an immutable model and abstracting over cross-browser differences.

Draft.js is a framework for building rich text editors in React, powered by an immutable model and abstracting over cross-browser differences.

Draft.js makes it easy to build any type of rich text input, whether you're just looking to support a few inline text styles or building a complex text editor for composing long-form articles.

In Draft.js, everything is customizable – it provides the building blocks so that you have full control over the user interface.

You can learn more about Draft.js here.

746 questions
4
votes
0 answers

How to store and index Draft.js output in databases?

What is the most efficient way to perform indexation for full-text search? I use mongodb, but i think this is not so important in the context of this question I'm thinking about two ways to store draft.js output with further indexing: Convert it to…
stkvtflw
  • 12,092
  • 26
  • 78
  • 155
4
votes
3 answers

How to handle key event in Draft js

if I want to handle input of character *, I can use handleBeforeInput(str): handleBeforeInput(str) { if (str !== '*') { return false; } // handling return true; } if I want to handle input of ENTER, I can use the hook…
Jonas Hao
  • 191
  • 1
  • 4
  • 11
4
votes
3 answers

Trying to use getCurrentContent in draftjs file

I want to get the content of my editor and eventually store to it to a const content. I'm getting an error of _draftJs.EditorState.getCurrentContent is not a function. import React from 'react' import ReactDOM from 'react-dom' import {Editor,…
David Kim
  • 41
  • 1
  • 2
4
votes
0 answers

Draft.js segmented mutability with "." delimiter

Apologies if this is in the documentation, but I've been unable to find it. With the segmented mutability option, is it possible to have something other than a "space" be the delimiting character? For instance I'm using a "." between words and I'd…
gfunk
  • 592
  • 6
  • 13
4
votes
1 answer

How to implement link in draft.js?

Official link example is broken (there is no contentState passed to findLinkEntities function). Is there any other implementations of link via draft.js?
Pavel Poberezhnyi
  • 733
  • 13
  • 28
4
votes
1 answer

Combine draft-js with redux-form

I have a form with 2 usual inputs where i can use this common approach: And also i have a draftJS editor in the form. I need to convert draftJS content to HTML (via draft-js-export-html) on submit, and load html to it on…
kuatro
  • 481
  • 1
  • 5
  • 17
4
votes
3 answers

Draft.js 's RichUtils.toggleInlineStyle doesn't work

Draft.js 's RichUtils.toggleInlineStyle doesn't work properly. please help! My code is on JSfiddle. Is there any misunderstood? var TextArea = React.createClass({ ... toggleBlockStyle: function(blockType) { …
森田昌宏
  • 51
  • 1
  • 3
3
votes
0 answers

ReferenceError: Window is not defined while importing htmlToDraft from html-to-draftjs on Node.js

I wrote a separate function to convert html to draftjs, there I used htmlToDraft function from html-to-draftjs. The Function: const htmlToDraftBlocks = (html) => { const blocksFromHTML = htmlToDraft(html); const state =…
Radhushani
  • 31
  • 2
3
votes
0 answers

problem about Draft-js when remove images by Backspace key

When deleting an image with text in the draft.js editor for image upload, occasionally the IMAGE entity remains even though the image was not rendering on the editor. This causes problems when converting that state into HTML because it appears that…
3
votes
2 answers

React application on Safari throws SyntaxError: Invalid regular expression: invalid group specifier name

I've just updated some depencencies in a React project using npm install and the updated project works nicely on all browser except Safari. On Safari it shows a blanks screen and an error in the console: SyntaxError: Invalid regular expression:…
lifeisfoo
  • 15,478
  • 6
  • 74
  • 115
3
votes
1 answer

Can we store metadata on every words and let user modify it and still keep it?

I’m new to lexcal and I’m developing annotation tool for speech-to-text. I have used draftjs. I use entity and decorator to store and manage metadata on each words. every single words are entities and each entity has timestamp as metadata. example:…
Ko Ohhashi
  • 844
  • 1
  • 11
  • 23
3
votes
2 answers

Draft-js JSON to EditorState does not update

So, I used Draft-js to create blog posts. When a user creates a post, the data is converted to a string and sent to the server to be saved. I converted the draft-js EditorState like…
Paul Bekaert
  • 81
  • 1
  • 10
3
votes
0 answers

Draft.js data is not sent to the server in React

I am using Draft.js editor for my project which is linked with a