RTE Editor component. | Community
Skip to main content
vijayl12137971
New Participant
March 13, 2017
Solved

RTE Editor component.

  • March 13, 2017
  • 10 replies
  • 3489 views

I am trying to create a Editor component that will take inline javascript. I understand that I can use clientlibs folder for loading JS, but as per my requirement they want to use embed tags with JavaScript in the editor, and I think some of that is also used for rapid development. Currently with the state of RTE, I cannot put a script <script/> tag even after extending it, as it strips it out and only takes the html tags. Same in the case of CSS <style/> tags. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

You can use the HTML view to modify HTML tags such as ul, ol, li, etc. However - you cannot place real scripts in there and fire them. To get scripts to work in a component, you typically use clientlibs and set categories - not try and write script tags in the RTE. 

10 replies

New Participant
March 16, 2017

hi Scott,

there is any list of  HTML tags that does not work in the HTML source editor. Previously I just thought it strips off script and style tags. Now same thing happening with the id attribute for example <div id = "xyz> </div>. even if I tried to insert form tags its taking later , it automatically changes from <form> </form> to <p> <form> </form></p>. Please let me know which tags usually work such HTMl source editor.

 

Thanks

smacdonald2008
New Participant
March 13, 2017

For example - you want to get JS workign with a Sightly (HTL) component -see: 

http://scottsdigitalcommunity.blogspot.ca/2016/06/creating-aem-sightly-component-that.html

vijayl12137971
New Participant
March 13, 2017

Thanks Scott

smacdonald2008
smacdonald2008Accepted solution
New Participant
March 13, 2017

You can use the HTML view to modify HTML tags such as ul, ol, li, etc. However - you cannot place real scripts in there and fire them. To get scripts to work in a component, you typically use clientlibs and set categories - not try and write script tags in the RTE. 

vijayl12137971
New Participant
March 13, 2017

I agree. But this is a OOTB component. Where we are trying to use this component exclusively for few users . It was termed it as HTML Source Enabled component. Is there no way to develop a component that takes style and scrip tags. ??

And there are any plugins are need to be modified to make work this component? plugins meaning js files??

vijayl12137971
New Participant
March 13, 2017

Hi Scott I agree. But this is a OOTB component. Where we are trying to use this component exclusively for few users . It was termed it as HTML Source Enabled component. Is there no way to develop a component that takes style and scrip tags. ??

And there are any plugins are need to be modified to make work this component? plugins meaning js files??

Ratna_Kumar
New Participant
March 13, 2017

Hi Vijay,

I agree with Scott - RTE is only a text editor and it won't supports Java script.
If you want to really use JS, you need to create your own custom component.

See here Sreekanth's blog  - There are many articles on RTE which they put JS in client libraries.: http://experience-aem.blogspot.in

~  Ratna.

smacdonald2008
New Participant
March 13, 2017

You - are are trying to use the RTE as a JS script client and fire off DOM/JS commands. This is not supported as RTE is only a text  editor - not a JS client. 

vijayl12137971
New Participant
March 13, 2017

resource super type : foundation/components/text

 

I have attached few images what exactly happening when use script and css tags. Please let me know if u need more clarification.?

 

Thanks in advance.

smacdonald2008
New Participant
March 13, 2017

When you say Rich Text Editor component - what is the resource type of that component? Do you mean the Text component where a RTE shows up in a dialog box?