Copy, Cut, and Paste Events, JavaScript Programming Example of Editing Events in File Manager

Copy, Cut, and Paste Events in File Manager

Check out our free coding sample of Copy, Cut, and Paste Events. As a result, a user will be able to select these actions in a right-click popup menu. Feel free to use Webix programming examples to accelerate your app development.

JS Code

/*
The sample uses an outdated File Manager that is no longer supported. 
To learn about the new tool, visit https://docs.webix.com/desktop__filemanager.html
*/


webix.ready(function(){

  webix.ui({
    type: "space",
    rows:[
      {
        view: "label", label: "Try to copy/cut and paste a file to see a corresponding event fired", height: 40
      },
      {
        view:"filemanager",
        id:"files"
      }
    ]

  });

  $$("files").load("https://docs.webix.com/filemanager/samples/server/");

  $$("files").attachEvent("onBeforeMarkCopy", function(ids){
    if (typeof ids === "string")
      ids = [ids];
    webix.message("Copy: "+ids.join(", "));
    return true;
  });
  $$("files").attachEvent("onBeforeMarkCut", function(ids){
    if (typeof ids === "string")
      ids = [ids];
    webix.message("Cut: "+ids.join(", "));
    return true;
  });
  $$("files").attachEvent("onBeforePasteFile", function(ids){
    if (typeof ids === "string")
      ids = [ids];
    webix.message("Paste: "+ids[0]);
    return true;
  });

});