Open s-kris opened 2 years ago
Please let me know the HTML string(getContents()
) in which the phenomenon is occurring.
@JiHong88 Apologies for the delay. I was able to recreate the scenario and find the reason.
The copied multi-paragraph text is inserted as one
tag. That's why formatting any line is formatting the entire text.
<br>Introduction-<br><br>It is no secret that our modern lifestyles are not conducive to good health or fitness. We live in a world where we are bombarded with unhealthy food choices and sedentary activities. Even when we try to make the right choices, it is often difficult to stick to them. So, how can we make sure that we stay fit?<br><br>There are many things that we can do to stay fit, but it is important to find an approach that works for us individually. What works for one person may not work for another. However, there are some general tips that can help us all to stay on track.<br><br>Here are 10 tips on how to stay fit:<br><br>1. Get active<br><br>The first and most important thing we can do to stay fit is to get active. It is important to find an activity that we enjoy and make it a part of our daily routine. Whether it is going for a walk, a run, or a swim, regular exercise is essential for good health.<br><br>2. Eat healthy<br><br>The second tip is to make sure that we are eating healthy. This means choosing nutritious foods and avoiding processed and junk foods. It is also important to eat regular meals and to avoid skipping meals.<br><br>3. Stay hydrated<br><br>It is important to stay hydrated by drinking plenty of water. It is also a good idea to avoid sugary drinks and alcohol.<br><br>4. Get enough sleep<br><br>Sleep is important for our overall health and wellbeing. It is recommended that we get between 7 and 8 hours of sleep each night.<br><br>5. Take breaks<br><br>When we are feeling stressed or overwhelmed, it is important to take a break. This can be a physical break, such as going for a walk, or a mental break, such as taking a few minutes to relax and clear our minds.<br><br>6. Avoid smoking<br><br>Smoking is harmful to our health and it is important to avoid it. If we are struggling to quit, there are many resources available to help us.<br><br>7. Limit screen time<br><br>Spending too much time looking at screens can be harmful to our health. It is important to limit our screen time and take breaks from screens throughout the day.<br><br>8. Be mindful<br><br>It is important to be aware of our thoughts and feelings and to manage them in a healthy way. Mindfulness can help us to do this.<br><br>9. Connect with others<br><br>It is important to connect with others and to have social support. This can help us to stay motivated and on track.<br><br>10. Seek professional help<br><br>If we are struggling to manage our health or fitness, it is important to seek professional help. There are many resources available to help us reach our goals.
<p>
<br>Introduction-<br><br>It is no secret that our modern lifestyles are not conducive to good health or fitness. We live in a world where we are bombarded with unhealthy food choices and sedentary activities. Even when we try to make the right choices, it is often difficult to stick to them. So, how can we make sure that we stay fit?<br><br>There are many things that we can do to stay fit, but it is important to find an approach that works for us individually. What works for one person may not work for another. However, there are some general tips that can help us all to stay on track.<br><br>Here are 10 tips on how to stay fit:<br><br>1. Get active<br><br>The first and most important thing we can do to stay fit is to get active. It is important to find an activity that we enjoy and make it a part of our daily routine. Whether it is going for a walk, a run, or a swim, regular exercise is essential for good health.<br><br>2. Eat healthy<br><br>The second tip is to make sure that we are eating healthy. This means choosing nutritious foods and avoiding processed and junk foods. It is also important to eat regular meals and to avoid skipping meals.<br><br>3. Stay hydrated<br><br>It is important to stay hydrated by drinking plenty of water. It is also a good idea to avoid sugary drinks and alcohol.<br><br>4. Get enough sleep<br><br>Sleep is important for our overall health and wellbeing. It is recommended that we get between 7 and 8 hours of sleep each night.<br><br>5. Take breaks<br><br>When we are feeling stressed or overwhelmed, it is important to take a break. This can be a physical break, such as going for a walk, or a mental break, such as taking a few minutes to relax and clear our minds.<br><br>6. Avoid smoking<br><br>Smoking is harmful to our health and it is important to avoid it. If we are struggling to quit, there are many resources available to help us.<br><br>7. Limit screen time<br><br>Spending too much time looking at screens can be harmful to our health. It is important to limit our screen time and take breaks from screens throughout the day.<br><br>8. Be mindful<br><br>It is important to be aware of our thoughts and feelings and to manage them in a healthy way. Mindfulness can help us to do this.<br><br>9. Connect with others<br><br>It is important to connect with others and to have social support. This can help us to stay motivated and on track.<br><br>10. Seek professional help<br><br>If we are struggling to manage our health or fitness, it is important to seek professional help. There are many resources available to help us reach our goals.
</p>
A line break with "br" in a paragraph adds a "br" within the paragraph. "Formats" replaces one paragraph. The copied contents are line breaks with only "br", so they are placed inside the pasted paragraph.
Processing all new lines based on the copied "br" will cause other side effects. I'll think about what would make sense..
PS: Please let me know if you have a link to the copy.
Thanks for considering. I understand processing each line has side effects.
It happens with any text that is copied from any text box. Please see the attached video.
https://user-images.githubusercontent.com/3975305/214642232-99f9aeb3-6e92-47ff-9ad4-03733ace0678.mp4
There's no way to do this. The copied text is "br". It's probably the same in other editors as well.
It is not the same in other editors. I tested in notion, google docs, tiny mce and other editors.
I handled it in a hacky way, seems to be working. It's been a few weeks for now.
Replacing all "br" tags with lines is problematic. Below is the "tinymce" test video.
Sometimes formatting a block of text affects other block of text too.
A video reproduction is shown below
https://user-images.githubusercontent.com/3975305/178138429-d2c8eb62-bcbc-4f9f-bb9c-cb278b78870b.mov
Desktop (please complete the following information):
Additional context This happens on other browsers and operating systems as well