draftjs-utils
Advanced tools
Comparing version 0.7.3 to 0.7.4
@@ -8,2 +8,3 @@ /* @flow */ | ||
getSelectionEntity, | ||
extractInlineStyle, | ||
removeAllInlineStyles, | ||
@@ -52,2 +53,3 @@ getSelectionInlineStyle, | ||
getSelectionEntity, | ||
extractInlineStyle, | ||
removeAllInlineStyles, | ||
@@ -54,0 +56,0 @@ getSelectionInlineStyle, |
@@ -234,2 +234,22 @@ /* @flow */ | ||
/** | ||
* | ||
*/ | ||
export function extractInlineStyle(editorState) { | ||
if(editorState) { | ||
const styleList = editorState.getCurrentContent().getBlockMap().map(block => block.get('characterList')).toList().flatten(); | ||
styleList.forEach(style => { | ||
if (style && style.indexOf('color-') === 0) { | ||
addToCustomStyleMap('color', 'color', style.substr(6)); | ||
} else if (style && style.indexOf('bgcolor-') === 0) { | ||
addToCustomStyleMap('bgcolor', 'backgroundColor', style.substr(8)); | ||
} else if (style && style.indexOf('fontsize-') === 0) { | ||
addToCustomStyleMap('fontSize', 'fontsize', style.substr(9)); | ||
} else if (style && style.indexOf('fontfamily-') === 0) { | ||
addToCustomStyleMap('fontFamily', 'fontfamily', style.substr(11)); | ||
} | ||
}); | ||
} | ||
} | ||
/** | ||
* Function returns size at a offset. | ||
@@ -236,0 +256,0 @@ */ |
{ | ||
"name": "draftjs-utils", | ||
"version": "0.7.3", | ||
"version": "0.7.4", | ||
"description": "Collection of utility function for use with Draftjs.", | ||
@@ -5,0 +5,0 @@ "main": "lib/draftjs-utils.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
564284
1856