mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 00:38:11 +08:00
Improve font import; replace Inconsolata with Source Code Pro; show third-party licenses in editor dialog (#3079)
* Improve font import; replace Inconsolata with Source Code Pro; show third-party licenses in editor dialog * Code review
This commit is contained in:
@@ -1,7 +1,16 @@
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
import { type Editor } from "@graphite/editor";
|
||||
import { defaultWidgetLayout, DisplayDialog, DisplayDialogDismiss, UpdateDialogButtons, UpdateDialogColumn1, UpdateDialogColumn2, patchWidgetLayout } from "@graphite/messages";
|
||||
import {
|
||||
defaultWidgetLayout,
|
||||
DisplayDialog,
|
||||
DisplayDialogDismiss,
|
||||
UpdateDialogButtons,
|
||||
UpdateDialogColumn1,
|
||||
UpdateDialogColumn2,
|
||||
patchWidgetLayout,
|
||||
TriggerDisplayThirdPartyLicensesDialog,
|
||||
} from "@graphite/messages";
|
||||
import { type IconName } from "@graphite/utility-functions/icons";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
@@ -78,6 +87,17 @@ export function createDialogState(editor: Editor) {
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(DisplayDialogDismiss, dismissDialog);
|
||||
|
||||
editor.subscriptions.subscribeJsMessage(TriggerDisplayThirdPartyLicensesDialog, async () => {
|
||||
const BACKUP_URL = "https://editor.graphite.rs/third-party-licenses.txt";
|
||||
let licenseText = `Content was not able to load. Please check your network connection and try again.\n\nOr visit ${BACKUP_URL} for the license notices.`;
|
||||
if (editor.handle.inDevelopmentMode()) licenseText = `Third-party licenses are not available in development builds.\n\nVisit ${BACKUP_URL} for the license notices.`;
|
||||
|
||||
const response = await fetch("/third-party-licenses.txt");
|
||||
if (response.ok && response.headers.get("Content-Type")?.includes("text/plain")) licenseText = await response.text();
|
||||
|
||||
editor.handle.requestLicensesThirdPartyDialogWithLicenseText(licenseText);
|
||||
});
|
||||
|
||||
return {
|
||||
subscribe,
|
||||
dismissDialog,
|
||||
|
||||
Reference in New Issue
Block a user