Doceditor: update calculate height for aside and backdrop

This commit is contained in:
Timofey Boyko 2024-04-18 14:03:01 +03:00
parent b6079b38f2
commit dd321b125a
2 changed files with 6 additions and 9 deletions

View File

@ -78,13 +78,10 @@ const useRootInit = ({ documentType }: UseRootInitProps) => {
React.useEffect(() => { React.useEffect(() => {
// need for separate window in desktop editors // need for separate window in desktop editors
if (window.AscDesktopEditor) { if (window.AscDesktopEditor) {
const viewPort = window.AscDesktopEditor.getViewportSettings?.(); window.AscDesktopEditor.attachEvent?.(
"onViewportSettingsChanged",
if (!viewPort || !viewPort?.isEditor) return; calculateAsideHeight,
);
window.AscDesktopEditor.onViewportSettingsChanged = () => {
calculateAsideHeight();
};
} }
}, []); }, []);
}; };

View File

@ -228,7 +228,7 @@ export const calculateAsideHeight = () => {
if (!viewPort) return; if (!viewPort) return;
if (viewPort.isEditor && viewPort.isSeparateWindow) { if (viewPort.widgetType === "window") {
const { captionHeight } = viewPort; const { captionHeight } = viewPort;
const backdrop = document.getElementsByClassName( const backdrop = document.getElementsByClassName(
"backdrop-active", "backdrop-active",
@ -238,7 +238,7 @@ export const calculateAsideHeight = () => {
if (aside && backdrop) { if (aside && backdrop) {
backdrop.style.height = backdrop.style.height =
aside.style.height = `calc(100dvh - ${captionHeight}px`; aside.style.height = `calc(100dvh - ${captionHeight}px`;
aside.style.top = `${captionHeight}px`; backdrop.style.marginTop = aside.style.top = `${captionHeight}px`;
} }
} }
}; };