[DE mobile] Bug 48388

This commit is contained in:
SergeyEzhin 2021-07-07 01:22:18 +03:00
parent d38e88f063
commit 5d8bc1e6df

View file

@ -79,31 +79,83 @@ const AddLayoutContent = ({ tabs }) => {
const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPanels, style, inPopover}) => { const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPanels, style, inPopover}) => {
const { t } = useTranslation(); const { t } = useTranslation();
const _t = t('Add', {returnObjects: true}); const _t = t('Add', {returnObjects: true});
const api = Common.EditorApi.get();
const tabs = []; const tabs = [];
const options = storeFocusObjects.settings; const options = storeFocusObjects.settings;
const paragraphObj = storeFocusObjects.paragraphObject;
let need_disable = false,
can_add_table = true,
can_add_image = true,
paragraph_locked = false,
in_footnote = false,
in_control = false,
control_props = false,
lock_type = false,
control_plain = false,
content_locked = false,
rich_del_lock = false,
rich_edit_lock = false,
plain_del_lock = false,
plain_edit_lock = false;
if(paragraphObj) {
can_add_table = paragraphObj.get_CanAddTable();
can_add_image = paragraphObj.get_CanAddImage();
paragraph_locked = paragraphObj.get_Locked();
in_footnote = api.asc_IsCursorInFootnote() || api.asc_IsCursorInEndnote();
in_control = api.asc_IsContentControl();
control_props = in_control ? api.asc_GetContentControlProperties() : null;
lock_type = (in_control && control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked;
control_plain = (in_control && control_props) ? (control_props.get_ContentControlType() == Asc.c_oAscSdtLevelType.Inline) : false;
content_locked = lock_type == Asc.c_oAscSdtLockType.SdtContentLocked || lock_type == Asc.c_oAscSdtLockType.ContentLocked;
rich_del_lock = paragraphObj ? !paragraphObj.can_DeleteBlockContentControl() : false;
rich_edit_lock = paragraphObj ? !paragraphObj.can_EditBlockContentControl() : false;
plain_del_lock = paragraphObj ? !paragraphObj.can_DeleteInlineContentControl() : false;
plain_edit_lock = paragraphObj ? !paragraphObj.can_EditInlineContentControl() : false;
}
if (!showPanels && options.indexOf('text') > -1) { if (!showPanels && options.indexOf('text') > -1) {
tabs.push({ need_disable = !can_add_table || control_plain || rich_edit_lock || plain_edit_lock || rich_del_lock || plain_del_lock;
caption: _t.textTable, // console.log(need_disable);
id: 'add-table',
icon: 'icon-add-table', if(!need_disable) {
component: <AddTableController/> tabs.push({
}); caption: _t.textTable,
id: 'add-table',
icon: 'icon-add-table',
component: <AddTableController/>
});
}
} }
if(!showPanels) { if(!showPanels) {
tabs.push({ need_disable = paragraph_locked || control_plain || content_locked || in_footnote;
caption: _t.textShape, // console.log(need_disable);
id: 'add-shape',
icon: 'icon-add-shape', if(!need_disable) {
component: <AddShapeController/> tabs.push({
}); caption: _t.textShape,
id: 'add-shape',
icon: 'icon-add-shape',
component: <AddShapeController/>
});
}
} }
if(!showPanels) { if(!showPanels) {
tabs.push({ need_disable = paragraph_locked || paragraphObj && !can_add_image || control_plain || rich_del_lock || plain_del_lock || content_locked;
caption: _t.textImage, // console.log(need_disable);
id: 'add-image',
icon: 'icon-add-image', if(!need_disable) {
component: <AddImageController/> tabs.push({
}); caption: _t.textImage,
id: 'add-image',
icon: 'icon-add-image',
component: <AddImageController/>
});
}
} }
if(!showPanels) { if(!showPanels) {
tabs.push({ tabs.push({