[SSE] Add cell settings (wrap text and shrink to fit) to the right panel

This commit is contained in:
Julia Radzhabova 2020-05-29 15:14:16 +03:00
parent 8e3e359c89
commit d9af2ca0e9
3 changed files with 67 additions and 2 deletions

View file

@ -100,10 +100,25 @@
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<td class="padding-large" colspan=2>
<label class="input-label"><%= scope.textAngle %></label>
<div id="cell-spin-angle" style="display: inline-block;margin-left:5px;"></div>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textControl %></label>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div id="cell-checkbox-wrap"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div id="cell-checkbox-shrink"></div>
</td>
</tr>
<tr class="finish-cell"></tr>
</table>

View file

@ -429,6 +429,22 @@ define([
this.lockedControls.push(this.spnAngle);
this.spnAngle.on('change', _.bind(this.onAngleChange, this));
this.spnAngle.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);});
this.chWrap = new Common.UI.CheckBox({
el: $('#cell-checkbox-wrap'),
labelText: this.strWrap,
disabled: this._locked
});
this.lockedControls.push(this.chWrap);
this.chWrap.on('change', this.onWrapChange.bind(this));
this.chShrink = new Common.UI.CheckBox({
el: $('#cell-checkbox-shrink'),
labelText: this.strShrink,
disabled: this._locked
});
this.lockedControls.push(this.chShrink);
this.chShrink.on('change', this.onShrinkChange.bind(this));
},
createDelayedElements: function() {
@ -452,6 +468,21 @@ define([
this.spnAngle.setValue((value !== null) ? (value==255 ? 0 : value) : '', true);
this._state.CellAngle = value;
}
value = xfs.asc_getWrapText();
if ( this._state.Wrap!==value ) {
this.chWrap.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
this._state.Wrap=value;
}
this.chWrap.setDisabled(xfs.asc_getHorAlign() == AscCommon.align_Justify || this._locked);
value = xfs.asc_getShrinkToFit();
if ( this._state.Shrink!==value ) {
this.chShrink.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
this._state.Shrink=value;
}
this.chShrink.setDisabled((this.chWrap.getValue()=='checked') || this._locked);
this.fill = xfs.asc_getFill();
if (this.fill) {
this.pattern = this.fill.asc_getPatternFill();
@ -1127,6 +1158,19 @@ define([
Common.NotificationCenter.trigger('edit:complete', this);
},
onWrapChange: function(field, newValue, oldValue, eOpts){
if (this.api && !this._noApply)
this.api.asc_setCellTextWrap((field.getValue()=='checked'));
this.chShrink.setDisabled((field.getValue()=='checked') || this._locked);
Common.NotificationCenter.trigger('edit:complete', this);
},
onShrinkChange: function(field, newValue, oldValue, eOpts){
if (this.api && !this._noApply)
this.api.asc_setCellTextShrink((field.getValue()=='checked'));
Common.NotificationCenter.trigger('edit:complete', this);
},
textBorders: 'Border\'s Style',
textBorderColor: 'Color',
textBackColor: 'Background color',
@ -1156,7 +1200,10 @@ define([
textPattern: 'Pattern',
textForeground: 'Foreground color',
textBackground: 'Background color',
textGradient: 'Gradient'
textGradient: 'Gradient',
textControl: 'Text Control',
strWrap: 'Wrap text',
strShrink: 'Shrink to fit'
}, SSE.Views.CellSettings || {}));
});

View file

@ -1255,6 +1255,9 @@
"SSE.Views.CellSettings.tipOuter": "Set outer border only",
"SSE.Views.CellSettings.tipRight": "Set outer right border only",
"SSE.Views.CellSettings.tipTop": "Set outer top border only",
"SSE.Views.CellSettings.textControl": "Text Control",
"SSE.Views.CellSettings.strWrap": "Wrap text",
"SSE.Views.CellSettings.strShrink": "Shrink to fit",
"SSE.Views.ChartSettings.strLineWeight": "Line Weight",
"SSE.Views.ChartSettings.strSparkColor": "Color",
"SSE.Views.ChartSettings.strTemplate": "Template",