Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React, { Component } from 'react';
import Editor, { createEditorStateWithText } from 'draft-js-plugins-editor';
import TextToolbar from 'draft-js-toolbar-plugin/components/text-toolbar';
import createToolbarPlugin from 'draft-js-toolbar-plugin';
import styles from './styles.css';
const toolbarPlugin = createToolbarPlugin({});
const text = `Cool, we can have all sorts of Emojis here. 🙌
🌿☃️🎉🙈 aaaand maybe a few more here 🐲☀️🗻 Quite fun!`;
class SimpleToolbarEditor extends Component {
state = {
editorState: createEditorStateWithText(text),
draggingOver: false,
};
onChange = (editorState) => {
// console.log(convertToRaw(editorState.getCurrentContent()));
this.setState({
editorState,
});
};
import React, {Component} from 'react';
import Image from './Image';
import {EditorState} from 'draft-js';
import Editor from 'draft-js-plugins-editor';
import createUploadPlugin from 'draft-js-dnd-plugin';
import createToolbarPlugin from 'draft-js-toolbar-plugin';
import TextToolbar from 'draft-js-toolbar-plugin/components/text-toolbar';
import styles from './styles.css';
import mockUpload from '../utils/mockUpload';
import DndWrapper from 'draft-js-dnd-plugin/components/dnd-wrapper';
import decorateWithProps from 'decorate-component-with-props';
const toolbarPlugin = createToolbarPlugin({});
const uploadPlugin = createUploadPlugin({
Image: decorateWithProps(Image, { toolbarTheme: toolbarPlugin.theme }),
upload: (data, success, failed, progress) =>
mockUpload(data, success, failed, progress),
});
class SimpleDndEditor extends Component {
state = {
editorState: EditorState.createEmpty(),
draggingOver: false,
};
onChange = (editorState) => {
this.setState({
editorState,
});