Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: call monaco.editor.remeasureFonts() after editor mounted #1376

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading