Merge pull request #1141 from ONLYOFFICE/feature/bug-fixes

Feature/bug fixes
This commit is contained in:
maxkadushkin 2021-08-31 18:39:12 +03:00 committed by GitHub
commit 3fbd41e9f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 14 deletions

View file

@ -104,7 +104,7 @@ class ContextMenuController extends Component {
}
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({
items: this.initMenuItems(),
extraItems: this.initExtraItems()

View file

@ -1,13 +1,16 @@
import React, {Component} from 'react';
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 {
constructor (props) {
super (props);
this.getMargins = this.getMargins.bind(this);
this.applyMargins = this.applyMargins.bind(this);
this.onFormatChange = this.onFormatChange.bind(this);
}
onPageOrientation (value){
@ -19,13 +22,22 @@ class DocumentSettingsController extends Component {
onFormatChange (value) {
const api = Common.EditorApi.get();
const storeDocumentSettings = this.props.storeDocumentSettings;
this.widthDocument = storeDocumentSettings.widthDocument;
this.heightDocument = storeDocumentSettings.heightDocument;
if (api) {
api.change_DocSize(value[0], value[1]);
this.getMargins();
}
}
getMargins() {
const api = Common.EditorApi.get();
const { t } = this.props;
const _t = t('Settings', {returnObjects: true});
if (api) {
this.localSectionProps = api.asc_GetSectionProps();
if (this.localSectionProps) {
@ -37,6 +49,20 @@ class DocumentSettingsController extends Component {
const left = this.localSectionProps.get_LeftMargin();
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 {
top,
bottom,
@ -96,4 +122,4 @@ class DocumentSettingsController extends Component {
}
}
export default DocumentSettingsController;
export default inject("storeDocumentSettings")(observer(withTranslation()(DocumentSettingsController)));

View file

@ -23,10 +23,10 @@ const StatusbarController = inject('sheets', 'storeFocusObjects', 'users')(obser
api.asc_registerCallback('asc_onActiveSheetChanged', onApiActiveSheetChanged);
api.asc_registerCallback('asc_onHidePopMenu', onApiHideTabContextMenu);
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('api:disconnect', onApiDisconnect);
Common.Notifications.on('api:disconnect', onApiDisconnect);
});
const onApiDisconnect = () => {
@ -180,7 +180,7 @@ const Statusbar = inject('sheets', 'storeAppOptions', 'users')(observer(props =>
if (index == api.asc_getActiveWorksheetIndex()) {
if (!opened) {
if (isEdit && !sheets.isWorkbookLocked) {
if (isEdit && !isDisconnected) {
api.asc_closeCellEditor();
f7.popover.open('#idx-tab-context-menu-popover', target);
}

View file

@ -8,22 +8,23 @@ const viewStyle = {
height: 30
};
const StatusbarView = inject('storeAppOptions', 'sheets')(observer(props => {
const StatusbarView = inject('storeAppOptions', 'sheets', 'users')(observer(props => {
const { t } = useTranslation();
const _t = t('Statusbar', {returnObjects: true});
const isAndroid = Device.android;
const isPhone = Device.isPhone;
const {sheets, storeAppOptions} = props;
const {sheets, storeAppOptions, users} = props;
const allSheets = sheets.sheets;
const hiddenSheets = sheets.hiddenWorksheets();
const isWorkbookLocked = sheets.isWorkbookLocked;
// const isWorkbookLocked = sheets.isWorkbookLocked;
const isEdit = storeAppOptions.isEdit;
const isDisconnected = users.isDisconnected;
return (
<Fragment>
<View id="idx-statusbar" className="statusbar" style={viewStyle}>
<div id="idx-box-add-tab" className={`${isWorkbookLocked ? 'disabled' : ''}`}>
<Link href={false} id="idx-btn-addtab" className={`tab${isWorkbookLocked ? ' disabled' : ''}`} onClick={props.onAddTabClicked}>
<div id="idx-box-add-tab" className={`${isDisconnected ? 'disabled' : ''}`}>
<Link href={false} id="idx-btn-addtab" className={`tab${isDisconnected ? ' disabled' : ''}`} onClick={props.onAddTabClicked}>
<Icon className="icon icon-plus" />
</Link>
</div>

View file

@ -816,7 +816,7 @@ const PageVerticalAxis = props => {
<ListInput
label={_t.textMinimumValue}
type="number"
placeholder="Auto"
placeholder={_t.textAuto}
value={minValue}
onChange={e => props.onVerAxisMinValue(e.target.value)}
onInput={e => setMinValue(e.target.value)}
@ -826,7 +826,7 @@ const PageVerticalAxis = props => {
<ListInput
label={_t.textMaximumValue}
type="number"
placeholder="Auto"
placeholder={_t.textAuto}
value={maxValue}
onChange={e => props.onVerAxisMaxValue(e.target.value)}
onInput={e => setMaxValue(e.target.value)}