diff --git a/.gitignore b/.gitignore index 9319f27ea..cb4a0c389 100644 --- a/.gitignore +++ b/.gitignore @@ -3,12 +3,17 @@ Thumbs.db .DS_Store /deploy build/node_modules +build/sprites/node_modules/ apps/documenteditor/embed/resources/less/node_modules apps/presentationeditor/embed/resources/less/node_modules apps/spreadsheeteditor/embed/resources/less/node_modules apps/documenteditor/mobile/resources/sass/.sass-cache apps/spreadsheeteditor/mobile/resources/sass/.sass-cache apps/presentationeditor/mobile/resources/sass/.sass-cache +apps/**/main/resources/**/iconssmall*.png +apps/**/main/resources/**/iconssmall*.less +apps/**/main/resources/**/iconsbig*.png +apps/**/main/resources/**/iconsbig*.less # test documents @@ -22,4 +27,4 @@ apps/spreadsheeteditor/mobile/offlinedocs # tests selenium-debug.log **/test/bin -**/test/reports \ No newline at end of file +**/test/reports diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..0e075b610 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "filewatcher.commands": [ + { + "match": "app-(ios|material)\\.less", + "isAsync": true, + "cmd": "lessc --js --no-color '${file}' '${fileDirname}/../css/${fileBasenameNoExt}.css'", + "event": "onFileChange" + } + ] +} \ No newline at end of file diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index f70d1565f..f3cc1fc2a 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -44,7 +44,7 @@ review: , // default = edit print: , // default = true rename: , // default = false - changeHistory: , // default = false + changeHistory: , // default = false // must be deprecated, check onRequestRestore event instead comment: // default = edit, modifyFilter: // default = true modifyContentControl: // default = true @@ -209,6 +209,7 @@ _config.editorConfig.canRequestInsertImage = _config.events && !!_config.events.onRequestInsertImage; _config.editorConfig.canRequestMailMergeRecipients = _config.events && !!_config.events.onRequestMailMergeRecipients; _config.editorConfig.canRequestCompareFile = _config.events && !!_config.events.onRequestCompareFile; + _config.editorConfig.canRequestSharingSettings = _config.events && !!_config.events.onRequestSharingSettings; _config.frameEditorId = placeholderId; var onMouseUp = function (evt) { diff --git a/apps/common/Gateway.js b/apps/common/Gateway.js index 6d45aa3a7..ec542cb31 100644 --- a/apps/common/Gateway.js +++ b/apps/common/Gateway.js @@ -293,27 +293,31 @@ if (Common === undefined) { }, requestMakeActionLink: function (config) { - _postMessage({event:'onMakeActionLink', data: config}) + _postMessage({event:'onMakeActionLink', data: config}); }, requestUsers: function () { - _postMessage({event:'onRequestUsers'}) + _postMessage({event:'onRequestUsers'}); }, requestSendNotify: function (emails) { - _postMessage({event:'onRequestSendNotify', data: emails}) + _postMessage({event:'onRequestSendNotify', data: emails}); }, requestInsertImage: function () { - _postMessage({event:'onRequestInsertImage'}) + _postMessage({event:'onRequestInsertImage'}); }, requestMailMergeRecipients: function () { - _postMessage({event:'onRequestMailMergeRecipients'}) + _postMessage({event:'onRequestMailMergeRecipients'}); }, requestCompareFile: function () { - _postMessage({event:'onRequestCompareFile'}) + _postMessage({event:'onRequestCompareFile'}); + }, + + requestSharingSettings: function () { + _postMessage({event:'onRequestSharingSettings'}); }, on: function(event, handler){ diff --git a/apps/common/main/lib/component/Button.js b/apps/common/main/lib/component/Button.js index 2e9a4e3ee..12eb656b7 100644 --- a/apps/common/main/lib/component/Button.js +++ b/apps/common/main/lib/component/Button.js @@ -187,8 +187,9 @@ define([ '' + '<% } else { %>' + '<% if (/svgicon/.test(iconCls)) {' + - 'print(\'\');' + - '} else ' + + 'print(\'' + + '\');' + + '} else ' + 'print(\' \'); %>' + '<% } %>'; @@ -253,7 +254,8 @@ define([ // '<% if (iconCls != "") { print(\' \'); }} %>', '<% if (iconCls != "") { ' + ' if (/svgicon/.test(iconCls)) {' + - 'print(\'\');' + + 'print(\'' + + '\');' + '} else ' + 'print(\' \'); ' + '}} %>', @@ -573,6 +575,13 @@ define([ this.trigger('toggle', this, state); }, + click: function(opts) { + if ( !this.disabled ) { + this.doToggle(); + this.trigger('click', this, opts); + } + }, + isActive: function() { if (this.enableToggle) return this.pressed; @@ -641,6 +650,24 @@ define([ btnIconEl.addClass(cls || ''); }, + changeIcon: function(opts) { + var me = this; + if ( opts && (opts.curr || opts.next)) { + !!opts.curr && (me.$icon.removeClass(opts.curr)); + !!opts.next && !me.$icon.hasClass(opts.next) && (me.$icon.addClass(opts.next)); + + if ( !!me.options.signals ) { + if ( !(me.options.signals.indexOf('icon:changed') < 0) ) { + me.trigger('icon:changed', me, opts); + } + } + } + }, + + hasIcon: function(iconcls) { + return this.$icon.hasClass(iconcls); + }, + setVisible: function(visible) { if (this.cmpEl) this.cmpEl.toggleClass('hidden', !visible); this.visible = visible; diff --git a/apps/common/main/lib/component/CheckBox.js b/apps/common/main/lib/component/CheckBox.js index 0d3d35c75..019c1013f 100644 --- a/apps/common/main/lib/component/CheckBox.js +++ b/apps/common/main/lib/component/CheckBox.js @@ -94,7 +94,7 @@ define([ checked : false, value : 'unchecked', - template : _.template(''), + template : _.template(''), initialize : function(options) { Common.UI.BaseView.prototype.initialize.call(this, options); diff --git a/apps/common/main/lib/component/ComboBorderSize.js b/apps/common/main/lib/component/ComboBorderSize.js index a22123a92..8f01b7071 100644 --- a/apps/common/main/lib/component/ComboBorderSize.js +++ b/apps/common/main/lib/component/ComboBorderSize.js @@ -268,4 +268,108 @@ define([ formcontrol.css('background-position', '0 -' + record.get('offsety') + 'px'); } }, Common.UI.ComboBorderType || {})); + + Common.UI.ComboBoxColor = Common.UI.ComboBox.extend(_.extend({ + template: _.template([ + '
', + '
', + '
', + '
', + '', + '', + '
' + ].join('')), + + itemClicked: function (e) { + var el = $(e.currentTarget).parent(); + + this._selectedItem = this.store.findWhere({ + id: el.attr('id') + }); + if (this._selectedItem) { + $('.selected', $(this.el)).removeClass('selected'); + el.addClass('selected'); + this.updateFormControl(this._selectedItem); + + this.trigger('selected', this, _.extend({}, this._selectedItem.toJSON()), e); + e.preventDefault(); + } + }, + + updateFormControl: function(record) { + var formcontrol = $(this.el).find('.form-control > div'); + + if (record.get('value')!=-1) { + formcontrol[0].innerHTML = ''; + formcontrol.css({'background': '#' + record.get('value'), 'margin-top': '0'}); + } else { + formcontrol[0].innerHTML = record.get('displayValue'); + formcontrol.css({'background': '', 'margin-top': '1px'}); + } + }, + + setValue: function(value) { + var obj; + this._selectedItem = this.store.findWhere((obj={}, obj[this.valueField]=value, obj)); + + $('.selected', $(this.el)).removeClass('selected'); + + if (this._selectedItem) { + this.updateFormControl(this._selectedItem); + $('#' + this._selectedItem.get('id'), $(this.el)).addClass('selected'); + } else { + var formcontrol = $(this.el).find('.form-control > div'); + formcontrol[0].innerHTML = ''; + formcontrol.css('background', ''); + } + }, + + onResetItems: function() { + if (this.itemsTemplate) { + $(this.el).find('ul').html( $(this.itemsTemplate({ + items: this.store.toJSON(), + scope: this + }))); + } else { + $(this.el).find('ul').html(_.template([ + '<% _.each(items, function(item) { %>', + '<% if (item.value==-1) { %>', + '
  • <%= scope.getDisplayValue(item) %>
  • ', + '<% } else { %>', + '
  • ', + '
    ', + '
  • ', + '<% } %>', + '<% }); %>' + ].join(''))({ + items: this.store.toJSON(), + scope: this + })); + } + + if (!_.isUndefined(this.scroller)) { + this.scroller.destroy(); + delete this.scroller; + } + this.scroller = new Common.UI.Scroller(_.extend({ + el: $('.dropdown-menu', this.cmpEl), + minScrollbarLength : 40, + includePadding : true, + wheelSpeed: 10, + alwaysVisibleY: this.scrollAlwaysVisible + }, this.options.scroller)); + } + + }, Common.UI.ComboBoxColor || {})); + }); \ No newline at end of file diff --git a/apps/common/main/lib/component/ComboBox.js b/apps/common/main/lib/component/ComboBox.js index a243b9895..bd4229d95 100644 --- a/apps/common/main/lib/component/ComboBox.js +++ b/apps/common/main/lib/component/ComboBox.js @@ -217,6 +217,11 @@ define([ }); } + var $list = el.find('.dropdown-menu'); + if ($list.hasClass('menu-absolute')) { + $list.css('min-width', el.outerWidth()); + } + el.on('show.bs.dropdown', _.bind(me.onBeforeShowMenu, me)); el.on('shown.bs.dropdown', _.bind(me.onAfterShowMenu, me)); el.on('hide.bs.dropdown', _.bind(me.onBeforeHideMenu, me)); @@ -292,6 +297,12 @@ define([ tip.hide(); } } + + var $list = this.cmpEl.find('ul'); + if ($list.hasClass('menu-absolute')) { + var offset = this.cmpEl.offset(); + $list.css({left: offset.left, top: offset.top + this.cmpEl.outerHeight() + 2}); + } }, onAfterShowMenu: function(e) { diff --git a/apps/common/main/lib/component/ListView.js b/apps/common/main/lib/component/ListView.js index e1a565af6..080d6e15f 100644 --- a/apps/common/main/lib/component/ListView.js +++ b/apps/common/main/lib/component/ListView.js @@ -67,11 +67,15 @@ define([ this.trigger('items:reset', this); }, - onAddItem: function(record, store, opts) { - var view = new Common.UI.DataViewItem({ + createNewItem: function(record) { + return new Common.UI.DataViewItem({ template: this.itemTemplate, model: record }); + }, + + onAddItem: function(record, store, opts) { + var view = this.createNewItem(record); if (!this.innerEl) this.innerEl = $(this.el).find('.inner'); diff --git a/apps/common/main/lib/component/Menu.js b/apps/common/main/lib/component/Menu.js index 95b35b4e9..6d0d0bd92 100644 --- a/apps/common/main/lib/component/Menu.js +++ b/apps/common/main/lib/component/Menu.js @@ -551,6 +551,8 @@ define([ } else { left = docW - menuW; } + if (left < 0) + left = 0; if (this.options.restoreHeight) { if (typeof (this.options.restoreHeight) == "number") { diff --git a/apps/common/main/lib/component/MenuItem.js b/apps/common/main/lib/component/MenuItem.js index c54501185..6d710cbec 100644 --- a/apps/common/main/lib/component/MenuItem.js +++ b/apps/common/main/lib/component/MenuItem.js @@ -183,6 +183,7 @@ define([ if (this.checkable && firstChild) { firstChild.toggleClass('checkable', this.checkable); + firstChild.toggleClass('no-checkmark', this.options.checkmark===false); firstChild.toggleClass('checked', this.checked); if (!_.isEmpty(this.iconCls)) { firstChild.css('background-image', 'none'); diff --git a/apps/common/main/lib/component/MetricSpinner.js b/apps/common/main/lib/component/MetricSpinner.js index 584db251d..673847da4 100644 --- a/apps/common/main/lib/component/MetricSpinner.js +++ b/apps/common/main/lib/component/MetricSpinner.js @@ -144,6 +144,9 @@ define([ el.on('input', '.form-control', _.bind(this.onInput, this)); if (!this.options.allowDecimal) el.on('keypress', '.form-control', _.bind(this.onKeyPress, this)); + el.on('focus', 'input.form-control', function() { + me.$input && me.$input.select(); + }); this.switches = { count: 1, @@ -347,6 +350,7 @@ define([ var value = this.getRawValue(); if (this.value != value) { this.onEnterValue(); + this.trigger('inputleave', this); return (this.value == value); } } else { @@ -355,6 +359,8 @@ define([ } else { this._fromKeyDown = true; } + if (e.keyCode==Common.UI.Keys.RETURN || e.keyCode==Common.UI.Keys.ESC) + this.trigger('inputleave', this); }, onKeyUp: function (e) { @@ -477,6 +483,8 @@ define([ _step: function (type, suspend) { (type) ? this._increase(suspend) : this._decrease(suspend); + if (this.options.hold && this.switches.fromKeyDown) + this.$input && this.$input.select(); }, _add: function (a, b, precision) { diff --git a/apps/common/main/lib/component/Mixtbar.js b/apps/common/main/lib/component/Mixtbar.js index 96169d94e..6e48e4261 100644 --- a/apps/common/main/lib/component/Mixtbar.js +++ b/apps/common/main/lib/component/Mixtbar.js @@ -74,7 +74,7 @@ define([ if ( this.isFolded ) { if ( $(e.target).parents('.toolbar, #file-menu-panel').length ){ } else { - this.collapse(); + optsFold.$bar && optsFold.$bar.hasClass('expanded') && this.collapse(); } } } diff --git a/apps/common/main/lib/component/RadioBox.js b/apps/common/main/lib/component/RadioBox.js index 9e8e2d159..39fdcb585 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); @@ -111,6 +111,7 @@ define([ return; if (disabled !== this.disabled) { + this.$label.toggleClass('disabled', disabled); this.$radio.toggleClass('disabled', disabled); (disabled) ? this.$radio.attr({disabled: disabled}) : this.$radio.removeAttr('disabled'); } diff --git a/apps/common/main/lib/component/Slider.js b/apps/common/main/lib/component/Slider.js index 00e54d0d0..212b38bbb 100644 --- a/apps/common/main/lib/component/Slider.js +++ b/apps/common/main/lib/component/Slider.js @@ -354,6 +354,7 @@ define([ return; } me.trigger('removethumb', me, _.findIndex(me.thumbs, {index: index})); + me.trigger('change', me, value, lastValue); me.trigger('changecomplete', me, value, lastValue); } else { me.setThumbPosition(index, pos); diff --git a/apps/common/main/lib/controller/Desktop.js b/apps/common/main/lib/controller/Desktop.js index ba7bd7336..41fa95d7c 100644 --- a/apps/common/main/lib/controller/Desktop.js +++ b/apps/common/main/lib/controller/Desktop.js @@ -42,8 +42,15 @@ define([ 'use strict'; var Desktop = function () { - var config = {}; - var app = window.AscDesktopEditor; + var config = {version:'{{PRODUCT_VERSION}}'}; + var app = window.AscDesktopEditor, + webapp = window.DE || window.PE || window.SSE; + var titlebuttons; + var btnsave_icons = { + 'btn-save': 'save', + 'btn-save-coauth': 'coauth', + 'btn-synch': 'synch' }; + if ( !!app ) { window.on_native_message = function (cmd, param) { @@ -83,15 +90,80 @@ define([ } } else if (/editor:config/.test(cmd)) { - if ( param == 'request' ) - app.execCommand('editor:config', JSON.stringify({user: config.user, 'extraleft': $('#box-document-title #slot-btn-dt-save').parent().width()})); + if ( param == 'request' ) { + if ( !!titlebuttons ) { + var opts = { + user: config.user, + title: { buttons: [] } + }; + + var header = webapp.getController('Viewport').getView('Common.Views.Header'); + if ( header ) { + for (var i in titlebuttons) { + opts.title.buttons.push(_serializeHeaderButton(i, titlebuttons[i])); + } + } + + app.execCommand('editor:config', JSON.stringify(opts)); + } else + if ( !config.callback_editorconfig ) { + config.callback_editorconfig = function() { + setTimeout(function(){window.on_native_message(cmd, param);},0); + } + } + } + } else + if (/button:click/.test(cmd)) { + var obj = JSON.parse(param); + if ( !!obj.action ) { + titlebuttons[obj.action].btn.click(); + } } }; - app.execCommand('webapps:events', 'loading'); - app.execCommand('window:features', 'request'); + if ( !!window.native_message_cmd ) { + for ( var c in window.native_message_cmd ) { + window.on_native_message(c, window.native_message_cmd[c]); + } + } + + // app.execCommand('window:features', {version: config.version, action: 'request'}); + app.execCommand('webapps:features', {version: config.version, eventloading:true, titlebuttons:true}); } + var _serializeHeaderButton = function(action, config) { + return { + action: action, + icon: config.icon || undefined, + hint: config.btn.options.hint, + disabled: config.disabled + }; + }; + + var _onTitleButtonDisabled = function (action, e, status) { + titlebuttons[action].disabled = status; + var _buttons = {}; + _buttons[action] = status; + app.execCommand('title:button', JSON.stringify({disabled: _buttons})); + }; + + var _onSaveIconChanged = function (e, opts) { + app.execCommand('title:button', JSON.stringify({'icon:changed': {'save': btnsave_icons[opts.next]}})); + }; + + var _onModalDialog = function (status) { + if ( status == 'open' ) { + app.execCommand('title:button', JSON.stringify({disabled: {'all':true}})); + } else { + var _buttons = {}; + for (var i in titlebuttons) { + _buttons[i] = titlebuttons[i].disabled; + } + + app.execCommand('title:button', JSON.stringify({'disabled': _buttons})); + } + }; + return { init: function (opts) { _.extend(config, opts); @@ -112,6 +184,35 @@ define([ if ( config.canUndock ) { Common.NotificationCenter.trigger('app:config', {canUndock: true}); } + + var header = webapp.getController('Viewport').getView('Common.Views.Header'); + titlebuttons = { + 'save': {btn: header.btnSave, disabled:false}, + 'print': {btn: header.btnPrint, disabled:false}, + 'undo': {btn: header.btnUndo, disabled:false}, + 'redo': {btn: header.btnRedo, disabled:false} + }; + + for (var i in titlebuttons) { + titlebuttons[i].btn.options.signals = ['disabled']; + titlebuttons[i].btn.on('disabled', _onTitleButtonDisabled.bind(this, i)); + } + + header.btnSave.options.signals.push('icon:changed'); + header.btnSave.on('icon:changed', _onSaveIconChanged.bind(this)); + + var iconname = /\s?([^\s]+)$/.exec(titlebuttons.save.btn.$icon.attr('class')); + !!iconname && iconname.length && (titlebuttons.save.icon = btnsave_icons[iconname]); + + if ( !!config.callback_editorconfig ) { + config.callback_editorconfig(); + delete config.callback_editorconfig; + } + }); + + Common.NotificationCenter.on({ + 'modal:show': _onModalDialog.bind(this, 'open'), + 'modal:close': _onModalDialog.bind(this, 'close') }); } }, diff --git a/apps/common/main/lib/controller/History.js b/apps/common/main/lib/controller/History.js index 49bc3e55d..b261bc3a5 100644 --- a/apps/common/main/lib/controller/History.js +++ b/apps/common/main/lib/controller/History.js @@ -81,6 +81,7 @@ define([ }, setMode: function(mode) { + this.mode = mode; if (!mode.canHistoryClose) { this.panelHistory.$el.find('#history-header').hide(); this.panelHistory.$el.find('#history-list').css('padding-top', 0); @@ -163,6 +164,8 @@ define([ }, onSetHistoryData: function(opts) { + if (!this.mode.canUseHistory) return; + if (opts.data.error) { var config = { title: this.notcriticalErrorTitle, diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 3be1d3449..c68bc4ff9 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -143,8 +143,10 @@ define([ this.popoverChanges = new Common.Collections.ReviewChanges(); this.view = this.createView('Common.Views.ReviewChanges', { mode: mode }); - !!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this)); - !!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length && Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this)); + if (!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length || this.appConfig.canRequestSharingSettings) { + Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this)); + Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this)); + } return this; }, @@ -831,17 +833,21 @@ define([ changeAccessRights: function(btn,event,opts) { if (this._docAccessDlg || this._readonlyRights) return; - var me = this; - me._docAccessDlg = new Common.Views.DocumentAccessDialog({ - settingsurl: this.appConfig.sharingSettingsUrl - }); - me._docAccessDlg.on('accessrights', function(obj, rights){ - me.setSharingSettings({sharingSettings: rights}); - }).on('close', function(obj){ - me._docAccessDlg = undefined; - }); + if (this.appConfig.canRequestSharingSettings) { + Common.Gateway.requestSharingSettings(); + } else { + var me = this; + me._docAccessDlg = new Common.Views.DocumentAccessDialog({ + settingsurl: this.appConfig.sharingSettingsUrl + }); + me._docAccessDlg.on('accessrights', function(obj, rights){ + me.setSharingSettings({sharingSettings: rights}); + }).on('close', function(obj){ + me._docAccessDlg = undefined; + }); - me._docAccessDlg.show(); + me._docAccessDlg.show(); + } }, setSharingSettings: function(data) { diff --git a/apps/common/main/lib/extend/Bootstrap.js b/apps/common/main/lib/extend/Bootstrap.js index b7d4a582f..599f129e7 100755 --- a/apps/common/main/lib/extend/Bootstrap.js +++ b/apps/common/main/lib/extend/Bootstrap.js @@ -205,10 +205,15 @@ function clearMenus(isFromInputControl) { }) } +function toggle() { + $('.dropdown-backdrop').remove(); +} + $(document) .off('keydown.bs.dropdown.data-api') .on('keydown.bs.dropdown.data-api', '[data-toggle=dropdown], [role=menu]' , onDropDownKeyDown); +('ontouchstart' in document.documentElement) && $(document).on('click.bs.dropdown.data-api', '[data-toggle=dropdown]', toggle); /* * workaround closing menu by right click * */ diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index f1c758af0..2268d5764 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -117,31 +117,30 @@ Common.Utils = _.extend(new(function() { isMobile = /android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent || navigator.vendor || window.opera), me = this, checkSize = function() { - me.zoom = 1; - if (isChrome && !isOpera && !isMobile && document && document.firstElementChild && document.body) - { + me.zoom = 1; + if (isChrome && !isOpera && !isMobile && document && document.firstElementChild && document.body) { // делаем простую проверку // считаем: 0 < window.devicePixelRatio < 2 => _devicePixelRatio = 1; zoom = window.devicePixelRatio / _devicePixelRatio; // считаем: window.devicePixelRatio >= 2 => _devicePixelRatio = 2; zoom = window.devicePixelRatio / _devicePixelRatio; - if (window.devicePixelRatio > 0.1) - { - if (window.devicePixelRatio < 1.99) - { - var _devicePixelRatio = 1; - me.zoom = window.devicePixelRatio / _devicePixelRatio; + if (window.devicePixelRatio > 0.1) { + var _fraction = window.devicePixelRatio % 1; + var _devicePixelRatio = Math.floor(window.devicePixelRatio); + + if ( !(_fraction < .5) ) { + _devicePixelRatio += .5; } - else - { - var _devicePixelRatio = 2; - me.zoom = window.devicePixelRatio / _devicePixelRatio; - } - // chrome 54.x: zoom = "reset" - clear retina zoom (windows) - //document.firstElementChild.style.zoom = "reset"; + + me.zoom = window.devicePixelRatio / _devicePixelRatio; document.firstElementChild.style.zoom = 1.0 / me.zoom; + + if ( _devicePixelRatio % 1 > 0 ) + $('#editor_sdk').css('zoom', 1.0 / _devicePixelRatio); + else $('#editor_sdk').css('zoom', ''); } else document.firstElementChild.style.zoom = "normal"; - } + } + me.innerWidth = window.innerWidth * me.zoom; me.innerHeight = window.innerHeight * me.zoom; }; @@ -152,6 +151,8 @@ Common.Utils = _.extend(new(function() { $(window).on('resize', checkSize); return { + checkSize: checkSize, + userAgent: userAgent, isStrict: isStrict, isIEQuirks: isIE && (!isStrict && (isIE6 || isIE7 || isIE8 || isIE9)), diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index 7933acdee..a56d5cfcd 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -86,7 +86,7 @@ define([ // '' + '