Copy/Paste plugin missing in HoT V1.9.x PRO

Tags: #<Tag:0x00007f8b1d63e3e0>

Hi,

I have HoT library in a production application that uses Angular 1.x. I cannot upgrade to 2.0 + and know that HoT does not support Angular 1 anymore.

The problem is when I do Handsontable.plugin to check all the available list of plugins I cannot see CopyPaste plugin by default.

List of plugins available for my project mentioned below.

  1. AutoColumnSize
  2. AutoRowSize
  3. Autofill
  4. BasePlugin
  5. BindRowsWithHeaders
  6. CollapsibleColumns
  7. ColumnSorting
  8. ColumnSummary
  9. Comments
  10. ContextMenu
  11. ContextMenuCopyPaste
  12. DragToScroll
  13. DropdownMenu
  14. ExportFile
  15. Filters
  16. Formulas
  17. GanttChart
  18. HeaderTooltips
  19. HiddenColumns
  20. HiddenRows
  21. ManualColumnFreeze
  22. ManualColumnMove
  23. ManualColumnResize
  24. ManualRowMove
  25. ManualRowResize
  26. MultipleSelectionHandles
  27. NestedHeaders
  28. NestedRows
  29. ObserveChanges
  30. TouchScroll
  31. TrimRows
  32. registerPlugin
  33. utils

I think it is default plugin provided by HoT. However, I have ContextMenuCopyPaste instead of copyPaste which give me this error when I enable it .“handsontable.full.min.js:32 To be able to use the Copy/Paste feature from the context menu, your browser needs to have Flash Plugin installed.

My basic config:

contextMenu: [
‘copy’ // copy&cut doesnot even trigger beforeCopy,afterCopy, afterCut callbacks
‘cut’
{
key: ‘paste’
name: ‘Paste’
disabled: ->
false
callback: ->
plugin = this.getPlugin(‘copyPaste’) //plugin is always undefined
this.listen((e) ->
console.log(‘testing’);
)
plugin.paste()
}
]

Want to know is there a way to get them working in any other way. I cannot produce a fiddle because the cdns and fiddle do have that plugin when I run the service outside my project.

Please assist what the problem could be.

Much appreciated.

-Akash

Hi @sai.jeedigunta

the copyPaste cannot be called by the getPlugin method even if this is actually a plugin. We are planning to change this behavior in newer versions of Handsontable.

ps. you still are able to load latest Handsontable version even when you’re on Angular 1 (with or without the wrapper).

Hi Aleksandra,

Thank you for the prompt response, If the CopyPaste cannot be called in as a plugin . How can I use the below.

  • beforeCopy
  • afterCopy
  • beforeCut
  • afterCut
  • beforePaste
  • afterPaste

They do not get triggered at all? Can we call the above hooks in any other way ??

Right now I am using these:

  • this.copyPaste.setCopyableText()
  • this.copyPaste.triggerCut();
  • this.copyPaste.triggerPaste();

Please let me know

Thanks
Akash

Hooks are called in the initialization

beforeCopy
afterCopy
beforeCut
afterCut
beforePaste
afterPaste

you should not get any issues while using them. Here’s a demo where you can check them out https://jsfiddle.net/tj50r83p/

and this is also correct

this.copyPaste.setCopyableText()
this.copyPaste.triggerCut();
this.copyPaste.triggerPaste();

In the future, nothing will change for the hooks, but the methods will be called by the getPlugin() method, like

this.getPlugin('copyPaste').copyPaste.triggerCut();

However, you shouldn’t worry about that. What you do now is completely fine.

This is so strange It works in the fiddle you sent me but when I add it in my project none of the copy paste hooks get triggered and give a console output. I will update a Plunker / fiddle in some time.

Thanks
Akash

are you able to log anything via afterChange hook?

I can do it through afterChange and beforeChange but the problem is
copy paste via contextMenu and keyboard are not in sync. As in, when I copy something with CTRL+C and try to paste it with right click context menu the copied value is not pasted and vice versa.

Here is the Plunker with my HoT.min.css and JS files that I am using in my project

Please help

-Akash

Hi @sai.jeedigunta

Can you check the demo? It does not load the table.

I dont know what the problem is it has my local HoT library and cdn ngHandsontable. it doesnot load and complain about Handsontable is not defined.

Unless I use my local HoT pro version to demo you . I cannot show the exact issue.

I am kind of stuck with this unable to reproduce. I will figure something out

But one question:

When you show the fiddle with just contextMenu:true, you see copy and cut as default values in context menu but in my local I dont see them as default . I have to write a custom query for copy and cut too.

Do you know why ??

Thanks
Akash

It usually means that the script order is wrong or you define a variable (hot container) after you refer to it. Can you send the code via Wetransfer?