RTE CTRL+V copying inline styles | Adobe Higher Education
Skip to main content
Level 3
October 14, 2016

RTE CTRL+V copying inline styles

  • October 14, 2016
  • 5 の返信
  • 3172 ビュー

Hi Everyone,

When i copy the content from browser and then to notepad, notepad++ to rich text, by default tool is adding font family to p tag. How to avoid adding style attribute to P tag when content is copied from browser, notepad etc...

<p style = "font-family: tahoma , arial , helvetica , sans-serif;"" font-size: 12.0px" ></p>

These are the two styles which is getting added to <p> tag when pasting from notepad.

AEM version:5.6.1

Any help would be greatly appreciated.

 

Thanks 

Mini

このトピックへの返信は締め切られました。

5 の返信

kautuk_sahni
Community Manager
Community Manager
October 14, 2016

Try this:

Copy: Ctrl + C

Paste : Ctrl + Shift + V

~kautuk

Kautuk Sahni
aem_dev1
Level 3
October 14, 2016

 ctrl+v needs to be handled explicitly. Or you can use following alternative.

1. Enable "Paste as text" plugin in RTE

2. While copying single paragraph use Paste as text plugin (it will not copy any styles)

3. While copying multiple paragraphs use ctrl + v and paste in the RTE directly. Do not use "Paste as text" plugin while copying multiple paragraphs as it will add <br> tags

AnkurAhlawat-1
Level 6
October 15, 2016

Try adding a property "removeSingleParagraphContainer = {String}true (Not boolean property)

at the node where xtype=rte.

regards,

Ankur

kautuk_sahni
Community Manager
Community Manager
October 17, 2016

Adding more references to Ankur's reply:

Please have a look at:-

Link:- https://mkbansal.wordpress.com/2016/01/02/aem-rte-remove-p-tag/

Link:-http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.105.html/forum__rhcm-hi_team_i_amget.html

// Remove <p> in richtext in touch UI

 The default behavior of AEM generates those <p> tags and can only be removed if you author only one paragraph by adding property removeSingleParagraphContainer suggested above

 

~kautuk

Kautuk Sahni
minisanu作成者
Level 3
October 19, 2016

Hi Kautuk,

    This will work only for single paragraph. I need to remove it for multiple paragraphs.

Thanks 

Mini

October 28, 2016

Try Applying the Following Listener under "Dialog" of that component and use the property "beforesubmit" it will surely Work 100% 

 

 

function(dialog)
{


var i;

for (i = 0; dialog.findByType("richtext", true)[i]="undefined"; i++) { 

var rte = dialog.findByType("richtext", true)[i];


var para=rte.getName();


var text=dialog.getField(para).getValue();


var final=text.split("font-family: tahoma, arial, helvetica, sans-serif; font-size: 12px;").join("");


dialog.getField(para).setValue(final);

}

}

 

 

 

Thanks,

Nikhil Kumar