diff options
| author | Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> | 2021-09-09 23:48:52 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-09 23:48:52 -0400 |
| commit | bc35345fdf72f26c5c94909180109a998c1513c0 (patch) | |
| tree | 4000ee3540ebb84db85ffcfb8e09e43ec0fe92fc /src/client/views/collections/CollectionSubView.tsx | |
| parent | 2d2e027f11253834a337680bbfd1ac549bb2a1f0 (diff) | |
| parent | 9d177851ecaaea1a89ac9b7de1cec16368603eaa (diff) | |
Merge pull request #35 from brown-dash/menu_updates_geireann
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 }); |
