From b7636e19532fbc2b505e4d3d83b3c11282542fc1 Mon Sep 17 00:00:00 2001 From: Jonnathan Charpentier <92122357+JonnCharpentier@users.noreply.github.com> Date: Fri, 13 Oct 2023 09:17:30 -0600 Subject: [PATCH] feat: adding fullWidth version of RichTextField (#966) Co-authored-by: JonnCh --- src/inputs/RichTextField.stories.tsx | 17 +++++++++++++++++ src/inputs/RichTextField.tsx | 8 +++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/inputs/RichTextField.stories.tsx b/src/inputs/RichTextField.stories.tsx index 8f5ea6f45..6992ee541 100644 --- a/src/inputs/RichTextField.stories.tsx +++ b/src/inputs/RichTextField.stories.tsx @@ -81,3 +81,20 @@ export function ToggleReadOnly() { ); } + +export function FullWidth() { + const value = + "
This is some content


some really important content
"; + + return ( + + ); +} diff --git a/src/inputs/RichTextField.tsx b/src/inputs/RichTextField.tsx index c09697db3..1f63990d3 100644 --- a/src/inputs/RichTextField.tsx +++ b/src/inputs/RichTextField.tsx @@ -28,6 +28,8 @@ export interface RichTextFieldProps { onFocus?: () => void; /** For rendering formatted text */ readOnly?: boolean; + /** Will set width to: 100% */ + fullWidth?: boolean; } /** @@ -38,7 +40,7 @@ export interface RichTextFieldProps { * We also integrate [tributejs]{@link https://github.com/zurb/tribute} for @ mentions. */ export function RichTextField(props: RichTextFieldProps) { - const { mergeTags, label, value = "", onChange, onBlur = noop, onFocus = noop, readOnly } = props; + const { mergeTags, label, value = "", onChange, onBlur = noop, onFocus = noop, readOnly, fullWidth } = props; // We get a reference to the Editor instance after trix-init fires const [editor, setEditor] = useState(); @@ -129,7 +131,7 @@ export function RichTextField(props: RichTextFieldProps) { if (!readOnly) { return ( -
+
{/* TODO: Not sure what to pass to labelProps. */} {label &&