[DE mobile] Bug 48388
This commit is contained in:
parent
d38e88f063
commit
5d8bc1e6df
|
@ -79,9 +79,50 @@ 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) {
|
||||||
|
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({
|
tabs.push({
|
||||||
caption: _t.textTable,
|
caption: _t.textTable,
|
||||||
id: 'add-table',
|
id: 'add-table',
|
||||||
|
@ -89,7 +130,12 @@ const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPa
|
||||||
component: <AddTableController/>
|
component: <AddTableController/>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(!showPanels) {
|
if(!showPanels) {
|
||||||
|
need_disable = paragraph_locked || control_plain || content_locked || in_footnote;
|
||||||
|
// console.log(need_disable);
|
||||||
|
|
||||||
|
if(!need_disable) {
|
||||||
tabs.push({
|
tabs.push({
|
||||||
caption: _t.textShape,
|
caption: _t.textShape,
|
||||||
id: 'add-shape',
|
id: 'add-shape',
|
||||||
|
@ -97,7 +143,12 @@ const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPa
|
||||||
component: <AddShapeController/>
|
component: <AddShapeController/>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(!showPanels) {
|
if(!showPanels) {
|
||||||
|
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({
|
tabs.push({
|
||||||
caption: _t.textImage,
|
caption: _t.textImage,
|
||||||
id: 'add-image',
|
id: 'add-image',
|
||||||
|
@ -105,6 +156,7 @@ const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPa
|
||||||
component: <AddImageController/>
|
component: <AddImageController/>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(!showPanels) {
|
if(!showPanels) {
|
||||||
tabs.push({
|
tabs.push({
|
||||||
caption: _t.textOther,
|
caption: _t.textOther,
|
||||||
|
|
Loading…
Reference in a new issue