Merge pull request #1141 from ONLYOFFICE/feature/bug-fixes
Feature/bug fixes
This commit is contained in:
commit
3fbd41e9f7
|
@ -104,7 +104,7 @@ class ContextMenuController extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onApiOpenContextMenu(x, y) {
|
onApiOpenContextMenu(x, y) {
|
||||||
if ( !this.state.opened && $$('.dialog.modal-in, .popover.modal-in, .sheet-modal.modal-in, .popup.modal-in, #pe-preview, .add-comment-popup').length < 1) {
|
if ( !this.state.opened && $$('.dialog.modal-in, .popover.modal-in, .sheet-modal.modal-in, .popup.modal-in, #pe-preview, .add-comment-popup, .actions-modal.modal-in').length < 1) {
|
||||||
this.setState({
|
this.setState({
|
||||||
items: this.initMenuItems(),
|
items: this.initMenuItems(),
|
||||||
extraItems: this.initExtraItems()
|
extraItems: this.initExtraItems()
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
|
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {DocumentSettings} from '../../view/settings/DocumentSettings';
|
import {DocumentSettings} from '../../view/settings/DocumentSettings';
|
||||||
|
import { inject, observer } from 'mobx-react';
|
||||||
|
import { withTranslation } from 'react-i18next';
|
||||||
|
import { f7 } from 'framework7-react';
|
||||||
|
|
||||||
class DocumentSettingsController extends Component {
|
class DocumentSettingsController extends Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super (props);
|
super (props);
|
||||||
this.getMargins = this.getMargins.bind(this);
|
this.getMargins = this.getMargins.bind(this);
|
||||||
this.applyMargins = this.applyMargins.bind(this);
|
this.applyMargins = this.applyMargins.bind(this);
|
||||||
|
this.onFormatChange = this.onFormatChange.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
onPageOrientation (value){
|
onPageOrientation (value){
|
||||||
|
@ -19,24 +22,47 @@ class DocumentSettingsController extends Component {
|
||||||
|
|
||||||
onFormatChange (value) {
|
onFormatChange (value) {
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
|
const storeDocumentSettings = this.props.storeDocumentSettings;
|
||||||
|
|
||||||
|
this.widthDocument = storeDocumentSettings.widthDocument;
|
||||||
|
this.heightDocument = storeDocumentSettings.heightDocument;
|
||||||
|
|
||||||
if (api) {
|
if (api) {
|
||||||
api.change_DocSize(value[0], value[1]);
|
api.change_DocSize(value[0], value[1]);
|
||||||
|
this.getMargins();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getMargins() {
|
getMargins() {
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
|
const { t } = this.props;
|
||||||
|
const _t = t('Settings', {returnObjects: true});
|
||||||
|
|
||||||
if (api) {
|
if (api) {
|
||||||
this.localSectionProps = api.asc_GetSectionProps();
|
this.localSectionProps = api.asc_GetSectionProps();
|
||||||
if (this.localSectionProps) {
|
if (this.localSectionProps) {
|
||||||
this.maxMarginsH = this.localSectionProps.get_H() - 2.6;
|
this.maxMarginsH = this.localSectionProps.get_H() - 2.6;
|
||||||
this.maxMarginsW = this.localSectionProps.get_W() - 12.7;
|
this.maxMarginsW = this.localSectionProps.get_W() - 12.7;
|
||||||
|
|
||||||
const top = this.localSectionProps.get_TopMargin();
|
const top = this.localSectionProps.get_TopMargin();
|
||||||
const bottom = this.localSectionProps.get_BottomMargin();
|
const bottom = this.localSectionProps.get_BottomMargin();
|
||||||
const left = this.localSectionProps.get_LeftMargin();
|
const left = this.localSectionProps.get_LeftMargin();
|
||||||
const right = this.localSectionProps.get_RightMargin();
|
const right = this.localSectionProps.get_RightMargin();
|
||||||
|
|
||||||
|
let errorMsg;
|
||||||
|
|
||||||
|
if(top + bottom > this.maxMarginsH || left + right > this.maxMarginsW) {
|
||||||
|
if(top + bottom > this.maxMarginsH) {
|
||||||
|
errorMsg = _t.textMarginsH;
|
||||||
|
} else {
|
||||||
|
errorMsg = _t.textMarginsH;
|
||||||
|
}
|
||||||
|
|
||||||
|
f7.dialog.alert(errorMsg, _t.notcriticalErrorTitle);
|
||||||
|
api.change_DocSize(this.widthDocument, this.heightDocument);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
top,
|
top,
|
||||||
bottom,
|
bottom,
|
||||||
|
@ -96,4 +122,4 @@ class DocumentSettingsController extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default DocumentSettingsController;
|
export default inject("storeDocumentSettings")(observer(withTranslation()(DocumentSettingsController)));
|
|
@ -23,10 +23,10 @@ const StatusbarController = inject('sheets', 'storeFocusObjects', 'users')(obser
|
||||||
api.asc_registerCallback('asc_onActiveSheetChanged', onApiActiveSheetChanged);
|
api.asc_registerCallback('asc_onActiveSheetChanged', onApiActiveSheetChanged);
|
||||||
api.asc_registerCallback('asc_onHidePopMenu', onApiHideTabContextMenu);
|
api.asc_registerCallback('asc_onHidePopMenu', onApiHideTabContextMenu);
|
||||||
api.asc_registerCallback('asc_onUpdateTabColor', onApiUpdateTabColor);
|
api.asc_registerCallback('asc_onUpdateTabColor', onApiUpdateTabColor);
|
||||||
// api.asc_registerCallback('asc_onCoAuthoringDisconnect', onApiDisconnect);
|
api.asc_registerCallback('asc_onCoAuthoringDisconnect', onApiDisconnect);
|
||||||
});
|
});
|
||||||
Common.Notifications.on('document:ready', onApiSheetsChanged);
|
Common.Notifications.on('document:ready', onApiSheetsChanged);
|
||||||
// Common.Notifications.on('api:disconnect', onApiDisconnect);
|
Common.Notifications.on('api:disconnect', onApiDisconnect);
|
||||||
});
|
});
|
||||||
|
|
||||||
const onApiDisconnect = () => {
|
const onApiDisconnect = () => {
|
||||||
|
@ -180,7 +180,7 @@ const Statusbar = inject('sheets', 'storeAppOptions', 'users')(observer(props =>
|
||||||
|
|
||||||
if (index == api.asc_getActiveWorksheetIndex()) {
|
if (index == api.asc_getActiveWorksheetIndex()) {
|
||||||
if (!opened) {
|
if (!opened) {
|
||||||
if (isEdit && !sheets.isWorkbookLocked) {
|
if (isEdit && !isDisconnected) {
|
||||||
api.asc_closeCellEditor();
|
api.asc_closeCellEditor();
|
||||||
f7.popover.open('#idx-tab-context-menu-popover', target);
|
f7.popover.open('#idx-tab-context-menu-popover', target);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,22 +8,23 @@ const viewStyle = {
|
||||||
height: 30
|
height: 30
|
||||||
};
|
};
|
||||||
|
|
||||||
const StatusbarView = inject('storeAppOptions', 'sheets')(observer(props => {
|
const StatusbarView = inject('storeAppOptions', 'sheets', 'users')(observer(props => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const _t = t('Statusbar', {returnObjects: true});
|
const _t = t('Statusbar', {returnObjects: true});
|
||||||
const isAndroid = Device.android;
|
const isAndroid = Device.android;
|
||||||
const isPhone = Device.isPhone;
|
const isPhone = Device.isPhone;
|
||||||
const {sheets, storeAppOptions} = props;
|
const {sheets, storeAppOptions, users} = props;
|
||||||
const allSheets = sheets.sheets;
|
const allSheets = sheets.sheets;
|
||||||
const hiddenSheets = sheets.hiddenWorksheets();
|
const hiddenSheets = sheets.hiddenWorksheets();
|
||||||
const isWorkbookLocked = sheets.isWorkbookLocked;
|
// const isWorkbookLocked = sheets.isWorkbookLocked;
|
||||||
const isEdit = storeAppOptions.isEdit;
|
const isEdit = storeAppOptions.isEdit;
|
||||||
|
const isDisconnected = users.isDisconnected;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<View id="idx-statusbar" className="statusbar" style={viewStyle}>
|
<View id="idx-statusbar" className="statusbar" style={viewStyle}>
|
||||||
<div id="idx-box-add-tab" className={`${isWorkbookLocked ? 'disabled' : ''}`}>
|
<div id="idx-box-add-tab" className={`${isDisconnected ? 'disabled' : ''}`}>
|
||||||
<Link href={false} id="idx-btn-addtab" className={`tab${isWorkbookLocked ? ' disabled' : ''}`} onClick={props.onAddTabClicked}>
|
<Link href={false} id="idx-btn-addtab" className={`tab${isDisconnected ? ' disabled' : ''}`} onClick={props.onAddTabClicked}>
|
||||||
<Icon className="icon icon-plus" />
|
<Icon className="icon icon-plus" />
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -816,7 +816,7 @@ const PageVerticalAxis = props => {
|
||||||
<ListInput
|
<ListInput
|
||||||
label={_t.textMinimumValue}
|
label={_t.textMinimumValue}
|
||||||
type="number"
|
type="number"
|
||||||
placeholder="Auto"
|
placeholder={_t.textAuto}
|
||||||
value={minValue}
|
value={minValue}
|
||||||
onChange={e => props.onVerAxisMinValue(e.target.value)}
|
onChange={e => props.onVerAxisMinValue(e.target.value)}
|
||||||
onInput={e => setMinValue(e.target.value)}
|
onInput={e => setMinValue(e.target.value)}
|
||||||
|
@ -826,7 +826,7 @@ const PageVerticalAxis = props => {
|
||||||
<ListInput
|
<ListInput
|
||||||
label={_t.textMaximumValue}
|
label={_t.textMaximumValue}
|
||||||
type="number"
|
type="number"
|
||||||
placeholder="Auto"
|
placeholder={_t.textAuto}
|
||||||
value={maxValue}
|
value={maxValue}
|
||||||
onChange={e => props.onVerAxisMaxValue(e.target.value)}
|
onChange={e => props.onVerAxisMaxValue(e.target.value)}
|
||||||
onInput={e => setMaxValue(e.target.value)}
|
onInput={e => setMaxValue(e.target.value)}
|
||||||
|
|
Loading…
Reference in a new issue