Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 新增「剪贴板 > 内容设置 > 自动排序」配置项 #925

Merged
merged 1 commit into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"delete": "Delete"
},
"auto_favorite": "Auto Favorite",
"delete_confirm": "Delete Confirmation"
"delete_confirm": "Delete Confirmation",
"auto_sort": "Auto Sort"
},
"hints": {
"auto_paste": "Quickly paste content to the input field when using the left mouse button",
Expand All @@ -77,7 +78,8 @@
"paste_as_plain": "Rich text and HTML formatting retains only plain text content when pasting",
"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"
"delete_confirm": "Pop-up confirmation dialog when deleting clipboard contents",
"auto_sort": "Alignment to the top when copying existing content"
}
}
},
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 @@ -68,7 +68,8 @@
"delete": "削除"
},
"auto_favorite": "自動コレクション",
"delete_confirm": "削除確認"
"delete_confirm": "削除確認",
"auto_sort": "自動整列"
},
"hints": {
"auto_paste": "左クリック時に、内容を素早く入力フィールドに貼り付けます",
Expand All @@ -77,7 +78,8 @@
"paste_as_plain": "リッチテキストとHTMLの書式設定は、貼り付け時にプレーンテキストの内容だけを保持する",
"operation_button": "クリップボード内容を操作するためのアイコンボタンをカスタマイズします",
"auto_favorite": "メモの追加・編集後に自動お気に入り登録",
"delete_confirm": "クリップボードの内容を削除する際のポップアップ確認ダイアログ"
"delete_confirm": "クリップボードの内容を削除する際に確認ダイアログを表示する",
"auto_sort": "既存の内容をコピーして最前面に配置する"
}
}
},
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 @@ -68,7 +68,8 @@
"delete": "删除"
},
"auto_favorite": "自动收藏",
"delete_confirm": "删除确认"
"delete_confirm": "删除确认",
"auto_sort": "自动排序"
},
"hints": {
"auto_paste": "鼠标左键操作时,快速粘贴内容至输入位置",
Expand All @@ -77,7 +78,8 @@
"paste_as_plain": "富文本和HTML格式在粘贴时仅保留纯文本内容",
"operation_button": "自定义操作剪贴板内容的图标按钮",
"auto_favorite": "新增或编辑备注后自动收藏",
"delete_confirm": "删除剪贴板内容时弹出确认对话框"
"delete_confirm": "删除剪贴板内容时弹出确认对话框",
"auto_sort": "复制已存在的内容时排列到最前面"
}
}
},
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 @@ -68,7 +68,8 @@
"delete": "刪除"
},
"auto_favorite": "自動收藏",
"delete_confirm": "删除確認"
"delete_confirm": "删除確認",
"auto_sort": "自動排序"
},
"hints": {
"auto_paste": "當使用滑鼠左鍵時,快速將內容貼上到輸入位置",
Expand All @@ -77,7 +78,8 @@
"paste_as_plain": "富文字和HTML格式在粘貼時僅保留純文字內容",
"operation_button": "自定義操作剪貼簿內容的圖示按鈕",
"auto_favorite": "新增或編輯備註後自動收藏",
"delete_confirm": "删除剪貼板內容時彈出確認對話方塊"
"delete_confirm": "删除剪貼板內容時彈出確認對話方塊",
"auto_sort": "複製已存在的內容時排列到最前面"
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Clipboard/Panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const ClipboardPanel = () => {
const createTime = formatDate();

if (findItem) {
if (!clipboardStore.content.autoSort) return;

const { id } = findItem;

const index = findIndex(state.list, { id });
Expand Down
11 changes: 11 additions & 0 deletions src/pages/Clipboard/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ const ClipboardSettings = () => {
clipboardStore.content.deleteConfirm = value;
}}
/>

<ProSwitch
title={t("preference.clipboard.content_settings.label.auto_sort")}
description={t(
"preference.clipboard.content_settings.hints.auto_sort",
)}
value={content.autoSort}
onChange={(value) => {
clipboardStore.content.autoSort = 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 @@ -27,6 +27,7 @@ export const clipboardStore = proxy<ClipboardStore>({
operationButtons: ["copy", "star", "delete"],
autoFavorite: false,
deleteConfirm: true,
autoSort: 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 @@ -89,6 +89,7 @@ export interface ClipboardStore {
operationButtons: OperationButton[];
autoFavorite: boolean;
deleteConfirm: boolean;
autoSort: boolean;
};

// 历史记录
Expand Down
Loading