diff --git a/src/renderer/plugins/markdown-drawio.ts b/src/renderer/plugins/markdown-drawio.ts index 5068959c..3ffe8672 100644 --- a/src/renderer/plugins/markdown-drawio.ts +++ b/src/renderer/plugins/markdown-drawio.ts @@ -120,10 +120,7 @@ const Drawio = defineComponent({ h('div', { class: 'drawio-wrapper reduce-brightness', style: 'position: relative' }, [ h( 'div', - { - class: 'no-print', - style: 'position: absolute; right: 15px; top: 3px; z-index: 1;' - }, + { class: 'drawio-action no-print' }, [ button(t('drawio.fit-height'), resize), button(t('reload'), reload), @@ -424,6 +421,21 @@ export default { register: ctx => { ctx.markdown.registerPlugin(MarkdownItPlugin) + ctx.theme.addStyles(` + .markdown-view .markdown-body .drawio-wrapper .drawio-action { + position: absolute; + right: 15px; + top: 2px; + z-index: 1; + opacity: 0; + transition: opacity .2s; + } + + .markdown-view .markdown-body .drawio-wrapper:hover .drawio-action { + opacity: 1; + } + `) + ctx.registerHook('TREE_NODE_SELECT', async ({ node }) => { if (node.path.toLowerCase().includes('.drawio')) { const { repo, path, name, type } = node