mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 08:18:42 +00:00
* 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.
64 lines
1.4 KiB
Vue
64 lines
1.4 KiB
Vue
<template>
|
|
<div class="form-view__preview">
|
|
<div class="form-view__page form-view__page--rounded">
|
|
<component
|
|
:is="component"
|
|
:database="database"
|
|
:table="table"
|
|
:view="view"
|
|
:fields="fields"
|
|
:store-prefix="storePrefix"
|
|
:read-only="readOnly"
|
|
:get-scroll-area-element="getScrollAreaElement"
|
|
@ordered-fields="$emit('ordered-fields', $event)"
|
|
></component>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import formViewHelpers from '@baserow/modules/database/mixins/formViewHelpers'
|
|
|
|
export default {
|
|
name: 'FormViewPreview',
|
|
mixins: [formViewHelpers],
|
|
props: {
|
|
database: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
table: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
view: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
fields: {
|
|
type: Array,
|
|
required: true,
|
|
},
|
|
readOnly: {
|
|
type: Boolean,
|
|
required: true,
|
|
},
|
|
},
|
|
emits: ['ordered-fields'],
|
|
computed: {
|
|
component() {
|
|
return this.$registry
|
|
.get('formViewMode', this.view.mode)
|
|
.getPreviewComponent()
|
|
},
|
|
},
|
|
methods: {
|
|
// This component owns the scrollable preview container; descendants use
|
|
// this resolver so rich text editor menus can stick to it while scrolling.
|
|
getScrollAreaElement() {
|
|
return this.$el
|
|
},
|
|
},
|
|
}
|
|
</script>
|