ASP.NET MVC Controls
Clipboard Class
File
wijmo.js
Module
wijmo

Static class that provides utility methods for clipboard operations.

The copy and paste methods that can be used by controls to customize the clipboard content during clipboard operations.

For example, the code below shows how a control could intercept the clipboard shortcut keys and provide custom clipboard handling:

rootElement.addEventListener('keydown', function(e) {

  // copy: ctrl+c or ctrl+Insert
  if (e.ctrlKey && (e.keyCode == 67 || e.keyCode == 45)) {
    var text = this.getClipString();
    Clipboard.copy(text);
    return;
  }

  // paste: ctrl+v or shift+Insert
  if ((e.ctrlKey && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45)) {
    Clipboard.paste(function (text) {
      this.setClipString(text);
    });
    return;
  }
});

Methods

Methods

Static copy

copy(text: string): void

Copies a string to the clipboard.

This method only works if invoked immediately after the user pressed a clipboard copy command (such as ctrl+c).

Parameters
  • text: string

    Text to copy to the clipboard.

Returns
void

Static paste

paste(callback: Function): void

Gets a string from the clipboard.

This method only works if invoked immediately after the user pressed a clipboard paste command (such as ctrl+v).

Parameters
  • callback: Function

    Function called when the clipboard content has been retrieved. The function receives the clipboard content as a parameter.

Returns
void

 

 


Copyright © GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback