@teselagen/ove 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AlignmentView/index.d.ts +4 -0
- package/index.cjs.js +732 -101
- package/index.es.js +733 -102
- package/index.umd.js +721 -81
- package/package.json +3 -6
- package/src/AlignmentView/index.js +45 -83
- package/src/withEditorInteractions/Keyboard.js +2 -2
- package/src/withEditorInteractions/index.js +13 -20
- package/withEditorInteractions/Keyboard.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teselagen/ove",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -12,12 +12,11 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@teselagen/sequence-utils": "0.3.27",
|
|
14
14
|
"@teselagen/range-utils": "0.3.7",
|
|
15
|
-
"@teselagen/ui": "0.7.
|
|
15
|
+
"@teselagen/ui": "0.7.9",
|
|
16
16
|
"@teselagen/file-utils": "0.3.16",
|
|
17
17
|
"@teselagen/bounce-loader": "0.3.11",
|
|
18
18
|
"@teselagen/bio-parsers": "0.4.22",
|
|
19
|
-
"@blueprintjs/core": "3.
|
|
20
|
-
"@blueprintjs/datetime": "^3.24.1",
|
|
19
|
+
"@blueprintjs/core": "3.52.0",
|
|
21
20
|
"@blueprintjs/icons": "3.33.0",
|
|
22
21
|
"@blueprintjs/select": "3.18.11",
|
|
23
22
|
"@dnd-kit/core": "^6.1.0",
|
|
@@ -71,7 +70,6 @@
|
|
|
71
70
|
"react-dom": "^18.3.1",
|
|
72
71
|
"react-draggable": "4.4.5",
|
|
73
72
|
"react-dropzone": "^11.4.2",
|
|
74
|
-
"react-markdown": "9.0.1",
|
|
75
73
|
"react-measure": "^2.5.2",
|
|
76
74
|
"react-redux": "^8.0.5",
|
|
77
75
|
"react-rnd": "^10.2.4",
|
|
@@ -83,7 +81,6 @@
|
|
|
83
81
|
"redux-act": "^1.8.0",
|
|
84
82
|
"redux-form": "^8.3.10",
|
|
85
83
|
"redux-thunk": "2.4.1",
|
|
86
|
-
"remark-gfm": "^4.0.0",
|
|
87
84
|
"reselect": "^4.1.7",
|
|
88
85
|
"shortid": "^2.2.16",
|
|
89
86
|
"tg-use-local-storage-state": "^16.0.3",
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
Droppable,
|
|
5
5
|
Draggable as DndDraggable
|
|
6
6
|
} from "@hello-pangea/dnd";
|
|
7
|
+
import Clipboard from "clipboard";
|
|
7
8
|
import React from "react";
|
|
8
9
|
import { connect } from "react-redux";
|
|
9
10
|
import {
|
|
@@ -1212,30 +1213,16 @@ export class AlignmentView extends React.Component {
|
|
|
1212
1213
|
this.copyAllAlignmentsFastaClipboardHelper.destroy();
|
|
1213
1214
|
},
|
|
1214
1215
|
didMount: () => {
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
async () => {
|
|
1223
|
-
const textToCopy =
|
|
1224
|
-
this.getAllAlignmentsFastaText();
|
|
1225
|
-
|
|
1226
|
-
try {
|
|
1227
|
-
await navigator.clipboard.writeText(
|
|
1228
|
-
textToCopy
|
|
1229
|
-
);
|
|
1230
|
-
} catch (err) {
|
|
1231
|
-
console.error(
|
|
1232
|
-
"Failed to copy text:",
|
|
1233
|
-
err
|
|
1234
|
-
);
|
|
1216
|
+
this.copyAllAlignmentsFastaClipboardHelper =
|
|
1217
|
+
new Clipboard(
|
|
1218
|
+
`.copyAllAlignmentsFastaClipboardHelper`,
|
|
1219
|
+
{
|
|
1220
|
+
action: "copyAllAlignmentsFasta",
|
|
1221
|
+
text: () => {
|
|
1222
|
+
return this.getAllAlignmentsFastaText();
|
|
1235
1223
|
}
|
|
1236
1224
|
}
|
|
1237
1225
|
);
|
|
1238
|
-
});
|
|
1239
1226
|
},
|
|
1240
1227
|
onClick: () => {
|
|
1241
1228
|
window.toastr.success("Selection Copied");
|
|
@@ -1251,42 +1238,29 @@ export class AlignmentView extends React.Component {
|
|
|
1251
1238
|
this.copySpecificAlignmentFastaClipboardHelper.destroy();
|
|
1252
1239
|
},
|
|
1253
1240
|
didMount: () => {
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
const seqDataToCopyAsFasta = `>${name}\r\n${seqDataToCopy}\r\n`;
|
|
1274
|
-
|
|
1275
|
-
try {
|
|
1276
|
-
await navigator.clipboard.writeText(
|
|
1277
|
-
seqDataToCopyAsFasta
|
|
1278
|
-
);
|
|
1279
|
-
} catch (err) {
|
|
1280
|
-
console.error(
|
|
1281
|
-
"Failed to copy text:",
|
|
1282
|
-
err
|
|
1283
|
-
);
|
|
1241
|
+
this.copySpecificAlignmentFastaClipboardHelper =
|
|
1242
|
+
new Clipboard(
|
|
1243
|
+
`.copySpecificAlignmentFastaClipboardHelper`,
|
|
1244
|
+
{
|
|
1245
|
+
action: "copySpecificAlignmentFasta",
|
|
1246
|
+
text: () => {
|
|
1247
|
+
const { selectionLayer } =
|
|
1248
|
+
this.props.store.getState()
|
|
1249
|
+
.VectorEditor
|
|
1250
|
+
.__allEditorsOptions.alignments[
|
|
1251
|
+
this.props.id
|
|
1252
|
+
] || {};
|
|
1253
|
+
const seqDataToCopy =
|
|
1254
|
+
getSequenceDataBetweenRange(
|
|
1255
|
+
alignmentData,
|
|
1256
|
+
selectionLayer
|
|
1257
|
+
).sequence;
|
|
1258
|
+
const seqDataToCopyAsFasta = `>${name}\r\n${seqDataToCopy}\r\n`;
|
|
1259
|
+
return seqDataToCopyAsFasta;
|
|
1284
1260
|
}
|
|
1285
1261
|
}
|
|
1286
1262
|
);
|
|
1287
|
-
});
|
|
1288
1263
|
},
|
|
1289
|
-
|
|
1290
1264
|
onClick: () => {
|
|
1291
1265
|
window.toastr.success(
|
|
1292
1266
|
"Selection Copied As Fasta"
|
|
@@ -1303,40 +1277,28 @@ export class AlignmentView extends React.Component {
|
|
|
1303
1277
|
this.copySpecificAlignmentAsPlainClipboardHelper.destroy();
|
|
1304
1278
|
},
|
|
1305
1279
|
didMount: () => {
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
try {
|
|
1326
|
-
await navigator.clipboard.writeText(
|
|
1327
|
-
seqDataToCopy
|
|
1328
|
-
);
|
|
1329
|
-
} catch (err) {
|
|
1330
|
-
console.error(
|
|
1331
|
-
"Failed to copy text:",
|
|
1332
|
-
err
|
|
1333
|
-
);
|
|
1280
|
+
this.copySpecificAlignmentAsPlainClipboardHelper =
|
|
1281
|
+
new Clipboard(
|
|
1282
|
+
`.copySpecificAlignmentAsPlainClipboardHelper`,
|
|
1283
|
+
{
|
|
1284
|
+
action: "copySpecificAlignmentFasta",
|
|
1285
|
+
text: () => {
|
|
1286
|
+
const { selectionLayer } =
|
|
1287
|
+
this.props.store.getState()
|
|
1288
|
+
.VectorEditor
|
|
1289
|
+
.__allEditorsOptions.alignments[
|
|
1290
|
+
this.props.id
|
|
1291
|
+
] || {};
|
|
1292
|
+
const seqDataToCopy =
|
|
1293
|
+
getSequenceDataBetweenRange(
|
|
1294
|
+
alignmentData,
|
|
1295
|
+
selectionLayer
|
|
1296
|
+
).sequence;
|
|
1297
|
+
return seqDataToCopy;
|
|
1334
1298
|
}
|
|
1335
1299
|
}
|
|
1336
1300
|
);
|
|
1337
|
-
});
|
|
1338
1301
|
},
|
|
1339
|
-
|
|
1340
1302
|
onClick: () => {
|
|
1341
1303
|
window.toastr.success("Selection Copied");
|
|
1342
1304
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { noop } from "lodash-es";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
-
class
|
|
4
|
+
class Clipboard extends React.Component {
|
|
5
5
|
// static propTypes = {
|
|
6
6
|
// value: PropTypes.string.isRequired
|
|
7
7
|
// };
|
|
@@ -82,4 +82,4 @@ class Keyboard extends React.Component {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
export default
|
|
85
|
+
export default Clipboard;
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
getAminoAcidStringFromSequenceString
|
|
5
5
|
} from "@teselagen/sequence-utils";
|
|
6
6
|
import { getSequenceWithinRange } from "@teselagen/range-utils";
|
|
7
|
+
import Clipboard from "clipboard";
|
|
7
8
|
import { compose } from "redux";
|
|
8
9
|
import {
|
|
9
10
|
getReverseComplementSequenceAndAnnotations,
|
|
@@ -598,8 +599,14 @@ function VectorInteractionHOC(Component /* options */) {
|
|
|
598
599
|
this.props;
|
|
599
600
|
const { isProtein } = sequenceData;
|
|
600
601
|
const makeTextCopyable = (transformFunc, className, action = "copy") => {
|
|
601
|
-
|
|
602
|
-
|
|
602
|
+
return new Clipboard(`.${className}`, {
|
|
603
|
+
action: () => action,
|
|
604
|
+
text: () => {
|
|
605
|
+
if (action === "copy") {
|
|
606
|
+
document.body.addEventListener("copy", this.handleCopy);
|
|
607
|
+
} else {
|
|
608
|
+
document.body.addEventListener("cut", this.handleCut);
|
|
609
|
+
}
|
|
603
610
|
const { editorName, store } = this.props;
|
|
604
611
|
const { sequenceData, copyOptions, selectionLayer } =
|
|
605
612
|
store.getState().VectorEditor[editorName];
|
|
@@ -621,36 +628,20 @@ function VectorInteractionHOC(Component /* options */) {
|
|
|
621
628
|
}
|
|
622
629
|
}
|
|
623
630
|
);
|
|
624
|
-
|
|
625
631
|
const sequenceDataToCopy = transformFunc(
|
|
626
632
|
selectedSeqData,
|
|
627
633
|
sequenceData
|
|
628
634
|
);
|
|
629
635
|
this.sequenceDataToCopy = sequenceDataToCopy;
|
|
630
636
|
|
|
631
|
-
const textToCopy =
|
|
632
|
-
sequenceDataToCopy.textToCopy || sequenceDataToCopy.sequence;
|
|
633
|
-
|
|
634
|
-
try {
|
|
635
|
-
await navigator.clipboard.writeText(textToCopy);
|
|
636
|
-
} catch (err) {
|
|
637
|
-
console.error("Failed to copy text:", err);
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
if (action === "copy") {
|
|
641
|
-
document.body.addEventListener("copy", this.handleCopy);
|
|
642
|
-
} else {
|
|
643
|
-
document.body.addEventListener("cut", this.handleCut);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
637
|
if (window.Cypress) {
|
|
647
638
|
window.Cypress.textToCopy = sequenceDataToCopy.textToCopy;
|
|
648
639
|
window.Cypress.seqDataToCopy = sequenceDataToCopy;
|
|
649
640
|
}
|
|
650
|
-
|
|
641
|
+
return sequenceDataToCopy.textToCopy || sequenceDataToCopy.sequence;
|
|
642
|
+
}
|
|
651
643
|
});
|
|
652
644
|
};
|
|
653
|
-
|
|
654
645
|
const aaCopy = {
|
|
655
646
|
text: "Copy AA Sequence",
|
|
656
647
|
className: "openVeCopyAA",
|
|
@@ -669,6 +660,8 @@ function VectorInteractionHOC(Component /* options */) {
|
|
|
669
660
|
}, className);
|
|
670
661
|
}
|
|
671
662
|
};
|
|
663
|
+
// TODO: maybe stop using Clipboard.js and unify clipboard handling with
|
|
664
|
+
// a more versatile approach
|
|
672
665
|
return [
|
|
673
666
|
...(readOnly || disableBpEditing
|
|
674
667
|
? []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from '../../../../node_modules/react';
|
|
2
|
-
export default
|
|
3
|
-
declare class
|
|
2
|
+
export default Clipboard;
|
|
3
|
+
declare class Clipboard extends React.Component<any, any, any> {
|
|
4
4
|
static defaultProps: {
|
|
5
5
|
className: string;
|
|
6
6
|
};
|