[SSE mobile] Correct Encoding

This commit is contained in:
SergeyEzhin 2021-07-20 18:09:39 +03:00
parent 1b5397d222
commit 5a30ae5cc9
6 changed files with 17 additions and 13 deletions

View file

@ -25,7 +25,7 @@ export class storeEncoding {
}
type;
mode;
mode = 1;
pages = [];
pagesName = [];
advOptions;

View file

@ -55,12 +55,14 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady
storeEncoding.initOptions({type, advOptions, formatOptions});
storeEncoding.initPages();
storeEncoding.initNamesDelimeter([_t.txtComma, _t.txtSemicolon, _t.txtColon, _t.txtTab, _t.txtSpace]);
storeEncoding.setMode(mode);
storeEncoding.initNamesDelimeter([_t.txtComma, _t.txtSemicolon, _t.txtColon, _t.txtTab, _t.txtSpace]);
storeEncoding.changeEncoding(recommendedSettings.asc_getCodePage());
storeEncoding.changeDelimeter(recommendedSettings && recommendedSettings.asc_getDelimiter() ? recommendedSettings.asc_getDelimiter() : 4);
f7.views.current.router.navigate('/encoding/');
if(mode === 2) {
f7.views.current.router.navigate('/encoding/');
}
}
// let picker;
// const pages = [];

View file

@ -12,7 +12,7 @@ class EncodingController extends Component {
closeModal() {
if (Device.phone) {
f7.sheet.close('.settings-popup', true);
f7.sheet.close('.settings-popup', false);
} else {
f7.popover.close('#settings-popover');
}
@ -20,15 +20,16 @@ class EncodingController extends Component {
onSaveFormat(mode, valueEncoding, valueDelimeter) {
const api = Common.EditorApi.get();
this.closeModal();
const storeEncoding = this.props.storeEncoding;
if(mode === 2) {
const formatOptions = this.props.storeEncoding.formatOptions;
this.closeModal();
const formatOptions = storeEncoding.formatOptions;
formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CTextOptions(valueEncoding, valueDelimeter));
api.asc_DownloadAs(formatOptions);
} else {
const type = this.props.storeEncoding.type;
storeEncoding.setMode(1);
const type = storeEncoding.type;
api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(valueEncoding, valueDelimeter));
}
}

View file

@ -74,6 +74,7 @@ class MainPage extends Component {
const config = appOptions.config;
const showLogo = !(appOptions.canBrandingExt && (config.customization && (config.customization.loaderName || config.customization.loaderLogo)));
const showPlaceholder = !appOptions.isDocReady && (!config.customization || !(config.customization.loaderName || config.customization.loaderLogo));
return (
<Page name="home" className={`editor${ showLogo ? ' page-with-logo' : ''}`}>
{/* Top Navbar */}
@ -105,7 +106,7 @@ class MainPage extends Component {
<AddOptions onclosed={this.handleOptionsViewClosed.bind(this, 'add')} showOptions={this.state.addShowOptions} />
}
{
!this.state.settingsVisible ? null :
!this.state.settingsVisible && this.props.storeEncoding.mode ? null :
<Settings openOptions={this.handleClickToOpenOptions} onclosed={this.handleOptionsViewClosed.bind(this, 'settings')} />
}
{
@ -124,4 +125,4 @@ class MainPage extends Component {
}
}
export default inject("storeAppOptions")(observer(MainPage));
export default inject("storeAppOptions", "storeEncoding")(observer(MainPage));

View file

@ -15,7 +15,7 @@ const PageEncoding = props => {
return (
<Page>
<Navbar title={_t.textChooseCsvOptions} backLink={_t.textBack} />
<Navbar title={_t.textChooseCsvOptions} backLink={mode === 2 ? _t.textBack : ''} />
<BlockTitle>{_t.textDelimeter}</BlockTitle>
<List>
<ListItem title={nameDelimeter} href="/delimeter-list/"></ListItem>

View file

@ -79,7 +79,7 @@ const routes = [
];
const SettingsList = inject("storeAppOptions")(observer(props => {
const SettingsList = inject("storeAppOptions", "storeEncoding")(observer(props => {
const { t } = useTranslation();
const _t = t('View.Settings', {returnObjects: true});
const navbar = <Navbar title={_t.textSettings}>
@ -138,7 +138,7 @@ const SettingsList = inject("storeAppOptions")(observer(props => {
}
return (
<View style={props.style} stackPages={true} routes={routes}>
<View style={props.style} stackPages={true} routes={routes} url={!props.storeEncoding.mode && '/encoding/'}>
<Page>
{navbar}
<List>