Skip to content

Commit

Permalink
- Fix sidepanel closing after link click
Browse files Browse the repository at this point in the history
- Fix edge case for link parsing
  • Loading branch information
Rustem Mussabekov committed May 13, 2024
1 parent fe59a50 commit 9406948
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app",
"version": "5.6.27",
"version": "5.6.28",
"description": "",
"author": "",
"license": "ISC",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
overflow: hidden
min-height: calc(var(--icon-size) + var(--padding-small))
max-height: calc(var(--icon-size) + var(--padding-small))
transition: opacity .3s ease-in, max-height .2s ease-out, min-height .2s ease-out
transition: opacity .15s ease-in, max-height .2s ease-out, min-height .2s ease-out

&:hover:not(:empty) {
transition-delay: .2s
Expand Down
2 changes: 1 addition & 1 deletion src/co/bookmarks/edit/form/tags/suggested.module.styl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
overflow: hidden
min-height: calc(var(--icon-size) + var(--padding-small))
max-height: calc(var(--icon-size) + var(--padding-small))
transition: opacity .3s ease-in, max-height .2s ease-out, min-height .2s ease-out
transition: opacity .15s ease-in, max-height .2s ease-out, min-height .2s ease-out

&:hover:not(:empty) {
transition-delay: .2s
Expand Down
4 changes: 3 additions & 1 deletion src/routes/_app/extension/useExternalLinks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useMemo } from 'react'
import browser from '~target/extension/browser'
import { environment } from '~target'

export default function useExternalLinks() {
useMemo(()=>{
Expand Down Expand Up @@ -34,7 +35,8 @@ export default function useExternalLinks() {
})

//close popover
window.close()
if (!environment.includes('sidepanel'))
window.close()
}

//very important to bind to window insted of document, to be sure that it happen after all other event listeners
Expand Down
4 changes: 2 additions & 2 deletions src/routes/my/space/bookmarks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useMemo } from 'react'
import { useSelector } from 'react-redux'
import { useNavigate, useLocation } from 'react-router-dom'
import { target } from '~target'
import { target, environment } from '~target'
import Bookmarks from '~co/bookmarks'

export default function PageMySpaceBookmarks({ cId, search, itemId }) {
Expand All @@ -20,7 +20,7 @@ export default function PageMySpaceBookmarks({ cId, search, itemId }) {

case 'new_tab':
window.open(item.link)
if (target == 'extension')
if (target == 'extension' && !environment.includes('sidepanel'))
window.close()
return true

Expand Down
4 changes: 2 additions & 2 deletions src/target/extension/getMeta/parse.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function getMeta() {
const elem = document.querySelector(
const elem = [...document.querySelectorAll(
[...arguments]
.map(key=>`meta[name="${key}"], meta[property="${key}"]`)
.join(', ')
)
)].at(-1) //last occurrence
if (!elem) return null

const value = elem.value || elem.content
Expand Down

0 comments on commit 9406948

Please sign in to comment.