Skip to content

Commit

Permalink
Fix preview button
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustem Mussabekov committed Dec 6, 2024
1 parent 78fd120 commit 6b277fc
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 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.63",
"version": "5.6.64",
"description": "All-in-one bookmark manager",
"author": "Rustem Mussabekov",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions src/co/bookmarks/item/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Button from '~co/common/button'
import Icon from '~co/common/icon'

export default function BookmarkItemActions(props) {
const { _id, link, access, important } = props
const { _id, link, access, important, type } = props
const { className='' } = props
const { onCopyLinkClick, onImportantClick, onRemoveClick } = props

Expand Down Expand Up @@ -38,7 +38,7 @@ export default function BookmarkItemActions(props) {
<Button
data-button='preview'
as={Link}
to={`item/${_id}/preview`}
to={`item/${_id}/${type == 'link' ? 'web' : 'preview'}`}
variant='outline'
title={t.s('preview')}>
<Icon name='show' />
Expand Down
4 changes: 2 additions & 2 deletions src/co/bookmarks/item/contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Popover, { Menu, MenuItem, MenuSeparator } from '~co/overlay/popover'
import { target } from '~target'

export default function BookmarksItemContextmenu({
_id, link, important, access, reparse, cache, fileType,
_id, link, important, access, reparse, cache, fileType, type,
onContextMenuClose, onRemoveClick, onCopyLinkClick,
onSelectClick, onImportantClick, onReparseClick
}) {
Expand All @@ -23,7 +23,7 @@ export default function BookmarksItemContextmenu({
<MenuSeparator />

{target != 'extension' && (
<MenuItem to={`item/${_id}`}>
<MenuItem to={`item/${_id}/${type == 'link' ? 'web' : 'preview'}`}>
{t.s('preview')}
</MenuItem>
)}
Expand Down
16 changes: 8 additions & 8 deletions src/routes/my/item/tab/preview.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import s from './preview.module.styl'
import React, { useState, useCallback } from 'react'
import React, { useState, useCallback, useEffect } from 'react'
import { useSelector } from 'react-redux'
import { API_ENDPOINT_URL } from '~data/constants/app'

import useWithWebView from '~co/highlights/useWithWebView'
import Preloader from '~co/common/preloader'
import Preloader from '~co/common/webview/preloader'

function getPreviewLink(_id) {
return `${API_ENDPOINT_URL}raindrop/preview/${_id}`
Expand All @@ -27,10 +27,16 @@ export default function PageMyItemTabPreview({ item: { _id }, webViewRef }) {
//loading state
const [loading, setLoading] = useState(true)
const onLoad = useCallback(()=>{ setLoading(false) }, [setLoading])
useEffect(()=>{ setLoading(true) }, [_id])

return (
<>
{loading && (
<Preloader className={s.preloader} />
)}

<iframe
key={_id}
ref={webViewRef}
role='article'
className={s.embed}
Expand All @@ -39,12 +45,6 @@ export default function PageMyItemTabPreview({ item: { _id }, webViewRef }) {
referrerPolicy='no-referrer'
src={`${getPreviewLink(_id)}#solid-bg=false&theme=${font_color||theme.app}&font-family=${font_family}&font-size=${font_size}`}
onLoad={onLoad} />

{loading && (
<div className={s.preloader}>
<Preloader enlarge='1.5' />
</div>
)}
</>
)
}
3 changes: 1 addition & 2 deletions src/routes/my/item/tab/preview.module.styl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
position: absolute
left: 0
right: 0
bottom: 0
top: 0
top: auto !important;
display: flex
align-items: center
justify-content: center
Expand Down
2 changes: 2 additions & 0 deletions src/target/extension/manifest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ module.exports = ({ vendor, production=false }, l) => {
// },

commands: {
_execute_action: {
},
save_page: {
suggested_key: (vendor == 'chrome' || vendor == 'safari') ? {
default: 'Ctrl+Shift+S'
Expand Down

0 comments on commit 6b277fc

Please sign in to comment.