-
-
+
+
+
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+
+
diff --git a/apps/common/main/lib/view/AutoCorrectDialog.js b/apps/common/main/lib/view/AutoCorrectDialog.js
index 0cea0bf82..abb089090 100644
--- a/apps/common/main/lib/view/AutoCorrectDialog.js
+++ b/apps/common/main/lib/view/AutoCorrectDialog.js
@@ -47,6 +47,8 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
], function (contentTemplate) { 'use strict';
var _mathStore = new Common.UI.DataViewStore();
var _functionsStore = new Common.UI.DataViewStore();
+ var _exciptionsStore = new Common.UI.DataViewStore();
+ var _exciptionsLangs = [0x0409, 0x0419];
Common.Views.AutoCorrectDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: {
@@ -57,7 +59,8 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
},
initialize : function(options) {
- var filter = Common.localStorage.getKeysFilter();
+ var filter = Common.localStorage.getKeysFilter(),
+ me = this;
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
var items = [
@@ -66,7 +69,7 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
];
if (this.appPrefix=='de-' || this.appPrefix=='pe-') {
items.push({panelId: 'id-autocorrect-dialog-settings-de-autoformat', panelCaption: this.textAutoFormat});
- items.push({panelId: 'id-autocorrect-dialog-settings-autocorrect', panelCaption: this.textAutoCorrect});
+ items.push({panelId: 'id-autocorrect-dialog-settings-exceptions', panelCaption: this.textAutoCorrect});
} else if (this.appPrefix=='sse-')
items.push({panelId: 'id-autocorrect-dialog-settings-sse-autoformat', panelCaption: this.textAutoFormat});
@@ -105,6 +108,19 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
this.arrAddRec = value ? JSON.parse(value) : [];
value = Common.Utils.InternalSettings.get(path + "-rem");
this.arrRemRec = value ? JSON.parse(value) : [];
+
+ this.arrAddExceptions = {};
+ this.arrRemExceptions = {};
+ _exciptionsLangs.forEach(function(lang) {
+ path = me.appPrefix + "settings-letter-exception";
+
+ value = Common.Utils.InternalSettings.get(path + "-add-" + lang);
+ me.arrAddExceptions[lang] = value ? JSON.parse(value) : [];
+
+ value = Common.Utils.InternalSettings.get(path + "-rem-" + lang);
+ me.arrRemExceptions[lang] = value ? JSON.parse(value) : [];
+ });
+
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
},
@@ -335,27 +351,121 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
Common.Utils.InternalSettings.set(me.appPrefix + "settings-autoformat-double-space", checked);
me.api.asc_SetAutoCorrectDoubleSpaceWithPeriod(checked);
});
+
+
// AutoCorrect
- this.chFLSentence = new Common.UI.CheckBox({
- el: $window.find('#id-autocorrect-dialog-chk-fl-sentence'),
+ var exciptionsActiveLang = Common.Utils.InternalSettings.get('settings-letter-exception-lang');
+ this.exceptionsLangCmb = new Common.UI.ComboBox({
+ el : $window.find('#auto-correct-exceptions-lang'),
+ style : 'width: 145px;',
+ menuStyle : 'min-width:100%;',
+ editable : false,
+ takeFocusOnClose : true,
+ menuCls : 'menu-aligned',
+ cls : 'input-group-nr',
+ dataHintDirection: 'bottom',
+ data : _exciptionsLangs.map(function(lang){
+ var langName = Common.util.LanguageInfo.getLocalLanguageName(lang);
+ return {
+ displayValue: langName[1],
+ shortName: langName[0],
+ value: lang
+ };
+ })
+ }).on('selected', function(combo, record) {
+ if(exciptionsActiveLang != record.value) {
+ exciptionsActiveLang = record.value;
+ Common.Utils.InternalSettings.set('settings-letter-exception-lang', exciptionsActiveLang);
+ me.onInitExceptionsList(true);
+ me.onChangeInputException(me.exceptionsFindInput, me.exceptionsFindInput.getValue());
+ }
+ });
+
+ if(!exciptionsActiveLang) {
+ var curLangObj = this.exceptionsLangCmb.store.findWhere({value: this.api.asc_getDefaultLanguage()});
+ if (!curLangObj) {
+ var nameLang = Common.util.LanguageInfo.getLocalLanguageName(this.api.asc_getDefaultLanguage())[0].split(/[\-\_]/)[0];
+ curLangObj = this.exceptionsLangCmb.store.find(function(lang){
+ return lang.get('shortName').indexOf(nameLang)==0;
+ });
+ }
+ if(curLangObj) exciptionsActiveLang = curLangObj.get('value');
+ }
+ this.exceptionsLangCmb.setValue(exciptionsActiveLang ? exciptionsActiveLang : _exciptionsLangs[0]);
+
+ this.onInitExceptionsList(true);
+ this.exceptionsList = new Common.UI.ListView({
+ el: $window.find('#auto-correct-exceptions-list'),
+ store: new Common.UI.DataViewStore(_exciptionsStore.slice(0, 6)),
+ simpleAddMode: false,
+ template: _.template(['
'].join('')),
+ itemTemplate: _.template([
+ '
<%= value + "."%>
'
+ ].join('')),
+ scrollAlwaysVisible: true,
+ tabindex: 1
+ });
+ this.exceptionsList.on('item:select', _.bind(this.onSelectExceptionItem, this));
+
+
+ this.exceptionsFindInput = new Common.UI.InputField({
+ el : $window.find('#auto-correct-exceptions-find'),
+ allowBlank : true,
+ validateOnChange : true,
+ maxLength : 255,
+ validation : function () { return true; }
+ }).on ('changing', _.bind(this.onChangeInputException, this));
+
+ this.exceptionsFindInput.cmpEl.find('input').on('keydown', function(event){
+ if (event.key == 'ArrowDown') {
+ var _selectedItem = me.exceptionsList.getSelectedRec() || me.exceptionsList.store.at(0);
+ if (_selectedItem) {
+ me.exceptionsList.selectRecord(_selectedItem);
+ me.exceptionsList.scrollToRecord(_selectedItem);
+ }
+ _.delay(function(){
+ me.exceptionsList.focus();
+ },10);
+
+ }
+ });
+
+ this.btnResetExceptions = new Common.UI.Button({
+ el: $window.find('#auto-correct-btn-exceptions-reset')
+ });
+ this.btnResetExceptions.on('click', _.bind(this.onResetExceptionsToDefault, this));
+
+ this.btnAddExceptions = new Common.UI.Button({
+ el: $window.find('#auto-correct-btn-exceptions-edit')
+ });
+ this.btnAddExceptions.on('click', _.bind(this.onAddException, this, false));
+
+ this.btnDeleteExceptions = new Common.UI.Button({
+ el: $window.find('#auto-correct-btn-exceptions-delete')
+ });
+ this.btnDeleteExceptions.on('click', _.bind(this.onDeleteException, this, false));
+
+
+ this.chkSentenceExceptions = new Common.UI.CheckBox({
+ el: $window.find('#auto-correct-exceptions-chk-sentence'),
labelText: this.textFLSentence,
- value: Common.Utils.InternalSettings.get(this.appPrefix + "settings-autoformat-fl-sentence")
+ value: Common.Utils.InternalSettings.get(this.appPrefix + "settings-letter-exception-sentence")
}).on('change', function(field, newValue, oldValue, eOpts){
var checked = (field.getValue()==='checked');
- Common.localStorage.setBool(me.appPrefix + "settings-autoformat-fl-sentence", checked);
- Common.Utils.InternalSettings.set(me.appPrefix + "settings-autoformat-fl-sentence", checked);
+ Common.localStorage.setBool(me.appPrefix + "settings-letter-exception-sentence", checked);
+ Common.Utils.InternalSettings.set(me.appPrefix + "settings-letter-exception-sentence", checked);
me.api.asc_SetAutoCorrectFirstLetterOfSentences && me.api.asc_SetAutoCorrectFirstLetterOfSentences(checked);
});
- this.chFLCells = new Common.UI.CheckBox({
- el: $window.find('#id-autocorrect-dialog-chk-fl-cells'),
+ this.chkSentenceCells = new Common.UI.CheckBox({
+ el: $window.find('#auto-correct-exceptions-chk-cells'),
labelText: this.textFLCells,
- value: Common.Utils.InternalSettings.get(this.appPrefix + "settings-autoformat-fl-cells")
+ value: Common.Utils.InternalSettings.get(this.appPrefix + "settings-letter-exception-cells")
}).on('change', function(field, newValue, oldValue, eOpts){
var checked = (field.getValue()==='checked');
- Common.localStorage.setBool(me.appPrefix + "settings-autoformat-fl-cells", checked);
- Common.Utils.InternalSettings.set(me.appPrefix + "settings-autoformat-fl-cells", checked);
- me.api.asc_SetAutoCorrectFirstLetterOfCells && me.api.asc_SetAutoCorrectFirstLetterOfCells(checked);
+ Common.localStorage.setBool(me.appPrefix + "settings-letter-exception-cells", checked);
+ Common.Utils.InternalSettings.set(me.appPrefix + "settings-letter-exception-cells", checked);
+ me.api.asc_SetAutoCorrectFirstLetterOfSentences && me.api.asc_SetAutoCorrectFirstLetterOfSentences(checked);
});
this.btnsCategory[3].on('click', _.bind(this.onAutocorrectCategoryClick, this, false));
@@ -392,6 +502,7 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
afterRender: function() {
this.updateControls();
this.updateRecControls();
+ this.updateExceptionsControls();
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName);
this.setActiveCategory((value!==null) ? parseInt(value) : 0);
@@ -402,10 +513,9 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
var arr = [
this.chReplaceType, this.inputReplace, this.inputBy, this.mathList, this.btnReset, this.btnEdit, this.btnDelete, // 0 tab
this.inputRecFind, this.mathRecList, this.btnResetRec, this.btnAddRec, this.btnDeleteRec, // 1 tab
- this.chHyperlink // 2 tab
];
- arr = arr.concat(this.chNewRows ? [this.chNewRows] : [this.chQuotes, this.chHyphens, this.chBulleted, this.chNumbered]);
- arr = arr.concat(this.chFLSentence ? [this.chFLSentence, this.chFLCells] : []);
+ arr = arr.concat(this.chNewRows ? [this.chHyperlink, this.chNewRows] : [this.chQuotes, this.chHyphens, this.chHyperlink, this.chDoubleSpaces, this.chBulleted, this.chNumbered]);
+ arr = arr.concat(this.chkSentenceExceptions ? [this.chkSentenceExceptions, this.chkSentenceCells, this.exceptionsLangCmb, this.exceptionsFindInput, this.exceptionsList, this.btnResetExceptions, this.btnAddExceptions, this.btnDeleteExceptions] : []);
return arr;
},
@@ -481,30 +591,45 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
onAutocorrectCategoryClick: function(delay) {
var me = this;
_.delay(function(){
- me.chFLSentence.focus();
+ $('input', me.exceptionsFindInput.cmpEl).select().focus();
},delay ? 50 : 0);
+
+ if (me.exceptionsList.store.length < _exciptionsStore.length) {
+ _.delay(function(){
+ me.exceptionsList.setStore(_exciptionsStore);
+ me.exceptionsList.onResetItems();
+ },delay ? 100 : 10);
+ }
},
onDelete: function() {
var rec = this.mathList.getSelectedRec();
+ var path = '';
+ var val;
if (rec) {
if (rec.get('defaultValue')) {
- var path = this.appPrefix + "settings-math-correct-rem";
+ path = this.appPrefix + "settings-math-correct-rem";
var disabled = !rec.get('defaultDisabled');
rec.set('defaultDisabled', disabled);
if (disabled)
this.arrRem.push(rec.get('replaced'));
else
this.arrRem.splice(this.arrRem.indexOf(rec.get('replaced')), 1);
- var val = JSON.stringify(this.arrRem);
+ val = JSON.stringify(this.arrRem);
Common.Utils.InternalSettings.set(path, val);
Common.localStorage.setItem(path, val);
this.btnDelete.setCaption(disabled ? this.textRestore : this.textDelete);
disabled ? this.api.asc_deleteFromAutoCorrectMathSymbols(rec.get('replaced')) : this.api.asc_AddOrEditFromAutoCorrectMathSymbols(rec.get('replaced'), rec.get('defaultValue'));
} else {
_mathStore.remove(rec);
+
+ this.arrAdd.splice(this.arrAdd.indexOf(rec.get('replaced')), 1);
+ path = this.appPrefix + "settings-math-correct-add";
+ val = JSON.stringify(this.arrAdd);
+ Common.Utils.InternalSettings.set(path, val);
+ Common.localStorage.setItem(path, val);
this.mathList.scroller && this.mathList.scroller.update({});
- this.api.asc_deleteFromAutoCorrectMathSymbols(rec.get('replaced'));
+ this.api.asc_deleteFromAutoCorrectMathSymbols(rec.get('replaced'));
}
this.updateControls();
}
@@ -746,22 +871,30 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
onDeleteRec: function() {
var rec = this.mathRecList.getSelectedRec();
+ var path;
+ var val;
if (rec) {
if (rec.get('defaultValue')) {
- var path = this.appPrefix + "settings-rec-functions-rem";
+ path = this.appPrefix + "settings-rec-functions-rem";
var disabled = !rec.get('defaultDisabled');
rec.set('defaultDisabled', disabled);
if (disabled)
this.arrRemRec.push(rec.get('value'));
else
this.arrRemRec.splice(this.arrRemRec.indexOf(rec.get('value')), 1);
- var val = JSON.stringify(this.arrRemRec);
+ val = JSON.stringify(this.arrRemRec);
Common.Utils.InternalSettings.set(path, val);
Common.localStorage.setItem(path, val);
this.btnDeleteRec.setCaption(disabled ? this.textRestore : this.textDelete);
disabled ? this.api.asc_deleteFromAutoCorrectMathFunctions(rec.get('value')) : this.api.asc_AddFromAutoCorrectMathFunctions(rec.get('value'));
} else {
_functionsStore.remove(rec);
+
+ this.arrAddRec.splice(this.arrAddRec.indexOf(rec.get('value')), 1);
+ path = this.appPrefix + "settings-rec-functions-add";
+ val = JSON.stringify(this.arrAddRec);
+ Common.Utils.InternalSettings.set(path, val);
+ Common.localStorage.setItem(path, val);
this.mathRecList.scroller && this.mathRecList.scroller.update({});
this.api.asc_deleteFromAutoCorrectMathFunctions(rec.get('value'));
}
@@ -822,6 +955,204 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
this.btnAddRec.setDisabled(!!rec || !value);
},
+ onInitExceptionsList: function(overrideNotEmptyStore) {
+ if (_exciptionsStore.length>0 && !overrideNotEmptyStore) return;
+
+ _exciptionsStore.comparator = function(item1, item2) {
+ var n1 = item1.get('value').toLowerCase(),
+ n2 = item2.get('value').toLowerCase();
+ if (n1==n2) return 0;
+ return (n1
-1
+ });
+ });
+
+ var dataAdd = [];
+ _.each(arrAdd, function(item, index){
+ if (_.findIndex(data, {value: item})<0) {
+ dataAdd.push({
+ value: item,
+ defaultValue: false,
+ defaultDisabled: false
+ });
+ }
+ });
+ _exciptionsStore.reset(data.concat(dataAdd));
+ this.updateExceptionsControls();
+ },
+
+ onResetExceptionsToDefault: function() {
+ var apiFlManager = this.api.asc_GetAutoCorrectSettings().get_FirstLetterExceptionManager();
+ var activeLang = this.exceptionsLangCmb.getValue();
+
+ Common.UI.warning({
+ maxwidth: 500,
+ msg: this.textWarnResetFL,
+ buttons: ['yes', 'no'],
+ primary: 'yes',
+ callback: _.bind(function(btn, dontshow){
+ if (btn == 'yes') {
+ apiFlManager.put_Exceptions(apiFlManager.get_DefaultExceptions(activeLang), activeLang);
+ this.onResetExceptionsList();
+ }
+ }, this)
+ });
+ },
+
+ onResetExceptionsList: function() {
+ var path = this.appPrefix + "settings-letter-exception";
+ var activeLang = this.exceptionsLangCmb.getValue();
+ var val = JSON.stringify([]);
+ Common.Utils.InternalSettings.set(path + "-add-" + activeLang, val);
+ Common.localStorage.setItem(path + "-add-" + activeLang, val);
+ Common.Utils.InternalSettings.set(path + "-rem-" + activeLang, val);
+ Common.localStorage.setItem(path + "-rem-" + activeLang, val);
+
+ this.arrAddExceptions[activeLang] = [];
+ this.arrRemExceptions[activeLang] = [];
+
+ _exciptionsStore.remove(_exciptionsStore.where({defaultValue: false}));
+ _exciptionsStore.each(function(item, index){
+ item.set('defaultDisabled', false);
+ });
+ this.exceptionsList.deselectAll();
+ if (this.exceptionsList.scroller) {
+ this.exceptionsList.scroller.update();
+ this.exceptionsList.scroller.scrollTop(0);
+ }
+ this.updateExceptionsControls();
+ },
+
+ onDeleteException: function() {
+ var rec = this.exceptionsList.getSelectedRec();
+ var apiFlManager = this.api.asc_GetAutoCorrectSettings().get_FirstLetterExceptionManager();
+ var activeLang = this.exceptionsLangCmb.getValue();
+ if (rec) {
+ var val;
+ var path = '';
+ if (rec.get('defaultValue')) {
+ var disabled = !rec.get('defaultDisabled');
+ path = this.appPrefix + "settings-letter-exception-rem-" + activeLang;
+ rec.set('defaultDisabled', disabled);
+ if (disabled)
+ this.arrRemExceptions[activeLang].push(rec.get('value'));
+ else
+ this.arrRemExceptions[activeLang].splice(this.arrRemExceptions[activeLang].indexOf(rec.get('value')), 1);
+
+ val = JSON.stringify(this.arrRemExceptions[activeLang]);
+ Common.Utils.InternalSettings.set(path, val);
+ Common.localStorage.setItem(path, val);
+ this.btnDeleteExceptions.setCaption(disabled ? this.textRestore : this.textDelete);
+ disabled ? apiFlManager.remove_Exception(rec.get('value'), activeLang) : apiFlManager.add_Exception(rec.get('value'), activeLang);
+ } else {
+ _exciptionsStore.remove(rec);
+
+ this.arrAddExceptions[activeLang].splice(this.arrAddExceptions[activeLang].indexOf(rec.get('value')), 1);
+ path = this.appPrefix + "settings-letter-exception-add-" + activeLang;
+ val = JSON.stringify(this.arrAddExceptions[activeLang]);
+ Common.Utils.InternalSettings.set(path, val);
+ Common.localStorage.setItem(path, val);
+ this.exceptionsList.scroller && this.exceptionsList.scroller.update({});
+ apiFlManager.remove_Exception(rec.get('value'), activeLang);
+ }
+ this.updateExceptionsControls();
+ }
+ },
+
+ onAddException: function() {
+ var rec = this.exceptionsList.getSelectedRec(),
+ activeLang = this.exceptionsLangCmb.getValue(),
+ me = this,
+ value = this.exceptionsFindInput.getValue().trim(),
+ applySettings = function(record) {
+ var path = me.appPrefix + "settings-letter-exception-add-" + activeLang;
+ var val = JSON.stringify(me.arrAddExceptions[activeLang]);
+ Common.Utils.InternalSettings.set(path, val);
+ Common.localStorage.setItem(path, val);
+ me.api.asc_GetAutoCorrectSettings().get_FirstLetterExceptionManager().add_Exception(record.get('value') ,activeLang);
+ me.exceptionsList.selectRecord(record);
+ me.exceptionsList.scrollToRecord(record);
+ };
+ if (!rec) {
+ rec = _exciptionsStore.findWhere({value: value})
+ }
+ if (!rec) {
+ if(value[value.length-1] === '.')
+ value = value.slice(0, -1);
+ if (/^[^\%/\\&\?\,\.\s\d\'\;:!-+!@#\$\^*)(]{1,20}$/.test(value)) {
+ rec = _exciptionsStore.add({
+ value: value,
+ defaultValue: false,
+ defaultDisabled: false
+ });
+ this.arrAddExceptions[activeLang].push(rec.get('value'));
+ applySettings(rec);
+ } else
+ Common.UI.warning({
+ maxwidth: 500,
+ msg: this.textWarnAddFL
+ });
+ } else {
+ me.exceptionsList.selectRecord(rec);
+ me.exceptionsList.scrollToRecord(rec);
+ }
+ },
+
+ onSelectExceptionItem: function(lisvView, itemView, record) {
+ if (record) {
+ this.exceptionsFindInput.setValue(record.get('value'));
+ }
+ this.updateExceptionsControls(record);
+ },
+
+ onChangeInputException: function (input, value) {
+ var _selectedItem;
+ value = value.trim();
+ if (value.length) {
+ if(value[value.length-1] === '.')
+ value = value.slice(0, -1);
+
+ var store = this.exceptionsList.store;
+ _selectedItem = store.find(function(item) {
+ if ( item.get('value').indexOf(value) == 0) {
+ return true;
+ }
+ });
+ if (_selectedItem) {
+ this.exceptionsList.scrollToRecord(_selectedItem, true);
+ if (_selectedItem.get('value') == value)
+ this.exceptionsList.selectRecord(_selectedItem, true);
+ else
+ _selectedItem = null;
+ }
+ }
+ (!_selectedItem) && this.exceptionsList.deselectAll();
+ this.updateExceptionsControls(_selectedItem);
+ },
+
+ updateExceptionsControls: function(rec) {
+ if (!this.exceptionsList) return;
+
+ rec = rec || this.exceptionsList.getSelectedRec();
+ var value = this.exceptionsFindInput.getValue();
+
+ this.btnDeleteExceptions.setCaption(rec && rec.get('defaultDisabled') ? this.textRestore : this.textDelete);
+ this.btnDeleteExceptions.setDisabled(!rec);
+ this.btnAddExceptions.setDisabled(!!rec || !value);
+ },
+
textTitle: 'AutoCorrect',
textMathCorrect: 'Math AutoCorrect',
textReplace: 'Replace',
@@ -850,8 +1181,12 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
textNewRowCol: 'Include new rows and columns in table',
textAutoCorrect: 'AutoCorrect',
textFLSentence: 'Capitalize first letter of sentences',
+ textWarnResetFL: 'Any exceptions you added will be removed and the removed ones will be restored. Do you want to continue?',
+ textWarnAddFL: 'Exceptions must contain only the letters, uppercase or lowercase.',
+ textForLangFL: 'Exceptions for the language:',
textHyperlink: 'Internet and network paths with hyperlinks',
textFLCells: 'Capitalize first letter of table cells',
+ textFLDont: 'Don`t capitalize after',
textDoubleSpaces: 'Add period with double-space'
}, Common.Views.AutoCorrectDialog || {}))
diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js
index 114d6afa3..38ef873bd 100644
--- a/apps/documenteditor/main/app/controller/Main.js
+++ b/apps/documenteditor/main/app/controller/Main.js
@@ -2847,19 +2847,38 @@ define([
value = Common.localStorage.getBool("de-settings-autoformat-hyphens", true);
Common.Utils.InternalSettings.set("de-settings-autoformat-hyphens", value);
me.api.asc_SetAutoCorrectHyphensWithDash(value);
-
- value = Common.localStorage.getBool("de-settings-autoformat-fl-sentence", true);
- Common.Utils.InternalSettings.set("de-settings-autoformat-fl-sentence", value);
+
+ value = Common.localStorage.getItem("de-settings-letter-exception-sentence");
+ value = value !== null ? parseInt(value) != 0 : Common.localStorage.getBool("de-settings-autoformat-fl-sentence", true);
+ Common.Utils.InternalSettings.set("de-settings-letter-exception-sentence", value);
me.api.asc_SetAutoCorrectFirstLetterOfSentences(value);
+ value = Common.localStorage.getItem("de-settings-letter-exception-cells");
+ value = value !== null ? parseInt(value) != 0 : Common.localStorage.getBool("de-settings-autoformat-fl-cells", true);
+ Common.Utils.InternalSettings.set("de-settings-letter-exception-cells", value);
+ me.api.asc_SetAutoCorrectFirstLetterOfCells(value);
+
+ [0x0409, 0x0419].forEach(function(lang) {
+ var apiFlManager = me.api.asc_GetAutoCorrectSettings().get_FirstLetterExceptionManager();
+
+ value = Common.localStorage.getItem("de-settings-letter-exception-add-" + lang);
+ Common.Utils.InternalSettings.set("de-settings-letter-exception-add-" + lang, value);
+ arrAdd = value ? JSON.parse(value) : [];
+
+ value = Common.localStorage.getItem("de-settings-letter-exception-rem-" + lang);
+ Common.Utils.InternalSettings.set("de-settings-letter-exception-rem-" + lang, value);
+ arrRem = value ? JSON.parse(value) : [];
+
+ var arrRes = _.union(apiFlManager.get_Exceptions(lang), arrAdd);
+ arrRes = _.difference(arrRes, arrRem);
+ arrRes.sort();
+ apiFlManager.put_Exceptions(arrRes, lang);
+ });
+
value = Common.localStorage.getBool("de-settings-autoformat-hyperlink", true);
Common.Utils.InternalSettings.set("de-settings-autoformat-hyperlink", value);
me.api.asc_SetAutoCorrectHyperlinks(value);
-
- value = Common.localStorage.getBool("de-settings-autoformat-fl-cells", true);
- Common.Utils.InternalSettings.set("de-settings-autoformat-fl-cells", value);
- me.api.asc_SetAutoCorrectFirstLetterOfCells(value);
-
+
value = Common.localStorage.getBool("de-settings-autoformat-double-space", Common.Utils.isMac); // add period with double-space in MacOs by default
Common.Utils.InternalSettings.set("de-settings-autoformat-double-space", value);
me.api.asc_SetAutoCorrectDoubleSpaceWithPeriod(value);
diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json
index cf84c0ab6..f480599dd 100644
--- a/apps/documenteditor/main/locale/en.json
+++ b/apps/documenteditor/main/locale/en.json
@@ -391,6 +391,10 @@
"Common.Views.AutoCorrectDialog.textDoubleSpaces": "Add period with double-space",
"Common.Views.AutoCorrectDialog.textFLCells": "Capitalize first letter of table cells",
"Common.Views.AutoCorrectDialog.textFLSentence": "Capitalize first letter of sentences",
+ "Common.Views.AutoCorrectDialog.textForLangFL": "Exceptions for the language:",
+ "Common.Views.AutoCorrectDialog.textWarnResetFL": "Any exceptions you added will be removed and the removed ones will be restored. Do you want to continue?",
+ "Common.Views.AutoCorrectDialog.textWarnAddFL": "Exceptions must contain only the letters, uppercase or lowercase.",
+ "Common.Views.AutoCorrectDialog.textFLDont": "Don`t capitalize after",
"Common.Views.AutoCorrectDialog.textHyperlink": "Internet and network paths with hyperlinks",
"Common.Views.AutoCorrectDialog.textHyphens": "Hyphens (--) with dash (—)",
"Common.Views.AutoCorrectDialog.textMathCorrect": "Math AutoCorrect",
diff --git a/apps/documenteditor/main/locale/ru.json b/apps/documenteditor/main/locale/ru.json
index 1dd9edcd6..e7c1aa792 100644
--- a/apps/documenteditor/main/locale/ru.json
+++ b/apps/documenteditor/main/locale/ru.json
@@ -391,6 +391,10 @@
"Common.Views.AutoCorrectDialog.textDoubleSpaces": "Добавлять точку двойным пробелом",
"Common.Views.AutoCorrectDialog.textFLCells": "Делать первые буквы ячеек таблиц прописными",
"Common.Views.AutoCorrectDialog.textFLSentence": "Делать первые буквы предложений прописными",
+ "Common.Views.AutoCorrectDialog.textForLangFL": "Исключения для языка:",
+ "Common.Views.AutoCorrectDialog.textFLDont": "Не писать прописными буквами после",
+ "Common.Views.AutoCorrectDialog.textWarnResetFL": "Все добавленные вами исключения будут удалены, а удаленные восстановлены. Вы хотите продолжить?",
+ "Common.Views.AutoCorrectDialog.textWarnAddFL": "Исключения должны содержать только прописные или строчные буквы.",
"Common.Views.AutoCorrectDialog.textHyperlink": "Адреса в Интернете и сетевые пути гиперссылками",
"Common.Views.AutoCorrectDialog.textHyphens": "Дефисы (--) на тире (—)",
"Common.Views.AutoCorrectDialog.textMathCorrect": "Автозамена математическими символами",
diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js
index 16fc578f3..ab9f23068 100644
--- a/apps/presentationeditor/main/app/controller/Main.js
+++ b/apps/presentationeditor/main/app/controller/Main.js
@@ -2406,18 +2406,37 @@ define([
Common.Utils.InternalSettings.set("pe-settings-autoformat-hyphens", value);
me.api.asc_SetAutoCorrectHyphensWithDash(value);
- value = Common.localStorage.getBool("pe-settings-autoformat-fl-sentence", true);
- Common.Utils.InternalSettings.set("pe-settings-autoformat-fl-sentence", value);
+ value = Common.localStorage.getItem("pe-settings-letter-exception-sentence");
+ value = value !== null ? parseInt(value) != 0 : Common.localStorage.getBool("pe-settings-autoformat-fl-sentence", true);
+ Common.Utils.InternalSettings.set("pe-settings-letter-exception-sentence", value);
me.api.asc_SetAutoCorrectFirstLetterOfSentences(value);
+ value = Common.localStorage.getItem("pe-settings-letter-exceptionl-cells", true);
+ value = value !== null ? parseInt(value) != 0 : Common.localStorage.getBool("pe-settings-autoformat-fl-cells", true);
+ Common.Utils.InternalSettings.set("pe-settings-letter-exception-cells", value);
+ me.api.asc_SetAutoCorrectFirstLetterOfCells && me.api.asc_SetAutoCorrectFirstLetterOfCells(value);
+
+ [0x0409, 0x0419].forEach(function(lang) {
+ var apiFlManager = me.api.asc_GetAutoCorrectSettings().get_FirstLetterExceptionManager();
+
+ value = Common.localStorage.getItem("pe-settings-letter-exception-add-" + lang);
+ Common.Utils.InternalSettings.set("pe-settings-letter-exception-add-" + lang, value);
+ arrAdd = value ? JSON.parse(value) : [];
+
+ value = Common.localStorage.getItem("pe-settings-letter-exception-rem-" + lang);
+ Common.Utils.InternalSettings.set("pe-settings-letter-exception-rem-" + lang, value);
+ arrRem = value ? JSON.parse(value) : [];
+
+ var arrRes = _.union(apiFlManager.get_Exceptions(lang), arrAdd);
+ arrRes = _.difference(arrRes, arrRem);
+ arrRes.sort();
+ apiFlManager.put_Exceptions(arrRes, lang);
+ });
+
value = Common.localStorage.getBool("pe-settings-autoformat-hyperlink", true);
Common.Utils.InternalSettings.set("pe-settings-autoformat-hyperlink", value);
me.api.asc_SetAutoCorrectHyperlinks(value);
- value = Common.localStorage.getBool("pe-settings-autoformat-fl-cells", true);
- Common.Utils.InternalSettings.set("pe-settings-autoformat-fl-cells", value);
- me.api.asc_SetAutoCorrectFirstLetterOfCells && me.api.asc_SetAutoCorrectFirstLetterOfCells(value);
-
value = Common.localStorage.getBool("pe-settings-autoformat-double-space", Common.Utils.isMac); // add period with double-space in MacOs by default
Common.Utils.InternalSettings.set("pe-settings-autoformat-double-space", value);
me.api.asc_SetAutoCorrectDoubleSpaceWithPeriod(value);
diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json
index 300769ae5..c20884373 100644
--- a/apps/presentationeditor/main/locale/en.json
+++ b/apps/presentationeditor/main/locale/en.json
@@ -483,6 +483,10 @@
"Common.Views.AutoCorrectDialog.textDoubleSpaces": "Add period with double-space",
"Common.Views.AutoCorrectDialog.textFLCells": "Capitalize first letter of table cells",
"Common.Views.AutoCorrectDialog.textFLSentence": "Capitalize first letter of sentences",
+ "Common.Views.AutoCorrectDialog.textForLangFL": "Exceptions for the language:",
+ "Common.Views.AutoCorrectDialog.textWarnResetFL": "Any exceptions you added will be removed and the removed ones will be restored. Do you want to continue?",
+ "Common.Views.AutoCorrectDialog.textWarnAddFL": "Exceptions must contain only the letters, uppercase or lowercase.",
+ "Common.Views.AutoCorrectDialog.textFLDont": "Don`t capitalize after",
"Common.Views.AutoCorrectDialog.textHyperlink": "Internet and network paths with hyperlinks",
"Common.Views.AutoCorrectDialog.textHyphens": "Hyphens (--) with dash (—)",
"Common.Views.AutoCorrectDialog.textMathCorrect": "Math AutoCorrect",
diff --git a/apps/presentationeditor/main/locale/ru.json b/apps/presentationeditor/main/locale/ru.json
index f7977a980..349a4a612 100644
--- a/apps/presentationeditor/main/locale/ru.json
+++ b/apps/presentationeditor/main/locale/ru.json
@@ -483,6 +483,10 @@
"Common.Views.AutoCorrectDialog.textDoubleSpaces": "Добавлять точку двойным пробелом",
"Common.Views.AutoCorrectDialog.textFLCells": "Делать первые буквы ячеек таблиц прописными",
"Common.Views.AutoCorrectDialog.textFLSentence": "Делать первые буквы предложений прописными",
+ "Common.Views.AutoCorrectDialog.textForLangFL": "Исключения для языка:",
+ "Common.Views.AutoCorrectDialog.textFLDont": "Не писать прописными буквами после",
+ "Common.Views.AutoCorrectDialog.textWarnResetFL": "Все добавленные вами исключения будут удалены, а удаленные восстановлены. Вы хотите продолжить?",
+ "Common.Views.AutoCorrectDialog.textWarnAddFL": "Исключения должны содержать только прописные или строчные буквы.",
"Common.Views.AutoCorrectDialog.textHyperlink": "Адреса в Интернете и сетевые пути гиперссылками",
"Common.Views.AutoCorrectDialog.textHyphens": "Дефисы (--) на тире (—)",
"Common.Views.AutoCorrectDialog.textMathCorrect": "Автозамена математическими символами",