1
0

Slight performance tweaks

This commit is contained in:
Zef Hemel 2023-12-29 20:03:54 +01:00
parent bc78fae5ec
commit 16b8d4ef12
3 changed files with 8 additions and 5 deletions

View File

@ -1028,7 +1028,7 @@ export class Client {
console.error, console.error,
); );
console.log("Flushed image height cache to store"); console.log("Flushed image height cache to store");
}, 5000); }, 2000);
setCachedImageHeight(url: string, height: number) { setCachedImageHeight(url: string, height: number) {
this.imageHeightCache.set(url, height); this.imageHeightCache.set(url, height);
@ -1047,7 +1047,7 @@ export class Client {
console.error, console.error,
); );
// console.log("Flushed widget height cache to store"); // console.log("Flushed widget height cache to store");
}, 5000); }, 2000);
setCachedWidgetHeight(bodyText: string, height: number) { setCachedWidgetHeight(bodyText: string, height: number) {
this.widgetHeightCache.set(bodyText, height); this.widgetHeightCache.set(bodyText, height);
@ -1063,7 +1063,7 @@ export class Client {
console.error, console.error,
); );
console.log("Flushed widget cache to store"); console.log("Flushed widget cache to store");
}, 5000); }, 2000);
setWidgetCache(key: string, cacheItem: WidgetCacheItem) { setWidgetCache(key: string, cacheItem: WidgetCacheItem) {
this.widgetCache.set(key, cacheItem); this.widgetCache.set(key, cacheItem);

View File

@ -54,7 +54,10 @@ export class MarkdownWidget extends WidgetType {
activeWidgets.add(this); activeWidgets.add(this);
if (!widgetContent) { if (!widgetContent) {
div.innerHTML = ""; div.innerHTML = "";
// div.style.display = "none"; this.client.setWidgetCache(
this.bodyText,
{ height: div.clientHeight, html: "" },
);
return; return;
} }
const lang = buildMarkdown(this.client.system.mdExtensions); const lang = buildMarkdown(this.client.system.mdExtensions);

View File

@ -468,7 +468,7 @@
.sb-markdown-widget, .sb-markdown-widget,
.sb-markdown-top-widget:has(*), .sb-markdown-top-widget:has(*),
.sb-markdown-bottom-widget:has(*) { .sb-markdown-bottom-widget:has(*) {
overflow-y: scroll; overflow-y: auto;
border: 1px solid var(--editor-directive-background-color); border: 1px solid var(--editor-directive-background-color);
border-radius: 5px; border-radius: 5px;
white-space: wrap; white-space: wrap;