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
Try this:
Copy: Ctrl + C
Paste : Ctrl + Shift + V
~kautuk
Views
Replies
Total Likes
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
Try adding a property "removeSingleParagraphContainer = {String}true (Not boolean property)
at the node where xtype=rte.
regards,
Ankur
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/
// 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
Views
Replies
Total Likes
Hi Kautuk,
This will work only for single paragraph. I need to remove it for multiple paragraphs.
Thanks
Mini
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
Views
Likes
Replies
Views
Likes
Replies