Skip to content

Commit

Permalink
feat: 新增「剪贴板 > 内容设置 > 显示原内容」配置项 (#977)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyz-git authored Feb 26, 2025
1 parent 73b7d48 commit 98fbbbf
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 12 deletions.
6 changes: 4 additions & 2 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
},
"auto_favorite": "Auto Favorite",
"delete_confirm": "Delete Confirmation",
"auto_sort": "Auto Sort"
"auto_sort": "Auto Sort",
"show_original_content": "Show Original Content"
},
"hints": {
"auto_paste": "Quickly paste content to the input field when using the left mouse button",
Expand All @@ -79,7 +80,8 @@
"operation_button": "Customize icon buttons to operate on clipboard content",
"auto_favorite": "Auto-favorite after adding or editing a note",
"delete_confirm": "Pop-up confirmation dialog when deleting clipboard contents",
"auto_sort": "Alignment to the top when copying existing content"
"auto_sort": "Alignment to the top when copying existing content",
"show_original_content": "Whether to display the original content on mouse hover after adding a note"
}
}
},
Expand Down
6 changes: 4 additions & 2 deletions src/locales/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
},
"auto_favorite": "自動コレクション",
"delete_confirm": "削除確認",
"auto_sort": "自動整列"
"auto_sort": "自動整列",
"show_original_content": "元の内容を表示します"
},
"hints": {
"auto_paste": "左クリック時に、内容を素早く入力フィールドに貼り付けます",
Expand All @@ -79,7 +80,8 @@
"operation_button": "クリップボード内容を操作するためのアイコンボタンをカスタマイズします",
"auto_favorite": "メモの追加・編集後に自動お気に入り登録",
"delete_confirm": "クリップボードの内容を削除する際に確認ダイアログを表示する",
"auto_sort": "既存の内容をコピーして最前面に配置する"
"auto_sort": "既存の内容をコピーして最前面に配置する",
"show_original_content": "メモを追加した後、マウスをホバーしたときに元のコンテンツを表示するかどうか"
}
}
},
Expand Down
6 changes: 4 additions & 2 deletions src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
},
"auto_favorite": "自动收藏",
"delete_confirm": "删除确认",
"auto_sort": "自动排序"
"auto_sort": "自动排序",
"show_original_content": "显示原内容"
},
"hints": {
"auto_paste": "鼠标左键操作时,快速粘贴内容至输入位置",
Expand All @@ -79,7 +80,8 @@
"operation_button": "自定义操作剪贴板内容的图标按钮",
"auto_favorite": "新增或编辑备注后自动收藏",
"delete_confirm": "删除剪贴板内容时弹出确认对话框",
"auto_sort": "复制已存在的内容时排列到最前面"
"auto_sort": "复制已存在的内容时排列到最前面",
"show_original_content": "添加备注后,鼠标悬停时是否显示原内容"
}
}
},
Expand Down
6 changes: 4 additions & 2 deletions src/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
},
"auto_favorite": "自動收藏",
"delete_confirm": "删除確認",
"auto_sort": "自動排序"
"auto_sort": "自動排序",
"show_original_content": "顯示原內容"
},
"hints": {
"auto_paste": "當使用滑鼠左鍵時,快速將內容貼上到輸入位置",
Expand All @@ -79,7 +80,8 @@
"operation_button": "自定義操作剪貼簿內容的圖示按鈕",
"auto_favorite": "新增或編輯備註後自動收藏",
"delete_confirm": "删除剪貼板內容時彈出確認對話方塊",
"auto_sort": "複製已存在的內容時排列到最前面"
"auto_sort": "複製已存在的內容時排列到最前面",
"show_original_content": "添加備註後,滑鼠懸停時是否顯示原內容"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,11 @@ const Item: FC<ItemProps> = (props) => {
<div className="relative flex-1 select-auto overflow-hidden break-words children:transition">
<div
className={clsx(
"pointer-events-none absolute inset-0 line-clamp-4 opacity-100 group-hover:opacity-0",
{ "opacity-0!": !note },
"pointer-events-none absolute inset-0 line-clamp-4 opacity-0",
{
"opacity-100": note,
"group-hover:opacity-0": content.showOriginalContent,
},
)}
>
<Icon
Expand All @@ -355,8 +358,9 @@ const Item: FC<ItemProps> = (props) => {
</div>

<div
className={clsx("h-full opacity-0 group-hover:opacity-100", {
"opacity-100!": !note,
className={clsx("h-full", {
"opacity-0": note,
"group-hover:opacity-100": content.showOriginalContent,
})}
>
{renderContent()}
Expand Down
13 changes: 13 additions & 0 deletions src/pages/Clipboard/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,19 @@ const ClipboardSettings = () => {
clipboardStore.content.autoSort = value;
}}
/>

<ProSwitch
title={t(
"preference.clipboard.content_settings.label.show_original_content",
)}
description={t(
"preference.clipboard.content_settings.hints.show_original_content",
)}
value={content.showOriginalContent}
onChange={(value) => {
clipboardStore.content.showOriginalContent = value;
}}
/>
</ProList>
</>
);
Expand Down
1 change: 1 addition & 0 deletions src/stores/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const clipboardStore = proxy<ClipboardStore>({
autoFavorite: false,
deleteConfirm: true,
autoSort: false,
showOriginalContent: false,
},

history: {
Expand Down
1 change: 1 addition & 0 deletions src/types/store.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export interface ClipboardStore {
autoFavorite: boolean;
deleteConfirm: boolean;
autoSort: boolean;
showOriginalContent: boolean;
};

// 历史记录
Expand Down

0 comments on commit 98fbbbf

Please sign in to comment.