SilverBullet pivot to become an offline-first PWA (#403)

This commit is contained in:
Zef Hemel
2023-05-23 20:53:53 +02:00
committed by GitHub
parent b256269897
commit 5f484bed57
389 changed files with 4484 additions and 291129 deletions
+3 -7
View File
@@ -7,7 +7,7 @@ import {
} from "../deps.ts";
import { decoratorStateField } from "./util.ts";
import type { Space } from "../../common/spaces/space.ts";
import type { Space } from "../space.ts";
class InlineImageWidget extends WidgetType {
constructor(
@@ -27,12 +27,8 @@ class InlineImageWidget extends WidgetType {
if (this.url.startsWith("http")) {
img.src = this.url;
} else {
// Load the image as a dataURL and inject it into the img's src attribute
this.space.readAttachment(decodeURIComponent(this.url), "dataurl").then(
({ data }) => {
img.src = data as string;
},
);
// This is an attachment image, rewrite the URL a little
img.src = `/.fs/${decodeURIComponent(this.url)}`;
}
img.alt = this.title;