mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #15795 from overleaf/td-ide-page-prevent-collapsed-panel-resize
Prevent collapsed panel resize in React IDE page GitOrigin-RevId: 3b60d924280472e4dd66f403779b937a4428b1b5
This commit is contained in:
parent
289942d1a5
commit
26fe632a22
2 changed files with 19 additions and 15 deletions
|
@ -89,20 +89,18 @@ export default function EditorAndPdf({
|
|||
</div>
|
||||
) : null}
|
||||
</HorizontalResizeHandle>
|
||||
{pdfIsOpen || resizing ? (
|
||||
<Panel
|
||||
ref={pdfPanelRef}
|
||||
id="pdf"
|
||||
order={2}
|
||||
defaultSize={50}
|
||||
minSize={5}
|
||||
collapsible
|
||||
onCollapse={collapsed => setPdfIsOpen(!collapsed)}
|
||||
className="ide-react-panel"
|
||||
>
|
||||
<PdfPreview />
|
||||
</Panel>
|
||||
) : null}
|
||||
<Panel
|
||||
ref={pdfPanelRef}
|
||||
id="pdf"
|
||||
order={2}
|
||||
defaultSize={50}
|
||||
minSize={5}
|
||||
collapsible
|
||||
onCollapse={collapsed => setPdfIsOpen(!collapsed)}
|
||||
className="ide-react-panel"
|
||||
>
|
||||
{pdfIsOpen || resizing ? <PdfPreview /> : null}
|
||||
</Panel>
|
||||
</PanelGroup>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -15,6 +15,12 @@ export const HorizontalResizeHandle: FC<
|
|||
const { t } = useTranslation()
|
||||
const [isDragging, setIsDragging] = useState(false)
|
||||
|
||||
function handleDragging(isDraggingParam: boolean) {
|
||||
if (isDragging || resizable) {
|
||||
setIsDragging(isDraggingParam)
|
||||
}
|
||||
}
|
||||
|
||||
// Only call onDragging prop when the pointer moves after starting a drag
|
||||
useEffect(() => {
|
||||
if (isDragging) {
|
||||
|
@ -35,7 +41,7 @@ export const HorizontalResizeHandle: FC<
|
|||
<PanelResizeHandle
|
||||
disabled={!resizable && !isDragging}
|
||||
{...props}
|
||||
onDragging={setIsDragging}
|
||||
onDragging={handleDragging}
|
||||
>
|
||||
<div
|
||||
className={classNames('horizontal-resize-handle', {
|
||||
|
|
Loading…
Reference in a new issue