HandsOnTable Copy / Paste function does not work correctly in some browsers

The copy / paste function works correctly in Chrome and works poorly in Safari. I work on Mac OS (Maverick). The code uses Handsontable 0.11.4 and the ZeroClipboard plugin.

Operations that work in both browsers:

  • Copy and paste inside the grid using the context menu. Example:

    • Select the content grid area, select Copy from the context menu, click the destination cell, and use Paste from the context menu.
  • Operations that use keyboard shortcuts for cutting or copying and context menus for pasting. Example:

    • Select the grid area and use Cmd-C or Cmd-X, then select the destination cell and use paste in the context menu.

Operations that work in Chrome but not in Safari

  • Copy / paste between grid cells whenever Cmd-P is used. That is, in Safari (unlike Chrome), you cannot paste the selection copied from the grid back into some area of ​​the grid using the Cmd-P keyboard shortcut.
  • Copy from another program (e.g. Excel or Sublime) to the grid. It works great in Chrome (using the Cmd-P or Paste menu option) and generally doesn't work in Safari. You cannot copy from an external program to Handsontable when working in Safari.

, , , "" Chrome. - , - . , , , ( 6938)

CopyPasteClass.prototype.triggerPaste = function (event, str) {
  var that = this;
  if (that.pasteCallbacks) {
    setTimeout(function () {
      var val = (str || that.elTextarea.value).replace(/\n$/, ''); //remove trailing newline
      for (var i = 0, ilen = that.pasteCallbacks.length; i < ilen; i++) {
        that.pasteCallbacks[i](val, event);
      }
    }, 50);
  }
};

that.elTextarea.value Chrome, Cmd-P Safari. , Chrome, Excel Safari, .

, Safari, . , ( ) (Chrome Firefox Windows) , Safari Mac. , Excel Handsontable. Ctrl-P, . .

?

+4

All Articles