diff --git a/package.json b/package.json index 4f4e1653..e18a05f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mind-elixir", - "version": "3.2.5", + "version": "3.2.6", "type": "module", "description": "Mind elixir is a free open source mind map core.", "keywords": [ diff --git a/src/index.less b/src/index.less index 51aef57a..890c6426 100644 --- a/src/index.less +++ b/src/index.less @@ -248,6 +248,9 @@ margin-bottom: 8px; object-fit: cover; } + & > .text { + display: inline-block; + } } .circle { position: absolute; diff --git a/src/index.ts b/src/index.ts index bf8e2a62..d8a6279a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -126,7 +126,7 @@ MindElixir.DARK_THEME = DARK_THEME * @memberof MindElixir * @static */ -MindElixir.version = '3.2.5' +MindElixir.version = '3.2.6' /** * @function * @memberof MindElixir diff --git a/src/plugin/exportImage.ts b/src/plugin/exportImage.ts index c8440ec2..12b2dfa3 100644 --- a/src/plugin/exportImage.ts +++ b/src/plugin/exportImage.ts @@ -20,7 +20,12 @@ function lineHightToPadding(lineHeight: string, fontSize: string) { function generateSvgText(tpc: HTMLElement, tpcStyle: CSSStyleDeclaration, x: number, y: number) { const g = document.createElementNS('http://www.w3.org/2000/svg', 'g') - const content = tpc.childNodes[0].textContent + let content = '' + if ((tpc as Topic).text) { + content = (tpc as Topic).text.textContent! + } else { + content = tpc.childNodes[0].textContent! + } const lines = content!.split('\n') lines.forEach((line, index) => { const text = document.createElementNS('http://www.w3.org/2000/svg', 'text') @@ -45,7 +50,12 @@ function generateSvgText(tpc: HTMLElement, tpcStyle: CSSStyleDeclaration, x: num } function generateSvgTextUsingForeignObject(tpc: HTMLElement, tpcStyle: CSSStyleDeclaration, x: number, y: number) { - const content = tpc.childNodes[0].textContent! + let content = '' + if ((tpc as Topic).text) { + content = (tpc as Topic).text.textContent! + } else { + content = tpc.childNodes[0].textContent! + } const foreignObject = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject') setAttributes(foreignObject, { x: x + parseInt(tpcStyle.paddingLeft) + '', @@ -144,7 +154,7 @@ const generateSvg = (mei: MindElixirInstance, noForiegnObject = false) => { summaries && g.appendChild(summaries) mapDiv.querySelectorAll('me-tpc').forEach(tpc => { - g.appendChild(convertDivToSvg(mei, (tpc as Topic).text, noForiegnObject ? false : true)) + g.appendChild(convertDivToSvg(mei, tpc as Topic, noForiegnObject ? false : true)) }) mapDiv.querySelectorAll('.tags > span').forEach(tag => { g.appendChild(convertDivToSvg(mei, tag as HTMLElement))