braft-convert
Advanced tools
Comparing version 1.8.13 to 1.8.14
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.convertCodeBlock = exports.mergeStyledSpans = exports.getFromHTMLConfig = exports.getToHTMLConfig = exports.blocks = exports.getHexColor = exports.defaultFontFamilies = undefined; | ||
exports.getFromHTMLConfig = exports.getToHTMLConfig = exports.blocks = exports.getHexColor = exports.defaultFontFamilies = undefined; | ||
@@ -366,23 +366,22 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var nextBlockType = nextBlock && nextBlock.getType(); | ||
var codeBreakLine = block.text ? '' : '<br>'; | ||
if (previousBlockType === 'code-block' && nextBlockType === 'code-block') { | ||
return { | ||
start: "<code><div>" + codeBreakLine, | ||
end: '</div></code>' | ||
start: "<code>", | ||
end: '</code>\r\n' | ||
}; | ||
} else if (previousBlockType === 'code-block') { | ||
return { | ||
start: "<code><div>" + codeBreakLine, | ||
end: '</div></code></pre>' | ||
start: "<code>", | ||
end: '</code>\r\n</pre>' | ||
}; | ||
} else if (nextBlockType === 'code-block') { | ||
return { | ||
start: "<pre><code><div>" + codeBreakLine, | ||
end: '</div></code>' | ||
start: "<pre><code>", | ||
end: '</code>\r\n' | ||
}; | ||
} else { | ||
return { | ||
start: "<pre><code><div>" + codeBreakLine, | ||
end: '</div></code></pre>' | ||
start: "<pre><code>", | ||
end: '</code></pre>' | ||
}; | ||
@@ -601,13 +600,2 @@ } | ||
}; | ||
var mergeStyledSpans = exports.mergeStyledSpans = function mergeStyledSpans(htmlContent) { | ||
return htmlContent; | ||
}; | ||
var convertCodeBlock = exports.convertCodeBlock = function convertCodeBlock(htmlContent) { | ||
var result = htmlContent.replace(/\<code\>\<div\>\<br\>\<\/div\>\<\/code\>/g, "<code><div></div></code>").replace(/\<pre\>\<code\>\<div\>/g, '<code><div>').replace(/\<\/div\>\<\/code\>\<\/pre\>/g, '</div></code>').replace(/\<code\>\<div\>/g, '<pre><code>').replace(/\<\/div\>\<\/code\>/g, '</code></pre>'); | ||
return result; | ||
}; | ||
; | ||
@@ -639,4 +627,2 @@ | ||
reactHotLoader.register(getFromHTMLConfig, "getFromHTMLConfig", "src/configs.js"); | ||
reactHotLoader.register(mergeStyledSpans, "mergeStyledSpans", "src/configs.js"); | ||
reactHotLoader.register(convertCodeBlock, "convertCodeBlock", "src/configs.js"); | ||
leaveModule(module); | ||
@@ -643,0 +629,0 @@ })(); |
@@ -25,3 +25,3 @@ 'use strict'; | ||
var contentState = (0, _draftJs.convertFromRaw)(content); | ||
return (0, _configs.mergeStyledSpans)((0, _draftConvert.convertToHTML)((0, _configs.getToHTMLConfig)({ contentState: contentState, fontFamilies: fontFamilies }))(contentState)); | ||
return (0, _draftConvert.convertToHTML)((0, _configs.getToHTMLConfig)({ contentState: contentState, fontFamilies: fontFamilies }))(contentState); | ||
} catch (error) { | ||
@@ -28,0 +28,0 @@ console.warn(error); |
{ | ||
"name": "braft-convert", | ||
"version": "1.8.13", | ||
"version": "1.8.14", | ||
"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
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
220710
658