Fix opening symbol dialog: select first symbol from the selected text or recent symbol
This commit is contained in:
parent
53618ed3ec
commit
c769995941
|
@ -489,9 +489,18 @@ define([
|
||||||
var init = (aFontSelects.length<1);
|
var init = (aFontSelects.length<1);
|
||||||
init && this.initFonts();
|
init && this.initFonts();
|
||||||
|
|
||||||
|
//fill recents
|
||||||
|
this.fillRecentSymbols();
|
||||||
|
|
||||||
|
var lastfont;
|
||||||
if (options.font) {
|
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){
|
for(var i = 0; i < aFontSelects.length; ++i){
|
||||||
if(aFontSelects[i].displayValue === options.font){
|
if(aFontSelects[i].displayValue === lastfont){
|
||||||
nCurrentFont = i;
|
nCurrentFont = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -526,6 +535,8 @@ define([
|
||||||
nCurrentSymbol = options.code;
|
nCurrentSymbol = options.code;
|
||||||
} else if (options.symbol) {
|
} else if (options.symbol) {
|
||||||
nCurrentSymbol = this.fixedCharCodeAt(options.symbol, 0);
|
nCurrentSymbol = this.fixedCharCodeAt(options.symbol, 0);
|
||||||
|
} else if (aRecents.length>0) {
|
||||||
|
nCurrentSymbol = aRecents[0].symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (init && this.options.lang && this.options.lang != 'en') {
|
if (init && this.options.lang && this.options.lang != 'en') {
|
||||||
|
@ -539,6 +550,8 @@ define([
|
||||||
|
|
||||||
this.on('resizing', _.bind(this.onWindowResizing, this));
|
this.on('resizing', _.bind(this.onWindowResizing, this));
|
||||||
this.on('resize', _.bind(this.onWindowResize, this));
|
this.on('resize', _.bind(this.onWindowResize, this));
|
||||||
|
|
||||||
|
bMainFocus = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
initFonts: function() {
|
initFonts: function() {
|
||||||
|
@ -705,9 +718,6 @@ define([
|
||||||
me.updateInput();
|
me.updateInput();
|
||||||
});
|
});
|
||||||
|
|
||||||
//fill recents
|
|
||||||
this.fillRecentSymbols();
|
|
||||||
|
|
||||||
this.symbolTablePanel = $window.find('#symbol-table-scrollable-div');
|
this.symbolTablePanel = $window.find('#symbol-table-scrollable-div');
|
||||||
this.previewPanel = $window.find('#id-preview-data');
|
this.previewPanel = $window.find('#id-preview-data');
|
||||||
this.previewParent = this.previewPanel.parent();
|
this.previewParent = this.previewPanel.parent();
|
||||||
|
@ -822,7 +832,7 @@ define([
|
||||||
this.options.handler.call(this, this, state, settings);
|
this.options.handler.call(this, this, state, settings);
|
||||||
}
|
}
|
||||||
if (state=='ok') {
|
if (state=='ok') {
|
||||||
!special && settings.updateRecents && this.checkRecent(nCurrentSymbol, settings.font);
|
!special && this.checkRecent(nCurrentSymbol, settings.font);
|
||||||
!special && settings.updateRecents && this.updateRecents();
|
!special && settings.updateRecents && this.updateRecents();
|
||||||
if (this.type)
|
if (this.type)
|
||||||
return;
|
return;
|
||||||
|
@ -1050,7 +1060,7 @@ define([
|
||||||
this._handleInput('ok');
|
this._handleInput('ok');
|
||||||
else {
|
else {
|
||||||
var settings = this.getPasteSymbol($(e.target).attr('id'));
|
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);
|
settings.updateRecents && this.updateView(false, undefined, undefined, true);
|
||||||
this.fireEvent('symbol:dblclick', this, 'ok', settings);
|
this.fireEvent('symbol:dblclick', this, 'ok', settings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2658,7 +2658,8 @@ define([
|
||||||
if (this.dlgSymbolTable && this.dlgSymbolTable.isVisible()) return;
|
if (this.dlgSymbolTable && this.dlgSymbolTable.isVisible()) return;
|
||||||
|
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
var me = this;
|
var me = this,
|
||||||
|
selected = me.api.asc_GetSelectedText();
|
||||||
me.dlgSymbolTable = new Common.Views.SymbolTableDialog({
|
me.dlgSymbolTable = new Common.Views.SymbolTableDialog({
|
||||||
api: me.api,
|
api: me.api,
|
||||||
lang: me.mode.lang,
|
lang: me.mode.lang,
|
||||||
|
@ -2666,6 +2667,8 @@ define([
|
||||||
type: 1,
|
type: 1,
|
||||||
special: true,
|
special: true,
|
||||||
showShortcutKey: 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'],
|
buttons: [{value: 'ok', caption: this.textInsert}, 'close'],
|
||||||
handler: function(dlg, result, settings) {
|
handler: function(dlg, result, settings) {
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
|
|
|
@ -1866,12 +1866,15 @@ define([
|
||||||
onInsertSymbolClick: function() {
|
onInsertSymbolClick: function() {
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
var me = this,
|
var me = this,
|
||||||
|
selected = me.api.asc_GetSelectedText(),
|
||||||
win = new Common.Views.SymbolTableDialog({
|
win = new Common.Views.SymbolTableDialog({
|
||||||
api: me.api,
|
api: me.api,
|
||||||
lang: me.toolbar.mode.lang,
|
lang: me.toolbar.mode.lang,
|
||||||
type: 1,
|
type: 1,
|
||||||
special: true,
|
special: true,
|
||||||
buttons: [{value: 'ok', caption: this.textInsert}, 'close'],
|
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) {
|
handler: function(dlg, result, settings) {
|
||||||
if (result == 'ok') {
|
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);
|
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(), settings.code, settings.special);
|
||||||
|
|
|
@ -2846,12 +2846,15 @@ define([
|
||||||
onInsertSymbolClick: function() {
|
onInsertSymbolClick: function() {
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
var me = this,
|
var me = this,
|
||||||
|
selected = me.api.asc_GetSelectedText(),
|
||||||
win = new Common.Views.SymbolTableDialog({
|
win = new Common.Views.SymbolTableDialog({
|
||||||
api: me.api,
|
api: me.api,
|
||||||
lang: me.toolbar.mode.lang,
|
lang: me.toolbar.mode.lang,
|
||||||
type: 1,
|
type: 1,
|
||||||
special: true,
|
special: true,
|
||||||
buttons: [{value: 'ok', caption: this.textInsert}, 'close'],
|
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) {
|
handler: function(dlg, result, settings) {
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.asc_getCellInfo().asc_getXfs().asc_getFontName(), settings.code, settings.special);
|
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.asc_getCellInfo().asc_getXfs().asc_getFontName(), settings.code, settings.special);
|
||||||
|
|
Loading…
Reference in a new issue