From f3501c27018d164133e28271291442eb296b54e6 Mon Sep 17 00:00:00 2001 From: Samuel Reichert Date: Fri, 2 May 2025 11:08:42 +0200 Subject: [PATCH] feat(rich-text): add support for custom fonts in RichText widget --- .../pluggableWidgets/rich-text-web/src/RichText.xml | 11 +++++++++++ .../rich-text-web/typings/RichTextProps.d.ts | 12 +++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/pluggableWidgets/rich-text-web/src/RichText.xml b/packages/pluggableWidgets/rich-text-web/src/RichText.xml index 13ccde87c1..afdb75061e 100644 --- a/packages/pluggableWidgets/rich-text-web/src/RichText.xml +++ b/packages/pluggableWidgets/rich-text-web/src/RichText.xml @@ -163,6 +163,17 @@ Enable spell checking + + Custom fonts + + + + Font name + Item + + + + diff --git a/packages/pluggableWidgets/rich-text-web/typings/RichTextProps.d.ts b/packages/pluggableWidgets/rich-text-web/typings/RichTextProps.d.ts index 0380ae4691..c2a58264a2 100644 --- a/packages/pluggableWidgets/rich-text-web/typings/RichTextProps.d.ts +++ b/packages/pluggableWidgets/rich-text-web/typings/RichTextProps.d.ts @@ -3,7 +3,7 @@ * WARNING: All changes made to this file will be overwritten * @author Mendix Widgets Framework Team */ -import { ActionValue, EditableValue } from "mendix"; +import { ActionValue, DynamicValue, EditableValue } from "mendix"; export type PresetEnum = "basic" | "standard" | "full" | "custom"; @@ -23,6 +23,10 @@ export type OverflowYEnum = "auto" | "scroll" | "hidden"; export type OnChangeTypeEnum = "onLeave" | "onDataChange"; +export interface CustomFontsType { + fontName?: DynamicValue; +} + export type ToolbarConfigEnum = "basic" | "advanced"; export type CtItemTypeEnum = "separator" | "undo" | "redo" | "bold" | "italic" | "underline" | "strike" | "superScript" | "subScript" | "orderedList" | "bulletList" | "lowerAlphaList" | "checkList" | "minIndent" | "plusIndent" | "direction" | "link" | "image" | "video" | "formula" | "blockquote" | "code" | "codeBlock" | "viewCode" | "align" | "centerAlign" | "rightAlign" | "font" | "size" | "color" | "background" | "header" | "fullscreen" | "clean" | "tableBetter"; @@ -31,6 +35,10 @@ export interface AdvancedConfigType { ctItemType: CtItemTypeEnum; } +export interface CustomFontsPreviewType { + fontName: string; +} + export interface AdvancedConfigPreviewType { ctItemType: CtItemTypeEnum; } @@ -59,6 +67,7 @@ export interface RichTextContainerProps { onLoad?: ActionValue; onChangeType: OnChangeTypeEnum; spellCheck: boolean; + customFonts: CustomFontsType[]; toolbarConfig: ToolbarConfigEnum; history: boolean; fontStyle: boolean; @@ -100,6 +109,7 @@ export interface RichTextPreviewProps { onLoad: {} | null; onChangeType: OnChangeTypeEnum; spellCheck: boolean; + customFonts: CustomFontsPreviewType[]; toolbarConfig: ToolbarConfigEnum; history: boolean; fontStyle: boolean;