@slate-serializers/html
Advanced tools
Comparing version 2.0.1 to 2.1.0
{ | ||
"name": "@slate-serializers/html", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"type": "commonjs", | ||
@@ -16,4 +16,4 @@ "dependencies": { | ||
"slate-hyperscript": "^0.77.0", | ||
"@slate-serializers/dom": "2.0.1", | ||
"@slate-serializers/utilities": "2.0.0", | ||
"@slate-serializers/dom": "2.1.0", | ||
"@slate-serializers/utilities": "2.1.0", | ||
"tslib": "2.5.0" | ||
@@ -20,0 +20,0 @@ }, |
@@ -52,3 +52,4 @@ "use strict"; | ||
convertBrToLineBreak: true, | ||
trimWhiteSpace: true, | ||
}; | ||
//# sourceMappingURL=default.js.map |
@@ -27,2 +27,3 @@ import { Element } from 'domhandler'; | ||
convertBrToLineBreak?: boolean; | ||
trimWhiteSpace?: boolean; | ||
} | ||
@@ -29,0 +30,0 @@ type UpdaterFunction = (el: Element) => Element | string; |
@@ -57,2 +57,3 @@ "use strict"; | ||
isNextSiblingBlock: (el.next && (0, domhandler_1.isTag)(el.next) && (0, utilities_1.isBlock)(el.next.tagName)) || false, | ||
shouldTrimWhiteSpace: config.trimWhiteSpace, | ||
}); | ||
@@ -59,0 +60,0 @@ if (text === '') { |
@@ -8,7 +8,8 @@ export type Context = 'preserve' | 'block' | 'inline' | ''; | ||
isNextSiblingBlock?: boolean; | ||
shouldTrimWhiteSpace?: boolean; | ||
} | ||
export declare const processTextValue: ({ text, context, isInlineStart, isInlineEnd, isNextSiblingBlock, }: IprocessTextValue) => string; | ||
export declare const minifyText: (str: string) => string; | ||
export declare const processTextValue: ({ text, context, isInlineStart, isInlineEnd, isNextSiblingBlock, shouldTrimWhiteSpace }: IprocessTextValue) => string; | ||
export declare const minifyText: (str: string, shouldTrimWhiteSpace: boolean) => string; | ||
export declare const isAllWhitespace: (str: string) => boolean; | ||
export declare const getContext: (tagName: string) => Context; | ||
export {}; |
@@ -5,3 +5,3 @@ "use strict"; | ||
const utilities_1 = require("@slate-serializers/utilities"); | ||
const processTextValue = ({ text, context = '', isInlineStart = false, isInlineEnd = false, isNextSiblingBlock = false, }) => { | ||
const processTextValue = ({ text, context = '', isInlineStart = false, isInlineEnd = false, isNextSiblingBlock = false, shouldTrimWhiteSpace = true }) => { | ||
let parsed = text; | ||
@@ -11,3 +11,3 @@ if (context === 'preserve') { | ||
} | ||
parsed = (0, exports.minifyText)(parsed); | ||
parsed = (0, exports.minifyText)(parsed, shouldTrimWhiteSpace); | ||
if (context === 'block') { | ||
@@ -26,4 +26,4 @@ // is this the start of inline content after a block element? | ||
exports.processTextValue = processTextValue; | ||
const minifyText = (str) => { | ||
return reduceToSingleSpaces(replaceNewlines(str)); | ||
const minifyText = (str, shouldTrimWhiteSpace) => { | ||
return shouldTrimWhiteSpace ? reduceToSingleSpaces(replaceNewlines(str)) : replaceNewlines(str); | ||
}; | ||
@@ -30,0 +30,0 @@ exports.minifyText = minifyText; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
37970
422
+ Added@slate-serializers/dom@2.1.0(transitive)
+ Added@slate-serializers/utilities@2.1.0(transitive)
- Removed@slate-serializers/dom@2.0.1(transitive)
- Removed@slate-serializers/utilities@2.0.0(transitive)
Updated@slate-serializers/dom@2.1.0