forked from Blendman974/faceclaw
Add font viewer
This commit is contained in:
1 parent
495cf0363a
commit
812c3f9b4a
7 files changed
+775
-1
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { type AppContext, type AppDefinition } from "../app-definition";
|
||||
import {
|
||||
createFilesAppWindow,
|
||||
createFontDocumentWindow,
|
||||
createImageDocumentWindow,
|
||||
createTextDocumentWindow,
|
||||
FILES_SURFACE_ID,
|
||||
@@ -33,6 +34,17 @@ function openImageDocumentWindow(ctx: AppContext, title: string, path: string):
|
||||
});
|
||||
}
|
||||
|
||||
function openFontDocumentWindow(ctx: AppContext, title: string, path: string): void {
|
||||
const windowId = `files:doc:${nextDocumentSerial++}`;
|
||||
void ctx
|
||||
.launchInProcessApp(windowId, `window:${windowId}`, (options) =>
|
||||
createFontDocumentWindow(windowId, title, path, options),
|
||||
)
|
||||
.catch((error) => {
|
||||
ctx.appendLog(`font preview window failed: ${error}`);
|
||||
});
|
||||
}
|
||||
|
||||
const filesApp: AppDefinition = {
|
||||
appId: "files",
|
||||
title: "Files",
|
||||
@@ -43,6 +55,7 @@ const filesApp: AppDefinition = {
|
||||
...options,
|
||||
openDocumentWindow: (title, text) => openTextDocumentWindow(ctx, title, text),
|
||||
openImageWindow: (title, path) => openImageDocumentWindow(ctx, title, path),
|
||||
openFontWindow: (title, path) => openFontDocumentWindow(ctx, title, path),
|
||||
}),
|
||||
),
|
||||
// A document arriving via Android's Share intent opens as its own window.
|
||||
|
||||
Reference in new issue
Block a user