Socket
Socket
Sign inDemoInstall

@jimmycode/draft-js-soft-newline-plugin

Package Overview
Dependencies
27
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @jimmycode/draft-js-soft-newline-plugin

Add support for soft newlines in your draft-js editor.


Version published
Weekly downloads
65
decreased by-29.35%
Maintainers
3
Created
Weekly downloads
 

Readme

Source

Draftjs Soft Newline Plugin

Add support for soft newlines in your draft-js editor.

This is a plugin for draft-js-plugins-editor.

Installation

npm install @jimmycode/draft-js-soft-newline-plugin

Usage

import createSoftNewLinePlugin from '@jimmycode/draft-js-soft-newline-plugin';
const softNewLinePlugin = createSoftNewLinePlugin();

Example

import React from 'react';
import ReactDOM from 'react-dom';

import Editor from 'draft-js-plugins-editor';
import { EditorState } from 'draft-js';
import createSoftNewLinePlugin from '@jimmycode/draft-js-soft-newline-plugin';

const softNewLinePlugin = createSoftNewLinePlugin();
const plugins = [
  softNewLinePlugin
];

class MyEditor extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      editorState: EditorState.createEmpty()
    };
  }
  
  onChange = editorState => this.setState({ editorState });

  render() {
    return (
      <div className="editor">
        <Editor
          editorState={this.state.editorState}
          onChange={this.onChange}
          plugins={plugins}
          placeholder="Tell a story" />
      </div>
    );
  }
}

ReactDOM.render(<MyEditor />, document.getElementById('root'));

Keywords

FAQs

Last updated on 09 Aug 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc