Change autocorrect options

This commit is contained in:
Julia Radzhabova 2020-07-03 18:06:34 +03:00
parent 660d38a853
commit 4ca4897e9c
4 changed files with 73 additions and 4 deletions

View file

@ -62,13 +62,25 @@ define([
'<div id="symbol-table-pnl-special">', '<div id="symbol-table-pnl-special">',
'<table cols="1" style="width: 100%;">', '<table cols="1" style="width: 100%;">',
'<tr>', '<tr>',
'<td>', '<td style="padding-bottom: 8px;">',
'<label style="font-weight: bold;margin-bottom: 2px;">' + this.textMathCorrect + '</label>', '<label style="font-weight: bold;">' + this.textMathCorrect + '</label>',
'</td>', '</td>',
'</tr>', '</tr>',
'<tr>', '<tr>',
'<td>', '<td>',
'<div id="auto-correct-math-list" class="" style="width:100%; height: 300px;"></div>', '<label style="width: 117px;">' + this.textReplace + '</label>',
'<label>' + this.textBy + '</label>',
'</td>',
'</tr>',
'<tr>',
'<td>',
'<div id="auto-correct-replace" style="height:22px;width: 115px;margin-right: 2px;display: inline-block;"></div>',
'<div id="auto-correct-by" style="height:22px;width: 299px;display: inline-block;"></div>',
'</td>',
'</tr>',
'<tr>',
'<td>',
'<div id="auto-correct-math-list" class="" style="width:100%; height: 254px;"></div>',
'</td>', '</td>',
'</tr>', '</tr>',
'</table>', '</table>',
@ -89,6 +101,7 @@ define([
Common.UI.Window.prototype.render.call(this); Common.UI.Window.prototype.render.call(this);
var $window = this.getChild(); var $window = this.getChild();
var me = this;
// special // special
this.mathList = new Common.UI.ListView({ this.mathList = new Common.UI.ListView({
@ -104,9 +117,57 @@ define([
].join('')), ].join('')),
scrollAlwaysVisible: true scrollAlwaysVisible: true
}); });
this.mathList.on('item:select', _.bind(this.onSelectMathItem, this));
this.inputReplace = new Common.UI.InputField({
el : $window.find('#auto-correct-replace'),
allowBlank : true,
validateOnChange : true,
validation : function () { return true; }
}).on ('changing', function (input, value) {
if (value.length) {
var store = me.mathList.store;
var _selectedItem = store.find(function(item) {
if ( item.get('replaced').indexOf(value) == 0) {
return true;
}
});
if (_selectedItem) {
me.mathList.selectRecord(_selectedItem, true);
me.mathList.scrollToRecord(_selectedItem);
} else {
me.mathList.deselectAll();
}
} else {
me.mathList.deselectAll();
}
});
this.inputBy = new Common.UI.InputField({
el : $window.find('#auto-correct-by'),
allowBlank : true,
validateOnChange : true,
validation : function () { return true; }
});
// this.inputBy.cmpEl.find('input').css('font-size', '13px');
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
}, },
onSelectMathItem: function(lisvView, itemView, record) {
this.inputReplace.setValue(record.get('replaced'));
this.inputBy.setValue(record.get('by'));
},
show: function() {
Common.UI.Window.prototype.show.apply(this, arguments);
var me = this;
_.delay(function(){
$('input', me.inputReplace.cmpEl).select().focus();
},100);
},
onBtnClick: function(event) { onBtnClick: function(event) {
this.close(); this.close();
}, },
@ -116,7 +177,9 @@ define([
}, },
textTitle: 'AutoCorrect', textTitle: 'AutoCorrect',
textMathCorrect: 'Math AutoCorrect' textMathCorrect: 'Math AutoCorrect',
textReplace: 'Replace:',
textBy: 'By:'
}, Common.Views.AutoCorrectDialog || {})) }, Common.Views.AutoCorrectDialog || {}))
}); });

View file

@ -159,6 +159,8 @@
"Common.Views.About.txtVersion": "Version ", "Common.Views.About.txtVersion": "Version ",
"Common.Views.AutoCorrectDialog.textTitle": "AutoCorrect", "Common.Views.AutoCorrectDialog.textTitle": "AutoCorrect",
"Common.Views.AutoCorrectDialog.textMathCorrect": "Math AutoCorrect", "Common.Views.AutoCorrectDialog.textMathCorrect": "Math AutoCorrect",
"Common.Views.AutoCorrectDialog.textReplace": "Replace:",
"Common.Views.AutoCorrectDialog.textBy": "By:",
"Common.Views.Chat.textSend": "Send", "Common.Views.Chat.textSend": "Send",
"Common.Views.Comments.textAdd": "Add", "Common.Views.Comments.textAdd": "Add",
"Common.Views.Comments.textAddComment": "Add Comment", "Common.Views.Comments.textAddComment": "Add Comment",

View file

@ -60,6 +60,8 @@
"Common.Views.About.txtVersion": "Version ", "Common.Views.About.txtVersion": "Version ",
"Common.Views.AutoCorrectDialog.textTitle": "AutoCorrect", "Common.Views.AutoCorrectDialog.textTitle": "AutoCorrect",
"Common.Views.AutoCorrectDialog.textMathCorrect": "Math AutoCorrect", "Common.Views.AutoCorrectDialog.textMathCorrect": "Math AutoCorrect",
"Common.Views.AutoCorrectDialog.textReplace": "Replace:",
"Common.Views.AutoCorrectDialog.textBy": "By:",
"Common.Views.Chat.textSend": "Send", "Common.Views.Chat.textSend": "Send",
"Common.Views.Comments.textAdd": "Add", "Common.Views.Comments.textAdd": "Add",
"Common.Views.Comments.textAddComment": "Add Comment", "Common.Views.Comments.textAddComment": "Add Comment",

View file

@ -61,6 +61,8 @@
"Common.Views.About.txtVersion": "Version ", "Common.Views.About.txtVersion": "Version ",
"Common.Views.AutoCorrectDialog.textTitle": "AutoCorrect", "Common.Views.AutoCorrectDialog.textTitle": "AutoCorrect",
"Common.Views.AutoCorrectDialog.textMathCorrect": "Math AutoCorrect", "Common.Views.AutoCorrectDialog.textMathCorrect": "Math AutoCorrect",
"Common.Views.AutoCorrectDialog.textReplace": "Replace:",
"Common.Views.AutoCorrectDialog.textBy": "By:",
"Common.Views.Chat.textSend": "Send", "Common.Views.Chat.textSend": "Send",
"Common.Views.Comments.textAdd": "Add", "Common.Views.Comments.textAdd": "Add",
"Common.Views.Comments.textAddComment": "Add Comment", "Common.Views.Comments.textAddComment": "Add Comment",