Articles in this section
Category / Section

How to Add Additional Content to the Image Upload Dialog in React Rich Text Editor Component

1 min read

This article provides guidance on how to include additional content in the image upload dialog of the Rich Text Editor Component. This customization is particularly useful when specific information needs to be displayed to users during the image upload process.

Customizing the Image Upload Dialog

To include additional content in the image upload dialog of the RichTextEditor Component, use the dialogOpen event. Follow the approach below:

<RichTextEditorComponent
  toolbarSettings={toolbarSettings}
  insertImageSettings={insertImageSettings}
  imageUploading={onImageUploading.bind(this)}
  dialogOpen={onDialogOpen}
>
  <Inject
    services={[Toolbar, Count, Image, Link, HtmlEditor, QuickToolbar]}
  />
</RichTextEditorComponent>

function onDialogOpen(args) {
  const linkHeader = args.container.querySelector('.e-linkheader');

  if (linkHeader) {
    // Create and configure the new div element
    const infoDiv = document.createElement('div');
    infoDiv.textContent =
      'Allowed file types are .png, .jpeg, .jpg, and .gif, and the maximum file size is 10 MB';
    infoDiv.classList.add('image-dialog-info');

    // Insert the new div after the linkHeader element
    linkHeader.parentNode.insertBefore(infoDiv, linkHeader.nextSibling);
  }
}

Sample

For a live demonstration, you can refer to the following sample application: StackBlitz Sample.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied