Fix Bug 48109

This commit is contained in:
ShimaginAndrey 2021-06-15 16:22:38 +03:00
parent 237d03ea57
commit 0022202b4d
2 changed files with 42 additions and 27 deletions

View file

@ -76,30 +76,36 @@ const AddLayoutContent = ({ tabs }) => {
)
};
const AddTabs = props => {
const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPanels, style, inPopover}) => {
const { t } = useTranslation();
const _t = t('Add', {returnObjects: true});
const showPanels = props.showPanels;
const tabs = [];
if (!showPanels) {
const options = storeFocusObjects.settings;
if (!showPanels && options.indexOf('text') > -1) {
tabs.push({
caption: _t.textTable,
id: 'add-table',
icon: 'icon-add-table',
component: <AddTableController/>
});
}
if(!showPanels) {
tabs.push({
caption: _t.textShape,
id: 'add-shape',
icon: 'icon-add-shape',
component: <AddShapeController/>
});
}
if(!showPanels) {
tabs.push({
caption: _t.textImage,
id: 'add-image',
icon: 'icon-add-image',
component: <AddImageController/>
});
}
if(!showPanels) {
tabs.push({
caption: _t.textOther,
id: 'add-other',
@ -115,14 +121,14 @@ const AddTabs = props => {
});
}
return (
<View style={props.style} stackPages={true} routes={routes}>
<View style={style} stackPages={true} routes={routes}>
<Page pageContent={false}>
<AddLayoutNavbar tabs={tabs} inPopover={props.inPopover}/>
<AddLayoutNavbar tabs={tabs} inPopover={inPopover}/>
<AddLayoutContent tabs={tabs} />
</Page>
</View>
)
};
}));
class AddView extends Component {
constructor(props) {

View file

@ -153,46 +153,55 @@ const PageFootnote = props => {
const AddOther = props => {
const { t } = useTranslation();
const _t = t('Add', {returnObjects: true});
const storeFocusObjects = props.storeFocusObjects;
let isShape = storeFocusObjects.settings.indexOf('shape') > -1,
isText = storeFocusObjects.settings.indexOf('text') > -1,
isChart = storeFocusObjects.settings.indexOf('chart') > -1;
return (
<List>
<ListItem title={_t.textComment} onClick={() => {
{isText &&<ListItem title={_t.textComment} onClick={() => {
props.closeModal();
Common.Notifications.trigger('addcomment');
}}>
<Icon slot="media" icon="icon-insert-comment"></Icon>
</ListItem>
<ListItem title={_t.textLink} link={'/add-link/'} routeProps={{
</ListItem>}
{isText && <ListItem title={_t.textLink} link={'/add-link/'} routeProps={{
onInsertLink: props.onInsertLink,
getDisplayLinkText: props.getDisplayLinkText
}}>
<Icon slot="media" icon="icon-link"></Icon>
</ListItem>
</ListItem>}
<ListItem title={_t.textPageNumber} link={'/add-page-number/'} routeProps={{
onInsertPageNumber: props.onInsertPageNumber
}}>
<Icon slot="media" icon="icon-pagenumber"></Icon>
</ListItem>
<ListItem title={_t.textBreak} link={'/add-break/'} routeProps={{
onPageBreak: props.onPageBreak,
onColumnBreak: props.onColumnBreak,
onInsertSectionBreak: props.onInsertSectionBreak
}}>
<Icon slot="media" icon="icon-sectionbreak"></Icon>
</ListItem>
<ListItem title={_t.textFootnote} link={'/add-footnote/'} routeProps={{
getFootnoteProps: props.getFootnoteProps,
getFootnoteStartAt: props.getFootnoteStartAt,
onFootnoteStartAt: props.onFootnoteStartAt,
onInsertFootnote: props.onInsertFootnote,
initFootnoteStartAt: props.initFootnoteStartAt
}}>
<Icon slot="media" icon="icon-footnote"></Icon>
</ListItem>
{(isShape || isChart) ? null :
<ListItem title={_t.textBreak} link={'/add-break/'} routeProps={{
onPageBreak: props.onPageBreak,
onColumnBreak: props.onColumnBreak,
onInsertSectionBreak: props.onInsertSectionBreak
}}>
<Icon slot="media" icon="icon-sectionbreak"></Icon>
</ListItem>
}
{(isShape || isChart) ? null :
<ListItem title={_t.textFootnote} link={'/add-footnote/'} routeProps={{
getFootnoteProps: props.getFootnoteProps,
getFootnoteStartAt: props.getFootnoteStartAt,
onFootnoteStartAt: props.onFootnoteStartAt,
onInsertFootnote: props.onInsertFootnote,
initFootnoteStartAt: props.initFootnoteStartAt
}}>
<Icon slot="media" icon="icon-footnote"></Icon>
</ListItem>}
</List>
)
};
const AddOtherContainer = inject("storeComments")(observer(AddOther));
const AddOtherContainer = inject("storeComments","storeFocusObjects")(observer(AddOther));
export {AddOtherContainer as AddOther,
PageNumber as PageAddNumber,