[DE mobile] Fix Bug 58759

This commit is contained in:
SergeyEzhin 2022-09-02 15:16:02 +03:00
parent ec48177e38
commit 5505fb3f47
4 changed files with 16 additions and 18 deletions

View file

@ -168,7 +168,6 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
onEditDocument={onEditDocument}
isDisconnected={isDisconnected}
isViewer={isViewer}
// turnOffViewerMode={turnOffViewerMode}
turnOnViewerMode={turnOnViewerMode}
isMobileView={isMobileView}
changeMobileView={changeMobileView}

View file

@ -82,19 +82,15 @@ const Settings = props => {
}, 0);
};
const onChangeMobileView = async () => {
const onChangeMobileView = () => {
const api = Common.EditorApi.get();
const appOptions = props.storeAppOptions;
const isMobileView = appOptions.isMobileView;
await LocalStorage.setBool('mobile-view', !isMobileView);
await appOptions.changeMobileView();
await api.ChangeReaderMode();
if(Device.phone) {
await closeModal();
}
}
LocalStorage.setBool('mobile-view', !isMobileView);
appOptions.changeMobileView();
api.ChangeReaderMode();
};
return <SettingsView usePopover={!Device.phone}
openOptions={props.openOptions}

View file

@ -46,12 +46,14 @@ const ToolbarView = props => {
onUndoClick: props.onUndo,
onRedoClick: props.onRedo
})}
{(isViewer || !Device.phone) && isAvailableExt && <Link className={props.disabledControls ? 'disabled' : ''} icon={isMobileView ? 'icon-standard-view' : 'icon-mobile-view'} href={false} onClick={() => {
props.changeMobileView();
props.openOptions('snackbar');
{(isViewer || !Device.phone) && isAvailableExt && <Link className={props.disabledControls ? 'disabled' : ''} icon={isMobileView ? 'icon-standard-view' : 'icon-mobile-view'} href={false} onClick={async e => {
e.target.closest('.link').classList.add('disabled');
await props.changeMobileView();
await props.openOptions('snackbar');
setTimeout(() => {
props.closeOptions('snackbar');
}, 500);
e.target.closest('.link').classList.remove('disabled');
}, 1500);
}}></Link>}
{(props.showEditDocument && !isViewer) &&
<Link className={props.disabledControls ? 'disabled' : ''} icon='icon-edit' href={false} onClick={props.onEditDocument}></Link>

View file

@ -163,12 +163,13 @@ const SettingsList = inject("storeAppOptions", "storeReview")(observer(props =>
{!isViewer && Device.phone &&
<ListItem title={t('Settings.textMobileView')}>
<Icon slot="media" icon="icon-mobile-view"></Icon>
<Toggle checked={isMobileView} onToggleChange={() => {
props.onChangeMobileView();
props.openOptions('snackbar');
<Toggle checked={isMobileView} onToggleChange={async () => {
await props.onChangeMobileView();
await closeModal();
await props.openOptions('snackbar');
setTimeout(() => {
props.closeOptions('snackbar');
}, 1000);
}, 1500);
}} />
</ListItem>
}