Merge pull request #544 from ONLYOFFICE/fix/bugfix

Fix/bugfix
This commit is contained in:
Julia Radzhabova 2020-10-29 13:11:29 +03:00 committed by GitHub
commit bc62c31fe7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 68 additions and 29 deletions

View file

@ -207,7 +207,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty();
this.Spacing = properties.get_Spacing();
}
this.Spacing.put_Before(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
var value = field.getNumberValue();
this.Spacing.put_Before(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value));
}, this));
this.spinners.push(this.numSpacingBefore);
@ -227,7 +228,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty();
this.Spacing = properties.get_Spacing();
}
this.Spacing.put_After(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
var value = field.getNumberValue();
this.Spacing.put_After(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value));
}, this));
this.spinners.push(this.numSpacingAfter);
@ -756,8 +758,10 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
this.numIndentsLeft.setValue(this.LeftIndent!==null ? Common.Utils.Metric.fnRecalcFromMM(this.LeftIndent) : '', true);
this.numIndentsRight.setValue((props.get_Ind() !== null && props.get_Ind().get_Right() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Ind().get_Right()) : '', true);
this.numSpacingBefore.setValue((props.get_Spacing() !== null && props.get_Spacing().get_Before() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_Before()) : '', true);
this.numSpacingAfter.setValue((props.get_Spacing() !== null && props.get_Spacing().get_After() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_After()) : '', true);
var value = props.get_Spacing() ? props.get_Spacing().get_Before() : null;
this.numSpacingBefore.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true);
value = props.get_Spacing() ? props.get_Spacing().get_After() : null;
this.numSpacingAfter.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true);
var linerule = props.get_Spacing().get_LineRule();
this.cmbLineRule.setValue((linerule !== null) ? linerule : '', true);

View file

@ -244,7 +244,7 @@ define([
if ($button.hasClass('decrement')) {
distance = Math.max(-1, distance - step);
} else {
distance = Math.min(maxValue, distance + step);
distance = (distance<0) ? 0 : Math.min(maxValue, distance + step);
}
var distanceFix = parseFloat(distance.toFixed(2));
@ -273,7 +273,7 @@ define([
if ($button.hasClass('decrement')) {
distance = Math.max(-1, distance - step);
} else {
distance = Math.min(maxValue, distance + step);
distance = (distance<0) ? 0 : Math.min(maxValue, distance + step);
}
var distanceFix = parseFloat(distance.toFixed(2));

View file

@ -451,7 +451,8 @@ define([
onApiBullets: function(data) {
var type = data.get_ListType(),
subtype = data.get_ListSubType();
$('.dataview.bullets li').removeClass('active');
$('.dataview.numbers li').removeClass('active');
switch (type) {
case 0:
$('.dataview.bullets li[data-type=' + subtype + ']').addClass('active');
@ -459,6 +460,9 @@ define([
case 1:
$('.dataview.numbers li[data-type=' + subtype + ']').addClass('active');
break;
default:
$('.dataview.bullets li[data-type="-1"]').addClass('active');
$('.dataview.numbers li[data-type="-1"]').addClass('active');
}
},

View file

@ -211,7 +211,7 @@
<div class="item-inner">
<div class="item-input">
<div class="range-slider">
<input type="range" min="0" max="150" value="0" step="1">
<input type="range" min="0" max="55" value="0" step="1">
</div>
</div>
<div class="item-after value">0 pt</div>

View file

@ -210,7 +210,8 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty();
this.Spacing = properties.get_Spacing();
}
this.Spacing.put_Before(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
var value = field.getNumberValue();
this.Spacing.put_Before(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value));
}, this));
this.spinners.push(this.numSpacingBefore);
@ -230,7 +231,8 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty();
this.Spacing = properties.get_Spacing();
}
this.Spacing.put_After(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
var value = field.getNumberValue();
this.Spacing.put_After(value<0 ? -1 : Common.Utils.Metric.fnRecalcToMM(value));
}, this));
this.spinners.push(this.numSpacingAfter);
@ -434,8 +436,10 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this.cmbSpecial.setValue(this.CurSpecial);
this.numSpecialBy.setValue(this.FirstLine!== null ? Math.abs(Common.Utils.Metric.fnRecalcFromMM(this.FirstLine)) : '', true);
this.numSpacingBefore.setValue((props.get_Spacing() !== null && props.get_Spacing().get_Before() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_Before()) : '', true);
this.numSpacingAfter.setValue((props.get_Spacing() !== null && props.get_Spacing().get_After() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.get_Spacing().get_After()) : '', true);
var value = props.get_Spacing() ? props.get_Spacing().get_Before() : null;
this.numSpacingBefore.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true);
value = props.get_Spacing() ? props.get_Spacing().get_After() : null;
this.numSpacingAfter.setValue((value !== null) ? (value<0 ? value : Common.Utils.Metric.fnRecalcFromMM(value)) : '', true);
var linerule = props.get_Spacing().get_LineRule();
this.cmbLineRule.setValue((linerule !== null) ? linerule : '', true);

View file

