mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 23:06:00 +00:00
SYNC: configurable export watermark
This commit is contained in:
committed by
Diflow
parent
3f98f9ff39
commit
4bc9b70882
@@ -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;
|
||||
},
|
||||
|
||||
|
||||
@@ -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>`;
|
||||
|
||||
Reference in New Issue
Block a user