diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 8ef274d7d..0bc80b97d 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -128,7 +128,8 @@ compactHeader: false, toolbarNoTabs: false, toolbarHideFileName: false, - reviewDisplay: 'original' + reviewDisplay: 'original', + spellcheck: true }, plugins: { autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'], diff --git a/apps/common/locale.js b/apps/common/locale.js index 3e3bdda3b..e7ce8cd71 100644 --- a/apps/common/locale.js +++ b/apps/common/locale.js @@ -36,27 +36,34 @@ if (Common === undefined) { Common.Locale = new(function() { "use strict"; - var l10n = {}; + var l10n = null; + var loadcallback, + apply = false; - var _applyLocalization = function() { + var _applyLocalization = function(callback) { try { - for (var prop in l10n) { - var p = prop.split('.'); - if (p && p.length > 2) { + callback && (loadcallback = callback); + if (l10n) { + for (var prop in l10n) { + var p = prop.split('.'); + if (p && p.length > 2) { - var obj = window; - for (var i = 0; i < p.length - 1; ++i) { - if (obj[p[i]] === undefined) { - obj[p[i]] = new Object(); + var obj = window; + for (var i = 0; i < p.length - 1; ++i) { + if (obj[p[i]] === undefined) { + obj[p[i]] = new Object(); + } + obj = obj[p[i]]; } - obj = obj[p[i]]; - } - if (obj) { - obj[p[p.length - 1]] = l10n[prop]; + if (obj) { + obj[p[p.length - 1]] = l10n[prop]; + } } } - } + loadcallback && loadcallback(); + } else + apply = true; } catch (e) { } @@ -64,7 +71,7 @@ Common.Locale = new(function() { var _get = function(prop, scope) { var res = ''; - if (scope && scope.name) { + if (l10n && scope && scope.name) { res = l10n[scope.name + '.' + prop]; } @@ -99,10 +106,12 @@ Common.Locale = new(function() { throw new Error('loaded'); } }).then(function(json) { - if ( !!json ) l10n = json; + l10n = json || {}; + apply && _applyLocalization(); }).catch(function(e) { + l10n = l10n || {}; + apply && _applyLocalization(); if ( e.message == 'loaded' ) { - } else console.log('fetch error: ' + e); }); @@ -110,7 +119,13 @@ Common.Locale = new(function() { if ( !window.fetch ) { /* use fetch polifill if native method isn't supported */ - require(['../vendor/fetch/fetch.umd'], _requireLang); + var polyfills = ['../vendor/fetch/fetch.umd']; + if ( !window.Promise ) { + require(['../vendor/es6-promise/es6-promise.auto.min.js'], + function () { + require(polyfills, _requireLang); + }); + } else require(polyfills, _requireLang); } else _requireLang(); return { diff --git a/apps/common/main/lib/component/Button.js b/apps/common/main/lib/component/Button.js index 76a0957e6..e097848f9 100644 --- a/apps/common/main/lib/component/Button.js +++ b/apps/common/main/lib/component/Button.js @@ -386,6 +386,18 @@ define([ if (modalParents.length > 0) { me.btnEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10); me.btnMenuEl && me.btnMenuEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10); + var onModalClose = function(dlg) { + if (modalParents[0] !== dlg.$window[0]) return; + var tip = me.btnEl.data('bs.tooltip'); + if (tip) { + if (tip.dontShow===undefined) + tip.dontShow = true; + + tip.hide(); + } + Common.NotificationCenter.off({'modal:close': onModalClose}); + }; + Common.NotificationCenter.on({'modal:close': onModalClose}); } } diff --git a/apps/common/main/lib/component/ComboBox.js b/apps/common/main/lib/component/ComboBox.js index 2cccb52e0..3ff726a9a 100644 --- a/apps/common/main/lib/component/ComboBox.js +++ b/apps/common/main/lib/component/ComboBox.js @@ -193,6 +193,18 @@ define([ var modalParents = el.closest('.asc-window'); if (modalParents.length > 0) { el.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10); + var onModalClose = function(dlg) { + if (modalParents[0] !== dlg.$window[0]) return; + var tip = el.data('bs.tooltip'); + if (tip) { + if (tip.dontShow===undefined) + tip.dontShow = true; + + tip.hide(); + } + Common.NotificationCenter.off({'modal:close': onModalClose}); + }; + Common.NotificationCenter.on({'modal:close': onModalClose}); } el.find('.dropdown-menu').on('mouseenter', function(){ // hide tooltip when mouse is over menu diff --git a/apps/common/main/lib/component/RadioBox.js b/apps/common/main/lib/component/RadioBox.js index 1b0f7084b..9e8e2d159 100644 --- a/apps/common/main/lib/component/RadioBox.js +++ b/apps/common/main/lib/component/RadioBox.js @@ -71,7 +71,7 @@ define([ disabled : false, rendered : false, - template : _.template(''), + template : _.template(''), initialize : function(options) { Common.UI.BaseView.prototype.initialize.call(this, options); @@ -100,6 +100,7 @@ define([ })); this.$radio = el.find('input[type=button]'); + this.$label = el.find('label'); this.rendered = true; return this; @@ -144,6 +145,10 @@ define([ getValue: function() { return this.$radio.hasClass('checked'); + }, + + setCaption: function(text) { + this.$label.find('span').text(text); } }); }); \ No newline at end of file diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 6f90ad350..e291dc5c0 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -643,7 +643,7 @@ define([ onAppReady: function (config) { var me = this; - if ( me.view && Common.localStorage.getBool(me.view.appPrefix + "settings-spellcheck", true) ) + if ( me.view && Common.localStorage.getBool(me.view.appPrefix + "settings-spellcheck", !(config.customization && config.customization.spellcheck===false))) me.view.turnSpelling(true); if ( config.canReview ) { diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index f33635c89..0e2a7619d 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -74,7 +74,7 @@ define([ var templateRightBox = '
' + '
' + - '' + + '' + '
' + '<%= textSaveEnd %>' + '
' + @@ -116,7 +116,7 @@ define([ '
' + '
' + '
' + - '' + + '' + '' + '
'; diff --git a/apps/common/main/lib/view/ReviewPopover.js b/apps/common/main/lib/view/ReviewPopover.js index 466226e0d..c2f1a922d 100644 --- a/apps/common/main/lib/view/ReviewPopover.js +++ b/apps/common/main/lib/view/ReviewPopover.js @@ -1118,7 +1118,7 @@ define([ return (item.email && 0 === item.email.toLowerCase().indexOf(str) || item.name && 0 === item.name.toLowerCase().indexOf(str)) }); } - var tpl = _.template('
<%= caption %>
<%= options.value %>
'), + var tpl = _.template('
<%= Common.Utils.String.htmlEncode(caption) %>
<%= Common.Utils.String.htmlEncode(options.value) %>
'), divider = false; _.each(users, function(menuItem, index) { if (divider && !menuItem.hasAccess) { diff --git a/apps/common/main/resources/img/controls/toolbarbig.png b/apps/common/main/resources/img/controls/toolbarbig.png index 16aaf8a45..aab375007 100644 Binary files a/apps/common/main/resources/img/controls/toolbarbig.png and b/apps/common/main/resources/img/controls/toolbarbig.png differ diff --git a/apps/common/main/resources/img/controls/toolbarbig@2x.png b/apps/common/main/resources/img/controls/toolbarbig@2x.png index f68309906..d767eea48 100644 Binary files a/apps/common/main/resources/img/controls/toolbarbig@2x.png and b/apps/common/main/resources/img/controls/toolbarbig@2x.png differ diff --git a/apps/common/main/resources/less/dropdown-menu.less b/apps/common/main/resources/less/dropdown-menu.less index 5aa203037..0f0c477cf 100644 --- a/apps/common/main/resources/less/dropdown-menu.less +++ b/apps/common/main/resources/less/dropdown-menu.less @@ -57,6 +57,9 @@ margin-left: -18px; background-position: @menu-check-offset-x @menu-check-offset-y; } + &.custom-scale:before { + margin-top: 3px; + } } .menu-item-icon { diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less index 76220cbc1..4e64e2a59 100644 --- a/apps/common/main/resources/less/toolbar.less +++ b/apps/common/main/resources/less/toolbar.less @@ -530,6 +530,8 @@ .button-normal-icon(btn-func-math, 73, @toolbar-big-icon-size); .button-normal-icon(btn-more, 74, @toolbar-big-icon-size); .button-normal-icon(btn-pagenum, 75, @toolbar-big-icon-size); +.button-normal-icon(btn-calculation, 80, @toolbar-big-icon-size); +.button-normal-icon(btn-scale, 81, @toolbar-big-icon-size); [applang=ru] { .btn-toolbar { diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js index 63d5296a4..bd0338bd0 100644 --- a/apps/common/mobile/lib/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -59,7 +59,8 @@ define([ _userId, editUsers = [], editor = !!window.DE ? 'DE' : !!window.PE ? 'PE' : 'SSE', - displayMode = "Markup", + displayMode = "markup", + canViewReview, arrChangeReview = [], dateChange = [], _fileKey; @@ -208,11 +209,8 @@ define([ me.initComments(); Common.Utils.addScrollIfNeed('.page[data-page=comments-view]', '.page[data-page=comments-view] .page-content'); } else { - if(editor === 'DE' && !this.appConfig.canReview) { - this.canViewReview = me.api.asc_HaveRevisionsChanges(true); - if (!this.canViewReview) { - $('#reviewing-settings').hide(); - } + if(editor === 'DE' && !this.appConfig.canReview && !canViewReview) { + $('#reviewing-settings').hide(); } } }, @@ -276,7 +274,7 @@ define([ $('#settings-review input:checkbox').single('change', _.bind(me.onTrackChanges, me)); $('#settings-accept-all').single('click', _.bind(me.onAcceptAllClick, me)); $('#settings-reject-all').single('click', _.bind(me.onRejectAllClick, me)); - if(this.appConfig.isReviewOnly || displayMode == "Final" || displayMode == "Original" ) { + if(this.appConfig.isReviewOnly || displayMode == "final" || displayMode == "original" ) { $('#settings-accept-all').addClass('disabled'); $('#settings-reject-all').addClass('disabled'); $('#settings-review').addClass('disabled'); @@ -320,12 +318,12 @@ define([ var me = this; $('input:radio').single('change', _.bind(me.onReviewViewClick, me)); var value = displayMode; - if (value == null || value === "Markup") { - $('input[value="Markup"]').attr('checked', true); - } else if (value === 'Final') { - $('input[value="Final"]').attr('checked', true); - } else if (value === 'Original') { - $('input[value="Original"]').attr('checked', true); + if (value == null || value === "markup") { + $('input[value="markup"]').attr('checked', true); + } else if (value === 'final') { + $('input[value="final"]').attr('checked', true); + } else if (value === 'original') { + $('input[value="original"]').attr('checked', true); } }, @@ -333,24 +331,29 @@ define([ return displayMode; }, + setCanViewReview: function(config) { + canViewReview = config; + }, + onReviewViewClick: function(event) { var value = $(event.currentTarget).val(); this.turnDisplayMode(value); + !this.appConfig.canReview && Common.localStorage.setItem("de-view-review-mode", value); }, - turnDisplayMode: function(value) { - displayMode = value; + turnDisplayMode: function(value, suppressEvent) { + displayMode = value.toLocaleLowerCase(); if (this.api) { - if (value === 'Final') + if (displayMode === 'final') this.api.asc_BeginViewModeInReview(true); - else if (value === 'Original') + else if (displayMode === 'original') this.api.asc_BeginViewModeInReview(false); else this.api.asc_EndViewModeInReview(); } - this.initReviewingSettingsView(); - DE.getController('Toolbar').setDisplayMode(value); + !suppressEvent && this.initReviewingSettingsView(); + DE.getController('Toolbar').setDisplayMode(displayMode); }, @@ -386,7 +389,7 @@ define([ $('#btn-delete-change').single('click', _.bind(this.onDeleteChange, this)); } } - if(displayMode == "Final" || displayMode == "Original") { + if(displayMode == "final" || displayMode == "original") { $('#btn-accept-change').addClass('disabled'); $('#btn-reject-change').addClass('disabled'); $('#btn-prev-change').addClass('disabled'); @@ -731,7 +734,7 @@ define([ time : date.getTime(), replys : [], groupName : (groupname && groupname.length>1) ? groupname[1] : null - } + }; if (comment) { var replies = this.readSDKReplies(data); if (replies.length) { @@ -818,6 +821,13 @@ define([ return 0; }, + stringUtcToLocalDate: function (date) { + if (typeof date === 'string') + return parseInt(date) + this.timeZoneOffsetInMs; + + return 0; + }, + addCommentToGroupCollection: function (comment) { var groupname = comment.groupName; if (!this.groupCollectionComments[groupname]) diff --git a/apps/common/mobile/lib/template/Collaboration.template b/apps/common/mobile/lib/template/Collaboration.template index 39e076ded..ec41861a4 100644 --- a/apps/common/mobile/lib/template/Collaboration.template +++ b/apps/common/mobile/lib/template/Collaboration.template @@ -150,7 +150,7 @@