Copy/Paste not working on Custom Editor?

Tags: #<Tag:0x00007f343925d8d8>


Currently, we are working on the implementation of multi-select cells on our Handsontable-based product. In order to do so, we tried several custom components already developed by the community such as ( not working as well as we expected ) therefore we switched to

However, in both of these components, we encoutered the same bug : The copy/paste function is not working for Handsontable ( v7.0.0+ ). After further analysis and research, the root of the main problem could be that the implementation of the custom editor could be wrong for the newest version of the CopyPaste plugin ( for instance here )

Can someone please help us figure out why the CopyPaste plugin of Handsontable is not working in this particular case ?

Edit: Even the beforeCopy event is not triggerred in this scenario.

Hi @nicolas.lehalper,

Our CopyPaste bases on the native ClipboardEvents. Under the hood, we create or keep actively selected HTMLTextAreaElement element that has to be focused (be an document.activeElement) with selected text inside. That trick allows preventing default actions for copy/paste/cut.

Though, in these custom editors, I see that authors extends TextEditor, which has TEXTAREA property. It’s something, that we internally use to determine if we need to create secondaryElement for CopyPaste (you can find that fragment here:

What I can suggest, is to move one of these packages you mentioned into your project, but replace parent class to Handsontable.editors.SelectEditor (or even use BaseEditor) to rid of all unnecessary things from the prototype.

Thanks for your feedback and your assist @piotr.laszczkowski. I am going to try this approach this week. I’ll keep you in touch.