1 Commits
Author SHA1 Message Date
alamin-br 59da1eb2da feat: rich content in form view descriptions (#1851) (#5707)
* feat: rich text editor for form field description (creator)

* feat: render form field description as rich text (respondent)

* feat: rich text editor for form description (creator)

* feat: render form description as rich text (respondent)

Renders the form-level description read-only via RichTextEditor in
FormViewModeForm.vue (the public standard form), matching the field
description treatment from FormPageField.

FormViewModeSurvey.vue was checked and has no separate form-level
description/title render at all (it goes straight to fields), so no
change was needed there.

* docs: changelog for rich form descriptions (#1851)

* fix: only save form description after an actual edit

saveDescription ran on every editor blur and compared tiptap's
normalized markdown against the raw stored value, so clicking into
a legacy plain-text description (with chars like *, #, %) and away
without editing silently rewrote the stored value. Add a dirty flag
set only by update:modelValue (real edits) so blur without an edit
is a no-op.

Also drops the unused editor-class attribute on the description
RichTextEditor (no matching SCSS rule).

* perf: only mount field description editor when needed (v-if)

* fix: preserve in-progress description edit on external update; add e2e coverage

* fix: click-to-edit toggle for form descriptions; fix cursor reset

Replace the always-editable inline RichTextEditor on the form builder with a
shared FormViewDescription component that renders read-only markdown and mounts
the editor only while editing, behind an edit pencil (matching title/submit).

- Restores the edit affordance that regressed vs the old Editable.
- Passes model-value one-way and reads markdown back on blur, so typing after
  moving the cursor no longer resets to the end.
- No floating menu lingers on the form once editing stops.
- Removes the dirty/save-on-blur logic duplicated across FormViewField and
  FormViewModePreviewForm.

* test: cover form description toggle and save-on-blur

* fix: keep description editor menu stuck to cursor line on scroll

Pass the form preview's scroll container (.form-view__preview) to the editor so
its floating/bubble menu tracks the cursor line while the page scrolls, instead
of falling back to the editor's own non-scrolling root.

* Address PR review feedback (#5707)

- Route public form description render sites through FormViewDescription
- Pass scroll container as a resolver prop instead of a closest() lookup
- Wrap long unbroken words in form and field descriptions
- Use palette color variable for the description placeholder

* fix: clamp form description containers to the form column

The flex editor wrapper inside the inline-block description containers
made them shrink-to-fit their max-content width, letting long words
escape the form column on the public form.
2026-07-17 17:40:40 +02:00