Ordered and Unordered Lists customization
Greetings,
I have noticed that for converting existing text in editor to an ordered or unordered list each item (line) must be in separate paragraph <p> in order to work properly. So if I have various lines separated with <br> this conversion will not work and will treat this as a single <li> item. Is there a setting to alter this behavior? Or could this be done in someway by code? I would really appreciate your help on that one!
Hi!
Thanks for your reply! In general, my problem is to clean the text that comes from copying/pasting from a word document. The case I mentioned in my initial post derives from that.
A paste from a word document (see attached pic) of a bulleted list comes to the editor with the following source code (code view):
<p><span>line 1</span></p><div>line 2</div><div>line 3</div><div>line4</div>
After many trials I have found that the most proper solution is to first paste the text, having set the
RichTextEditorPasteCleanupSettings.PlainText to "true", and then pressing the "Clear Format" button from the toolbar.
After doing this, the source code becomes:
<p>line 1</p><p>line 2</p><p>line 3</p><p>line 4</p>
Which then can be formatted properly as a bulleted list.
The above is just one example of many cases I have seen. Almost in all of them, the most clean and "proper" final source code is generated after pasting (with the PlainText option) and then performing a
"Clear Format".
So my question is how can I automate that functionality? Is there a way that after a paste is performed to run the "Clear Format" command without having the user do that? I have seen the "AfterPasteCleanup" event and I guess that's the one I should use but how to invoke from there the
"Clear Format" command? Or is there a better way to achieve this?
Best
Attachment: Screenshot_20240606_132142_20ffe4c7.zip
- 3 Replies
- 2 Participants
- Marked answer
-
SO Sotiris
- Jun 3, 2024 11:56 AM UTC
- Jun 18, 2024 06:34 AM UTC