Class: Glib::JsonUi::ViewBuilder::Fields::RichText

Inherits:
Text show all
Defined in:
app/helpers/glib/json_ui/view_builder/fields.rb

Overview

Rich text editor field with WYSIWYG editing.

Provides a full-featured text editor with formatting options, image uploads, and @mention support. Can output HTML or Markdown.

Examples:

Rich text editor with image upload and mentions

avatar = 'https://example.com/avatar.jpg'
mention_list = [
  { id: 'johndoe', value: 'johndoe', text: 'John Doe', avatar: avatar, group: 'Programmer' },
  { id: 'budi', value: 'budi', text: 'Budi', avatar: avatar, group: 'Programmer' }
]
form.fields_richText \
  width: 'matchParent',
  produce: :markdown,
  label: 'Content',
  name: 'user[message]',
  value: initial_message,
  mentionList: mention_list,
  imageUploader: {
    name: 'user[images_attributes][]',
    accepts: { fileType: ['image', 'csv', 'xlsx', 'pptx', 'docx'], maxFileSize: 5000 },
    directUploadUrl: glib_direct_uploads_url,
    blobUrlGenerator: glib_blob_url_generators_url
  },
  debug: true

See Also:

  • Garage example

Instance Attribute Summary

Attributes inherited from JsonUiElement

#json, #page

Method Summary

Methods inherited from AbstractField

#autoValidate, #context, #created, #default_url_options, #determine_value, #disableDirtyCheck, #hint, #hint_args, #label, #label_args, #name, #placeholder, #placeholder_args, #prop, #validation, #value

Methods inherited from View

component_name

Methods inherited from JsonUiElement

#initialize, #props

Constructor Details

This class inherits a constructor from Glib::JsonUi::JsonUiElement