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
+3 -3
View File
@@ -1028,7 +1028,7 @@ export class Client {
console.error,
);
console.log("Flushed image height cache to store");
}, 5000);
}, 2000);
setCachedImageHeight(url: string, height: number) {
this.imageHeightCache.set(url, height);
@@ -1047,7 +1047,7 @@ export class Client {
console.error,
);
// console.log("Flushed widget height cache to store");
}, 5000);
}, 2000);
setCachedWidgetHeight(bodyText: string, height: number) {
this.widgetHeightCache.set(bodyText, height);
@@ -1063,7 +1063,7 @@ export class Client {
console.error,
);
console.log("Flushed widget cache to store");
}, 5000);
}, 2000);
setWidgetCache(key: string, cacheItem: WidgetCacheItem) {
this.widgetCache.set(key, cacheItem);
+4 -1
View File
@@ -54,7 +54,10 @@ export class MarkdownWidget extends WidgetType {
activeWidgets.add(this);
if (!widgetContent) {
div.innerHTML = "";
// div.style.display = "none";
this.client.setWidgetCache(
this.bodyText,
{ height: div.clientHeight, html: "" },
);
return;
}
const lang = buildMarkdown(this.client.system.mdExtensions);
+1 -1
View File
@@ -468,7 +468,7 @@
.sb-markdown-widget,
.sb-markdown-top-widget:has(*),
.sb-markdown-bottom-widget:has(*) {
overflow-y: scroll;
overflow-y: auto;
border: 1px solid var(--editor-directive-background-color);
border-radius: 5px;
white-space: wrap;