diff --git a/UI/WebServerResources/js/Mailer/MessageEditorController.js b/UI/WebServerResources/js/Mailer/MessageEditorController.js index fde7db0cc..fcbd6e022 100644 --- a/UI/WebServerResources/js/Mailer/MessageEditorController.js +++ b/UI/WebServerResources/js/Mailer/MessageEditorController.js @@ -6,8 +6,8 @@ /** * @ngInject */ - MessageEditorController.$inject = ['$scope', '$window', '$stateParams', '$mdConstant', '$mdUtil', '$mdDialog', '$mdToast', 'FileUploader', 'stateParent', 'stateAccount', 'stateMessage', 'onCompletePromise', 'encodeUriFilter', '$timeout', 'sgConstant', 'sgFocus', 'Dialog', 'AddressBook', 'Card', 'Preferences']; - function MessageEditorController($scope, $window, $stateParams, $mdConstant, $mdUtil, $mdDialog, $mdToast, FileUploader, stateParent, stateAccount, stateMessage, onCompletePromise, encodeUriFilter, $timeout, sgConstant, focus, Dialog, AddressBook, Card, Preferences) { + MessageEditorController.$inject = ['$scope', '$window', '$stateParams', '$mdUtil', '$mdDialog', '$mdToast', 'FileUploader', 'stateParent', 'stateAccount', 'stateMessage', 'onCompletePromise', 'encodeUriFilter', '$timeout', 'sgConstant', 'sgFocus', 'Dialog', 'AddressBook', 'Card', 'Preferences']; + function MessageEditorController($scope, $window, $stateParams, $mdUtil, $mdDialog, $mdToast, FileUploader, stateParent, stateAccount, stateMessage, onCompletePromise, encodeUriFilter, $timeout, sgConstant, focus, Dialog, AddressBook, Card, Preferences) { var vm = this; this.$onInit = function() { @@ -24,12 +24,7 @@ this.fromIdentity = stateMessage.editable.from; this.identitySearchText = ''; this.message = stateMessage; - this.recipientSeparatorKeys = [ - $mdConstant.KEY_CODE.ENTER, - $mdConstant.KEY_CODE.TAB, - $mdConstant.KEY_CODE.COMMA, - $mdConstant.KEY_CODE.SEMICOLON - ]; + this.recipientSeparatorKeys = Preferences.defaults.emailSeparatorKeys; this.sendState = false; this.toggleFullscreen = toggleFullscreen; this.firstFocus = true; diff --git a/UI/WebServerResources/js/Preferences/AccountDialogController.js b/UI/WebServerResources/js/Preferences/AccountDialogController.js index 18786ce2d..6d3642172 100644 --- a/UI/WebServerResources/js/Preferences/AccountDialogController.js +++ b/UI/WebServerResources/js/Preferences/AccountDialogController.js @@ -7,8 +7,8 @@ /** * @ngInject */ - AccountDialogController.$inject = ['$timeout', '$window', '$mdConstant', '$mdDialog', 'FileUploader', 'Dialog', 'sgSettings', 'defaults', 'account', 'accountId', 'mailCustomFromEnabled']; - function AccountDialogController($timeout, $window, $mdConstant, $mdDialog, FileUploader, Dialog, Settings, defaults, account, accountId, mailCustomFromEnabled) { + AccountDialogController.$inject = ['$timeout', '$window', '$mdDialog', 'FileUploader', 'Dialog', 'sgSettings', 'defaults', 'account', 'accountId', 'mailCustomFromEnabled']; + function AccountDialogController($timeout, $window, $mdDialog, FileUploader, Dialog, Settings, defaults, account, accountId, mailCustomFromEnabled) { var vm = this, usesSSO = $window.usesCASAuthentication || $window.usesSAML2Authentication; this.defaultPort = 143; @@ -17,12 +17,6 @@ this.accountId = accountId; this.hostnameRE = usesSSO && accountId > 0 ? /^(?!(127\.0\.0\.1|localhost(?:\.localdomain)?)$)/ : /./; this.addressesSearchText = ''; - this.emailSeparatorKeys = [ - $mdConstant.KEY_CODE.ENTER, - $mdConstant.KEY_CODE.TAB, - $mdConstant.KEY_CODE.COMMA, - $mdConstant.KEY_CODE.SEMICOLON - ]; this.ckConfig = { 'autoGrow_minHeight': 70, 'toolbar': [['Bold', 'Italic', '-', 'Link', diff --git a/UI/WebServerResources/js/Preferences/Preferences.service.js b/UI/WebServerResources/js/Preferences/Preferences.service.js index b32df842e..e45dbd202 100644 --- a/UI/WebServerResources/js/Preferences/Preferences.service.js +++ b/UI/WebServerResources/js/Preferences/Preferences.service.js @@ -163,14 +163,36 @@ else data.SOGoContactsCategories = _.compact(data.SOGoContactsCategories); + data.emailSeparatorKeys = [ + 9, // $mdConstant.KEY_CODE.TAB, + 13, // $mdConstant.KEY_CODE.ENTER, + 186, // $mdConstant.KEY_CODE.SEMICOLON + 188 // $mdConstant.KEY_CODE.COMMA, + ]; if (data.LocaleCode) { + data.ckLocaleCode = data.LocaleCode.replace('_', '-').toLowerCase(); + // Exceptions switch (data.LocaleCode) { + case 'it': + // The Italian keyboard layout has the same keycode (186) for '@' and ';'; we remove the semicolon. + data.emailSeparatorKeys = [ + 9, // $mdConstant.KEY_CODE.TAB, + 13, // $mdConstant.KEY_CODE.ENTER, + 188 // $mdConstant.KEY_CODE.COMMA, + ]; + break; + case 'ru': + // The Russian keyboard layout has the same keycode (186) for 'Ж' and ';'; we remove the semicolon. + // It also has the same keycode (188) for 'Б' and ','; we remove the comma. + data.emailSeparatorKeys = [ + 9, // $mdConstant.KEY_CODE.TAB, + 13 // $mdConstant.KEY_CODE.ENTER, + ]; + break; case 'sr_ME': case 'sr_RS': data.ckLocaleCode = 'sr-latn'; break; - default: - data.ckLocaleCode = data.LocaleCode.replace('_', '-').toLowerCase(); } } diff --git a/UI/WebServerResources/js/Preferences/PreferencesController.js b/UI/WebServerResources/js/Preferences/PreferencesController.js index a3014702e..0ece9f1a5 100644 --- a/UI/WebServerResources/js/Preferences/PreferencesController.js +++ b/UI/WebServerResources/js/Preferences/PreferencesController.js @@ -7,8 +7,8 @@ /** * @ngInject */ - PreferencesController.$inject = ['$q', '$window', '$state', '$mdConstant', '$mdMedia', '$mdSidenav', '$mdDialog', '$mdToast', 'sgSettings', 'sgFocus', 'Dialog', 'User', 'Account', 'Preferences', 'Authentication']; - function PreferencesController($q, $window, $state, $mdConstant, $mdMedia, $mdSidenav, $mdDialog, $mdToast, sgSettings, focus, Dialog, User, Account, Preferences, Authentication) { + PreferencesController.$inject = ['$q', '$window', '$state', '$mdMedia', '$mdSidenav', '$mdDialog', '$mdToast', 'sgSettings', 'sgFocus', 'Dialog', 'User', 'Account', 'Preferences', 'Authentication']; + function PreferencesController($q, $window, $state, $mdMedia, $mdSidenav, $mdDialog, $mdToast, sgSettings, focus, Dialog, User, Account, Preferences, Authentication) { var vm = this, mailboxes = [], today = new Date().beginOfDay(); this.$onInit = function() { @@ -18,12 +18,7 @@ this.timeZonesSearchText = ''; this.addressesSearchText = ''; this.mailLabelKeyRE = new RegExp(/^(?!^_\$)[^(){} %*\"\\\\]*?$/); - this.emailSeparatorKeys = [ - $mdConstant.KEY_CODE.ENTER, - $mdConstant.KEY_CODE.TAB, - $mdConstant.KEY_CODE.COMMA, - $mdConstant.KEY_CODE.SEMICOLON - ]; + this.emailSeparatorKeys = Preferences.defaults.emailSeparatorKeys; if (Preferences.defaults.SOGoMailAutoMarkAsReadMode == 'delay') this.mailAutoMarkAsReadDelay = Math.max(1, this.preferences.defaults.SOGoMailAutoMarkAsReadDelay); else