Skip to content

Commit

Permalink
fix: call monaco.editor.remeasureFonts() after editor mounted
Browse files Browse the repository at this point in the history
  • Loading branch information
KermanX committed Mar 6, 2024
1 parent 448141c commit 047773d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 28 deletions.
31 changes: 31 additions & 0 deletions packages/client/builtin/Monaco.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ onMounted(async () => {
: /* BELOW */ `` // reset
}
}
nextTick(() => monaco.editor.remeasureFonts())
})
</script>

Expand All @@ -148,3 +149,33 @@ onMounted(async () => {
<div ref="container" class="absolute inset-0.5" />
</div>
</template>

<style>
div[widgetid='messageoverlay'] {
transform: translateY(calc(100% * (var(--slidev-slide-scale) - 1)));
}

.slidev-monaco-container {
position: relative;
margin: var(--slidev-code-margin);
padding: var(--slidev-code-padding);
line-height: var(--slidev-code-line-height);
border-radius: var(--slidev-code-radius);
background: var(--slidev-code-background);
}

.slidev-monaco-container .monaco-editor {
--monaco-monospace-font: var(--slidev-code-font-family);
--vscode-editor-background: var(--slidev-code-background);
--vscode-editorGutter-background: var(--slidev-code-background);
}

/** Revert styles */
.slidev-monaco-container .monaco-editor a {
border-bottom: none;
}

.slidev-monaco-container .monaco-editor a:hover {
border-bottom: none;
}
</style>
27 changes: 0 additions & 27 deletions packages/client/styles/monaco.css

This file was deleted.

1 change: 0 additions & 1 deletion packages/slidev/node/plugins/loaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,6 @@ defineProps<{ no: number | string }>()`)
`import "${resolveUrlOfClient('styles/code.css')}"`,
`import "${resolveUrlOfClient('styles/katex.css')}"`,
`import "${resolveUrlOfClient('styles/transitions.css')}"`,
`import "${resolveUrlOfClient('styles/monaco.css')}"`,
]

for (const root of roots) {
Expand Down

0 comments on commit 047773d

Please sign in to comment.