fix(ai-toolbar): honor AI state in shortcuts and clipboard dedup
This commit is contained in:
@@ -310,6 +310,8 @@ export const AIToolbar = ({
|
||||
if (
|
||||
e.key === "Enter" &&
|
||||
(e.metaKey || e.ctrlKey) &&
|
||||
!aiLoading &&
|
||||
canUseAi &&
|
||||
(aiPrompt.trim() || hasImages)
|
||||
) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -8,14 +8,15 @@
|
||||
|
||||
/**
|
||||
* Returns a stable deduplication key for a File.
|
||||
* Key = `name:size` — cheap, deterministic, and catches re-selections of the
|
||||
* exact same file (same name *and* same byte count).
|
||||
* Key = `name:size:lastModified` — cheap, deterministic, and catches
|
||||
* re-selections of the exact same file while keeping clipboard fallback files
|
||||
* distinct when they share a generated name and byte size.
|
||||
*
|
||||
* Two different files that happen to share a name but have different content
|
||||
* will have different sizes and therefore different keys.
|
||||
* Two different files that happen to share a generated fallback name but have
|
||||
* different timestamps will not collapse to the same key.
|
||||
*/
|
||||
export function imageFileKey(file: File): string {
|
||||
return `${file.name}:${file.size}`;
|
||||
return `${file.name}:${file.size}:${file.lastModified}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user