mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-02-10 18:05:32 +08:00
fix: focus and delay of popover resize on exit
This commit is contained in:
@ -779,18 +779,6 @@
|
||||
.view {
|
||||
height: 128px !important;
|
||||
}
|
||||
|
||||
.item-input.item-content {
|
||||
padding-bottom: 15px !important;
|
||||
}
|
||||
|
||||
.item-input-with-value::after {
|
||||
bottom: 15px !important;
|
||||
}
|
||||
|
||||
.list .item-inner {
|
||||
padding-top: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.list .item-link.size-label {
|
||||
|
||||
@ -206,7 +206,6 @@ const PageCustomFontSize = (props) => {
|
||||
const displaySize = props.initialValue ?? 0;
|
||||
const [value, setValue] = useState(String(displaySize));
|
||||
|
||||
|
||||
const valueRef = useRef(value);
|
||||
useEffect(() => { valueRef.current = value; }, [value]);
|
||||
|
||||
@ -216,17 +215,21 @@ const PageCustomFontSize = (props) => {
|
||||
props.applyFontSize(size);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const toggleCustomClass = (on) => {
|
||||
const modalId = Device.phone ? '#edit-sheet' : '#edit-popover';
|
||||
const modalEl = document.querySelector(modalId);
|
||||
if (!modalEl) return;
|
||||
modalEl.classList.toggle('edit-custom-font-size', on);
|
||||
};
|
||||
|
||||
modalEl.classList.add('edit-custom-font-size');
|
||||
return () => modalEl.classList.remove('edit-custom-font-size');
|
||||
}, []);
|
||||
const focusInput = () => {
|
||||
const el = document.querySelector('.page-custom-font-size input');
|
||||
if (!el) return;
|
||||
el.focus();
|
||||
};
|
||||
|
||||
return (
|
||||
<Page className="page-custom-font-size" onPageBeforeOut={() => apply(valueRef.current)}>
|
||||
<Page className="page-custom-font-size" onPageBeforeIn={() => toggleCustomClass(true)} onPageAfterIn={focusInput} onPageBeforeOut={() => { toggleCustomClass(false); apply(valueRef.current);}}>
|
||||
<Navbar title={t('Edit.txtCustom')} backLink="Back">
|
||||
{Device.phone &&
|
||||
<NavRight>
|
||||
|
||||
Reference in New Issue
Block a user