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.
- Host: GitHub
- URL: https://github.com/null-none/draft-js-first-line-heading
- Owner: null-none
- Created: 2018-04-12T07:53:53.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-06T18:43:55.000Z (almost 6 years ago)
- Last Synced: 2025-02-27T01:48:47.703Z (about 1 year ago)
- Topics: draft-js, plugin, plugins, react
- Language: JavaScript
- Homepage:
- Size: 37.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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