From 5d74f76d4d2064d68514580031092247e6e5607d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 12 Nov 2019 15:01:59 +0300 Subject: [PATCH] Fix non-modal mode for symbol table dialog. Update translation --- .../common/main/lib/view/SymbolTableDialog.js | 41 +++++++++---------- .../main/app/controller/Toolbar.js | 11 +++-- apps/documenteditor/main/locale/en.json | 1 + 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/apps/common/main/lib/view/SymbolTableDialog.js b/apps/common/main/lib/view/SymbolTableDialog.js index 24b183c9f..181083aea 100644 --- a/apps/common/main/lib/view/SymbolTableDialog.js +++ b/apps/common/main/lib/view/SymbolTableDialog.js @@ -391,7 +391,7 @@ define([ '
', '
', '
', - '
', + '
', '
', '
', '
', @@ -401,7 +401,7 @@ define([ '', '', '', - '
', + '
', '', '', '', @@ -413,7 +413,7 @@ define([ '', '', '', - '
', + '
', '', '', '
', @@ -561,7 +561,9 @@ define([ } bMainFocus = true; me.updateView(); - me.previewPanel.focus(); + setTimeout(function(){ + me.previewPanel.focus(); + }, 1); }); this.cmbFonts.setValue(nCurrentFont); @@ -575,7 +577,9 @@ define([ nCurrentSymbol = oCurrentRange.Start; bMainFocus = true; me.updateView(undefined, undefined, undefined, undefined, false); - me.previewPanel.focus(); + setTimeout(function(){ + me.previewPanel.focus(); + }, 1); }); this.updateRangeSelector(); @@ -1149,32 +1153,28 @@ define([ var bFill = true; if(bMainFocus){ var nCode = -1; - if ( value === 37 ){//left + if ( value === Common.UI.Keys.LEFT ){//left nCode = this.getCodeByLinearIndex(aRanges, this.getLinearIndexByCode(aRanges, nCurrentSymbol) - 1); } - else if ( value === 38 ){//top + else if ( value === Common.UI.Keys.UP ){//top nCode = this.getCodeByLinearIndex(aRanges, this.getLinearIndexByCode(aRanges, nCurrentSymbol) - this.getColsCount()); } - else if ( value === 39 ){//right + else if ( value === Common.UI.Keys.RIGHT ){//right nCode = this.getCodeByLinearIndex(aRanges, this.getLinearIndexByCode(aRanges, nCurrentSymbol) + 1); } - else if ( value === 40 ){//bottom + else if ( value === Common.UI.Keys.DOWN ){//bottom nCode = this.getCodeByLinearIndex(aRanges, this.getLinearIndexByCode(aRanges, nCurrentSymbol) + this.getColsCount()); } - else if(value === 36){//home + else if(value === Common.UI.Keys.HOME){//home if(aRanges.length > 0){ nCode = aRanges[0].Start; } } - else if(value === 35){//end + else if(value === Common.UI.Keys.END){//end if(aRanges.length > 0){ nCode = aRanges[aRanges.length - 1].End; } } - else if(value === 13){//enter - this.checkRecent(nCurrentSymbol, aFontSelects[nCurrentFont].displayValue); - this.fireEvent('symbol:dblclick', this, {font: aFontSelects[nCurrentFont].displayValue, symbol: this.encodeSurrogateChar(nCurrentSymbol)}); - } else{ bFill = false; } @@ -1186,7 +1186,7 @@ define([ } else{ var oSelectedCell, aStrings; - if ( value === 37 ){//left + if ( value === Common.UI.Keys.LEFT ){//left oSelectedCell = this.$window.find('.cell-selected')[0]; if(oSelectedCell && oSelectedCell.id[0] === 'r'){ var oPresCell = this.$window.find(oSelectedCell).prev(); @@ -1198,7 +1198,7 @@ define([ } } } - else if ( value === 39 ){//right + else if ( value === Common.UI.Keys.RIGHT ){//right oSelectedCell = this.$window.find('.cell-selected')[0]; if(oSelectedCell && oSelectedCell.id[0] === 'r'){ var oNextCell = this.$window.find(oSelectedCell).next(); @@ -1210,7 +1210,7 @@ define([ } } } - else if(value === 36){//home + else if(value === Common.UI.Keys.HOME){//home var oFirstCell = this.$window.find('#recent-table').children()[0]; if(oFirstCell){ aStrings = oFirstCell.id.split('_'); @@ -1219,7 +1219,7 @@ define([ this.updateView(false); } } - else if(value === 35){//end + else if(value === Common.UI.Keys.END){//end var aChildren = this.recentPanel.children(); var oLastCell = aChildren[aChildren.length - 1]; if(oLastCell){ @@ -1229,9 +1229,6 @@ define([ this.updateView(false); } } - else if(value === 13){//enter - this.fireEvent('symbol:dblclick', this, {font: aFontSelects[nFontNameRecent].displayValue, symbol: this.encodeSurrogateChar(nCurrentSymbol)}); - } else{ bFill = false; } diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 34bae5604..ed898d49c 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -2480,14 +2480,14 @@ define([ win = new Common.Views.SymbolTableDialog({ api: me.api, lang: me.mode.lang, - // modal: false, - // type: 1, - // buttons: [{value: 'ok', caption: this.textInsert}, 'close'], + modal: false, + type: 1, + buttons: [{value: 'ok', caption: this.textInsert}, 'close'], handler: function(dlg, result, settings) { if (result == 'ok') { me.api.pluginMethod_PasteHtml("" + settings.symbol + ""); - } - Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } else + Common.NotificationCenter.trigger('edit:complete', me.toolbar); } }); win.show(); @@ -2495,7 +2495,6 @@ define([ me.api.pluginMethod_PasteHtml("" + settings.symbol + ""); }); } - Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertSymbol); }, onApiMathTypes: function(equation) { diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index eb1cf3cef..65546eae4 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -996,6 +996,7 @@ "DE.Controllers.Toolbar.txtSymbol_vdots": "Vertical ellipsis", "DE.Controllers.Toolbar.txtSymbol_xsi": "Xi", "DE.Controllers.Toolbar.txtSymbol_zeta": "Zeta", + "DE.Controllers.Toolbar.textInsert": "Insert", "DE.Controllers.Viewport.textFitPage": "Fit to Page", "DE.Controllers.Viewport.textFitWidth": "Fit to Width", "DE.Views.AddNewCaptionLabelDialog.textLabel": "Label:",