Merge pull request #1129 from ONLYOFFICE/feature/bug-fixes
Feature/bug fixes
This commit is contained in:
commit
bed8b542ac
|
@ -12,29 +12,7 @@ const PageDocumentFormats = props => {
|
|||
const pageSizesIndex = storeSettings.pageSizesIndex;
|
||||
const pageSizes = storeSettings.getPageSizesList();
|
||||
const textMetric = Common.Utils.Metric.getCurrentMetricName();
|
||||
const margins = props.getMargins();
|
||||
const maxMarginsW = margins.maxMarginsW;
|
||||
const maxMarginsH = margins.maxMarginsH;
|
||||
|
||||
// console.log(margins.left, margins.right, margins.top, margins.bottom);
|
||||
// console.log(maxMarginsW, maxMarginsH);
|
||||
|
||||
const onFormatChange = (value) => {
|
||||
let errorMsg;
|
||||
|
||||
if (margins.left + margins.right > maxMarginsW) {
|
||||
errorMsg = _t.textMarginsW;
|
||||
} else if (margins.top + margins.bottom > maxMarginsH) {
|
||||
errorMsg = _t.textMarginsH;
|
||||
}
|
||||
|
||||
if(errorMsg) {
|
||||
f7.dialog.alert(errorMsg, _t.notcriticalErrorTitle);
|
||||
} else {
|
||||
props.onFormatChange(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<Page>
|
||||
<Navbar title={_t.textDocumentSettings} backLink={_t.textBack} />
|
||||
|
@ -45,7 +23,7 @@ const PageDocumentFormats = props => {
|
|||
subtitle={parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.value[0]).toFixed(2)) + ' ' + textMetric + ' x ' + parseFloat(Common.Utils.Metric.fnRecalcFromMM(item.value[1]).toFixed(2)) + ' ' + textMetric}
|
||||
name="format-size-checkbox"
|
||||
checked={pageSizesIndex === index}
|
||||
onClick={e => onFormatChange(item.value)}
|
||||
onClick={e => props.onFormatChange(item.value)}
|
||||
></ListItem>)}
|
||||
</List>
|
||||
</Page>
|
||||
|
@ -58,6 +36,8 @@ const PageDocumentMargins = props => {
|
|||
const _t = t('Settings', {returnObjects: true});
|
||||
const metricText = Common.Utils.Metric.getMetricName(Common.Utils.Metric.getCurrentMetric());
|
||||
const margins = props.getMargins();
|
||||
const maxMarginsW = margins.maxMarginsW;
|
||||
const maxMarginsH = margins.maxMarginsH;
|
||||
const [stateTop, setTop] = useState(margins.top);
|
||||
const [stateBottom, setBottom] = useState(margins.bottom);
|
||||
const [stateLeft, setLeft] = useState(margins.left);
|
||||
|
@ -65,7 +45,7 @@ const PageDocumentMargins = props => {
|
|||
|
||||
const onChangeMargins = (align, isDecrement) => {
|
||||
const step = Common.Utils.Metric.fnRecalcToMM(Common.Utils.Metric.getCurrentMetric() === Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
|
||||
let marginValue;
|
||||
let marginValue, errorMsg;
|
||||
|
||||
switch (align) {
|
||||
case 'left': marginValue = stateLeft; break;
|
||||
|
@ -77,7 +57,21 @@ const PageDocumentMargins = props => {
|
|||
if (isDecrement) {
|
||||
marginValue = Math.max(0, marginValue - step);
|
||||
} else {
|
||||
marginValue = Math.min((align == 'left' || align == 'right') ? margins.maxMarginsW : margins.maxMarginsH, marginValue + step);
|
||||
if(align == 'left' || align == 'right') {
|
||||
marginValue = Math.min(maxMarginsW, marginValue + step);
|
||||
if(stateLeft + stateRight + step > maxMarginsW)
|
||||
errorMsg = _t.textMarginsW;
|
||||
|
||||
} else {
|
||||
marginValue = Math.min(maxMarginsH, marginValue + step);
|
||||
if(stateTop + stateBottom + step > maxMarginsH)
|
||||
errorMsg = _t.textMarginsH;
|
||||
}
|
||||
|
||||
if(errorMsg) {
|
||||
f7.dialog.alert(errorMsg, _t.notcriticalErrorTitle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (align) {
|
||||
|
|
|
@ -138,7 +138,7 @@ class EditTextController extends Component {
|
|||
} else {
|
||||
typeof size === 'undefined' || size == '' ? api.FontSizeIn() : size = Math.min(300, ++size);
|
||||
}
|
||||
if (typeof size !== 'undefined' || size == '') {
|
||||
if (typeof size !== 'undefined' && size !== '') {
|
||||
api.put_TextPrFontSize(size);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -328,7 +328,6 @@ const EditLayoutContent = ({ editors }) => {
|
|||
const EditTabs = props => {
|
||||
const { t } = useTranslation();
|
||||
const _t = t('View.Edit', {returnObjects: true});
|
||||
|
||||
const store = props.storeFocusObjects;
|
||||
const settings = !store.focusOn ? [] : (store.focusOn === 'obj' ? store.objects : store.selections);
|
||||
let editors = [];
|
||||
|
@ -374,7 +373,7 @@ const EditTabs = props => {
|
|||
component: <EditChartController />
|
||||
})
|
||||
}
|
||||
if (settings.indexOf('hyperlink') > -1) {
|
||||
if (settings.indexOf('hyperlink') > -1 || (props.hyperinfo && props.isAddShapeHyperlink)) {
|
||||
editors.push({
|
||||
caption: _t.textHyperlink,
|
||||
id: 'edit-link',
|
||||
|
@ -404,10 +403,10 @@ const EditView = props => {
|
|||
return (
|
||||
show_popover ?
|
||||
<Popover id="edit-popover" className="popover__titled" onPopoverClosed={() => props.onClosed()}>
|
||||
<EditTabsContainer inPopover={true} onOptionClick={onOptionClick} style={{height: '410px'}} />
|
||||
<EditTabsContainer isAddShapeHyperlink={props.isAddShapeHyperlink} hyperinfo={props.hyperinfo} inPopover={true} onOptionClick={onOptionClick} style={{height: '410px'}} />
|
||||
</Popover> :
|
||||
<Sheet id="edit-sheet" push onSheetClosed={() => props.onClosed()}>
|
||||
<EditTabsContainer onOptionClick={onOptionClick} />
|
||||
<EditTabsContainer isAddShapeHyperlink={props.isAddShapeHyperlink} hyperinfo={props.hyperinfo} onOptionClick={onOptionClick} />
|
||||
</Sheet>
|
||||
)
|
||||
};
|
||||
|
@ -428,8 +427,13 @@ const EditOptions = props => {
|
|||
props.onclosed();
|
||||
};
|
||||
|
||||
const api = Common.EditorApi.get();
|
||||
const cellinfo = api.asc_getCellInfo();
|
||||
const hyperinfo = cellinfo.asc_getHyperlink();
|
||||
const isAddShapeHyperlink = api.asc_canAddShapeHyperlink();
|
||||
|
||||
return (
|
||||
<EditView usePopover={!Device.phone} onClosed={onviewclosed} />
|
||||
<EditView usePopover={!Device.phone} onClosed={onviewclosed} isAddShapeHyperlink={isAddShapeHyperlink} hyperinfo={hyperinfo} />
|
||||
)
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue