Expand my Community achievements bar.

SOLVED

RTE Editor component.

Avatar

Level 2

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. 

1 Accepted Solution

Avatar

Correct answer by
Level 10

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. 

View solution in original post

10 Replies

Avatar

Level 10

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? 

Avatar

Level 2

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.

Avatar

Level 10

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. 

Avatar

Level 10

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.

Avatar

Level 2

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??

Avatar

Level 2

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??

Avatar

Correct answer by
Level 10

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. 

Avatar

Level 3

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