[DE mobile] Bug 48388
This commit is contained in:
parent
5d8bc1e6df
commit
2034377187
|
@ -26,7 +26,8 @@ import PluginsController from '../../../../common/mobile/lib/controller/Plugins.
|
|||
"storeTableSettings",
|
||||
"storeDocumentInfo",
|
||||
"storeChartSettings",
|
||||
"storeApplicationSettings"
|
||||
"storeApplicationSettings",
|
||||
"storeLinkSettings"
|
||||
)
|
||||
class MainController extends Component {
|
||||
constructor(props) {
|
||||
|
@ -572,6 +573,12 @@ class MainController extends Component {
|
|||
storeTextSettings.resetBackgroundColor(color);
|
||||
});
|
||||
|
||||
// link settings
|
||||
const storeLinkSettings = this.props.storeLinkSettings;
|
||||
this.api.asc_registerCallback('asc_onCanAddHyperlink', (value) => {
|
||||
storeLinkSettings.canAddHyperlink(value);
|
||||
});
|
||||
|
||||
//paragraph settings
|
||||
EditorUIController.initEditorStyles && EditorUIController.initEditorStyles(this.props.storeParagraphSettings);
|
||||
|
||||
|
|
|
@ -242,16 +242,25 @@ class AddOtherController extends Component {
|
|||
|
||||
render () {
|
||||
return (
|
||||
<AddOther closeModal={this.closeModal}
|
||||
onInsertPageNumber={this.onInsertPageNumber}
|
||||
onPageBreak={this.onPageBreak}
|
||||
onColumnBreak={this.onColumnBreak}
|
||||
onInsertSectionBreak={this.onInsertSectionBreak}
|
||||
getFootnoteProps={this.getFootnoteProps}
|
||||
getFootnoteStartAt={this.getFootnoteStartAt}
|
||||
onFootnoteStartAt={this.onFootnoteStartAt}
|
||||
onInsertFootnote={this.onInsertFootnote}
|
||||
initFootnoteStartAt={this.initFootnoteStartAt}
|
||||
<AddOther
|
||||
closeModal={this.closeModal}
|
||||
onInsertPageNumber={this.onInsertPageNumber}
|
||||
onPageBreak={this.onPageBreak}
|
||||
onColumnBreak={this.onColumnBreak}
|
||||
onInsertSectionBreak={this.onInsertSectionBreak}
|
||||
getFootnoteProps={this.getFootnoteProps}
|
||||
getFootnoteStartAt={this.getFootnoteStartAt}
|
||||
onFootnoteStartAt={this.onFootnoteStartAt}
|
||||
onInsertFootnote={this.onInsertFootnote}
|
||||
initFootnoteStartAt={this.initFootnoteStartAt}
|
||||
inFootnote={this.props.inFootnote}
|
||||
inControl={this.props.inControl}
|
||||
paragraphLocked={this.props.paragraphLocked}
|
||||
controlPlain={this.props.controlPlain}
|
||||
richDelLock={this.props.richDelLock}
|
||||
richEditLock={this.props.richEditLock}
|
||||
plainDelLock={this.props.plainDelLock}
|
||||
plainEditLock={this.props.plainEditLock}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import {storeImageSettings} from "./imageSettings";
|
|||
import {storeTableSettings} from "./tableSettings";
|
||||
import {storeChartSettings} from "./chartSettings";
|
||||
import {storeDocumentInfo} from "./documentInfo";
|
||||
import {storeLinkSettings} from './linkSettings';
|
||||
import {storeApplicationSettings} from './applicationSettings';
|
||||
import {storeAppOptions} from "./appOptions";
|
||||
import {storePalette} from "./palette";
|
||||
|
@ -21,6 +22,7 @@ export const stores = {
|
|||
storeDocumentSettings: new storeDocumentSettings(),
|
||||
users: new storeUsers(),
|
||||
storeTextSettings: new storeTextSettings(),
|
||||
storeLinkSettings: new storeLinkSettings(),
|
||||
storeParagraphSettings: new storeParagraphSettings(),
|
||||
storeShapeSettings: new storeShapeSettings(),
|
||||
storeChartSettings: new storeChartSettings(),
|
||||
|
|
|
@ -84,45 +84,44 @@ const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPa
|
|||
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;
|
||||
let needDisable = false,
|
||||
canAddTable = true,
|
||||
canAddImage = true,
|
||||
paragraphLocked = false,
|
||||
inFootnote = false,
|
||||
inControl = false,
|
||||
controlProps = false,
|
||||
lockType = false,
|
||||
controlPlain = false,
|
||||
contentLocked = false,
|
||||
richDelLock = false,
|
||||
richEditLock = false,
|
||||
plainDelLock = false,
|
||||
plainEditLock = false;
|
||||
|
||||
if(paragraphObj) {
|
||||
can_add_table = paragraphObj.get_CanAddTable();
|
||||
can_add_image = paragraphObj.get_CanAddImage();
|
||||
paragraph_locked = paragraphObj.get_Locked();
|
||||
canAddTable = paragraphObj.get_CanAddTable();
|
||||
canAddImage = paragraphObj.get_CanAddImage();
|
||||
paragraphLocked = paragraphObj.get_Locked();
|
||||
|
||||
in_footnote = api.asc_IsCursorInFootnote() || api.asc_IsCursorInEndnote();
|
||||
in_control = api.asc_IsContentControl();
|
||||
inFootnote = api.asc_IsCursorInFootnote() || api.asc_IsCursorInEndnote();
|
||||
inControl = 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;
|
||||
controlProps = inControl ? api.asc_GetContentControlProperties() : null;
|
||||
lockType = (inControl && controlProps) ? controlProps.get_Lock() : Asc.c_oAscSdtLockType.Unlocked;
|
||||
controlPlain = (inControl && controlProps) ? (controlProps.get_ContentControlType() == Asc.c_oAscSdtLevelType.Inline) : false;
|
||||
contentLocked = lockType == Asc.c_oAscSdtLockType.SdtContentLocked || lockType == 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;
|
||||
richDelLock = paragraphObj ? !paragraphObj.can_DeleteBlockContentControl() : false;
|
||||
richEditLock = paragraphObj ? !paragraphObj.can_EditBlockContentControl() : false;
|
||||
plainDelLock = paragraphObj ? !paragraphObj.can_DeleteInlineContentControl() : false;
|
||||
plainEditLock = paragraphObj ? !paragraphObj.can_EditInlineContentControl() : false;
|
||||
}
|
||||
|
||||
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);
|
||||
needDisable = !canAddTable || controlPlain || richEditLock || plainEditLock || richDelLock || plainDelLock;
|
||||
|
||||
if(!need_disable) {
|
||||
if(!needDisable) {
|
||||
tabs.push({
|
||||
caption: _t.textTable,
|
||||
id: 'add-table',
|
||||
|
@ -132,10 +131,9 @@ const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPa
|
|||
}
|
||||
}
|
||||
if(!showPanels) {
|
||||
need_disable = paragraph_locked || control_plain || content_locked || in_footnote;
|
||||
// console.log(need_disable);
|
||||
needDisable = paragraphLocked || controlPlain || contentLocked || inFootnote;
|
||||
|
||||
if(!need_disable) {
|
||||
if(!needDisable) {
|
||||
tabs.push({
|
||||
caption: _t.textShape,
|
||||
id: 'add-shape',
|
||||
|
@ -145,10 +143,9 @@ const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPa
|
|||
}
|
||||
}
|
||||
if(!showPanels) {
|
||||
need_disable = paragraph_locked || paragraphObj && !can_add_image || control_plain || rich_del_lock || plain_del_lock || content_locked;
|
||||
// console.log(need_disable);
|
||||
needDisable = paragraphLocked || paragraphObj && !canAddImage || controlPlain || richDelLock || plainDelLock || contentLocked;
|
||||
|
||||
if(!need_disable) {
|
||||
if(!needDisable) {
|
||||
tabs.push({
|
||||
caption: _t.textImage,
|
||||
id: 'add-image',
|
||||
|
@ -162,7 +159,17 @@ const AddTabs = inject("storeFocusObjects")(observer(({storeFocusObjects, showPa
|
|||
caption: _t.textOther,
|
||||
id: 'add-other',
|
||||
icon: 'icon-add-other',
|
||||
component: <AddOtherController/>
|
||||
component:
|
||||
<AddOtherController
|
||||
inFootnote={inFootnote}
|
||||
inControl={inControl}
|
||||
paragraphLocked={paragraphLocked}
|
||||
controlPlain={controlPlain}
|
||||
richDelLock={richDelLock}
|
||||
richEditLock={richEditLock}
|
||||
plainDelLock={plainDelLock}
|
||||
plainEditLock={plainEditLock}
|
||||
/>
|
||||
});
|
||||
}
|
||||
if (showPanels && showPanels === 'link') {
|
||||
|
|
|
@ -153,21 +153,39 @@ const PageFootnote = props => {
|
|||
const AddOther = props => {
|
||||
const { t } = useTranslation();
|
||||
const _t = t('Add', {returnObjects: true});
|
||||
|
||||
const storeFocusObjects = props.storeFocusObjects;
|
||||
const storeLinkSettings = props.storeLinkSettings;
|
||||
const canAddLink = storeLinkSettings.canAddLink;
|
||||
|
||||
let isShape = storeFocusObjects.settings.indexOf('shape') > -1,
|
||||
isText = storeFocusObjects.settings.indexOf('text') > -1,
|
||||
isChart = storeFocusObjects.settings.indexOf('chart') > -1;
|
||||
|
||||
let disabledAddLink = false,
|
||||
disabledAddBreak = false,
|
||||
disabledAddFootnote = false,
|
||||
inFootnote = props.inFootnote,
|
||||
inControl = props.inControl,
|
||||
paragraphLocked = props.paragraphLocked,
|
||||
controlPlain = props.controlPlain,
|
||||
richDelLock = props.richDelLock,
|
||||
richEditLock = props.richEditLock,
|
||||
plainDelLock = props.plainDelLock,
|
||||
plainEditLock = props.plainEditLock;
|
||||
|
||||
disabledAddBreak = paragraphLocked || inFootnote || inControl || richEditLock || plainEditLock || richDelLock || plainDelLock;
|
||||
disabledAddFootnote = paragraphLocked || controlPlain || richEditLock || plainEditLock;
|
||||
disabledAddLink = paragraphLocked || !canAddLink;
|
||||
|
||||
return (
|
||||
<List>
|
||||
{isText &&<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>}
|
||||
{isText && <ListItem title={_t.textLink} link={'/add-link/'} routeProps={{
|
||||
{(isText && !disabledAddLink) && <ListItem title={_t.textLink} link={'/add-link/'} routeProps={{
|
||||
onInsertLink: props.onInsertLink,
|
||||
getDisplayLinkText: props.getDisplayLinkText
|
||||
}}>
|
||||
|
@ -178,15 +196,16 @@ const AddOther = props => {
|
|||
}}>
|
||||
<Icon slot="media" icon="icon-pagenumber"></Icon>
|
||||
</ListItem>
|
||||
{(isShape || isChart) ? null :
|
||||
[ <ListItem key='break' title={_t.textBreak} link={'/add-break/'} routeProps={{
|
||||
{(isShape || isChart) || (isText && disabledAddBreak) ? null :
|
||||
<ListItem key='break' 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>
|
||||
}
|
||||
{(isShape || isChart) || (isText && disabledAddFootnote) ? null :
|
||||
<ListItem key='footnote' title={_t.textFootnote} link={'/add-footnote/'} routeProps={{
|
||||
getFootnoteProps: props.getFootnoteProps,
|
||||
getFootnoteStartAt: props.getFootnoteStartAt,
|
||||
|
@ -195,13 +214,13 @@ const AddOther = props => {
|
|||
initFootnoteStartAt: props.initFootnoteStartAt
|
||||
}}>
|
||||
<Icon slot="media" icon="icon-footnote"></Icon>
|
||||
</ListItem> ]
|
||||
</ListItem>
|
||||
}
|
||||
</List>
|
||||
)
|
||||
};
|
||||
|
||||
const AddOtherContainer = inject("storeComments","storeFocusObjects")(observer(AddOther));
|
||||
const AddOtherContainer = inject("storeComments","storeFocusObjects", "storeLinkSettings")(observer(AddOther));
|
||||
|
||||
export {AddOtherContainer as AddOther,
|
||||
PageNumber as PageAddNumber,
|
||||
|
|
Loading…
Reference in a new issue