Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

braft-convert

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

braft-convert - npm Package Compare versions

Comparing version 2.1.3 to 2.1.4

26

dist/configs.js

@@ -469,3 +469,3 @@ "use strict";

var htmlToStyle = function htmlToStyle(options) {
var htmlToStyle = function htmlToStyle(options, source) {
return function (nodeName, node, currentStyle) {

@@ -489,7 +489,7 @@

} else if (nodeName === 'span' && style === 'font-size') {
newStyle = newStyle.add('FONTSIZE-' + unitImportFn(node.style.fontSize, 'font-size'));
newStyle = newStyle.add('FONTSIZE-' + unitImportFn(node.style.fontSize, 'font-size', source));
} else if (nodeName === 'span' && style === 'line-height') {
newStyle = newStyle.add('LINEHEIGHT-' + unitImportFn(node.style.lineHeight, 'line-height'));
newStyle = newStyle.add('LINEHEIGHT-' + unitImportFn(node.style.lineHeight, 'line-height', source));
} else if (nodeName === 'span' && style === 'letter-spacing' && !isNaN(node.style.letterSpacing.replace('px', ''))) {
newStyle = newStyle.add('LETTERSPACING-' + unitImportFn(node.style.letterSpacing, 'letter-spacing'));
newStyle = newStyle.add('LETTERSPACING-' + unitImportFn(node.style.letterSpacing, 'letter-spacing', source));
} else if (nodeName === 'span' && style === 'text-decoration' && node.style.textDecoration === 'line-through') {

@@ -512,3 +512,3 @@ newStyle = newStyle.add('STRIKETHROUGH');

options.styleImportFn && (newStyle = options.styleImportFn(nodeName, node, newStyle) || newStyle);
options.styleImportFn && (newStyle = options.styleImportFn(nodeName, node, newStyle, source) || newStyle);
return newStyle;

@@ -518,7 +518,7 @@ };

var htmlToEntity = function htmlToEntity(options) {
var htmlToEntity = function htmlToEntity(options, source) {
return function (nodeName, node, createEntity) {
if (options && options.entityImportFn) {
var customInput = options.entityImportFn(nodeName, node, createEntity);
var customInput = options.entityImportFn(nodeName, node, createEntity, source);
if (customInput) {

@@ -590,7 +590,7 @@ return customInput;

var htmlToBlock = function htmlToBlock(options) {
var htmlToBlock = function htmlToBlock(options, source) {
return function (nodeName, node) {
if (options && options.blockImportFn) {
var customInput = options.blockImportFn(nodeName, node);
var customInput = options.blockImportFn(nodeName, node, source);
if (customInput) {

@@ -657,9 +657,11 @@ return customInput;

var getFromHTMLConfig = exports.getFromHTMLConfig = function getFromHTMLConfig(options) {
var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'unknow';
return {
htmlToStyle: htmlToStyle(options),
htmlToEntity: htmlToEntity(options),
htmlToBlock: htmlToBlock(options)
htmlToStyle: htmlToStyle(options, source),
htmlToEntity: htmlToEntity(options, source),
htmlToBlock: htmlToBlock(options, source)
};
};
//# sourceMappingURL=configs.js.map

@@ -34,3 +34,3 @@ 'use strict';

var convertHTMLToRaw = exports.convertHTMLToRaw = function convertHTMLToRaw(HTMLString, options) {
var convertHTMLToRaw = exports.convertHTMLToRaw = function convertHTMLToRaw(HTMLString, options, source) {

@@ -40,3 +40,3 @@ options = _extends({}, defaultConvertOptions, options);

try {
var contentState = (0, _draftConvert.convertFromHTML)((0, _configs.getFromHTMLConfig)(options))(HTMLString);
var contentState = (0, _draftConvert.convertFromHTML)((0, _configs.getFromHTMLConfig)(options, source))(HTMLString);
return (0, _draftJs.convertToRaw)(contentState);

@@ -63,3 +63,3 @@ } catch (error) {

var convertHTMLToEditorState = exports.convertHTMLToEditorState = function convertHTMLToEditorState(HTMLString, editorDecorators, options) {
var convertHTMLToEditorState = exports.convertHTMLToEditorState = function convertHTMLToEditorState(HTMLString, editorDecorators, options, source) {

@@ -69,3 +69,3 @@ options = _extends({}, defaultConvertOptions, options);

try {
return _draftJs.EditorState.createWithContent((0, _draftConvert.convertFromHTML)((0, _configs.getFromHTMLConfig)(options))(HTMLString), editorDecorators);
return _draftJs.EditorState.createWithContent((0, _draftConvert.convertFromHTML)((0, _configs.getFromHTMLConfig)(options, source))(HTMLString), editorDecorators);
} catch (error) {

@@ -72,0 +72,0 @@ console.warn(error);

{
"name": "braft-convert",
"version": "2.1.3",
"version": "2.1.4",
"description": "A convert helper for Braft Editor.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc