Commit dc6db03d authored by Julia Radzhabova's avatar Julia Radzhabova

[DE] Fixed bug with closing menus and combo-boxes from toolbar and right...

[DE] Fixed bug with closing menus and combo-boxes from toolbar and right panel, closing left panel and comments.
parent 7b48b0d2
......@@ -232,7 +232,7 @@ define([
},
onBeforeShowMenu: function(e) {
Common.NotificationCenter.trigger('menu:show');
Common.NotificationCenter.trigger('menu:show', this);
this.trigger('show:before', this, e);
if (this.options.hint) {
var tip = this.cmpEl.data('bs.tooltip');
......@@ -274,7 +274,7 @@ define([
onAfterHideMenu: function(e) {
this.cmpEl.find('.dropdown-toggle').blur();
this.trigger('hide:after', this, e);
Common.NotificationCenter.trigger('menu:hide');
Common.NotificationCenter.trigger('menu:hide', this);
},
onAfterKeydownMenu: function(e) {
......
......@@ -147,7 +147,7 @@ define([
},
template: _.template([
'<ul class="dropdown-menu <%= options.cls %>" oo_editor_input="true" style="<%= options.style %>" role="menu"></ul>'
'<ul class="dropdown-menu <%= options.cls %>" style="<%= options.style %>" role="menu"></ul>'
].join('')),
initialize : function(options) {
......@@ -410,7 +410,7 @@ define([
},
onBeforeShowMenu: function(e) {
Common.NotificationCenter.trigger('menu:show');
Common.NotificationCenter.trigger('menu:show', this);
if (this.mustLayout) {
delete this.mustLayout;
......@@ -441,7 +441,7 @@ define([
onAfterHideMenu: function(e) {
this.trigger('hide:after', this, e);
Common.NotificationCenter.trigger('menu:hide');
Common.NotificationCenter.trigger('menu:hide', this);
},
onAfterKeydownMenu: function(e) {
......
......@@ -1079,7 +1079,6 @@ define([
if (dialog) {
if (this.popoverComments.length) {
_.delay(function() {
me.api.asc_enableKeyEvents(false);
dialog.commentsView.setFocusToTextBox();
}, 200);
return;
......@@ -1234,7 +1233,6 @@ define([
var panel = $('.new-comment-ct', this.view.el);
if (panel && panel.length) {
if ('none' !== panel.css('display')) {
this.api.asc_enableKeyEvents(false);
this.view.txtComment.focus();
}
......
......@@ -155,18 +155,11 @@ define([
// Syncronize focus with api
$(document.body).on('focus', 'input, textarea', function(e) {
if (!/area_id/.test(e.target.id)) {
me.api.asc_enableKeyEvents(false);
if (/msg-reply/.test(e.target.className))
me.dontCloseDummyComment = true;
}
});
$("#editor_sdk").focus(function (e) {
if (!me.isModalShowed) {
me.api.asc_enableKeyEvents(true);
}
});
$(document.body).on('blur', 'input, textarea', function(e) {
if (!me.isModalShowed) {
/*
......@@ -206,21 +199,13 @@ define([
}
},
'settings:unitschanged':_.bind(this.unitsChanged, this),
'dataview:focus': function(e){
me.api.asc_enableKeyEvents(false);
},
'dataview:blur': function(e){
if (!me.isModalShowed) {
me.api.asc_enableKeyEvents(true);
if (!me.isModalShowed)
me.onEditComplete();
}
},
'menu:show': function(e){
me.api.asc_enableKeyEvents(false);
},
'menu:hide': function(e){
if (!me.isModalShowed)
me.api.asc_enableKeyEvents(true);
'menu:hide': function(menu){
if (!me.isModalShowed && menu.options.allowEditComplete)
me.onEditComplete();
},
'edit:complete': _.bind(me.onEditComplete, me)
});
......
......@@ -201,7 +201,6 @@ define([
toolbar.btnNumbers.on('click', _.bind(this.onNumbers, this));
toolbar.cmbFontName.on('selected', _.bind(this.onFontNameSelect, this));
toolbar.cmbFontName.on('show:after', _.bind(this.onComboOpen, this, true));
toolbar.cmbFontName.on('hide:after', _.bind(this.onHideMenus, this));
toolbar.cmbFontName.on('combo:blur', _.bind(this.onComboBlur, this));
toolbar.cmbFontName.on('combo:focusin', _.bind(this.onComboOpen, this, false));
toolbar.cmbFontSize.on('selected', _.bind(this.onFontSizeSelect, this));
......@@ -210,7 +209,6 @@ define([
toolbar.cmbFontSize.on('combo:blur', _.bind(this.onComboBlur, this));
toolbar.cmbFontSize.on('combo:focusin', _.bind(this.onComboOpen, this, false));
toolbar.cmbFontSize.on('show:after', _.bind(this.onComboOpen, this, true));
toolbar.cmbFontSize.on('hide:after', _.bind(this.onHideMenus, this));
toolbar.mnuMarkersPicker.on('item:click', _.bind(this.onSelectBullets, this, toolbar.btnMarkers));
toolbar.mnuNumbersPicker.on('item:click', _.bind(this.onSelectBullets, this, toolbar.btnNumbers));
toolbar.mnuMultilevelPicker.on('item:click', _.bind(this.onSelectBullets, this, toolbar.btnMultilevels));
......@@ -1107,7 +1105,6 @@ define([
msg: this.textFontSizeErr,
callback: function() {
_.defer(function(btn) {
me.api.asc_enableKeyEvents(false);
$('input', combo.cmpEl).focus();
})
}
......@@ -2554,10 +2551,6 @@ define([
Common.component.Analytics.trackEvent('ToolBar', 'Highlight Color');
},
onHideMenus: function(e){
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onSetupCopyStyleButton: function () {
this.modeAlwaysSetStyle = false;
......
......@@ -110,9 +110,6 @@ define([
menu.alignPosition();
}
_.delay(function() {
var value = Common.localStorage.getItem("de-settings-inputmode"); // only for hieroglyphs mode
if (value!==null && parseInt(value) == 1)
me.api.asc_enableKeyEvents(false);
menu.cmpEl.focus();
}, 10);
......@@ -1616,7 +1613,6 @@ define([
addComment: function(item, e, eOpt){
if (this.api && this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) {
this.suppressEditComplete = true;
this.api.asc_enableKeyEvents(false);
var controller = DE.getController('Common.Controllers.Comments');
if (controller) {
......
......@@ -108,6 +108,7 @@ define([
menu : new Common.UI.Menu({
style: 'min-width: 190px;max-width: 400px;',
maxHeight: 200,
allowEditComplete: true,
items: []
}).on('render:after', function(mnu) {
this.scroller = new Common.UI.Scroller({
......@@ -220,6 +221,7 @@ define([
menuStyle: 'min-width: 190px;',
editable: false,
data: this._arrMergeSrc,
allowEditComplete: true,
lock: [_set.noRecipients, _set.lostConnect]
});
this.cmbMergeTo.setValue(this._arrMergeSrc[0].value);
......
......@@ -100,6 +100,7 @@ define([
menuStyle: 'min-width: 85px;',
editable: false,
data: this._arrLineRule,
allowEditComplete: true,
disabled: this._locked
});
this.cmbLineRule.setValue('');
......@@ -158,6 +159,7 @@ define([
style: "width:45px;",
disabled: this._locked,
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ template: _.template('<div id="paragraph-color-menu" style="width: 165px; height: 220px; margin: 10px;"></div>') },
{ template: _.template('<a id="paragraph-color-new" style="padding-left:12px;">' + me.textNewColor + '</a>') }
......@@ -199,7 +201,6 @@ define([
this.numSpacingAfter.on('change', _.bind(this.onNumSpacingAfterChange, this));
this.chAddInterval.on('change', _.bind(this.onAddIntervalChange, this));
this.cmbLineRule.on('selected', _.bind(this.onLineRuleSelect, this));
this.cmbLineRule.on('hide:after', _.bind(this.onHideMenus, this));
$(this.el).on('click', '#paragraph-advanced-link', _.bind(this.openAdvancedSettings, this));
$(this.el).on('click', '#paragraph-color-new', _.bind(this.addNewColor, this));
this.TextOnlySettings = $('.text-only');
......@@ -478,10 +479,6 @@ define([
this.mnuColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
},
onHideMenus: function(e){
this.fireEvent('editcomplete', this);
},
setLocked: function (locked) {
this._locked = locked;
},
......
......@@ -141,6 +141,7 @@ define([
style: 'width: 100%;',
menuStyle: 'min-width: 190px;',
editable: false,
allowEditComplete: true,
data: this._arrFillSrc
});
this.cmbFillSrc.setValue(this._arrFillSrc[0].value);
......@@ -150,6 +151,7 @@ define([
this.btnBackColor = new Common.UI.ColorButton({
style: "width:45px;",
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ template: _.template('<div id="shape-back-color-menu" style="width: 165px; height: 220px; margin: 10px;"></div>') },
{ template: _.template('<a id="shape-back-color-new" style="padding-left:12px;">' + me.textNewColor + '</a>') }
......@@ -217,6 +219,7 @@ define([
this.btnFGColor = new Common.UI.ColorButton({
style: "width:45px;",
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ template: _.template('<div id="shape-foreground-color-menu" style="width: 165px; height: 220px; margin: 10px;"></div>') },
{ template: _.template('<a id="shape-foreground-color-new" style="padding-left:12px;">' + me.textNewColor + '</a>') }
......@@ -258,6 +261,7 @@ define([
this.btnBGColor = new Common.UI.ColorButton({
style: "width:45px;",
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ template: _.template('<div id="shape-background-color-menu" style="width: 165px; height: 220px; margin: 10px;"></div>') },
{ template: _.template('<a id="shape-background-color-new" style="padding-left:12px;">' + me.textNewColor + '</a>') }
......@@ -322,6 +326,7 @@ define([
cls: 'input-group-nr',
menuStyle: 'min-width: 90px;',
editable: false,
allowEditComplete: true,
data: this._arrFillType
});
this.cmbFillType.setValue(this._arrFillType[0].value);
......@@ -382,6 +387,7 @@ define([
cls: 'input-group-nr',
menuStyle: 'min-width: 90px;',
editable: false,
allowEditComplete: true,
data: this._arrGradType
});
this.cmbGradType.setValue(this._arrGradType[0].value);
......@@ -431,6 +437,7 @@ define([
this.btnGradColor = new Common.UI.ColorButton({
style: "width:45px;",
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ template: _.template('<div id="shape-gradient-color-menu" style="width: 165px; height: 220px; margin: 10px;"></div>') },
{ template: _.template('<a id="shape-gradient-color-new" style="padding-left:12px;">' + me.textNewColor + '</a>') }
......@@ -491,6 +498,7 @@ define([
this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({
el: $('#shape-combo-border-size'),
style: "width: 93px;",
allowEditComplete: true,
txtNoBorders: this.txtNoBorders
})
.on('selected', _.bind(this.onBorderSizeSelect, this))
......@@ -504,6 +512,7 @@ define([
this.btnBorderColor = new Common.UI.ColorButton({
style: "width:45px;",
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ template: _.template('<div id="shape-border-color-menu" style="width: 165px; height: 220px; margin: 10px;"></div>') },
{ template: _.template('<a id="shape-border-color-new" style="padding-left:12px;">' + me.textNewColor + '</a>') }
......@@ -545,6 +554,7 @@ define([
this.cmbBorderType = new Common.UI.ComboBorderType({
el: $('#shape-combo-border-type'),
style: "width: 93px;",
allowEditComplete: true,
menuStyle: 'min-width: 93px;'
}).on('selected', _.bind(this.onBorderTypeSelect, this))
.on('combo:blur', _.bind(this.onComboBlur, this, false));
......@@ -589,6 +599,7 @@ define([
menu : new Common.UI.Menu({
menuAlign: 'tr-br',
cls: 'menu-shapes',
allowEditComplete: true,
items: []
})
});
......
......@@ -208,7 +208,6 @@ define([
this.btnLanguage.cmpEl.on({
'show.bs.dropdown': function () {
_.defer(function(){
me.api.asc_enableKeyEvents(false);
me.btnLanguage.cmpEl.find('ul').focus();
}, 100);
},
......@@ -234,7 +233,6 @@ define([
});
this.cntZoom.cmpEl.on('show.bs.dropdown', function () {
_.defer(function(){
me.api.asc_enableKeyEvents(false);
me.cntZoom.cmpEl.find('ul').focus();
}, 100);
}
......@@ -351,7 +349,6 @@ define([
if (me.api && box) {
box.focus(); // for IE
box.parent().removeClass('open');
me.api.asc_enableKeyEvents(true);
}
}
......
......@@ -216,6 +216,7 @@ define([
this.cmbBorderSize = new Common.UI.ComboBorderSize({
el: $('#table-combo-border-size'),
allowEditComplete: true,
style: "width: 93px;"
});
this.BorderSize = this.cmbBorderSize.store.at(1).get('value');
......@@ -226,6 +227,7 @@ define([
this.btnBorderColor = new Common.UI.ColorButton({
style: "width:45px;",
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ template: _.template('<div id="table-border-color-menu" style="width: 165px; height: 220px; margin: 10px;"></div>') },
{ template: _.template('<a id="table-border-color-new" style="padding-left:12px;">' + me.textNewColor + '</a>') }
......@@ -266,6 +268,7 @@ define([
this.btnBackColor = new Common.UI.ColorButton({
style: "width:45px;",
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ template: _.template('<div id="table-back-color-menu" style="width: 165px; height: 220px; margin: 10px;"></div>') },
{ template: _.template('<a id="table-back-color-new" style="padding-left:12px;">' + me.textNewColor + '</a>') }
......@@ -306,6 +309,7 @@ define([
cls: 'btn-icon-default',
iconCls: 'btn-edit-table',
menu : new Common.UI.Menu({
allowEditComplete: true,
menuAlign: 'tr-br',
items: [
{ caption: this.selectRowText, value: 0 },
......
......@@ -139,6 +139,7 @@ define([
style: 'width: 100%;',
menuStyle: 'min-width: 190px;',
editable: false,
allowEditComplete: true,
data: this._arrFillSrc
});
this.cmbFillSrc.setValue(this._arrFillSrc[0].value);
......@@ -148,6 +149,7 @@ define([
this.btnBackColor = new Common.UI.ColorButton({
style: "width:45px;",
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ template: _.template('<div id="textart-back-color-menu" style="width: 165px; height: 220px; margin: 10px;"></div>') },
{ template: _.template('<a id="textart-back-color-new" style="padding-left:12px;">' + me.textNewColor + '</a>') }
......@@ -222,6 +224,7 @@ define([
cls: 'input-group-nr',
menuStyle: 'min-width: 90px;',
editable: false,
allowEditComplete: true,
data: this._arrGradType
});
this.cmbGradType.setValue(this._arrGradType[0].value);
......@@ -270,6 +273,7 @@ define([
this.btnGradColor = new Common.UI.ColorButton({
style: "width:45px;",
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ template: _.template('<div id="textart-gradient-color-menu" style="width: 165px; height: 220px; margin: 10px;"></div>') },
{ template: _.template('<a id="textart-gradient-color-new" style="padding-left:12px;">' + me.textNewColor + '</a>') }
......@@ -330,6 +334,7 @@ define([
this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({
el: $('#textart-combo-border-size'),
style: "width: 93px;",
allowEditComplete: true,
txtNoBorders: this.txtNoBorders
})
.on('selected', _.bind(this.onBorderSizeSelect, this))
......@@ -343,6 +348,7 @@ define([
this.btnBorderColor = new Common.UI.ColorButton({
style: "width:45px;",
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ template: _.template('<div id="textart-border-color-menu" style="width: 165px; height: 220px; margin: 10px;"></div>') },
{ template: _.template('<a id="textart-border-color-new" style="padding-left:12px;">' + me.textNewColor + '</a>') }
......@@ -384,6 +390,7 @@ define([
this.cmbBorderType = new Common.UI.ComboBorderType({
el: $('#textart-combo-border-type'),
style: "width: 93px;",
allowEditComplete: true,
menuStyle: 'min-width: 93px;'
}).on('selected', _.bind(this.onBorderTypeSelect, this))
.on('combo:blur', _.bind(this.onComboBlur, this, false));
......
......@@ -244,6 +244,7 @@ define([
split : true,
menu : new Common.UI.Menu({
style: 'min-width: 100px;',
allowEditComplete: true,
items: [
{ template: _.template('<div id="id-toolbar-menu-highlight" style="width: 120px; height: 120px; margin: 10px;"></div>') },
{ caption: '--' },
......@@ -264,6 +265,7 @@ define([
hint : this.tipFontColor,
split : true,
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{
id : 'id-toolbar-menu-auto-fontcolor',
......@@ -285,6 +287,7 @@ define([
hint : this.tipPrColor,
split : true,
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ template: _.template('<div id="id-toolbar-menu-paracolor" style="width: 165px; height: 220px; margin: 10px;"></div>') },
{ template: _.template('<a id="id-toolbar-menu-new-paracolor" style="padding-left:12px;">' + this.textNewColor + '</a>') }
......@@ -346,6 +349,7 @@ define([
icls : 'btn-align-left',
menu : new Common.UI.Menu({
cls: 'ppm-toolbar',
allowEditComplete: true,
items: [
{
caption: this.tipAlignLeft + Common.Utils.String.platformKey('Ctrl+L'),
......@@ -408,6 +412,7 @@ define([
hint : this.tipLineSpace,
menu : new Common.UI.Menu({
style: 'min-width: 60px;',
allowEditComplete: true,
items: [
{ caption: '1.0', value: 1.0, checkable: true, toggleGroup: 'linesize' },
{ caption: '1.15', value: 1.15, checkable: true, toggleGroup: 'linesize' },
......@@ -429,6 +434,7 @@ define([
split : true,
menu : new Common.UI.Menu({
style: 'min-width: 60px;',
allowEditComplete: true,
items: [
{ caption: this.mniHiddenChars, value: 'characters', checkable: true },
{ caption: this.mniHiddenBorders, value: 'table', checkable: true }
......@@ -491,6 +497,7 @@ define([
iconCls : 'btn-inserttable',
hint : this.tipInsertTable,
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ template: _.template('<div id="id-toolbar-menu-tablepicker" class="dimension-picker" style="margin: 5px 10px;"></div>') },
{ caption: this.mniCustomTable, value: 'custom' }
......@@ -505,6 +512,7 @@ define([
iconCls : 'btn-insertimage',
hint : this.tipInsertImage,
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ caption: this.mniImageFromFile, value: 'file' },
{ caption: this.mniImageFromUrl, value: 'url' }
......@@ -560,6 +568,7 @@ define([
hint : this.tipPageBreak,
split : true,
menu : new Common.UI.Menu({
allowEditComplete: true,
items : [
{caption: this.textInsPageBreak},
{caption: this.textInsColumnBreak, value: 'column'},
......@@ -595,6 +604,7 @@ define([
iconCls : 'btn-editheader',
hint : this.tipEditHeader,
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ caption: this.mniEditHeader, value: 'header' },
{ caption: this.mniEditFooter, value: 'footer' },
......@@ -645,6 +655,7 @@ define([
hint : this.tipDropCap,
menu : new Common.UI.Menu({
cls: 'ppm-toolbar',
allowEditComplete: true,
items: [
{ caption: this.textNone, iconCls: 'mnu-dropcap-none', checkable: true, toggleGroup: 'menuDropCap', value: Asc.c_oAscDropCap.None, checked: true },
{ caption: this.textInText, iconCls: 'mnu-dropcap-intext', checkable: true, toggleGroup: 'menuDropCap', value: Asc.c_oAscDropCap.Drop },
......@@ -663,6 +674,7 @@ define([
hint : this.tipColumns,
menu : new Common.UI.Menu({
cls: 'ppm-toolbar',
allowEditComplete: true,
items: [
{ caption: this.textColumnsOne, iconCls: 'mnu-columns-one', checkable: true, toggleGroup: 'menuColumns', value: 0 },
{ caption: this.textColumnsTwo, iconCls: 'mnu-columns-two', checkable: true, toggleGroup: 'menuColumns', value: 1 },
......@@ -681,6 +693,7 @@ define([
hint : this.tipPageOrient,
menu : new Common.UI.Menu({
cls: 'ppm-toolbar',
allowEditComplete: true,
items: [
{ caption: this.textPortrait, iconCls: 'mnu-orient-portrait', checkable: true, toggleGroup: 'menuOrient', value: true },
{ caption: this.textLandscape, iconCls: 'mnu-orient-landscape', checkable: true, toggleGroup: 'menuOrient', value: false }
......@@ -704,6 +717,7 @@ define([
iconCls : 'btn-pagemargins',
hint : this.tipPageMargins,
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ caption: this.textMarginsLast, checkable: true, template: pageMarginsTemplate, toggleGroup: 'menuPageMargins'}, //top,left,bottom,right
{ caption: this.textMarginsNormal, checkable: true, template: pageMarginsTemplate, toggleGroup: 'menuPageMargins', value: [20, 30, 20, 15] },
......@@ -728,6 +742,7 @@ define([
iconCls : 'btn-pagesize',
hint : this.tipPageSize,
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{ caption: 'US Letter', subtitle: '21,59cm x 27,94cm', template: pageSizeTemplate, checkable: true, toggleGroup: 'menuPageSize', value: [215.9, 279.4] },
{ caption: 'US Legal', subtitle: '21,59cm x 35,56cm', template: pageSizeTemplate, checkable: true, toggleGroup: 'menuPageSize', value: [215.9, 355.6] },
......@@ -772,6 +787,7 @@ define([
iconCls : 'btn-colorschemas',
hint : this.tipColorSchemas,
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [],
maxHeight : 600,
restoreHeight: 600
......@@ -818,6 +834,7 @@ define([
menu : new Common.UI.Menu({
cls: 'pull-right',
style: 'min-width: 180px;',
allowEditComplete: true,
items: [
this.mnuitemCompactToolbar = new Common.UI.MenuItem({
caption : this.textCompactView,
......@@ -1104,6 +1121,7 @@ define([
cls: 'input-group-nr',
menuStyle: 'min-width: 55px;',
hint: this.tipFontSize,
allowEditComplete: true,
data: [
{ value: 8, displayValue: "8" },
{ value: 9, displayValue: "9" },
......@@ -1130,6 +1148,7 @@ define([
menuCls: 'scrollable-menu',
menuStyle: 'min-width: 325px;',
hint: this.tipFontName,
allowEditComplete: true,
store: new Common.Collections.Fonts()
});
this.paragraphControls.push(this.cmbFontName);
......@@ -1548,6 +1567,7 @@ define([
if (this.mnuColorSchema == null) {
this.mnuColorSchema = new Common.UI.Menu({
allowEditComplete: true,
maxHeight : 600,
restoreHeight: 600
}).on('render:after', function(mnu) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment