[DE mobile] Bug 48388
This commit is contained in:
parent
d38e88f063
commit
5d8bc1e6df
|
@ -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: <AddTableController/>
|
||||
});
|
||||
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: <AddTableController/>
|
||||
});
|
||||
}
|
||||
}
|
||||
if(!showPanels) {
|
||||
tabs.push({
|
||||
caption: _t.textShape,
|
||||
id: 'add-shape',
|
||||
icon: 'icon-add-shape',
|
||||
component: <AddShapeController/>
|
||||
});
|
||||
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: <AddShapeController/>
|
||||
});
|
||||
}
|
||||
}
|
||||
if(!showPanels) {
|
||||
tabs.push({
|
||||
caption: _t.textImage,
|
||||
id: 'add-image',
|
||||
icon: 'icon-add-image',
|
||||
component: <AddImageController/>
|
||||
});
|
||||
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: <AddImageController/>
|
||||
});
|
||||
}
|
||||
}
|
||||
if(!showPanels) {
|
||||
tabs.push({
|
||||
|
|
Loading…
Reference in a new issue