[DE] revert dc6db03de9 (Fixed bug with closing menus and combo-boxes from toolbar and right panel, closing left panel and comments)

This commit is contained in:
Julia Radzhabova 2016-07-08 12:12:09 +03:00
parent dc6db03de9
commit 1ccae8d386
13 changed files with 46 additions and 56 deletions

View file

@ -232,7 +232,7 @@ define([
},
onBeforeShowMenu: function(e) {
Common.NotificationCenter.trigger('menu:show', this);
Common.NotificationCenter.trigger('menu:show');
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', this);
Common.NotificationCenter.trigger('menu:hide');
},
onAfterKeydownMenu: function(e) {

View file

@ -147,7 +147,7 @@ define([
},
template: _.template([
'<ul class="dropdown-menu <%= options.cls %>" style="<%= options.style %>" role="menu"></ul>'
'<ul class="dropdown-menu <%= options.cls %>" oo_editor_input="true" style="<%= options.style %>" role="menu"></ul>'
].join('')),
initialize : function(options) {
@ -410,7 +410,7 @@ define([
},
onBeforeShowMenu: function(e) {
Common.NotificationCenter.trigger('menu:show', this);
Common.NotificationCenter.trigger('menu:show');
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', this);
Common.NotificationCenter.trigger('menu:hide');
},
onAfterKeydownMenu: function(e) {

View file

@ -1079,6 +1079,7 @@ define([
if (dialog) {
if (this.popoverComments.length) {
_.delay(function() {
me.api.asc_enableKeyEvents(false);
dialog.commentsView.setFocusToTextBox();
}, 200);
return;
@ -1233,6 +1234,7 @@ 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();
}

View file

@ -155,11 +155,18 @@ 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) {
/*
@ -199,13 +206,21 @@ define([
}
},
'settings:unitschanged':_.bind(this.unitsChanged, this),
'dataview:blur': function(e){
if (!me.isModalShowed)
me.onEditComplete();
'dataview:focus': function(e){
me.api.asc_enableKeyEvents(false);
},
'menu:hide': function(menu){
if (!me.isModalShowed && menu.options.allowEditComplete)
'dataview:blur': function(e){
if (!me.isModalShowed) {
me.api.asc_enableKeyEvents(true);
me.onEditComplete();
}
},
'menu:show': function(e){
me.api.asc_enableKeyEvents(false);
},
'menu:hide': function(e){
if (!me.isModalShowed)
me.api.asc_enableKeyEvents(true);
},
'edit:complete': _.bind(me.onEditComplete, me)
});

View file

@ -201,6 +201,7 @@ 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));
@ -209,6 +210,7 @@ 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));
@ -1105,6 +1107,7 @@ define([
msg: this.textFontSizeErr,
callback: function() {
_.defer(function(btn) {
me.api.asc_enableKeyEvents(false);
$('input', combo.cmpEl).focus();
})
}
@ -2551,6 +2554,10 @@ define([
Common.component.Analytics.trackEvent('ToolBar', 'Highlight Color');
},
onHideMenus: function(e){
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onSetupCopyStyleButton: function () {
this.modeAlwaysSetStyle = false;

View file

@ -110,6 +110,9 @@ 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);
@ -1613,6 +1616,7 @@ 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) {

View file

@ -108,7 +108,6 @@ 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({
@ -221,7 +220,6 @@ define([
menuStyle: 'min-width: 190px;',
editable: false,
data: this._arrMergeSrc,
allowEditComplete: true,
lock: [_set.noRecipients, _set.lostConnect]
});
this.cmbMergeTo.setValue(this._arrMergeSrc[0].value);

View file

@ -100,7 +100,6 @@ define([
menuStyle: 'min-width: 85px;',
editable: false,
data: this._arrLineRule,
allowEditComplete: true,
disabled: this._locked
});
this.cmbLineRule.setValue('');
@ -159,7 +158,6 @@ 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>') }
@ -201,6 +199,7 @@ 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');
@ -479,6 +478,10 @@ 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;
},

View file

@ -141,7 +141,6 @@ define([
style: 'width: 100%;',
menuStyle: 'min-width: 190px;',
editable: false,
allowEditComplete: true,
data: this._arrFillSrc
});
this.cmbFillSrc.setValue(this._arrFillSrc[0].value);
@ -151,7 +150,6 @@ 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>') }
@ -219,7 +217,6 @@ 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>') }
@ -261,7 +258,6 @@ 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>') }
@ -326,7 +322,6 @@ define([
cls: 'input-group-nr',
menuStyle: 'min-width: 90px;',
editable: false,
allowEditComplete: true,
data: this._arrFillType
});
this.cmbFillType.setValue(this._arrFillType[0].value);
@ -387,7 +382,6 @@ define([
cls: 'input-group-nr',
menuStyle: 'min-width: 90px;',
editable: false,
allowEditComplete: true,
data: this._arrGradType
});
this.cmbGradType.setValue(this._arrGradType[0].value);
@ -437,7 +431,6 @@ 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>') }
@ -498,7 +491,6 @@ 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))
@ -512,7 +504,6 @@ 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>') }
@ -554,7 +545,6 @@ 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));
@ -599,7 +589,6 @@ define([
menu : new Common.UI.Menu({
menuAlign: 'tr-br',
cls: 'menu-shapes',
allowEditComplete: true,
items: []
})
});

View file

@ -208,6 +208,7 @@ define([
this.btnLanguage.cmpEl.on({
'show.bs.dropdown': function () {
_.defer(function(){
me.api.asc_enableKeyEvents(false);
me.btnLanguage.cmpEl.find('ul').focus();
}, 100);
},
@ -233,6 +234,7 @@ define([
});
this.cntZoom.cmpEl.on('show.bs.dropdown', function () {
_.defer(function(){
me.api.asc_enableKeyEvents(false);
me.cntZoom.cmpEl.find('ul').focus();
}, 100);
}
@ -349,6 +351,7 @@ define([
if (me.api && box) {
box.focus(); // for IE
box.parent().removeClass('open');
me.api.asc_enableKeyEvents(true);
}
}

View file

@ -216,7 +216,6 @@ 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');
@ -227,7 +226,6 @@ 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>') }
@ -268,7 +266,6 @@ 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>') }
@ -309,7 +306,6 @@ 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 },

View file

@ -139,7 +139,6 @@ define([
style: 'width: 100%;',
menuStyle: 'min-width: 190px;',
editable: false,
allowEditComplete: true,
data: this._arrFillSrc
});
this.cmbFillSrc.setValue(this._arrFillSrc[0].value);
@ -149,7 +148,6 @@ 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>') }
@ -224,7 +222,6 @@ define([
cls: 'input-group-nr',
menuStyle: 'min-width: 90px;',
editable: false,
allowEditComplete: true,
data: this._arrGradType
});
this.cmbGradType.setValue(this._arrGradType[0].value);
@ -273,7 +270,6 @@ 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>') }
@ -334,7 +330,6 @@ 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))
@ -348,7 +343,6 @@ 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>') }
@ -390,7 +384,6 @@ 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));

View file

@ -244,7 +244,6 @@ 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: '--' },
@ -265,7 +264,6 @@ define([
hint : this.tipFontColor,
split : true,
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [
{
id : 'id-toolbar-menu-auto-fontcolor',
@ -287,7 +285,6 @@ 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>') }
@ -349,7 +346,6 @@ 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'),
@ -412,7 +408,6 @@ 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' },
@ -434,7 +429,6 @@ 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 }
@ -497,7 +491,6 @@ 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' }
@ -512,7 +505,6 @@ 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' }
@ -568,7 +560,6 @@ define([
hint : this.tipPageBreak,
split : true,
menu : new Common.UI.Menu({
allowEditComplete: true,
items : [
{caption: this.textInsPageBreak},
{caption: this.textInsColumnBreak, value: 'column'},
@ -604,7 +595,6 @@ 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' },
@ -655,7 +645,6 @@ 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 },
@ -674,7 +663,6 @@ 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 },
@ -693,7 +681,6 @@ 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 }
@ -717,7 +704,6 @@ 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] },
@ -742,7 +728,6 @@ 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] },
@ -787,7 +772,6 @@ define([
iconCls : 'btn-colorschemas',
hint : this.tipColorSchemas,
menu : new Common.UI.Menu({
allowEditComplete: true,
items: [],
maxHeight : 600,
restoreHeight: 600
@ -834,7 +818,6 @@ 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,
@ -1121,7 +1104,6 @@ define([
cls: 'input-group-nr',
menuStyle: 'min-width: 55px;',
hint: this.tipFontSize,
allowEditComplete: true,
data: [
{ value: 8, displayValue: "8" },
{ value: 9, displayValue: "9" },
@ -1148,7 +1130,6 @@ define([
menuCls: 'scrollable-menu',
menuStyle: 'min-width: 325px;',
hint: this.tipFontName,
allowEditComplete: true,
store: new Common.Collections.Fonts()
});
this.paragraphControls.push(this.cmbFontName);
@ -1567,7 +1548,6 @@ define([
if (this.mnuColorSchema == null) {
this.mnuColorSchema = new Common.UI.Menu({
allowEditComplete: true,
maxHeight : 600,
restoreHeight: 600
}).on('render:after', function(mnu) {