diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-08-31 21:08:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-31 21:08:30 -0400 |
commit | 02194fcb9f5dfd61482b6d3814e395a1225c8a9b (patch) | |
tree | cf9db705bdae5517d9a62141a0b0a0f5494178bf /ext/js | |
parent | ce1a862df41691da1ee0c0d86b2fdb16472f316b (diff) |
Add support for structured content margins (#1920)
Diffstat (limited to 'ext/js')
-rw-r--r-- | ext/js/display/sandbox/structured-content-generator.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ext/js/display/sandbox/structured-content-generator.js b/ext/js/display/sandbox/structured-content-generator.js index f0e70c4d..82bf0421 100644 --- a/ext/js/display/sandbox/structured-content-generator.js +++ b/ext/js/display/sandbox/structured-content-generator.js @@ -216,7 +216,17 @@ class StructuredContentGenerator { _setStructuredContentElementStyle(node, contentStyle) { const {style} = node; - const {fontStyle, fontWeight, fontSize, textDecorationLine, verticalAlign} = contentStyle; + const { + fontStyle, + fontWeight, + fontSize, + textDecorationLine, + verticalAlign, + marginTop, + marginLeft, + marginRight, + marginBottom + } = contentStyle; if (typeof fontStyle === 'string') { style.fontStyle = fontStyle; } if (typeof fontWeight === 'string') { style.fontWeight = fontWeight; } if (typeof fontSize === 'string') { style.fontSize = fontSize; } @@ -226,5 +236,9 @@ class StructuredContentGenerator { } else if (Array.isArray(textDecorationLine)) { style.textDecoration = textDecorationLine.join(' '); } + if (typeof marginTop === 'number') { style.marginTop = `${marginTop}em`; } + if (typeof marginLeft === 'number') { style.marginLeft = `${marginLeft}em`; } + if (typeof marginRight === 'number') { style.marginRight = `${marginRight}em`; } + if (typeof marginBottom === 'number') { style.marginBottom = `${marginBottom}em`; } } } |