|
@@ -53,7 +53,17 @@ class Search:
|
|
with self.results:
|
|
with self.results:
|
|
for result in await ui.run_javascript(f'return window.fuse.search("{e.value}").slice(0, 50)'):
|
|
for result in await ui.run_javascript(f'return window.fuse.search("{e.value}").slice(0, 50)'):
|
|
href: str = result['item']['url']
|
|
href: str = result['item']['url']
|
|
- target = 'blank' if href.startswith('http') else ''
|
|
|
|
- with ui.element('q-item').props(f'clickable href={href} target={target}'):
|
|
|
|
|
|
+ with ui.element('q-item').props(f'clickable').on('click', lambda href=href: self.clicked(href)):
|
|
with ui.element('q-item-section'):
|
|
with ui.element('q-item-section'):
|
|
ui.label(result['item']['title'])
|
|
ui.label(result['item']['title'])
|
|
|
|
+
|
|
|
|
+ async def clicked(self, url: str) -> None:
|
|
|
|
+ await ui.run_javascript(f'''
|
|
|
|
+ const url = "{url}"
|
|
|
|
+ if (url.startsWith("http"))
|
|
|
|
+ window.open(url, "_blank");
|
|
|
|
+ else
|
|
|
|
+ window.location.href = url;
|
|
|
|
+ ''', respond=False)
|
|
|
|
+ self.dialog.close()
|
|
|
|
+ print(url, flush=True)
|