@ -202,7 +202,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
width: 100,
defaultUnit : "cm",
value: '0.19 cm',
maxValue: 9.34,
maxValue: 55.87,
minValue: 0
});
this.spnMarginLeft.on('change', _.bind(function(field, newValue, oldValue, eOpts){
@ -220,7 +220,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
width: 100,
defaultUnit : "cm",
value: '0.19 cm',
maxValue: 9.34,
maxValue: 55.87,
minValue: 0
});
this.spnMarginRight.on('change', _.bind(function(field, newValue, oldValue, eOpts){

View file

@ -147,7 +147,7 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
width: 85,
defaultUnit : "cm",
value: '0.19 cm',
maxValue: 9.34,
maxValue: 55.87,
minValue: 0
});
this.spnTableMarginLeft.on('change', _.bind(function(field, newValue, oldValue, eOpts){
@ -167,7 +167,7 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
width: 85,
defaultUnit : "cm",
value: '0.19 cm',
maxValue: 9.34,
maxValue: 55.87,
minValue: 0
});
this.spnTableMarginRight.on('change', _.bind(function(field, newValue, oldValue, eOpts){
@ -259,7 +259,7 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
width: 85,
defaultUnit : "cm",
value: '0.19 cm',
maxValue: 9.34,
maxValue: 55.87,
minValue: 0
});
this.spnMarginLeft.on('change', _.bind(function(field, newValue, oldValue, eOpts){
@ -279,7 +279,7 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
width: 85,
defaultUnit : "cm",
value: '0.19 cm',
maxValue: 9.34,
maxValue: 55.87,
minValue: 0
});
this.spnMarginRight.on('change', _.bind(function(field, newValue, oldValue, eOpts){

View file

@ -415,35 +415,58 @@ define([
onDistanceBefore: function (e) {
var $button = $(e.currentTarget),
distance = _paragraphInfo.spaceBefore;
distance = _paragraphInfo.spaceBefore,
step,
maxValue;
if (Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.pt) {
step = 1;
} else {
step = 0.01;
}
maxValue = Common.Utils.Metric.fnRecalcFromMM(558.8);
if ($button.hasClass('decrement')) {
distance = Math.max(-1, --distance);
distance = Math.max(-1, distance - step);
} else {
distance = Math.min(100, ++distance);
distance = (distance<0) ? 0 : Math.min(maxValue, distance + step);
}
var distanceFix = parseFloat(distance.toFixed(2));
_paragraphInfo.spaceBefore = distance;
$('#paragraph-distance-before .item-after label').text(_paragraphInfo.spaceBefore < 0 ? 'Auto' : (_paragraphInfo.spaceBefore) + ' ' + metricText);
$('#paragraph-distance-before .item-after label').text(_paragraphInfo.spaceBefore < 0 ? 'Auto' : distanceFix + ' ' + metricText);
this.api.put_LineSpacingBeforeAfter(0, (_paragraphInfo.spaceBefore < 0) ? -1 : Common.Utils.Metric.fnRecalcToMM(_paragraphInfo.spaceBefore));
},
onDistanceAfter: function (e) {
var $button = $(e.currentTarget),
distance = _paragraphInfo.spaceAfter;
distance = _paragraphInfo.spaceAfter,
step,
maxValue;
if (Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.pt) {
step = 1;
} else {
step = 0.01;
}
maxValue = Common.Utils.Metric.fnRecalcFromMM(558.8);
if ($button.hasClass('decrement')) {
distance = Math.max(-1, --distance);
distance = Math.max(-1, distance - step);
} else {
distance = Math.min(100, ++distance);
distance = (distance<0) ? 0 : Math.min(maxValue, distance + step);
}
var distanceFix = parseFloat(distance.toFixed(2));
_paragraphInfo.spaceAfter = distance;
$('#paragraph-distance-after .item-after label').text(_paragraphInfo.spaceAfter < 0 ? 'Auto' : (_paragraphInfo.spaceAfter) + ' ' + metricText);
$('#paragraph-distance-after .item-after label').text(_paragraphInfo.spaceAfter < 0 ? 'Auto' : distanceFix + ' ' + metricText);
this.api.put_LineSpacingBeforeAfter(1, (_paragraphInfo.spaceAfter < 0) ? -1 : Common.Utils.Metric.fnRecalcToMM(_paragraphInfo.spaceAfter));
},
@ -544,7 +567,8 @@ define([
onApiBullets: function(data) {
var type = data.get_ListType(),
subtype = data.get_ListSubType();
$('.dataview.bullets li').removeClass('active');
$('.dataview.numbers li').removeClass('active');
switch (type) {
case 0:
$('.dataview.bullets li[data-type=' + subtype + ']').addClass('active');
@ -552,6 +576,9 @@ define([
case 1:
$('.dataview.numbers li[data-type=' + subtype + ']').addClass('active');
break;
default:
$('.dataview.bullets li[data-type="-1"]').addClass('active');
$('.dataview.numbers li[data-type="-1"]').addClass('active');
}
},

View file

@ -73,7 +73,7 @@
<div class="item-inner">
<div class="item-input">
<div class="range-slider">
<input type="range" min="0" max="150" value="0" step="1">
<input type="range" min="0" max="55" value="0" step="1">
</div>
</div>
<div class="item-after value">0 pt</div>