aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkimdahey <claire_kim1@brown.edu>2019-08-04 20:53:50 -0400
committerkimdahey <claire_kim1@brown.edu>2019-08-04 20:53:50 -0400
commitac6d9fe0b327436729ceeaee2acecf6ea8f2fa3d (patch)
tree21bbc0fa8062d8a7f225bce704ba34b07cfae8f6
parent857e98b16f693db968b04ede62e3f864f8b2ed35 (diff)
copy to clipboard
-rw-r--r--.vscode/launch.json3
-rw-r--r--package.json3
-rw-r--r--src/client/util/DictationManager.ts12
3 files changed, 16 insertions, 2 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json
index e4196600e..d2c18d6f1 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -12,6 +12,9 @@
"breakOnLoad": true,
"url": "http://localhost:1050/login",
"webRoot": "${workspaceFolder}",
+ "runtimeArgs": [
+ "--experimental-modules"
+ ]
},
{
"type": "firefox",
diff --git a/package.json b/package.json
index 3d0d5c3d7..97980f0ca 100644
--- a/package.json
+++ b/package.json
@@ -117,8 +117,8 @@
"bluebird": "^3.5.3",
"body-parser": "^1.18.3",
"bootstrap": "^4.3.1",
- "child_process": "^1.0.2",
"canvas": "^2.5.0",
+ "child_process": "^1.0.2",
"class-transformer": "^0.2.0",
"connect-flash": "^0.1.1",
"connect-mongo": "^2.0.3",
@@ -211,6 +211,7 @@
"socket.io-client": "^2.2.0",
"solr-node": "^1.2.1",
"standard-http-error": "^2.0.1",
+ "ts-clipboard": "^1.0.17",
"typescript-collections": "^1.3.2",
"url-loader": "^1.1.2",
"uuid": "^3.3.2",
diff --git a/src/client/util/DictationManager.ts b/src/client/util/DictationManager.ts
index 978889830..3668ca0d2 100644
--- a/src/client/util/DictationManager.ts
+++ b/src/client/util/DictationManager.ts
@@ -11,6 +11,7 @@ import { listSpec } from "../../new_fields/Schema";
import { AudioField, ImageField } from "../../new_fields/URLField";
import { HistogramField } from "../northstar/dash-fields/HistogramField";
import { MainView } from "../views/MainView";
+import { Clipboard } from "ts-clipboard";
/**
* This namespace provides a singleton instance of a manager that
@@ -78,6 +79,7 @@ export namespace DictationManager {
try {
results = await listenImpl(options);
if (results) {
+ Clipboard.copy(results);
main.isListening = false;
let execute = options && options.tryExecute;
main.dictatedPhrase = execute ? results.toLowerCase() : results;
@@ -250,7 +252,8 @@ export namespace DictationManager {
[DocumentType.AUDIO, AudioField],
[DocumentType.IMG, ImageField],
[DocumentType.HIST, HistogramField],
- [DocumentType.IMPORT, listSpec(Doc)]
+ [DocumentType.IMPORT, listSpec(Doc)],
+ [DocumentType.TEXT, "string"]
]);
const tryCast = (view: DocumentView, type: DocumentType) => {
@@ -294,6 +297,13 @@ export namespace DictationManager {
let kvp = Docs.Create.KVPDocument(target.props.Document, { width: 300, height: 300 });
target.props.addDocTab(kvp, target.dataDoc, "onRight");
}
+ }],
+
+ ["promote", {
+ action: (target: DocumentView) => {
+ console.log(target);
+ },
+ restrictTo: [DocumentType.TEXT]
}]
]);