Pasted Empty Lines Are Duplicated
See original GitHub issueDescribe the Bug
Pasting an empty line when editing a label results in two empty lines upon rendering. Even though direct editing and the properties panel use the same fix empty lines are duplicated upon rendering a label.
Steps to Reproduce
- Copy this text
Foo
Bar
Baz
- Paste it into the direct editing box when editing a label
- Complete direct editing
- Rendered text is now
Foo
Bar
Baz
Expected Behavior
Empty lines are neither lost nor duplicated.
Environment
- OS: Windows 10
- Camunda Modeler Version: 4.9.0-rc.4
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Pasting text adds new line between each line · Issue #1454 ...
I expect the file to paste as I have copied it, with no extra spaces or new lines added. Actual behavior. The pasted...
Read more >Quickly Remove Blanks and Duplicates in Microsoft Excel
In this Microsoft Excel tutorial, I will show you how to remove blank rows, cells, and duplicates. This method with Go to Special...
Read more >Copying a file without duplicate and blank lines in Python
This writes to 'file2.txt' all lines in 'file1.txt' apart from those that are made up of only whitespace or that are duplicates.
Read more >Copy paste in code block double the empty lines
Hello, When I copy code from an editor (Notepad+++, PyCharm etc.) and paste it into an Evernote code block, all empty lines are...
Read more >How to copy and paste values skipping duplicates in Excel?
1. Select the column range you need to copy and paste values skipping duplicates, and click Data > Filter. Then click the Advanced...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Have done some investigations, and have fully RCA’d this:
<divs>
are created:<divs>
are treated as their own newlines, which leads to the duplication we see.Solution proposal:
We could simply sanitize the divs out, if we ever want to include rich text in the labels, this might come back to bite us but from my research combining richText with
document.execCommand('insertText'
is not advisable anyways and is very buggy.ExecCommand as it stands is deprecated, but there is no good alternative to this. The clipboard API does not have a replacement function for insertText.
We could also have our own implementation for chromium based browsers, like we do with IE, but that would be a much larger time investment.
@nikku @philippfromme Opinions?
Okay, so this issue is not related to https://github.com/camunda/camunda-modeler/issues/2280. Thanks, @barmac, with v4.8.1 on Windows I wasn’t able to test this as empty lines were lost on paste.