Font selection for text layers (#585)

* Add font dropdown

* Add fonts

* Font tool options

* Fix tests

* Replace http with https

* Add variant selection

* Do not embed default font

* Use proxied font list API

* Change default font to Merriweather

* Remove outdated comment

* Specify font once & load font into foreignobject

* Fix tests

* Rename variant to font_style

* Change TextAreaInput to use FieldInput (WIP, breaks functionality)

* Fix textarea functionality

* Fix types

* Add weight name mapping

* Change labeling of "Italic"

* Remove commented HTML node

* Rename font "name" to "font_family" and "file" "font_file"

* Fix errors

* Fix fmt

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2022-04-21 09:50:44 +01:00
committed by Keavon Chambers
co-authored by Keavon Chambers
parent e01f0081a9
commit a26679b96c
36 changed files with 1029 additions and 253 deletions
+21 -1
View File
@@ -388,6 +388,8 @@ export class IndexedDbDocumentDetails extends DocumentDetails {
id!: string;
}
export class TriggerDefaultFontLoad extends JsMessage {}
export class TriggerIndexedDbWriteDocument extends JsMessage {
document!: string;
@@ -403,6 +405,10 @@ export class TriggerIndexedDbRemoveDocument extends JsMessage {
document_id!: string;
}
export class TriggerFontLoad extends JsMessage {
font!: string;
}
export interface WidgetLayout {
layout_target: unknown;
layout: LayoutRow[];
@@ -427,7 +433,19 @@ export function isWidgetSection(layoutRow: WidgetRow | WidgetSection): layoutRow
return Boolean((layoutRow as WidgetSection).layout);
}
export type WidgetKind = "NumberInput" | "Separator" | "IconButton" | "PopoverButton" | "OptionalInput" | "RadioInput" | "TextInput" | "TextLabel" | "IconLabel" | "ColorInput";
export type WidgetKind =
| "NumberInput"
| "Separator"
| "IconButton"
| "PopoverButton"
| "OptionalInput"
| "RadioInput"
| "TextInput"
| "TextAreaInput"
| "TextLabel"
| "IconLabel"
| "ColorInput"
| "FontInput";
export interface Widget {
kind: WidgetKind;
@@ -522,9 +540,11 @@ export const messageConstructors: Record<string, MessageMaker> = {
DisplayEditableTextbox,
UpdateImageData,
DisplayRemoveEditableTextbox,
TriggerDefaultFontLoad,
TriggerFileDownload,
TriggerFileUpload,
TriggerIndexedDbRemoveDocument,
TriggerFontLoad,
TriggerIndexedDbWriteDocument,
TriggerTextCommit,
TriggerTextCopy,