aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionSubView.tsx
diff options
context:
space:
mode:
authorab <abdullah_ahmed@brown.edu>2019-06-24 10:49:24 -0400
committerab <abdullah_ahmed@brown.edu>2019-06-24 10:49:24 -0400
commitadde0572b84feb9b7ea90f4e584595516e0d04ec (patch)
tree844e997b7b213d734c1dbbff3c9ffde1ec4a1a2f /src/client/views/collections/CollectionSubView.tsx
parent818d3a367648f7dbb279e13aa197ffbae412fbd0 (diff)
parent52051829373bc4acfe9d705b64c30e3fddebf439 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into text_box_ab
Diffstat (limited to 'src/client/views/collections/CollectionSubView.tsx')
-rw-r--r--src/client/views/collections/CollectionSubView.tsx7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index e55cd9e37..699bddc7c 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -176,8 +176,11 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) {
return;
}
if (html && !html.startsWith("<a")) {
- if (html.indexOf("<img") === 0) {
- let split = html.split("\"")[1];
+ let tags = html.split("<");
+ if (tags[0] === "") tags.splice(0, 1);
+ let img = tags[0].startsWith("img") ? tags[0] : tags.length > 1 && tags[1].startsWith("img") ? tags[1] : "";
+ if (img) {
+ let split = img.split("src=\"")[1].split("\"")[0];
let doc = Docs.ImageDocument(split, { ...options, width: 300 });
this.props.addDocument(doc, false);
return;