Hello,
When i copy the content from notepad, notepad++ to rixh 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...
I added edit plugin (features are blank array, defaultPasteMode
=
"plaintext"), but no luck.
AEM version: 6.0 with SP2
Appreciated for quick response.
Views
Replies
Total Likes
IN the docs - it states:
STYLES (TEXT)
Styles affect the appearance of a portion of text, from a single character upwards. They are based on CSS classes (already existing in your CSS stylesheet); as they enclose a portion of text within span tags using the class attribute to reference the CSS class. For example:
<span class=monospaced>Monospaced Text Here</span>
To enable styles for selection in the dialog you:
So using Styles plug-in you can reference a CSS that specifies the font type you want to use.
https://docs.adobe.com/docs/en/aem/6-0/administer/operations/page-authoring/rich-text-editor.html
Views
Replies
Total Likes
I dont want to add any style attribute. Just wanted to avoid the style tag which is added by default when content is copied from notepad ++.
How can i avoid OOTB style addition?
Views
Replies
Total Likes
Is it adding the style even if you copy from the notepad ??
Most of the times, copying from textpad, notepad or word would come along with these styles with it. I would say, you can write a quick listener before saving to remove/clean these styles
Views
Replies
Total Likes
Yes. style attribute added to p tag as below
<p style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 12px;">
Views
Replies
Total Likes
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
Replies
Total Likes