[SSE] Improvement for textbox
This commit is contained in:
parent
15f495ee58
commit
857578864d
|
@ -255,7 +255,10 @@ define([
|
||||||
|
|
||||||
this.onApiEndAddShape = function() {
|
this.onApiEndAddShape = function() {
|
||||||
if (this.toolbar.btnInsertShape.pressed) this.toolbar.btnInsertShape.toggle(false, true);
|
if (this.toolbar.btnInsertShape.pressed) this.toolbar.btnInsertShape.toggle(false, true);
|
||||||
if (this.toolbar.btnInsertText.pressed) this.toolbar.btnInsertText.toggle(false, true);
|
if (this.toolbar.btnInsertText.pressed) {
|
||||||
|
this.toolbar.btnInsertText.toggle(false, true);
|
||||||
|
this.toolbar.btnInsertText.menu.clearAll();
|
||||||
|
}
|
||||||
$(document.body).off('mouseup', checkInsertAutoshape);
|
$(document.body).off('mouseup', checkInsertAutoshape);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -401,10 +404,7 @@ define([
|
||||||
toolbar.btnInsertImage.menu.on('item:click', _.bind(this.onInsertImageMenu, this));
|
toolbar.btnInsertImage.menu.on('item:click', _.bind(this.onInsertImageMenu, this));
|
||||||
toolbar.btnInsertHyperlink.on('click', _.bind(this.onHyperlink, this));
|
toolbar.btnInsertHyperlink.on('click', _.bind(this.onHyperlink, this));
|
||||||
toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this));
|
toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this));
|
||||||
toolbar.btnInsertText.menu.on('item:click', _.bind(function(btn, e) {
|
toolbar.btnInsertText.menu.on('item:click', _.bind(this.onMenuInsertTextClick, this));
|
||||||
this.toolbar.btnInsertText.toggle(true);
|
|
||||||
this.onBtnInsertTextClick(e.value, btn, e);
|
|
||||||
}, this));
|
|
||||||
toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this));
|
toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this));
|
||||||
toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this));
|
toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this));
|
||||||
toolbar.btnInsertSymbol.on('click', _.bind(this.onInsertSymbolClick, this));
|
toolbar.btnInsertSymbol.on('click', _.bind(this.onInsertSymbolClick, this));
|
||||||
|
@ -1251,7 +1251,34 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onBtnInsertTextClick: function(type, btn, e) {
|
onBtnInsertTextClick: function(btn, e) {
|
||||||
|
btn.menu.items.forEach(function(item) {
|
||||||
|
if(item.value == btn.options.textboxType)
|
||||||
|
item.setChecked(true);
|
||||||
|
});
|
||||||
|
if(!this.toolbar.btnInsertText.pressed) {
|
||||||
|
this.toolbar.btnInsertText.menu.clearAll();
|
||||||
|
}
|
||||||
|
this.onInsertText(btn.options.textboxType, btn, e);
|
||||||
|
},
|
||||||
|
|
||||||
|
onMenuInsertTextClick: function(btn, e) {
|
||||||
|
var oldType = this.toolbar.btnInsertText.options.textboxType;
|
||||||
|
var newType = e.value;
|
||||||
|
this.toolbar.btnInsertText.toggle(true);
|
||||||
|
|
||||||
|
if(newType != oldType){
|
||||||
|
this.toolbar.btnInsertText.changeIcon({
|
||||||
|
next: e.options.iconClsForMainBtn,
|
||||||
|
curr: this.toolbar.btnInsertText.menu.items.filter(function(item){return item.value == oldType})[0].options.iconClsForMainBtn
|
||||||
|
});
|
||||||
|
this.toolbar.btnInsertText.updateHint([e.caption, this.views.Toolbar.prototype.tipInsertText]);
|
||||||
|
this.toolbar.btnInsertText.options.textboxType = newType;
|
||||||
|
}
|
||||||
|
this.onInsertText(newType, btn, e);
|
||||||
|
},
|
||||||
|
|
||||||
|
onInsertText: function(type, btn, e) {
|
||||||
if (this.api)
|
if (this.api)
|
||||||
this._addAutoshape(this.toolbar.btnInsertText.pressed, type);
|
this._addAutoshape(this.toolbar.btnInsertText.pressed, type);
|
||||||
|
|
||||||
|
|
|
@ -1225,14 +1225,15 @@ define([
|
||||||
me.btnInsertText = new Common.UI.Button({
|
me.btnInsertText = new Common.UI.Button({
|
||||||
id : 'tlbtn-inserttext',
|
id : 'tlbtn-inserttext',
|
||||||
cls : 'btn-toolbar x-huge icon-top',
|
cls : 'btn-toolbar x-huge icon-top',
|
||||||
iconCls : 'toolbar__icon btn-text',
|
iconCls : 'toolbar__icon btn-subtotals',
|
||||||
caption : me.capInsertText,
|
caption : me.capInsertText,
|
||||||
lock : [_set.editCell, _set.lostConnect, _set.coAuth, _set['Objects']],
|
lock : [_set.editCell, _set.lostConnect, _set.coAuth, _set['Objects']],
|
||||||
enableToggle: true,
|
enableToggle: true,
|
||||||
split : true,
|
split : true,
|
||||||
dataHint : '1',
|
dataHint : '1',
|
||||||
dataHintDirection: 'bottom',
|
dataHintDirection: 'bottom',
|
||||||
dataHintOffset: 'small'
|
dataHintOffset: 'small',
|
||||||
|
textboxType: 'textRect',
|
||||||
});
|
});
|
||||||
|
|
||||||
me.btnInsertTextArt = new Common.UI.Button({
|
me.btnInsertTextArt = new Common.UI.Button({
|
||||||
|
@ -2585,8 +2586,24 @@ define([
|
||||||
if(this.btnInsertText) {
|
if(this.btnInsertText) {
|
||||||
this.btnInsertText.setMenu(new Common.UI.Menu({
|
this.btnInsertText.setMenu(new Common.UI.Menu({
|
||||||
items: [
|
items: [
|
||||||
{caption: this.tipInsertHorizontalText, value: 'textRect'},
|
{
|
||||||
{caption: this.tipInsertVerticalText, value: 'textRectVertical'},
|
caption: this.tipInsertHorizontalText,
|
||||||
|
checkable: true,
|
||||||
|
checkmark: false,
|
||||||
|
iconCls : 'menu__icon text-orient-hor',
|
||||||
|
toggleGroup: 'textbox',
|
||||||
|
value: 'textRect',
|
||||||
|
iconClsForMainBtn: 'btn-subtotals'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: this.tipInsertVerticalText,
|
||||||
|
checkable: true,
|
||||||
|
checkmark: false,
|
||||||
|
iconCls : 'menu__icon text-orient-rup',
|
||||||
|
toggleGroup: 'textbox',
|
||||||
|
value: 'textRectVertical',
|
||||||
|
iconClsForMainBtn: 'btn-pivot-layout'
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue