An open API service indexing awesome lists of open source software.

https://github.com/null-none/draft-js-first-line-heading

The plugin force block style on first line for a heading/title. Alternatives to Medium Editor.
https://github.com/null-none/draft-js-first-line-heading

draft-js plugin plugins react

Last synced: 7 months ago
JSON representation

The plugin force block style on first line for a heading/title. Alternatives to Medium Editor.

Awesome Lists containing this project

README

          

# draft-js-first-line-heading
The plugin force block style on first line for a heading/title. Alternatives to Medium Editor.

## Install

```bash
$ npm install draft-js-first-line-heading
```

## Usage

```js
import createFirstLineHeadingPLugin from 'draft-js-first-line-heading';
const firstLineHeading = createFirstLineHeadingPLugin();

...

const plugins = [firstLineHeading];

let lines = this.state.story.getCurrentContent().getPlainText().split('\n');
let title = lines[0];
lines.shift();
let body = lines.join('\n');

console.log(title, body)

...

```

## License
MIT