[SSE] Fix Bug 26581.

This commit is contained in:
Julia Radzhabova 2017-12-05 16:58:01 +03:00
parent 662a7e0c20
commit a8a7a4f917
9 changed files with 178 additions and 5 deletions

View file

@ -120,6 +120,9 @@ define([
bold: undefined,
italic: undefined,
underline: undefined,
strikeout: undefined,
subscript: undefined,
superscript: undefined,
wrap: undefined,
merge: undefined,
angle: undefined,
@ -247,6 +250,9 @@ define([
toolbar.btnBold.on('click', _.bind(this.onBold, this));
toolbar.btnItalic.on('click', _.bind(this.onItalic, this));
toolbar.btnUnderline.on('click', _.bind(this.onUnderline, this));
toolbar.btnStrikeout.on('click', _.bind(this.onStrikeout, this));
toolbar.btnSubscript.on('click', _.bind(this.onSubscript, this));
toolbar.btnSubscript.menu.on('item:click', _.bind(this.onSubscriptMenu, this));
toolbar.btnTextColor.on('click', _.bind(this.onTextColor, this));
toolbar.btnBackColor.on('click', _.bind(this.onBackColor, this));
toolbar.mnuTextColorPicker.on('select', _.bind(this.onTextColorSelect, this));
@ -463,6 +469,51 @@ define([
Common.component.Analytics.trackEvent('ToolBar', 'Underline');
},
onStrikeout: function(btn, e) {
this._state.strikeout = undefined;
if (this.api)
this.api.asc_setCellStrikeout(btn.pressed);
Common.NotificationCenter.trigger('edit:complete', this.toolbar, {restorefocus:true});
Common.component.Analytics.trackEvent('ToolBar', 'Strikeout');
},
onSubscriptMenu: function(menu, item) {
var btnSubscript = this.toolbar.btnSubscript,
iconEl = $('.icon', btnSubscript.cmpEl);
if (item.value == 'sub') {
this._state.subscript = undefined;
this.api.asc_setCellSubscript(item.checked);
} else {
this._state.superscript = undefined;
this.api.asc_setCellSuperscript(item.checked);
}
if (item.checked) {
iconEl.removeClass(btnSubscript.options.icls);
btnSubscript.options.icls = item.options.icls;
iconEl.addClass(btnSubscript.options.icls);
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', (item.value == 'sub') ? 'Subscript' : 'Superscript');
},
onSubscript: function(btn, e) {
var subscript = (btn.options.icls == 'btn-subscript');
if (subscript) {
this._state.subscript = undefined;
this.api.asc_setCellSubscript(btn.pressed);
} else {
this._state.superscript = undefined;
this.api.asc_setCellSuperscript(btn.pressed);
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', (subscript) ? 'Subscript' : 'Superscript');
},
onTextColor: function() {
this.toolbar.mnuTextColorPicker.trigger('select', this.toolbar.mnuTextColorPicker, this.toolbar.mnuTextColorPicker.currentColor, true);
},
@ -1648,7 +1699,7 @@ define([
toolbar.lockToolbar(SSE.enumLock.editFormula, is_formula,
{ array: [toolbar.cmbFontName, toolbar.cmbFontSize, toolbar.btnIncFontSize, toolbar.btnDecFontSize,
toolbar.btnBold, toolbar.btnItalic, toolbar.btnUnderline, toolbar.btnTextColor]});
toolbar.btnBold, toolbar.btnItalic, toolbar.btnUnderline, toolbar.btnStrikeout, toolbar.btnSubscript, toolbar.btnTextColor]});
toolbar.lockToolbar(SSE.enumLock.editText, is_text, {array:[toolbar.btnInsertFormula]});
}
this._state.coauthdisable = undefined;
@ -1706,6 +1757,37 @@ define([
toolbar.btnUnderline.toggle(val === true, true);
this._state.underline = val;
}
val = fontobj.asc_getStrikeout();
if (this._state.strikeout !== val) {
toolbar.btnStrikeout.toggle(val === true, true);
this._state.strikeout = val;
}
var subsc = fontobj.asc_getSubscript(),
supersc = fontobj.asc_getSuperscript();
if (this._state.subscript !== subsc || this._state.superscript !== supersc) {
var index = (subsc) ? 0 : (supersc ? 1 : -1),
btnSubscript = toolbar.btnSubscript;
btnSubscript.toggle(index>-1, true);
if (index < 0) {
this._clearChecked(btnSubscript.menu);
} else {
btnSubscript.menu.items[index].setChecked(true);
if (btnSubscript.rendered) {
var iconEl = $('.icon', btnSubscript.cmpEl);
if (iconEl) {
iconEl.removeClass(btnSubscript.options.icls);
btnSubscript.options.icls = btnSubscript.menu.items[index].options.icls;
iconEl.addClass(btnSubscript.options.icls);
}
}
}
this._state.subscript = subsc;
this._state.superscript = supersc;
}
}
/* read font size */
@ -1816,6 +1898,37 @@ define([
toolbar.btnUnderline.toggle(val === true, true);
this._state.underline = val;
}
val = fontobj.asc_getStrikeout();
if (this._state.strikeout !== val) {
toolbar.btnStrikeout.toggle(val === true, true);
this._state.strikeout = val;
}
var subsc = fontobj.asc_getSubscript(),
supersc = fontobj.asc_getSuperscript();
if (this._state.subscript !== subsc || this._state.superscript !== supersc) {
var index = (subsc) ? 0 : (supersc ? 1 : -1),
btnSubscript = toolbar.btnSubscript;
btnSubscript.toggle(index>-1, true);
if (index < 0) {
this._clearChecked(btnSubscript.menu);
} else {
btnSubscript.menu.items[index].setChecked(true);
if (btnSubscript.rendered) {
var iconEl = $('.icon', btnSubscript.cmpEl);
if (iconEl) {
iconEl.removeClass(btnSubscript.options.icls);
btnSubscript.options.icls = btnSubscript.menu.items[index].options.icls;
iconEl.addClass(btnSubscript.options.icls);
}
}
}
this._state.subscript = subsc;
this._state.superscript = supersc;
}
}
/* read font color */

View file

@ -56,6 +56,8 @@
<span class="btn-slot" id="slot-btn-bold"></span>
<span class="btn-slot" id="slot-btn-italic"></span>
<span class="btn-slot" id="slot-btn-underline"></span>
<span class="btn-slot" id="slot-btn-strikeout"></span>
<span class="btn-slot split" id="slot-btn-subscript"></span>
<span class="btn-slot split" id="slot-btn-fontcolor"></span>
<span class="btn-slot split" id="slot-btn-fillparag"></span>
<span class="btn-slot split" id="slot-btn-borders"></span>

View file

@ -411,6 +411,46 @@ define([
enableToggle: true
});
me.btnStrikeout = new Common.UI.Button({
id: 'id-toolbar-btn-strikeout',
cls: 'btn-toolbar',
iconCls: 'btn-strikeout',
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
enableToggle: true
});
me.btnSubscript = new Common.UI.Button({
id : 'id-toolbar-btn-subscript',
cls : 'btn-toolbar',
iconCls : 'btn-subscript',
icls : 'btn-subscript',
split : true,
enableToggle: true,
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
menu : new Common.UI.Menu({
items: [
{
caption : me.textSubscript,
iconCls : 'mnu-text-subscript',
icls : 'btn-subscript',
checkable : true,
allowDepress: true,
toggleGroup : 'textsubscriptgroup',
value : 'sub'
},
{
caption : me.textSuperscript,
iconCls : 'mnu-text-superscript',
icls : 'btn-superscript',
checkable : true,
allowDepress: true,
toggleGroup : 'textsubscriptgroup',
value : 'super'
}
]
})
});
me.mnuTextColorPicker = dummyCmp();
me.btnTextColor = new Common.UI.Button({
id : 'id-toolbar-btn-fontcolor',
@ -1199,7 +1239,7 @@ define([
me.lockControls = [
me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnBold,
me.btnItalic, me.btnUnderline, me.btnTextColor, me.btnHorizontalAlign, me.btnAlignLeft,
me.btnItalic, me.btnUnderline, me.btnStrikeout, me.btnSubscript, me.btnTextColor, me.btnHorizontalAlign, me.btnAlignLeft,
me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust, me.btnVerticalAlign, me.btnAlignTop,
me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor,
me.btnMerge, me.btnInsertFormula, me.btnNamedRange, me.btnIncDecimal, me.btnInsertShape, me.btnInsertEquation,
@ -1214,7 +1254,7 @@ define([
var _temp_array = [me.cmbFontName, me.cmbFontSize, me.btnAlignLeft,me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust,me.btnAlignTop,
me.btnAlignMiddle, me.btnAlignBottom, me.btnHorizontalAlign, me.btnVerticalAlign,
me.btnInsertImage, me.btnInsertText, me.btnInsertTextArt, me.btnInsertShape, me.btnInsertEquation, me.btnIncFontSize,
me.btnDecFontSize, me.btnBold, me.btnItalic, me.btnUnderline, me.btnTextColor, me.btnBackColor,
me.btnDecFontSize, me.btnBold, me.btnItalic, me.btnUnderline, me.btnStrikeout, me.btnSubscript, me.btnTextColor, me.btnBackColor,
me.btnInsertHyperlink, me.btnBorders, me.btnTextOrient, me.btnPercentStyle, me.btnCurrencyStyle, me.btnColorSchemas,
me.btnSettings, me.btnInsertFormula, me.btnNamedRange, me.btnDecDecimal, me.btnIncDecimal, me.cmbNumberFormat, me.btnWrap,
me.btnInsertChart, me.btnMerge, me.btnAddCell, me.btnDeleteCell, me.btnShowMode, me.btnPrint,
@ -1309,6 +1349,8 @@ define([
_injectComponent('#slot-btn-bold', this.btnBold);
_injectComponent('#slot-btn-italic', this.btnItalic);
_injectComponent('#slot-btn-underline', this.btnUnderline);
_injectComponent('#slot-btn-strikeout', this.btnStrikeout);
_injectComponent('#slot-btn-subscript', this.btnSubscript);
_injectComponent('#slot-btn-fontcolor', this.btnTextColor);
_injectComponent('#slot-btn-fillparag', this.btnBackColor);
_injectComponent('#slot-btn-borders', this.btnBorders);
@ -1377,6 +1419,8 @@ define([
_updateHint(this.btnBold, this.textBold + Common.Utils.String.platformKey('Ctrl+B'));
_updateHint(this.btnItalic, this.textItalic + Common.Utils.String.platformKey('Ctrl+I'));
_updateHint(this.btnUnderline, this.textUnderline + Common.Utils.String.platformKey('Ctrl+U'));
_updateHint(this.btnStrikeout, this.textStrikeout);
_updateHint(this.btnSubscript, this.textSubSuperscript);
_updateHint(this.btnTextColor, this.tipFontColor);
_updateHint(this.btnBackColor, this.tipPrColor);
_updateHint(this.btnBorders, this.tipBorders);
@ -1890,6 +1934,10 @@ define([
textBold: 'Bold',
textItalic: 'Italic',
textUnderline: 'Underline',
textStrikeout: 'Strikeout',
textSuperscript: 'Superscript',
textSubscript: 'Subscript',
textSubSuperscript: 'Subscript/Superscript',
tipFontName: 'Font Name',
tipFontSize: 'Font Size',
tipCellStyle: 'Cell Style',

View file

@ -1655,6 +1655,10 @@
"SSE.Views.Toolbar.textTabInsert": "Insert",
"SSE.Views.Toolbar.textTopBorders": "Top Borders",
"SSE.Views.Toolbar.textUnderline": "Underline",
"SSE.Views.Toolbar.textStrikeout": "Strikeout",
"SSE.Views.Toolbar.textSuperscript": "Superscript",
"SSE.Views.Toolbar.textSubscript": "Subscript",
"SSE.Views.Toolbar.textSubSuperscript": "Subscript/Superscript",
"SSE.Views.Toolbar.textWinLossSpark": "Win/Loss",
"SSE.Views.Toolbar.textZoom": "Zoom",
"SSE.Views.Toolbar.tipAdvSettings": "Advanced settings",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

@ -30,7 +30,7 @@
}
.font-attr-top {
width: 186px;
width: 243px;
> .btn-slot {
float: left;
@ -167,6 +167,9 @@
.toolbar-btn-icon(btn-named-range, 77, @toolbar-icon-size);
//.toolbar-btn-icon(btn-insertequation, 82, @toolbar-icon-size);
.toolbar-btn-icon(btn-strikeout, 84, @toolbar-icon-size);
.toolbar-btn-icon(btn-subscript, 85, @toolbar-icon-size);
.toolbar-btn-icon(btn-superscript, 86, @toolbar-icon-size);
@menu-icon-size: 22px;
.menu-btn-icon(mnu-align-center, 0, @menu-icon-size);
@ -206,6 +209,9 @@
//
.menu-btn-icon(mnu-border-diagup, 36, @menu-icon-size);
.menu-btn-icon(mnu-border-diagdown, 37, @menu-icon-size);
//
.menu-btn-icon(mnu-text-subscript, 38, @menu-icon-size);
.menu-btn-icon(mnu-text-superscript, 39, @menu-icon-size);
.username-tip {
background-color: #ee3525;
@ -246,7 +252,7 @@
}
#slot-field-fontname {
width: 91px;
width: 148px;
}
#slot-field-fontsize {