mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-28 21:53:25 -05:00
Upgrade react-resizable-panels (#16321)
GitOrigin-RevId: 524257c441fc98ffc0e3da6f1e703ebdfbfbffb7
This commit is contained in:
parent
6c73a1d38a
commit
e7dfd14986
4 changed files with 15 additions and 29 deletions
16
package-lock.json
generated
16
package-lock.json
generated
|
@ -36995,9 +36995,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-resizable-panels": {
|
"node_modules/react-resizable-panels": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-1.0.3.tgz",
|
||||||
"integrity": "sha512-bFKrVLO6VCDp9+zXvLybB3Ldd7MF+Q6E+qE6sxlDfVAlIwEWksJ94CD5RNXTN9a0E3YyAZUkhJEw3a9aCgymzA==",
|
"integrity": "sha512-d54mBF/T6S51ZAU7s8SjLMa9hnLIhBHi35GJkdzC+gsEOpm8IEQ5odJid1AWi8neGfGm2HDANGo8Ndc6C8ISdw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.14.0 || ^17.0.0 || ^18.0.0",
|
"react": "^16.14.0 || ^17.0.0 || ^18.0.0",
|
||||||
|
@ -46697,7 +46697,7 @@
|
||||||
"react-i18next": "^13.3.1",
|
"react-i18next": "^13.3.1",
|
||||||
"react-linkify": "^1.0.0-alpha",
|
"react-linkify": "^1.0.0-alpha",
|
||||||
"react-refresh": "^0.14.0",
|
"react-refresh": "^0.14.0",
|
||||||
"react-resizable-panels": "^1.0.1",
|
"react-resizable-panels": "^1.0.3",
|
||||||
"react2angular": "^4.0.6",
|
"react2angular": "^4.0.6",
|
||||||
"react2angular-shared-context": "^1.1.0",
|
"react2angular-shared-context": "^1.1.0",
|
||||||
"requirejs": "^2.3.6",
|
"requirejs": "^2.3.6",
|
||||||
|
@ -55494,7 +55494,7 @@
|
||||||
"react-i18next": "^13.3.1",
|
"react-i18next": "^13.3.1",
|
||||||
"react-linkify": "^1.0.0-alpha",
|
"react-linkify": "^1.0.0-alpha",
|
||||||
"react-refresh": "^0.14.0",
|
"react-refresh": "^0.14.0",
|
||||||
"react-resizable-panels": "^1.0.1",
|
"react-resizable-panels": "^1.0.3",
|
||||||
"react2angular": "^4.0.6",
|
"react2angular": "^4.0.6",
|
||||||
"react2angular-shared-context": "^1.1.0",
|
"react2angular-shared-context": "^1.1.0",
|
||||||
"recurly": "^4.0.0",
|
"recurly": "^4.0.0",
|
||||||
|
@ -78807,9 +78807,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-resizable-panels": {
|
"react-resizable-panels": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-1.0.3.tgz",
|
||||||
"integrity": "sha512-bFKrVLO6VCDp9+zXvLybB3Ldd7MF+Q6E+qE6sxlDfVAlIwEWksJ94CD5RNXTN9a0E3YyAZUkhJEw3a9aCgymzA==",
|
"integrity": "sha512-d54mBF/T6S51ZAU7s8SjLMa9hnLIhBHi35GJkdzC+gsEOpm8IEQ5odJid1AWi8neGfGm2HDANGo8Ndc6C8ISdw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {}
|
"requires": {}
|
||||||
},
|
},
|
||||||
|
|
|
@ -65,7 +65,7 @@ export const MainLayout: FC = () => {
|
||||||
id="panel-sidebar"
|
id="panel-sidebar"
|
||||||
order={1}
|
order={1}
|
||||||
defaultSize={10}
|
defaultSize={10}
|
||||||
minSize={10}
|
minSize={5}
|
||||||
maxSize={30}
|
maxSize={30}
|
||||||
collapsible
|
collapsible
|
||||||
onCollapse={handleSidebarCollapse}
|
onCollapse={handleSidebarCollapse}
|
||||||
|
@ -114,7 +114,7 @@ export const MainLayout: FC = () => {
|
||||||
id="panel-chat"
|
id="panel-chat"
|
||||||
order={2}
|
order={2}
|
||||||
defaultSize={20}
|
defaultSize={20}
|
||||||
minSize={10}
|
minSize={5}
|
||||||
maxSize={30}
|
maxSize={30}
|
||||||
collapsible
|
collapsible
|
||||||
onCollapse={handleChatCollapse}
|
onCollapse={handleChatCollapse}
|
||||||
|
|
|
@ -5,29 +5,15 @@ export default function useCollapsiblePanel(
|
||||||
panelIsOpen: boolean,
|
panelIsOpen: boolean,
|
||||||
panelRef: RefObject<ImperativePanelHandle>
|
panelRef: RefObject<ImperativePanelHandle>
|
||||||
) {
|
) {
|
||||||
// store the expanded height in localStorage when collapsing,
|
// collapse the panel when it is toggled closed (including on initial layout)
|
||||||
// so it can be restored when expanding after reloading the page
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const panelHandle = panelRef.current
|
const panelHandle = panelRef.current
|
||||||
|
|
||||||
if (panelHandle) {
|
if (panelHandle) {
|
||||||
const storageKey = `ide-panel.expanded-size.${panelHandle.getId()}`
|
if (panelIsOpen) {
|
||||||
if (!panelIsOpen) {
|
panelHandle.expand()
|
||||||
// collapsing, so store the current size if > 0
|
|
||||||
const size = panelHandle.getSize()
|
|
||||||
if (size > 0) {
|
|
||||||
localStorage.setItem(storageKey, String(size))
|
|
||||||
}
|
|
||||||
|
|
||||||
panelHandle.collapse()
|
|
||||||
} else {
|
} else {
|
||||||
const storedKey = localStorage.getItem(storageKey)
|
panelHandle.collapse()
|
||||||
|
|
||||||
if (storedKey) {
|
|
||||||
panelHandle.resize(Number(storedKey))
|
|
||||||
} else {
|
|
||||||
panelHandle.expand()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [panelIsOpen, panelRef])
|
}, [panelIsOpen, panelRef])
|
||||||
|
|
|
@ -332,7 +332,7 @@
|
||||||
"react-i18next": "^13.3.1",
|
"react-i18next": "^13.3.1",
|
||||||
"react-linkify": "^1.0.0-alpha",
|
"react-linkify": "^1.0.0-alpha",
|
||||||
"react-refresh": "^0.14.0",
|
"react-refresh": "^0.14.0",
|
||||||
"react-resizable-panels": "^1.0.1",
|
"react-resizable-panels": "^1.0.3",
|
||||||
"react2angular": "^4.0.6",
|
"react2angular": "^4.0.6",
|
||||||
"react2angular-shared-context": "^1.1.0",
|
"react2angular-shared-context": "^1.1.0",
|
||||||
"requirejs": "^2.3.6",
|
"requirejs": "^2.3.6",
|
||||||
|
|
Loading…
Reference in a new issue