mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-04-07 14:06:16 +08:00
[DE mobile] Fix Bug 61182
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
import React, {Component} from 'react';
|
||||
import { f7 } from 'framework7-react';
|
||||
import {Device} from '../../../../../common/mobile/utils/device';
|
||||
import { withTranslation} from 'react-i18next';
|
||||
|
||||
import {observer, inject} from "mobx-react";
|
||||
import { withTranslation } from 'react-i18next';
|
||||
import AddTable from '../../view/add/AddTable';
|
||||
|
||||
class AddTableController extends Component {
|
||||
@ -79,14 +79,24 @@ class AddTableController extends Component {
|
||||
}).open();
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
const storeTableSettings = this.props.storeTableSettings;
|
||||
|
||||
if(!storeTableSettings.arrayStylesDefault.length) {
|
||||
const api = Common.EditorApi.get();
|
||||
const tableStylesPreviews = await api.asc_getTableStylesPreviews(true);
|
||||
|
||||
storeTableSettings.setStyles(tableStylesPreviews, 'default');
|
||||
}
|
||||
}
|
||||
|
||||
render () {
|
||||
return (
|
||||
<AddTable onStyleClick={this.onStyleClick}
|
||||
/>
|
||||
<AddTable onStyleClick={this.onStyleClick} />
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const AddTableWithTranslation = withTranslation()(AddTableController);
|
||||
const AddTableWithTranslation = inject('storeTableSettings')(observer(withTranslation()(AddTableController)));
|
||||
|
||||
export {AddTableWithTranslation as AddTableController};
|
||||
@ -78,11 +78,11 @@ const AddLayoutNavbar = ({ tabs, inPopover }) => {
|
||||
)
|
||||
};
|
||||
|
||||
const AddLayoutContent = ({ tabs, onGetTableStylesPreviews }) => {
|
||||
const AddLayoutContent = ({ tabs }) => {
|
||||
return (
|
||||
<Tabs animated>
|
||||
{tabs.map((item, index) =>
|
||||
<Tab key={"de-tab-" + item.id} onTabShow={(e) => {e.id === 'add-table' && onGetTableStylesPreviews()}} id={item.id} className="page-content" tabActive={index === 0}>
|
||||
<Tab key={"de-tab-" + item.id} id={item.id} className="page-content" tabActive={index === 0}>
|
||||
{item.component}
|
||||
</Tab>
|
||||
)}
|
||||
@ -90,7 +90,7 @@ const AddLayoutContent = ({ tabs, onGetTableStylesPreviews }) => {
|
||||
)
|
||||
};
|
||||
|
||||
const AddTabs = inject("storeFocusObjects", "storeTableSettings")(observer(({storeFocusObjects,storeTableSettings, showPanels, style, inPopover, onCloseLinkSettings}) => {
|
||||
const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPanels, style, inPopover, onCloseLinkSettings}) => {
|
||||
const { t } = useTranslation();
|
||||
const _t = t('Add', {returnObjects: true});
|
||||
const api = Common.EditorApi.get();
|
||||
@ -197,18 +197,11 @@ const AddTabs = inject("storeFocusObjects", "storeTableSettings")(observer(({sto
|
||||
// });
|
||||
// }
|
||||
|
||||
const onGetTableStylesPreviews = () => {
|
||||
if(storeTableSettings.arrayStylesDefault.length == 0) {
|
||||
const api = Common.EditorApi.get();
|
||||
setTimeout(() => storeTableSettings.setStyles(api.asc_getTableStylesPreviews(true), 'default'), 1);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={style} stackPages={true} routes={routes}>
|
||||
<Page pageContent={false}>
|
||||
<AddLayoutNavbar tabs={tabs} inPopover={inPopover}/>
|
||||
<AddLayoutContent tabs={tabs} onGetTableStylesPreviews={onGetTableStylesPreviews}/>
|
||||
<AddLayoutContent tabs={tabs} />
|
||||
</Page>
|
||||
</View>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user