Skip to content

Commit

Permalink
feat: add copy title to context menu of feed entry (#801)
Browse files Browse the repository at this point in the history
Co-authored-by: cesaryuan <cesaryuan@users.noreply.github.com>
  • Loading branch information
cesaryuan and cesaryuan authored Oct 8, 2024
1 parent be581f6 commit 1f57ab2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/renderer/src/constants/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export const shortcuts = {
name: "keys.entry.copyLink",
key: "Shift+Meta+C",
},
copyTitle: {
name: "keys.entry.copyTitle",
key: "Shift+Meta+B",
},
tip: {
name: "keys.entry.tip",
key: "Shift+Meta+T",
Expand Down
14 changes: 14 additions & 0 deletions apps/renderer/src/hooks/biz/useEntryActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,20 @@ export const useEntryActions = ({
})
},
},
{
key: "copyTitle",
name: t("entry_actions.copy_title"),
className: "i-mgc-link-cute-re",
hide: !populatedEntry.entries.title,
shortcut: shortcuts.entry.copyTitle.key,
onClick: () => {
if (!populatedEntry.entries.title) return
navigator.clipboard.writeText(populatedEntry.entries.title)
toast(t("entry_actions.title_copied"), {
duration: 1000,
})
},
},
{
key: "openInBrowser",
name: t("entry_actions.open_in_browser", {
Expand Down
2 changes: 2 additions & 0 deletions locales/app/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"discover.target.lists": "Lists",
"early_access": "Early Access",
"entry_actions.copy_link": "Copy link",
"entry_actions.copy_title": "Copy title",
"entry_actions.failed_to_save_to_eagle": "Failed to save to Eagle.",
"entry_actions.failed_to_save_to_instapaper": "Failed to save to Instapaper.",
"entry_actions.failed_to_save_to_readwise": "Failed to save to Readwise.",
Expand All @@ -70,6 +71,7 @@
"entry_actions.star": "Star",
"entry_actions.starred": "Starred.",
"entry_actions.tip": "Tip",
"entry_actions.title_copied": "Title copied to clipboard.",
"entry_actions.unstar": "Unstar",
"entry_actions.unstarred": "Unstarred.",
"entry_actions.view_source_content": "View source content",
Expand Down
2 changes: 2 additions & 0 deletions locales/app/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"discover.target.lists": "列表",
"early_access": "预览版本",
"entry_actions.copy_link": "复制链接",
"entry_actions.copy_title": "复制标题",
"entry_actions.failed_to_save_to_eagle": "保存到 Eagle 失败",
"entry_actions.failed_to_save_to_instapaper": "保存到 Instapaper 失败",
"entry_actions.failed_to_save_to_readwise": "保存到 Readwise 失败",
Expand All @@ -70,6 +71,7 @@
"entry_actions.star": "收藏",
"entry_actions.starred": "已收藏",
"entry_actions.tip": "打赏",
"entry_actions.title_copied": "标题已复制到剪贴板",
"entry_actions.unstar": "取消收藏",
"entry_actions.unstarred": "取消收藏",
"entry_actions.view_source_content": "查看原文",
Expand Down

0 comments on commit 1f57ab2

Please sign in to comment.