SYNC: configurable export watermark

This commit is contained in:
SPRINX0\prochazka
2025-04-01 10:40:45 +02:00
committed by Diflow
parent 3f98f9ff39
commit 4bc9b70882
4 changed files with 25 additions and 4 deletions

View File

@@ -195,8 +195,8 @@ module.exports = {
},
exportDiagram_meta: true,
async exportDiagram({ filePath, html, css, themeType, themeClassName }) {
await fs.writeFile(filePath, getDiagramExport(html, css, themeType, themeClassName));
async exportDiagram({ filePath, html, css, themeType, themeClassName, watermark }) {
await fs.writeFile(filePath, getDiagramExport(html, css, themeType, themeClassName, watermark));
return true;
},

View File

@@ -1,4 +1,11 @@
const getDiagramExport = (html, css, themeType, themeClassName) => {
const getDiagramExport = (html, css, themeType, themeClassName, watermark) => {
const watermarkHtml = watermark
? `
<div style="position: fixed; bottom: 0; right: 0; padding: 5px; font-size: 12px; color: var(--theme-font-2); background-color: var(--theme-bg-2); border-top-left-radius: 5px; border: 1px solid var(--theme-border);">
${watermark}
</div>
`
: '';
return `<html>
<meta charset='utf-8'>
@@ -17,6 +24,7 @@ const getDiagramExport = (html, css, themeType, themeClassName) => {
<body class='${themeType == 'dark' ? 'theme-type-dark' : 'theme-type-light'} ${themeClassName}'>
${html}
${watermarkHtml}
</body>
</html>`;