feat: persist maximize state so Restore button shows after reopen
This commit is contained in:
1 parent
a6d02322f3
commit
f885be7266
2 files changed
+23
-6
No files matched your search
+13
-1
@@ -167,6 +167,17 @@ function Plugin () {
|
||||
return function () { off() }
|
||||
}, [])
|
||||
|
||||
// Main tells UI the restored placement was maximized → show the Restore button.
|
||||
useEffect(function () {
|
||||
const off = on('SET_MAXIMIZED', function (payload: { maximized: boolean }) {
|
||||
if (payload.maximized) {
|
||||
maximizedRef.current = true
|
||||
setIsMaxToggled(true)
|
||||
}
|
||||
})
|
||||
return function () { off() }
|
||||
}, [])
|
||||
|
||||
// Request fresh window data from main (after any action / on start).
|
||||
// Pass the REAL iframe size (window.innerWidth/innerHeight) — what Figma actually
|
||||
// rendered, not the requested lastSize. Otherwise gaps would be tautological.
|
||||
@@ -217,7 +228,8 @@ function Plugin () {
|
||||
})
|
||||
// Maximize is NOT a held dock — persist the exact size+position so re-open
|
||||
// restores it (overrides the edge-dock save done by DOCK_REFINE above).
|
||||
emit('SAVE_FREE')
|
||||
// 'maximized: true' so the Restore button shows on next open.
|
||||
emit('SAVE_FREE', { maximized: true })
|
||||
refreshInfo()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user