Skip to content

Commit

Permalink
- Open action popup when clipper mode and auto save is enabled on pre…
Browse files Browse the repository at this point in the history
…ss keyboard shortcut

- Rename "Remove" to "Delete"
- Show more clear message "Saved" for new
  • Loading branch information
exentrich committed Sep 5, 2024
1 parent 872d769 commit e8382da
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 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.54",
"version": "5.6.55",
"description": "All-in-one bookmark manager",
"author": "Rustem Mussabekov",
"license": "MIT",
Expand Down
12 changes: 6 additions & 6 deletions src/assets/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"saveSuccess": "Saved successfully!",
"saved": "Saved",
"addSuccess": "Added",
"removeSuccess": "Item removed!",
"removeSuccess": "Item deleted!",
"coverUpload": "Upload cover",
"fileUploadUnable": "File cannot be uploaded!",
"fileUploadError": "Upload error. try again!",
"profile": "Profile",
"signIn": "Sign in",
"myCollections": "My Collections",
"save": "Save",
"remove": "Remove",
"remove": "Delete",
"about": "About",
"blog": "Blog",
"signInSocial": "Sign in with",
Expand All @@ -42,7 +42,7 @@
"videos": "Video",
"links": "Links",
"bookmarksRemoved": "Bookmarks moved to trash",
"bookmarksRemovedPermament": "Bookmarks removed",
"bookmarksRemovedPermament": "Bookmarks deleted",
"other": "other",
"yourName": "Your name",
"changePassword": "Change password",
Expand Down Expand Up @@ -89,7 +89,7 @@
"sites": "Sites",
"in": "in",
"settings": "Settings",
"removeCollectionSuccess": "Collection removed",
"removeCollectionSuccess": "Collection deleted",
"changeIcon": "Change icon",
"change": "Change",
"group": "Group",
Expand Down Expand Up @@ -187,7 +187,7 @@
"price": "Price",
"features": "Features",
"free": "Free",
"removeAccount": "Remove account",
"removeAccount": "Delete account",
"areYouSure": "Are you sure?",
"comparePlans": "Compare plans",
"changeAvatar": "Change avatar",
Expand Down Expand Up @@ -275,7 +275,7 @@
"mode": "Mode",
"ignore": "Ignore",
"startFromScratch": "Start from scratch",
"startFromScratchD": "All existing bookmarks and collections will be removed and replaced with new one",
"startFromScratchD": "All existing bookmarks and collections will be deleted and replaced with new one",
"usedSpace": "Used space",
"usedThisMonth": "Used this month",
"forUploads": "for uploads",
Expand Down
2 changes: 1 addition & 1 deletion src/co/bookmarks/edit/form/action/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function BookmarkEditFormActionMain({ status, onRemove }) {
return (
<ButtonsGroup>
<Button
variant='link'
variant='flat'
accent='danger'
onClick={onRemove}>
{t.s('remove')}
Expand Down
9 changes: 8 additions & 1 deletion src/routes/extension/clipper/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import t from '~t'
import config from '~config'
import { connect } from 'react-redux'
import { getDraftStatus, getDraftItem } from '~data/selectors/bookmarks'
import isThisMinute from 'date-fns/isThisMinute'
import parseISO from 'date-fns/parseISO'

import LogoIcon from '~assets/brand/icon_raw.svg?component'
import Header, { Space, Title } from '~co/common/header'
Expand All @@ -19,7 +21,12 @@ function ClipperHeader({ status, item }) {
case 'idle': title = ''; break
case 'loading': title = ''; break
case 'removed': title = t.s('removeSuccess'); break
default: title = t.s('edit'); break
default: {
let isNowSaved = false;
try { isNowSaved = isThisMinute(parseISO(item.created), new Date()) } catch(e){console.log(e)}
title = isNowSaved ? t.s('saved') : t.s('edit')
}
break
}

const collectionPath = `/my/${status=='new' ? 0 : item.collectionId}`
Expand Down
11 changes: 11 additions & 0 deletions src/target/extension/background/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import config from '~config'
import { currentTab } from '~target'
import { open } from './popup'
import { addCurrentTabSelection } from './highlights'
import Api from '~data/modules/api'

function getSelectedText() {
var s = window.getSelection();
Expand All @@ -23,6 +24,16 @@ async function onCommand(command, tab) {
if (res?.result)
return addCurrentTabSelection()

let openAction = false
try {
const {user:{config}} = (await Api._get('user'))
openAction = config.browser_extension_mode == 'clipper' && config.add_auto_save == true
}
catch(e) { console.error(e) }

if (openAction)
return browser.action.openPopup()

return open(`/add?link=${encodeURIComponent(url)}`)
}

Expand Down

0 comments on commit e8382da

Please sign in to comment.