mirror of
https://github.com/excalidraw/excalidraw
synced 2025-07-25 13:58:22 +08:00
feat: multiple fonts fallbacks (#8286)
This commit is contained in:
@ -72,12 +72,14 @@ vi.mock(
|
||||
...mod,
|
||||
ExcalidrawFont: class extends ExcalidrawFontImpl {
|
||||
public async getContent(): Promise<string> {
|
||||
if (this.url.protocol !== "file:") {
|
||||
const url = this.urls[0];
|
||||
|
||||
if (url.protocol !== "file:") {
|
||||
return super.getContent();
|
||||
}
|
||||
|
||||
// read local assets directly, without running a server
|
||||
const content = await fs.promises.readFile(this.url);
|
||||
const content = await fs.promises.readFile(url);
|
||||
return `data:font/woff2;base64,${content.toString("base64")}`;
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user