[de] Add edit of first line of the paragraph

This commit is contained in:
Alexander Yuzhin 2019-03-13 13:59:41 +03:00
parent 0fc75a9ab5
commit 2592bffef1
4 changed files with 49 additions and 3 deletions

View file

@ -54,6 +54,7 @@ define([
var _stack = [], var _stack = [],
_paragraphInfo = {}, _paragraphInfo = {},
_paragraphObject = undefined, _paragraphObject = undefined,
_paragraphProperty = undefined,
_styles = [], _styles = [],
_styleThumbSize, _styleThumbSize,
_styleName, _styleName,
@ -113,6 +114,7 @@ define([
$('#paragraph-distance-before .button').single('click', _.bind(me.onDistanceBefore, me)); $('#paragraph-distance-before .button').single('click', _.bind(me.onDistanceBefore, me));
$('#paragraph-distance-after .button').single('click', _.bind(me.onDistanceAfter, me)); $('#paragraph-distance-after .button').single('click', _.bind(me.onDistanceAfter, me));
$('#paragraph-spin-first-line .button').single('click', _.bind(me.onSpinFirstLine, me));
$('#paragraph-space input:checkbox').single('change', _.bind(me.onSpaceBetween, me)); $('#paragraph-space input:checkbox').single('change', _.bind(me.onSpaceBetween, me));
$('#paragraph-page-break input:checkbox').single('change', _.bind(me.onBreakBefore, me)); $('#paragraph-page-break input:checkbox').single('change', _.bind(me.onBreakBefore, me));
$('#paragraph-page-orphan input:checkbox').single('change', _.bind(me.onOrphan, me)); $('#paragraph-page-orphan input:checkbox').single('change', _.bind(me.onOrphan, me));
@ -127,6 +129,23 @@ define([
initSettings: function () { initSettings: function () {
var me = this; var me = this;
var selectedElements = me.api.getSelectedElements();
if (selectedElements && _.isArray(selectedElements)) {
for (var i = selectedElements.length - 1; i >= 0; i--) {
if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) {
_paragraphProperty = selectedElements[i].get_ObjectValue();
break;
}
}
}
if (_paragraphProperty) {
if (_paragraphProperty.get_Ind()===null || _paragraphProperty.get_Ind()===undefined) {
_paragraphProperty.get_Ind().put_FirstLine(0);
}
$('#paragraph-spin-first-line .item-after label').text(_paragraphProperty.get_Ind().get_FirstLine() + ' ' + metricText);
}
if (_paragraphObject) { if (_paragraphObject) {
_paragraphInfo.spaceBefore = _paragraphObject.get_Spacing().get_Before() < 0 ? _paragraphObject.get_Spacing().get_Before() : Common.Utils.Metric.fnRecalcFromMM(_paragraphObject.get_Spacing().get_Before()); _paragraphInfo.spaceBefore = _paragraphObject.get_Spacing().get_Before() < 0 ? _paragraphObject.get_Spacing().get_Before() : Common.Utils.Metric.fnRecalcFromMM(_paragraphObject.get_Spacing().get_Before());
_paragraphInfo.spaceAfter = _paragraphObject.get_Spacing().get_After() < 0 ? _paragraphObject.get_Spacing().get_After() : Common.Utils.Metric.fnRecalcFromMM(_paragraphObject.get_Spacing().get_After()); _paragraphInfo.spaceAfter = _paragraphObject.get_Spacing().get_After() < 0 ? _paragraphObject.get_Spacing().get_After() : Common.Utils.Metric.fnRecalcFromMM(_paragraphObject.get_Spacing().get_After());
@ -236,12 +255,22 @@ define([
} else { } else {
distance = Math.min(100, ++distance); distance = Math.min(100, ++distance);
} }
},
_paragraphInfo.spaceAfter = distance; onSpinFirstLine: function(e) {
var $button = $(e.currentTarget),
distance = _paragraphProperty.get_Ind().get_FirstLine();
$('#paragraph-distance-after .item-after label').text(_paragraphInfo.spaceAfter < 0 ? 'Auto' : (_paragraphInfo.spaceAfter) + ' ' + metricText); if ($button.hasClass('decrement')) {
distance = Math.max(-999, --distance);
} else {
distance = Math.min(999, ++distance);
}
this.api.put_LineSpacingBeforeAfter(1, (_paragraphInfo.spaceAfter < 0) ? -1 : Common.Utils.Metric.fnRecalcToMM(_paragraphInfo.spaceAfter)); _paragraphProperty.get_Ind().put_FirstLine(distance)
$('#paragraph-spin-first-line .item-after label').text(distance + ' ' + metricText);
this.api.paraApply(_paragraphProperty);
}, },
onSpaceBetween: function (e) { onSpaceBetween: function (e) {

View file

@ -92,6 +92,21 @@
</div> </div>
</div> </div>
</li> </li>
<li id="paragraph-spin-first-line">
<div class="item-content">
<div class="item-inner">
<div class="item-title"><%= scope.textFirstLine %></div>
<div class="item-after splitter">
<% if (!android) { %><label><%= scope.textAuto %></label><% } %>
<p class="buttons-row">
<span class="button decrement no-ripple"><% if (android) { %><i class="icon icon-expand-down"></i><% } else { %>-<% } %></span>
<% if (android) { %><label><%= scope.textAuto %></label><% } %>
<span class="button increment no-ripple"><% if (android) { %><i class="icon icon-expand-up"></i><% } else { %>+<% } %></span>
</p>
</div>
</div>
</div>
</li>
</ul> </ul>
</div> </div>
<div class="list-block"> <div class="list-block">

View file

@ -165,6 +165,7 @@ define([
textFromText: 'Distance from Text', textFromText: 'Distance from Text',
textBefore: 'Before', textBefore: 'Before',
textAuto: 'Auto', textAuto: 'Auto',
textFirstLine: 'First Line',
textAfter: 'After', textAfter: 'After',
textSpaceBetween: 'Space Between Paragraphs', textSpaceBetween: 'Space Between Paragraphs',
textPageBreak: 'Page Break Before', textPageBreak: 'Page Break Before',

View file

@ -273,6 +273,7 @@
"DE.Views.EditParagraph.textAdvSettings": "Дополнительно", "DE.Views.EditParagraph.textAdvSettings": "Дополнительно",
"DE.Views.EditParagraph.textAfter": "После", "DE.Views.EditParagraph.textAfter": "После",
"DE.Views.EditParagraph.textAuto": "Авто", "DE.Views.EditParagraph.textAuto": "Авто",
"DE.Views.EditParagraph.textFirstLine": "Первоя строка",
"DE.Views.EditParagraph.textBack": "Назад", "DE.Views.EditParagraph.textBack": "Назад",
"DE.Views.EditParagraph.textBackground": "Фон", "DE.Views.EditParagraph.textBackground": "Фон",
"DE.Views.EditParagraph.textBefore": "Перед", "DE.Views.EditParagraph.textBefore": "Перед",