diff --git a/components/elements/fields/renderRichMultiline.js b/components/elements/fields/renderRichMultiline.js new file mode 100644 index 00000000..f09b77e8 --- /dev/null +++ b/components/elements/fields/renderRichMultiline.js @@ -0,0 +1,81 @@ +import React, { useState } from "react"; +import dynamic from "next/dynamic"; +import { updateLinks } from "../../utils"; + +const ReactQuill = dynamic(() => import("react-quill-new"), { ssr: false }); + +export const RenderRichMultiline = ({ + id, + className, + rows, + datafieldname, + name, + label, + input, + meta: { touched, error }, + ...custom +}) => { + const [editValue, setEditValue] = useState( + input.value != null ? input.value : "" + ); + + const changeEdit = (valStr) => { + setEditValue(valStr); + input.onChange(valStr); + }; + + const handleBlur = () => { + const updated = updateLinks(editValue); + setEditValue(updated); + input.onChange(updated); + }; + + var modules = { + toolbar: [ + [{ "header": [1, 2, false] }], + ["bold", "italic", "underline", "blockquote"], + [{ "list": "ordered" }, { "list": "bullet" }], + ["clean"] + ] + }; + + return ( + <> +
+ + + {error && ( + + Error:{" "} + {error} + + )} + + + +
+ + ); +}; diff --git a/components/elements/index.js b/components/elements/index.js index 9748dea7..338da931 100644 --- a/components/elements/index.js +++ b/components/elements/index.js @@ -19,12 +19,7 @@ import { import fieldLookup from "../../data/crmfieldlookuptranslations.json"; import pickListLookup from "../../data/picklistLookups.json"; -import dynamic from "next/dynamic"; -import { - bytesToSize, - getThumbnailIconByExtension, - updateLinks -} from "../utils"; +import { bytesToSize, getThumbnailIconByExtension } from "../utils"; import { setFileCount } from "../../store/appealType/action"; import { @@ -37,7 +32,6 @@ import { subYears } from "date-fns"; import "react-quill-new/dist/quill.snow.css"; -const ReactQuill = dynamic(() => import("react-quill-new"), { ssr: false }); import { useStore as store, useSelector } from "react-redux"; import { useDispatch } from "react-redux"; @@ -51,6 +45,7 @@ import { getFieldTranslation, getPickListTranslation } from "./helpers/translationHelpers"; +import { RenderRichMultiline } from "./fields/renderRichMultiline"; const RenderTextfield = ({ id, @@ -472,82 +467,6 @@ export function MultiLinefield(props) { ); } -export const RenderRichMultiline = ({ - id, - className, - rows, - datafieldname, - name, - label, - input, - meta: { touched, error }, - ...custom -}) => { - const [editValue, setEditValue] = useState( - input.value != null ? input.value : "" - ); - - const changeEdit = (valStr) => { - setEditValue(valStr); - input.onChange(valStr); - }; - - const handleBlur = () => { - const updated = updateLinks(editValue); - setEditValue(updated); - input.onChange(updated); - }; - - var modules = { - toolbar: [ - [{ "header": [1, 2, false] }], - ["bold", "italic", "underline", "blockquote"], - [{ "list": "ordered" }, { "list": "bullet" }], - ["clean"] - ] - }; - - return ( - <> -
- - - {error && ( - - Error:{" "} - {error} - - )} - - - -
- - ); -}; - export function RichMultiLinefield(props) { const { name, diff --git a/memory-bank/change-log.md b/memory-bank/change-log.md index a88f61e9..d15ea182 100644 --- a/memory-bank/change-log.md +++ b/memory-bank/change-log.md @@ -52,6 +52,30 @@ Follow-ups: - Phase 2: extract low-risk leaf field renderer components from `components/elements/index.js` in bounded slices. - Perform manual EN/CY + a11y smoke matrix on new appeal/myportal form journeys before merge. +### CL-00Y: 22500 `components/elements/index.js` Phase 2 leaf renderer extraction (Rich multiline) + +date: 2026-04-07 +author: Cline +scope: `components/elements/index.js`, `components/elements/fields/renderRichMultiline.js` +type: change +rationale: Continue the approved phased decomposition by extracting one low-risk leaf renderer (`RenderRichMultiline`) from the elements monolith while keeping existing field wiring and behavior intact. +impact: Refactor-only move of rich multiline renderer implementation; no route/API/auth/security changes and no intended EN/CY behavior change. +status: completed + +Summary: + +- Added `components/elements/fields/renderRichMultiline.js` containing the extracted `RenderRichMultiline` renderer. +- Updated `components/elements/index.js` to import the extracted renderer and removed the inline duplicate implementation. +- Kept `RichMultiLinefield` usage and props unchanged (same Redux Field component wiring and validation flow). + +Validation: + +- `npx eslint components/elements/index.js components/elements/fields/renderRichMultiline.js` -> pass + +Follow-ups: + +- Continue Phase 2 in bounded slices by extracting additional low-risk leaf renderers (e.g., `RenderMultiline` / `RenderTextfield`) with no behavior change. + ### CL-001: TASK22211 endpoint search-document contract consistency slice date: 2026-03-23