diff options
| author | geireann <geireann.lindfield@gmail.com> | 2021-09-12 10:03:00 -0400 |
|---|---|---|
| committer | geireann <geireann.lindfield@gmail.com> | 2021-09-12 10:03:00 -0400 |
| commit | 939c7d092635e47e081aa8f047b73af36058f3b7 (patch) | |
| tree | 7b5d4a9dce0c66ce3e2bd62755f536d41db48181 /src/client/views/collections/CollectionSubView.tsx | |
| parent | f20dfa857e1651ced1eb2303ea8a8462483fbc4c (diff) | |
| parent | d9419c89ccdac7435c87b27a55486b7a5980ae29 (diff) | |
Merge branch 'menu_updates_geireann' of https://github.com/brown-dash/Dash-Web into menu_updates_geireann
Diffstat (limited to 'src/client/views/collections/CollectionSubView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionSubView.tsx | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index b70df93da..06d20f015 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -321,12 +321,8 @@ export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?: } }); } else { - let srcUrl: string | undefined; - let srcWeb: Doc | undefined; - if (SelectionManager.Views().length) { - srcWeb = SelectionManager.Views()[0].props.Document; - srcUrl = (srcWeb.data as WebField).url?.href?.match(/http[s]?:\/\/[^/]*/)?.[0]; - } + const srcWeb = SelectionManager.Docs().lastElement(); + const srcUrl = (srcWeb?.data as WebField).url?.href?.match(/http[s]?:\/\/[^/]*/)?.[0]; const reg = new RegExp(Utils.prepend(""), "g"); const modHtml = srcUrl ? html.replace(reg, srcUrl) : html; const htmlDoc = Docs.Create.HtmlDocument(modHtml, { ...options, title: "-web page-", _width: 300, _height: 300 }); |
