fix: can't replace text when paste command with multi selected blocks(#1705)
issue:(#1705)
I always use products. And I was stressed about this issue, so I tried a fix. And I'm here to discuss solutions.
Maybe a caret issue...? and it did not work without _deley
If you think you can figure out the cause, please let me know and I will fix it.
Tasks
- Writing Tests
_.delay(() => {
document.execCommand(
'insertHTML',
false,
clean(content.innerHTML, currentToolSanitizeConfig)
);
}, 20)();
hello, anybody here?
@kaaaaaaaaaaai, Thanks for creating the PR for the issue and sorry for the late response. Can you pls update the test case according to your pr so we can go for merge. I guess you just need to increase this time.
@robonetphy @neSpecc thank you response.
i try! I'll do my best to contribute!
@neSpecc about the promise we added into the caret.ts, if you check here
Currently, there is a delay during the caret set process since we are trying to replace the entire or partial content of the editor we need to do the following steps:
- Remove all the selected blocks.
- add a new empty default block.
- set the caret to it (need a promise to wait for the caret to set).
- add all the clipboard contents
That's right! That's what I wanted to say :)))))
Lack of tests