tagify icon indicating copy to clipboard operation
tagify copied to clipboard

if deleted key is pressed before a single character in a new line, the node before it also gets deleted

Open carls-jr opened this issue 5 years ago • 2 comments

https://jsbin.com/yehevewitu/edit?html,js,output

This will not happen when copy & paste. Please type it one by one character.

This happens in the newest chrome and I think this is not a matter of browser.

This line causes this matter.

https://github.com/yairEO/tagify/blob/67546600a23ee3c75cf32add4cd18d9f99d92bf2/src/tagify.js#L689-L691

In this case

currentValue: aaa<div>bbb</div><div><br></div> lastInputValue: aaa<div>bbb</div><div>c</div>

so this meets the following condition and 'ccc' is removed by this.removeTags !selection.anchorOffset && currentValue.length >= lastInputValue.length

when these characters are copied&pasted

currentValue: aaa bbb <br>

lastInputValue:
aaa bbb c<br>

(both values include line feed code) This issue will not happen because this doesn't meet the condition.

I hope this helps you!

carls-jr avatar May 28 '20 04:05 carls-jr

Seems to work fine in Chrome. Which browser are you using?

yairEO avatar May 28 '20 10:05 yairEO

If you've pressed Shift+Enter this wouldn't have happen :)

Thanks for reporting

yairEO avatar May 30 '20 12:05 yairEO