draftjs-md-converter
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -378,3 +378,4 @@ 'use strict'; | ||
addInlineStyleRange(text.length, child.value.length, style.type); | ||
} else if (inlineStyles[child.type]) { | ||
} | ||
if (inlineStyles[child.type]) { | ||
addInlineStyleRange(text.length, child.value.length, inlineStyles[child.type].type); | ||
@@ -381,0 +382,0 @@ } |
{ | ||
"name": "draftjs-md-converter", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Converter for converting Draft.js state into Markdown and vice versa", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -1,2 +0,1 @@ | ||
[![Build Status](https://travis-ci.org/kadikraman/draftjs-md-converter.svg?branch=master)](https://travis-ci.org/kadikraman/draftjs-md-converter) | ||
[![npm version](https://badge.fury.io/js/draftjs-md-converter.svg)](https://badge.fury.io/js/draftjs-md-converter) | ||
@@ -6,7 +5,7 @@ | ||
Converts content from Draft.js blocks to Markdown and vice versa. | ||
Converts rich text content between Draft.js blocks and Markdown. | ||
## Reasoning and background | ||
This exists because I needed a highly customisable rich text editor which posts to an external API in Markdown. [Draft.js](https://facebook.github.io/draft-js/) to the rescue! Alas, it doesn't ship with any sort of import or export to or from markdown so I've written my own. | ||
This library exists because I needed a highly customisable rich text editor which posts to an external API in Markdown. [Draft.js](https://facebook.github.io/draft-js/) to the rescue! It provides the editor state but, alas, doesn't ship with any sort of conversion to or from markdown. So, I've written my own. | ||
@@ -33,3 +32,3 @@ ## Installation | ||
The following media is supported: | ||
The following media types are supported: | ||
@@ -41,2 +40,3 @@ * images | ||
### Converting from Markdown to Draft.js | ||
### `mdToDraftjs(markdown: String): RawDraftContentState` | ||
@@ -46,2 +46,3 @@ | ||
### Converting from Draft.js to Markdown | ||
### `draftjsToMd(rawData: RawDraftContentState): String` | ||
@@ -62,3 +63,3 @@ | ||
The inline styles extended or overridden by passing it in as a second optional argument to `draftjsToMd`, e.g. | ||
The inline styles can be extended or overridden by passing a custom dictionary object as a second optional argument to `draftjsToMd`, e.g. | ||
@@ -73,3 +74,3 @@ ```js | ||
NOTE: at this point you cannot override block styles! | ||
__NOTE: at this point you cannot override block styles!__ | ||
@@ -76,0 +77,0 @@ ## Example |
@@ -183,3 +183,4 @@ 'use strict'; | ||
addInlineStyleRange(text.length, child.value.length, style.type); | ||
} else if (inlineStyles[child.type]) { | ||
} | ||
if (inlineStyles[child.type]) { | ||
addInlineStyleRange(text.length, child.value.length, inlineStyles[child.type].type); | ||
@@ -186,0 +187,0 @@ } |
196132
10
752
126