diff --git a/apps/documenteditor/mobile/src/view/add/Add.jsx b/apps/documenteditor/mobile/src/view/add/Add.jsx
index c09a2690a5..f793ba4b69 100644
--- a/apps/documenteditor/mobile/src/view/add/Add.jsx
+++ b/apps/documenteditor/mobile/src/view/add/Add.jsx
@@ -79,31 +79,83 @@ const AddLayoutContent = ({ tabs }) => {
const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPanels, style, inPopover}) => {
const { t } = useTranslation();
const _t = t('Add', {returnObjects: true});
+ const api = Common.EditorApi.get();
const tabs = [];
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) {
- tabs.push({
- caption: _t.textTable,
- id: 'add-table',
- icon: 'icon-add-table',
- component:
- });
+ need_disable = !can_add_table || control_plain || rich_edit_lock || plain_edit_lock || rich_del_lock || plain_del_lock;
+ // console.log(need_disable);
+
+ if(!need_disable) {
+ tabs.push({
+ caption: _t.textTable,
+ id: 'add-table',
+ icon: 'icon-add-table',
+ component:
+ });
+ }
}
if(!showPanels) {
- tabs.push({
- caption: _t.textShape,
- id: 'add-shape',
- icon: 'icon-add-shape',
- component:
- });
+ need_disable = paragraph_locked || control_plain || content_locked || in_footnote;
+ // console.log(need_disable);
+
+ if(!need_disable) {
+ tabs.push({
+ caption: _t.textShape,
+ id: 'add-shape',
+ icon: 'icon-add-shape',
+ component:
+ });
+ }
}
if(!showPanels) {
- tabs.push({
- caption: _t.textImage,
- id: 'add-image',
- icon: 'icon-add-image',
- component:
- });
+ need_disable = paragraph_locked || paragraphObj && !can_add_image || control_plain || rich_del_lock || plain_del_lock || content_locked;
+ // console.log(need_disable);
+
+ if(!need_disable) {
+ tabs.push({
+ caption: _t.textImage,
+ id: 'add-image',
+ icon: 'icon-add-image',
+ component:
+ });
+ }
}
if(!showPanels) {
tabs.push({