handsontable
Version:
Handsontable is a JavaScript Spreadsheet Component available for React, Angular and Vue.
31 lines (27 loc) • 750 B
JavaScript
import * as C from "../../../i18n/constants.mjs";
/**
* @param {CopyPaste} copyPastePlugin The plugin instance.
* @returns {object}
*/
export default function copyItem(copyPastePlugin) {
return {
key: 'copy',
name: function name() {
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_COPY);
},
callback: function callback() {
copyPastePlugin.copy();
},
disabled: function disabled() {
if (this.countRows() === 0 || this.countCols() === 0) {
return true;
}
var selected = this.getSelected(); // Disable for no selection or for non-contiquous selection.
if (!selected || selected.length > 1) {
return true;
}
return false;
},
hidden: false
};
}