From 9565b80fb1c1e9b8d5d1bc5b241fa9ae456555ce Mon Sep 17 00:00:00 2001 From: Colin Dawson Date: Sun, 1 Feb 2026 22:43:11 +0000 Subject: [PATCH] Fixed ui errors to do with ck-editor --- src/Sass/_ckEditor.scss | 13 +- src/components/common/Select.tsx | 26 +- src/components/common/ckeditor/TextEditor.jsx | 711 +++++++++--------- .../common/ckeditor/plugins/field/field.ts | 14 +- .../common/ckeditor/plugins/field/fieldui.js | 108 +-- 5 files changed, 468 insertions(+), 404 deletions(-) diff --git a/src/Sass/_ckEditor.scss b/src/Sass/_ckEditor.scss index 8691b0e..deab255 100644 --- a/src/Sass/_ckEditor.scss +++ b/src/Sass/_ckEditor.scss @@ -5,7 +5,8 @@ } .mailTemplate-editor { - width: calc(100% - ($gridGap + $mailtemplateNameListWidth)); + //width: calc(100% - ($gridGap + $mailtemplateNameListWidth)); + width: 100%; } @media print { @@ -17,7 +18,7 @@ .ck-main-container { // --ckeditor5-preview-height: 700px; font-family: "Lato"; - width: fit-content; + width: 100%; margin-left: auto; margin-right: auto; @@ -35,6 +36,7 @@ font-family: "Lato"; line-height: 1.6; word-break: break-word; + color: var(--bs-body-color); .table table { overflow: auto; @@ -42,8 +44,7 @@ } .editor-container__editor-wrapper { - display: flex; - width: fit-content; + width: 100%; } .editor-container_document-editor { @@ -96,12 +97,12 @@ //min-width: calc(100vw - ($leftMenuWidth + ($frameWorkAreaPadding * 2))); //max-width: calc(100vw - ($leftMenuWidth + ($frameWorkAreaPadding * 2))); - min-width: 100%; - max-width: 100%; + width: 100%; // min-width: calc(210mm + 2px); // max-width: calc(210mm + 2px); height: fit-content; + // padding: 20mm 12mm; border: 1px hsl(0, 0%, 82.7%) solid; //background: hsl(0, 0%, 100%); diff --git a/src/components/common/Select.tsx b/src/components/common/Select.tsx index da4fec2..cd01a86 100644 --- a/src/components/common/Select.tsx +++ b/src/components/common/Select.tsx @@ -11,6 +11,7 @@ export interface SelectProps { value: unknown; options?: Option[]; includeBlankFirstEntry?: boolean; + multiple?: boolean; onChange?: (e: React.ChangeEvent) => void; } @@ -20,6 +21,24 @@ function GenerateValue(value: unknown) { return value as string | number | readonly string[] | undefined; } +function NormalizeSelectValue(value: unknown, isMultiple: boolean) { + const actualValue = GenerateValue(value); + + if (!isMultiple) { + return actualValue; + } + + if (Array.isArray(actualValue)) { + return actualValue; + } + + if (actualValue === undefined || actualValue === null || actualValue === "") { + return [] as readonly string[]; + } + + return [actualValue] as readonly (string | number)[]; +} + export default function Select({ includeLabel, name, @@ -28,11 +47,13 @@ export default function Select({ value, options, includeBlankFirstEntry, + multiple, onChange, ...rest }: SelectProps) { const { t } = useTranslation(); - const actualValue = GenerateValue(value); + const isMultiple = multiple ?? options === undefined; + const actualValue = NormalizeSelectValue(value, isMultiple); return (
@@ -41,7 +62,7 @@ export default function Select({ )} {!options && (