Skip to content

Commit

Permalink
fix line break bug within export due to line break conversion in tspan (
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikStreek authored Mar 5, 2024
1 parent e05939c commit 34283cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion teammapper-frontend/mmp/src/map/handlers/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default class Export {
const x = parseInt(fo.getAttribute('x'), 10) + Math.floor(parseInt(fo.getAttribute('width'), 10) / 2)
const splittedText = fo.firstChild.textContent.split('\n')
// line breaks are created via tspan elements that are relatively positioned using dy property
const svgTextWithLineBreaks = splittedText.map((text, i) => `<tspan dy="${(i === 0 || i === splittedText.length - 1) ? '0' : '1.2em'}" x="${x}">${text}</tspan>`)
const svgTextWithLineBreaks = splittedText.map((text, i) => `<tspan dy="${(i === 0) ? '0' : '1.2em'}" x="${x}">${text}</tspan>`)
const textSVG = DOMPurify.sanitize(svgTextWithLineBreaks.join(''), { USE_PROFILES: { svg: true }, NAMESPACE: 'http://www.w3.org/2000/svg'})
d3.select(parent)
.attr('width', fo.getAttribute('width'))
Expand Down

0 comments on commit 34283cb

Please sign in to comment.