Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

how to save rich text editor content to mysql database

Avatar

Level 2

I need to create a video plugin for rich text editor in AEM and then save the editor content to mysql database after editting. The page look likes submitting new posts in adobe forum here. Anyone can give me some hints on how to achieve this? 

Thanks and regards,

Yy

1 Accepted Solution

Avatar

Correct answer by
Level 10

Looks like you need to do a lot of customization:-

How and where to store the video files : Store these files in DAM

How to preview the video in RTE? : You need to integrate some available video player in RTE to which you will be passing selected path to video

How to define the video size limit : Once the path is selected by user, you can have ajax call to find it size if its more than what you want you can deny that path.

Question:

Why don't you just use normal fields for video details instead of RTE as it will save your time

View solution in original post

5 Replies

Avatar

Level 9

Hey,

May I have answer following questions:

  • Are you not using JCR Tar as backend?.
  • Do you want to store only RTE content to MYSQL And the rest of the content in the JCR Repository?.

----

Jitendra

Avatar

Administrator

Hi 

We can create a component/Service to communicate with JCR nodes or can fetch component dialog values, and can populate it to and DB. Your OSGI Component/Service will fetch the value, create a connection with DB and then feed it accordingly to your logic.

You can refer the following article to help you achieve the needful :-

Link1 :- https://helpx.adobe.com/experience-manager/using/querying-persisting-cq-data-mysql.html

// Querying and Persisting Adobe AEM data into MySQL. The application that is able to query data from MySQL as well as persist data back to the database. This article creates an OSGi bundle that uses the JDBC API to query and persist data. In addition, discusses how to invoke an OSGi bundle operation from the client web page.  

Link 2:- http://aem.matelli.org/fetching-properties-from-dialogs/

// Fetching Properties From Dialogs.

String title = "", text= "";
if (!Resource.RESOURCE_TYPE_NON_EXISTING.equals(myResource.getResourceType())) {
Node node = myResource.adaptTo(Node.class);
title = node.getProperty("jcr:title").getString();
text= node.getProperty("jcr:text").getString();
}

//Extending RTE

Link 4:- https://helpx.adobe.com/experience-manager/using/querying-experience-manager-data-using1.html

//Querying Adobe Experience Manager Data using the JCR API

I hope this could help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 2

Jitendra,

I will use JCR Repository to store image and video files after editting the rich text component. The reason I use mysql database is that the rich text contents will be saved to the specified users and I need query those contents from users to render web pages. I don't know if there is a convenient way to do that in AEM(I am j2ee guy, just start doing AEM projects recently).

Avatar

Level 2

Kautuk,

Thank you very much for replying.

I took a look at the link 3 for extending RTE. It seems building a video plugin is a little different from a pullquote. For instances, how and where to store the video files? How to preview the video in RTE? How to define the video size limit? etc

Is there a more direct sample to extend RTE for a video plugin? 

Thanks and regards,

Yy

Avatar

Correct answer by
Level 10

Looks like you need to do a lot of customization:-

How and where to store the video files : Store these files in DAM

How to preview the video in RTE? : You need to integrate some available video player in RTE to which you will be passing selected path to video

How to define the video size limit : Once the path is selected by user, you can have ajax call to find it size if its more than what you want you can deny that path.

Question:

Why don't you just use normal fields for video details instead of RTE as it will save your time