This commit is contained in:
Faris Ansari 2017-11-02 09:57:37 +05:30
parent 89dfaa13ed
commit d55ee1b45f
4 changed files with 19 additions and 13 deletions

View File

@ -326,10 +326,7 @@ function copyTextToClipboard(text) {
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
console.log('Copying text command was ' + msg);
document.execCommand('copy');
} catch (err) {
console.log('Oops, unable to copy');
}
@ -1729,18 +1726,26 @@ var CellManager = function () {
if (!cells) return;
var values = cells.map(function (index) {
var values = cells
// get cell objects
.map(function (index) {
return _this8.getCell.apply(_this8, _toConsumableArray(index));
}).reduce(function (acc, curr) {
})
// convert to array of rows
.reduce(function (acc, curr) {
var rowIndex = curr.rowIndex;
acc[rowIndex] = acc[rowIndex] || [];
acc[rowIndex].push(curr.content);
return acc;
}, []).map(function (row) {
}, [])
// join values by tab
.map(function (row) {
return row.join('\t');
}).join('\n');
})
// join rows by newline
.join('\n');
(0, _utils.copyTextToClipboard)(values);
}

File diff suppressed because one or more lines are too long

View File

@ -334,7 +334,9 @@ export default class CellManager {
if (!cells) return;
const values = cells
// get cell objects
.map(index => this.getCell(...index))
// convert to array of rows
.reduce((acc, curr) => {
const rowIndex = curr.rowIndex;
@ -343,7 +345,9 @@ export default class CellManager {
return acc;
}, [])
// join values by tab
.map(row => row.join('\t'))
// join rows by newline
.join('\n');
copyTextToClipboard(values);

View File

@ -247,10 +247,7 @@ function copyTextToClipboard(text) {
textArea.select();
try {
const successful = document.execCommand('copy');
const msg = successful ? 'successful' : 'unsuccessful';
console.log('Copying text command was ' + msg);
document.execCommand('copy');
} catch (err) {
console.log('Oops, unable to copy');
}