Commit e6e7be6f authored by Julia Radzhabova's avatar Julia Radzhabova

Fixed bugs with focus and keydown events in menus.

parent 1ccae8d3
...@@ -1079,7 +1079,6 @@ define([ ...@@ -1079,7 +1079,6 @@ define([
if (dialog) { if (dialog) {
if (this.popoverComments.length) { if (this.popoverComments.length) {
_.delay(function() { _.delay(function() {
me.api.asc_enableKeyEvents(false);
dialog.commentsView.setFocusToTextBox(); dialog.commentsView.setFocusToTextBox();
}, 200); }, 200);
return; return;
...@@ -1234,7 +1233,6 @@ define([ ...@@ -1234,7 +1233,6 @@ define([
var panel = $('.new-comment-ct', this.view.el); var panel = $('.new-comment-ct', this.view.el);
if (panel && panel.length) { if (panel && panel.length) {
if ('none' !== panel.css('display')) { if ('none' !== panel.css('display')) {
this.api.asc_enableKeyEvents(false);
this.view.txtComment.focus(); this.view.txtComment.focus();
} }
......
...@@ -155,18 +155,11 @@ define([ ...@@ -155,18 +155,11 @@ define([
// Syncronize focus with api // Syncronize focus with api
$(document.body).on('focus', 'input, textarea', function(e) { $(document.body).on('focus', 'input, textarea', function(e) {
if (!/area_id/.test(e.target.id)) { if (!/area_id/.test(e.target.id)) {
me.api.asc_enableKeyEvents(false);
if (/msg-reply/.test(e.target.className)) if (/msg-reply/.test(e.target.className))
me.dontCloseDummyComment = true; me.dontCloseDummyComment = true;
} }
}); });
$("#editor_sdk").focus(function (e) {
if (!me.isModalShowed) {
me.api.asc_enableKeyEvents(true);
}
});
$(document.body).on('blur', 'input, textarea', function(e) { $(document.body).on('blur', 'input, textarea', function(e) {
if (!me.isModalShowed) { if (!me.isModalShowed) {
/* /*
...@@ -207,16 +200,13 @@ define([ ...@@ -207,16 +200,13 @@ define([
}, },
'settings:unitschanged':_.bind(this.unitsChanged, this), 'settings:unitschanged':_.bind(this.unitsChanged, this),
'dataview:focus': function(e){ 'dataview:focus': function(e){
me.api.asc_enableKeyEvents(false);
}, },
'dataview:blur': function(e){ 'dataview:blur': function(e){
if (!me.isModalShowed) { if (!me.isModalShowed) {
me.api.asc_enableKeyEvents(true); me.api.asc_enableKeyEvents(true);
me.onEditComplete();
} }
}, },
'menu:show': function(e){ 'menu:show': function(e){
me.api.asc_enableKeyEvents(false);
}, },
'menu:hide': function(e){ 'menu:hide': function(e){
if (!me.isModalShowed) if (!me.isModalShowed)
......
...@@ -1107,7 +1107,6 @@ define([ ...@@ -1107,7 +1107,6 @@ define([
msg: this.textFontSizeErr, msg: this.textFontSizeErr,
callback: function() { callback: function() {
_.defer(function(btn) { _.defer(function(btn) {
me.api.asc_enableKeyEvents(false);
$('input', combo.cmpEl).focus(); $('input', combo.cmpEl).focus();
}) })
} }
......
...@@ -110,9 +110,6 @@ define([ ...@@ -110,9 +110,6 @@ define([
menu.alignPosition(); menu.alignPosition();
} }
_.delay(function() { _.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(); menu.cmpEl.focus();
}, 10); }, 10);
...@@ -1616,7 +1613,6 @@ define([ ...@@ -1616,7 +1613,6 @@ define([
addComment: function(item, e, eOpt){ addComment: function(item, e, eOpt){
if (this.api && this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) { if (this.api && this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) {
this.suppressEditComplete = true; this.suppressEditComplete = true;
this.api.asc_enableKeyEvents(false);
var controller = DE.getController('Common.Controllers.Comments'); var controller = DE.getController('Common.Controllers.Comments');
if (controller) { if (controller) {
......
...@@ -208,7 +208,6 @@ define([ ...@@ -208,7 +208,6 @@ define([
this.btnLanguage.cmpEl.on({ this.btnLanguage.cmpEl.on({
'show.bs.dropdown': function () { 'show.bs.dropdown': function () {
_.defer(function(){ _.defer(function(){
me.api.asc_enableKeyEvents(false);
me.btnLanguage.cmpEl.find('ul').focus(); me.btnLanguage.cmpEl.find('ul').focus();
}, 100); }, 100);
}, },
...@@ -234,7 +233,6 @@ define([ ...@@ -234,7 +233,6 @@ define([
}); });
this.cntZoom.cmpEl.on('show.bs.dropdown', function () { this.cntZoom.cmpEl.on('show.bs.dropdown', function () {
_.defer(function(){ _.defer(function(){
me.api.asc_enableKeyEvents(false);
me.cntZoom.cmpEl.find('ul').focus(); me.cntZoom.cmpEl.find('ul').focus();
}, 100); }, 100);
} }
......
...@@ -138,17 +138,11 @@ define([ ...@@ -138,17 +138,11 @@ define([
// Syncronize focus with api // Syncronize focus with api
$(document.body).on('focus', 'input, textarea', function(e) { $(document.body).on('focus', 'input, textarea', function(e) {
if (!/area_id/.test(e.target.id)) { if (!/area_id/.test(e.target.id)) {
me.api.asc_enableKeyEvents(false);
if (/msg-reply/.test(e.target.className)) if (/msg-reply/.test(e.target.className))
me.dontCloseDummyComment = true; me.dontCloseDummyComment = true;
} }
}); });
$("#editor_sdk").focus(function (e) {
if (!me.isModalShowed)
me.api.asc_enableKeyEvents(true);
});
$(document.body).on('blur', 'input, textarea', function(e) { $(document.body).on('blur', 'input, textarea', function(e) {
if (!me.isModalShowed) { if (!me.isModalShowed) {
/* /*
...@@ -189,16 +183,13 @@ define([ ...@@ -189,16 +183,13 @@ define([
}, },
'settings:unitschanged':_.bind(this.unitsChanged, this), 'settings:unitschanged':_.bind(this.unitsChanged, this),
'dataview:focus': function(e){ 'dataview:focus': function(e){
me.api.asc_enableKeyEvents(false);
}, },
'dataview:blur': function(e){ 'dataview:blur': function(e){
if (!me.isModalShowed) { if (!me.isModalShowed) {
me.api.asc_enableKeyEvents(true); me.api.asc_enableKeyEvents(true);
me.onEditComplete();
} }
}, },
'menu:show': function(e){ 'menu:show': function(e){
me.api.asc_enableKeyEvents(false);
}, },
'menu:hide': function(e){ 'menu:hide': function(e){
if (!me.isModalShowed) if (!me.isModalShowed)
......
...@@ -1106,7 +1106,6 @@ define([ ...@@ -1106,7 +1106,6 @@ define([
msg: this.textFontSizeErr, msg: this.textFontSizeErr,
callback: function() { callback: function() {
_.defer(function(btn) { _.defer(function(btn) {
me.api.asc_enableKeyEvents(false);
$('input', combo.cmpEl).focus(); $('input', combo.cmpEl).focus();
}) })
} }
......
...@@ -101,9 +101,6 @@ define([ ...@@ -101,9 +101,6 @@ define([
menu.alignPosition(); menu.alignPosition();
} }
_.delay(function() { _.delay(function() {
var value = Common.localStorage.getItem("pe-settings-inputmode"); // only for hieroglyphs mode
if (value!==null && parseInt(value) == 1)
me.api.asc_enableKeyEvents(false);
menu.cmpEl.focus(); menu.cmpEl.focus();
}, 10); }, 10);
...@@ -813,7 +810,6 @@ define([ ...@@ -813,7 +810,6 @@ define([
addComment: function(item, e, eOpt){ addComment: function(item, e, eOpt){
if (this.api && this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) { if (this.api && this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) {
this.suppressEditComplete = true; this.suppressEditComplete = true;
this.api.asc_enableKeyEvents(false);
var controller = PE.getController('Common.Controllers.Comments'); var controller = PE.getController('Common.Controllers.Comments');
if (controller) { if (controller) {
......
...@@ -137,7 +137,6 @@ define([ ...@@ -137,7 +137,6 @@ define([
}); });
this.cntZoom.cmpEl.on('show.bs.dropdown', function () { this.cntZoom.cmpEl.on('show.bs.dropdown', function () {
_.defer(function(){ _.defer(function(){
me.api.asc_enableKeyEvents(false);
me.cntZoom.cmpEl.find('ul').focus(); me.cntZoom.cmpEl.find('ul').focus();
}, 100); }, 100);
} }
......
...@@ -217,7 +217,6 @@ define([ ...@@ -217,7 +217,6 @@ define([
var controller = this.getApplication().getController('FormulaDialog'); var controller = this.getApplication().getController('FormulaDialog');
if (controller) { if (controller) {
$('#ce-func-label', this.editor.el).blur(); $('#ce-func-label', this.editor.el).blur();
this.api.asc_enableKeyEvents(false);
controller.showDialog(); controller.showDialog();
} }
} }
......
...@@ -419,7 +419,6 @@ define([ ...@@ -419,7 +419,6 @@ define([
onInsFunction: function(item) { onInsFunction: function(item) {
var controller = this.getApplication().getController('FormulaDialog'); var controller = this.getApplication().getController('FormulaDialog');
if (controller && this.api) { if (controller && this.api) {
this.api.asc_enableKeyEvents(false);
controller.showDialog(); controller.showDialog();
} }
}, },
...@@ -517,7 +516,6 @@ define([ ...@@ -517,7 +516,6 @@ define([
onAddComment: function(item) { onAddComment: function(item) {
if (this.api && this.permissions.canCoAuthoring && this.permissions.isEdit && this.permissions.canComments) { if (this.api && this.permissions.canCoAuthoring && this.permissions.isEdit && this.permissions.canComments) {
this.api.asc_enableKeyEvents(false);
var controller = SSE.getController('Common.Controllers.Comments'), var controller = SSE.getController('Common.Controllers.Comments'),
cellinfo = this.api.asc_getCellInfo(); cellinfo = this.api.asc_getCellInfo();
......
...@@ -156,12 +156,6 @@ define([ ...@@ -156,12 +156,6 @@ define([
} }
}); });
$("#editor_sdk").focus(function (e) {
if (this.isAppDisabled === true) return;
if (!me.isModalShowed)
me.api.asc_enableKeyEvents(true);
});
$(document.body).on('blur', 'input, textarea', function(e) { $(document.body).on('blur', 'input, textarea', function(e) {
if (this.isAppDisabled === true) return; if (this.isAppDisabled === true) return;
if (!me.isModalShowed && !(me.loadMask && me.loadMask.isVisible()) && !/area_id/.test(e.target.id) && if (!me.isModalShowed && !(me.loadMask && me.loadMask.isVisible()) && !/area_id/.test(e.target.id) &&
...@@ -197,20 +191,17 @@ define([ ...@@ -197,20 +191,17 @@ define([
} }
}, },
'dataview:focus': function(e){ 'dataview:focus': function(e){
// me.api.asc_enableKeyEvents(false);
}, },
'dataview:blur': function(e){ 'dataview:blur': function(e){
if (!me.isModalShowed) { if (!me.isModalShowed) {
// me.api.asc_enableKeyEvents(true); me.api.asc_enableKeyEvents(true);
me.onEditComplete();
} }
}, },
'menu:show': function(e){ 'menu:show': function(e){
// me.api.asc_enableKeyEvents(false);
}, },
'menu:hide': function(e){ 'menu:hide': function(e){
// if (!me.isModalShowed) if (!me.isModalShowed)
// me.api.asc_enableKeyEvents(true); me.api.asc_enableKeyEvents(true);
}, },
'edit:complete': _.bind(this.onEditComplete, this), 'edit:complete': _.bind(this.onEditComplete, this),
'settings:unitschanged':_.bind(this.unitsChanged, this) 'settings:unitschanged':_.bind(this.unitsChanged, this)
......
...@@ -878,7 +878,6 @@ define([ ...@@ -878,7 +878,6 @@ define([
if (item.value === 'more') { if (item.value === 'more') {
var controller = this.getApplication().getController('FormulaDialog'); var controller = this.getApplication().getController('FormulaDialog');
if (controller) { if (controller) {
this.api.asc_enableKeyEvents(false);
controller.showDialog(); controller.showDialog();
} }
} else { } else {
...@@ -1082,7 +1081,6 @@ define([ ...@@ -1082,7 +1081,6 @@ define([
msg: this.textFontSizeErr, msg: this.textFontSizeErr,
callback: function() { callback: function() {
_.defer(function(btn) { _.defer(function(btn) {
me.api.asc_enableKeyEvents(false);
$('input', combo.cmpEl).focus(); $('input', combo.cmpEl).focus();
}) })
} }
......
...@@ -150,7 +150,6 @@ define([ ...@@ -150,7 +150,6 @@ define([
this.cntZoom.cmpEl.on({ this.cntZoom.cmpEl.on({
'show.bs.dropdown': function () { 'show.bs.dropdown': function () {
_.defer(function(){ _.defer(function(){
me.api.asc_enableKeyEvents(false);
me.cntZoom.cmpEl.find('ul').focus(); me.cntZoom.cmpEl.find('ul').focus();
}, 100); }, 100);
}, },
......
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