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.
TypeScript clipboardclipboard-managerdesktop-appdrag-and-dropelectronopen-sourceproductivityproductivity-toolwindows
fix(clipboard): eliminate empty gap on item deletion
Deepender25d04312755711
diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsxindex e38c8b3..26524a3 100644--- a/src/components/ClipboardItem.tsx+++ b/src/components/ClipboardItem.tsx@@ -125,8 +125,20 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {ref={ref}layout="position"initial={open ? { opacity: 0, scale: 0.96, y: 6 } : false}- animate={{ opacity: 1, scale: 1, y: 0 }}- exit={{ opacity: 0, scale: 0.95, y: -4, transition: { duration: 0.12, ease: [0.32, 0, 0.67, 0] } }}+ animate={{ opacity: 1, scale: 1, y: 0, height: 'auto', marginBottom: undefined }}+ exit={{+ opacity: 0,+ height: 0,+ marginBottom: 0,+ scale: 0.95,+ y: -4,+ transition: {+ opacity: { duration: 0.12, ease: [0.32, 0, 0.67, 0] },+ height: { duration: 0.18, ease: [0.16, 1, 0.3, 1] },+ marginBottom: { duration: 0.18, ease: [0.16, 1, 0.3, 1] },+ scale: { duration: 0.14, ease: [0.32, 0, 0.67, 0] }+ }+ }}transition={{layout: { duration: 0.22, ease: [0.16, 1, 0.3, 1] },type: 'spring',diff --git a/src/components/ItemList.tsx b/src/components/ItemList.tsxindex eae7d01..4bc671f 100644--- a/src/components/ItemList.tsx+++ b/src/components/ItemList.tsx@@ -98,13 +98,12 @@ export function ItemList() {}, [open, topRecentId, topRecentTime, topPinnedTime])useLayoutEffect(() => {- // If recent or pinned items changed/updated while panel is open, instantly jump to top without animation+ // If a brand new or freshly updated item was added while panel is open, jump to topif (open) {- const idChanged = topRecentId !== prevTopRecentId.current- const recentTimeChanged = topRecentTime !== prevTopRecentTime.current- const pinnedTimeChanged = topPinnedTime !== prevTopPinnedTime.current+ const isNewRecent = !!topRecentTime && (!prevTopRecentTime.current || topRecentTime > prevTopRecentTime.current)+ const isNewPinned = !!topPinnedTime && (!prevTopPinnedTime.current || topPinnedTime > prevTopPinnedTime.current)- if (idChanged || recentTimeChanged || pinnedTimeChanged) {+ if (isNewRecent || isNewPinned) {if (listRef.current) {listRef.current.scrollTop = 0}diff --git a/src/store/appStore.ts b/src/store/appStore.tsindex 977dd29..2297108 100644--- a/src/store/appStore.ts+++ b/src/store/appStore.ts@@ -237,6 +237,12 @@ export const useStore = create<AppState>((set, get) => ({setItems: (items) => {const prevItems = get().items+ if (+ prevItems.length === items.length &&+ prevItems.every((it, i) => it.id === items[i]?.id && it.pinned === items[i]?.pinned && it.hitCount === items[i]?.hitCount && it.capturedAt === items[i]?.capturedAt)+ ) {+ return+ }const prevTop = prevItems.length > 0 ? prevItems[0] : nullconst newTop = items.length > 0 ? items[0] : null@@ -333,7 +339,10 @@ export const useStore = create<AppState>((set, get) => ({set({ items: previousItems.filter((it) => it.id !== id) })try {const items = await edge.deleteItem(id)- set({ items })+ const current = get().items+ if (items.length !== current.length || items.some((it, i) => it.id !== current[i]?.id)) {+ set({ items })+ }} catch {// Do not leave the UI claiming an item was deleted when the main-process// persistence request failed (for example during a renderer reload).@@ -348,7 +357,10 @@ export const useStore = create<AppState>((set, get) => ({set({ items: previousItems.filter((it) => it.pinned) })try {const items = await edge.clearItems()- set({ items })+ const current = get().items+ if (items.length !== current.length || items.some((it, i) => it.id !== current[i]?.id)) {+ set({ items })+ }} catch {set({ items: previousItems })get().pushToast({ id: `clear-${Date.now()}`, message: 'Could not clear history. Please try again.', tone: 'error' })@@ -359,7 +371,10 @@ export const useStore = create<AppState>((set, get) => ({set({ items: previousItems.filter((it) => !idSet.has(it.id)) })try {const items = await edge.deleteBatchItems(ids)- set({ items })+ const current = get().items+ if (items.length !== current.length || items.some((it, i) => it.id !== current[i]?.id)) {+ set({ items })+ }} catch {set({ items: previousItems })get().pushToast({ id: `clear-${Date.now()}`, message: 'Could not clear history. Please try again.', tone: 'error' })diff --git a/src/styles/item.css b/src/styles/item.cssindex 62227e8..3af97af 100644--- a/src/styles/item.css+++ b/src/styles/item.css@@ -17,8 +17,6 @@border-color 0.16s ease,box-shadow 0.16s ease;overflow: hidden;- content-visibility: auto;- contain-intrinsic-size: 0 80px;}.item:hover {