1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Desktop: Fixed regression with Ace Editor (switching layout had bugs)

This commit is contained in:
Laurent Cozic
2020-05-07 18:08:03 +01:00
parent a04092c99c
commit 132c6543b2
2 changed files with 36 additions and 6 deletions

View File

@ -239,3 +239,16 @@ export function useScrollHandler(editor: any, webviewRef: any, onScroll: Functio
return { resetScroll, setEditorPercentScroll, setViewerPercentScroll, editor_scroll };
}
export function useRootWidth(dependencies:any) {
const { rootRef } = dependencies;
const [rootWidth, setRootWidth] = useState(0);
useEffect(() => {
if (!rootRef.current) return;
setRootWidth(rootRef.current.offsetWidth);
});
return rootWidth;
}