This is a migrated thread and some comments may be shown as answers.

Pasting plain text as paragraphs in <p> tags, rather than with <br> tags

3 Answers 358 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Emily
Top achievements
Rank 1
Emily asked on 12 Jan 2010, 06:34 PM
Is it possible, when using the "Paste Plain Text" button, to have paragraphs wrapped in <p> tags rather than separated by <br><br>? I have NewLineBr set to "true" but I don't think that applies for pasting. Let me know if this is unclear or more information is needed. Thank you.

3 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 13 Jan 2010, 02:05 PM
Hi Emily,

RadEditor's PastePlainText command strips all formatting from the pasted text, thus there are no paragraphs, fonts, colors, etc., only the new lines are preserved which are replaced with the corresponding HTML tag (<br />).

It is possible, however, to create a custom tool or custom content filter to provide the requested functionality. Information regarding custom tools and custom content filters is available in the following articles: 
Custom Tools - Live Demo
Adding Your Own Buttons
Custom Content Filters - Live Demo
Content Filters - Help Article

In addition, NewlineBr property default value is true and it only applies to the functionality of the Enter key in RadEditor.

Best wishes,
Dobromir
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Emily
Top achievements
Rank 1
answered on 13 Jan 2010, 10:18 PM
Thank you for your reply. I did want to present an "argument" (as it were) in favor of wrapping paragraphs that are pasted in as plain text in "p" tags, rather than separating them with "br" tags, as presented by my manager. Here is the argument:

We encourage our clients to paste content from word processing documents such as Microsoft Word as plain text into the RAD Editor, and then perform formatting from there. However, they run into problems doing that formatting when the content pasted is not formatted as HTML paragraphs, because when they select a single line and try to align it to the center (for example) or initiate a bulleted list, the formatting command gets applied to the entire block of text that is pasted, rather than just the selected line. This is because the content that is pasted gets treated by default as a single paragraph separated by line breaks, rather than multiple paragraphs.

The only solution to this is to have the client go through and backspace, then hit enter, between each paragraph in the editor in order to "force" them to be paragraphs before initiating the additional formatting.

Does that make sense? Please let me know if I can be more clear, or if there are other solutions to the problem described above.

Thank you for your consideration.
0
Dobromir
Telerik team
answered on 18 Jan 2010, 12:56 PM
Hi Emily,

As I said in my previous reply, it is possible to create a custom content filter to replace new lines with paragraphs but since <br/> is a self-closing tag it is impossible to distinct a "standard" new line from the end of a paragraph.

In addition, RadEditor offers the built-in functionality to strip MS Word specific tags so I would suggest you to use Paste From Word or Paste From Word, strip font instead of Paste Plain Text for such scenarios. More information on the subject is available in the following help article:
Cleaning Word Formatting

I hope this information helps.

Greetings,
Dobromir
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Editor
Asked by
Emily
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Emily
Top achievements
Rank 1
Share this question
or