[mobile-react] Fix store focus objects
This commit is contained in:
parent
2164ff77ae
commit
77b5e90c4b
|
@ -59,7 +59,7 @@ const EditLayoutContent = ({ editors }) => {
|
||||||
const EditSheet = props => {
|
const EditSheet = props => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const settings = props.storeFocusObjects.focusObjects;
|
const settings = props.storeFocusObjects.settings;
|
||||||
const headerType = props.storeFocusObjects.headerType;
|
const headerType = props.storeFocusObjects.headerType;
|
||||||
let editors = [];
|
let editors = [];
|
||||||
if (settings.length < 1) {
|
if (settings.length < 1) {
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
import {action, observable, computed} from 'mobx';
|
import {action, observable, computed} from 'mobx';
|
||||||
|
|
||||||
export class storeFocusObjects {
|
export class storeFocusObjects {
|
||||||
@observable focusObjects = [];
|
@observable _focusObjects = [];
|
||||||
@observable headerType = 1;
|
@observable _headerType = 1;
|
||||||
|
|
||||||
@action resetFocusObjects (objects) {
|
@action resetFocusObjects (objects) {
|
||||||
this.focusObjects = objects;
|
this._focusObjects = objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed get settings() {
|
||||||
let _settings = [];
|
let _settings = [];
|
||||||
for (let object of objects) {
|
for (let object of this._focusObjects) {
|
||||||
var type = object.get_ObjectType();
|
let type = object.get_ObjectType();
|
||||||
if (Asc.c_oAscTypeSelectElement.Paragraph === type) {
|
if (Asc.c_oAscTypeSelectElement.Paragraph === type) {
|
||||||
_settings.push('text', 'paragraph');
|
_settings.push('text', 'paragraph');
|
||||||
} else if (Asc.c_oAscTypeSelectElement.Table === type) {
|
} else if (Asc.c_oAscTypeSelectElement.Table === type) {
|
||||||
|
@ -25,13 +28,21 @@ export class storeFocusObjects {
|
||||||
_settings.push('hyperlink');
|
_settings.push('hyperlink');
|
||||||
} else if (Asc.c_oAscTypeSelectElement.Header === type) {
|
} else if (Asc.c_oAscTypeSelectElement.Header === type) {
|
||||||
_settings.push('header');
|
_settings.push('header');
|
||||||
this.headerType = object.get_ObjectValue().get_Type();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Exclude shapes if chart exist
|
// Exclude shapes if chart exist
|
||||||
if (_settings.indexOf('chart') > -1) {
|
if (_settings.indexOf('chart') > -1) {
|
||||||
_settings = _settings.filter((value) => value !== 'shape');
|
_settings = _settings.filter((value) => value !== 'shape');
|
||||||
}
|
}
|
||||||
this.focusObjects = _settings.filter((value, index, self) => self.indexOf(value) === index);
|
return _settings.filter((value, index, self) => self.indexOf(value) === index);
|
||||||
|
}
|
||||||
|
@computed get headerType() {
|
||||||
|
for (let object of this._focusObjects) {
|
||||||
|
let type = object.get_ObjectType();
|
||||||
|
if (Asc.c_oAscTypeSelectElement.Header === type) {
|
||||||
|
return object.get_ObjectValue().get_Type();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this._headerType;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue