persist max block size setting in LayoutPanel component (#134)

https://github.com/readest/readest/issues/131
This commit is contained in:
Egan Gumiwang Pratama Bisma 2025-01-09 18:23:11 +07:00 committed by GitHub
parent 33d4dcd740
commit 86dc32dab3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -119,6 +119,17 @@ const LayoutPanel: React.FC<{ bookKey: string }> = ({ bookKey }) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [maxInlineSize]);
useEffect(() => {
viewSettings.maxBlockSize = maxBlockSize;
setViewSettings(bookKey, viewSettings);
if (isFontLayoutSettingsGlobal) {
settings.globalViewSettings.maxBlockSize = maxBlockSize;
setSettings(settings);
}
view?.renderer.setAttribute('max-block-size', `${maxBlockSize}px`);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [maxBlockSize]);
useEffect(() => {
// global settings are not supported for writing mode
viewSettings.writingMode = writingMode;