Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.
/ backdraft-js Public archive

Simple function to turn a Draft.js RawDraftContentBlock into a marked-up string.

Notifications You must be signed in to change notification settings

evanc/backdraft-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

backdraft-js

Simple function to turn a Draft.js RawDraftContentBlock into a marked-up string.

Install

$ npm install --save backdraft-js

Usage

var backdraft = require('backdraft-js');

var rawDraftContentBlock = Draft.convertToRaw(contentState);

var markup = {
	'BOLD': ['<strong>', '</strong>'],
	'ITALIC': ['<em>', '</em>']
};

var markedUpBlocks = backdraft(rawDraftContentBlock, markup);

API

backdraft(rawDraftContentBlock, markup) -> array

markup is an object, the key should be the DraftJS "style" identifier and the value should be an array: the first item will be appended to the output to "open" the style and the second tag will be appended to "close" the style. See "Usage" above for a simple example.

About

Simple function to turn a Draft.js RawDraftContentBlock into a marked-up string.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published