diff --git a/apps/common/main/lib/view/SymbolTableDialog.js b/apps/common/main/lib/view/SymbolTableDialog.js index a1755132e..d1afd2dbb 100644 --- a/apps/common/main/lib/view/SymbolTableDialog.js +++ b/apps/common/main/lib/view/SymbolTableDialog.js @@ -489,9 +489,18 @@ define([ var init = (aFontSelects.length<1); init && this.initFonts(); + //fill recents + this.fillRecentSymbols(); + + var lastfont; if (options.font) { + lastfont = options.font; + } else if (aRecents.length>0) { + lastfont = aRecents[0].font; + } + if (lastfont) { for(var i = 0; i < aFontSelects.length; ++i){ - if(aFontSelects[i].displayValue === options.font){ + if(aFontSelects[i].displayValue === lastfont){ nCurrentFont = i; break; } @@ -526,6 +535,8 @@ define([ nCurrentSymbol = options.code; } else if (options.symbol) { nCurrentSymbol = this.fixedCharCodeAt(options.symbol, 0); + } else if (aRecents.length>0) { + nCurrentSymbol = aRecents[0].symbol; } if (init && this.options.lang && this.options.lang != 'en') { @@ -539,6 +550,8 @@ define([ this.on('resizing', _.bind(this.onWindowResizing, this)); this.on('resize', _.bind(this.onWindowResize, this)); + + bMainFocus = true; }, initFonts: function() { @@ -705,9 +718,6 @@ define([ me.updateInput(); }); - //fill recents - this.fillRecentSymbols(); - this.symbolTablePanel = $window.find('#symbol-table-scrollable-div'); this.previewPanel = $window.find('#id-preview-data'); this.previewParent = this.previewPanel.parent(); @@ -822,7 +832,7 @@ define([ this.options.handler.call(this, this, state, settings); } if (state=='ok') { - !special && settings.updateRecents && this.checkRecent(nCurrentSymbol, settings.font); + !special && this.checkRecent(nCurrentSymbol, settings.font); !special && settings.updateRecents && this.updateRecents(); if (this.type) return; @@ -1050,7 +1060,7 @@ define([ this._handleInput('ok'); else { var settings = this.getPasteSymbol($(e.target).attr('id')); - settings.updateRecents && this.checkRecent(nCurrentSymbol, settings.font); + this.checkRecent(nCurrentSymbol, settings.font); settings.updateRecents && this.updateView(false, undefined, undefined, true); this.fireEvent('symbol:dblclick', this, 'ok', settings); } diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 44d96d76d..49da71c50 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -2658,7 +2658,8 @@ define([ if (this.dlgSymbolTable && this.dlgSymbolTable.isVisible()) return; if (this.api) { - var me = this; + var me = this, + selected = me.api.asc_GetSelectedText(); me.dlgSymbolTable = new Common.Views.SymbolTableDialog({ api: me.api, lang: me.mode.lang, @@ -2666,6 +2667,8 @@ define([ type: 1, special: true, showShortcutKey: true, + font: selected && selected.length>0 ? this.api.get_TextProps().get_TextPr().get_FontFamily().get_Name() : undefined, + symbol: selected && selected.length>0 ? selected.charAt(0) : undefined, buttons: [{value: 'ok', caption: this.textInsert}, 'close'], handler: function(dlg, result, settings) { if (result == 'ok') { diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 5892bd748..25b75df12 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -1866,12 +1866,15 @@ define([ onInsertSymbolClick: function() { if (this.api) { var me = this, + selected = me.api.asc_GetSelectedText(), win = new Common.Views.SymbolTableDialog({ api: me.api, lang: me.toolbar.mode.lang, type: 1, special: true, buttons: [{value: 'ok', caption: this.textInsert}, 'close'], + font: selected && selected.length>0 ? me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name() : undefined, + symbol: selected && selected.length>0 ? selected.charAt(0) : undefined, handler: function(dlg, result, settings) { if (result == 'ok') { me.api.asc_insertSymbol(settings.font ? settings.font : me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(), settings.code, settings.special); diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index e416582c0..f96aecf6a 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -2846,12 +2846,15 @@ define([ onInsertSymbolClick: function() { if (this.api) { var me = this, + selected = me.api.asc_GetSelectedText(), win = new Common.Views.SymbolTableDialog({ api: me.api, lang: me.toolbar.mode.lang, type: 1, special: true, buttons: [{value: 'ok', caption: this.textInsert}, 'close'], + font: selected && selected.length>0 ? me.api.asc_getCellInfo().asc_getXfs().asc_getFontName() : undefined, + symbol: selected && selected.length>0 ? selected.charAt(0) : undefined, handler: function(dlg, result, settings) { if (result == 'ok') { me.api.asc_insertSymbol(settings.font ? settings.font : me.api.asc_getCellInfo().asc_getXfs().asc_getFontName(), settings.code, settings.special);