Skip to content

Edge-Drop is a clipboard shelf on the edge of your screen. Hover to open it. Drag files and images into any app, click to copy text and links. Free and open-source for Windows.

perf(ui): optimize large text rendering, IPC payload size, and CSS containment for locked 60fps animations

Deepender25cc954725b237
diff --git a/electron/store/ItemStore.ts b/electron/store/ItemStore.ts
index 291c04b..30ac263 100644
--- a/electron/store/ItemStore.ts
+++ b/electron/store/ItemStore.ts
@@ -194,6 +194,9 @@ export class ItemStore {
* Returns true if the list actually changed (so callers can decide to push).
*/
add(data: ItemData, limit: number): boolean {
+ if (data.kind === 'text' && data.text.length > 500000) {
+ data = { ...data, text: data.text.slice(0, 500000) }
+ }
const sig = signature(data)
const existingId = this.sigToId.get(sig)
const now = Date.now()
diff --git a/src/lib/format.ts b/src/lib/format.ts
index c9f79e6..52e989e 100644
--- a/src/lib/format.ts
+++ b/src/lib/format.ts
@@ -5,7 +5,9 @@ import { t, getResolvedLanguage } from '../i18n'
/** Truncate long text for list previews. */
export function previewText(text: string, max = 160): string {
- const single = text.replace(/\s+/g, ' ').trim()
+ if (!text) return ''
+ const head = text.length > max * 4 ? text.slice(0, max * 4) : text
+ const single = head.replace(/\s+/g, ' ').trim()
if (single.length <= max) return single
return single.slice(0, max - 1) + '…'
}
diff --git a/src/styles/item.css b/src/styles/item.css
index baf4887..56cc4ea 100644
--- a/src/styles/item.css
+++ b/src/styles/item.css
@@ -17,6 +17,8 @@
border-color 0.16s ease,
box-shadow 0.16s ease;
overflow: hidden;
+ content-visibility: auto;
+ contain-intrinsic-size: 0 80px;
}
.item:hover {