From 76354c5e3a9dbe1720386cf6a5bd2e9535fd29af Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Thu, 9 Mar 2023 20:47:36 +0400 Subject: [PATCH] [DE mobile] Fix Bug 61182 --- .../mobile/src/controller/add/AddTable.jsx | 11 ----------- apps/documenteditor/mobile/src/view/add/Add.jsx | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/apps/documenteditor/mobile/src/controller/add/AddTable.jsx b/apps/documenteditor/mobile/src/controller/add/AddTable.jsx index c09d2cde8d..628f3ff8cc 100644 --- a/apps/documenteditor/mobile/src/controller/add/AddTable.jsx +++ b/apps/documenteditor/mobile/src/controller/add/AddTable.jsx @@ -79,17 +79,6 @@ 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 ( diff --git a/apps/documenteditor/mobile/src/view/add/Add.jsx b/apps/documenteditor/mobile/src/view/add/Add.jsx index c394924f67..22395d8e9f 100644 --- a/apps/documenteditor/mobile/src/view/add/Add.jsx +++ b/apps/documenteditor/mobile/src/view/add/Add.jsx @@ -57,16 +57,24 @@ const routes = [ } ]; -const AddLayoutNavbar = ({ tabs, inPopover }) => { +const AddLayoutNavbar = ({ tabs, inPopover, storeTableSettings }) => { const isAndroid = Device.android; const { t } = useTranslation(); const _t = t('Add', {returnObjects: true}); + + const getTableStylesPreviews = async () => { + if(!storeTableSettings.arrayStylesDefault.length) { + const api = Common.EditorApi.get(); + setTimeout(() => storeTableSettings.setStyles(api.asc_getTableStylesPreviews(true), 'default'), 1); + } + }; + return ( {tabs.length > 1 ?
{tabs.map((item, index) => - + getTableStylesPreviews()} tabLink={"#" + item.id} tabLinkActive={index === 0}> )} {isAndroid && } @@ -90,7 +98,7 @@ const AddLayoutContent = ({ tabs }) => { ) }; -const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPanels, style, inPopover, onCloseLinkSettings}) => { +const AddTabs = inject("storeFocusObjects", "storeTableSettings")(observer(({storeFocusObjects, showPanels, storeTableSettings, style, inPopover, onCloseLinkSettings}) => { const { t } = useTranslation(); const _t = t('Add', {returnObjects: true}); const api = Common.EditorApi.get(); @@ -200,7 +208,7 @@ const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPa return ( - +