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})
|
'translate': t('Main.SDK', {returnObjects:true})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Common.Notifications.trigger('engineCreated', this.api);
|
||||||
|
Common.EditorApi = {get: () => this.api};
|
||||||
|
|
||||||
this.appOptions = {};
|
this.appOptions = {};
|
||||||
this.bindEvents();
|
this.bindEvents();
|
||||||
|
|
||||||
|
@ -230,9 +233,6 @@ class MainController extends Component {
|
||||||
// Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me));
|
// Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me));
|
||||||
Common.Gateway.on('opendocument', loadDocument);
|
Common.Gateway.on('opendocument', loadDocument);
|
||||||
Common.Gateway.appReady();
|
Common.Gateway.appReady();
|
||||||
|
|
||||||
Common.Notifications.trigger('engineCreated', this.api);
|
|
||||||
Common.EditorApi = {get: () => this.api};
|
|
||||||
}, error => {
|
}, error => {
|
||||||
console.log('promise failed ' + error);
|
console.log('promise failed ' + error);
|
||||||
});
|
});
|
||||||
|
@ -423,34 +423,12 @@ class MainController extends Component {
|
||||||
this.api.asc_registerCallback('asc_onDocSize', (w, h) => {
|
this.api.asc_registerCallback('asc_onDocSize', (w, h) => {
|
||||||
storeDocumentSettings.changeDocSize(w, h);
|
storeDocumentSettings.changeDocSize(w, h);
|
||||||
});
|
});
|
||||||
const storeFocusObjects = this.props.storeFocusObjects;
|
|
||||||
this.api.asc_registerCallback('asc_onFocusObject', objects => {
|
|
||||||
storeFocusObjects.resetFocusObjects(objects);
|
|
||||||
});
|
|
||||||
|
|
||||||
//text settings
|
//text settings
|
||||||
const storeTextSettings = this.props.storeTextSettings;
|
const storeTextSettings = this.props.storeTextSettings;
|
||||||
this.api.asc_registerCallback('asc_onInitEditorFonts', (fonts, select) => {
|
EditorUIController.initFonts(storeTextSettings);
|
||||||
storeTextSettings.initEditorFonts(fonts, select);
|
EditorUIController.initFocusObjects(this.props.storeFocusObjects);
|
||||||
});
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
this.api.asc_registerCallback('asc_onVerticalAlign', (typeBaseline) => {
|
this.api.asc_registerCallback('asc_onVerticalAlign', (typeBaseline) => {
|
||||||
storeTextSettings.resetTypeBaseline(typeBaseline);
|
storeTextSettings.resetTypeBaseline(typeBaseline);
|
||||||
});
|
});
|
||||||
|
@ -482,23 +460,14 @@ class MainController extends Component {
|
||||||
});
|
});
|
||||||
|
|
||||||
//paragraph settings
|
//paragraph settings
|
||||||
this.api.asc_setParagraphStylesSizes(330, 38);
|
EditorUIController.initEditorStyles(this.props.storeParagraphSettings);
|
||||||
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);
|
|
||||||
});
|
|
||||||
|
|
||||||
//table settings
|
//table settings
|
||||||
const storeTableSettings = this.props.storeTableSettings;
|
EditorUIController.initTableTemplates(this.props.storeTableSettings);
|
||||||
this.api.asc_registerCallback('asc_onInitTableTemplates', (templates) => {
|
|
||||||
storeTableSettings.initTableTemplates(templates);
|
|
||||||
});
|
|
||||||
|
|
||||||
//chart settings
|
//chart settings
|
||||||
const storeChartSettings = this.props.storeChartSettings;
|
const storeChartSettings = this.props.storeChartSettings;
|
||||||
|
const storeFocusObjects = this.props.storeFocusObjects;
|
||||||
this.api.asc_registerCallback('asc_onUpdateChartStyles', () => {
|
this.api.asc_registerCallback('asc_onUpdateChartStyles', () => {
|
||||||
if (storeFocusObjects.chartObject && storeFocusObjects.chartObject.get_ChartProperties()) {
|
if (storeFocusObjects.chartObject && storeFocusObjects.chartObject.get_ChartProperties()) {
|
||||||
storeChartSettings.updateChartStyles(this.api.asc_getChartPreviews(storeFocusObjects.chartObject.get_ChartProperties().getType()));
|
storeChartSettings.updateChartStyles(this.api.asc_getChartPreviews(storeFocusObjects.chartObject.get_ChartProperties().getType()));
|
||||||
|
|
|
@ -11,4 +11,10 @@ EditorUIController.getToolbarOptions = () => {
|
||||||
return null
|
return null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EditorUIController.initFonts = () => null;
|
||||||
|
EditorUIController.initEditorStyles = () => null;
|
||||||
|
EditorUIController.initFocusObjects = () => null;
|
||||||
|
EditorUIController.filterFocusObjects = () => [];
|
||||||
|
EditorUIController.initTableTemplates = () => null;
|
||||||
|
|
||||||
export default EditorUIController;
|
export default EditorUIController;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import {action, observable, computed, makeObservable} from 'mobx';
|
import {action, observable, computed, makeObservable} from 'mobx';
|
||||||
|
import EditorUIController from '../lib/patch'
|
||||||
|
|
||||||
export class storeFocusObjects {
|
export class storeFocusObjects {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -27,30 +28,7 @@ export class storeFocusObjects {
|
||||||
}
|
}
|
||||||
|
|
||||||
get settings() {
|
get settings() {
|
||||||
const _settings = [];
|
return EditorUIController.filterFocusObjects(this._focusObjects);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get headerType() {
|
get headerType() {
|
||||||
|
|
|
@ -168,9 +168,11 @@ module.exports = {
|
||||||
|
|
||||||
...(env === 'production' ? [
|
...(env === 'production' ? [
|
||||||
new CssMinimizerPlugin({
|
new CssMinimizerPlugin({
|
||||||
processorOptions: {
|
minimizerOptions: {
|
||||||
safe: true,
|
processorOptions: {
|
||||||
map: { inline: false },
|
safe: true,
|
||||||
|
map: { inline: false },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||||
|
|
Loading…
Reference in a new issue