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
0
votes
1 answer

How to add meta data to a specific word and turn it into a custom type while using decorators with a regex strategy?

I’m struggling at modeling a certain use case of mine with Draft.js. I’m highlighting certain words/phrases in the editor with a composite decorator by using a regex strategy. What I’m trying to archive is: if a user clicks on a decorated word, I…
roundrobin
  • 674
  • 1
  • 7
  • 23
0
votes
1 answer

Draft.js change default monospace font

By default Draft Editor uses the default system monospace. I was wondering if they was a way to change it to Consolas through Draft.css or using global css classes.
Mary Cahill
  • 163
  • 3
  • 12
0
votes
1 answer

mongodb doesnt save 2 objects inside the main object

I want to save an object that has and object and array inside it. But when I end up saving the data in the mongo, it doesnt save a few properties. like "entityMap": {}, data: {} body = { entityMap: {}, blocks: [ { key: '637gr', text:…
JP.
  • 1,035
  • 2
  • 17
  • 39
0
votes
0 answers

draft-js text within custom atomic block

Using Draft-js, I'm inserting an atomic block into the editor via an entity: const contentState = editorState.getCurrentContent(); const contentStateWithEntity = contentState.createEntity( 'IMAGE', 'IMMUTABLE', {src:…
Alias
  • 2,983
  • 7
  • 39
  • 62
0
votes
3 answers

How to insert / upload image (update entity and blocks) in Draft.js?

I am trying to insert image to Draft.js editor. Based on my understanding, I need update entity by mergeData and blocks by mergeBlockData. (I am not sure) Now I am trying to use mergeBlockData to insert a block. mergeBlockData( contentState:…
Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267
0
votes
1 answer

Draft.js styles not working

I'm trying to use Draft.js with the Image plugin. Here are my problems. I manage to get it to work, but the styles aren't loaded and the editor takes the whole page and the buttons aren't styled. I load the styles from the provided CSS import…
aspiring_dev
  • 83
  • 4
  • 12
0
votes
1 answer

How to allow resizing when the mouse hovers on the bottom of the image?

I am using Draft.js plugin Resizeable. I am trying to allow resizing when the mouse hovers on the bottom (if possible, also include bottom right corner) of the image. In the document Usage section, it says: Hover with the mouse on the right side…
Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267
0
votes
1 answer

Why instanceof Map returns false?

I am using Draft.js plugin Mention. For editorState.content.entityMap.mention, I can successfully get value by mention.get('address') But why I check whether it is Map by console.log('mention', mention); console.log('mention instanceof Map',…
Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267
0
votes
1 answer

Importing Editor from draft-js-plugins-editor causes TypeErrors on empty project

I've created a new React project in Webstorm. I've installed draft-js and draft-js-plugins-editor, along with the plugins draft-js-hashtag-plugin and draft-js-mathjax-plugin (Using node). I've following their 'getting started' on their Github,…
haz
  • 2,034
  • 4
  • 28
  • 52
0
votes
0 answers

How to fix array to string error with wysiwyg editor

So im trying to update a comment on my database using a "PUT" method in react this is my function to fetch the api : updateComment = () =>{ const comments = this.state.updateComment; const i = this.state.selectedTicket.id; …
user7949952
0
votes
1 answer

Draft.js Custom content block doesnt show up

I'm creating a ContentState from an Array of blocks that were created programmatically, but when I created an EditorState using the ContentState nothing shows up in the edtior, is this the right way to create custom blocks? const dummyBlocks = [ new…
ryudice
  • 36,476
  • 32
  • 115
  • 163
0
votes
1 answer

Draft JS Modifier.ReplaceText undo/redo error

Background: Using Draft-JS, I've a chunk of code which will replace a word with an Entity on clicking 'Return' so user types in 'i love eggplant' then 'Return' they should see 'i love :eggplant:' Problem After the entity has been added, when I do an…
whomba
  • 387
  • 5
  • 13
0
votes
1 answer

can't run react app using draft-js on android phone

I'm working on a react-app using draft-js but when I run my application I have always this error this is my js: import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import {Editor, EditorState} from…
sana
  • 133
  • 8
0
votes
0 answers

Is draft.js secure?

I've been looking into the possibility of using this framework, but I have not found any explicit statement of its security features, if any. I've run searches both in Google and on their Github. Since Facebook created this and makes it available to…
Malik A. Rumi
  • 1,855
  • 4
  • 25
  • 36
0
votes
1 answer

Simple Schema is deleting an Object value (DraftJS Raw Editor State object) when cleaning

I am using the npm version of Simple Schema. I have a schema defined like this: const PageSchema = new SimpleSchema({ organizationId: String, title: String, published: Boolean, slug: String, content: { type: Object, optional: true …
Dave Munger
  • 479
  • 3
  • 11