diff options
| author | monikahedman <monika_hedman@brown.edu> | 2019-08-20 10:39:58 -0400 |
|---|---|---|
| committer | monikahedman <monika_hedman@brown.edu> | 2019-08-20 10:39:58 -0400 |
| commit | 56014ff0f3ae620d8a09fdd1d5e98d6b0755f354 (patch) | |
| tree | 8b08e99e6ae1e0e2eb145f98ee8294eb47450765 /src/client/views/PreviewCursor.tsx | |
| parent | ffb4da00970f4146d7ce2c5022dabba193e763a3 (diff) | |
| parent | b987fe6e18c4b37a1ec40abcb4d8360d57dc7d54 (diff) | |
pulled from updates
Diffstat (limited to 'src/client/views/PreviewCursor.tsx')
| -rw-r--r-- | src/client/views/PreviewCursor.tsx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/client/views/PreviewCursor.tsx b/src/client/views/PreviewCursor.tsx index 7bf0d8ace..40be470d6 100644 --- a/src/client/views/PreviewCursor.tsx +++ b/src/client/views/PreviewCursor.tsx @@ -34,8 +34,10 @@ export class PreviewCursor extends React.Component<{}> { let newPoint = PreviewCursor._getTransform().transformPoint(PreviewCursor._clickPoint[0], PreviewCursor._clickPoint[1]); runInAction(() => { PreviewCursor.Visible = false; }); - // pasting in text/video from youtube + if (e.clipboardData.getData("text/plain") !== "") { + + // tests for youtube and makes video document if (e.clipboardData.getData("text/plain").indexOf("www.youtube.com/watch") !== -1) { const url = e.clipboardData.getData("text/plain").replace("youtube.com/watch?v=", "youtube.com/embed/"); PreviewCursor._addDocument(Docs.Create.VideoDocument(url, { @@ -45,6 +47,20 @@ export class PreviewCursor extends React.Component<{}> { }), false); return; } + + // tests for URL and makes web document + let re: any = /^https?:\/\/www\./g; + if (re.test(e.clipboardData.getData("text/plain"))) { + const url = e.clipboardData.getData("text/plain") + PreviewCursor._addDocument(Docs.Create.WebDocument(url, { + title: url, width: 300, height: 300, + // nativeWidth: 300, nativeHeight: 472.5, + x: newPoint[0], y: newPoint[1] + }), false); + return; + } + + // creates text document let newBox = Docs.Create.TextDocument({ width: 200, height: 100, x: newPoint[0], |
