Merge branch 'feature/mobile-apps-on-reactjs' of https://github.com/ONLYOFFICE/web-apps into feature/mobile-apps-on-reactjs
This commit is contained in:
commit
2ea2d5238e
|
@ -223,6 +223,9 @@ class MainController extends Component {
|
|||
'translate': t('Main.SDK', {returnObjects:true})
|
||||
});
|
||||
|
||||
Common.Notifications.trigger('engineCreated', this.api);
|
||||
Common.EditorApi = {get: () => this.api};
|
||||
|
||||
this.appOptions = {};
|
||||
this.bindEvents();
|
||||
|
||||
|
@ -230,9 +233,6 @@ class MainController extends Component {
|
|||
// Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me));
|
||||
Common.Gateway.on('opendocument', loadDocument);
|
||||
Common.Gateway.appReady();
|
||||
|
||||
Common.Notifications.trigger('engineCreated', this.api);
|
||||
Common.EditorApi = {get: () => this.api};
|
||||
}, error => {
|
||||
console.log('promise failed ' + error);
|
||||
});
|
||||
|
@ -423,34 +423,12 @@ class MainController extends Component {
|
|||
this.api.asc_registerCallback('asc_onDocSize', (w, h) => {
|
||||
storeDocumentSettings.changeDocSize(w, h);
|
||||
});
|
||||
const storeFocusObjects = this.props.storeFocusObjects;
|
||||
this.api.asc_registerCallback('asc_onFocusObject', objects => {
|
||||
storeFocusObjects.resetFocusObjects(objects);
|
||||
});
|
||||
|
||||
//text settings
|
||||
const storeTextSettings = this.props.storeTextSettings;
|
||||
this.api.asc_registerCallback('asc_onInitEditorFonts', (fonts, select) => {
|
||||
storeTextSettings.initEditorFonts(fonts, select);
|
||||
});
|
||||
this.api.asc_registerCallback('asc_onFontFamily', (font) => {
|
||||
storeTextSettings.resetFontName(font);
|
||||
});
|
||||
this.api.asc_registerCallback('asc_onFontSize', (size) => {
|
||||
storeTextSettings.resetFontSize(size);
|
||||
});
|
||||
this.api.asc_registerCallback('asc_onBold', (isBold) => {
|
||||
storeTextSettings.resetIsBold(isBold);
|
||||
});
|
||||
this.api.asc_registerCallback('asc_onItalic', (isItalic) => {
|
||||
storeTextSettings.resetIsItalic(isItalic);
|
||||
});
|
||||
this.api.asc_registerCallback('asc_onUnderline', (isUnderline) => {
|
||||
storeTextSettings.resetIsUnderline(isUnderline);
|
||||
});
|
||||
this.api.asc_registerCallback('asc_onStrikeout', (isStrikeout) => {
|
||||
storeTextSettings.resetIsStrikeout(isStrikeout);
|
||||
});
|
||||
EditorUIController.initFonts(storeTextSettings);
|
||||
EditorUIController.initFocusObjects(this.props.storeFocusObjects);
|
||||
|
||||
this.api.asc_registerCallback('asc_onVerticalAlign', (typeBaseline) => {
|
||||
storeTextSettings.resetTypeBaseline(typeBaseline);
|
||||
});
|
||||
|
@ -482,23 +460,14 @@ class MainController extends Component {
|
|||
});
|
||||
|
||||
//paragraph settings
|
||||
this.api.asc_setParagraphStylesSizes(330, 38);
|
||||
const storeParagraphSettings = this.props.storeParagraphSettings;
|
||||
this.api.asc_registerCallback('asc_onInitEditorStyles', (styles) => {
|
||||
storeParagraphSettings.initEditorStyles(styles);
|
||||
});
|
||||
this.api.asc_registerCallback('asc_onParaStyleName', (name) => {
|
||||
storeParagraphSettings.changeParaStyleName(name);
|
||||
});
|
||||
EditorUIController.initEditorStyles(this.props.storeParagraphSettings);
|
||||
|
||||
//table settings
|
||||
const storeTableSettings = this.props.storeTableSettings;
|
||||
this.api.asc_registerCallback('asc_onInitTableTemplates', (templates) => {
|
||||
storeTableSettings.initTableTemplates(templates);
|
||||
});
|
||||
EditorUIController.initTableTemplates(this.props.storeTableSettings);
|
||||
|
||||
//chart settings
|
||||
const storeChartSettings = this.props.storeChartSettings;
|
||||
const storeFocusObjects = this.props.storeFocusObjects;
|
||||
this.api.asc_registerCallback('asc_onUpdateChartStyles', () => {
|
||||
if (storeFocusObjects.chartObject && storeFocusObjects.chartObject.get_ChartProperties()) {
|
||||
storeChartSettings.updateChartStyles(this.api.asc_getChartPreviews(storeFocusObjects.chartObject.get_ChartProperties().getType()));
|
||||
|
|
|
@ -11,4 +11,10 @@ EditorUIController.getToolbarOptions = () => {
|
|||
return null
|
||||
};
|
||||
|
||||
EditorUIController.initFonts = () => null;
|
||||
EditorUIController.initEditorStyles = () => null;
|
||||
EditorUIController.initFocusObjects = () => null;
|
||||
EditorUIController.filterFocusObjects = () => [];
|
||||
EditorUIController.initTableTemplates = () => null;
|
||||
|
||||
export default EditorUIController;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {action, observable, computed, makeObservable} from 'mobx';
|
||||
import EditorUIController from '../lib/patch'
|
||||
|
||||
export class storeFocusObjects {
|
||||
constructor() {
|
||||
|
@ -27,30 +28,7 @@ export class storeFocusObjects {
|
|||
}
|
||||
|
||||
get settings() {
|
||||
const _settings = [];
|
||||
for (let object of this._focusObjects) {
|
||||
let type = object.get_ObjectType();
|
||||
if (Asc.c_oAscTypeSelectElement.Paragraph === type) {
|
||||
_settings.push('text', 'paragraph');
|
||||
} else if (Asc.c_oAscTypeSelectElement.Table === type) {
|
||||
_settings.push('table');
|
||||
} else if (Asc.c_oAscTypeSelectElement.Image === type) {
|
||||
if (object.get_ObjectValue().get_ChartProperties()) {
|
||||
// Exclude shapes if chart exist
|
||||
let si = _settings.indexOf('shape');
|
||||
si < 0 ? _settings.push('chart') : _settings.splice(si,1,'chart');
|
||||
} else if (object.get_ObjectValue().get_ShapeProperties() && !_settings.includes('chart')) {
|
||||
_settings.push('shape');
|
||||
} else {
|
||||
_settings.push('image');
|
||||
}
|
||||
} else if (Asc.c_oAscTypeSelectElement.Hyperlink === type) {
|
||||
_settings.push('hyperlink');
|
||||
} else if (Asc.c_oAscTypeSelectElement.Header === type) {
|
||||
_settings.push('header');
|
||||
}
|
||||
}
|
||||
return _settings.filter((value, index, self) => self.indexOf(value) === index);
|
||||
return EditorUIController.filterFocusObjects(this._focusObjects);
|
||||
}
|
||||
|
||||
get headerType() {
|
||||
|
|
|
@ -168,9 +168,11 @@ module.exports = {
|
|||
|
||||
...(env === 'production' ? [
|
||||
new CssMinimizerPlugin({
|
||||
processorOptions: {
|
||||
safe: true,
|
||||
map: { inline: false },
|
||||
minimizerOptions: {
|
||||
processorOptions: {
|
||||
safe: true,
|
||||
map: { inline: false },
|
||||
},
|
||||
},
|
||||
}),
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
|
|
Loading…
Reference in a new issue