diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index cf378efd7..0bc80b97d 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -736,8 +736,15 @@ : config.type === "embedded" ? "embed" : "main"; - path += "/index.html"; + var index = "/index.html"; + if (config.editorConfig && config.editorConfig.targetApp!=='desktop') { + var customization = config.editorConfig.customization; + if ( typeof(customization) == 'object' && (customization.loaderName || customization.loaderLogo)) { + index = "/index_loader.html"; + } + } + path += index; return path; } @@ -754,6 +761,11 @@ params += "&customer=ONLYOFFICE"; if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.loaderLogo) { if (config.editorConfig.customization.loaderLogo !== '') params += "&logo=" + config.editorConfig.customization.loaderLogo; + } else if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.logo) { + if (config.type=='embedded' && config.editorConfig.customization.logo.imageEmbedded) + params += "&headerlogo=" + config.editorConfig.customization.logo.imageEmbedded; + else if (config.type!='embedded' && config.editorConfig.customization.logo.image) + params += "&headerlogo=" + config.editorConfig.customization.logo.image; } } diff --git a/apps/common/main/lib/component/Button.js b/apps/common/main/lib/component/Button.js index 8b78cbfb0..e097848f9 100644 --- a/apps/common/main/lib/component/Button.js +++ b/apps/common/main/lib/component/Button.js @@ -319,7 +319,7 @@ define([ me.trigger('render:before', me); - me.cmpEl = $(me.el); + me.cmpEl = me.$el || $(me.el); if (parentEl) { me.setElement(parentEl, false); diff --git a/apps/common/main/lib/component/CheckBox.js b/apps/common/main/lib/component/CheckBox.js index 5aaa8a112..0d3d35c75 100644 --- a/apps/common/main/lib/component/CheckBox.js +++ b/apps/common/main/lib/component/CheckBox.js @@ -104,27 +104,25 @@ define([ }, render: function (parentEl) { - var me = this, - el = $(this.el); + var me = this; if (!me.rendered) { if (parentEl) { this.setElement(parentEl, false); parentEl.html(this.template({ labelText: this.options.labelText })); - el = $(this.el); } else { - el.html(this.template({ + me.$el.html(this.template({ labelText: this.options.labelText })); } - this.$chk = el.find('input[type=button]'); - this.$label = el.find('label'); - this.$chk.on('click', _.bind(this.onItemCheck, this)); - } + this.$chk = me.$el.find('input[type=button]'); + this.$label = me.$el.find('label'); + this.$chk.on('click', this.onItemCheck.bind(this)); - this.rendered = true; + this.rendered = true; + } if (this.options.disabled) this.setDisabled(this.options.disabled); diff --git a/apps/common/main/lib/component/ColorPalette.js b/apps/common/main/lib/component/ColorPalette.js index 106cfb761..ba35ca857 100644 --- a/apps/common/main/lib/component/ColorPalette.js +++ b/apps/common/main/lib/component/ColorPalette.js @@ -91,16 +91,14 @@ define([ this.setElement(parentEl, false); parentEl.html(this.cmpEl); } else { - $(this.el).html(this.cmpEl); + me.$el.html(this.cmpEl); } } else { - this.cmpEl = $(this.el); + this.cmpEl = me.$el || $(this.el); } if (!me.rendered) { - var el = this.cmpEl; - - el.on('click', 'span.color-item', _.bind(this.itemClick, this)); + me.cmpEl.on('click', 'span.color-item', me.itemClick.bind(me)); } me.rendered = true; diff --git a/apps/common/main/lib/component/ColorPaletteExt.js b/apps/common/main/lib/component/ColorPaletteExt.js index 98eadf69d..a6b7e9c9a 100644 --- a/apps/common/main/lib/component/ColorPaletteExt.js +++ b/apps/common/main/lib/component/ColorPaletteExt.js @@ -108,12 +108,12 @@ define([ this.setElement(parentEl, false); parentEl.html(this.cmpEl); } else { - $(this.el).html(this.cmpEl); + this.$el.html(this.cmpEl); } - this.cmpEl.on('click', _.bind(this.handleClick, this)); + this.cmpEl.on('click', me.handleClick.bind(me)); } else { - this.cmpEl = $(this.el); + this.cmpEl = me.$el || $(this.el); } me.rendered = true; diff --git a/apps/common/main/lib/component/ComboBox.js b/apps/common/main/lib/component/ComboBox.js index 02d7cadde..3ff726a9a 100644 --- a/apps/common/main/lib/component/ComboBox.js +++ b/apps/common/main/lib/component/ComboBox.js @@ -104,8 +104,7 @@ define([ initialize : function(options) { Common.UI.BaseView.prototype.initialize.call(this, options); - var me = this, - el = $(this.el); + var me = this; this.id = me.options.id || Common.UI.getId(); this.cls = me.options.cls; @@ -158,10 +157,10 @@ define([ this.setElement(parentEl, false); parentEl.html(this.cmpEl); } else { - $(this.el).html(this.cmpEl); + this.$el.html(this.cmpEl); } } else { - this.cmpEl = $(this.el); + this.cmpEl = me.$el || $(this.el); } if (!me.rendered) { diff --git a/apps/common/main/lib/component/ComboDataView.js b/apps/common/main/lib/component/ComboDataView.js index a667aac1f..ff31ae0aa 100644 --- a/apps/common/main/lib/component/ComboDataView.js +++ b/apps/common/main/lib/component/ComboDataView.js @@ -148,7 +148,7 @@ define([ me.trigger('render:before', me); - me.cmpEl = $(me.el); + me.cmpEl = me.$el || $(me.el); var templateEl = me.template({ id : me.id, diff --git a/apps/common/main/lib/component/DataView.js b/apps/common/main/lib/component/DataView.js index 67a027902..dc309e1d1 100644 --- a/apps/common/main/lib/component/DataView.js +++ b/apps/common/main/lib/component/DataView.js @@ -135,7 +135,7 @@ define([ if (_.isUndefined(this.model.id)) return this; - var el = $(this.el); + var el = this.$el || $(this.el); el.html(this.template(this.model.toJSON())); el.addClass('item'); @@ -262,7 +262,6 @@ define([ this.trigger('render:before', this); - this.cmpEl = $(this.el); if (parentEl) { this.setElement(parentEl, false); this.cmpEl = $(this.template({ @@ -272,6 +271,7 @@ define([ parentEl.html(this.cmpEl); } else { + this.cmpEl = me.$el || $(this.el); this.cmpEl.html(this.template({ groups: me.groups ? me.groups.toJSON() : null, style: me.style @@ -766,6 +766,435 @@ define([ } }); + Common.UI.DataViewSimple = Common.UI.BaseView.extend({ + options : { + handleSelect: true, + enableKeyEvents: true, + keyMoveDirection: 'both', // 'vertical', 'horizontal' + restoreHeight: 0, + scrollAlwaysVisible: false, + useBSKeydown: false + }, + + template: _.template([ + '
', + '<% _.each(items, function(item) { %>', + '<% if (!item.id) item.id = Common.UI.getId(); %>', + '
data-toggle="tooltip" <% } %> ><%= itemTemplate(item) %>
', + '<% }) %>', + '
' + ].join('')), + + initialize : function(options) { + Common.UI.BaseView.prototype.initialize.call(this, options); + var me = this; + + me.template = me.options.template || me.template; + me.store = me.options.store || new Common.UI.DataViewStore(); + me.itemTemplate = me.options.itemTemplate || null; + me.handleSelect = me.options.handleSelect; + me.parentMenu = me.options.parentMenu; + me.enableKeyEvents= me.options.enableKeyEvents; + me.useBSKeydown = me.options.useBSKeydown; // only with enableKeyEvents && parentMenu + me.style = me.options.style || ''; + me.scrollAlwaysVisible = me.options.scrollAlwaysVisible || false; + if (me.parentMenu) + me.parentMenu.options.restoreHeight = (me.options.restoreHeight>0); + me.rendered = false; + if (me.options.keyMoveDirection=='vertical') + me.moveKeys = [Common.UI.Keys.UP, Common.UI.Keys.DOWN]; + else if (me.options.keyMoveDirection=='horizontal') + me.moveKeys = [Common.UI.Keys.LEFT, Common.UI.Keys.RIGHT]; + else + me.moveKeys = [Common.UI.Keys.UP, Common.UI.Keys.DOWN, Common.UI.Keys.LEFT, Common.UI.Keys.RIGHT]; + if (me.options.el) + me.render(); + }, + + render: function (parentEl) { + var me = this; + this.trigger('render:before', this); + if (parentEl) { + this.setElement(parentEl, false); + this.cmpEl = $(this.template({ + items: me.store.toJSON(), + itemTemplate: me.itemTemplate, + style: me.style + })); + + parentEl.html(this.cmpEl); + } else { + this.cmpEl = me.$el || $(this.el); + this.cmpEl.html(this.template({ + items: me.store.toJSON(), + itemTemplate: me.itemTemplate, + style: me.style + })); + } + var modalParents = this.cmpEl.closest('.asc-window'); + if (modalParents.length < 1) + modalParents = this.cmpEl.closest('[id^="menu-container-"]'); // context menu + if (modalParents.length > 0) { + this.tipZIndex = parseInt(modalParents.css('z-index')) + 10; + } + + if (!this.rendered) { + if (this.parentMenu) { + this.cmpEl.closest('li').css('height', '100%'); + this.cmpEl.css('height', '100%'); + this.parentMenu.on('show:after', _.bind(this.alignPosition, this)); + this.parentMenu.on('show:after', _.bind(this.onAfterShowMenu, this)); + } else if (this.store.length>0) + this.onAfterShowMenu(); + + if (this.enableKeyEvents && this.parentMenu && this.handleSelect) { + this.parentMenu.on('show:before', function(menu) { me.deselectAll(); }); + this.parentMenu.on('show:after', function(menu) { + Common.NotificationCenter.trigger('dataview:focus'); + _.delay(function() { + menu.cmpEl.find('.dataview').focus(); + }, 10); + }).on('hide:after', function() { + Common.NotificationCenter.trigger('dataview:blur'); + }); + } + this.attachKeyEvents(); + this.cmpEl.on( "click", "div.item", _.bind(me.onClickItem, me)); + } + if (_.isUndefined(this.scroller)) { + this.scroller = new Common.UI.Scroller({ + el: $(this.el).find('.inner').addBack().filter('.inner'), + useKeyboard: this.enableKeyEvents && !this.handleSelect, + minScrollbarLength : 40, + wheelSpeed: 10, + alwaysVisibleY: this.scrollAlwaysVisible + }); + } + + this.rendered = true; + + this.cmpEl.on('click', function(e){ + if (/dataview/.test(e.target.className)) return false; + }); + + this.trigger('render:after', this); + return this; + }, + + selectRecord: function(record, suspendEvents) { + if (!this.handleSelect) + return; + + if (suspendEvents) + this.suspendEvents(); + + this.deselectAll(suspendEvents); + + if (record) { + record.set({selected: true}); + var idx = _.indexOf(this.store.models, record); + if (idx>=0 && this.dataViewItems && this.dataViewItems.length>idx) { + this.dataViewItems[idx].el.addClass('selected'); + } + } + + if (suspendEvents) + this.resumeEvents(); + return record; + }, + + selectByIndex: function(index, suspendEvents) { + if (this.store.length > 0 && index > -1 && index < this.store.length) { + return this.selectRecord(this.store.at(index), suspendEvents); + } + }, + + deselectAll: function(suspendEvents) { + if (suspendEvents) + this.suspendEvents(); + + _.each(this.store.where({selected: true}), function(record){ + record.set({selected: false}); + }); + this.cmpEl.find('.item.selected').removeClass('selected'); + + if (suspendEvents) + this.resumeEvents(); + }, + + getSelectedRec: function() { + return this.store.findWhere({selected: true}); + }, + + onResetItems: function() { + this.dataViewItems && _.each(this.dataViewItems, function(item) { + var tip = item.el.data('bs.tooltip'); + if (tip) { + if (tip.dontShow===undefined) + tip.dontShow = true; + (tip.tip()).remove(); + } + }, this); + this.dataViewItems = null; + + var template = _.template([ + '<% _.each(items, function(item) { %>', + '<% if (!item.id) item.id = Common.UI.getId(); %>', + '
data-toggle="tooltip" <% } %> ><%= itemTemplate(item) %>
', + '<% }) %>' + ].join('')); + this.cmpEl && this.cmpEl.find('.inner').html(template({ + items: this.store.toJSON(), + itemTemplate: this.itemTemplate, + style : this.style + })); + + if (!_.isUndefined(this.scroller)) { + this.scroller.destroy(); + delete this.scroller; + } + + this.scroller = new Common.UI.Scroller({ + el: $(this.el).find('.inner').addBack().filter('.inner'), + useKeyboard: this.enableKeyEvents && !this.handleSelect, + minScrollbarLength : 40, + wheelSpeed: 10, + alwaysVisibleY: this.scrollAlwaysVisible + }); + + if (!this.parentMenu && this.store.length>0) + this.onAfterShowMenu(); + this._layoutParams = undefined; + }, + + setStore: function(store) { + if (store) { + this.store = store; + this.onResetItems(); + } + }, + + onClickItem: function(e) { + if ( this.disabled ) return; + + window._event = e; // for FireFox only + + var index = $(e.currentTarget).closest('div.item').index(), + record = (index>=0) ? this.store.at(index) : null, + view = (index>=0) ? this.dataViewItems[index] : null; + if (!record || !view) return; + + record.set({selected: true}); + var tip = view.el.data('bs.tooltip'); + if (tip) (tip.tip()).remove(); + + if (!this.isSuspendEvents) { + this.trigger('item:click', this, view.el, record, e); + } + }, + + onAfterShowMenu: function(e) { + if (!this.dataViewItems) { + var me = this; + this.dataViewItems = []; + _.each(this.cmpEl.find('div.item'), function(item, index) { + var $item = $(item), + rec = me.store.at(index); + me.dataViewItems.push({el: $item}); + if (rec.get('tip')) { + $item.tooltip({ + title : rec.get('tip'), + placement : 'cursor', + zIndex : me.tipZIndex + }); + } + }); + } + }, + + scrollToRecord: function (record) { + if (!record) return; + var innerEl = $(this.el).find('.inner'), + inner_top = innerEl.offset().top, + idx = _.indexOf(this.store.models, record), + div = (idx>=0 && this.dataViewItems.length>idx) ? this.dataViewItems[idx].el : innerEl.find('#' + record.get('id')); + if (div.length<=0) return; + + var div_top = div.offset().top, + div_first = this.dataViewItems[0].el, + div_first_top = (div_first.length>0) ? div_first[0].offsetTop : 0; + if (div_top < inner_top + div_first_top || div_top+div.outerHeight() > inner_top + innerEl.height()) { + if (this.scroller) { + this.scroller.scrollTop(innerEl.scrollTop() + div_top - inner_top - div_first_top, 0); + } else { + innerEl.scrollTop(innerEl.scrollTop() + div_top - inner_top - div_first_top); + } + } + }, + + onKeyDown: function (e, data) { + if ( this.disabled ) return; + if (data===undefined) data = e; + if (_.indexOf(this.moveKeys, data.keyCode)>-1 || data.keyCode==Common.UI.Keys.RETURN) { + data.preventDefault(); + data.stopPropagation(); + var rec = this.getSelectedRec(); + if (data.keyCode==Common.UI.Keys.RETURN) { + if (this.selectedBeforeHideRec) // only for ComboDataView menuPicker + rec = this.selectedBeforeHideRec; + this.trigger('item:click', this, this, rec, e); + if (this.parentMenu) + this.parentMenu.hide(); + } else { + var idx = _.indexOf(this.store.models, rec); + if (idx<0) { + if (data.keyCode==Common.UI.Keys.LEFT) { + var target = $(e.target).closest('.dropdown-submenu.over'); + if (target.length>0) { + target.removeClass('over'); + target.find('> a').focus(); + } else + idx = 0; + } else + idx = 0; + } else if (this.options.keyMoveDirection == 'both') { + if (this._layoutParams === undefined) + this.fillIndexesArray(); + var topIdx = this.dataViewItems[idx].topIdx, + leftIdx = this.dataViewItems[idx].leftIdx; + + idx = undefined; + if (data.keyCode==Common.UI.Keys.LEFT) { + while (idx===undefined) { + leftIdx--; + if (leftIdx<0) { + var target = $(e.target).closest('.dropdown-submenu.over'); + if (target.length>0) { + target.removeClass('over'); + target.find('> a').focus(); + break; + } else + leftIdx = this._layoutParams.columns-1; + } + idx = this._layoutParams.itemsIndexes[topIdx][leftIdx]; + } + } else if (data.keyCode==Common.UI.Keys.RIGHT) { + while (idx===undefined) { + leftIdx++; + if (leftIdx>this._layoutParams.columns-1) leftIdx = 0; + idx = this._layoutParams.itemsIndexes[topIdx][leftIdx]; + } + } else if (data.keyCode==Common.UI.Keys.UP) { + while (idx===undefined) { + topIdx--; + if (topIdx<0) topIdx = this._layoutParams.rows-1; + idx = this._layoutParams.itemsIndexes[topIdx][leftIdx]; + } + } else { + while (idx===undefined) { + topIdx++; + if (topIdx>this._layoutParams.rows-1) topIdx = 0; + idx = this._layoutParams.itemsIndexes[topIdx][leftIdx]; + } + } + } else { + idx = (data.keyCode==Common.UI.Keys.UP || data.keyCode==Common.UI.Keys.LEFT) + ? Math.max(0, idx-1) + : Math.min(this.store.length - 1, idx + 1) ; + } + + if (idx !== undefined && idx>=0) rec = this.store.at(idx); + if (rec) { + this._fromKeyDown = true; + this.selectRecord(rec); + this._fromKeyDown = false; + this.scrollToRecord(rec); + } + } + } else { + this.trigger('item:keydown', this, rec, e); + } + }, + + attachKeyEvents: function() { + if (this.enableKeyEvents && this.handleSelect) { + var el = $(this.el).find('.inner').addBack().filter('.inner'); + el.addClass('canfocused'); + el.attr('tabindex', '0'); + el.on((this.parentMenu && this.useBSKeydown) ? 'dataview:keydown' : 'keydown', _.bind(this.onKeyDown, this)); + } + }, + + setDisabled: function(disabled) { + this.disabled = disabled; + $(this.el).find('.inner').addBack().filter('.inner').toggleClass('disabled', disabled); + }, + + isDisabled: function() { + return this.disabled; + }, + + alignPosition: function() { + var menuRoot = (this.parentMenu.cmpEl.attr('role') === 'menu') + ? this.parentMenu.cmpEl + : this.parentMenu.cmpEl.find('[role=menu]'), + docH = Common.Utils.innerHeight()-10, + innerEl = $(this.el).find('.inner').addBack().filter('.inner'), + parent = innerEl.parent(), + margins = parseInt(parent.css('margin-top')) + parseInt(parent.css('margin-bottom')) + parseInt(menuRoot.css('margin-top')), + paddings = parseInt(menuRoot.css('padding-top')) + parseInt(menuRoot.css('padding-bottom')), + menuH = menuRoot.outerHeight(), + top = parseInt(menuRoot.css('top')), + props = {minScrollbarLength : 40}; + this.scrollAlwaysVisible && (props.alwaysVisibleY = this.scrollAlwaysVisible); + + if (top + menuH > docH ) { + innerEl.css('max-height', (docH - top - paddings - margins) + 'px'); + this.scroller.update(props); + } else if ( top + menuH < docH && innerEl.height() < this.options.restoreHeight ) { + innerEl.css('max-height', (Math.min(docH - top - paddings - margins, this.options.restoreHeight)) + 'px'); + this.scroller.update(props); + } + }, + + fillIndexesArray: function() { + if (this.dataViewItems.length<=0) return; + + this._layoutParams = { + itemsIndexes: [], + columns: 0, + rows: 0 + }; + + var el = this.dataViewItems[0].el, + itemW = el.outerWidth() + parseInt(el.css('margin-left')) + parseInt(el.css('margin-right')), + offsetLeft = this.$el.offset().left, + offsetTop = el.offset().top, + prevtop = -1, topIdx = 0, leftIdx = 0; + + for (var i=0; iprevtop) { + prevtop = top; + this._layoutParams.itemsIndexes.push([]); + topIdx = this._layoutParams.itemsIndexes.length-1; + } + this._layoutParams.itemsIndexes[topIdx][leftIdx] = i; + item.topIdx = topIdx; + item.leftIdx = leftIdx; + if (this._layoutParams.columns docH) { menuRoot.css('max-height', (docH - top) + 'px'); (!this.scroller) && (this.scroller = new Common.UI.Scroller({ - el: $(this.el).find('.dropdown-menu '), + el: this.$el.find('.dropdown-menu '), minScrollbarLength: 30, suppressScrollX: true, alwaysVisibleY: this.scrollAlwaysVisible @@ -588,4 +588,447 @@ define([ })() }) })(); + + Common.UI.MenuSimple = Common.UI.BaseView.extend({ + options : { + cls : '', + style : '', + itemTemplate: null, + items : [], + menuAlign : 'tl-bl', + menuAlignEl : null, + offset : [0, 0], + cyclic : true, + search : false, + scrollAlwaysVisible: true + }, + + template: _.template([ + '' + ].join('')), + + initialize : function(options) { + Common.UI.BaseView.prototype.initialize.call(this, options); + + var me = this; + + this.id = this.options.id || Common.UI.getId(); + this.itemTemplate = this.options.itemTemplate || _.template([ + ' style="<%= style %>" <% } %>', + '<% if(typeof canFocused !== "undefined") { %> tabindex="-1" type="menuitem" <% } %>', + '<% if(typeof stopPropagation !== "undefined") { %> data-stopPropagation="true" <% } %>', + 'class="<% if (checked) { %> checked <% } %>" >', + '<% if (typeof iconCls !== "undefined") { %>', + '', + '<% } %>', + '<%= caption %>', + '' + ].join('')); + this.rendered = false; + this.items = this.options.items || []; + this.offset = [0, 0]; + this.menuAlign = this.options.menuAlign; + this.menuAlignEl = this.options.menuAlignEl; + this.scrollAlwaysVisible = this.options.scrollAlwaysVisible; + this.search = this.options.search; + + if (this.options.restoreHeight) { + this.options.restoreHeight = (typeof (this.options.restoreHeight) == "number") ? this.options.restoreHeight : (this.options.maxHeight ? this.options.maxHeight : 100000); + !this.options.maxHeight && (this.options.maxHeight = this.options.restoreHeight); + } + + if (!this.options.cyclic) this.options.cls += ' no-cyclic'; + + if (this.options.el) + this.render(); + + Common.UI.Menu.Manager.register(this); + }, + + remove: function() { + Common.UI.Menu.Manager.unregister(this); + Common.UI.BaseView.prototype.remove.call(this); + }, + + render: function(parentEl) { + var me = this; + + this.trigger('render:before', this); + + this.cmpEl = me.$el || $(this.el); + + parentEl && this.setElement(parentEl, false); + + if (!me.rendered) { + this.cmpEl = $(this.template({ + items: me.items, + itemTemplate: me.itemTemplate, + options : me.options + })); + + parentEl ? parentEl.append(this.cmpEl) : this.$el.append(this.cmpEl); + } + + var rootEl = this.cmpEl.parent(), + menuRoot = (rootEl.attr('role') === 'menu') ? rootEl : rootEl.find('[role=menu]'); + this.menuRoot = menuRoot; + + if (menuRoot) { + if (!me.rendered) { + menuRoot.on( "click", "li", _.bind(me.onItemClick, me)); + menuRoot.on( "mousedown", "li", _.bind(me.onItemMouseDown, me)); + } + + if (this.options.maxHeight) { + menuRoot.css({'max-height': me.options.maxHeight}); + this.scroller = new Common.UI.Scroller({ + el: me.$el.find('.dropdown-menu '), + minScrollbarLength: 30, + suppressScrollX: true, + alwaysVisibleY: this.scrollAlwaysVisible + }); + } + + menuRoot.css({ + position : 'fixed', + right : 'auto', + left : -1000, + top : -1000 + }); + + this.parentEl = menuRoot.parent(); + + this.parentEl.on('show.bs.dropdown', _.bind(me.onBeforeShowMenu, me)); + this.parentEl.on('shown.bs.dropdown', _.bind(me.onAfterShowMenu, me)); + this.parentEl.on('hide.bs.dropdown', _.bind(me.onBeforeHideMenu, me)); + this.parentEl.on('hidden.bs.dropdown', _.bind(me.onAfterHideMenu, me)); + this.parentEl.on('keydown.after.bs.dropdown', _.bind(me.onAfterKeydownMenu, me)); + + menuRoot.hover( + function(e) { me.isOver = true;}, + function(e) { me.isOver = false; } + ); + } + + this.rendered = true; + + this.trigger('render:after', this); + + return this; + }, + + resetItems: function(items) { + this.items = items || []; + this.$items = null; + var template = _.template([ + '<% _.each(items, function(item) { %>', + '<% if (!item.id) item.id = Common.UI.getId(); %>', + '<% item.checked = item.checked || false; %>', + '
  • <%= itemTemplate(item) %>
  • ', + '<% }) %>' + ].join('')); + this.cmpEl && this.cmpEl.html(template({ + items: this.items, + itemTemplate: this.itemTemplate, + options : this.options + })); + }, + + isVisible: function() { + return this.rendered && (this.cmpEl.is(':visible')); + }, + + show: function() { + if (this.rendered && this.parentEl && !this.parentEl.hasClass('open')) { + this.cmpEl.dropdown('toggle'); + } + }, + + hide: function() { + if (this.rendered && this.parentEl) { + if ( this.parentEl.hasClass('open') ) + this.cmpEl.dropdown('toggle'); + else if (this.parentEl.hasClass('over')) + this.parentEl.removeClass('over'); + } + }, + + onItemClick: function(e) { + if (e.which != 1 && e.which !== undefined) + return false; + + var index = $(e.currentTarget).closest('li').index(), + item = (index>=0) ? this.items[index] : null; + if (!item) return; + + if (item.disabled) + return false; + + if (item.checkable && !item.checked) + this.setChecked(index, !item.checked); + + this.isOver = false; + if (item.stopPropagation) { + e.stopPropagation(); + var me = this; + _.delay(function(){ + me.$el.parent().parent().find('[data-toggle=dropdown]').focus(); + }, 10); + return; + } + this.trigger('item:click', this, item, e); + }, + + onItemMouseDown: function(e) { + if (e.which != 1) { + e.preventDefault(); + e.stopPropagation(); + + return false; + } + e.stopPropagation(); + }, + + setChecked: function(index, check, suppressEvent) { + this.toggle(index, check, suppressEvent); + }, + + toggle: function(index, toggle, suppressEvent) { + var state = !!toggle; + var item = this.items[index]; + + this.clearAll(); + + if (item && item.checkable) { + item.checked = state; + + if (this.rendered) { + var itemEl = item.el || this.cmpEl.find('#'+item.id); + if (itemEl) { + itemEl.toggleClass('checked', item.checked); + if (!_.isEmpty(item.iconCls)) { + itemEl.css('background-image', 'none'); + } + } + } + + if (!suppressEvent) + this.trigger('item:toggle', this, item, state); + } + }, + + setDisabled: function(disabled) { + this.disabled = !!disabled; + + if (this.rendered) + this.cmpEl.toggleClass('disabled', this.disabled); + }, + + isDisabled: function() { + return this.disabled; + }, + + onBeforeShowMenu: function(e) { + Common.NotificationCenter.trigger('menu:show'); + this.trigger('show:before', this, e); + this.alignPosition(); + }, + + onAfterShowMenu: function(e) { + this.trigger('show:after', this, e); + if (this.scroller) { + this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible}); + var menuRoot = this.menuRoot, + $selected = menuRoot.find('> li .checked'); + if ($selected.length) { + var itemTop = $selected.position().top, + itemHeight = $selected.height(), + listHeight = menuRoot.height(); + if (itemTop < 0 || itemTop + itemHeight > listHeight) { + menuRoot.scrollTop(menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2)); + } + setTimeout(function(){$selected.focus();}, 1); + } + } + this._search = {}; + if (this.search && !this.$items) { + var me = this; + this.$items = this.menuRoot.find('> li').find('> a'); + _.each(this.$items, function(item, index) { + me.items[index].el = $(item); + }); + } + }, + + onBeforeHideMenu: function(e) { + this.trigger('hide:before', this, e); + + if (Common.UI.Scroller.isMouseCapture()) + e.preventDefault(); + }, + + onAfterHideMenu: function(e, isFromInputControl) { + this.trigger('hide:after', this, e, isFromInputControl); + Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl); + }, + + onAfterKeydownMenu: function(e) { + if (e.keyCode == Common.UI.Keys.RETURN) { + var li = $(e.target).closest('li'); + if (li.length<=0) li = $(e.target).parent().find('li .dataview'); + if (li.length>0) li.click(); + if (!li.hasClass('dropdown-submenu')) + Common.UI.Menu.Manager.hideAll(); + if ( $(e.currentTarget).closest('li').hasClass('dropdown-submenu')) { + e.stopPropagation(); + return false; + } + } else if (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) { + this.fromKeyDown = true; + } else if (e.keyCode == Common.UI.Keys.ESC) { +// Common.NotificationCenter.trigger('menu:afterkeydown', e); +// return false; + } else if (this.search && e.keyCode > 64 && e.keyCode < 91 && e.key){ + var me = this; + clearTimeout(this._search.timer); + this._search.timer = setTimeout(function () { me._search = {}; }, 1000); + + (!this._search.text) && (this._search.text = ''); + (!this._search.char) && (this._search.char = e.key); + (this._search.char !== e.key) && (this._search.full = true); + this._search.text += e.key; + if (this._search.index===undefined) { + this._search.index = this.$items.index(this.$items.filter(':focus')); + } + this.selectCandidate(); + } + }, + + selectCandidate: function() { + var index = this._search.index || 0, + re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'), + itemCandidate, idxCandidate; + + for (var i=0; iindex) { + itemCandidate = item; + idxCandidate = i; + break; + } + } + } + + if (itemCandidate) { + this._search.index = idxCandidate; + var item = itemCandidate.el; + if (this.scroller) { + this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible}); + var itemTop = item.position().top, + itemHeight = item.height(), + listHeight = this.menuRoot.height(); + if (itemTop < 0 || itemTop + itemHeight > listHeight) { + this.menuRoot.scrollTop(this.menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2)); + } + } + item.focus(); + } + }, + + setOffset: function(offsetX, offsetY) { + this.offset[0] = _.isUndefined(offsetX) ? this.offset[0] : offsetX; + this.offset[1] = _.isUndefined(offsetY) ? this.offset[1] : offsetY; + this.alignPosition(); + }, + + getOffset: function() { + return this.offset; + }, + + alignPosition: function(fixedAlign, fixedOffset) { + var menuRoot = this.menuRoot, + menuParent = this.menuAlignEl || menuRoot.parent(), + m = this.menuAlign.match(/^([a-z]+)-([a-z]+)/), + offset = menuParent.offset(), + docW = Common.Utils.innerWidth(), + docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number + menuW = menuRoot.outerWidth(), + menuH = menuRoot.outerHeight(), + parentW = menuParent.outerWidth(), + parentH = menuParent.outerHeight(); + + var posMenu = { + 'tl': [0, 0], + 'bl': [0, menuH], + 'tr': [menuW, 0], + 'br': [menuW, menuH] + }; + var posParent = { + 'tl': [0, 0], + 'tr': [parentW, 0], + 'bl': [0, parentH], + 'br': [parentW, parentH] + }; + var left = offset.left - posMenu[m[1]][0] + posParent[m[2]][0] + this.offset[0]; + var top = offset.top - posMenu[m[1]][1] + posParent[m[2]][1] + this.offset[1]; + + if (left + menuW > docW) + if (menuParent.is('li.dropdown-submenu')) { + left = offset.left - menuW + 2; + } else { + left = docW - menuW; + } + + if (this.options.restoreHeight) { + if (typeof (this.options.restoreHeight) == "number") { + if (top + menuH > docH) { + menuRoot.css('max-height', (docH - top) + 'px'); + (!this.scroller) && (this.scroller = new Common.UI.Scroller({ + el: this.$el.find('.dropdown-menu '), + minScrollbarLength: 30, + suppressScrollX: true, + alwaysVisibleY: this.scrollAlwaysVisible + })); + } else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight) { + menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px'); + } + } + } else { + if (top + menuH > docH) { + if (fixedAlign && typeof fixedAlign == 'string') { // how to align if menu height > window height + m = fixedAlign.match(/^([a-z]+)-([a-z]+)/); + top = offset.top - posMenu[m[1]][1] + posParent[m[2]][1] + this.offset[1] + (fixedOffset || 0); + } else + top = docH - menuH; + } + + if (top < 0) + top = 0; + } + + if (this.options.additionalAlign) + this.options.additionalAlign.call(this, menuRoot, left, top); + else + menuRoot.css({left: Math.ceil(left), top: Math.ceil(top)}); + }, + + clearAll: function() { + this.cmpEl && this.cmpEl.find('li > a.checked').removeClass('checked'); + _.each(this.items, function(item){ + item.checked = false; + }); + } + }); + }); \ No newline at end of file diff --git a/apps/common/main/lib/component/MenuItem.js b/apps/common/main/lib/component/MenuItem.js index 7b49b77e2..c54501185 100644 --- a/apps/common/main/lib/component/MenuItem.js +++ b/apps/common/main/lib/component/MenuItem.js @@ -119,8 +119,7 @@ define([ initialize : function(options) { Common.UI.BaseView.prototype.initialize.call(this, options); - var me = this, - el = $(this.el); + var me = this; this.id = me.options.id || Common.UI.getId(); this.cls = me.options.cls; @@ -138,7 +137,7 @@ define([ this.hint = me.options.hint; this.rendered = false; - if (this.menu !== null && !(this.menu instanceof Common.UI.Menu)) { + if (this.menu !== null && !(this.menu instanceof Common.UI.Menu) && !(this.menu instanceof Common.UI.MenuSimple)) { this.menu = new Common.UI.Menu(_.extend({}, me.options.menu)); } @@ -148,7 +147,7 @@ define([ render: function() { var me = this, - el = $(this.el); + el = me.$el || $(this.el); me.trigger('render:before', me); @@ -159,7 +158,7 @@ define([ el.off('click'); Common.UI.ToggleManager.unregister(me); - $(this.el).html(this.template({ + el.html(this.template({ id : me.id, caption : me.caption, iconCls : me.iconCls, @@ -170,7 +169,7 @@ define([ if (me.menu) { el.addClass('dropdown-submenu'); - me.menu.render($(this.el)); + me.menu.render(el); el.mouseenter(_.bind(me.menu.alignPosition, me.menu)); // el.focusin(_.bind(me.onFocusItem, me)); el.focusout(_.bind(me.onBlurItem, me)); @@ -214,7 +213,7 @@ define([ } if (this.disabled) - $(this.el).toggleClass('disabled', this.disabled); + el.toggleClass('disabled', this.disabled); el.on('click', _.bind(this.onItemClick, this)); el.on('mousedown', _.bind(this.onItemMouseDown, this)); @@ -223,7 +222,7 @@ define([ } } - me.cmpEl = $(this.el); + me.cmpEl = el; me.rendered = true; me.trigger('render:after', me); diff --git a/apps/common/main/lib/component/MetricSpinner.js b/apps/common/main/lib/component/MetricSpinner.js index e64b61522..584db251d 100644 --- a/apps/common/main/lib/component/MetricSpinner.js +++ b/apps/common/main/lib/component/MetricSpinner.js @@ -128,7 +128,7 @@ define([ Common.UI.BaseView.prototype.initialize.call(this, options); var me = this, - el = $(this.el); + el = me.$el || $(this.el); el.addClass('spinner'); @@ -165,7 +165,7 @@ define([ this.setRawValue(this.value); if (this.options.width) { - $(this.el).width(this.options.width); + el.width(this.options.width); } if (this.options.defaultValue===undefined) @@ -176,7 +176,7 @@ define([ }, render: function () { - var el = $(this.el); + var el = this.$el || $(this.el); el.html(this.template); this.$input = el.find('.form-control'); @@ -189,7 +189,7 @@ define([ }, setDisabled: function(disabled) { - var el = $(this.el); + var el = this.$el || $(this.el); if (disabled !== this.disabled) { el.find('button').toggleClass('disabled', disabled); el.toggleClass('disabled', disabled); diff --git a/apps/common/main/lib/component/RadioBox.js b/apps/common/main/lib/component/RadioBox.js index 3b698ddfe..9e8e2d159 100644 --- a/apps/common/main/lib/component/RadioBox.js +++ b/apps/common/main/lib/component/RadioBox.js @@ -76,8 +76,7 @@ define([ initialize : function(options) { Common.UI.BaseView.prototype.initialize.call(this, options); - var me = this, - el = $(this.el); + var me = this; this.name = this.options.name || Common.UI.getId(); @@ -94,7 +93,7 @@ define([ }, render: function () { - var el = $(this.el); + var el = this.$el || $(this.el); el.html(this.template({ labelText: this.options.labelText, name: this.name diff --git a/apps/common/main/lib/component/Scroller.js b/apps/common/main/lib/component/Scroller.js index 53e3783dd..db564e0d4 100644 --- a/apps/common/main/lib/component/Scroller.js +++ b/apps/common/main/lib/component/Scroller.js @@ -78,7 +78,7 @@ define([ render: function() { var me = this; - me.cmpEl = $(this.el); + me.cmpEl = me.$el || $(this.el); if (!me.rendered) { me.cmpEl.perfectScrollbar(_.extend({}, me.options)); diff --git a/apps/common/main/lib/component/Slider.js b/apps/common/main/lib/component/Slider.js index d11430466..0ee059b7e 100644 --- a/apps/common/main/lib/component/Slider.js +++ b/apps/common/main/lib/component/Slider.js @@ -104,8 +104,7 @@ define([ initialize : function(options) { Common.UI.BaseView.prototype.initialize.call(this, options); - var me = this, - el = $(this.el); + var me = this; me.width = me.options.width; me.minValue = me.options.minValue; @@ -131,10 +130,10 @@ define([ this.setElement(parentEl, false); parentEl.html(this.cmpEl); } else { - $(this.el).html(this.cmpEl); + me.$el.html(this.cmpEl); } } else { - this.cmpEl = $(this.el); + this.cmpEl = me.$el; } this.cmpEl.find('.track-center').width(me.options.width - 14); @@ -299,8 +298,7 @@ define([ initialize : function(options) { Common.UI.BaseView.prototype.initialize.call(this, options); - var me = this, - el = $(this.el); + var me = this; me.width = me.options.width; me.minValue = me.options.minValue; @@ -326,10 +324,10 @@ define([ this.setElement(parentEl, false); parentEl.html(this.cmpEl); } else { - $(this.el).html(this.cmpEl); + this.$el.html(this.cmpEl); } } else { - this.cmpEl = $(this.el); + this.cmpEl = this.$el; } var el = this.cmpEl; diff --git a/apps/common/main/lib/component/Switcher.js b/apps/common/main/lib/component/Switcher.js index e393011d2..a474e40ae 100644 --- a/apps/common/main/lib/component/Switcher.js +++ b/apps/common/main/lib/component/Switcher.js @@ -65,8 +65,7 @@ define([ initialize : function(options) { Common.UI.BaseView.prototype.initialize.call(this, options); - var me = this, - el = $(this.el); + var me = this; me.width = me.options.width; me.thumbWidth = me.options.thumbWidth; @@ -89,10 +88,10 @@ define([ this.setElement(parentEl, false); parentEl.html(this.cmpEl); } else { - $(this.el).html(this.cmpEl); + this.$el.html(this.cmpEl); } } else { - this.cmpEl = $(this.el); + this.cmpEl = this.$el; } this.thumb = this.cmpEl.find('.thumb'); diff --git a/apps/common/main/lib/component/TableStyler.js b/apps/common/main/lib/component/TableStyler.js index 1f2868e90..fab6c9640 100644 --- a/apps/common/main/lib/component/TableStyler.js +++ b/apps/common/main/lib/component/TableStyler.js @@ -335,10 +335,10 @@ define([ this.setElement(parentEl, false); parentEl.html(this.cmpEl); } else { - $(this.el).html(this.cmpEl); + this.$el.html(this.cmpEl); } } else { - this.cmpEl = $(this.el); + this.cmpEl = this.$el; } me.rendered = true; diff --git a/apps/common/main/lib/component/ThemeColorPalette.js b/apps/common/main/lib/component/ThemeColorPalette.js index 98899fd45..10549495c 100644 --- a/apps/common/main/lib/component/ThemeColorPalette.js +++ b/apps/common/main/lib/component/ThemeColorPalette.js @@ -98,7 +98,7 @@ define([ Common.UI.BaseView.prototype.initialize.call(this, options); var me = this, - el = $(this.el); + el = me.$el || $(this.el); this.colors = me.options.colors || this.generateColorData(me.options.themecolors, me.options.effects, me.options.standardcolors, me.options.transparent); @@ -116,7 +116,7 @@ define([ }, render: function () { - $(this.el).html(this.template({colors: this.colors})); + this.$el.html(this.template({colors: this.colors})); return this; }, @@ -144,7 +144,7 @@ define([ }, updateCustomColors: function() { - var el = $(this.el); + var el = this.$el || $(this.el); if (el) { var selected = el.find('a.' + this.selectedCls), color = (selected.length>0 && /color-dynamic/.test(selected[0].className)) ? selected.attr('color') : undefined; @@ -221,7 +221,7 @@ define([ }, setCustomColor: function(color) { - var el = $(this.el); + var el = this.$el || $(this.el); color = /#?([a-fA-F0-9]{6})/.exec(color); if (color) { this.saveCustomColor(color[1]); @@ -272,7 +272,7 @@ define([ }, select: function(color, suppressEvent) { - var el = $(this.el); + var el = this.$el || $(this.el); el.find('a.' + this.selectedCls).removeClass(this.selectedCls); if (typeof(color) == 'object' ) { @@ -321,7 +321,7 @@ define([ }, selectByRGB: function(rgb, suppressEvent) { - var el = $(this.el); + var el = this.$el || $(this.el); el.find('a.' + this.selectedCls).removeClass(this.selectedCls); var color = (typeof(rgb) == 'object') ? rgb.color : rgb; @@ -351,7 +351,7 @@ define([ if (effectcolors===undefined || standartcolors===undefined) return; var me = this, - el = $(this.el); + el = me.$el || $(this.el); if (me.aColorElements === undefined) { me.aColorElements = el.find('a.palette-color'); @@ -407,7 +407,7 @@ define([ if (value) this.select(value, true); else { - var selected = $(this.el).find('a.' + this.selectedCls); + var selected = el.find('a.' + this.selectedCls); if (selected.length && selected.hasClass('palette-color-effect')) { this.value = selected[0].className.match(this.colorRe)[1].toUpperCase(); } @@ -416,7 +416,7 @@ define([ }, clearSelection: function(suppressEvent) { - $(this.el).find('a.' + this.selectedCls).removeClass(this.selectedCls); + this.$el.find('a.' + this.selectedCls).removeClass(this.selectedCls); this.value = undefined; }, diff --git a/apps/common/main/lib/component/TreeView.js b/apps/common/main/lib/component/TreeView.js index c95bb9878..d8b645e2c 100644 --- a/apps/common/main/lib/component/TreeView.js +++ b/apps/common/main/lib/component/TreeView.js @@ -193,7 +193,7 @@ define([ }); if (view) { - var innerEl = $(this.el).find('.inner').addBack().filter('.inner'); + var innerEl = (this.$el || $(this.el)).find('.inner').addBack().filter('.inner'); if (innerEl) { (this.dataViewItems.length<1) && innerEl.find('.empty-text').remove(); diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index cb4c0eae6..c55a79656 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -172,7 +172,7 @@ define([ }, onAfterRender: function(panelPlugins) { - panelPlugins.viewPluginsList.on('item:click', _.bind(this.onSelectPlugin, this)); + panelPlugins.viewPluginsList && panelPlugins.viewPluginsList.on('item:click', _.bind(this.onSelectPlugin, this)); this.bindViewEvents(this.panelPlugins, this.events); var me = this; Common.NotificationCenter.on({ diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 4119b1e2b..e291dc5c0 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -618,7 +618,7 @@ define([ comments.setPreviewMode(disable); var leftMenu = app.getController('LeftMenu'); - leftMenu.leftMenu.getMenu('file').miProtect.setDisabled(disable); + leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable); leftMenu.setPreviewMode(disable); if (this.view) { diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index fe3601e45..7d5f8a2ba 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -846,6 +846,47 @@ Common.Utils.injectComponent = function ($slot, cmp) { } }; +jQuery.fn.extend({ + elementById: function (id, parent) { + /** + * usage: $obj.findById('#id') + * $().findById('#id', $obj | node) + * $.fn.findById('#id', $obj | node) + * + * return: dom element + * */ + var _el = document.getElementById(id.substring(1)); + if ( !_el ) { + parent = parent || this; + if ( parent instanceof jQuery ) { + parent.each(function (i, node) { + _el = node.querySelectorAll(id); + if ( _el.length == 0 ) { + if ( ('#' + node.id) == id ) { + _el = node; + return false; + } + } else + if ( _el.length ) { + _el = _el[0]; + return false; + } + }) + } else { + _el = parent.querySelectorAll(id); + if ( _el && _el.length ) return _el[0]; + } + } + + return _el; + }, + + findById: function (id, parent) { + var _el = $.fn.elementById.apply(this, arguments); + return !!_el ? $(_el) : $(); + } +}); + Common.Utils.InternalSettings.set('toolbar-height-tabs', 32); Common.Utils.InternalSettings.set('toolbar-height-tabs-top-title', 28); Common.Utils.InternalSettings.set('toolbar-height-controls', 67); diff --git a/apps/common/main/lib/view/About.js b/apps/common/main/lib/view/About.js index 4a50978b3..5bf6bf72a 100644 --- a/apps/common/main/lib/view/About.js +++ b/apps/common/main/lib/view/About.js @@ -45,6 +45,7 @@ define([ Common.Views.About = Common.UI.BaseView.extend(_.extend({ menu: undefined, + rendered: false, options: { alias: 'Common.Views.About' }, @@ -152,81 +153,95 @@ define([ }, render: function() { - var el = $(this.el); - el.html(this.template({ - publishername: '{{PUBLISHER_NAME}}', - publisheraddr: '{{PUBLISHER_ADDRESS}}', - publisherurl: '{{PUBLISHER_URL}}', - supportemail: '{{SUPPORT_EMAIL}}', - phonenum: '{{PUBLISHER_PHONE}}', - scope: this - })); + if ( !this.rendered ) { + this.rendered = true; - el.addClass('about-dlg'); - this.cntLicenseeInfo = $('#id-about-licensee-info'); - this.cntLicensorInfo = $('#id-about-licensor-info'); - this.divCompanyLogo = $('#id-about-company-logo'); - this.lblCompanyName = $('#id-about-company-name'); - this.lblCompanyAddress = $('#id-about-company-address'); - this.lblCompanyMail = $('#id-about-company-mail'); - this.lblCompanyUrl = $('#id-about-company-url'); - this.lblCompanyLic = $('#id-about-company-lic'); + var _$l = $(this.template({ + publishername: '{{PUBLISHER_NAME}}', + publisheraddr: '{{PUBLISHER_ADDRESS}}', + publisherurl: '{{PUBLISHER_URL}}', + supportemail: '{{SUPPORT_EMAIL}}', + phonenum: '{{PUBLISHER_PHONE}}', + scope: this + })); - if (_.isUndefined(this.scroller)) { - this.scroller = new Common.UI.Scroller({ - el: $(this.el), - suppressScrollX: true - }); + this.cntLicenseeInfo = _$l.findById('#id-about-licensee-info'); + this.cntLicensorInfo = _$l.findById('#id-about-licensor-info'); + this.divCompanyLogo = _$l.findById('#id-about-company-logo'); + this.lblCompanyName = _$l.findById('#id-about-company-name'); + this.lblCompanyAddress = _$l.findById('#id-about-company-address'); + this.lblCompanyMail = _$l.findById('#id-about-company-mail'); + this.lblCompanyUrl = _$l.findById('#id-about-company-url'); + this.lblCompanyLic = _$l.findById('#id-about-company-lic'); + + if ( this.licData ) + this.setLicInfo(this.licData); + + this.$el.html(_$l); + this.$el.addClass('about-dlg'); + + if (_.isUndefined(this.scroller)) { + this.scroller = new Common.UI.Scroller({ + el: this.$el, + suppressScrollX: true + }); + } } return this; }, setLicInfo: function(data){ - if (data && typeof data == 'object' && typeof(data.customer)=='object') { - var customer = data.customer; - - $('#id-about-licensor-logo').addClass('hidden'); - $('#id-about-licensor-short').removeClass('hidden'); - this.cntLicensorInfo.addClass('hidden'); + if ( !this.rendered ) { + this.licData = data || true; + } else { + if (data && typeof data == 'object' && typeof(data.customer)=='object') { + var customer = data.customer; - this.cntLicenseeInfo.removeClass('hidden'); - this.cntLicensorInfo.removeClass('margin-bottom'); + $('#id-about-licensor-logo').addClass('hidden'); + $('#id-about-licensor-short').removeClass('hidden'); + this.cntLicensorInfo.addClass('hidden'); - var value = customer.name; - value && value.length ? + this.cntLicenseeInfo.removeClass('hidden'); + this.cntLicensorInfo.removeClass('margin-bottom'); + + var value = customer.name; + value && value.length ? this.lblCompanyName.text(value) : this.lblCompanyName.parents('tr').addClass('hidden'); - value = customer.address; - value && value.length ? + value = customer.address; + value && value.length ? this.lblCompanyAddress.text(value) : this.lblCompanyAddress.parents('tr').addClass('hidden'); - (value = customer.mail) && value.length ? + (value = customer.mail) && value.length ? this.lblCompanyMail.attr('href', "mailto:"+value).text(value) : this.lblCompanyMail.parents('tr').addClass('hidden'); - if ((value = customer.www) && value.length) { - var http = !/^https?:\/{2}/i.test(value) ? "http:\/\/" : ''; - this.lblCompanyUrl.attr('href', http+value).text(value); - } else - this.lblCompanyUrl.parents('tr').addClass('hidden'); + if ((value = customer.www) && value.length) { + var http = !/^https?:\/{2}/i.test(value) ? "http:\/\/" : ''; + this.lblCompanyUrl.attr('href', http+value).text(value); + } else + this.lblCompanyUrl.parents('tr').addClass('hidden'); - (value = customer.info) && value.length ? + (value = customer.info) && value.length ? this.lblCompanyLic.text(value) : this.lblCompanyLic.parents('tr').addClass('hidden'); - (value = customer.logo) && value.length ? + (value = customer.logo) && value.length ? this.divCompanyLogo.html('') : this.divCompanyLogo.parents('tr').addClass('hidden'); - } else { - this.cntLicenseeInfo.addClass('hidden'); - this.cntLicensorInfo.addClass('margin-bottom'); + } else { + this.cntLicenseeInfo.addClass('hidden'); + this.cntLicensorInfo.addClass('margin-bottom'); + } } }, show: function () { + if ( !this.rendered ) this.render(); + Common.UI.BaseView.prototype.show.call(this,arguments); this.fireEvent('show', this ); }, diff --git a/apps/common/main/lib/view/Comments.js b/apps/common/main/lib/view/Comments.js index 788a1df3b..7efc94c3f 100644 --- a/apps/common/main/lib/view/Comments.js +++ b/apps/common/main/lib/view/Comments.js @@ -72,6 +72,99 @@ define([ return tpl; } + var CommentsPanelDataView = Common.UI.DataView.extend((function() { + return { + options : { + handleSelect: false, + scrollable: true, + listenStoreEvents: false, + template: _.template('
    ') + }, + + getTextBox: function () { + var text = $(this.el).find('textarea'); + return (text && text.length) ? text : undefined; + }, + setFocusToTextBox: function () { + var text = $(this.el).find('textarea'); + if (text && text.length) { + var val = text.val(); + text.focus(); + text.val(''); + text.val(val); + } + }, + getActiveTextBoxVal: function () { + var text = $(this.el).find('textarea'); + return (text && text.length) ? text.val().trim() : ''; + }, + autoHeightTextBox: function () { + var view = this, + textBox = $(this.el).find('textarea'), + domTextBox = null, + minHeight = 50, + lineHeight = 0, + scrollPos = 0, + oldHeight = 0, + newHeight = 0; + + function updateTextBoxHeight() { + if (domTextBox.scrollHeight > domTextBox.clientHeight) { + textBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'}); + } else { + oldHeight = domTextBox.clientHeight; + if (oldHeight >= minHeight) { + + textBox.css({height: minHeight + 'px'}); + + if (domTextBox.scrollHeight > domTextBox.clientHeight) { + newHeight = Math.max(domTextBox.scrollHeight + lineHeight, minHeight); + textBox.css({height: newHeight + 'px'}); + } + } + } + + view.autoScrollToEditButtons(); + } + + if (textBox && textBox.length) { + domTextBox = textBox.get(0); + + if (domTextBox) { + lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25; + updateTextBoxHeight(); + textBox.bind('input propertychange', updateTextBoxHeight) + } + } + + this.textBox = textBox; + }, + clearTextBoxBind: function () { + if (this.textBox) { + this.textBox.unbind('input propertychange'); + this.textBox = undefined; + } + }, + autoScrollToEditButtons: function () { + var button = $('#id-comments-change'), // TODO: add to cache + btnBounds = null, + contentBounds = this.el.getBoundingClientRect(), + moveY = 0, + padding = 7; + + if (button.length) { + btnBounds = button.get(0).getBoundingClientRect(); + if (btnBounds && contentBounds) { + moveY = contentBounds.bottom - (btnBounds.bottom + padding); + if (moveY < 0) { + this.scroller.scrollTop(this.scroller.getScrollTop() - moveY); + } + } + } + } + } + })()); + Common.Views.Comments = Common.UI.BaseView.extend(_.extend({ el: '#left-panel-comments', template: _.template(panelTemplate), @@ -81,11 +174,126 @@ define([ textBoxAutoSizeLocked: undefined, // disable autosize textbox viewmode: false, + _commentsViewOnItemClick: function (picker, item, record, e) { + var me = this; + var btn, showEditBox, showReplyBox, commentId, replyId, hideAddReply; + + function readdresolves() { + me.update(); + } + + btn = $(e.target); + if (btn) { + showEditBox = record.get('editText'); + showReplyBox = record.get('showReply'); + commentId = record.get('uid'); + replyId = btn.attr('data-value'); + + if (btn.hasClass('btn-edit')) { + if (!_.isUndefined(replyId)) { + me.fireEvent('comment:closeEditing', [commentId]); + me.fireEvent('comment:editReply', [commentId, replyId]); + + me.commentsView.reply = replyId; + + this.autoHeightTextBox(); + + readdresolves(); + + me.hookTextBox(); + + this.autoScrollToEditButtons(); + this.setFocusToTextBox(); + } else { + + if (!showEditBox) { + me.fireEvent('comment:closeEditing'); + record.set('editText', true); + + this.autoHeightTextBox(); + readdresolves(); + this.setFocusToTextBox(); + me.hookTextBox(); + } + } + } else if (btn.hasClass('btn-delete')) { + if (!_.isUndefined(replyId)) { + me.fireEvent('comment:removeReply', [commentId, replyId]); + } else { + me.fireEvent('comment:remove', [commentId]); + Common.NotificationCenter.trigger('edit:complete', me); + } + + me.fireEvent('comment:closeEditing'); + readdresolves(); + } else if (btn.hasClass('user-reply')) { + me.fireEvent('comment:closeEditing'); + record.set('showReply', true); + + readdresolves(); + + this.autoHeightTextBox(); + me.hookTextBox(); + + this.autoScrollToEditButtons(); + this.setFocusToTextBox(); + } else if (btn.hasClass('btn-reply', false)) { + if (showReplyBox) { + me.fireEvent('comment:addReply', [commentId, this.getActiveTextBoxVal()]); + me.fireEvent('comment:closeEditing'); + + readdresolves(); + } + } else if (btn.hasClass('btn-close', false)) { + + me.fireEvent('comment:closeEditing', [commentId]); + + } else if (btn.hasClass('btn-inner-edit', false)) { + if (!_.isUndefined(me.commentsView.reply)) { + me.fireEvent('comment:changeReply', [commentId, me.commentsView.reply, this.getActiveTextBoxVal()]); + me.commentsView.reply = undefined; + } else if (showEditBox) { + me.fireEvent('comment:change', [commentId, this.getActiveTextBoxVal()]); + } + + me.fireEvent('comment:closeEditing'); + + readdresolves(); + + } else if (btn.hasClass('btn-inner-close', false)) { + me.fireEvent('comment:closeEditing'); + + me.commentsView.reply = undefined; + + readdresolves(); + } else if (btn.hasClass('btn-resolve', false)) { + var tip = btn.data('bs.tooltip'); + if (tip) tip.dontShow = true; + + me.fireEvent('comment:resolve', [commentId]); + + readdresolves(); + } else if (btn.hasClass('btn-resolve-check', false)) { + var tip = btn.data('bs.tooltip'); + if (tip) tip.dontShow = true; + + me.fireEvent('comment:resolve', [commentId]); + + readdresolves(); + } else if (!btn.hasClass('msg-reply') && + !btn.hasClass('btn-resolve-check') && + !btn.hasClass('btn-resolve')) { + me.fireEvent('comment:show', [commentId, false]); + } + } + }, + initialize: function (options) { Common.UI.BaseView.prototype.initialize.call(this, options); this.store = this.options.store; }, + render: function () { var me = this; @@ -134,255 +342,51 @@ define([ } }); } - var CommentsPanelDataView = Common.UI.DataView.extend((function() { - return { + if (this.commentsView) { + this.commentsView.onResetItems(); + } else { + this.commentsView = new CommentsPanelDataView({ + el: $('.messages-ct',me.el), + store: me.store, + itemTemplate: _.template(replaceWords(commentsTemplate, { + textAddReply: me.textAddReply, + textAdd: me.textAdd, + textCancel: me.textCancel, + textEdit: me.textEdit, + textReply: me.textReply, + textClose: me.textClose, + maxCommLength: Asc.c_oAscMaxCellOrCommentLength + })) + }); - options : { - handleSelect: false, - scrollable: true, - listenStoreEvents: false, - template: _.template('
    ') - }, - - getTextBox: function () { - var text = $(this.el).find('textarea'); - return (text && text.length) ? text : undefined; - }, - setFocusToTextBox: function () { - var text = $(this.el).find('textarea'); - if (text && text.length) { - var val = text.val(); - text.focus(); - text.val(''); - text.val(val); - } - }, - getActiveTextBoxVal: function () { - var text = $(this.el).find('textarea'); - return (text && text.length) ? text.val().trim() : ''; - }, - autoHeightTextBox: function () { - var view = this, - textBox = $(this.el).find('textarea'), - domTextBox = null, - minHeight = 50, - lineHeight = 0, - scrollPos = 0, - oldHeight = 0, - newHeight = 0; - - function updateTextBoxHeight() { - if (domTextBox.scrollHeight > domTextBox.clientHeight) { - textBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'}); - } else { - oldHeight = domTextBox.clientHeight; - if (oldHeight >= minHeight) { - - textBox.css({height: minHeight + 'px'}); - - if (domTextBox.scrollHeight > domTextBox.clientHeight) { - newHeight = Math.max(domTextBox.scrollHeight + lineHeight, minHeight); - textBox.css({height: newHeight + 'px'}); - } - } - } - - view.autoScrollToEditButtons(); - } - - if (textBox && textBox.length) { - domTextBox = textBox.get(0); - - if (domTextBox) { - lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25; - updateTextBoxHeight(); - textBox.bind('input propertychange', updateTextBoxHeight) - } - } - - this.textBox = textBox; - }, - clearTextBoxBind: function () { - if (this.textBox) { - this.textBox.unbind('input propertychange'); - this.textBox = undefined; - } - }, - autoScrollToEditButtons: function () { - var button = $('#id-comments-change'), // TODO: add to cache - btnBounds = null, - contentBounds = this.el.getBoundingClientRect(), - moveY = 0, - padding = 7; - - if (button.length) { - btnBounds = button.get(0).getBoundingClientRect(); - if (btnBounds && contentBounds) { - moveY = contentBounds.bottom - (btnBounds.bottom + padding); - if (moveY < 0) { - this.scroller.scrollTop(this.scroller.getScrollTop() - moveY); - } - } - } + var addtooltip = function (dataview, view, record) { + if (view.tipsArray) { + view.tipsArray.forEach(function(item){ + item.remove(); + }); } - } - })()); - if (CommentsPanelDataView) { - if (this.commentsView) { - this.commentsView.onResetItems(); - } else { - this.commentsView = new CommentsPanelDataView({ - el: $('.messages-ct',me.el), - store: me.store, - itemTemplate: _.template(replaceWords(commentsTemplate, { - textAddReply: me.textAddReply, - textAdd: me.textAdd, - textCancel: me.textCancel, - textEdit: me.textEdit, - textReply: me.textReply, - textClose: me.textClose, - maxCommLength: Asc.c_oAscMaxCellOrCommentLength - })) + + var arr = [], + btns = $(view.el).find('.btn-resolve'); + btns.tooltip({title: me.textResolve, placement: 'cursor'}); + btns.each(function(idx, item){ + arr.push($(item).data('bs.tooltip').tip()); }); - - var addtooltip = function (dataview, view, record) { - if (view.tipsArray) { - view.tipsArray.forEach(function(item){ - item.remove(); - }); - } - - var arr = [], - btns = $(view.el).find('.btn-resolve'); - btns.tooltip({title: me.textResolve, placement: 'cursor'}); - btns.each(function(idx, item){ - arr.push($(item).data('bs.tooltip').tip()); - }); - btns = $(view.el).find('.btn-resolve-check'); - btns.tooltip({title: me.textOpenAgain, placement: 'cursor'}); - btns.each(function(idx, item){ - arr.push($(item).data('bs.tooltip').tip()); - }); - view.tipsArray = arr; - }; - this.commentsView.on('item:add', addtooltip); - this.commentsView.on('item:remove', addtooltip); - this.commentsView.on('item:change', addtooltip); - - this.commentsView.on('item:click', function (picker, item, record, e) { - var btn, showEditBox, showReplyBox, commentId, replyId, hideAddReply; - - function readdresolves() { - me.update(); - } - - btn = $(e.target); - if (btn) { - showEditBox = record.get('editText'); - showReplyBox = record.get('showReply'); - commentId = record.get('uid'); - replyId = btn.attr('data-value'); - - if (btn.hasClass('btn-edit')) { - if (!_.isUndefined(replyId)) { - me.fireEvent('comment:closeEditing', [commentId]); - me.fireEvent('comment:editReply', [commentId, replyId]); - - me.commentsView.reply = replyId; - - this.autoHeightTextBox(); - - readdresolves(); - - me.hookTextBox(); - - this.autoScrollToEditButtons(); - this.setFocusToTextBox(); - } else { - - if (!showEditBox) { - me.fireEvent('comment:closeEditing'); - record.set('editText', true); - - this.autoHeightTextBox(); - readdresolves(); - this.setFocusToTextBox(); - me.hookTextBox(); - } - } - } else if (btn.hasClass('btn-delete')) { - if (!_.isUndefined(replyId)) { - me.fireEvent('comment:removeReply', [commentId, replyId]); - } else { - me.fireEvent('comment:remove', [commentId]); - Common.NotificationCenter.trigger('edit:complete', me); - } - - me.fireEvent('comment:closeEditing'); - readdresolves(); - } else if (btn.hasClass('user-reply')) { - me.fireEvent('comment:closeEditing'); - record.set('showReply', true); - - readdresolves(); - - this.autoHeightTextBox(); - me.hookTextBox(); - - this.autoScrollToEditButtons(); - this.setFocusToTextBox(); - } else if (btn.hasClass('btn-reply', false)) { - if (showReplyBox) { - me.fireEvent('comment:addReply', [commentId, this.getActiveTextBoxVal()]); - me.fireEvent('comment:closeEditing'); - - readdresolves(); - } - } else if (btn.hasClass('btn-close', false)) { - - me.fireEvent('comment:closeEditing', [commentId]); - - } else if (btn.hasClass('btn-inner-edit', false)) { - if (!_.isUndefined(me.commentsView.reply)) { - me.fireEvent('comment:changeReply', [commentId, me.commentsView.reply, this.getActiveTextBoxVal()]); - me.commentsView.reply = undefined; - } else if (showEditBox) { - me.fireEvent('comment:change', [commentId, this.getActiveTextBoxVal()]); - } - - me.fireEvent('comment:closeEditing'); - - readdresolves(); - - } else if (btn.hasClass('btn-inner-close', false)) { - me.fireEvent('comment:closeEditing'); - - me.commentsView.reply = undefined; - - readdresolves(); - } else if (btn.hasClass('btn-resolve', false)) { - var tip = btn.data('bs.tooltip'); - if (tip) tip.dontShow = true; - - me.fireEvent('comment:resolve', [commentId]); - - readdresolves(); - } else if (btn.hasClass('btn-resolve-check', false)) { - var tip = btn.data('bs.tooltip'); - if (tip) tip.dontShow = true; - - me.fireEvent('comment:resolve', [commentId]); - - readdresolves(); - } else if (!btn.hasClass('msg-reply') && - !btn.hasClass('btn-resolve-check') && - !btn.hasClass('btn-resolve')) { - me.fireEvent('comment:show', [commentId, false]); - } - } + btns = $(view.el).find('.btn-resolve-check'); + btns.tooltip({title: me.textOpenAgain, placement: 'cursor'}); + btns.each(function(idx, item){ + arr.push($(item).data('bs.tooltip').tip()); }); - } + view.tipsArray = arr; + }; + + this.commentsView.on({ + 'item:add': addtooltip, + 'item:remove': addtooltip, + 'item:change': addtooltip, + 'item:click': this._commentsViewOnItemClick.bind(this) + }); } if (!this.rendered) this.setupLayout(); @@ -482,7 +486,7 @@ define([ }, setupLayout: function () { - var me = this, parent = $(me.el); + var me = this, parent = me.$el; var add = $('.new-comment-ct', me.el), to = $('.add-link-ct', me.el), diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index 12ce705de..0e2a7619d 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -489,13 +489,13 @@ define([ if ( !config.isEdit ) { if ( (config.canDownload || config.canDownloadOrigin) && !config.isOffline ) - this.btnDownload = createTitleButton('svg-btn-download', $html.find('#slot-hbtn-download')); + this.btnDownload = createTitleButton('svg-btn-download', $html.findById('#slot-hbtn-download')); if ( config.canPrint ) - this.btnPrint = createTitleButton('svg-btn-print', $html.find('#slot-hbtn-print')); + this.btnPrint = createTitleButton('svg-btn-print', $html.findById('#slot-hbtn-print')); if ( config.canEdit && config.canRequestEditRights ) - this.btnEdit = createTitleButton('svg-btn-edit', $html.find('#slot-hbtn-edit')); + this.btnEdit = createTitleButton('svg-btn-edit', $html.findById('#slot-hbtn-edit')); } me.btnOptions.render($html.find('#slot-btn-options')); @@ -519,12 +519,12 @@ define([ me.setUserName(me.options.userName); if ( config.canPrint && config.isEdit ) { - me.btnPrint = createTitleButton('svg-btn-print', $('#slot-btn-dt-print', $html), true); + me.btnPrint = createTitleButton('svg-btn-print', $html.findById('#slot-btn-dt-print'), true); } - me.btnSave = createTitleButton('svg-btn-save', $('#slot-btn-dt-save', $html), true); - me.btnUndo = createTitleButton('svg-btn-undo', $('#slot-btn-dt-undo', $html), true); - me.btnRedo = createTitleButton('svg-btn-redo', $('#slot-btn-dt-redo', $html), true); + me.btnSave = createTitleButton('svg-btn-save', $html.findById('#slot-btn-dt-save'), true); + me.btnUndo = createTitleButton('svg-btn-undo', $html.findById('#slot-btn-dt-undo'), true); + me.btnRedo = createTitleButton('svg-btn-redo', $html.findById('#slot-btn-dt-redo'), true); if ( me.btnSave.$icon.is('svg') ) { me.btnSave.$icon.addClass('icon-save'); diff --git a/apps/common/main/lib/view/Plugins.js b/apps/common/main/lib/view/Plugins.js index 36c163b9b..90a615f47 100644 --- a/apps/common/main/lib/view/Plugins.js +++ b/apps/common/main/lib/view/Plugins.js @@ -88,22 +88,22 @@ define([ el && (this.$el = $(el)); this.$el.html(this.template({scope: this})); - this.viewPluginsList = new Common.UI.DataView({ - el: $('#plugins-list'), - store: this.storePlugins, - enableKeyEvents: false, - itemTemplate: _.template([ - '
    ', - '
    1) ? 1 : 0) + (variations[currentVariation].get("icons").length>2 ? 2 : 0)] %>);">
    ', - '<% if (variations.length>1) { %>', - '
    ', - '<% } %>', - '<%= name %>', - '
    ' - ].join('')) - }); - this.lockedControls.push(this.viewPluginsList); - this.viewPluginsList.cmpEl.off('click'); + // this.viewPluginsList = new Common.UI.DataView({ + // el: $('#plugins-list'), + // store: this.storePlugins, + // enableKeyEvents: false, + // itemTemplate: _.template([ + // '
    ', + // '
    1) ? 1 : 0) + (variations[currentVariation].get("icons").length>2 ? 2 : 0)] %>);">
    ', + // '<% if (variations.length>1) { %>', + // '
    ', + // '<% } %>', + // '<%= name %>', + // '
    ' + // ].join('')) + // }); + // this.lockedControls.push(this.viewPluginsList); + // this.viewPluginsList.cmpEl.off('click'); this.pluginName = $('#current-plugin-header label'); this.pluginsPanel = $('#plugins-box'); diff --git a/apps/common/mobile/resources/img/header/header-logo.png b/apps/common/mobile/resources/img/header/header-logo.png new file mode 100644 index 000000000..bace6a100 Binary files /dev/null and b/apps/common/mobile/resources/img/header/header-logo.png differ diff --git a/apps/common/mobile/resources/img/header/header-logo@2x.png b/apps/common/mobile/resources/img/header/header-logo@2x.png new file mode 100644 index 000000000..57644434a Binary files /dev/null and b/apps/common/mobile/resources/img/header/header-logo@2x.png differ diff --git a/apps/documenteditor/embed/index.html b/apps/documenteditor/embed/index.html index 7b276bdb1..71e53a6d1 100644 --- a/apps/documenteditor/embed/index.html +++ b/apps/documenteditor/embed/index.html @@ -15,170 +15,94 @@ @@ -232,50 +157,19 @@ .replace(/>/g, '>'); } - var params = getUrlParams(), - lang = (params["lang"] || 'en').split(/[\-\_]/)[0], - customer = params["customer"] ? ('
    ' + encodeUrlParam(params["customer"]) + '
    ') : '', - margin = (customer !== '') ? 50 : 20, - loading = 'Loading...', - logo = params["logo"] ? ((params["logo"] !== 'none') ? ('') : '') : null; + var params = getUrlParams(), + lang = (params["lang"] || 'en').split(/[\-\_]/)[0], + logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null; - window.frameEditorId = params["frameEditorId"]; + window.frameEditorId = params["frameEditorId"]; - if ( lang == 'de') loading = 'Ladevorgang...'; - else if ( lang == 'es') loading = 'Cargando...'; - else if ( lang == 'fr') loading = 'Chargement en cours...'; - else if ( lang == 'it') loading = 'Caricamento in corso...'; - else if ( lang == 'pt') loading = 'Carregando...'; - else if ( lang == 'ru') loading = 'Загрузка...'; - else if ( lang == 'sl') loading = 'Nalaganje...'; - else if ( lang == 'tr') loading = 'Yükleniyor...'; - else if ( lang == 'bg') loading = 'Зареждане...'; - else if ( lang == 'cs') loading = 'Nahrávám...'; - else if ( lang == 'hu') loading = 'Betöltés...'; - else if ( lang == 'ja') loading = '読み込み中...'; - else if ( lang == 'ko') loading = '로드 중...'; - else if ( lang == 'lv') loading = 'Ieladēšana ...'; - else if ( lang == 'nl') loading = 'Laden...'; - else if ( lang == 'pl') loading = 'Ładowanie...'; - else if ( lang == 'sk') loading = 'Nahrávam...'; - else if ( lang == 'uk') loading = 'Завантаження...'; - else if ( lang == 'vi') loading = 'Đang tải...'; - else if ( lang == 'zh') loading = '加载中...'; - - document.write( - '
    ' + - '
    ' + - ((logo!==null) ? logo : - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ') + - '
    ' + - '
    ' + customer + - '
    ' + loading + '
    ' + - '
    ' + - '
    '); + var elem = document.querySelector('.loading-logo'); + if (elem && logo) { + elem.style.backgroundImage= 'none'; + var img = document.querySelector('.loading-logo img'); + img && img.setAttribute('src', logo); + img.style.opacity = 1; + }
    diff --git a/apps/documenteditor/embed/index.html.deploy b/apps/documenteditor/embed/index.html.deploy index f66c00573..8e30b2c8e 100644 --- a/apps/documenteditor/embed/index.html.deploy +++ b/apps/documenteditor/embed/index.html.deploy @@ -13,168 +13,93 @@ @@ -184,6 +109,7 @@ +
    diff --git a/apps/documenteditor/embed/index_loader.html b/apps/documenteditor/embed/index_loader.html new file mode 100644 index 000000000..4042fb812 --- /dev/null +++ b/apps/documenteditor/embed/index_loader.html @@ -0,0 +1,375 @@ + + + + + Documents + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    +
      +
    • +
    • +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    of 0
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/documenteditor/embed/index_loader.html.deploy b/apps/documenteditor/embed/index_loader.html.deploy new file mode 100644 index 000000000..bac45e2be --- /dev/null +++ b/apps/documenteditor/embed/index_loader.html.deploy @@ -0,0 +1,355 @@ + + + + + Documents + + + + + + + + + + + + + + + + + +
    + +
    +
      +
    • +
    • +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    of 0
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 236ae58aa..002792ba4 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -97,38 +97,9 @@ define([ 'settings:apply': _.bind(this.applySettings, this) } }); - }, - onLaunch: function() { - var me = this; - - this.stackLongActions = new Common.IrregularStack({ - strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;}, - weakCompare : function(obj1, obj2){return obj1.type === obj2.type;} - }); - - this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false}; - this.languages = null; - this.translationTable = []; - this.isModalShowed = 0; - // Initialize viewport - - if (!Common.Utils.isBrowserSupported()){ - Common.Utils.showBrowserRestriction(); - Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText); - return; - } - - var value = Common.localStorage.getItem("de-settings-fontrender"); - if (value === null) - window.devicePixelRatio > 1 ? value = '1' : '0'; - Common.Utils.InternalSettings.set("de-settings-fontrender", value); - - // Initialize api - - window["flat_desine"] = true; - - var styleNames = ['Normal', 'No Spacing', 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Heading 5', + var me = this, + styleNames = ['Normal', 'No Spacing', 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Heading 5', 'Heading 6', 'Heading 7', 'Heading 8', 'Heading 9', 'Title', 'Subtitle', 'Quote', 'Intense Quote', 'List Paragraph', 'footnote text'], translate = { 'Series': this.txtSeries, @@ -164,16 +135,39 @@ define([ "Hyperlink": this.txtHyperlink }; styleNames.forEach(function(item){ - translate[item] = me.translationTable[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item; + translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item; }); - me.translationTable['Header'] = this.txtHeader; - me.translationTable['Footer'] = this.txtFooter; + me.translationTable = translate; + }, - this.api = new Asc.asc_docs_api({ - 'id-view' : 'editor_sdk', - 'translate': translate + onLaunch: function() { + var me = this; + + this.stackLongActions = new Common.IrregularStack({ + strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;}, + weakCompare : function(obj1, obj2){return obj1.type === obj2.type;} }); + this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false}; + this.languages = null; + this.isModalShowed = 0; + // Initialize viewport + + if (!Common.Utils.isBrowserSupported()){ + Common.Utils.showBrowserRestriction(); + Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText); + return; + } + + var value = Common.localStorage.getItem("de-settings-fontrender"); + if (value === null) + window.devicePixelRatio > 1 ? value = '1' : '0'; + Common.Utils.InternalSettings.set("de-settings-fontrender", value); + + // Initialize api + window["flat_desine"] = true; + this.api = this.getApplication().getController('Viewport').getApi(); + if (this.api){ this.api.SetDrawingFreeze(true); switch (value) { @@ -365,6 +359,9 @@ define([ if (this.appOptions.location == 'us' || this.appOptions.location == 'ca') Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch); + if (!this.editorConfig.customization || !(this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo)) + $('#editor_sdk').append('
    ' + '
    '.repeat(20) + '
    '); + Common.Controllers.Desktop.init(this.appOptions); }, @@ -1026,7 +1023,6 @@ define([ if (me.needToUpdateVersion) toolbarController.onApiCoAuthoringDisconnect(); me.api.UpdateInterfaceState(); - me.fillTextArt(me.api.asc_getTextArtPreviews()); Common.NotificationCenter.trigger('document:ready', 'main'); me.applyLicense(); @@ -1051,6 +1047,8 @@ define([ $(document).on('contextmenu', _.bind(me.onContextMenu, me)); Common.Gateway.documentReady(); + + $('.doc-placeholder').remove(); }, onLicenseChanged: function(params) { @@ -1809,25 +1807,25 @@ define([ shapeStore.reset(); - var groupscount = groupNames.length; _.each(groupNames, function(groupName, index){ var store = new Backbone.Collection([], { model: DE.Models.ShapeModel - }); + }), + arr = []; var cols = (shapes[index].length) > 18 ? 7 : 6, height = Math.ceil(shapes[index].length/cols) * 35 + 3, width = 30 * cols; _.each(shapes[index], function(shape, idx){ - store.add({ + arr.push({ data : {shapeType: shape.Type}, tip : me['txtShape_' + shape.Type] || (me.textShape + ' ' + (idx+1)), allowSelected : true, selected: false }); }); - + store.add(arr); shapegrouparray.push({ groupName : me.shapeGroupNames[index], groupStore : store, @@ -1837,19 +1835,20 @@ define([ }); shapeStore.add(shapegrouparray); - setTimeout(function(){ - me.getApplication().getController('Toolbar').fillAutoShapes(); + me.getApplication().getController('Toolbar').onApiAutoShapes(); }, 50); - }, fillTextArt: function(shapes){ - if (_.isEmpty(shapes)) return; - - var me = this, arr = [], + var arr = [], artStore = this.getCollection('Common.Collections.TextArt'); + if (!shapes && artStore.length>0) {// shapes == undefined when update textart collection (from asc_onSendThemeColors) + shapes = this.api.asc_getTextArtPreviews(); + } + if (_.isEmpty(shapes)) return; + _.each(shapes, function(shape, index){ arr.push({ imageUrl : shape, @@ -1859,15 +1858,6 @@ define([ }); }); artStore.reset(arr); - - setTimeout(function(){ - me.getApplication().getController('Toolbar').fillTextArt(); - }, 50); - - setTimeout(function(){ - me.getApplication().getController('RightMenu').fillTextArt(); - }, 50); - }, updateThemeColors: function() { @@ -1875,10 +1865,6 @@ define([ setTimeout(function(){ me.getApplication().getController('RightMenu').UpdateThemeColors(); }, 50); - setTimeout(function(){ - me.getApplication().getController('DocumentHolder').getView().updateThemeColors(); - }, 50); - setTimeout(function(){ me.getApplication().getController('Toolbar').updateThemeColors(); }, 50); @@ -1890,7 +1876,7 @@ define([ this.updateThemeColors(); var me = this; setTimeout(function(){ - me.fillTextArt(me.api.asc_getTextArtPreviews()); + me.fillTextArt(); }, 1); } }, diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index d79e0ba8c..fd8b9fabc 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -251,10 +251,6 @@ define([ this.rightmenu.textartSettings.UpdateThemeColors(); }, - fillTextArt: function() { - this.rightmenu.textartSettings.fillTextArt(); - }, - updateMetricUnit: function() { this.rightmenu.headerSettings.updateMetricUnit(); this.rightmenu.paragraphSettings.updateMetricUnit(); @@ -276,7 +272,7 @@ define([ } if (this.editMode && this.api) { - this.rightmenu.shapeSettings.createDelayedElements(); + // this.rightmenu.shapeSettings.createDelayedElements(); var selectedElements = this.api.getSelectedElements(); if (selectedElements.length>0) { this.onFocusObject(selectedElements, !Common.localStorage.getBool("de-hide-right-settings", this.rightmenu.defaultHideRightMenu)); diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 00a89dd3e..cc10f585e 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -103,12 +103,15 @@ define([ this.diagramEditor = null; this._isAddingShape = false; this.editMode = true; + this.binding = {}; this.addListeners({ 'Toolbar': { 'insert:break' : this.onClickPageBreak, 'change:compact' : this.onClickChangeCompact, - 'home:open' : this.onHomeOpen + 'home:open' : this.onHomeOpen, + 'add:chart' : this.onSelectChart, + 'insert:textart' : this.onInsertTextart }, 'FileMenu': { 'menu:hide': this.onFileMenu.bind(this, 'hide'), @@ -312,7 +315,6 @@ define([ toolbar.mnuColorSchema.on('item:click', _.bind(this.onColorSchemaClick, this)); toolbar.mnuColorSchema.on('show:after', _.bind(this.onColorSchemaShow, this)); toolbar.btnMailRecepients.on('click', _.bind(this.onSelectRecepientsClick, this)); - toolbar.mnuInsertChartPicker.on('item:click', _.bind(this.onSelectChart, this)); toolbar.mnuPageNumberPosPicker.on('item:click', _.bind(this.onInsertPageNumberClick, this)); toolbar.btnEditHeader.menu.on('item:click', _.bind(this.onEditHeaderFooterClick, this)); toolbar.mnuPageNumCurrentPos.on('click', _.bind(this.onPageNumCurrentPosClick, this)); @@ -370,7 +372,7 @@ define([ this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onCanCopyCut', _.bind(this.onApiCanCopyCut, this)); - this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onMathTypes, this)); + this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this)); this.api.asc_registerCallback('asc_onColumnsProps', _.bind(this.onColumnsProps, this)); this.api.asc_registerCallback('asc_onSectionProps', _.bind(this.onSectionProps, this)); this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this)); @@ -1838,11 +1840,8 @@ define([ } }, - onSelectChart: function(picker, item, record) { - if (!record) return; - + onSelectChart: function(type) { var me = this, - type = record.get('type'), chart = false; var selectedElements = me.api.getSelectedElements(); @@ -1882,6 +1881,19 @@ define([ } }, + onInsertTextart: function (data) { + if (this.api) { + this.toolbar.fireEvent('inserttextart', this.toolbar); + this.api.AddTextArt(data); + + if (this.toolbar.btnInsertShape.pressed) + this.toolbar.btnInsertShape.toggle(false, true); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertTextArt); + Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art'); + } + }, + onInsertPageNumberClick: function(picker, item, record) { if (this.api) this.api.put_PageNum(record.get('data').type, record.get('data').subtype); @@ -2323,10 +2335,49 @@ define([ this._state.clrtext_asccolor = color; }, + onApiAutoShapes: function() { + var me = this; + var onShowBefore = function(menu) { + me.fillAutoShapes(); + menu.off('show:before', onShowBefore); + }; + me.toolbar.btnInsertShape.menu.on('show:before', onShowBefore); + }, + fillAutoShapes: function() { var me = this, shapesStore = this.getApplication().getCollection('ShapeGroups'); + var onShowAfter = function(menu) { + for (var i = 0; i < shapesStore.length; i++) { + var shapePicker = new Common.UI.DataViewSimple({ + el: $('#id-toolbar-menu-shapegroup' + i, menu.items[i].$el), + store: shapesStore.at(i).get('groupStore'), + parentMenu: menu.items[i].menu, + itemTemplate: _.template('
    \">
    ') + }); + shapePicker.on('item:click', function(picker, item, record, e) { + if (me.api) { + if (record) { + me._addAutoshape(true, record.get('data').shapeType); + me._isAddingShape = true; + } + + if (me.toolbar.btnInsertText.pressed) { + me.toolbar.btnInsertText.toggle(false, true); + } + + if (e.type !== 'click') + me.toolbar.btnInsertShape.menu.hide(); + Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertShape); + Common.component.Analytics.trackEvent('ToolBar', 'Add Shape'); + } + }); + } + menu.off('show:after', onShowAfter); + }; + me.toolbar.btnInsertShape.menu.on('show:after', onShowAfter); + for (var i = 0; i < shapesStore.length; i++) { var shapeGroup = shapesStore.at(i); @@ -2339,34 +2390,7 @@ define([ ] }) }); - me.toolbar.btnInsertShape.menu.addItem(menuItem); - - var shapePicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-shapegroup' + i), - store: shapeGroup.get('groupStore'), - parentMenu: menuItem.menu, - showLast: false, - itemTemplate: _.template('
    \">
    ') - }); - - shapePicker.on('item:click', function(picker, item, record, e) { - if (me.api) { - if (record) { - me._addAutoshape(true, record.get('data').shapeType); - me._isAddingShape = true; - } - - if (me.toolbar.btnInsertText.pressed) { - me.toolbar.btnInsertText.toggle(false, true); - } - - if (e.type !== 'click') - me.toolbar.btnInsertShape.menu.hide(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertShape); - Common.component.Analytics.trackEvent('ToolBar', 'Add Shape'); - } - }); } }, @@ -2375,12 +2399,44 @@ define([ var me = this, equationsStore = this.getApplication().getCollection('EquationGroups'); - me.equationPickers = []; me.toolbar.btnInsertEquation.menu.removeAll(); - + var onShowAfter = function(menu) { + for (var i = 0; i < equationsStore.length; ++i) { + var equationPicker = new Common.UI.DataViewSimple({ + el: $('#id-toolbar-menu-equationgroup' + i, menu.items[i].$el), + parentMenu: menu.items[i].menu, + store: equationsStore.at(i).get('groupStore'), + scrollAlwaysVisible: true, + itemTemplate: _.template('
    ' + + '
    ' + + '
    ') + }); + equationPicker.on('item:click', function(picker, item, record, e) { + if (me.api) { + if (record) + me.api.asc_AddMath(record.get('data').equationType); + + if (me.toolbar.btnInsertText.pressed) { + me.toolbar.btnInsertText.toggle(false, true); + } + if (me.toolbar.btnInsertShape.pressed) { + me.toolbar.btnInsertShape.toggle(false, true); + } + + if (e.type !== 'click') + me.toolbar.btnInsertEquation.menu.hide(); + Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertEquation); + Common.component.Analytics.trackEvent('ToolBar', 'Add Equation'); + } + }); + } + menu.off('show:after', onShowAfter); + }; + me.toolbar.btnInsertEquation.menu.on('show:after', onShowAfter); + for (var i = 0; i < equationsStore.length; ++i) { var equationGroup = equationsStore.at(i); - var menuItem = new Common.UI.MenuItem({ caption: equationGroup.get('groupName'), menu: new Common.UI.Menu({ @@ -2392,56 +2448,7 @@ define([ ] }) }); - me.toolbar.btnInsertEquation.menu.addItem(menuItem); - - var equationPicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-equationgroup' + i), - store: equationGroup.get('groupStore'), - parentMenu: menuItem.menu, - showLast: false, - itemTemplate: _.template('
    ' + - '
    ') - }); - if (equationGroup.get('groupHeight').length) { - - me.equationPickers.push(equationPicker); - me.toolbar.btnInsertEquation.menu.on('show:after', function () { - - if (me.equationPickers.length) { - var element = $(this.el).find('.over').find('.menu-shape'); - if (element.length) { - for (var i = 0; i < me.equationPickers.length; ++i) { - if (element[0].id == me.equationPickers[i].el.id) { - me.equationPickers[i].scroller.update({alwaysVisibleY: true}); - me.equationPickers.splice(i, 1); - return; - } - } - } - } - }); - } - - equationPicker.on('item:click', function(picker, item, record, e) { - if (me.api) { - if (record) - me.api.asc_AddMath(record.get('data').equationType); - - if (me.toolbar.btnInsertText.pressed) { - me.toolbar.btnInsertText.toggle(false, true); - } - if (me.toolbar.btnInsertShape.pressed) { - me.toolbar.btnInsertShape.toggle(false, true); - } - - if (e.type !== 'click') - me.toolbar.btnInsertEquation.menu.hide(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertEquation); - Common.component.Analytics.trackEvent('ToolBar', 'Add Equation'); - } - }); } }, @@ -2453,6 +2460,16 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertEquation); }, + onApiMathTypes: function(equation) { + this._equationTemp = equation; + var me = this; + var onShowBefore = function(menu) { + me.onMathTypes(me._equationTemp); + me.toolbar.btnInsertEquation.menu.off('show:before', onShowBefore); + }; + me.toolbar.btnInsertEquation.menu.on('show:before', onShowBefore); + }, + onMathTypes: function(equation) { var equationgrouparray = [], equationsStore = this.getCollection('EquationGroups'); @@ -2493,35 +2510,29 @@ define([ translationTable[Common.define.c_oAscMathType[name]] = this[translate]; } } - - var i,id = 0, count = 0, length = 0, width = 0, height = 0, store = null, list = null, eqStore = null, eq = null; + var i,id = 0, count = 0, length = 0, width = 0, height = 0, store = null, list = null, eqStore = null, eq = null, data; if (equation) { - - count = equation.get_Data().length; - + data = equation.get_Data(); + count = data.length; if (count) { for (var j = 0; j < count; ++j) { - id = equation.get_Data()[j].get_Id(); - width = equation.get_Data()[j].get_W(); - height = equation.get_Data()[j].get_H(); + var group = data[j]; + id = group.get_Id(); + width = group.get_W(); + height = group.get_H(); store = new Backbone.Collection([], { model: DE.Models.EquationModel }); if (store) { - - var allItemsCount = 0, itemsCount = 0, ids = 0; - - length = equation.get_Data()[j].get_Data().length; - + var allItemsCount = 0, itemsCount = 0, ids = 0, arr = []; + length = group.get_Data().length; for (i = 0; i < length; ++i) { - eqStore = equation.get_Data()[j].get_Data()[i]; - + eqStore = group.get_Data()[i]; itemsCount = eqStore.get_Data().length; for (var p = 0; p < itemsCount; ++p) { - eq = eqStore.get_Data()[p]; ids = eq.get_Id(); @@ -2530,8 +2541,7 @@ define([ if (translationTable.hasOwnProperty(ids)) { translate = translationTable[ids]; } - - store.add({ + arr.push({ data : {equationType: ids}, tip : translate, allowSelected : true, @@ -2545,7 +2555,7 @@ define([ allItemsCount += itemsCount; } - + store.add(arr); width = c_oAscMathMainTypeStrings[id][1] * (width + 10); // 4px margin + 4px margin + 1px border + 1px border var normHeight = parseInt(370 / (height + 10)) * (height + 10); @@ -2557,57 +2567,12 @@ define([ }); } } - equationsStore.add(equationgrouparray); - this.fillEquations(); } } }, - fillTextArt: function() { - if (!this.toolbar.btnInsertTextArt.rendered) return; - - var me = this; - if (this.toolbar.mnuTextArtPicker) { - var models = this.getApplication().getCollection('Common.Collections.TextArt').models, - count = this.toolbar.mnuTextArtPicker.store.length; - if (count>0 && count==models.length) { - var data = this.toolbar.mnuTextArtPicker.store.models; - _.each(models, function(template, index){ - data[index].set('imageUrl', template.get('imageUrl')); - }); - } else { - this.toolbar.mnuTextArtPicker.store.reset(models); - } - } else { - this.toolbar.mnuTextArtPicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-insart'), - store: this.getApplication().getCollection('Common.Collections.TextArt'), - parentMenu: this.toolbar.btnInsertTextArt.menu, - showLast: false, - itemTemplate: _.template('
    ') - }); - - this.toolbar.mnuTextArtPicker.on('item:click', function(picker, item, record, e) { - if (me.api) { - if (record) { - me.toolbar.fireEvent('inserttextart', me.toolbar); - me.api.AddTextArt(record.get('data')); - } - - if (me.toolbar.btnInsertShape.pressed) - me.toolbar.btnInsertShape.toggle(false, true); - - if (e.type !== 'click') - me.toolbar.btnInsertTextArt.menu.hide(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertTextArt); - Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art'); - } - }); - } - }, - activateControls: function() { _.each(this.toolbar.toolbarControls, function(item){ item.setDisabled(false); diff --git a/apps/documenteditor/main/app/controller/Viewport.js b/apps/documenteditor/main/app/controller/Viewport.js index eef6af3e7..54ad031fd 100644 --- a/apps/documenteditor/main/app/controller/Viewport.js +++ b/apps/documenteditor/main/app/controller/Viewport.js @@ -116,11 +116,20 @@ define([ Common.NotificationCenter.on('api:disconnect', this.onApiCoAuthoringDisconnect.bind(this)); }, + getApi: function() { + return this.api; + }, // When our application is ready, lets get started onLaunch: function() { // Create and render main view this.viewport = this.createView('Viewport').render(); + + this.api = new Asc.asc_docs_api({ + 'id-view' : 'editor_sdk', + 'translate': this.getApplication().getController('Main').translationTable + }); + this.header = this.createView('Common.Views.Header', { headerCaption: 'Document Editor', storeUsers: DE.getCollection('Common.Collections.Users') diff --git a/apps/documenteditor/main/app/view/ChartSettings.js b/apps/documenteditor/main/app/view/ChartSettings.js index c0eedc91d..64eb011be 100644 --- a/apps/documenteditor/main/app/view/ChartSettings.js +++ b/apps/documenteditor/main/app/view/ChartSettings.js @@ -84,16 +84,16 @@ define([ this._originalProps = null; this.render(); - - this.labelWidth = $(this.el).find('#chart-label-width'); - this.labelHeight = $(this.el).find('#chart-label-height'); }, render: function () { - var el = $(this.el); + var el = this.$el || $(this.el); el.html(this.template({ scope: this })); + + this.labelWidth = el.find('#chart-label-width'); + this.labelHeight = el.find('#chart-label-height'); }, setApi: function(api) { diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index a9344feff..6d3301d82 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -743,21 +743,11 @@ define([ }; this.changeLanguageMenu = function(menu) { - var i; if (me._currLang.id===null || me._currLang.id===undefined) { - for (i=0; i-1) && !menu.items[index].checked && menu.setChecked(index, true); } }; @@ -1850,11 +1840,6 @@ define([ } }, - updateThemeColors: function() { - this.effectcolors = Common.Utils.ThemeColor.getEffectColors(); - this.standartcolors = Common.Utils.ThemeColor.getStandartColors(); - }, - onCutCopyPaste: function(item, e) { var me = this; if (me.api) { @@ -2773,13 +2758,21 @@ define([ }) }); + var langTemplate = _.template([ + '', + '', + '<%= caption %>', + '' + ].join('')); + me.langTableMenu = new Common.UI.MenuItem({ caption : me.langText, - menu : new Common.UI.Menu({ + menu : new Common.UI.MenuSimple({ cls: 'lang-menu', menuAlign: 'tl-tr', restoreHeight: 285, items : [], + itemTemplate: langTemplate, search: true }) }); @@ -3426,11 +3419,12 @@ define([ me.langParaMenu = new Common.UI.MenuItem({ caption : me.langText, - menu : new Common.UI.Menu({ + menu : new Common.UI.MenuSimple({ cls: 'lang-menu', menuAlign: 'tl-tr', restoreHeight: 285, items : [], + itemTemplate: langTemplate, search: true }) }); @@ -3828,58 +3822,39 @@ define([ var me = this; if (langs && langs.length > 0 && me.langParaMenu && me.langTableMenu) { - me.langParaMenu.menu.removeAll(); - me.langTableMenu.menu.removeAll(); - _.each(langs, function(lang, index){ - me.langParaMenu.menu.addItem(new Common.UI.MenuItem({ + var arrPara = [], arrTable = []; + _.each(langs, function(lang) { + var item = { caption : lang.displayValue, value : lang.value, checkable : true, - toggleGroup : 'popupparalang', langid : lang.code, - spellcheck : lang.spellcheck, - template: _.template([ - '', - '', - '<%= caption %>', - '' - ].join('')) - }).on('click', function(item, e){ - if (me.api){ - if (!_.isUndefined(item.options.langid)) - me.api.put_TextPrLang(item.options.langid); + spellcheck : lang.spellcheck + }; + arrPara.push(item); + arrTable.push(_.clone(item)); + }); + me.langParaMenu.menu.resetItems(arrPara); + me.langTableMenu.menu.resetItems(arrTable); - me._currLang.paraid = item.options.langid; - me.langParaMenu.menu.currentCheckedItem = item; + me.langParaMenu.menu.on('item:click', function(menu, item){ + if (me.api){ + if (!_.isUndefined(item.langid)) + me.api.put_TextPrLang(item.langid); - me.fireEvent('editcomplete', me); - } - })); + me._currLang.paraid = item.langid; + me.fireEvent('editcomplete', me); + } + }); - me.langTableMenu.menu.addItem(new Common.UI.MenuItem({ - caption : lang.displayValue, - value : lang.value, - checkable : true, - toggleGroup : 'popuptablelang', - langid : lang.code, - spellcheck : lang.spellcheck, - template: _.template([ - '', - '', - '<%= caption %>', - '' - ].join('')) - }).on('click', function(item, e){ - if (me.api){ - if (!_.isUndefined(item.options.langid)) - me.api.put_TextPrLang(item.options.langid); + me.langTableMenu.menu.on('item:click', function(menu, item, e){ + if (me.api){ + if (!_.isUndefined(item.langid)) + me.api.put_TextPrLang(item.langid); - me._currLang.tableid = item.options.langid; - me.langTableMenu.menu.currentCheckedItem = item; - - me.fireEvent('editcomplete', me); - } - })); + me._currLang.tableid = item.langid; + me.fireEvent('editcomplete', me); + } }); } }, diff --git a/apps/documenteditor/main/app/view/FileMenu.js b/apps/documenteditor/main/app/view/FileMenu.js index bbf120cf3..5fcf1c1d4 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -49,6 +49,7 @@ define([ DE.Views.FileMenu = Common.UI.BaseView.extend(_.extend({ el: '#file-menu-panel', + rendered: false, options: {alias:'FileMenu'}, template: _.template(tpl), @@ -81,95 +82,109 @@ define([ }, render: function () { - this.$el = $(this.el); - this.$el.html(this.template()); + var $markup = $(this.template()); this.miSave = new Common.UI.MenuItem({ - el : $('#fm-btn-save',this.el), + el : $markup.elementById('#fm-btn-save'), action : 'save', caption : this.btnSaveCaption, canFocused: false }); + if ( !!this.options.miSave ) { + this.miSave.setDisabled(this.options.miSave.isDisabled()); + delete this.options.miSave; + } + this.miEdit = new Common.UI.MenuItem({ - el : $('#fm-btn-edit',this.el), + el : $markup.elementById('#fm-btn-edit'), action : 'edit', caption : this.btnToEditCaption, canFocused: false }); this.miDownload = new Common.UI.MenuItem({ - el : $('#fm-btn-download',this.el), + el : $markup.elementById('#fm-btn-download'), action : 'saveas', caption : this.btnDownloadCaption, canFocused: false }); this.miSaveCopyAs = new Common.UI.MenuItem({ - el : $('#fm-btn-save-copy',this.el), + el : $markup.elementById('#fm-btn-save-copy'), action : 'save-copy', caption : this.btnSaveCopyAsCaption, canFocused: false }); this.miSaveAs = new Common.UI.MenuItem({ - el : $('#fm-btn-save-desktop',this.el), + el : $markup.elementById('#fm-btn-save-desktop'), action : 'save-desktop', caption : this.btnSaveAsCaption, canFocused: false }); this.miPrint = new Common.UI.MenuItem({ - el : $('#fm-btn-print',this.el), + el : $markup.elementById('#fm-btn-print'), action : 'print', caption : this.btnPrintCaption, canFocused: false }); this.miRename = new Common.UI.MenuItem({ - el : $('#fm-btn-rename',this.el), + el : $markup.elementById('#fm-btn-rename'), action : 'rename', caption : this.btnRenameCaption, canFocused: false }); + if ( !!this.options.miRename ) { + this.miRename.setDisabled(this.options.miRename.isDisabled()); + delete this.options.miRename; + } + this.miProtect = new Common.UI.MenuItem({ - el : $('#fm-btn-protect',this.el), + el : $markup.elementById('#fm-btn-protect'), action : 'protect', caption : this.btnProtectCaption, canFocused: false }); + if ( !!this.options.miProtect ) { + this.miProtect.setDisabled(this.options.miProtect.isDisabled()); + delete this.options.miProtect; + } + this.miRecent = new Common.UI.MenuItem({ - el : $('#fm-btn-recent',this.el), + el : $markup.elementById('#fm-btn-recent'), action : 'recent', caption : this.btnRecentFilesCaption, canFocused: false }); this.miNew = new Common.UI.MenuItem({ - el : $('#fm-btn-create',this.el), + el : $markup.elementById('#fm-btn-create'), action : 'new', caption : this.btnCreateNewCaption, canFocused: false }); this.miAccess = new Common.UI.MenuItem({ - el : $('#fm-btn-rights',this.el), + el : $markup.elementById('#fm-btn-rights'), action : 'rights', caption : this.btnRightsCaption, canFocused: false }); this.miHistory = new Common.UI.MenuItem({ - el : $('#fm-btn-history',this.el), + el : $markup.elementById('#fm-btn-history'), action : 'history', caption : this.btnHistoryCaption, canFocused: false }); this.miHelp = new Common.UI.MenuItem({ - el : $('#fm-btn-help',this.el), + el : $markup.elementById('#fm-btn-help'), action : 'help', caption : this.btnHelpCaption, canFocused: false @@ -178,7 +193,7 @@ define([ this.items = []; this.items.push( new Common.UI.MenuItem({ - el : $('#fm-btn-return',this.el), + el : $markup.elementById('#fm-btn-return'), action : 'back', caption : this.btnCloseMenuCaption, canFocused: false @@ -194,7 +209,7 @@ define([ this.miRecent, this.miNew, new Common.UI.MenuItem({ - el : $('#fm-btn-info',this.el), + el : $markup.elementById('#fm-btn-info'), action : 'info', caption : this.btnInfoCaption, canFocused: false @@ -202,29 +217,31 @@ define([ this.miAccess, this.miHistory, new Common.UI.MenuItem({ - el : $('#fm-btn-settings',this.el), + el : $markup.elementById('#fm-btn-settings'), action : 'opts', caption : this.btnSettingsCaption, canFocused: false }), this.miHelp, new Common.UI.MenuItem({ - el : $('#fm-btn-back',this.el), + el : $markup.elementById('#fm-btn-back'), + // el : _get_el('fm-btn-back'), action : 'exit', caption : this.btnBackCaption, canFocused: false }) ); - var me = this; - me.panels = { -// 'saveas' : (new DE.Views.FileMenuPanels.ViewSaveAs({menu:me})).render(), - 'opts' : (new DE.Views.FileMenuPanels.Settings({menu:me})).render(), - 'info' : (new DE.Views.FileMenuPanels.DocumentInfo({menu:me})).render(), - 'rights' : (new DE.Views.FileMenuPanels.DocumentRights({menu:me})).render() - }; + this.rendered = true; + this.$el.html($markup); + this.$el.find('.content-box').hide(); + this.applyMode(); - me.$el.find('.content-box').hide(); + if ( !!this.api ) { + this.panels['info'].setApi(this.api); + if ( this.panels['protect'] ) + this.panels['protect'].setApi(this.api); + } return this; }, @@ -232,6 +249,9 @@ define([ show: function(panel, opts) { if (this.isVisible() && panel===undefined || !this.mode) return; + if ( !this.rendered ) + this.render(); + var defPanel = (this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info'; if (!panel) panel = this.active || defPanel; @@ -250,6 +270,16 @@ define([ }, applyMode: function() { + if (!this.panels) { + this.panels = { + 'opts' : (new DE.Views.FileMenuPanels.Settings({menu:this})).render(this.$el.find('#panel-settings')), + 'info' : (new DE.Views.FileMenuPanels.DocumentInfo({menu:this})).render(this.$el.find('#panel-info')), + 'rights' : (new DE.Views.FileMenuPanels.DocumentRights({menu:this})).render(this.$el.find('#panel-rights')) + }; + } + + if (!this.mode) return; + this.miDownload[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide'](); this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) ?'show':'hide'](); this.miSaveAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide'](); @@ -284,32 +314,29 @@ define([ if ( this.mode.canCreateNew ) { if (this.mode.templates && this.mode.templates.length) { $('a',this.miNew.$el).text(this.btnCreateNewCaption + '...'); - this.panels['new'] = ((new DE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render()); + !this.panels['new'] && (this.panels['new'] = ((new DE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render())); } } - if ( this.mode.canOpenRecent ) { - if (this.mode.recent){ - this.panels['recent'] = (new DE.Views.FileMenuPanels.RecentFiles({menu:this, recent: this.mode.recent})).render(); - } + if ( this.mode.canOpenRecent && this.mode.recent ) { + !this.panels['recent'] && (this.panels['recent'] = (new DE.Views.FileMenuPanels.RecentFiles({menu:this, recent: this.mode.recent})).render()); } if (this.mode.canProtect) { -// this.$el.find('#fm-btn-back').hide(); - this.panels['protect'] = (new DE.Views.FileMenuPanels.ProtectDoc({menu:this})).render(); + !this.panels['protect'] && (this.panels['protect'] = (new DE.Views.FileMenuPanels.ProtectDoc({menu:this})).render()); this.panels['protect'].setMode(this.mode); } if (this.mode.canDownload) { - this.panels['saveas'] = ((new DE.Views.FileMenuPanels.ViewSaveAs({menu: this})).render()); + !this.panels['saveas'] && (this.panels['saveas'] = ((new DE.Views.FileMenuPanels.ViewSaveAs({menu: this})).render())); } else if (this.mode.canDownloadOrigin) $('a',this.miDownload.$el).text(this.textDownload); if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) { - this.panels['save-copy'] = ((new DE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render()); + !this.panels['save-copy'] && (this.panels['save-copy'] = ((new DE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render())); } - if (this.mode.canHelp) { + if (this.mode.canHelp && !this.panels['help']) { this.panels['help'] = ((new DE.Views.FileMenuPanels.Help({menu: this})).render()); this.panels['help'].setLangConfig(this.mode.lang); } @@ -329,13 +356,22 @@ define([ this.mode = mode; } - if (!delay) this.applyMode(); + if (!delay) { + if ( this.rendered ) + this.applyMode(); + } + return this; }, setApi: function(api) { this.api = api; - this.panels['info'].setApi(api); - if (this.panels['protect']) this.panels['protect'].setApi(api); + + if ( this.rendered ) { + this.panels['info'].setApi(api); + if (this.panels['protect']) this.panels['protect'].setApi(api); + } + + return this; }, loadDocument: function(data) { @@ -369,8 +405,11 @@ define([ }, SetDisabled: function(disable) { - this.miSave[(disable || !this.mode.isEdit)?'hide':'show'](); - this.miRename[(disable || !this.mode.canRename || this.mode.isDesktopApp) ?'hide':'show'](); + var _btn_save = this.getButton('save'), + _btn_rename = this.getButton('rename'); + + _btn_save[(disable || !this.mode.isEdit)?'hide':'show'](); + _btn_rename[(disable || !this.mode.canRename || this.mode.isDesktopApp) ?'hide':'show'](); }, isVisible: function () { @@ -378,8 +417,27 @@ define([ }, getButton: function(type) { - if (type == 'save') - return this.miSave; + if ( !this.rendered ) { + if (type == 'save') { + return this.options.miSave ? this.options.miSave : (this.options.miSave = new Common.UI.MenuItem({})); + } else + if (type == 'rename') { + return this.options.miRename ? this.options.miRename : (this.options.miRename = new Common.UI.MenuItem({})); + } else + if (type == 'protect') { + return this.options.miProtect ? this.options.miProtect : (this.options.miProtect = new Common.UI.MenuItem({})); + } + } else { + if (type == 'save') { + return this.miSave; + } else + if (type == 'rename') { + return this.miRename; + }else + if (type == 'protect') { + return this.miProtect; + } + } }, btnSaveCaption : 'Save', diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index c36eb3b0c..8496d4599 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -87,12 +87,12 @@ define([ }, render: function() { - $(this.el).html(this.template({rows:this.formats})); + this.$el.html(this.template({rows:this.formats})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -148,12 +148,12 @@ define([ }, render: function() { - $(this.el).html(this.template({rows:this.formats})); + this.$el.html(this.template({rows:this.formats})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -247,30 +247,31 @@ define([ this.menu = options.menu; }, - render: function() { - $(this.el).html(this.template({scope: this})); + render: function(node) { + var me = this; + var $markup = $(this.template({scope: this})); this.chInputMode = new Common.UI.CheckBox({ - el: $('#fms-chb-input-mode'), + el: $markup.findById('#fms-chb-input-mode'), labelText: this.strInputMode }); /** coauthoring begin **/ this.chLiveComment = new Common.UI.CheckBox({ - el: $('#fms-chb-live-comment'), + el: $markup.findById('#fms-chb-live-comment'), labelText: this.strLiveComment - }).on('change', _.bind(function(field, newValue, oldValue, eOpts){ - this.chResolvedComment.setDisabled(field.getValue()!=='checked'); - }, this)); + }).on('change', function(field, newValue, oldValue, eOpts){ + me.chResolvedComment.setDisabled(field.getValue()!=='checked'); + }); this.chResolvedComment = new Common.UI.CheckBox({ - el: $('#fms-chb-resolved-comment'), + el: $markup.findById('#fms-chb-resolved-comment'), labelText: this.strResolvedComment }); /** coauthoring end **/ this.chSpell = new Common.UI.CheckBox({ - el: $('#fms-chb-spell-check'), + el: $markup.findById('#fms-chb-spell-check'), labelText: this.strSpellCheckMode }); @@ -280,28 +281,28 @@ define([ }); this.chAutosave = new Common.UI.CheckBox({ - el: $('#fms-chb-autosave'), + el: $markup.findById('#fms-chb-autosave'), labelText: this.strAutosave - }).on('change', _.bind(function(field, newValue, oldValue, eOpts){ - if (field.getValue()!=='checked' && this.cmbCoAuthMode.getValue()) { - this.cmbCoAuthMode.setValue(0); - this.onSelectCoAuthMode(this.cmbCoAuthMode.getSelectedRecord()); + }).on('change', function(field, newValue, oldValue, eOpts){ + if (field.getValue()!=='checked' && me.cmbCoAuthMode.getValue()) { + me.cmbCoAuthMode.setValue(0); + me.onSelectCoAuthMode(me.cmbCoAuthMode.getSelectedRecord()); } - }, this)); - this.lblAutosave = $('#fms-lbl-autosave'); + }); + this.lblAutosave = $markup.findById('#fms-lbl-autosave'); this.chForcesave = new Common.UI.CheckBox({ - el: $('#fms-chb-forcesave'), + el: $markup.findById('#fms-chb-forcesave'), labelText: this.strForcesave }); this.chAlignGuides = new Common.UI.CheckBox({ - el: $('#fms-chb-align-guides'), + el: $markup.findById('#fms-chb-align-guides'), labelText: this.strAlignGuides }); this.cmbZoom = new Common.UI.ComboBox({ - el : $('#fms-cmb-zoom'), + el : $markup.findById('#fms-cmb-zoom'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -325,7 +326,7 @@ define([ /** coauthoring begin **/ this.cmbShowChanges = new Common.UI.ComboBox({ - el : $('#fms-cmb-show-changes'), + el : $markup.findById('#fms-cmb-show-changes'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -337,7 +338,7 @@ define([ }); this.cmbCoAuthMode = new Common.UI.ComboBox({ - el : $('#fms-cmb-coauth-mode'), + el : $markup.findById('#fms-cmb-coauth-mode'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -345,17 +346,17 @@ define([ { value: 1, displayValue: this.strFast, descValue: this.strCoAuthModeDescFast}, { value: 0, displayValue: this.strStrict, descValue: this.strCoAuthModeDescStrict } ] - }).on('selected', _.bind( function(combo, record) { - if (record.value == 1 && (this.chAutosave.getValue()!=='checked')) - this.chAutosave.setValue(1); - this.onSelectCoAuthMode(record); - }, this)); + }).on('selected', function(combo, record) { + if (record.value == 1 && (me.chAutosave.getValue()!=='checked')) + me.chAutosave.setValue(1); + me.onSelectCoAuthMode(record); + }); - this.lblCoAuthMode = $('#fms-lbl-coauth-mode'); + this.lblCoAuthMode = $markup.findById('#fms-lbl-coauth-mode'); /** coauthoring end **/ this.cmbFontRender = new Common.UI.ComboBox({ - el : $('#fms-cmb-font-render'), + el : $markup.find('#fms-cmb-font-render'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -367,7 +368,7 @@ define([ }); this.cmbUnit = new Common.UI.ComboBox({ - el : $('#fms-cmb-unit'), + el : $markup.findById('#fms-cmb-unit'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -379,18 +380,19 @@ define([ }); this.btnApply = new Common.UI.Button({ - el: '#fms-btn-apply' + el: $markup.findById('#fms-btn-apply') }); - this.btnApply.on('click', _.bind(this.applySettings, this)); + this.btnApply.on('click', this.applySettings.bind(this)); + + this.$el = $(node).html($markup); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } - return this; }, @@ -564,7 +566,7 @@ define([ }, render: function() { - $(this.el).html(this.template()); + this.$el.html(this.template()); this.viewRecentPicker = new Common.UI.DataView({ el: $('#id-recent-view'), @@ -582,7 +584,7 @@ define([ if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -644,14 +646,14 @@ define([ }, render: function() { - $(this.el).html(this.template({ + this.$el.html(this.template({ scope: this, docs: this.options[0].docs })); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -784,23 +786,22 @@ define([ this._locked = false; }, - render: function() { - $(this.el).html(this.template({scope: this})); - + render: function(node) { var me = this; + var $markup = $(me.template()); // server info - this.lblPlacement = $('#id-info-placement'); - this.lblOwner = $('#id-info-owner'); - this.lblUploaded = $('#id-info-uploaded'); + this.lblPlacement = $markup.findById('#id-info-placement'); + this.lblOwner = $markup.findById('#id-info-owner'); + this.lblUploaded = $markup.findById('#id-info-uploaded'); // statistic info - this.lblStatPages = $('#id-info-pages'); - this.lblStatWords = $('#id-info-words'); - this.lblStatParagraphs = $('#id-info-paragraphs'); - this.lblStatSymbols = $('#id-info-symbols'); - this.lblStatSpaces = $('#id-info-spaces'); - // this.lblEditTime = $('#id-info-edittime'); + this.lblStatPages = $markup.findById('#id-info-pages'); + this.lblStatWords = $markup.findById('#id-info-words'); + this.lblStatParagraphs = $markup.findById('#id-info-paragraphs'); + this.lblStatSymbols = $markup.findById('#id-info-symbols'); + this.lblStatSpaces = $markup.findById('#id-info-spaces'); + // this.lblEditTime = $markup.find('#id-info-edittime'); // edited info var keyDownBefore = function(input, e){ @@ -815,37 +816,37 @@ define([ }; this.inputTitle = new Common.UI.InputField({ - el : $('#id-info-title'), + el : $markup.findById('#id-info-title'), style : 'width: 200px;', placeHolder : this.txtAddText, validateOnBlur: false }).on('keydown:before', keyDownBefore); this.inputSubject = new Common.UI.InputField({ - el : $('#id-info-subject'), + el : $markup.findById('#id-info-subject'), style : 'width: 200px;', placeHolder : this.txtAddText, validateOnBlur: false }).on('keydown:before', keyDownBefore); this.inputComment = new Common.UI.InputField({ - el : $('#id-info-comment'), + el : $markup.findById('#id-info-comment'), style : 'width: 200px;', placeHolder : this.txtAddText, validateOnBlur: false }).on('keydown:before', keyDownBefore); // modify info - this.lblModifyDate = $('#id-info-modify-date'); - this.lblModifyBy = $('#id-info-modify-by'); + this.lblModifyDate = $markup.findById('#id-info-modify-date'); + this.lblModifyBy = $markup.findById('#id-info-modify-by'); // creation info - this.lblDate = $('#id-info-date'); - this.lblApplication = $('#id-info-appname'); - this.tblAuthor = $('#id-info-author table'); - this.trAuthor = $('#id-info-add-author').closest('tr'); + this.lblDate = $markup.findById('#id-info-date'); + this.lblApplication = $markup.findById('#id-info-appname'); + this.tblAuthor = $markup.findById('#id-info-author table'); + this.trAuthor = $markup.findById('#id-info-add-author').closest('tr'); this.authorTpl = '
    '; this.tblAuthor.on('click', function(e) { - var btn = $(e.target); + var btn = $markup.find(e.target); if (btn.hasClass('close') && !btn.hasClass('disabled')) { var el = btn.closest('tr'), idx = me.tblAuthor.find('tr').index(el); @@ -855,7 +856,7 @@ define([ }); this.inputAuthor = new Common.UI.InputField({ - el : $('#id-info-add-author'), + el : $markup.findById('#id-info-add-author'), style : 'width: 200px;', validateOnBlur: false, placeHolder: this.txtAddAuthor @@ -888,13 +889,13 @@ define([ this.updateInfo(this.doc); + this.$el = $(node).html($markup); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } - return this; }, @@ -1178,12 +1179,12 @@ define([ this.menu = options.menu; }, - render: function() { - $(this.el).html(this.template()); + render: function(node) { + var $markup = $(this.template()); - this.cntRights = $('#id-info-rights'); + this.cntRights = $markup.findById('#id-info-rights'); this.btnEditRights = new Common.UI.Button({ - el: '#id-info-btn-edit' + el: $markup.elementById('#id-info-btn-edit') }); this.btnEditRights.on('click', _.bind(this.changeAccessRights, this)); @@ -1191,16 +1192,17 @@ define([ this.updateInfo(this.doc); + Common.NotificationCenter.on('collaboration:sharing', this.changeAccessRights.bind(this)); + Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this)); + + this.$el = $(node).html($markup); + if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } - - Common.NotificationCenter.on('collaboration:sharing', _.bind(this.changeAccessRights, this)); - Common.NotificationCenter.on('collaboration:sharingdeny', _.bind(this.onLostEditRights, this)); - return this; }, @@ -1364,7 +1366,7 @@ define([ render: function() { var me = this; - $(this.el).html(this.template()); + this.$el.html(this.template()); this.viewHelpPicker = new Common.UI.DataView({ el: $('#id-help-contents'), @@ -1504,7 +1506,7 @@ define([ }, render: function() { - $(this.el).html(this.template({scope: this})); + this.$el.html(this.template({scope: this})); var protection = DE.getController('Common.Controllers.Protection').getView(); @@ -1531,7 +1533,7 @@ define([ this.cntSignatureView = $('#id-fms-signature-view'); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } diff --git a/apps/documenteditor/main/app/view/HeaderFooterSettings.js b/apps/documenteditor/main/app/view/HeaderFooterSettings.js index 5b7028254..ae792ce79 100644 --- a/apps/documenteditor/main/app/view/HeaderFooterSettings.js +++ b/apps/documenteditor/main/app/view/HeaderFooterSettings.js @@ -84,7 +84,7 @@ define([ }, render: function () { - var el = $(this.el); + var el = this.$el || $(this.el); el.html(this.template({ scope: this })); diff --git a/apps/documenteditor/main/app/view/ImageSettings.js b/apps/documenteditor/main/app/view/ImageSettings.js index 22ac089b2..84b2e50fd 100644 --- a/apps/documenteditor/main/app/view/ImageSettings.js +++ b/apps/documenteditor/main/app/view/ImageSettings.js @@ -82,16 +82,16 @@ define([ this._originalProps = null; this.render(); - - this.labelWidth = $(this.el).find('#image-label-width'); - this.labelHeight = $(this.el).find('#image-label-height'); }, render: function () { - var el = $(this.el); + var el = this.$el || $(this.el); el.html(this.template({ scope: this })); + + this.labelWidth = el.find('#image-label-width'); + this.labelHeight = el.find('#image-label-height'); }, setApi: function(api) { diff --git a/apps/documenteditor/main/app/view/LeftMenu.js b/apps/documenteditor/main/app/view/LeftMenu.js index 767fd4613..b8e9742e7 100644 --- a/apps/documenteditor/main/app/view/LeftMenu.js +++ b/apps/documenteditor/main/app/view/LeftMenu.js @@ -90,13 +90,11 @@ define([ }, render: function () { - var el = $(this.el); - el.html(this.template({ - })); + var $markup = $(this.template({})); this.btnSearch = new Common.UI.Button({ action: 'search', - el: $('#left-btn-search'), + el: $markup.elementById('#left-btn-search'), hint: this.tipSearch + Common.Utils.String.platformKey('Ctrl+F'), disabled: true, enableToggle: true @@ -104,7 +102,7 @@ define([ this.btnAbout = new Common.UI.Button({ action: 'about', - el: $('#left-btn-about'), + el: $markup.elementById('#left-btn-about'), hint: this.tipAbout, enableToggle: true, disabled: true, @@ -113,14 +111,14 @@ define([ this.btnSupport = new Common.UI.Button({ action: 'support', - el: $('#left-btn-support'), + el: $markup.elementById('#left-btn-support'), hint: this.tipSupport, disabled: true }); /** coauthoring begin **/ this.btnComments = new Common.UI.Button({ - el: $('#left-btn-comments'), + el: $markup.elementById('#left-btn-comments'), hint: this.tipComments + Common.Utils.String.platformKey('Ctrl+Shift+H'), enableToggle: true, disabled: true, @@ -128,7 +126,7 @@ define([ }); this.btnChat = new Common.UI.Button({ - el: $('#left-btn-chat'), + el: $markup.elementById('#left-btn-chat'), hint: this.tipChat + Common.Utils.String.platformKey('Alt+Q'), enableToggle: true, disabled: true, @@ -138,36 +136,37 @@ define([ this.btnComments.hide(); this.btnChat.hide(); - this.btnComments.on('click', _.bind(this.onBtnMenuClick, this)); - this.btnComments.on('toggle', _.bind(this.onBtnCommentsToggle, this)); - this.btnChat.on('click', _.bind(this.onBtnMenuClick, this)); + this.btnComments.on('click', this.onBtnMenuClick.bind(this)); + this.btnComments.on('toggle', this.onBtnCommentsToggle.bind(this)); + this.btnChat.on('click', this.onBtnMenuClick.bind(this)); /** coauthoring end **/ this.btnPlugins = new Common.UI.Button({ - el: $('#left-btn-plugins'), + el: $markup.elementById('#left-btn-plugins'), hint: this.tipPlugins, enableToggle: true, disabled: true, toggleGroup: 'leftMenuGroup' }); this.btnPlugins.hide(); - this.btnPlugins.on('click', _.bind(this.onBtnMenuClick, this)); + this.btnPlugins.on('click', this.onBtnMenuClick.bind(this)); this.btnNavigation = new Common.UI.Button({ - el: $('#left-btn-navigation'), + el: $markup.elementById('#left-btn-navigation'), hint: this.tipNavigation, enableToggle: true, disabled: true, toggleGroup: 'leftMenuGroup' }); - this.btnNavigation.on('click', _.bind(this.onBtnMenuClick, this)); + this.btnNavigation.on('click', this.onBtnMenuClick.bind(this)); - this.btnSearch.on('click', _.bind(this.onBtnMenuClick, this)); - this.btnAbout.on('toggle', _.bind(this.onBtnMenuToggle, this)); + this.btnSearch.on('click', this.onBtnMenuClick.bind(this)); + this.btnAbout.on('toggle', this.onBtnMenuToggle.bind(this)); this.menuFile = new DE.Views.FileMenu(); - this.menuFile.render(); - this.btnAbout.panel = (new Common.Views.About({el: $('#about-menu-panel'), appName: 'Document Editor'})).render(); + this.btnAbout.panel = new Common.Views.About({el: '#about-menu-panel', appName: 'Document Editor'}); + + this.$el.html($markup); return this; }, diff --git a/apps/documenteditor/main/app/view/MailMergeSettings.js b/apps/documenteditor/main/app/view/MailMergeSettings.js index fa32bd838..ad24da6ef 100644 --- a/apps/documenteditor/main/app/view/MailMergeSettings.js +++ b/apps/documenteditor/main/app/view/MailMergeSettings.js @@ -91,6 +91,31 @@ define([ this.mergeMailData = undefined; this.render(); + }, + + render: function () { + this.$el.html(this.template({ + scope: this + })); + }, + + setApi: function(api) { + this.api = api; + if (this.api) { + this.api.asc_registerCallback('asc_onPreviewMailMergeResult', _.bind(this.onPreviewMailMergeResult, this)); + this.api.asc_registerCallback('asc_onEndPreviewMailMergeResult', _.bind(this.onEndPreviewMailMergeResult, this)); + this.api.asc_registerCallback('asc_onStartMailMerge', _.bind(this.onStartMailMerge, this)); + this.api.asc_registerCallback('asc_onSaveMailMerge', _.bind(this.onSaveMailMerge, this)); + this.api.asc_registerCallback('asc_onEndAction', _.bind(this.onLongActionEnd, this)); + Common.Gateway.on('setemailaddresses', _.bind(this.onSetEmailAddresses, this)); + Common.Gateway.on('processmailmerge', _.bind(this.onProcessMailMerge, this)); + } + return this; + }, + + createDelayedControls: function() { + var me = this, + _set = DE.enumLockMM; this.btnInsField = new Common.UI.Button({ cls: 'btn-text-menu-default', @@ -133,32 +158,7 @@ define([ } }); this.emptyDBControls.push(this.txtFieldNum); - }, - render: function () { - this.$el.html(this.template({ - scope: this - })); - }, - - setApi: function(api) { - this.api = api; - if (this.api) { - this.api.asc_registerCallback('asc_onPreviewMailMergeResult', _.bind(this.onPreviewMailMergeResult, this)); - this.api.asc_registerCallback('asc_onEndPreviewMailMergeResult', _.bind(this.onEndPreviewMailMergeResult, this)); - this.api.asc_registerCallback('asc_onStartMailMerge', _.bind(this.onStartMailMerge, this)); - this.api.asc_registerCallback('asc_onSaveMailMerge', _.bind(this.onSaveMailMerge, this)); - this.api.asc_registerCallback('asc_onEndAction', _.bind(this.onLongActionEnd, this)); - Common.Gateway.on('setemailaddresses', _.bind(this.onSetEmailAddresses, this)); - Common.Gateway.on('processmailmerge', _.bind(this.onProcessMailMerge, this)); - } - return this; - }, - - createDelayedControls: function() { - var me = this, - _set = DE.enumLockMM; - this.btnEditData = new Common.UI.Button({ el: me.$el.find('#mmerge-button-edit-data'), lock: [_set.preview, _set.lostConnect] @@ -760,8 +760,8 @@ define([ }, onStartMailMerge: function() { - this.btnInsField.menu.removeAll(); - this.txtFieldNum.setValue(1); + this.btnInsField && this.btnInsField.menu.removeAll(); + this.txtFieldNum && this.txtFieldNum.setValue(1); this.ChangeSettings({ recipientsCount: this.api.asc_GetReceptionsCount(), fieldsList: this.api.asc_GetMailMergeFieldsNameList() diff --git a/apps/documenteditor/main/app/view/ParagraphSettings.js b/apps/documenteditor/main/app/view/ParagraphSettings.js index 1814951ca..04bee00dd 100644 --- a/apps/documenteditor/main/app/view/ParagraphSettings.js +++ b/apps/documenteditor/main/app/view/ParagraphSettings.js @@ -91,10 +91,16 @@ define([ {displayValue: this.textAuto, defaultValue: 1, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''}, {displayValue: this.textExact, defaultValue: 5, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 0.01, defaultUnit: 'cm'} ]; + }, + + render: function () { + var $markup = $(this.template({ + scope: this + })); // Short Size this.cmbLineRule = new Common.UI.ComboBox({ - el: $('#paragraph-combo-line-rule'), + el: $markup.findById('#paragraph-combo-line-rule'), cls: 'input-group-nr', menuStyle: 'min-width: 85px;', editable: false, @@ -105,7 +111,7 @@ define([ this.lockedControls.push(this.cmbLineRule); this.numLineHeight = new Common.UI.MetricSpinner({ - el: $('#paragraph-spin-line-height'), + el: $markup.findById('#paragraph-spin-line-height'), step: .01, width: 85, value: '', @@ -117,7 +123,7 @@ define([ this.lockedControls.push(this.numLineHeight); this.numSpacingBefore = new Common.UI.MetricSpinner({ - el: $('#paragraph-spin-spacing-before'), + el: $markup.findById('#paragraph-spin-spacing-before'), step: .1, width: 85, value: '', @@ -132,7 +138,7 @@ define([ this.lockedControls.push(this.numSpacingBefore); this.numSpacingAfter = new Common.UI.MetricSpinner({ - el: $('#paragraph-spin-spacing-after'), + el: $markup.findById('#paragraph-spin-spacing-after'), step: .1, width: 85, value: '', @@ -147,7 +153,7 @@ define([ this.lockedControls.push(this.numSpacingAfter); this.chAddInterval = new Common.UI.CheckBox({ - el: $('#paragraph-checkbox-add-interval'), + el: $markup.findById('#paragraph-checkbox-add-interval'), labelText: this.strSomeParagraphSpace, disabled: this._locked }); @@ -158,27 +164,25 @@ define([ disabled: this._locked, menu : true }); - this.btnColor.render( $('#paragraph-color-btn')); + this.btnColor.render($markup.findById('#paragraph-color-btn')); this.lockedControls.push(this.btnColor); - this.numLineHeight.on('change', _.bind(this.onNumLineHeightChange, this)); - this.numSpacingBefore.on('change', _.bind(this.onNumSpacingBeforeChange, this)); - this.numSpacingAfter.on('change', _.bind(this.onNumSpacingAfterChange, this)); - this.chAddInterval.on('change', _.bind(this.onAddIntervalChange, this)); - this.cmbLineRule.on('selected', _.bind(this.onLineRuleSelect, this)); - this.cmbLineRule.on('hide:after', _.bind(this.onHideMenus, this)); - $(this.el).on('click', '#paragraph-advanced-link', _.bind(this.openAdvancedSettings, this)); - this.TextOnlySettings = $('.text-only'); - }, + this.numLineHeight.on('change', this.onNumLineHeightChange.bind(this)); + this.numSpacingBefore.on('change', this.onNumSpacingBeforeChange.bind(this)); + this.numSpacingAfter.on('change', this.onNumSpacingAfterChange.bind(this)); + this.chAddInterval.on('change', this.onAddIntervalChange.bind(this)); + this.cmbLineRule.on('selected', this.onLineRuleSelect.bind(this)); + this.cmbLineRule.on('hide:after', this.onHideMenus.bind(this)); - render: function () { - var el = $(this.el); - el.html(this.template({ - scope: this - })); - - this.linkAdvanced = $('#paragraph-advanced-link'); + this.linkAdvanced = $markup.findById('#paragraph-advanced-link'); this.linkAdvanced.toggleClass('disabled', this._locked); + + this.$el.on('click', '#paragraph-advanced-link', this.openAdvancedSettings.bind(this)); + this.$el.html($markup); + + this.TextOnlySettings = $('.text-only', this.$el); + + this.rendered = true; }, setApi: function(api) { @@ -393,9 +397,9 @@ define([ }, createDelayedElements: function() { + this._initSettings = false; this.UpdateThemeColors(); this.updateMetricUnit(); - this._initSettings = false; }, openAdvancedSettings: function(e) { diff --git a/apps/documenteditor/main/app/view/RightMenu.js b/apps/documenteditor/main/app/view/RightMenu.js index e33266c43..f1b95cc70 100644 --- a/apps/documenteditor/main/app/view/RightMenu.js +++ b/apps/documenteditor/main/app/view/RightMenu.js @@ -146,32 +146,31 @@ define([ }, render: function (mode) { - var el = $(this.el); - this.trigger('render:before', this); this.defaultHideRightMenu = mode.customization && !!mode.customization.hideRightMenu; var open = !Common.localStorage.getBool("de-hide-right-settings", this.defaultHideRightMenu); - el.css('width', ((open) ? MENU_SCALE_PART : SCALE_MIN) + 'px'); - el.show(); + this.$el.css('width', ((open) ? MENU_SCALE_PART : SCALE_MIN) + 'px'); + this.$el.show(); - el.html(this.template({})); + var $markup = $(this.template({})); + this.$el.html($markup); - this.btnText.setElement($('#id-right-menu-text'), false); this.btnText.render(); - this.btnTable.setElement($('#id-right-menu-table'), false); this.btnTable.render(); - this.btnImage.setElement($('#id-right-menu-image'), false); this.btnImage.render(); - this.btnHeaderFooter.setElement($('#id-right-menu-header'), false); this.btnHeaderFooter.render(); - this.btnChart.setElement($('#id-right-menu-chart'), false); this.btnChart.render(); - this.btnShape.setElement($('#id-right-menu-shape'), false); this.btnShape.render(); - this.btnTextArt.setElement($('#id-right-menu-textart'), false); this.btnTextArt.render(); + this.btnText.setElement($markup.findById('#id-right-menu-text'), false); this.btnText.render(); + this.btnTable.setElement($markup.findById('#id-right-menu-table'), false); this.btnTable.render(); + this.btnImage.setElement($markup.findById('#id-right-menu-image'), false); this.btnImage.render(); + this.btnHeaderFooter.setElement($markup.findById('#id-right-menu-header'), false); this.btnHeaderFooter.render(); + this.btnChart.setElement($markup.findById('#id-right-menu-chart'), false); this.btnChart.render(); + this.btnShape.setElement($markup.findById('#id-right-menu-shape'), false); this.btnShape.render(); + this.btnTextArt.setElement($markup.findById('#id-right-menu-textart'), false); this.btnTextArt.render(); - this.btnText.on('click', _.bind(this.onBtnMenuClick, this)); - this.btnTable.on('click', _.bind(this.onBtnMenuClick, this)); - this.btnImage.on('click', _.bind(this.onBtnMenuClick, this)); - this.btnHeaderFooter.on('click', _.bind(this.onBtnMenuClick, this)); - this.btnChart.on('click', _.bind(this.onBtnMenuClick, this)); - this.btnShape.on('click', _.bind(this.onBtnMenuClick, this)); - this.btnTextArt.on('click', _.bind(this.onBtnMenuClick, this)); + this.btnText.on('click', this.onBtnMenuClick.bind(this)); + this.btnTable.on('click', this.onBtnMenuClick.bind(this)); + this.btnImage.on('click', this.onBtnMenuClick.bind(this)); + this.btnHeaderFooter.on('click', this.onBtnMenuClick.bind(this)); + this.btnChart.on('click', this.onBtnMenuClick.bind(this)); + this.btnShape.on('click', this.onBtnMenuClick.bind(this)); + this.btnTextArt.on('click', this.onBtnMenuClick.bind(this)); this.paragraphSettings = new DE.Views.ParagraphSettings(); this.headerSettings = new DE.Views.HeaderFooterSettings(); @@ -192,8 +191,8 @@ define([ }); this._settings[Common.Utils.documentSettingsType.MailMerge] = {panel: "id-mail-merge-settings", btn: this.btnMailMerge}; - this.btnMailMerge.el = $('#id-right-menu-mail-merge'); this.btnMailMerge.render().setVisible(true); - this.btnMailMerge.on('click', _.bind(this.onBtnMenuClick, this)); + this.btnMailMerge.el = $markup.findById('#id-right-menu-mail-merge'); this.btnMailMerge.render().setVisible(true); + this.btnMailMerge.on('click', this.onBtnMenuClick.bind(this)); this.mergeSettings = new DE.Views.MailMergeSettings(); } @@ -208,8 +207,8 @@ define([ }); this._settings[Common.Utils.documentSettingsType.Signature] = {panel: "id-signature-settings", btn: this.btnSignature}; - this.btnSignature.el = $('#id-right-menu-signature'); this.btnSignature.render().setVisible(true); - this.btnSignature.on('click', _.bind(this.onBtnMenuClick, this)); + this.btnSignature.el = $markup.findById('#id-right-menu-signature'); this.btnSignature.render().setVisible(true); + this.btnSignature.on('click', this.onBtnMenuClick.bind(this)); this.signatureSettings = new DE.Views.SignatureSettings(); } @@ -222,27 +221,29 @@ define([ } if (open) { - $('#id-paragraph-settings').parent().css("display", "inline-block" ); - $('#id-paragraph-settings').addClass("active"); + $markup.findById('#id-paragraph-settings').parent().css("display", "inline-block" ); + $markup.findById('#id-paragraph-settings').addClass("active"); } + // this.$el.html($markup); this.trigger('render:after', this); return this; }, setApi: function(api) { - this.api = api; - var fire = function() { this.fireEvent('editcomplete', this); }; - this.paragraphSettings.setApi(api).on('editcomplete', _.bind( fire, this)); - this.headerSettings.setApi(api).on('editcomplete', _.bind( fire, this)); - this.imageSettings.setApi(api).on('editcomplete', _.bind( fire, this)); - this.chartSettings.setApi(api).on('editcomplete', _.bind( fire, this)); - this.tableSettings.setApi(api).on('editcomplete', _.bind( fire, this)); - this.shapeSettings.setApi(api).on('editcomplete', _.bind( fire, this)); - this.textartSettings.setApi(api).on('editcomplete', _.bind( fire, this)); - if (this.mergeSettings) this.mergeSettings.setApi(api).on('editcomplete', _.bind( fire, this)); - if (this.signatureSettings) this.signatureSettings.setApi(api).on('editcomplete', _.bind( fire, this)); + var me = this; + me.api = api; + var _fire_editcomplete = function() {me.fireEvent('editcomplete', me);}; + this.paragraphSettings.setApi(api).on('editcomplete', _fire_editcomplete); + this.headerSettings.setApi(api).on('editcomplete', _fire_editcomplete); + this.imageSettings.setApi(api).on('editcomplete', _fire_editcomplete); + this.chartSettings.setApi(api).on('editcomplete', _fire_editcomplete); + this.tableSettings.setApi(api).on('editcomplete', _fire_editcomplete); + this.shapeSettings.setApi(api).on('editcomplete', _fire_editcomplete); + this.textartSettings.setApi(api).on('editcomplete', _fire_editcomplete); + if (this.mergeSettings) this.mergeSettings.setApi(api).on('editcomplete', _fire_editcomplete); + if (this.signatureSettings) this.signatureSettings.setApi(api).on('editcomplete', _fire_editcomplete); }, setMode: function(mode) { diff --git a/apps/documenteditor/main/app/view/ShapeSettings.js b/apps/documenteditor/main/app/view/ShapeSettings.js index b856e4a8c..1d227611a 100644 --- a/apps/documenteditor/main/app/view/ShapeSettings.js +++ b/apps/documenteditor/main/app/view/ShapeSettings.js @@ -78,6 +78,7 @@ define([ this.imgprops = null; this._sendUndoPoint = true; this._sliderChanged = false; + this._texturearray = null; this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt); @@ -100,7 +101,8 @@ define([ DisabledFillPanels: false, DisabledControls: false, HideShapeOnlySettings: false, - HideChangeTypeSettings: false + HideChangeTypeSettings: false, + isFromImage: false }; this.lockedControls = []; this._locked = false; @@ -126,6 +128,13 @@ define([ this.fillControls = []; this.render(); + }, + + render: function () { + var el = this.$el || $(this.el); + el.html(this.template({ + scope: this + })); this.FillColorContainer = $('#shape-panel-color-fill'); this.FillImageContainer = $('#shape-panel-image-fill'); @@ -136,13 +145,6 @@ define([ this.CanChangeType = $('.change-type'); }, - render: function () { - var el = $(this.el); - el.html(this.template({ - scope: this - })); - }, - setApi: function(api) { this.api = api; if (this.api) { @@ -785,7 +787,8 @@ define([ || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' || shapetype=='straightConnector1'; this.hideChangeTypeSettings(hidechangetype); - if (!hidechangetype) { + this._state.isFromImage = !!shapeprops.get_FromImage(); + if (!hidechangetype && this.btnChangeShape.menu.items.length) { this.btnChangeShape.menu.items[0].setVisible(shapeprops.get_FromImage()); this.btnChangeShape.menu.items[1].setVisible(!shapeprops.get_FromImage()); } @@ -1480,6 +1483,7 @@ define([ }, createDelayedElements: function() { + this._initSettings = false; this.createDelayedControls(); var global_hatch_menu_map = [ @@ -1513,37 +1517,17 @@ define([ this.PatternFillType = this.patternViewData[0].type; } - this.fillAutoShapes(); + this.onInitStandartTextures(); + this.onApiAutoShapes(); this.UpdateThemeColors(); - this._initSettings = false; }, onInitStandartTextures: function(texture) { var me = this; if (texture && texture.length>0){ - if (!this.btnTexture) { - this.btnTexture = new Common.UI.ComboBox({ - el: $('#shape-combo-fill-texture'), - template: _.template([ - '' - ].join('')) - }); - this.textureMenu = new Common.UI.Menu({ - items: [ - { template: _.template('
    ') } - ] - }); - this.textureMenu.render($('#shape-combo-fill-texture')); - this.fillControls.push(this.btnTexture); - } - - var texturearray = []; + me._texturearray = []; _.each(texture, function(item){ - texturearray.push({ + me._texturearray.push({ imageUrl: item.get_image(), name : me.textureNames[item.get_id()], type : item.get_id(), @@ -1551,15 +1535,41 @@ define([ selected: false }); }); - var mnuTexturePicker = new Common.UI.DataView({ - el: $('#id-shape-menu-texture'), - restoreHeight: 174, - parentMenu: me.textureMenu, - showLast: false, - store: new Common.UI.DataViewStore(texturearray), - itemTemplate: _.template('
    ') + } + + if (!me._texturearray || me._texturearray.length<1) return; + if (!this._initSettings && !this.btnTexture) { + this.btnTexture = new Common.UI.ComboBox({ + el: $('#shape-combo-fill-texture'), + template: _.template([ + '' + ].join('')) }); - mnuTexturePicker.on('item:click', _.bind(this.onSelectTexture, this)); + this.textureMenu = new Common.UI.Menu({ + items: [ + { template: _.template('
    ') } + ] + }); + this.textureMenu.render($('#shape-combo-fill-texture')); + this.fillControls.push(this.btnTexture); + + var onShowBefore = function(menu) { + var mnuTexturePicker = new Common.UI.DataView({ + el: $('#id-shape-menu-texture'), + restoreHeight: 174, + parentMenu: menu, + showLast: false, + store: new Common.UI.DataViewStore(me._texturearray || []), + itemTemplate: _.template('
    ') + }); + mnuTexturePicker.on('item:click', _.bind(me.onSelectTexture, me)); + menu.off('show:before', onShowBefore); + }; + this.textureMenu.on('show:before', onShowBefore); } }, @@ -1610,49 +1620,66 @@ define([ this.fireEvent('editcomplete', this); }, + onApiAutoShapes: function() { + var me = this; + var onShowBefore = function(menu) { + me.fillAutoShapes(); + menu.off('show:before', onShowBefore); + }; + me.btnChangeShape.menu.on('show:before', onShowBefore); + }, + fillAutoShapes: function() { var me = this, - shapesStore = this.application.getCollection('ShapeGroups'); + shapesStore = this.application.getCollection('ShapeGroups'), + count = shapesStore.length; + + var onShowAfter = function(menu) { + for (var i=-1; i0; i++) { + var store = shapesStore.at(i > -1 ? i : 0).get('groupStore'); + if (i<0) { + store = store.clone(); + store.shift(); + } + var shapePicker = new Common.UI.DataViewSimple({ + el: $('#id-shape-menu-shapegroup' + (i+1), menu.items[i+1].$el), + store: store, + parentMenu: menu.items[i+1].menu, + itemTemplate: _.template('
    \">
    ') + }); + shapePicker.on('item:click', function(picker, item, record, e) { + if (me.api) { + me.api.ChangeShapeType(record.get('data').shapeType); + me.fireEvent('editcomplete', me); + } + if (e.type !== 'click') + me.btnChangeShape.menu.hide(); + }); + } + menu.off('show:after', onShowAfter); + }; + me.btnChangeShape.menu.on('show:after', onShowAfter); - var count = shapesStore.length; for (var i=-1; i0; i++) { - var shapeGroup = shapesStore.at(i>-1 ? i : i+1); + var shapeGroup = shapesStore.at(i > -1 ? i : i + 1); var menuItem = new Common.UI.MenuItem({ caption: shapeGroup.get('groupName'), menu: new Common.UI.Menu({ menuAlign: 'tr-tl', items: [ - { template: _.template('') } + {template: _.template('')} ] }) }); me.btnChangeShape.menu.addItem(menuItem); - - var store = shapeGroup.get('groupStore'); - if (i<0) { - store = store.clone(); - store.shift(); - } - var shapePicker = new Common.UI.DataView({ - el: $('#id-shape-menu-shapegroup' + (i+1)), - store: store, - parentMenu: menuItem.menu, - showLast: false, - itemTemplate: _.template('
    \">
    ') - }); - - shapePicker.on('item:click', function(picker, item, record, e) { - if (me.api) { - me.api.ChangeShapeType(record.get('data').shapeType); - me.fireEvent('editcomplete', me); - } - if (e.type !== 'click') - me.btnChangeShape.menu.hide(); - }); } + me.btnChangeShape.menu.items[0].setVisible(me._state.isFromImage); + me.btnChangeShape.menu.items[1].setVisible(!me._state.isFromImage); }, UpdateThemeColors: function() { + if (this._initSettings) return; + if (!this.btnBackColor) { // create color buttons this.btnBackColor = new Common.UI.ColorButton({ @@ -1674,7 +1701,6 @@ define([ }); this.colorsBack.on('select', _.bind(this.onColorsBackSelect, this)); this.btnBackColor.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor)); - this.btnFGColor = new Common.UI.ColorButton({ style: "width:45px;", menu : new Common.UI.Menu({ @@ -1751,7 +1777,6 @@ define([ this.colorsBorder.on('select', _.bind(this.onColorsBorderSelect, this)); this.btnBorderColor.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colorsBorder, this.btnBorderColor)); } - this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); diff --git a/apps/documenteditor/main/app/view/Statusbar.js b/apps/documenteditor/main/app/view/Statusbar.js index f8131e80d..c8b9cc613 100644 --- a/apps/documenteditor/main/app/view/Statusbar.js +++ b/apps/documenteditor/main/app/view/Statusbar.js @@ -66,7 +66,7 @@ define([ Common.Utils.String.format(this.pageIndexText, model.get('current'), model.get('count')) ); } - function _clickLanguage(menu, item, state) { + function _clickLanguage(menu, item) { var $parent = menu.$el.parent(); $parent.find('#status-label-lang').text(item.caption); this.langMenu.prevTip = item.value.value; @@ -228,13 +228,13 @@ define([ disabled: true }); - this.langMenu = new Common.UI.Menu({ + this.langMenu = new Common.UI.MenuSimple({ cls: 'lang-menu', style: 'margin-top:-5px;', restoreHeight: 285, itemTemplate: _.template([ - '', - '', + '', + '', '<%= caption %>', '' ].join('')), @@ -340,18 +340,18 @@ define([ }, reloadLanguages: function(array) { - this.langMenu.removeAll(); + var arr = [], + saved = this.langMenu.saved; _.each(array, function(item) { - this.langMenu.addItem({ + arr.push({ caption : item['displayValue'], value : {value: item['value'], code: item['code']}, checkable : true, - checked : this.langMenu.saved == item['displayValue'], - spellcheck : item['spellcheck'], - toggleGroup : 'language' + checked : saved == item['displayValue'], + spellcheck : item['spellcheck'] }); - }, this); - + }); + this.langMenu.resetItems(arr); if (this.langMenu.items.length>0) { this.btnLanguage.setDisabled(!!this.mode.isDisconnected); } @@ -365,9 +365,9 @@ define([ this.langMenu.prevTip = info.value; var lang = _.find(this.langMenu.items, function(item) { return item.caption == info.displayValue; }); - if (lang) - lang.setChecked(true); - else { + if (lang) { + this.langMenu.setChecked(this.langMenu.items.indexOf(lang), true); + } else { this.langMenu.saved = info.displayValue; this.langMenu.clearAll(); } diff --git a/apps/documenteditor/main/app/view/TableSettings.js b/apps/documenteditor/main/app/view/TableSettings.js index ad1d1f911..9e7bdda98 100644 --- a/apps/documenteditor/main/app/view/TableSettings.js +++ b/apps/documenteditor/main/app/view/TableSettings.js @@ -231,7 +231,7 @@ define([ }, render: function () { - var el = $(this.el); + var el = this.$el || $(this.el); el.html(this.template({ scope: this })); @@ -431,10 +431,10 @@ define([ }, createDelayedElements: function() { + this._initSettings = false; this.createDelayedControls(); this.UpdateThemeColors(); this.updateMetricUnit(); - this._initSettings = false; }, ChangeSettings: function(props) { @@ -641,6 +641,7 @@ define([ }, UpdateThemeColors: function() { + if (this._initSettings) return; if (!this.btnBackColor) { // create color buttons this.btnBorderColor = new Common.UI.ColorButton({ @@ -715,7 +716,6 @@ define([ data[index].set('imageUrl', template.asc_getImage()); }); } else { - self.cmbTableTemplate.menuPicker.store.reset([]); var arr = []; _.each(Templates, function(template){ arr.push({ @@ -725,7 +725,7 @@ define([ tip : template.asc_getDisplayName() }); }); - self.cmbTableTemplate.menuPicker.store.add(arr); + self.cmbTableTemplate.menuPicker.store.reset(arr); } }, diff --git a/apps/documenteditor/main/app/view/TextArtSettings.js b/apps/documenteditor/main/app/view/TextArtSettings.js index 663bd9537..4613bf022 100644 --- a/apps/documenteditor/main/app/view/TextArtSettings.js +++ b/apps/documenteditor/main/app/view/TextArtSettings.js @@ -105,20 +105,24 @@ define([ this.BorderSize = 0; this.BorderType = Asc.c_oDashType.solid; + DE.getCollection('Common.Collections.TextArt').bind({ + reset: this.fillTextArt.bind(this) + }); + this.render(); + }, + + render: function () { + var el = this.$el || $(this.el); + el.html(this.template({ + scope: this + })); this.FillColorContainer = $('#textart-panel-color-fill'); this.FillGradientContainer = $('#textart-panel-gradient-fill'); this.TransparencyContainer = $('#textart-panel-transparent-fill'); }, - render: function () { - var el = $(this.el); - el.html(this.template({ - scope: this - })); - }, - setApi: function(api) { this.api = api; return this; @@ -985,15 +989,17 @@ define([ }, createDelayedElements: function() { + this._initSettings = false; this.createDelayedControls(); this.UpdateThemeColors(); this.fillTransform(this.api.asc_getPropertyEditorTextArts()); - this._initSettings = false; + this.fillTextArt(); }, fillTextArt: function() { + if (this._initSettings) return; + var me = this; - if (!this.cmbTextArt) { this.cmbTextArt = new Common.UI.ComboDataView({ itemWidth: 50, @@ -1017,6 +1023,10 @@ define([ var models = this.application.getCollection('Common.Collections.TextArt').models, count = this.cmbTextArt.menuPicker.store.length; + if (models.length<1) { + DE.getController('Main').fillTextArt(this.api.asc_getTextArtPreviews()); + return; + } if (count>0 && count==models.length) { var data = this.cmbTextArt.menuPicker.store.models; _.each(models, function(template, index){ @@ -1073,6 +1083,7 @@ define([ }, UpdateThemeColors: function() { + if (this._initSettings) return; if (!this.btnBackColor) { this.btnBorderColor = new Common.UI.ColorButton({ style: "width:45px;", @@ -1132,7 +1143,6 @@ define([ this.colorsBack.on('select', _.bind(this.onColorsBackSelect, this)); this.btnBackColor.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor)); } - this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 60c729e5b..ade6b68a7 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -506,12 +506,7 @@ define([ cls: 'btn-toolbar x-huge icon-top', caption: me.capBtnInsChart, iconCls: 'btn-insertchart', - menu: new Common.UI.Menu({ - style: 'width: 435px;', - items: [ - {template: _.template('')} - ] - }) + menu: true }); this.paragraphControls.push(this.btnInsertChart); @@ -1270,7 +1265,7 @@ define([ rendererComponents: function (html) { var $host = $(html); var _injectComponent = function (id, cmp) { - Common.Utils.injectComponent($host.find(id), cmp); + Common.Utils.injectComponent($host.findById(id), cmp); }; _injectComponent('#slot-field-fontname', this.cmbFontName); @@ -1656,6 +1651,91 @@ define([ this.paragraphControls.push(this.mnuPageNumCurrentPos); this.paragraphControls.push(this.mnuInsertPageCount); + this.btnInsertChart.setMenu( new Common.UI.Menu({ + style: 'width: 435px;', + items: [ + {template: _.template('')} + ] + })); + + var onShowBefore = function(menu) { + var picker = new Common.UI.DataView({ + el: $('#id-toolbar-menu-insertchart'), + parentMenu: menu, + showLast: false, + restoreHeight: 421, + groups: new Common.UI.DataViewGroupStore([ + {id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts}, + {id: 'menu-chart-group-line', caption: me.textLine}, + {id: 'menu-chart-group-pie', caption: me.textPie}, + {id: 'menu-chart-group-hbar', caption: me.textBar}, + {id: 'menu-chart-group-area', caption: me.textArea, inline: true}, + {id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true}, + {id: 'menu-chart-group-stock', caption: me.textStock, inline: true} + // {id: 'menu-chart-group-surface', caption: me.textSurface} + ]), + store: new Common.UI.DataViewStore([ + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'}, + { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'}, + { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'} + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'} + + ]), + itemTemplate: _.template('
    ') + }); + picker.on('item:click', function (picker, item, record, e) { + if (record) + me.fireEvent('add:chart', [record.get('type')]); + }); + menu.off('show:before', onShowBefore); + }; + this.btnInsertChart.menu.on('show:before', onShowBefore); + + var onShowBeforeTextArt = function (menu) { + var collection = DE.getCollection('Common.Collections.TextArt'); + if (collection.length<1) + DE.getController('Main').fillTextArt(me.api.asc_getTextArtPreviews()); + var picker = new Common.UI.DataView({ + el: $('#id-toolbar-menu-insart'), + store: collection, + parentMenu: menu, + showLast: false, + itemTemplate: _.template('
    ') + }); + picker.on('item:click', function (picker, item, record, e) { + if (record) + me.fireEvent('insert:textart', [record.get('data')]); + if (e.type !== 'click') menu.hide(); + }); + menu.off('show:before', onShowBeforeTextArt); + }; + this.btnInsertTextArt.menu.on('show:before', onShowBeforeTextArt); + // set dataviews var _conf = this.mnuMarkersPicker.conf; @@ -1773,181 +1853,6 @@ define([ }); _conf && this.mnuPageNumberPosPicker.setDisabled(_conf.disabled); - this.mnuInsertChartPicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-insertchart'), - parentMenu: this.btnInsertChart.menu, - showLast: false, - restoreHeight: 421, - groups: new Common.UI.DataViewGroupStore([ - {id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts}, - {id: 'menu-chart-group-line', caption: me.textLine}, - {id: 'menu-chart-group-pie', caption: me.textPie}, - {id: 'menu-chart-group-hbar', caption: me.textBar}, - {id: 'menu-chart-group-area', caption: me.textArea, inline: true}, - {id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true}, - {id: 'menu-chart-group-stock', caption: me.textStock, inline: true} - // {id: 'menu-chart-group-surface', caption: me.textSurface} - ]), - store: new Common.UI.DataViewStore([ - { - group: 'menu-chart-group-bar', - type: Asc.c_oAscChartTypeSettings.barNormal, - allowSelected: true, - iconCls: 'column-normal', - selected: true - }, - { - group: 'menu-chart-group-bar', - type: Asc.c_oAscChartTypeSettings.barStacked, - allowSelected: true, - iconCls: 'column-stack' - }, - { - group: 'menu-chart-group-bar', - type: Asc.c_oAscChartTypeSettings.barStackedPer, - allowSelected: true, - iconCls: 'column-pstack' - }, - { - group: 'menu-chart-group-bar', - type: Asc.c_oAscChartTypeSettings.barNormal3d, - allowSelected: true, - iconCls: 'column-3d-normal' - }, - { - group: 'menu-chart-group-bar', - type: Asc.c_oAscChartTypeSettings.barStacked3d, - allowSelected: true, - iconCls: 'column-3d-stack' - }, - { - group: 'menu-chart-group-bar', - type: Asc.c_oAscChartTypeSettings.barStackedPer3d, - allowSelected: true, - iconCls: 'column-3d-pstack' - }, - { - group: 'menu-chart-group-bar', - type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, - allowSelected: true, - iconCls: 'column-3d-normal-per' - }, - { - group: 'menu-chart-group-line', - type: Asc.c_oAscChartTypeSettings.lineNormal, - allowSelected: true, - iconCls: 'line-normal' - }, - { - group: 'menu-chart-group-line', - type: Asc.c_oAscChartTypeSettings.lineStacked, - allowSelected: true, - iconCls: 'line-stack' - }, - { - group: 'menu-chart-group-line', - type: Asc.c_oAscChartTypeSettings.lineStackedPer, - allowSelected: true, - iconCls: 'line-pstack' - }, - { - group: 'menu-chart-group-line', - type: Asc.c_oAscChartTypeSettings.line3d, - allowSelected: true, - iconCls: 'line-3d' - }, - { - group: 'menu-chart-group-pie', - type: Asc.c_oAscChartTypeSettings.pie, - allowSelected: true, - iconCls: 'pie-normal' - }, - { - group: 'menu-chart-group-pie', - type: Asc.c_oAscChartTypeSettings.doughnut, - allowSelected: true, - iconCls: 'pie-doughnut' - }, - { - group: 'menu-chart-group-pie', - type: Asc.c_oAscChartTypeSettings.pie3d, - allowSelected: true, - iconCls: 'pie-3d-normal' - }, - { - group: 'menu-chart-group-hbar', - type: Asc.c_oAscChartTypeSettings.hBarNormal, - allowSelected: true, - iconCls: 'bar-normal' - }, - { - group: 'menu-chart-group-hbar', - type: Asc.c_oAscChartTypeSettings.hBarStacked, - allowSelected: true, - iconCls: 'bar-stack' - }, - { - group: 'menu-chart-group-hbar', - type: Asc.c_oAscChartTypeSettings.hBarStackedPer, - allowSelected: true, - iconCls: 'bar-pstack' - }, - { - group: 'menu-chart-group-hbar', - type: Asc.c_oAscChartTypeSettings.hBarNormal3d, - allowSelected: true, - iconCls: 'bar-3d-normal' - }, - { - group: 'menu-chart-group-hbar', - type: Asc.c_oAscChartTypeSettings.hBarStacked3d, - allowSelected: true, - iconCls: 'bar-3d-stack' - }, - { - group: 'menu-chart-group-hbar', - type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, - allowSelected: true, - iconCls: 'bar-3d-pstack' - }, - { - group: 'menu-chart-group-area', - type: Asc.c_oAscChartTypeSettings.areaNormal, - allowSelected: true, - iconCls: 'area-normal' - }, - { - group: 'menu-chart-group-area', - type: Asc.c_oAscChartTypeSettings.areaStacked, - allowSelected: true, - iconCls: 'area-stack' - }, - { - group: 'menu-chart-group-area', - type: Asc.c_oAscChartTypeSettings.areaStackedPer, - allowSelected: true, - iconCls: 'area-pstack' - }, - { - group: 'menu-chart-group-scatter', - type: Asc.c_oAscChartTypeSettings.scatter, - allowSelected: true, - iconCls: 'point-normal' - }, - { - group: 'menu-chart-group-stock', - type: Asc.c_oAscChartTypeSettings.stock, - allowSelected: true, - iconCls: 'stock-normal' - } - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, allowSelected: true, iconCls: 'surface-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, allowSelected: true, iconCls: 'surface-wireframe'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, allowSelected: true, iconCls: 'contour-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, allowSelected: true, iconCls: 'contour-wireframe'} - ]), - itemTemplate: _.template('
    ') - }); - this.mnuTablePicker = new Common.UI.DimensionPicker({ el: $('#id-toolbar-menu-tablepicker'), minRows: 8, diff --git a/apps/documenteditor/main/index.html b/apps/documenteditor/main/index.html index 145a0b453..d407512fc 100644 --- a/apps/documenteditor/main/index.html +++ b/apps/documenteditor/main/index.html @@ -22,157 +22,93 @@ z-index: 1001; } - .loader-page { + .loadmask > .brendpanel { width: 100%; - height: 170px; - bottom: 42%; - position: absolute; - text-align: center; - line-height: 10px; + height: 56px; + background: #446995; } - .loader-logo { - max-height: 160px; - margin-bottom: 10px; + .loadmask > .brendpanel > div { + display: flex; + align-items: center; } - .loader-page-romb { - width: 40px; + .loadmask > .brendpanel .spacer { + margin-left: auto; + } + + .loadmask > .brendpanel .loading-logo { + padding: 0 24px 0 12px; + max-width: 200px; + height: 20px; + } + + .loadmask > .brendpanel .loading-logo > img { display: inline-block; + max-width: 100px; + max-height: 20px; + opacity: 0; } - .loader-page-text { - width: 100%; - bottom: 42%; - position: absolute; - text-align: center; - color: #888; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 20px; + .loadmask > .brendpanel .circle { + vertical-align: middle; + width: 20px; + height: 20px; + border-radius: 12px; + margin: 4px 10px; + background: rgba(255, 255, 255, 0.2); } - .loader-page-text-loading { - font-size: 14px; + .loadmask > .brendpanel .rect { + vertical-align: middle; + width: 50px; + height: 12px; + border-radius: 3px; + margin: 0 10px; + background: rgba(255, 255, 255, 0.2); } - .loader-page-text-customer { - font-size: 16px; - margin-bottom: 5px; + .loadmask > .placeholder { + background: #fbfbfb; + width: 796px; + margin: 112px auto; + height: 100%; + border: 1px solid #dfdfdf; + padding-top: 50px; } - .romb { - width: 40px; - height: 40px; - -webkit-transform: rotate(135deg) skew(20deg, 20deg); - -moz-transform: rotate(135deg) skew(20deg, 20deg); - -ms-transform: rotate(135deg) skew(20deg, 20deg); - -o-transform: rotate(135deg) skew(20deg, 20deg); - position: absolute; - background: red; - border-radius: 6px; - -webkit-animation: movedown 3s infinite ease; - -moz-animation: movedown 3s infinite ease; - -ms-animation: movedown 3s infinite ease; - -o-animation: movedown 3s infinite ease; - animation: movedown 3s infinite ease; + .loadmask > .placeholder > .line { + height: 15px; + margin: 30px 80px; + background: #e2e2e2; + overflow: hidden; + position: relative; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; } - #blue { - z-index: 3; - background: #55bce6; - -webkit-animation-name: blue; - -moz-animation-name: blue; - -ms-animation-name: blue; - -o-animation-name: blue; - animation-name: blue; + @keyframes flickerAnimation { + 0% { opacity:0.1; } + 50% { opacity:1; } + 100% { opacity:0.1; } } - - #red { - z-index:1; - background: #de7a59; - -webkit-animation-name: red; - -moz-animation-name: red; - -ms-animation-name: red; - -o-animation-name: red; - animation-name: red; + @-o-keyframes flickerAnimation{ + 0% { opacity:0.1; } + 50% { opacity:1; } + 100% { opacity:0.1; } } - - #green { - z-index: 2; - background: #a1cb5c; - -webkit-animation-name: green; - -moz-animation-name: green; - -ms-animation-name: green; - -o-animation-name: green; - animation-name: green; + @-moz-keyframes flickerAnimation{ + 0% { opacity:0.1; } + 50% { opacity:1; } + 100% { opacity:0.1; } } - - @-webkit-keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0;} - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0; } - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @-webkit-keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @-webkit-keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } - } - - @keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #fff; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } + @-webkit-keyframes flickerAnimation{ + 0% { opacity:0.1; } + 50% { opacity:1; } + 100% { opacity:0.1; } } @@ -228,49 +164,9 @@ var params = getUrlParams(), lang = (params["lang"] || 'en').split(/[\-\_]/)[0], - customer = params["customer"] ? ('
    ' + encodeUrlParam(params["customer"]) + '
    ') : '', - margin = (customer !== '') ? 50 : 20, - loading = 'Loading...', - logo = params["logo"] ? ((params["logo"] !== 'none') ? ('') : '') : null; + logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null; window.frameEditorId = params["frameEditorId"]; - - if ( lang == 'de') loading = 'Ladevorgang...'; - else if ( lang == 'es') loading = 'Cargando...'; - else if ( lang == 'fr') loading = 'Chargement en cours...'; - else if ( lang == 'it') loading = 'Caricamento in corso...'; - else if ( lang == 'pt') loading = 'Carregando...'; - else if ( lang == 'ru') loading = 'Загрузка...'; - else if ( lang == 'sl') loading = 'Nalaganje...'; - else if ( lang == 'tr') loading = 'Yükleniyor...'; - else if ( lang == 'bg') loading = 'Зареждане...'; - else if ( lang == 'cs') loading = 'Nahrávám...'; - else if ( lang == 'hu') loading = 'Betöltés...'; - else if ( lang == 'ja') loading = '読み込み中...'; - else if ( lang == 'ko') loading = '로드 중...'; - else if ( lang == 'lv') loading = 'Ieladēšana ...'; - else if ( lang == 'nl') loading = 'Laden...'; - else if ( lang == 'pl') loading = 'Ładowanie...'; - else if ( lang == 'sk') loading = 'Nahrávam...'; - else if ( lang == 'uk') loading = 'Завантаження...'; - else if ( lang == 'vi') loading = 'Đang tải...'; - else if ( lang == 'zh') loading = '加载中...'; - - if ( !stopLoading ) - document.write( - '
    ' + - '
    ' + - ((logo!==null) ? logo : - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ') + - '
    ' + - '
    ' + customer + - '
    ' + loading + '
    ' + - '
    ' + - '
    '); @@ -278,8 +174,21 @@ +
    + + @@ -299,7 +208,7 @@ - + diff --git a/apps/documenteditor/main/index.html.deploy b/apps/documenteditor/main/index.html.deploy index 45faf2f30..675be6f5b 100644 --- a/apps/documenteditor/main/index.html.deploy +++ b/apps/documenteditor/main/index.html.deploy @@ -23,157 +23,93 @@ z-index: 1001; } - .loader-page { + .loadmask > .brendpanel { width: 100%; - height: 170px; - bottom: 42%; - position: absolute; - text-align: center; - line-height: 10px; + height: 56px; + background: #446995; } - .loader-logo { - max-height: 160px; - margin-bottom: 10px; + .loadmask > .brendpanel > div { + display: flex; + align-items: center; } - .loader-page-romb { - width: 40px; + .loadmask > .brendpanel .spacer { + margin-left: auto; + } + + .loadmask > .brendpanel .loading-logo { + padding: 0 24px 0 12px; + max-width: 200px; + height: 20px; + } + + .loadmask > .brendpanel .loading-logo > img { display: inline-block; + max-width: 100px; + max-height: 20px; + opacity: 0; } - .loader-page-text { - width: 100%; - bottom: 42%; - position: absolute; - text-align: center; - color: #888; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 20px; + .loadmask > .brendpanel .circle { + vertical-align: middle; + width: 20px; + height: 20px; + border-radius: 12px; + margin: 4px 10px; + background: rgba(255, 255, 255, 0.2); } - .loader-page-text-loading { - font-size: 14px; + .loadmask > .brendpanel .rect { + vertical-align: middle; + width: 50px; + height: 12px; + border-radius: 3px; + margin: 0 10px; + background: rgba(255, 255, 255, 0.2); } - .loader-page-text-customer { - font-size: 16px; - margin-bottom: 5px; + .loadmask > .placeholder { + background: #fbfbfb; + width: 796px; + margin: 112px auto; + height: 100%; + border: 1px solid #dfdfdf; + padding-top: 50px; } - .romb { - width: 40px; - height: 40px; - -webkit-transform: rotate(135deg) skew(20deg, 20deg); - -moz-transform: rotate(135deg) skew(20deg, 20deg); - -ms-transform: rotate(135deg) skew(20deg, 20deg); - -o-transform: rotate(135deg) skew(20deg, 20deg); - position: absolute; - background: red; - border-radius: 6px; - -webkit-animation: movedown 3s infinite ease; - -moz-animation: movedown 3s infinite ease; - -ms-animation: movedown 3s infinite ease; - -o-animation: movedown 3s infinite ease; - animation: movedown 3s infinite ease; + .loadmask > .placeholder > .line { + height: 15px; + margin: 30px 80px; + background: #e2e2e2; + overflow: hidden; + position: relative; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; } - #blue { - z-index: 3; - background: #55bce6; - -webkit-animation-name: blue; - -moz-animation-name: blue; - -ms-animation-name: blue; - -o-animation-name: blue; - animation-name: blue; + @keyframes flickerAnimation { + 0% { opacity:0.1; } + 50% { opacity:1; } + 100% { opacity:0.1; } } - - #red { - z-index:1; - background: #de7a59; - -webkit-animation-name: red; - -moz-animation-name: red; - -ms-animation-name: red; - -o-animation-name: red; - animation-name: red; + @-o-keyframes flickerAnimation{ + 0% { opacity:0.1; } + 50% { opacity:1; } + 100% { opacity:0.1; } } - - #green { - z-index: 2; - background: #a1cb5c; - -webkit-animation-name: green; - -moz-animation-name: green; - -ms-animation-name: green; - -o-animation-name: green; - animation-name: green; + @-moz-keyframes flickerAnimation{ + 0% { opacity:0.1; } + 50% { opacity:1; } + 100% { opacity:0.1; } } - - @-webkit-keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0;} - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0; } - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @-webkit-keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @-webkit-keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } - } - - @keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } + @-webkit-keyframes flickerAnimation{ + 0% { opacity:0.1; } + 50% { opacity:1; } + 100% { opacity:0.1; } } @@ -227,54 +163,28 @@ var params = getUrlParams(), lang = (params["lang"] || 'en').split(/[\-\_]/)[0], - customer = params["customer"] ? ('
    ' + encodeUrlParam(params["customer"]) + '
    ') : '', - margin = (customer !== '') ? 50 : 20, - loading = 'Loading...', - logo = params["logo"] ? ((params["logo"] !== 'none') ? ('') : '') : null; + logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null; window.frameEditorId = params["frameEditorId"]; - - if ( lang == 'de') loading = 'Ladevorgang...'; - else if ( lang == 'es') loading = 'Cargando...'; - else if ( lang == 'fr') loading = 'Chargement en cours...'; - else if ( lang == 'it') loading = 'Caricamento in corso...'; - else if ( lang == 'pt') loading = 'Carregando...'; - else if ( lang == 'ru') loading = 'Загрузка...'; - else if ( lang == 'sl') loading = 'Nalaganje...'; - else if ( lang == 'tr') loading = 'Yükleniyor...'; - else if ( lang == 'bg') loading = 'Зареждане...'; - else if ( lang == 'cs') loading = 'Nahrávám...'; - else if ( lang == 'hu') loading = 'Betöltés...'; - else if ( lang == 'ja') loading = '読み込み中...'; - else if ( lang == 'ko') loading = '로드 중...'; - else if ( lang == 'lv') loading = 'Ieladēšana ...'; - else if ( lang == 'nl') loading = 'Laden...'; - else if ( lang == 'pl') loading = 'Ładowanie...'; - else if ( lang == 'sk') loading = 'Nahrávam...'; - else if ( lang == 'uk') loading = 'Завантаження...'; - else if ( lang == 'vi') loading = 'Đang tải...'; - else if ( lang == 'zh') loading = '加载中...'; - - if ( !stopLoading ) - document.write( - '
    ' + - '
    ' + - ((logo!==null) ? logo : - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ') + - '
    ' + - '
    ' + customer + - '
    ' + loading + '
    ' + - '
    ' + - '
    '); +
    +
    + + diff --git a/apps/documenteditor/main/index_loader.html b/apps/documenteditor/main/index_loader.html new file mode 100644 index 000000000..3d0f4b30e --- /dev/null +++ b/apps/documenteditor/main/index_loader.html @@ -0,0 +1,303 @@ + + + + ONLYOFFICE Documents + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/apps/documenteditor/main/index_loader.html.deploy b/apps/documenteditor/main/index_loader.html.deploy new file mode 100644 index 000000000..0d2c66fa9 --- /dev/null +++ b/apps/documenteditor/main/index_loader.html.deploy @@ -0,0 +1,322 @@ + + + + ONLYOFFICE Document Editor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + \ No newline at end of file diff --git a/apps/documenteditor/main/resources/less/app.less b/apps/documenteditor/main/resources/less/app.less index a16802d19..4f7c8b1cc 100644 --- a/apps/documenteditor/main/resources/less/app.less +++ b/apps/documenteditor/main/resources/less/app.less @@ -144,4 +144,29 @@ } @huge-icon-size: 37px; -@x-huge-icon-size: 45px; \ No newline at end of file +@x-huge-icon-size: 45px; + +// Skeleton of document + +.doc-placeholder { + background: #fbfbfb; + width: 100%; + max-width: 796px; + margin: 40px auto; + height: 100%; + border: 1px solid #dfdfdf; + padding-top: 50px; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + + > .line { + height: 15px; + margin: 30px 80px; + background: #e2e2e2; + overflow: hidden; + position: relative; + } +} \ No newline at end of file diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 176d92429..199a5a109 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -220,6 +220,9 @@ define([ if (me.editorConfig.lang) me.api.asc_setLocale(me.editorConfig.lang); + if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo)) + $('#editor_sdk').append('
    '); + // if (this.appOptions.location == 'us' || this.appOptions.location == 'ca') // Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch); }, @@ -619,6 +622,8 @@ define([ } Common.Gateway.documentReady(); + + $('.doc-placeholder').remove(); }, onLicenseChanged: function(params) { diff --git a/apps/documenteditor/mobile/index.html b/apps/documenteditor/mobile/index.html index 5f3b6495a..0a15273f4 100644 --- a/apps/documenteditor/mobile/index.html +++ b/apps/documenteditor/mobile/index.html @@ -16,172 +16,107 @@ +
    +
    diff --git a/apps/documenteditor/mobile/index.html.deploy b/apps/documenteditor/mobile/index.html.deploy index dc911efec..6eb804dc5 100644 --- a/apps/documenteditor/mobile/index.html.deploy +++ b/apps/documenteditor/mobile/index.html.deploy @@ -15,172 +15,107 @@ +
    + + +
    + + + + + + + + + + + \ No newline at end of file diff --git a/apps/documenteditor/mobile/index_loader.html.deploy b/apps/documenteditor/mobile/index_loader.html.deploy new file mode 100644 index 000000000..dc911efec --- /dev/null +++ b/apps/documenteditor/mobile/index_loader.html.deploy @@ -0,0 +1,293 @@ + + + + + + + + + + ONLYOFFICE Document Editor + + + + + + + + + + +
    + + + diff --git a/apps/documenteditor/mobile/resources/css/app-ios.css b/apps/documenteditor/mobile/resources/css/app-ios.css index 36046fb2f..409d688e1 100644 --- a/apps/documenteditor/mobile/resources/css/app-ios.css +++ b/apps/documenteditor/mobile/resources/css/app-ios.css @@ -7081,3 +7081,25 @@ html.pixel-ratio-3 .numbers li { max-height: 100%; overflow: auto; } + +.doc-placeholder { + background: #fbfbfb; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + z-index: 10; +} +.doc-placeholder > .line { + height: 15px; + margin: 30px; + background: #e2e2e2; + overflow: hidden; + position: relative; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; +} diff --git a/apps/documenteditor/mobile/resources/css/app-material.css b/apps/documenteditor/mobile/resources/css/app-material.css index c6c7d000c..b89e0c23f 100644 --- a/apps/documenteditor/mobile/resources/css/app-material.css +++ b/apps/documenteditor/mobile/resources/css/app-material.css @@ -6852,3 +6852,24 @@ html.pixel-ratio-3 .numbers li { max-height: 100%; overflow: auto; } +.doc-placeholder { + background: #fbfbfb; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + z-index: 10; +} +.doc-placeholder > .line { + height: 15px; + margin: 30px; + background: #e2e2e2; + overflow: hidden; + position: relative; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; +} diff --git a/apps/documenteditor/mobile/resources/less/app-ios.less b/apps/documenteditor/mobile/resources/less/app-ios.less index 9cd8b17cc..e97a46d5a 100644 --- a/apps/documenteditor/mobile/resources/less/app-ios.less +++ b/apps/documenteditor/mobile/resources/less/app-ios.less @@ -240,3 +240,28 @@ input, textarea { max-height: 100%; overflow: auto; } + +// Skeleton of document + +.doc-placeholder { + background: #fbfbfb; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + z-index: 10; + + > .line { + height: 15px; + margin: 30px; + background: #e2e2e2; + overflow: hidden; + position: relative; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + } +} diff --git a/apps/documenteditor/mobile/resources/less/app-material.less b/apps/documenteditor/mobile/resources/less/app-material.less index 67653a7d2..c84bb6b83 100644 --- a/apps/documenteditor/mobile/resources/less/app-material.less +++ b/apps/documenteditor/mobile/resources/less/app-material.less @@ -227,3 +227,28 @@ input, textarea { max-height: 100%; overflow: auto; } + +// Skeleton of document + +.doc-placeholder { + background: #fbfbfb; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + z-index: 10; + + > .line { + height: 15px; + margin: 30px; + background: #e2e2e2; + overflow: hidden; + position: relative; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + } +} diff --git a/apps/presentationeditor/embed/index.html b/apps/presentationeditor/embed/index.html index 53212081e..32d5afef3 100644 --- a/apps/presentationeditor/embed/index.html +++ b/apps/presentationeditor/embed/index.html @@ -15,168 +15,121 @@ @@ -186,7 +139,27 @@ - +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    @@ -233,48 +206,17 @@ var params = getUrlParams(), lang = (params["lang"] || 'en').split(/[\-\_]/)[0], - customer = params["customer"] ? ('
    ' + encodeUrlParam(params["customer"]) + '
    ') : '', - margin = (customer !== '') ? 50 : 20, - loading = 'Loading...', - logo = params["logo"] ? ((params["logo"] !== 'none') ? ('') : '') : null; + logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null; window.frameEditorId = params["frameEditorId"]; - if ( lang == 'de') loading = 'Ladevorgang...'; - else if ( lang == 'es') loading = 'Cargando...'; - else if ( lang == 'fr') loading = 'Chargement en cours...'; - else if ( lang == 'it') loading = 'Caricamento in corso...'; - else if ( lang == 'pt') loading = 'Carregando...'; - else if ( lang == 'ru') loading = 'Загрузка...'; - else if ( lang == 'sl') loading = 'Nalaganje...'; - else if ( lang == 'tr') loading = 'Yükleniyor...'; - else if ( lang == 'bg') loading = 'Зареждане...'; - else if ( lang == 'cs') loading = 'Nahrávám...'; - else if ( lang == 'hu') loading = 'Betöltés...'; - else if ( lang == 'ja') loading = '読み込み中...'; - else if ( lang == 'ko') loading = '로드 중...'; - else if ( lang == 'lv') loading = 'Ieladēšana ...'; - else if ( lang == 'nl') loading = 'Laden...'; - else if ( lang == 'pl') loading = 'Ładowanie...'; - else if ( lang == 'sk') loading = 'Nahrávam...'; - else if ( lang == 'uk') loading = 'Завантаження...'; - else if ( lang == 'vi') loading = 'Đang tải...'; - else if ( lang == 'zh') loading = '加载中...'; - - document.write( - '
    ' + - '
    ' + - ((logo!==null) ? logo : - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ') + - '
    ' + - '
    ' + customer + - '
    ' + loading + '
    ' + - '
    ' + - '
    '); + var elem = document.querySelector('.loading-logo'); + if (elem && logo) { + elem.style.backgroundImage= 'none'; + var img = document.querySelector('.loading-logo img'); + img && img.setAttribute('src', logo); + img.style.opacity = 1; + }
    diff --git a/apps/presentationeditor/embed/index.html.deploy b/apps/presentationeditor/embed/index.html.deploy index 519b44e18..2b9abfa1e 100644 --- a/apps/presentationeditor/embed/index.html.deploy +++ b/apps/presentationeditor/embed/index.html.deploy @@ -13,168 +13,93 @@ @@ -184,6 +109,7 @@ +
    diff --git a/apps/presentationeditor/embed/index_loader.html b/apps/presentationeditor/embed/index_loader.html new file mode 100644 index 000000000..e82a7d950 --- /dev/null +++ b/apps/presentationeditor/embed/index_loader.html @@ -0,0 +1,377 @@ + + + + + Documents + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    +
      +
    • +
    • +
    • +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    of 0
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/presentationeditor/embed/index_loader.html.deploy b/apps/presentationeditor/embed/index_loader.html.deploy new file mode 100644 index 000000000..d0dd00e6c --- /dev/null +++ b/apps/presentationeditor/embed/index_loader.html.deploy @@ -0,0 +1,359 @@ + + + + + Documents + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    +
      +
    • +
    • +
    • +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    of 0
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 7e0733fc4..62f21f6b3 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -96,42 +96,10 @@ define([ 'settings:apply': _.bind(this.applySettings, this) } }); - }, - onLaunch: function() { - var me = this; - - this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false}; - this.languages = null; - this.translationTable = []; - this.isModalShowed = 0; - - window.storagename = 'presentation'; - - this.stackLongActions = new Common.IrregularStack({ - strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;}, - weakCompare : function(obj1, obj2){return obj1.type === obj2.type;} - }); - - // Initialize viewport - - if (!Common.Utils.isBrowserSupported()){ - Common.Utils.showBrowserRestriction(); - Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText); - return; - } - - var value = Common.localStorage.getItem("pe-settings-fontrender"); - if (value===null) value = window.devicePixelRatio > 1 ? '1' : '3'; - Common.Utils.InternalSettings.set("pe-settings-fontrender", value); - - // Initialize api - - window["flat_desine"] = true; - - this.api = new Asc.asc_docs_api({ - 'id-view' : 'editor_sdk', - 'translate': { + var me = this, + themeNames = ['blank', 'pixel', 'classic', 'official', 'green', 'lines', 'office', 'safari', 'dotted', 'corner', 'turtle'], + translate = { 'Series': this.txtSeries, 'Diagram Title': this.txtDiagramTitle, 'X Axis': this.txtXAxis, @@ -154,13 +122,43 @@ define([ 'Loading': this.txtLoading, 'Click to add notes': this.txtAddNotes, 'Click to add first slide': this.txtAddFirstSlide - } + }; + + themeNames.forEach(function(item){ + translate[item] = me['txtTheme_' + item.replace(/ /g, '_')] || item; + }); + me.translationTable = translate; + }, + + onLaunch: function() { + var me = this; + + this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false}; + this.languages = null; + this.isModalShowed = 0; + + window.storagename = 'presentation'; + + this.stackLongActions = new Common.IrregularStack({ + strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;}, + weakCompare : function(obj1, obj2){return obj1.type === obj2.type;} }); - var themeNames = ['blank', 'pixel', 'classic', 'official', 'green', 'lines', 'office', 'safari', 'dotted', 'corner', 'turtle']; - themeNames.forEach(function(item){ - me.translationTable[item] = me['txtTheme_' + item.replace(/ /g, '_')] || item; - }); + // Initialize viewport + + if (!Common.Utils.isBrowserSupported()){ + Common.Utils.showBrowserRestriction(); + Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText); + return; + } + + var value = Common.localStorage.getItem("pe-settings-fontrender"); + if (value===null) value = window.devicePixelRatio > 1 ? '1' : '3'; + Common.Utils.InternalSettings.set("pe-settings-fontrender", value); + + // Initialize api + window["flat_desine"] = true; + this.api = this.getApplication().getController('Viewport').getApi(); if (this.api){ this.api.SetDrawingFreeze(true); @@ -331,6 +329,9 @@ define([ if (this.appOptions.location == 'us' || this.appOptions.location == 'ca') Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch); + if (!this.editorConfig.customization || !(this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo)) + $('#editor_sdk').append('
    '); + Common.Controllers.Desktop.init(this.appOptions); }, @@ -763,7 +764,6 @@ define([ me.api.asc_registerCallback('asc_onFocusObject', _.bind(me.onFocusObject, me)); - me.fillTextArt(me.api.asc_getTextArtPreviews()); toolbarController.activateControls(); if (me.needToUpdateVersion) toolbarController.onApiCoAuthoringDisconnect(); @@ -791,6 +791,8 @@ define([ $(document).on('contextmenu', _.bind(me.onContextMenu, me)); Common.Gateway.documentReady(); + + $('.doc-placeholder').remove(); }, onLicenseChanged: function(params) { @@ -1562,7 +1564,7 @@ define([ this.updateThemeColors(); var me = this; setTimeout(function(){ - me.fillTextArt(me.api.asc_getTextArtPreviews()); + me.fillTextArt(); }, 1); } }, @@ -1592,21 +1594,22 @@ define([ _.each(groupNames, function(groupName, index){ var store = new Backbone.Collection([], { model: PE.Models.ShapeModel - }); + }), + arr = []; var cols = (shapes[index].length) > 18 ? 7 : 6, height = Math.ceil(shapes[index].length/cols) * 35 + 3, width = 30 * cols; _.each(shapes[index], function(shape, idx){ - store.add({ + arr.push({ data : {shapeType: shape.Type}, tip : me['txtShape_' + shape.Type] || (me.textShape + ' ' + (idx+1)), allowSelected : true, selected: false }); }); - + store.add(arr); shapegrouparray.push({ groupName : me.shapeGroupNames[index], groupStore : store, @@ -1645,11 +1648,14 @@ define([ }, fillTextArt: function(shapes){ - if (_.isEmpty(shapes)) return; - - var me = this, arr = [], + var arr = [], artStore = this.getCollection('Common.Collections.TextArt'); + if (!shapes && artStore.length>0) {// shapes == undefined when update textart collection (from asc_onSendThemeColors) + shapes = this.api.asc_getTextArtPreviews(); + } + if (_.isEmpty(shapes)) return; + _.each(shapes, function(shape, index){ arr.push({ imageUrl : shape, @@ -1659,11 +1665,6 @@ define([ }); }); artStore.reset(arr); - - setTimeout(function(){ - me.getApplication().getController('RightMenu').fillTextArt(); - }, 50); - }, loadLanguages: function(apiLangs) { diff --git a/apps/presentationeditor/main/app/controller/RightMenu.js b/apps/presentationeditor/main/app/controller/RightMenu.js index ce0e8a958..646a27be8 100644 --- a/apps/presentationeditor/main/app/controller/RightMenu.js +++ b/apps/presentationeditor/main/app/controller/RightMenu.js @@ -278,15 +278,11 @@ define([ this.rightmenu.tableSettings.updateMetricUnit(); }, - fillTextArt: function() { - this.rightmenu.textartSettings.fillTextArt(); - }, - createDelayedElements: function() { if (this.editMode && this.api) { this.api.asc_registerCallback('asc_doubleClickOnObject', _.bind(this.onDoubleClickOnObject, this)); - this.rightmenu.shapeSettings.createDelayedElements(); + // this.rightmenu.shapeSettings.createDelayedElements(); var selectedElements = this.api.getSelectedElements(); if (selectedElements.length>0) { this.onFocusObject(selectedElements, !Common.localStorage.getBool("pe-hide-right-settings", this.rightmenu.defaultHideRightMenu)); diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 385c1db34..41b028a80 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -125,7 +125,9 @@ define([ 'insert:textart' : this.onInsertTextart.bind(this), 'insert:shape' : this.onInsertShape.bind(this), 'add:slide' : this.onAddSlide.bind(this), - 'change:compact' : this.onClickChangeCompact + 'change:slide' : this.onChangeSlide.bind(this), + 'change:compact' : this.onClickChangeCompact, + 'add:chart' : this.onSelectChart }, 'FileMenu': { 'menu:hide': this.onFileMenu.bind(this, 'hide'), @@ -232,10 +234,6 @@ define([ Common.NotificationCenter.on('app:ready', me.onAppReady.bind(me)); Common.NotificationCenter.on('app:face', me.onAppShowed.bind(me)); - PE.getCollection('Common.Collections.TextArt').bind({ - reset: me.onResetTextArt.bind(this) - }); - PE.getCollection('ShapeGroups').bind({ reset: me.onResetAutoshapes.bind(this) }); @@ -255,8 +253,6 @@ define([ * UI Events */ - if (toolbar.mnuChangeSlidePicker) - toolbar.mnuChangeSlidePicker.on('item:click', _.bind(this.onChangeSlide, this)); toolbar.btnPreview.on('click', _.bind(this.onPreviewBtnClick, this)); toolbar.btnPreview.menu.on('item:click', _.bind(this.onPreviewItemClick, this)); toolbar.btnPrint.on('click', _.bind(this.onPrint, this)); @@ -309,7 +305,6 @@ define([ toolbar.btnColorSchemas.menu.on('item:click', _.bind(this.onColorSchemaClick, this)); toolbar.btnColorSchemas.menu.on('show:after', _.bind(this.onColorSchemaShow, this)); toolbar.btnSlideSize.menu.on('item:click', _.bind(this.onSlideSize, this)); - toolbar.mnuInsertChartPicker.on('item:click', _.bind(this.onSelectChart, this)); toolbar.listTheme.on('click', _.bind(this.onListThemeSelect, this)); toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this)); toolbar.btnEditHeader.on('click', _.bind(this.onEditHeaderClick, this, 'header')); @@ -362,7 +357,7 @@ define([ this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this)); this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPages, this)); - this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onMathTypes, this)); + this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this)); this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this)); this.api.asc_registerCallback('asc_onTextLanguage', _.bind(this.onTextLanguage, this)); }, @@ -722,8 +717,12 @@ define([ this.toolbar.lockToolbar(PE.enumLock.inEquation, in_equation, {array: [me.toolbar.btnSuperscript, me.toolbar.btnSubscript]}); } - if (this.toolbar.mnuChangeSlidePicker) - this.toolbar.mnuChangeSlidePicker.options.layout_index = layout_index; + if (this.toolbar.btnChangeSlide) { + if (this.toolbar.btnChangeSlide.mnuSlidePicker) + this.toolbar.btnChangeSlide.mnuSlidePicker.options.layout_index = layout_index; + else + this.toolbar.btnChangeSlide.mnuSlidePicker = {options: {layout_index: layout_index}}; + } }, onApiStyleChange: function(v) { @@ -816,19 +815,17 @@ define([ }, onAddSlide: function(type) { - var me = this; if ( this.api) { this.api.AddSlide(type); - Common.NotificationCenter.trigger('edit:complete', me.toolbar); + Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.component.Analytics.trackEvent('ToolBar', 'Add Slide'); } }, - onChangeSlide: function(picker, item, record) { + onChangeSlide: function(type) { if (this.api) { - if (record) - this.api.ChangeLayout(record.get('data').idx); + this.api.ChangeLayout(type); Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.component.Analytics.trackEvent('ToolBar', 'Change Layout'); @@ -1584,11 +1581,8 @@ define([ } }, - onSelectChart: function(picker, item, record) { - if (!record) return; - + onSelectChart: function(type) { var me = this, - type = record.get('type'), chart = false; var selectedElements = me.api.getSelectedElements(); @@ -1712,17 +1706,14 @@ define([ }, onResetAutoshapes: function () { - setTimeout(function () { - this.toolbar.updateAutoshapeMenu(PE.getCollection('ShapeGroups')); - }.bind(this), 0); - }, - - onResetTextArt: function (collection, opts) { - (new Promise(function (resolve, reject) { - resolve(); - })).then(function () { - this.toolbar.updateTextartMenu(collection); - }.bind(this)); + var me = this; + var onShowBefore = function(menu) { + me.toolbar.updateAutoshapeMenu(menu, PE.getCollection('ShapeGroups')); + menu.off('show:before', onShowBefore); + }; + me.toolbar.btnsInsertShape.forEach(function (btn, index) { + btn.menu.on('show:before', onShowBefore); + }); }, onResetSlides: function () { @@ -1736,12 +1727,44 @@ define([ var me = this, equationsStore = this.getApplication().getCollection('EquationGroups'); - me.equationPickers = []; me.toolbar.btnInsertEquation.menu.removeAll(); + var onShowAfter = function(menu) { + for (var i = 0; i < equationsStore.length; ++i) { + var equationPicker = new Common.UI.DataViewSimple({ + el: $('#id-toolbar-menu-equationgroup' + i), + parentMenu: menu.items[i].menu, + store: equationsStore.at(i).get('groupStore'), + scrollAlwaysVisible: true, + itemTemplate: _.template('
    ' + + '
    ' + + '
    ') + }); + equationPicker.on('item:click', function(picker, item, record, e) { + if (me.api) { + if (record) + me.api.asc_AddMath(record.get('data').equationType); + + if (me.toolbar.btnsInsertText.pressed()) { + me.toolbar.btnsInsertText.toggle(false, true); + } + if (me.toolbar.btnsInsertShape.pressed()) { + me.toolbar.btnsInsertShape.toggle(false, true); + } + + if (e.type !== 'click') + me.toolbar.btnInsertEquation.menu.hide(); + Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertEquation); + Common.component.Analytics.trackEvent('ToolBar', 'Add Equation'); + } + }); + } + menu.off('show:after', onShowAfter); + }; + me.toolbar.btnInsertEquation.menu.on('show:after', onShowAfter); for (var i = 0; i < equationsStore.length; ++i) { var equationGroup = equationsStore.at(i); - var menuItem = new Common.UI.MenuItem({ caption: equationGroup.get('groupName'), menu: new Common.UI.Menu({ @@ -1753,56 +1776,7 @@ define([ ] }) }); - me.toolbar.btnInsertEquation.menu.addItem(menuItem); - - var equationPicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-equationgroup' + i), - store: equationGroup.get('groupStore'), - parentMenu: menuItem.menu, - showLast: false, - itemTemplate: _.template('
    ' + - '
    ') - }); - if (equationGroup.get('groupHeight').length) { - - me.equationPickers.push(equationPicker); - me.toolbar.btnInsertEquation.menu.on('show:after', function () { - - if (me.equationPickers.length) { - var element = $(this.el).find('.over').find('.menu-shape'); - if (element.length) { - for (var i = 0; i < me.equationPickers.length; ++i) { - if (element[0].id == me.equationPickers[i].el.id) { - me.equationPickers[i].scroller.update({alwaysVisibleY: true}); - me.equationPickers.splice(i, 1); - return; - } - } - } - } - }); - } - - equationPicker.on('item:click', function(picker, item, record, e) { - if (me.api) { - if (record) - me.api.asc_AddMath(record.get('data').equationType); - - if (me.toolbar.btnsInsertText.pressed()) { - me.toolbar.btnsInsertText.toggle(false, true); - } - if (me.toolbar.btnsInsertShape.pressed()) { - me.toolbar.btnsInsertShape.toggle(false, true); - } - - if (e.type !== 'click') - me.toolbar.btnInsertEquation.menu.hide(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertEquation); - Common.component.Analytics.trackEvent('ToolBar', 'Add Equation'); - } - }); } }, @@ -1814,6 +1788,16 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertEquation); }, + onApiMathTypes: function(equation) { + this._equationTemp = equation; + var me = this; + var onShowBefore = function(menu) { + me.onMathTypes(me._equationTemp); + me.toolbar.btnInsertEquation.menu.off('show:before', onShowBefore); + }; + me.toolbar.btnInsertEquation.menu.on('show:before', onShowBefore); + }, + onMathTypes: function(equation) { var equationgrouparray = [], equationsStore = this.getCollection('EquationGroups'); @@ -1854,35 +1838,29 @@ define([ translationTable[Common.define.c_oAscMathType[name]] = this[translate]; } } - - var i,id = 0, count = 0, length = 0, width = 0, height = 0, store = null, list = null, eqStore = null, eq = null; + var i,id = 0, count = 0, length = 0, width = 0, height = 0, store = null, list = null, eqStore = null, eq = null, data; if (equation) { - - count = equation.get_Data().length; - + data = equation.get_Data(); + count = data.length; if (count) { for (var j = 0; j < count; ++j) { - id = equation.get_Data()[j].get_Id(); - width = equation.get_Data()[j].get_W(); - height = equation.get_Data()[j].get_H(); + var group = data[j]; + id = group.get_Id(); + width = group.get_W(); + height = group.get_H(); store = new Backbone.Collection([], { model: PE.Models.EquationModel }); if (store) { - - var allItemsCount = 0, itemsCount = 0, ids = 0; - - length = equation.get_Data()[j].get_Data().length; - + var allItemsCount = 0, itemsCount = 0, ids = 0, arr = []; + length = group.get_Data().length; for (i = 0; i < length; ++i) { - eqStore = equation.get_Data()[j].get_Data()[i]; - + eqStore = group.get_Data()[i]; itemsCount = eqStore.get_Data().length; for (var p = 0; p < itemsCount; ++p) { - eq = eqStore.get_Data()[p]; ids = eq.get_Id(); @@ -1891,8 +1869,7 @@ define([ if (translationTable.hasOwnProperty(ids)) { translate = translationTable[ids]; } - - store.add({ + arr.push({ data : {equationType: ids}, tip : translate, allowSelected : true, @@ -1906,7 +1883,7 @@ define([ allItemsCount += itemsCount; } - + store.add(arr); width = c_oAscMathMainTypeStrings[id][1] * (width + 10); // 4px margin + 4px margin + 1px border + 1px border var normHeight = parseInt(370 / (height + 10)) * (height + 10); @@ -1918,9 +1895,7 @@ define([ }); } } - equationsStore.add(equationgrouparray); - this.fillEquations(); } } @@ -1962,7 +1937,7 @@ define([ this._state.clrtext_asccolor = undefined; }, - _onInitEditorThemes: function(editorThemes, documentThemes) { + _onInitEditorThemes: function(editorThemes/*array */, documentThemes) { var me = this; window.styles_loaded = false; diff --git a/apps/presentationeditor/main/app/controller/Viewport.js b/apps/presentationeditor/main/app/controller/Viewport.js index 36aa2aab6..50de61e27 100644 --- a/apps/presentationeditor/main/app/controller/Viewport.js +++ b/apps/presentationeditor/main/app/controller/Viewport.js @@ -123,11 +123,20 @@ define([ Common.NotificationCenter.on('api:disconnect', this.onApiCoAuthoringDisconnect.bind(this)); }, + getApi: function() { + return this.api; + }, // When our application is ready, lets get started onLaunch: function() { // Create and render main view this.viewport = this.createView('Viewport').render(); + + this.api = new Asc.asc_docs_api({ + 'id-view' : 'editor_sdk', + 'translate': this.getApplication().getController('Main').translationTable + }); + this.header = this.createView('Common.Views.Header', { headerCaption: 'Presentation Editor', storeUsers: PE.getCollection('Common.Collections.Users') diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index e16ca6ae2..529e5359c 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -692,21 +692,11 @@ define([ }; this.changeLanguageMenu = function(menu) { - var i; if (me._currLang.id===null || me._currLang.id===undefined) { - for (i=0; i-1) && !menu.items[index].checked && menu.setChecked(index, true); } }; @@ -2169,13 +2159,21 @@ define([ }) }); + var langTemplate = _.template([ + '', + '', + '<%= caption %>', + '' + ].join('')); + me.langTableMenu = new Common.UI.MenuItem({ caption : me.langText, - menu : new Common.UI.Menu({ + menu : new Common.UI.MenuSimple({ cls: 'lang-menu', menuAlign: 'tl-tr', restoreHeight: 285, items : [], + itemTemplate: langTemplate, search: true }) }); @@ -2246,11 +2244,12 @@ define([ me.langParaMenu = new Common.UI.MenuItem({ caption : me.langText, - menu : new Common.UI.Menu({ + menu : new Common.UI.MenuSimple({ cls: 'lang-menu', menuAlign: 'tl-tr', restoreHeight: 285, items : [], + itemTemplate: langTemplate, search: true }) }); @@ -3360,60 +3359,40 @@ define([ setLanguages: function(langs){ var me = this; - if (langs && langs.length > 0 && me.langParaMenu && me.langTableMenu) { - me.langParaMenu.menu.removeAll(); - me.langTableMenu.menu.removeAll(); - _.each(langs, function(lang, index){ - me.langParaMenu.menu.addItem(new Common.UI.MenuItem({ + var arrPara = [], arrTable = []; + _.each(langs, function(lang) { + var item = { caption : lang.displayValue, value : lang.value, checkable : true, - toggleGroup : 'popupparalang', langid : lang.code, - spellcheck : lang.spellcheck, - template: _.template([ - '', - '', - '<%= caption %>', - '' - ].join('')) - }).on('click', function(item, e){ - if (me.api){ - if (!_.isUndefined(item.options.langid)) - me.api.put_TextPrLang(item.options.langid); + spellcheck : lang.spellcheck + }; + arrPara.push(item); + arrTable.push(_.clone(item)); + }); + me.langParaMenu.menu.resetItems(arrPara); + me.langTableMenu.menu.resetItems(arrTable); - me._currLang.paraid = item.options.langid; - me.langParaMenu.menu.currentCheckedItem = item; + me.langParaMenu.menu.on('item:click', function(menu, item){ + if (me.api){ + if (!_.isUndefined(item.langid)) + me.api.put_TextPrLang(item.langid); - me.fireEvent('editcomplete', me); - } - })); + me._currLang.paraid = item.langid; + me.fireEvent('editcomplete', me); + } + }); - me.langTableMenu.menu.addItem(new Common.UI.MenuItem({ - caption : lang.displayValue, - value : lang.value, - checkable : true, - toggleGroup : 'popuptablelang', - langid : lang.code, - spellcheck : lang.spellcheck, - template: _.template([ - '', - '', - '<%= caption %>', - '' - ].join('')) - }).on('click', function(item, e){ - if (me.api){ - if (!_.isUndefined(item.options.langid)) - me.api.put_TextPrLang(item.options.langid); + me.langTableMenu.menu.on('item:click', function(menu, item, e){ + if (me.api){ + if (!_.isUndefined(item.langid)) + me.api.put_TextPrLang(item.langid); - me._currLang.tableid = item.options.langid; - me.langTableMenu.menu.currentCheckedItem = item; - - me.fireEvent('editcomplete', me); - } - })); + me._currLang.tableid = item.langid; + me.fireEvent('editcomplete', me); + } }); } }, diff --git a/apps/presentationeditor/main/app/view/FileMenu.js b/apps/presentationeditor/main/app/view/FileMenu.js index f76d34328..469555fd2 100644 --- a/apps/presentationeditor/main/app/view/FileMenu.js +++ b/apps/presentationeditor/main/app/view/FileMenu.js @@ -49,6 +49,7 @@ define([ PE.Views.FileMenu = Common.UI.BaseView.extend(_.extend({ el: '#file-menu-panel', + rendered: false, options: {alias:'FileMenu'}, template: _.template(tpl), @@ -84,89 +85,92 @@ define([ }, render: function () { - this.$el = $(this.el); - this.$el.html(this.template()); + var $markup = $(this.template()); this.miSave = new Common.UI.MenuItem({ - el : $('#fm-btn-save',this.el), + el : $markup.elementById('#fm-btn-save'), action : 'save', caption : this.btnSaveCaption, canFocused: false, disabled: true }); + if ( !!this.options.miSave ) { + this.miSave.setDisabled(this.options.miSave.isDisabled()); + delete this.options.miSave; + } this.miEdit = new Common.UI.MenuItem({ - el : $('#fm-btn-edit',this.el), + el : $markup.elementById('#fm-btn-edit'), action : 'edit', caption : this.btnToEditCaption, canFocused: false }); this.miDownload = new Common.UI.MenuItem({ - el : $('#fm-btn-download',this.el), + el : $markup.elementById('#fm-btn-download'), action : 'saveas', caption : this.btnDownloadCaption, canFocused: false }); this.miSaveCopyAs = new Common.UI.MenuItem({ - el : $('#fm-btn-save-copy',this.el), + el : $markup.elementById('#fm-btn-save-copy'), action : 'save-copy', caption : this.btnSaveCopyAsCaption, canFocused: false }); this.miSaveAs = new Common.UI.MenuItem({ - el : $('#fm-btn-save-desktop',this.el), + el : $markup.elementById('#fm-btn-save-desktop'), action : 'save-desktop', caption : this.btnSaveAsCaption, canFocused: false }); this.miPrint = new Common.UI.MenuItem({ - el : $('#fm-btn-print',this.el), + el : $markup.elementById('#fm-btn-print'), action : 'print', caption : this.btnPrintCaption, canFocused: false }); this.miRename = new Common.UI.MenuItem({ - el : $('#fm-btn-rename',this.el), + el : $markup.elementById('#fm-btn-rename'), action : 'rename', caption : this.btnRenameCaption, canFocused: false }); this.miProtect = new Common.UI.MenuItem({ - el : $('#fm-btn-protect',this.el), + el : $markup.elementById('#fm-btn-protect'), action : 'protect', caption : this.btnProtectCaption, canFocused: false }); this.miRecent = new Common.UI.MenuItem({ - el : $('#fm-btn-recent',this.el), + el : $markup.elementById('#fm-btn-recent'), action : 'recent', caption : this.btnRecentFilesCaption, canFocused: false }); this.miNew = new Common.UI.MenuItem({ - el : $('#fm-btn-create',this.el), + el : $markup.elementById('#fm-btn-create'), action : 'new', caption : this.btnCreateNewCaption, canFocused: false }); this.miAccess = new Common.UI.MenuItem({ - el : $('#fm-btn-rights',this.el), + el : $markup.elementById('#fm-btn-rights'), action : 'rights', caption : this.btnRightsCaption, canFocused: false }); this.miHelp = new Common.UI.MenuItem({ - el : $('#fm-btn-help',this.el), + el : $markup.elementById('#fm-btn-help'), action : 'help', caption : this.btnHelpCaption, canFocused: false @@ -175,7 +179,7 @@ define([ this.items = []; this.items.push( new Common.UI.MenuItem({ - el : $('#fm-btn-return',this.el), + el : $markup.elementById('#fm-btn-return'), action : 'back', caption : this.btnCloseMenuCaption, canFocused: false @@ -191,35 +195,37 @@ define([ this.miRecent, this.miNew, new Common.UI.MenuItem({ - el : $('#fm-btn-info',this.el), + el : $markup.elementById('#fm-btn-info'), action : 'info', caption : this.btnInfoCaption, canFocused: false }), this.miAccess, new Common.UI.MenuItem({ - el : $('#fm-btn-settings',this.el), + el : $markup.elementById('#fm-btn-settings'), action : 'opts', caption : this.btnSettingsCaption, canFocused: false }), this.miHelp, new Common.UI.MenuItem({ - el : $('#fm-btn-back',this.el), + el : $markup.elementById('#fm-btn-back'), action : 'exit', caption : this.btnBackCaption, canFocused: false }) ); - var me = this; - me.panels = { - 'opts' : (new PE.Views.FileMenuPanels.Settings({menu:me})).render(), - 'info' : (new PE.Views.FileMenuPanels.DocumentInfo({menu:me})).render(), - 'rights' : (new PE.Views.FileMenuPanels.DocumentRights({menu:me})).render() - }; + this.rendered = true; + this.$el.html($markup); + this.$el.find('.content-box').hide(); + this.applyMode(); - me.$el.find('.content-box').hide(); + if ( !!this.api ) { + this.panels['info'].setApi(this.api); + if ( this.panels['protect'] ) + this.panels['protect'].setApi(this.api); + } return this; }, @@ -227,6 +233,9 @@ define([ show: function(panel) { if (this.isVisible() && panel===undefined || !this.mode) return; + if ( !this.rendered ) + this.render(); + var defPanel = (this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info'; if (!panel) panel = this.active || defPanel; @@ -245,6 +254,16 @@ define([ }, applyMode: function() { + if (!this.panels) { + this.panels = { + 'opts' : (new PE.Views.FileMenuPanels.Settings({menu:this})).render(this.$el.find('#panel-settings')), + 'info' : (new PE.Views.FileMenuPanels.DocumentInfo({menu:this})).render(this.$el.find('#panel-info')), + 'rights' : (new PE.Views.FileMenuPanels.DocumentRights({menu:this})).render(this.$el.find('#panel-rights')) + }; + } + + if (!this.mode) return; + this.miDownload[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide'](); this.miSaveCopyAs[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) ?'show':'hide'](); this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide'](); @@ -278,30 +297,28 @@ define([ if ( this.mode.canCreateNew ) { if (this.mode.templates && this.mode.templates.length) { $('a',this.miNew.$el).text(this.btnCreateNewCaption + '...'); - this.panels['new'] = ((new PE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render()); + !this.panels['new'] && (this.panels['new'] = (new PE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render()); } } - if ( this.mode.canOpenRecent ) { - if (this.mode.recent){ - this.panels['recent'] = (new PE.Views.FileMenuPanels.RecentFiles({menu:this, recent: this.mode.recent})).render(); - } + if ( this.mode.canOpenRecent && this.mode.recent ) { + !this.panels['recent'] && (this.panels['recent'] = (new PE.Views.FileMenuPanels.RecentFiles({menu:this, recent: this.mode.recent})).render()); } if (this.mode.canProtect) { - this.panels['protect'] = (new PE.Views.FileMenuPanels.ProtectDoc({menu:this})).render(); + !this.panels['protect'] && (this.panels['protect'] = (new PE.Views.FileMenuPanels.ProtectDoc({menu:this})).render()); this.panels['protect'].setMode(this.mode); } if (this.mode.canDownload) { - this.panels['saveas'] = ((new PE.Views.FileMenuPanels.ViewSaveAs({menu: this})).render()); + !this.panels['saveas'] && (this.panels['saveas'] = ((new PE.Views.FileMenuPanels.ViewSaveAs({menu: this})).render())); } if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) { - this.panels['save-copy'] = ((new PE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render()); + !this.panels['save-copy'] && (this.panels['save-copy'] = ((new PE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render())); } - if (this.mode.canHelp) { + if (this.mode.canHelp && !this.panels['help']) { this.panels['help'] = ((new PE.Views.FileMenuPanels.Help({menu: this})).render()); this.panels['help'].setLangConfig(this.mode.lang); } @@ -319,14 +336,21 @@ define([ this.mode = mode; } - if (!delay) this.applyMode(); + if (!delay) { + if ( this.rendered ) + this.applyMode(); + } }, setApi: function(api) { this.api = api; - this.panels['info'].setApi(api); - if (this.panels['protect']) this.panels['protect'].setApi(api); + + if ( this.rendered ) { + this.panels['info'].setApi(api); + if (this.panels['protect']) this.panels['protect'].setApi(api); + } this.api.asc_registerCallback('asc_onDocumentName', _.bind(this.onDocumentName, this)); + return this; }, loadDocument: function(data) { @@ -370,7 +394,8 @@ define([ onDocumentName: function(name) { this.document.title = name; - this.panels['info'].updateInfo(this.document); + if (this.rendered) + this.panels['info'].updateInfo(this.document); }, isVisible: function () { @@ -378,8 +403,12 @@ define([ }, getButton: function(type) { - if (type == 'save') - return this.miSave; + if (type == 'save') { + if (this.rendered) + return this.miSave; + else + return this.options.miSave ? this.options.miSave : (this.options.miSave = new Common.UI.MenuItem({})); + } }, btnSaveCaption : 'Save', diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index f225db3eb..4d57c925d 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -84,12 +84,12 @@ define([ }, render: function() { - $(this.el).html(this.template({rows:this.formats})); + this.$el.html(this.template({rows:this.formats})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -140,12 +140,12 @@ define([ }, render: function() { - $(this.el).html(this.template({rows:this.formats})); + this.$el.html(this.template({rows:this.formats})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -221,21 +221,22 @@ define([ this.menu = options.menu; }, - render: function() { - $(this.el).html(this.template({scope: this})); + render: function(node) { + var me = this; + var $markup = $(this.template({scope: this})); this.chSpell = new Common.UI.CheckBox({ - el: $('#fms-chb-spell-check'), + el: $markup.findById('#fms-chb-spell-check'), labelText: this.strSpellCheckMode }); this.chInputMode = new Common.UI.CheckBox({ - el: $('#fms-chb-input-mode'), + el: $markup.findById('#fms-chb-input-mode'), labelText: this.strInputMode }); this.cmbZoom = new Common.UI.ComboBox({ - el : $('#fms-cmb-zoom'), + el : $markup.findById('#fms-cmb-zoom'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -259,7 +260,7 @@ define([ /** coauthoring begin **/ this.cmbCoAuthMode = new Common.UI.ComboBox({ - el : $('#fms-cmb-coauth-mode'), + el : $markup.findById('#fms-cmb-coauth-mode'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -267,38 +268,38 @@ define([ { value: 1, displayValue: this.strFast, descValue: this.strCoAuthModeDescFast}, { value: 0, displayValue: this.strStrict, descValue: this.strCoAuthModeDescStrict } ] - }).on('selected', _.bind(function(combo, record) { - if (record.value == 1 && (this.chAutosave.getValue()!=='checked')) - this.chAutosave.setValue(1); - this.lblCoAuthMode.text(record.descValue); - }, this)); + }).on('selected', function(combo, record) { + if (record.value == 1 && (me.chAutosave.getValue()!=='checked')) + me.chAutosave.setValue(1); + me.lblCoAuthMode.text(record.descValue); + }); - this.lblCoAuthMode = $('#fms-lbl-coauth-mode'); + this.lblCoAuthMode = $markup.findById('#fms-lbl-coauth-mode'); /** coauthoring end **/ this.chAutosave = new Common.UI.CheckBox({ - el: $('#fms-chb-autosave'), + el: $markup.findById('#fms-chb-autosave'), labelText: this.strAutosave - }).on('change', _.bind(function(field, newValue, oldValue, eOpts){ - if (field.getValue()!=='checked' && this.cmbCoAuthMode.getValue()) { - this.cmbCoAuthMode.setValue(0); - this.lblCoAuthMode.text(this.strCoAuthModeDescStrict); + }).on('change', function(field, newValue, oldValue, eOpts){ + if (field.getValue()!=='checked' && me.cmbCoAuthMode.getValue()) { + me.cmbCoAuthMode.setValue(0); + me.lblCoAuthMode.text(me.strCoAuthModeDescStrict); } - }, this)); - this.lblAutosave = $('#fms-lbl-autosave'); + }); + this.lblAutosave = $markup.findById('#fms-lbl-autosave'); this.chForcesave = new Common.UI.CheckBox({ - el: $('#fms-chb-forcesave'), + el: $markup.findById('#fms-chb-forcesave'), labelText: this.strForcesave }); this.chAlignGuides = new Common.UI.CheckBox({ - el: $('#fms-chb-align-guides'), + el: $markup.findById('#fms-chb-align-guides'), labelText: this.strAlignGuides }); this.cmbFontRender = new Common.UI.ComboBox({ - el : $('#fms-cmb-font-render'), + el : $markup.findById('#fms-cmb-font-render'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -310,7 +311,7 @@ define([ }); this.cmbUnit = new Common.UI.ComboBox({ - el : $('#fms-cmb-unit'), + el : $markup.findById('#fms-cmb-unit'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -322,14 +323,16 @@ define([ }); this.btnApply = new Common.UI.Button({ - el: '#fms-btn-apply' + el: $markup.findById('#fms-btn-apply') }); this.btnApply.on('click', _.bind(this.applySettings, this)); + this.$el = $(node).html($markup); + if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -472,7 +475,7 @@ define([ }, render: function() { - $(this.el).html(this.template()); + this.$el.html(this.template()); this.viewRecentPicker = new Common.UI.DataView({ el: $('#id-recent-view'), @@ -490,7 +493,7 @@ define([ if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -552,14 +555,14 @@ define([ }, render: function() { - $(this.el).html(this.template({ + this.$el.html(this.template({ scope: this, docs: this.options[0].docs })); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -668,15 +671,14 @@ define([ this._locked = false; }, - render: function() { - $(this.el).html(this.template({scope: this})); - + render: function(node) { var me = this; + var $markup = $(me.template()); // server info - this.lblPlacement = $('#id-info-placement'); - this.lblOwner = $('#id-info-owner'); - this.lblUploaded = $('#id-info-uploaded'); + this.lblPlacement = $markup.findById('#id-info-placement'); + this.lblOwner = $markup.findById('#id-info-owner'); + this.lblUploaded = $markup.findById('#id-info-uploaded'); // edited info var keyDownBefore = function(input, e){ @@ -691,37 +693,37 @@ define([ }; this.inputTitle = new Common.UI.InputField({ - el : $('#id-info-title'), + el : $markup.findById('#id-info-title'), style : 'width: 200px;', placeHolder : this.txtAddText, validateOnBlur: false }).on('keydown:before', keyDownBefore); this.inputSubject = new Common.UI.InputField({ - el : $('#id-info-subject'), + el : $markup.findById('#id-info-subject'), style : 'width: 200px;', placeHolder : this.txtAddText, validateOnBlur: false }).on('keydown:before', keyDownBefore); this.inputComment = new Common.UI.InputField({ - el : $('#id-info-comment'), + el : $markup.findById('#id-info-comment'), style : 'width: 200px;', placeHolder : this.txtAddText, validateOnBlur: false }).on('keydown:before', keyDownBefore); // modify info - this.lblModifyDate = $('#id-info-modify-date'); - this.lblModifyBy = $('#id-info-modify-by'); + this.lblModifyDate = $markup.findById('#id-info-modify-date'); + this.lblModifyBy = $markup.findById('#id-info-modify-by'); // creation info - this.lblDate = $('#id-info-date'); - this.lblApplication = $('#id-info-appname'); - this.tblAuthor = $('#id-info-author table'); - this.trAuthor = $('#id-info-add-author').closest('tr'); + this.lblDate = $markup.findById('#id-info-date'); + this.lblApplication = $markup.findById('#id-info-appname'); + this.tblAuthor = $markup.findById('#id-info-author table'); + this.trAuthor = $markup.findById('#id-info-add-author').closest('tr'); this.authorTpl = '
    '; this.tblAuthor.on('click', function(e) { - var btn = $(e.target); + var btn = $markup.find(e.target); if (btn.hasClass('close') && !btn.hasClass('disabled')) { var el = btn.closest('tr'), idx = me.tblAuthor.find('tr').index(el); @@ -731,7 +733,7 @@ define([ }); this.inputAuthor = new Common.UI.InputField({ - el : $('#id-info-add-author'), + el : $markup.findById('#id-info-add-author'), style : 'width: 200px;', validateOnBlur: false, placeHolder: this.txtAddAuthor @@ -764,9 +766,10 @@ define([ this.updateInfo(this.doc); + this.$el = $(node).html($markup); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -985,12 +988,12 @@ define([ this.menu = options.menu; }, - render: function() { - $(this.el).html(this.template()); + render: function(node) { + var $markup = $(this.template()); - this.cntRights = $('#id-info-rights'); + this.cntRights = $markup.findById('#id-info-rights'); this.btnEditRights = new Common.UI.Button({ - el: '#id-info-btn-edit' + el: $markup.findById('#id-info-btn-edit') }); this.btnEditRights.on('click', _.bind(this.changeAccessRights, this)); @@ -998,15 +1001,17 @@ define([ this.updateInfo(this.doc); + this.$el = $(node).html($markup); + if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } - Common.NotificationCenter.on('collaboration:sharing', _.bind(this.changeAccessRights, this)); - Common.NotificationCenter.on('collaboration:sharingdeny', _.bind(this.onLostEditRights, this)); + Common.NotificationCenter.on('collaboration:sharing', this.changeAccessRights.bind(this)); + Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this)); return this; }, @@ -1150,7 +1155,7 @@ define([ render: function() { var me = this; - $(this.el).html(this.template()); + this.$el.html(this.template()); this.viewHelpPicker = new Common.UI.DataView({ el: $('#id-help-contents'), @@ -1281,7 +1286,7 @@ define([ }, render: function() { - $(this.el).html(this.template({scope: this})); + this.$el.html(this.template({scope: this})); var protection = PE.getController('Common.Controllers.Protection').getView(); @@ -1308,7 +1313,7 @@ define([ this.cntSignatureView = $('#id-fms-signature-view'); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } diff --git a/apps/presentationeditor/main/app/view/LeftMenu.js b/apps/presentationeditor/main/app/view/LeftMenu.js index ad3680c6a..4c5db4111 100644 --- a/apps/presentationeditor/main/app/view/LeftMenu.js +++ b/apps/presentationeditor/main/app/view/LeftMenu.js @@ -87,13 +87,11 @@ define([ }, render: function () { - var el = $(this.el); - el.html(this.template({ - })); + var $markup = $(this.template({})); this.btnSearch = new Common.UI.Button({ action: 'search', - el: $('#left-btn-search'), + el: $markup.elementById('#left-btn-search'), hint: this.tipSearch + Common.Utils.String.platformKey('Ctrl+F'), disabled: true, enableToggle: true @@ -101,7 +99,7 @@ define([ this.btnThumbs = new Common.UI.Button({ action: 'thumbs', - el: $('#left-btn-thumbs'), + el: $markup.elementById('#left-btn-thumbs'), hint: this.tipSlides, enableToggle: true, disabled: true, @@ -110,7 +108,7 @@ define([ this.btnAbout = new Common.UI.Button({ action: 'about', - el: $('#left-btn-about'), + el: $markup.elementById('#left-btn-about'), hint: this.tipAbout, enableToggle: true, disabled: true, @@ -119,14 +117,14 @@ define([ this.btnSupport = new Common.UI.Button({ action: 'support', - el: $('#left-btn-support'), + el: $markup.elementById('#left-btn-support'), hint: this.tipSupport, disabled: true }); /** coauthoring begin **/ this.btnComments = new Common.UI.Button({ - el: $('#left-btn-comments'), + el: $markup.elementById('#left-btn-comments'), hint: this.tipComments + Common.Utils.String.platformKey('Ctrl+Shift+H'), enableToggle: true, disabled: true, @@ -134,7 +132,7 @@ define([ }); this.btnChat = new Common.UI.Button({ - el: $('#left-btn-chat'), + el: $markup.elementById('#left-btn-chat'), hint: this.tipChat + Common.Utils.String.platformKey('Alt+Q'), enableToggle: true, disabled: true, @@ -144,12 +142,12 @@ define([ this.btnComments.hide(); this.btnChat.hide(); - this.btnComments.on('click', _.bind(this.onBtnMenuClick, this)); - this.btnChat.on('click', _.bind(this.onBtnMenuClick, this)); + this.btnComments.on('click', this.onBtnMenuClick.bind(this)); + this.btnChat.on('click', this.onBtnMenuClick.bind(this)); /** coauthoring end **/ this.btnPlugins = new Common.UI.Button({ - el: $('#left-btn-plugins'), + el: $markup.elementById('#left-btn-plugins'), hint: this.tipPlugins, enableToggle: true, disabled: true, @@ -164,8 +162,8 @@ define([ this.btnAbout.on('click', _.bind(this.onFullMenuClick, this)); this.menuFile = new PE.Views.FileMenu({}); - this.menuFile.render(); - this.btnAbout.panel = (new Common.Views.About({el: $('#about-menu-panel'), appName: 'Presentation Editor'})).render(); + this.btnAbout.panel = (new Common.Views.About({el: '#about-menu-panel', appName: 'Presentation Editor'})); + this.$el.html($markup); return this; }, diff --git a/apps/presentationeditor/main/app/view/ShapeSettings.js b/apps/presentationeditor/main/app/view/ShapeSettings.js index 29335a3dc..0ab44f978 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettings.js +++ b/apps/presentationeditor/main/app/view/ShapeSettings.js @@ -76,6 +76,7 @@ define([ this._noApply = true; this._sendUndoPoint = true; this._sliderChanged = false; + this._texturearray = null; this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt); @@ -95,7 +96,8 @@ define([ DisabledFillPanels: false, DisabledControls: false, HideShapeOnlySettings: false, - HideChangeTypeSettings: false + HideChangeTypeSettings: false, + isFromImage: false }; this.lockedControls = []; this._locked = false; @@ -717,7 +719,8 @@ define([ || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' || shapetype=='straightConnector1'; this.hideChangeTypeSettings(hidechangetype); - if (!hidechangetype) { + this._state.isFromImage = !!props.get_FromImage(); + if (!hidechangetype && this.btnChangeShape.menu.items.length) { this.btnChangeShape.menu.items[0].setVisible(props.get_FromImage()); this.btnChangeShape.menu.items[1].setVisible(!props.get_FromImage()); } @@ -1355,6 +1358,7 @@ define([ }, createDelayedElements: function() { + this._initSettings = false; this.createDelayedControls(); var global_hatch_menu_map = [ @@ -1388,36 +1392,17 @@ define([ this.PatternFillType = this.patternViewData[0].type; } - this.fillAutoShapes(); + this.onInitStandartTextures(); + this.onApiAutoShapes(); this.UpdateThemeColors(); - this._initSettings = false; }, onInitStandartTextures: function(texture) { var me = this; if (texture && texture.length>0){ - if (!this.btnTexture) { - this.btnTexture = new Common.UI.ComboBox({ - el: $('#shape-combo-fill-texture'), - template: _.template([ - '' - ].join('')) - }); - this.textureMenu = new Common.UI.Menu({ - items: [ - { template: _.template('
    ') } - ] - }); - this.textureMenu.render($('#shape-combo-fill-texture')); - this.fillControls.push(this.btnTexture); - } - var texturearray = []; + me._texturearray = []; _.each(texture, function(item){ - texturearray.push({ + me._texturearray.push({ imageUrl: item.get_image(), name : me.textureNames[item.get_id()], type : item.get_id(), @@ -1425,15 +1410,41 @@ define([ selected: false }); }); - var mnuTexturePicker = new Common.UI.DataView({ - el: $('#id-shape-menu-texture'), - restoreHeight: 174, - parentMenu: me.textureMenu, - showLast: false, - store: new Common.UI.DataViewStore(texturearray), - itemTemplate: _.template('
    ') + } + + if (!me._texturearray || me._texturearray.length<1) return; + if (!this._initSettings && !this.btnTexture) { + this.btnTexture = new Common.UI.ComboBox({ + el: $('#shape-combo-fill-texture'), + template: _.template([ + '' + ].join('')) }); - mnuTexturePicker.on('item:click', _.bind(this.onSelectTexture, this)); + this.textureMenu = new Common.UI.Menu({ + items: [ + { template: _.template('
    ') } + ] + }); + this.textureMenu.render($('#shape-combo-fill-texture')); + this.fillControls.push(this.btnTexture); + + var onShowBefore = function(menu) { + var mnuTexturePicker = new Common.UI.DataView({ + el: $('#id-shape-menu-texture'), + restoreHeight: 174, + parentMenu: menu, + showLast: false, + store: new Common.UI.DataViewStore(me._texturearray || []), + itemTemplate: _.template('
    ') + }); + mnuTexturePicker.on('item:click', _.bind(me.onSelectTexture, me)); + menu.off('show:before', onShowBefore); + }; + this.textureMenu.on('show:before', onShowBefore); } }, @@ -1465,11 +1476,46 @@ define([ this.fireEvent('editcomplete', this); }, + onApiAutoShapes: function() { + var me = this; + var onShowBefore = function(menu) { + me.fillAutoShapes(); + menu.off('show:before', onShowBefore); + }; + me.btnChangeShape.menu.on('show:before', onShowBefore); + }, + fillAutoShapes: function() { var me = this, - shapesStore = this.application.getCollection('ShapeGroups'); + shapesStore = this.application.getCollection('ShapeGroups'), + count = shapesStore.length; + + var onShowAfter = function(menu) { + for (var i=-1; i0; i++) { + var store = shapesStore.at(i > -1 ? i : 0).get('groupStore'); + if (i<0) { + store = store.clone(); + store.shift(); + } + var shapePicker = new Common.UI.DataViewSimple({ + el: $('#id-shape-menu-shapegroup' + (i+1), menu.items[i+1].$el), + store: store, + parentMenu: menu.items[i+1].menu, + itemTemplate: _.template('
    \">
    ') + }); + shapePicker.on('item:click', function(picker, item, record, e) { + if (me.api) { + me.api.ChangeShapeType(record.get('data').shapeType); + me.fireEvent('editcomplete', me); + } + if (e.type !== 'click') + me.btnChangeShape.menu.hide(); + }); + } + menu.off('show:after', onShowAfter); + }; + me.btnChangeShape.menu.on('show:after', onShowAfter); - var count = shapesStore.length; for (var i=-1; i0; i++) { var shapeGroup = shapesStore.at(i>-1 ? i : i+1); var menuItem = new Common.UI.MenuItem({ @@ -1482,32 +1528,13 @@ define([ }) }); me.btnChangeShape.menu.addItem(menuItem); - - var store = shapeGroup.get('groupStore'); - if (i<0) { - store = store.clone(); - store.shift(); - } - var shapePicker = new Common.UI.DataView({ - el: $('#id-shape-menu-shapegroup' + (i+1)), - store: store, - parentMenu: menuItem.menu, - showLast: false, - itemTemplate: _.template('
    \">
    ') - }); - - shapePicker.on('item:click', function(picker, item, record, e) { - if (me.api) { - me.api.ChangeShapeType(record.get('data').shapeType); - me.fireEvent('editcomplete', me); - } - if (e.type !== 'click') - me.btnChangeShape.menu.hide(); - }); } + me.btnChangeShape.menu.items[0].setVisible(me._state.isFromImage); + me.btnChangeShape.menu.items[1].setVisible(!me._state.isFromImage); }, UpdateThemeColors: function() { + if (this._initSettings) return; if (!this.btnBackColor) { this.btnBackColor = new Common.UI.ColorButton({ style: "width:45px;", diff --git a/apps/presentationeditor/main/app/view/SlideSettings.js b/apps/presentationeditor/main/app/view/SlideSettings.js index 742ab375a..f71abc046 100644 --- a/apps/presentationeditor/main/app/view/SlideSettings.js +++ b/apps/presentationeditor/main/app/view/SlideSettings.js @@ -73,6 +73,7 @@ define([ this._noApply = true; this._sendUndoPoint = true; this._sliderChanged = false; + this._texturearray = null; this.FillItems = []; @@ -808,6 +809,7 @@ define([ }, createDelayedElements: function() { + this._initSettings = false; this.createDelayedControls(); var global_hatch_menu_map = [ @@ -841,35 +843,16 @@ define([ this.PatternFillType = this.patternViewData[0].type; } + this.onInitStandartTextures(); this.UpdateThemeColors(); - this._initSettings = false; }, onInitStandartTextures: function(texture) { var me = this; if (texture && texture.length>0){ - if (!this.btnTexture) { - this.btnTexture = new Common.UI.ComboBox({ - el: $('#slide-combo-fill-texture'), - template: _.template([ - '' - ].join('')) - }); - this.textureMenu = new Common.UI.Menu({ - items: [ - { template: _.template('
    ') } - ] - }); - this.textureMenu.render($('#slide-combo-fill-texture')); - this.FillItems.push(this.btnTexture); - } - var texturearray = []; + me._texturearray = []; _.each(texture, function(item){ - texturearray.push({ + me._texturearray.push({ imageUrl: item.get_image(), name : me.textureNames[item.get_id()], type : item.get_id(), @@ -877,15 +860,41 @@ define([ selected: false }); }); - var mnuTexturePicker = new Common.UI.DataView({ - el: $('#id-slide-menu-texture'), - restoreHeight: 174, - parentMenu: me.textureMenu, - showLast: false, - store: new Common.UI.DataViewStore(texturearray), - itemTemplate: _.template('
    ') + } + + if (!me._texturearray || me._texturearray.length<1) return; + if (!this._initSettings && !this.btnTexture) { + this.btnTexture = new Common.UI.ComboBox({ + el: $('#slide-combo-fill-texture'), + template: _.template([ + '' + ].join('')) }); - mnuTexturePicker.on('item:click', _.bind(this.onSelectTexture, this)); + this.textureMenu = new Common.UI.Menu({ + items: [ + { template: _.template('
    ') } + ] + }); + this.textureMenu.render($('#slide-combo-fill-texture')); + this.FillItems.push(this.btnTexture); + + var onShowBefore = function(menu) { + var mnuTexturePicker = new Common.UI.DataView({ + el: $('#id-slide-menu-texture'), + restoreHeight: 174, + parentMenu: menu, + showLast: false, + store: new Common.UI.DataViewStore(me._texturearray || []), + itemTemplate: _.template('
    ') + }); + mnuTexturePicker.on('item:click', _.bind(me.onSelectTexture, me)); + menu.off('show:before', onShowBefore); + }; + this.textureMenu.on('show:before', onShowBefore); } }, @@ -1036,6 +1045,7 @@ define([ }, UpdateThemeColors: function() { + if (this._initSettings) return; if (!this.btnBackColor) { this.btnBackColor = new Common.UI.ColorButton({ style: "width:45px;", diff --git a/apps/presentationeditor/main/app/view/Statusbar.js b/apps/presentationeditor/main/app/view/Statusbar.js index d0b11b27f..07b70a2b6 100644 --- a/apps/presentationeditor/main/app/view/Statusbar.js +++ b/apps/presentationeditor/main/app/view/Statusbar.js @@ -69,7 +69,7 @@ define([ Common.Utils.String.format(this.pageIndexText, model.get('current'), model.get('count')) ); } - function _clickLanguage(menu, item, state) { + function _clickLanguage(menu, item) { var $parent = menu.$el.parent(); $parent.find('#status-label-lang').text(item.caption); this.langMenu.prevTip = item.value.value; @@ -248,14 +248,14 @@ define([ this.btnPreview.render($('#slot-status-btn-preview')); var panelLang = $('.cnt-lang',this.el); - this.langMenu = new Common.UI.Menu({ + this.langMenu = new Common.UI.MenuSimple({ cls: 'lang-menu', style: 'margin-top:-5px;', restoreHeight: 285, itemTemplate: _.template([ - '', - '', - '<%= caption %>', + '', + '', + '<%= caption %>', '' ].join('')), menuAlign: 'bl-tl', @@ -328,18 +328,18 @@ define([ }, reloadLanguages: function(array) { - this.langMenu.removeAll(); + var arr = [], + saved = this.langMenu.saved; _.each(array, function(item) { - this.langMenu.addItem({ + arr.push({ caption : item['displayValue'], value : {value: item['value'], code: item['code']}, checkable : true, - checked : this.langMenu.saved == item['displayValue'], - spellcheck : item['spellcheck'], - toggleGroup : 'language' + checked : saved == item['displayValue'], + spellcheck : item['spellcheck'] }); - }, this); - + }); + this.langMenu.resetItems(arr); if (this.langMenu.items.length>0) { this.btnLanguage.setDisabled(false || this._state.no_paragraph); } @@ -352,9 +352,9 @@ define([ this.langMenu.prevTip = info.value; var lang = _.find(this.langMenu.items, function(item) { return item.caption == info.displayValue; }); - if (lang) - lang.setChecked(true); - else { + if (lang) { + this.langMenu.setChecked(this.langMenu.items.indexOf(lang), true); + } else { this.langMenu.saved = info.displayValue; this.langMenu.clearAll(); } diff --git a/apps/presentationeditor/main/app/view/TableSettings.js b/apps/presentationeditor/main/app/view/TableSettings.js index 6944d3052..b2fc81434 100644 --- a/apps/presentationeditor/main/app/view/TableSettings.js +++ b/apps/presentationeditor/main/app/view/TableSettings.js @@ -604,13 +604,14 @@ define([ }, createDelayedElements: function() { + this._initSettings = false; this.createDelayedControls(); this.UpdateThemeColors(); this.updateMetricUnit(); - this._initSettings = false; }, UpdateThemeColors: function() { + if (this._initSettings) return; if (!this.btnBackColor) { this.btnBorderColor = new Common.UI.ColorButton({ style: "width:45px;", @@ -684,7 +685,6 @@ define([ data[index].set('imageUrl', template.asc_getImage()); }); } else { - self.cmbTableTemplate.menuPicker.store.reset([]); var arr = []; _.each(Templates, function(template){ arr.push({ @@ -694,7 +694,7 @@ define([ tip : template.asc_getDisplayName() }); }); - self.cmbTableTemplate.menuPicker.store.add(arr); + self.cmbTableTemplate.menuPicker.store.reset(arr); } }, diff --git a/apps/presentationeditor/main/app/view/TextArtSettings.js b/apps/presentationeditor/main/app/view/TextArtSettings.js index b1b73fd35..7d1690829 100644 --- a/apps/presentationeditor/main/app/view/TextArtSettings.js +++ b/apps/presentationeditor/main/app/view/TextArtSettings.js @@ -75,6 +75,7 @@ define([ this.shapeprops = null; this._sendUndoPoint = true; this._sliderChanged = false; + this._texturearray = null; this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt); @@ -122,6 +123,10 @@ define([ this.FillPatternContainer = $('#textart-panel-pattern-fill'); this.FillGradientContainer = $('#textart-panel-gradient-fill'); this.TransparencyContainer = $('#textart-panel-transparent-fill'); + + PE.getCollection('Common.Collections.TextArt').bind({ + reset: this.fillTextArt.bind(this) + }); }, render: function () { @@ -1294,6 +1299,7 @@ define([ }, createDelayedElements: function() { + this._initSettings = false; this.createDelayedControls(); var global_hatch_menu_map = [ @@ -1327,50 +1333,59 @@ define([ this.PatternFillType = this.patternViewData[0].type; } this.UpdateThemeColors(); + this.onInitStandartTextures(); + this.fillTextArt(); this.fillTransform(this.api.asc_getPropertyEditorTextArts()); - this._initSettings = false; }, onInitStandartTextures: function(texture) { var me = this; if (texture && texture.length>0){ - if (!this.btnTexture) { - this.btnTexture = new Common.UI.ComboBox({ - el: $('#textart-combo-fill-texture'), - template: _.template([ - '' - ].join('')) - }); - this.textureMenu = new Common.UI.Menu({ - items: [ - { template: _.template('
    ') } - ] - }); - this.textureMenu.render($('#textart-combo-fill-texture')); - this.lockedControls.push(this.btnTexture); - } - var texturearray = []; + me._texturearray = []; _.each(texture, function(item){ - texturearray.push({ + me._texturearray.push({ imageUrl: item.get_image(), name : me.textureNames[item.get_id()], type : item.get_id(), +// allowSelected : false, selected: false }); }); - var mnuTexturePicker = new Common.UI.DataView({ - el: $('#id-textart-menu-texture'), - restoreHeight: 174, - parentMenu: me.textureMenu, - showLast: false, - store: new Common.UI.DataViewStore(texturearray), - itemTemplate: _.template('
    ') + } + + if (!me._texturearray || me._texturearray.length<1) return; + if (!this._initSettings && !this.btnTexture) { + this.btnTexture = new Common.UI.ComboBox({ + el: $('#textart-combo-fill-texture'), + template: _.template([ + '' + ].join('')) }); - mnuTexturePicker.on('item:click', _.bind(this.onSelectTexture, this)); + this.textureMenu = new Common.UI.Menu({ + items: [ + { template: _.template('
    ') } + ] + }); + this.textureMenu.render($('#textart-combo-fill-texture')); + this.lockedControls.push(this.btnTexture); + + var onShowBefore = function(menu) { + var mnuTexturePicker = new Common.UI.DataView({ + el: $('#id-textart-menu-texture'), + restoreHeight: 174, + parentMenu: menu, + showLast: false, + store: new Common.UI.DataViewStore(me._texturearray || []), + itemTemplate: _.template('
    ') + }); + mnuTexturePicker.on('item:click', _.bind(me.onSelectTexture, me)); + menu.off('show:before', onShowBefore); + }; + this.textureMenu.on('show:before', onShowBefore); } }, @@ -1395,6 +1410,7 @@ define([ }, fillTextArt: function() { + if (this._initSettings) return; var me = this; if (!this.cmbTextArt) { this.cmbTextArt = new Common.UI.ComboDataView({ @@ -1419,6 +1435,10 @@ define([ var models = this.application.getCollection('Common.Collections.TextArt').models, count = this.cmbTextArt.menuPicker.store.length; + if (models.length<1) { + PE.getController('Main').fillTextArt(this.api.asc_getTextArtPreviews()); + return; + } if (count>0 && count==models.length) { var data = this.cmbTextArt.menuPicker.store.models; _.each(models, function(template, index){ @@ -1475,6 +1495,7 @@ define([ }, UpdateThemeColors: function() { + if (this._initSettings) return; if (!this.btnBackColor) { this.btnBackColor = new Common.UI.ColorButton({ style: "width:45px;", diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 0956de53b..353002ff4 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -113,6 +113,7 @@ define([ me._state = { hasCollaborativeChanges: undefined }; + me.binding = {}; Common.NotificationCenter.on('app:ready', me.onAppReady.bind(this)); return this; @@ -527,12 +528,7 @@ define([ iconCls: 'btn-insertchart', caption: me.capInsertChart, lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.disableOnStart], - menu: new Common.UI.Menu({ - style: 'width: 435px;', - items: [ - {template: _.template('')} - ] - }) + menu: true }); me.slideOnlyControls.push(me.btnInsertChart); @@ -1087,6 +1083,91 @@ define([ }) ); + this.btnInsertChart.setMenu( new Common.UI.Menu({ + style: 'width: 435px;', + items: [ + {template: _.template('')} + ] + })); + + var onShowBefore = function(menu) { + var picker = new Common.UI.DataView({ + el: $('#id-toolbar-menu-insertchart'), + parentMenu: menu, + showLast: false, + restoreHeight: 421, + groups: new Common.UI.DataViewGroupStore([ + {id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts}, + {id: 'menu-chart-group-line', caption: me.textLine}, + {id: 'menu-chart-group-pie', caption: me.textPie}, + {id: 'menu-chart-group-hbar', caption: me.textBar}, + {id: 'menu-chart-group-area', caption: me.textArea, inline: true}, + {id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true}, + {id: 'menu-chart-group-stock', caption: me.textStock, inline: true} + // {id: 'menu-chart-group-surface', caption: me.textSurface} + ]), + store: new Common.UI.DataViewStore([ + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'}, + { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'}, + { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'} + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'} + + ]), + itemTemplate: _.template('
    ') + }); + picker.on('item:click', function (picker, item, record, e) { + if (record) + me.fireEvent('add:chart', [record.get('type')]); + }); + menu.off('show:before', onShowBefore); + }; + this.btnInsertChart.menu.on('show:before', onShowBefore); + + var onShowBeforeTextArt = function (menu) { + var collection = PE.getCollection('Common.Collections.TextArt'); + if (collection.length<1) + PE.getController('Main').fillTextArt(me.api.asc_getTextArtPreviews()); + var picker = new Common.UI.DataView({ + el: $('#view-insert-art', menu.$el), + store: collection, + parentMenu: menu, + showLast: false, + itemTemplate: _.template('
    ') + }); + picker.on('item:click', function (picker, item, record, e) { + if (record) + me.fireEvent('insert:textart', [record.get('data')]); + if (e.type !== 'click') menu.hide(); + }); + menu.off('show:before', onShowBeforeTextArt); + }; + this.btnInsertTextArt.menu.on('show:before', onShowBeforeTextArt); + // set dataviews var _conf = this.mnuMarkersPicker.conf; @@ -1130,55 +1211,6 @@ define([ }); _conf && this.mnuNumbersPicker.selectByIndex(_conf.index, true); - this.mnuInsertChartPicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-insertchart'), - parentMenu: this.btnInsertChart.menu, - showLast: false, - restoreHeight: 421, - groups: new Common.UI.DataViewGroupStore([ - { id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts }, - { id: 'menu-chart-group-line', caption: me.textLine }, - { id: 'menu-chart-group-pie', caption: me.textPie }, - { id: 'menu-chart-group-hbar', caption: me.textBar }, - { id: 'menu-chart-group-area', caption: me.textArea, inline: true }, - { id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true }, - { id: 'menu-chart-group-stock', caption: me.textStock, inline: true } - // { id: 'menu-chart-group-surface', caption: me.textSurface} - ]), - store: new Common.UI.DataViewStore([ - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, allowSelected: true, iconCls: 'column-normal', selected: true}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, allowSelected: true, iconCls: 'column-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, allowSelected: true, iconCls: 'column-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, allowSelected: true, iconCls: 'column-3d-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, allowSelected: true, iconCls: 'column-3d-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, allowSelected: true, iconCls: 'column-3d-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, allowSelected: true, iconCls: 'column-3d-normal-per'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, allowSelected: true, iconCls: 'line-normal'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, allowSelected: true, iconCls: 'line-stack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, allowSelected: true, iconCls: 'line-pstack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, allowSelected: true, iconCls: 'line-3d'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, allowSelected: true, iconCls: 'pie-normal'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, allowSelected: true, iconCls: 'pie-doughnut'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, allowSelected: true, iconCls: 'pie-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, allowSelected: true, iconCls: 'bar-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, allowSelected: true, iconCls: 'bar-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, allowSelected: true, iconCls: 'bar-pstack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, allowSelected: true, iconCls: 'bar-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, allowSelected: true, iconCls: 'bar-3d-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, allowSelected: true, iconCls: 'bar-3d-pstack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, allowSelected: true, iconCls: 'area-normal'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, allowSelected: true, iconCls: 'area-stack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, allowSelected: true, iconCls: 'area-pstack'}, - { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, allowSelected: true, iconCls: 'point-normal'}, - { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, allowSelected: true, iconCls: 'stock-normal'} - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, allowSelected: true, iconCls: 'surface-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, allowSelected: true, iconCls: 'surface-wireframe'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, allowSelected: true, iconCls: 'contour-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, allowSelected: true, iconCls: 'contour-wireframe'} - ]), - itemTemplate: _.template('
    ') - }); - this.mnuTablePicker = new Common.UI.DimensionPicker({ el: $('#id-toolbar-menu-tablepicker'), minRows: 8, @@ -1187,46 +1219,6 @@ define([ maxColumns: 10 }); - var createDataPicker = function (btn) { - me.mnuChangeSlidePicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-changeslide'), - parentMenu: me.btnChangeSlide.menu, - restoreHeight: 300, - restoreWidth: 302, - style: 'max-height: 300px;', - store: PE.getCollection('SlideLayouts'), - itemTemplate: _.template([ - '
    ', - '
    ', - '
    <%= title %>
    ', - '
    ' - ].join('')) - }); - if (me.btnChangeSlide.menu) { - me.btnChangeSlide.menu.on('show:after', function () { - me.onSlidePickerShowAfter(me.mnuChangeSlidePicker); - me.mnuChangeSlidePicker.scroller.update({alwaysVisibleY: true}); - - var record = me.mnuChangeSlidePicker.store.findLayoutByIndex(me.mnuChangeSlidePicker.options.layout_index); - if (record) { - me.mnuChangeSlidePicker.selectRecord(record, true); - me.mnuChangeSlidePicker.scrollToRecord(record); - } - }); - } - me.mnuChangeSlidePicker._needRecalcSlideLayout = true; - }; - // btnChangeSlide isn't in compact toolbar mode -> may be rendered after createDelayedElements - if (this.btnChangeSlide.rendered) - createDataPicker(this.btnChangeSlide); - else - this.btnChangeSlide.on('render:after', createDataPicker); - - this.listenTo(PE.getCollection('SlideLayouts'), 'reset', function () { - if (me.mnuChangeSlidePicker) - me.mnuChangeSlidePicker._needRecalcSlideLayout = true; - }); - /** coauthoring begin **/ this.showSynchTip = !Common.localStorage.getBool('pe-hide-synch'); @@ -1420,7 +1412,6 @@ define([ onSlidePickerShowAfter: function (picker) { if (!picker._needRecalcSlideLayout) return; - if (picker.cmpEl && picker.dataViewItems.length > 0) { var dataViewItems = picker.dataViewItems, el = $(dataViewItems[0].el), @@ -1449,79 +1440,52 @@ define([ } }, - updateTextartMenu: function (collection) { + updateAutoshapeMenu: function (menuShape, collection) { var me = this; - - var btn = me.btnInsertTextArt; - if ( btn.textartPicker ) { - if ( btn.textartPicker.store.size() == collection.size() ) { - btn.textartPicker.store.each(function (model, index) { - model.set('imageUrl', collection.at(index).get('imageUrl')); - }); - } else { - btn.textartPicker.store.reset( collection.models ); - } - } else { - btn.textartPicker = new Common.UI.DataView({ - el: $('#view-insert-art', btn.menu.$el), - store: collection, - parentMenu: btn.menu, - showLast: false, - itemTemplate: _.template('
    ') - }); - - btn.textartPicker.on('item:click', function(picker, item, record, e) { - if (record) - me.fireEvent('insert:textart', [record.get('data')]); - - if (e.type !== 'click') btn.menu.hide(); - }); - } - }, - - updateAutoshapeMenu: function (collection) { - var me = this; - for (var i = 0; i < collection.size(); i++) { - var group = collection.at(i); - - me.btnsInsertShape.forEach(function (btn, index) { - var menuitem = new Common.UI.MenuItem({ - caption: group.get('groupName'), - menu: new Common.UI.Menu({ - menuAlign: 'tl-tr', - items: [ - { template: _.template('
    ') } - ] - }) - }); - - btn.menu.addItem(menuitem); - - (new Common.UI.DataView({ - el: $('.shapegroup-' + i, menuitem.$el), - store: group.get('groupStore'), - parentMenu: menuitem.menu, - showLast: false, + var onShowAfter = function(menu) { + for (var i = 0; i < collection.length; i++) { + var shapePicker = new Common.UI.DataViewSimple({ + el: $('.shapegroup-' + i, menu.items[i].$el), + store: collection.at(i).get('groupStore'), + parentMenu: menu.items[i].menu, itemTemplate: _.template('
    \">
    ') - })).on('item:click', function (picker, item, record, e) { + }); + shapePicker.on('item:click', function(picker, item, record, e) { if (e.type !== 'click') Common.UI.Menu.Manager.hideAll(); if (record) me.fireEvent('insert:shape', [record.get('data').shapeType]); }); + } + menu.off('show:after', onShowAfter); + }; + menuShape.on('show:after', onShowAfter); + + for (var i = 0; i < collection.size(); i++) { + var group = collection.at(i); + + var menuitem = new Common.UI.MenuItem({ + caption: group.get('groupName'), + menu: new Common.UI.Menu({ + menuAlign: 'tl-tr', + items: [ + {template: _.template('
    ')} + ] + }) }); + menuShape.addItem(menuitem); } }, updateAddSlideMenu: function(collection) { if (collection.size()<1) return; - var me = this; - me.btnsAddSlide.forEach(function (btn, index) { - if ( !btn.mnuAddSlidePicker ) { - btn.mnuAddSlidePicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-addslide-' + index), - parentMenu: btn.menu, - showLast: false, + if (!me.binding.onShowBeforeAddSlide) { + me.binding.onShowBeforeAddSlide = function(menu) { + var change = (this.iconCls == 'btn-changeslide'); + var picker = new Common.UI.DataView({ + el: $('.menu-layouts', menu.$el), + parentMenu: menu, + showLast: change, restoreHeight: 300, restoreWidth: 302, style: 'max-height: 300px;', @@ -1533,21 +1497,38 @@ define([ '
    ' ].join('')) }); - btn.mnuAddSlidePicker.on('item:click', function (picker, item, record, e) { + picker.on('item:click', function (picker, item, record, e) { if (e.type !== 'click') Common.UI.Menu.Manager.hideAll(); if (record) - me.fireEvent('add:slide', [record.get('data').idx]); + me.fireEvent(change ? 'change:slide' : 'add:slide', [record.get('data').idx]); }); - if (btn.menu) { - btn.menu.on('show:after', function () { - me.onSlidePickerShowAfter(btn.mnuAddSlidePicker); - btn.mnuAddSlidePicker.scroller.update({alwaysVisibleY: true}); - btn.mnuAddSlidePicker.scroller.scrollTop(0); + if (menu) { + menu.on('show:after', function () { + me.onSlidePickerShowAfter(picker); + picker.scroller.update({alwaysVisibleY: true}); + if (change) { + var record = picker.store.findLayoutByIndex(picker.options.layout_index); + if (record) { + picker.selectRecord(record, true); + picker.scrollToRecord(record); + } + } else + picker.scroller.scrollTop(0); }); } - } - btn.mnuAddSlidePicker._needRecalcSlideLayout = true; - }); + menu.off('show:before', me.binding.onShowBeforeAddSlide); + if (change && this.mnuSlidePicker) + picker.options.layout_index = this.mnuSlidePicker.options.layout_index; + this.mnuSlidePicker = picker; + }; + me.btnsAddSlide.concat(me.btnChangeSlide).forEach(function (btn, index) { + btn.menu.on('show:before', me.binding.onShowBeforeAddSlide, btn); + }); + } else { + me.btnsAddSlide.concat(me.btnChangeSlide).forEach(function (btn, index) { + btn.mnuSlidePicker && (btn.mnuSlidePicker._needRecalcSlideLayout = true); + }); + } }, textBold: 'Bold', diff --git a/apps/presentationeditor/main/index.html b/apps/presentationeditor/main/index.html index 069ad3a3f..21189a452 100644 --- a/apps/presentationeditor/main/index.html +++ b/apps/presentationeditor/main/index.html @@ -21,157 +21,120 @@ z-index: 1001; } - .loader-page { + .loadmask > .brendpanel { width: 100%; - height: 170px; - bottom: 42%; - position: absolute; - text-align: center; - line-height: 10px; + height: 56px; + background: #aa5252; } - .loader-logo { - max-height: 160px; - margin-bottom: 10px; + .loadmask > .brendpanel > div { + display: flex; + align-items: center; } - .loader-page-romb { - width: 40px; + .loadmask > .brendpanel .loading-logo { + padding: 0 24px 0 12px; + max-width: 200px; + height: 20px; + } + + .loadmask > .brendpanel .loading-logo > img { display: inline-block; + max-width: 100px; + max-height: 20px; + opacity: 0; } - .loader-page-text { + .loadmask > .brendpanel .spacer { + margin-left: auto; + } + + .loadmask > .brendpanel .circle { + vertical-align: middle; + width: 20px; + height: 20px; + border-radius: 12px; + margin: 4px 10px; + background: rgba(255, 255, 255, 0.2); + } + + .loadmask > .brendpanel .rect { + vertical-align: middle; + width: 50px; + height: 12px; + border-radius: 3px; + margin: 0 10px; + background: rgba(255, 255, 255, 0.2); + } + + .loadmask > .placeholder { + display: flex; + flex-direction: column; + min-height: 100%; + margin: 0 100px; + } + + .loadmask > .placeholder .slide-h { + display: flex; + flex-direction: column; + justify-content: center; + flex-grow: 1; + max-width: 1350px; width: 100%; - bottom: 42%; + margin: 0 auto 56px; + } + .loadmask > .placeholder .slide-v { + display: flex; + position: relative; + flex-direction: column; + padding-bottom: 56.1333%; + } + + .loadmask > .placeholder .slide-container { position: absolute; - text-align: center; - color: #888; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 20px; + height: 100%; + width: 100%; + background: #fbfbfb; + border: 1px solid #dfdfdf; + display: grid; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; } - .loader-page-text-loading { - font-size: 14px; - } - - .loader-page-text-customer { - font-size: 16px; - margin-bottom: 5px; - } - - .romb { - width: 40px; - height: 40px; - -webkit-transform: rotate(135deg) skew(20deg, 20deg); - -moz-transform: rotate(135deg) skew(20deg, 20deg); - -ms-transform: rotate(135deg) skew(20deg, 20deg); - -o-transform: rotate(135deg) skew(20deg, 20deg); - position: absolute; - background: red; + .loadmask > .placeholder .slide-container > .line { + height: 30%; + margin: auto 120px; border-radius: 6px; - -webkit-animation: movedown 3s infinite ease; - -moz-animation: movedown 3s infinite ease; - -ms-animation: movedown 3s infinite ease; - -o-animation: movedown 3s infinite ease; - animation: movedown 3s infinite ease; + background: #f5f5f5; } - #blue { - z-index: 3; - background: #55bce6; - -webkit-animation-name: blue; - -moz-animation-name: blue; - -ms-animation-name: blue; - -o-animation-name: blue; - animation-name: blue; + .loadmask > .placeholder .slide-container > .line:nth-child(1) { + height: 40%; + margin: auto 80px; } - #red { - z-index:1; - background: #de7a59; - -webkit-animation-name: red; - -moz-animation-name: red; - -ms-animation-name: red; - -o-animation-name: red; - animation-name: red; + @keyframes flickerAnimation { + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - #green { - z-index: 2; - background: #a1cb5c; - -webkit-animation-name: green; - -moz-animation-name: green; - -ms-animation-name: green; - -o-animation-name: green; - animation-name: green; + @-o-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - @-webkit-keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0;} - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } + @-moz-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - @keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0; } - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @-webkit-keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @-webkit-keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } - } - - @keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } + @-webkit-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } @@ -219,49 +182,9 @@ var params = getUrlParams(), lang = (params["lang"] || 'en').split(/[\-\_]/)[0], - customer = params["customer"] ? ('
    ' + encodeUrlParam(params["customer"]) + '
    ') : '', - margin = (customer !== '') ? 50 : 20, - loading = 'Loading...', - logo = params["logo"] ? ((params["logo"] !== 'none') ? ('') : '') : null; + logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null; window.frameEditorId = params["frameEditorId"]; - - if ( lang == 'de') loading = 'Ladevorgang...'; - else if ( lang == 'es') loading = 'Cargando...'; - else if ( lang == 'fr') loading = 'Chargement en cours...'; - else if ( lang == 'it') loading = 'Caricamento in corso...'; - else if ( lang == 'pt') loading = 'Carregando...'; - else if ( lang == 'ru') loading = 'Загрузка...'; - else if ( lang == 'sl') loading = 'Nalaganje...'; - else if ( lang == 'tr') loading = 'Yükleniyor...'; - else if ( lang == 'bg') loading = 'Зареждане...'; - else if ( lang == 'cs') loading = 'Nahrávám...'; - else if ( lang == 'hu') loading = 'Betöltés...'; - else if ( lang == 'ja') loading = '読み込み中...'; - else if ( lang == 'ko') loading = '로드 중...'; - else if ( lang == 'lv') loading = 'Ieladēšana ...'; - else if ( lang == 'nl') loading = 'Laden...'; - else if ( lang == 'pl') loading = 'Ładowanie...'; - else if ( lang == 'sk') loading = 'Nahrávam...'; - else if ( lang == 'uk') loading = 'Завантаження...'; - else if ( lang == 'vi') loading = 'Đang tải...'; - else if ( lang == 'zh') loading = '加载中...'; - - if ( !stopLoading ) - document.write( - '
    ' + - '
    ' + - ((logo!==null) ? logo : - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ') + - '
    ' + - '
    ' + customer + - '
    ' + loading + '
    ' + - '
    ' + - '
    '); @@ -269,8 +192,21 @@ +
    + + @@ -294,7 +230,7 @@ - + diff --git a/apps/presentationeditor/main/index.html.deploy b/apps/presentationeditor/main/index.html.deploy index f863038ca..6311fc856 100644 --- a/apps/presentationeditor/main/index.html.deploy +++ b/apps/presentationeditor/main/index.html.deploy @@ -23,157 +23,120 @@ z-index: 1001; } - .loader-page { + .loadmask > .brendpanel { width: 100%; - height: 170px; - bottom: 42%; - position: absolute; - text-align: center; - line-height: 10px; + height: 56px; + background: #aa5252; } - .loader-logo { - max-height: 160px; - margin-bottom: 10px; + .loadmask > .brendpanel > div { + display: flex; + align-items: center; } - .loader-page-romb { - width: 40px; + .loadmask > .brendpanel .loading-logo { + padding: 0 24px 0 12px; + max-width: 200px; + height: 20px; + } + + .loadmask > .brendpanel .loading-logo > img { display: inline-block; + max-width: 100px; + max-height: 20px; + opacity: 0; } - .loader-page-text { + .loadmask > .brendpanel .spacer { + margin-left: auto; + } + + .loadmask > .brendpanel .circle { + vertical-align: middle; + width: 20px; + height: 20px; + border-radius: 12px; + margin: 4px 10px; + background: rgba(255, 255, 255, 0.2); + } + + .loadmask > .brendpanel .rect { + vertical-align: middle; + width: 50px; + height: 12px; + border-radius: 3px; + margin: 0 10px; + background: rgba(255, 255, 255, 0.2); + } + + .loadmask > .placeholder { + display: flex; + flex-direction: column; + min-height: 100%; + margin: 0 100px; + } + + .loadmask > .placeholder .slide-h { + display: flex; + flex-direction: column; + justify-content: center; + flex-grow: 1; + max-width: 1350px; width: 100%; - bottom: 42%; + margin: 0 auto 56px; + } + .loadmask > .placeholder .slide-v { + display: flex; + position: relative; + flex-direction: column; + padding-bottom: 56.1333%; + } + + .loadmask > .placeholder .slide-container { position: absolute; - text-align: center; - color: #888; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 20px; + height: 100%; + width: 100%; + background: #fbfbfb; + border: 1px solid #dfdfdf; + display: grid; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; } - .loader-page-text-loading { - font-size: 14px; - } - - .loader-page-text-customer { - font-size: 16px; - margin-bottom: 5px; - } - - .romb { - width: 40px; - height: 40px; - -webkit-transform: rotate(135deg) skew(20deg, 20deg); - -moz-transform: rotate(135deg) skew(20deg, 20deg); - -ms-transform: rotate(135deg) skew(20deg, 20deg); - -o-transform: rotate(135deg) skew(20deg, 20deg); - position: absolute; - background: red; + .loadmask > .placeholder .slide-container > .line { + height: 30%; + margin: auto 120px; border-radius: 6px; - -webkit-animation: movedown 3s infinite ease; - -moz-animation: movedown 3s infinite ease; - -ms-animation: movedown 3s infinite ease; - -o-animation: movedown 3s infinite ease; - animation: movedown 3s infinite ease; + background: #f5f5f5; } - #blue { - z-index: 3; - background: #55bce6; - -webkit-animation-name: blue; - -moz-animation-name: blue; - -ms-animation-name: blue; - -o-animation-name: blue; - animation-name: blue; + .loadmask > .placeholder .slide-container > .line:nth-child(1) { + height: 40%; + margin: auto 80px; } - #red { - z-index:1; - background: #de7a59; - -webkit-animation-name: red; - -moz-animation-name: red; - -ms-animation-name: red; - -o-animation-name: red; - animation-name: red; + @keyframes flickerAnimation { + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - #green { - z-index: 2; - background: #a1cb5c; - -webkit-animation-name: green; - -moz-animation-name: green; - -ms-animation-name: green; - -o-animation-name: green; - animation-name: green; + @-o-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - @-webkit-keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0;} - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } + @-moz-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - @keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0; } - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @-webkit-keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @-webkit-keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } - } - - @keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } + @-webkit-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } @@ -227,54 +190,28 @@ var params = getUrlParams(), lang = (params["lang"] || 'en').split(/[\-\_]/)[0], - customer = params["customer"] ? ('
    ' + encodeUrlParam(params["customer"]) + '
    ') : '', - margin = (customer !== '') ? 50 : 20, - loading = 'Loading...', - logo = params["logo"] ? ((params["logo"] !== 'none') ? ('') : '') : null; + logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null; window.frameEditorId = params["frameEditorId"]; - - if ( lang == 'de') loading = 'Ladevorgang...'; - else if ( lang == 'es') loading = 'Cargando...'; - else if ( lang == 'fr') loading = 'Chargement en cours...'; - else if ( lang == 'it') loading = 'Caricamento in corso...'; - else if ( lang == 'pt') loading = 'Carregando...'; - else if ( lang == 'ru') loading = 'Загрузка...'; - else if ( lang == 'sl') loading = 'Nalaganje...'; - else if ( lang == 'tr') loading = 'Yükleniyor...'; - else if ( lang == 'bg') loading = 'Зареждане...'; - else if ( lang == 'cs') loading = 'Nahrávám...'; - else if ( lang == 'hu') loading = 'Betöltés...'; - else if ( lang == 'ja') loading = '読み込み中...'; - else if ( lang == 'ko') loading = '로드 중...'; - else if ( lang == 'lv') loading = 'Ieladēšana ...'; - else if ( lang == 'nl') loading = 'Laden...'; - else if ( lang == 'pl') loading = 'Ładowanie...'; - else if ( lang == 'sk') loading = 'Nahrávam...'; - else if ( lang == 'uk') loading = 'Завантаження...'; - else if ( lang == 'vi') loading = 'Đang tải...'; - else if ( lang == 'zh') loading = '加载中...'; - - if (!stopLoading) - document.write( - '
    ' + - '
    ' + - ((logo!==null) ? logo : - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ') + - '
    ' + - '
    ' + customer + - '
    ' + loading + '
    ' + - '
    ' + - '
    '); +
    +
    + + diff --git a/apps/presentationeditor/main/index.reporter.html b/apps/presentationeditor/main/index.reporter.html index 7ac1b7fa5..e0b938417 100644 --- a/apps/presentationeditor/main/index.reporter.html +++ b/apps/presentationeditor/main/index.reporter.html @@ -20,160 +20,110 @@ overflow: hidden; border: none; background-color: #f4f4f4; - z-index: 100; + z-index: 10000; } - .loader-page { + .loadmask > .brendpanel { width: 100%; - height: 170px; - bottom: 42%; - position: absolute; - text-align: center; - line-height: 10px; + height: 56px; + background: #aa5252; } - .loader-logo { - max-height: 160px; - margin-bottom: 10px; + .loadmask > .brendpanel > div { + display: flex; + align-items: center; } - .loader-page-romb { - width: 40px; - display: inline-block; + .loadmask > .brendpanel .spacer { + margin-left: auto; } - .loader-page-text { + .loadmask > .brendpanel .circle { + vertical-align: middle; + width: 20px; + height: 20px; + border-radius: 12px; + margin: 4px 10px; + background: rgba(255, 255, 255, 0.2); + } + + .loadmask > .brendpanel .rect { + vertical-align: middle; + width: 50px; + height: 12px; + border-radius: 3px; + margin: 0 10px; + background: rgba(255, 255, 255, 0.2); + } + + .loadmask > .placeholder { + display: flex; + flex-direction: column; + min-height: 100%; + margin: 0 100px; + } + + .loadmask > .placeholder .slide-h { + display: flex; + flex-direction: column; + justify-content: center; + flex-grow: 1; + max-width: 1350px; width: 100%; - bottom: 42%; + margin: 0 auto 56px; + } + .loadmask > .placeholder .slide-v { + display: flex; + position: relative; + flex-direction: column; + padding-bottom: 56.1333%; + } + + .loadmask > .placeholder .slide-container { position: absolute; - text-align: center; - color: #888; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 20px; + height: 100%; + width: 100%; + background: #fbfbfb; + border: 1px solid #dfdfdf; + display: grid; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; } - .loader-page-text-loading { - font-size: 14px; - } - - .loader-page-text-customer { - font-size: 16px; - margin-bottom: 5px; - } - - .romb { - width: 40px; - height: 40px; - -webkit-transform: rotate(135deg) skew(20deg, 20deg); - -moz-transform: rotate(135deg) skew(20deg, 20deg); - -ms-transform: rotate(135deg) skew(20deg, 20deg); - -o-transform: rotate(135deg) skew(20deg, 20deg); - position: absolute; - background: red; + .loadmask > .placeholder .slide-container > .line { + height: 30%; + margin: auto 120px; border-radius: 6px; - -webkit-animation: movedown 3s infinite ease; - -moz-animation: movedown 3s infinite ease; - -ms-animation: movedown 3s infinite ease; - -o-animation: movedown 3s infinite ease; - animation: movedown 3s infinite ease; + background: #f5f5f5; } - #blue { - z-index: 3; - background: #55bce6; - -webkit-animation-name: blue; - -moz-animation-name: blue; - -ms-animation-name: blue; - -o-animation-name: blue; - animation-name: blue; + .loadmask > .placeholder .slide-container > .line:nth-child(1) { + height: 40%; + margin: auto 80px; } - #red { - z-index:1; - background: #de7a59; - -webkit-animation-name: red; - -moz-animation-name: red; - -ms-animation-name: red; - -o-animation-name: red; - animation-name: red; + @keyframes flickerAnimation { + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - #green { - z-index: 2; - background: #a1cb5c; - -webkit-animation-name: green; - -moz-animation-name: green; - -ms-animation-name: green; - -o-animation-name: green; - animation-name: green; + @-o-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - @-webkit-keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0;} - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } + @-moz-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - @keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0; } - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @-webkit-keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @-webkit-keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } - } - - @keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } + @-webkit-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } @@ -223,53 +173,22 @@ var params = getUrlParams(), lang = (params["lang"] || 'en').split(/[\-\_]/)[0], - customer = params["customer"] ? ('
    ' + encodeUrlParam(params["customer"]) + '
    ') : '', - margin = (customer !== '') ? 50 : 20, - loading = 'Loading...', - presenter = 'Presenter View', - logo = params["logo"] ? ((params["logo"] !== 'none') ? ('') : '') : null; + presenter = 'Presenter View'; window.frameEditorId = params["frameEditorId"]; - - if ( lang == 'bg') { presenter = 'Изглед на презентатора'; loading = 'Зареждане...';} - else if ( lang == 'cs') { presenter = 'Zobrazení přednášejícího'; loading = 'Nahrávám...';} - else if ( lang == 'de') { presenter = 'Referentenansicht'; loading = 'Ladevorgang...';} - else if ( lang == 'es') { presenter = 'Vista del presentador'; loading = 'Cargando...';} - else if ( lang == 'fr') { presenter = 'Mode présentateur'; loading = 'Chargement en cours...';} - else if ( lang == 'it') { presenter = 'Visualizzazione del presenter'; loading = 'Caricamento in corso...';} - else if ( lang == 'pl') { presenter = 'Widok Prezentera'; loading = 'Ładowanie...';} - else if ( lang == 'pt') { presenter = 'Vista de apresentador'; loading = 'Carregando...';} - else if ( lang == 'ru') { presenter = 'Режим докладчика'; loading = 'Загрузка...';} - else if ( lang == 'sk') { presenter = 'Režim prezentácie'; loading = 'Nahrávam...';} - else if ( lang == 'sl') { loading = 'Nalaganje...';} + if ( lang == 'bg') { presenter = 'Изглед на презентатора';} + else if ( lang == 'cs') { presenter = 'Zobrazení přednášejícího';} + else if ( lang == 'de') { presenter = 'Referentenansicht';} + else if ( lang == 'es') { presenter = 'Vista del presentador';} + else if ( lang == 'fr') { presenter = 'Mode présentateur';} + else if ( lang == 'it') { presenter = 'Visualizzazione del presenter';} + else if ( lang == 'pl') { presenter = 'Widok Prezentera';} + else if ( lang == 'pt') { presenter = 'Vista de apresentador';} + else if ( lang == 'ru') { presenter = 'Режим докладчика';} + else if ( lang == 'sk') { presenter = 'Režim prezentácie';} else if ( lang == 'zh') { presenter = '演示者视图';} - else if ( lang == 'tr') { loading = 'Yükleniyor...';} - else if ( lang == 'hu') loading = 'Betöltés...'; - else if ( lang == 'ja') loading = '読み込み中...'; - else if ( lang == 'ko') loading = '로드 중...'; - else if ( lang == 'lv') loading = 'Ieladēšana ...'; - else if ( lang == 'nl') loading = 'Laden...'; - else if ( lang == 'uk') loading = 'Завантаження...'; - else if ( lang == 'vi') loading = 'Đang tải...'; - else if ( lang == 'zh') loading = '加载中...'; window.document.title = presenter; - - if (!stopLoading) - document.write( - '
    ' + - '
    ' + - ((logo!==null) ? logo : - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ') + - '
    ' + - '
    ' + customer + - '
    ' + loading + '
    ' + - '
    ' + - '
    '); +
    + + + diff --git a/apps/presentationeditor/main/index.reporter.html.deploy b/apps/presentationeditor/main/index.reporter.html.deploy index e94f590cd..20ae41e03 100644 --- a/apps/presentationeditor/main/index.reporter.html.deploy +++ b/apps/presentationeditor/main/index.reporter.html.deploy @@ -20,160 +20,110 @@ overflow: hidden; border: none; background-color: #f4f4f4; - z-index: 100; + z-index: 10000; } - .loader-page { + .loadmask > .brendpanel { width: 100%; - height: 170px; - bottom: 42%; - position: absolute; - text-align: center; - line-height: 10px; + height: 56px; + background: #aa5252; } - .loader-logo { - max-height: 160px; - margin-bottom: 10px; + .loadmask > .brendpanel > div { + display: flex; + align-items: center; } - .loader-page-romb { - width: 40px; - display: inline-block; + .loadmask > .brendpanel .spacer { + margin-left: auto; } - .loader-page-text { + .loadmask > .brendpanel .circle { + vertical-align: middle; + width: 20px; + height: 20px; + border-radius: 12px; + margin: 4px 10px; + background: rgba(255, 255, 255, 0.2); + } + + .loadmask > .brendpanel .rect { + vertical-align: middle; + width: 50px; + height: 12px; + border-radius: 3px; + margin: 0 10px; + background: rgba(255, 255, 255, 0.2); + } + + .loadmask > .placeholder { + display: flex; + flex-direction: column; + min-height: 100%; + margin: 0 100px; + } + + .loadmask > .placeholder .slide-h { + display: flex; + flex-direction: column; + justify-content: center; + flex-grow: 1; + max-width: 1350px; width: 100%; - bottom: 42%; + margin: 0 auto 56px; + } + .loadmask > .placeholder .slide-v { + display: flex; + position: relative; + flex-direction: column; + padding-bottom: 56.1333%; + } + + .loadmask > .placeholder .slide-container { position: absolute; - text-align: center; - color: #888; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 20px; + height: 100%; + width: 100%; + background: #fbfbfb; + border: 1px solid #dfdfdf; + display: grid; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; } - .loader-page-text-loading { - font-size: 14px; - } - - .loader-page-text-customer { - font-size: 16px; - margin-bottom: 5px; - } - - .romb { - width: 40px; - height: 40px; - -webkit-transform: rotate(135deg) skew(20deg, 20deg); - -moz-transform: rotate(135deg) skew(20deg, 20deg); - -ms-transform: rotate(135deg) skew(20deg, 20deg); - -o-transform: rotate(135deg) skew(20deg, 20deg); - position: absolute; - background: red; + .loadmask > .placeholder .slide-container > .line { + height: 30%; + margin: auto 120px; border-radius: 6px; - -webkit-animation: movedown 3s infinite ease; - -moz-animation: movedown 3s infinite ease; - -ms-animation: movedown 3s infinite ease; - -o-animation: movedown 3s infinite ease; - animation: movedown 3s infinite ease; + background: #f5f5f5; } - #blue { - z-index: 3; - background: #55bce6; - -webkit-animation-name: blue; - -moz-animation-name: blue; - -ms-animation-name: blue; - -o-animation-name: blue; - animation-name: blue; + .loadmask > .placeholder .slide-container > .line:nth-child(1) { + height: 40%; + margin: auto 80px; } - #red { - z-index:1; - background: #de7a59; - -webkit-animation-name: red; - -moz-animation-name: red; - -ms-animation-name: red; - -o-animation-name: red; - animation-name: red; + @keyframes flickerAnimation { + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - #green { - z-index: 2; - background: #a1cb5c; - -webkit-animation-name: green; - -moz-animation-name: green; - -ms-animation-name: green; - -o-animation-name: green; - animation-name: green; + @-o-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - @-webkit-keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0;} - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } + @-moz-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - @keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0; } - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @-webkit-keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @-webkit-keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } - } - - @keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } + @-webkit-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } @@ -219,52 +169,22 @@ var params = getUrlParams(), lang = (params["lang"] || 'en').split(/[\-\_]/)[0], - customer = params["customer"] ? ('
    ' + encodeUrlParam(params["customer"]) + '
    ') : '', - margin = (customer !== '') ? 50 : 20, - loading = 'Loading...', - presenter = 'Presenter View', - logo = params["logo"] ? ((params["logo"] !== 'none') ? ('') : '') : null; + presenter = 'Presenter View'; window.frameEditorId = params["frameEditorId"]; - if ( lang == 'bg') { presenter = 'Изглед на презентатора'; loading = 'Зареждане...';} - else if ( lang == 'cs') { presenter = 'Zobrazení přednášejícího'; loading = 'Nahrávám...';} - else if ( lang == 'de') { presenter = 'Referentenansicht'; loading = 'Ladevorgang...';} - else if ( lang == 'es') { presenter = 'Vista del presentador'; loading = 'Cargando...';} - else if ( lang == 'fr') { presenter = 'Mode présentateur'; loading = 'Chargement en cours...';} - else if ( lang == 'it') { presenter = 'Visualizzazione del presenter'; loading = 'Caricamento in corso...';} - else if ( lang == 'pl') { presenter = 'Widok Prezentera'; loading = 'Ładowanie...';} - else if ( lang == 'pt') { presenter = 'Vista de apresentador'; loading = 'Carregando...';} - else if ( lang == 'ru') { presenter = 'Режим докладчика'; loading = 'Загрузка...';} - else if ( lang == 'sk') { presenter = 'Režim prezentácie'; loading = 'Nahrávam...';} - else if ( lang == 'sl') { loading = 'Nalaganje...';} + if ( lang == 'bg') { presenter = 'Изглед на презентатора';} + else if ( lang == 'cs') { presenter = 'Zobrazení přednášejícího';} + else if ( lang == 'de') { presenter = 'Referentenansicht';} + else if ( lang == 'es') { presenter = 'Vista del presentador';} + else if ( lang == 'fr') { presenter = 'Mode présentateur';} + else if ( lang == 'it') { presenter = 'Visualizzazione del presenter';} + else if ( lang == 'pl') { presenter = 'Widok Prezentera';} + else if ( lang == 'pt') { presenter = 'Vista de apresentador';} + else if ( lang == 'ru') { presenter = 'Режим докладчика';} + else if ( lang == 'sk') { presenter = 'Režim prezentácie';} else if ( lang == 'zh') { presenter = '演示者视图';} - else if ( lang == 'tr') { loading = 'Yükleniyor...';} - else if ( lang == 'hu') loading = 'Betöltés...'; - else if ( lang == 'ja') loading = '読み込み中...'; - else if ( lang == 'ko') loading = '로드 중...'; - else if ( lang == 'lv') loading = 'Ieladēšana ...'; - else if ( lang == 'nl') loading = 'Laden...'; - else if ( lang == 'uk') loading = 'Завантаження...'; - else if ( lang == 'vi') loading = 'Đang tải...'; - else if ( lang == 'zh') loading = '加载中...'; window.document.title = presenter; - - if (!stopLoading) - document.write( - '
    ' + - '
    ' + - ((logo!==null) ? logo : - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ') + - '
    ' + - '
    ' + customer + - '
    ' + loading + '
    ' + - '
    ' + - '
    '); +
    +
    + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/apps/presentationeditor/main/index_loader.html.deploy b/apps/presentationeditor/main/index_loader.html.deploy new file mode 100644 index 000000000..4f454d42f --- /dev/null +++ b/apps/presentationeditor/main/index_loader.html.deploy @@ -0,0 +1,320 @@ + + + + ONLYOFFICE Presentation Editor + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + \ No newline at end of file diff --git a/apps/presentationeditor/main/resources/less/app.less b/apps/presentationeditor/main/resources/less/app.less index 995117453..3757a6423 100644 --- a/apps/presentationeditor/main/resources/less/app.less +++ b/apps/presentationeditor/main/resources/less/app.less @@ -168,4 +168,62 @@ background-position: -20px @top-position; } } +} + +// Skeleton of document + +.doc-placeholder { + display: flex; + flex-direction: column; + min-height: 100%; + padding: 0 100px; + background: rgb(226, 226, 226); + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + + .slide-h { + display: flex; + flex-direction: column; + justify-content: center; + flex-grow: 1; + max-width: 1350px; + width: 100%; + margin: 0 auto 56px; + } + + .slide-v { + display: flex; + position: relative; + flex-direction: column; + padding-bottom: 56.1333%; + } + + .slide-container { + position: absolute; + height: 100%; + width: 100%; + background: #fbfbfb; + border: 1px solid #dfdfdf; + display: grid; + + > .line { + height: 30%; + margin: auto 120px; + border-radius: 6px; + background: #f5f5f5; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + + &:nth-child(1) { + height: 40%; + margin: auto 80px; + } + } + } } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index b777fa609..9c64ee293 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -219,6 +219,9 @@ define([ if (me.editorConfig.lang) me.api.asc_setLocale(me.editorConfig.lang); + if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo)) + $('#editor_sdk').append('
    '); + // if (this.appOptions.location == 'us' || this.appOptions.location == 'ca') // Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch); }, @@ -551,6 +554,8 @@ define([ $(document).on('contextmenu', _.bind(me.onContextMenu, me)); Common.Gateway.documentReady(); + + $('.doc-placeholder').remove(); }, onLicenseChanged: function(params) { diff --git a/apps/presentationeditor/mobile/index.html b/apps/presentationeditor/mobile/index.html index 03d7dff40..c6d585f5b 100644 --- a/apps/presentationeditor/mobile/index.html +++ b/apps/presentationeditor/mobile/index.html @@ -16,172 +16,158 @@ +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    diff --git a/apps/presentationeditor/mobile/index.html.deploy b/apps/presentationeditor/mobile/index.html.deploy index f2a19a0e7..d4b6a8060 100644 --- a/apps/presentationeditor/mobile/index.html.deploy +++ b/apps/presentationeditor/mobile/index.html.deploy @@ -15,172 +15,158 @@ +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + \ No newline at end of file diff --git a/apps/presentationeditor/mobile/index_loader.html.deploy b/apps/presentationeditor/mobile/index_loader.html.deploy new file mode 100644 index 000000000..f2a19a0e7 --- /dev/null +++ b/apps/presentationeditor/mobile/index_loader.html.deploy @@ -0,0 +1,293 @@ + + + + + + + + + + ONLYOFFICE Document Editor + + + + + + + + + + +
    + + + diff --git a/apps/presentationeditor/mobile/resources/css/app-ios.css b/apps/presentationeditor/mobile/resources/css/app-ios.css index 73d3feb0d..79ef64e8c 100644 --- a/apps/presentationeditor/mobile/resources/css/app-ios.css +++ b/apps/presentationeditor/mobile/resources/css/app-ios.css @@ -7024,3 +7024,50 @@ html.pixel-ratio-3 .numbers li { max-height: 100%; overflow: auto; } +.doc-placeholder { + background: #f5f5f5; + width: 100%; + height: 100%; + left: 0; + top: 0; + bottom: 0; + right: 0; + position: absolute; + padding-top: 12px; +} +.doc-placeholder .slide-h { + display: flex; + flex-direction: column; + justify-content: center; + flex-grow: 1; + width: 90%; + margin: 15px auto; +} +.doc-placeholder .slide-v { + display: flex; + position: relative; + flex-direction: column; + padding-bottom: 56.1333%; +} +.doc-placeholder .slide-container { + position: absolute; + height: 100%; + width: 100%; + background: #fbfbfb; + border: 1px solid #dfdfdf; + display: grid; + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; +} +.doc-placeholder .slide-container > .line { + height: 40%; + margin: auto 60px; + border-radius: 6px; + background: #f5f5f5; +} +.doc-placeholder .slide-container > .line:nth-child(1) { + height: 50%; + margin: auto 35px; +} diff --git a/apps/presentationeditor/mobile/resources/css/app-material.css b/apps/presentationeditor/mobile/resources/css/app-material.css index e3141f1a9..b714f1d28 100644 --- a/apps/presentationeditor/mobile/resources/css/app-material.css +++ b/apps/presentationeditor/mobile/resources/css/app-material.css @@ -6844,3 +6844,50 @@ html.pixel-ratio-3 .numbers li { max-height: 100%; overflow: auto; } +.doc-placeholder { + background: #f5f5f5; + width: 100%; + height: 100%; + left: 0; + top: 0; + bottom: 0; + right: 0; + position: absolute; + padding-top: 22px; +} +.doc-placeholder .slide-h { + display: flex; + flex-direction: column; + justify-content: center; + flex-grow: 1; + width: 90%; + margin: 15px auto; +} +.doc-placeholder .slide-v { + display: flex; + position: relative; + flex-direction: column; + padding-bottom: 56.1333%; +} +.doc-placeholder .slide-container { + position: absolute; + height: 100%; + width: 100%; + background: #fbfbfb; + border: 1px solid #dfdfdf; + display: grid; + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; +} +.doc-placeholder .slide-container > .line { + height: 40%; + margin: auto 60px; + border-radius: 6px; + background: #f5f5f5; +} +.doc-placeholder .slide-container > .line:nth-child(1) { + height: 50%; + margin: auto 35px; +} diff --git a/apps/presentationeditor/mobile/resources/less/app-ios.less b/apps/presentationeditor/mobile/resources/less/app-ios.less index 2778f67bc..7ded076a0 100644 --- a/apps/presentationeditor/mobile/resources/less/app-ios.less +++ b/apps/presentationeditor/mobile/resources/less/app-ios.less @@ -245,3 +245,59 @@ input, textarea { max-height: 100%; overflow: auto; } + +// Skeleton of document + +.doc-placeholder { + background: #f5f5f5; + width: 100%; + height: 100%; + left: 0; + top: 0; + bottom: 0; + right: 0; + position: absolute; + padding-top: 12px; + + .slide-h { + display: flex; + flex-direction: column; + justify-content: center; + flex-grow: 1; + width: 90%; + margin: 15px auto; + } + + .slide-v { + display: flex; + position: relative; + flex-direction: column; + padding-bottom: 56.1333%; + } + + .slide-container { + position: absolute; + height: 100%; + width: 100%; + background: #fbfbfb; + border: 1px solid #dfdfdf; + display: grid; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + + > .line { + height: 40%; + margin: auto 60px; + border-radius: 6px; + background: #f5f5f5; + + &:nth-child(1) { + height: 50%; + margin: auto 35px; + } + } + } +} diff --git a/apps/presentationeditor/mobile/resources/less/app-material.less b/apps/presentationeditor/mobile/resources/less/app-material.less index 211286e3b..78bee7fa7 100644 --- a/apps/presentationeditor/mobile/resources/less/app-material.less +++ b/apps/presentationeditor/mobile/resources/less/app-material.less @@ -233,3 +233,59 @@ input, textarea { max-height: 100%; overflow: auto; } + +// Skeleton of document + +.doc-placeholder { + background: #f5f5f5; + width: 100%; + height: 100%; + left: 0; + top: 0; + bottom: 0; + right: 0; + position: absolute; + padding-top: 22px; + + .slide-h { + display: flex; + flex-direction: column; + justify-content: center; + flex-grow: 1; + width: 90%; + margin: 15px auto; + } + + .slide-v { + display: flex; + position: relative; + flex-direction: column; + padding-bottom: 56.1333%; + } + + .slide-container { + position: absolute; + height: 100%; + width: 100%; + background: #fbfbfb; + border: 1px solid #dfdfdf; + display: grid; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + + > .line { + height: 40%; + margin: auto 60px; + border-radius: 6px; + background: #f5f5f5; + + &:nth-child(1) { + height: 50%; + margin: auto 35px; + } + } + } +} diff --git a/apps/spreadsheeteditor/embed/index.html b/apps/spreadsheeteditor/embed/index.html index 4cf8f08ef..406c61587 100644 --- a/apps/spreadsheeteditor/embed/index.html +++ b/apps/spreadsheeteditor/embed/index.html @@ -24,160 +24,95 @@ overflow: hidden; border: none; background-color: #f4f4f4; - z-index: 20002; + z-index: 10000; } - - .loader-page { + .loadmask > .brendpanel { width: 100%; - height: 170px; - bottom: 42%; position: absolute; + height: 32px; + background-color: #e2e2e2; + } + + .loadmask > .brendpanel > div { + display: flex; + align-items: center; + height: 100%; + } + + .loadmask > .brendpanel .loading-logo { + max-width: 200px; + height: 24px; + margin: 0 auto; text-align: center; - line-height: 10px; } - .loader-logo { - max-height: 160px; - margin-bottom: 10px; - } - - .loader-page-romb { - width: 40px; + .loadmask > .brendpanel .loading-logo > img { display: inline-block; + max-width: 100px; + max-height: 20px; + margin-top: 2px; + opacity: 0; } - .loader-page-text { + .loadmask > .brendpanel .circle { + vertical-align: middle; + width: 24px; + height: 24px; + border-radius: 12px; + margin: 4px 10px; + background: rgba(255, 255, 255, 0.2); + } + + .loadmask > .placeholder { + background: #fbfbfb; width: 100%; - bottom: 42%; + height: 100%; + border: 1px solid #dfdfdf; + white-space: nowrap; + padding-top: 32px; + } + + .loadmask > .placeholder > .columns { + width: 100%; + height: 100%; + display: inline-block; + background: linear-gradient(90deg, #d5d5d5 0px, rgba(0,0,0,0) 1px) 0 0, + linear-gradient(rgba(0,255,0,0) 19px, #d5d5d5 20px) 0 0, + linear-gradient( #f1f1f1 0px, #f1f1f1 20px) 0 0 repeat-x; + background-size: 80px 20px; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + } + + .loadmask > .placeholder > .columns:first-child { position: absolute; - text-align: center; - color: #888; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 20px; + background: linear-gradient(#f1f1f1 19px, #d5d5d5 20px) 0 0; + background-size: 20px 20px; + width: 35px; } - .loader-page-text-loading { - font-size: 14px; + @keyframes flickerAnimation { + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - .loader-page-text-customer { - font-size: 16px; - margin-bottom: 5px; + @-o-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - .romb { - width: 40px; - height: 40px; - -webkit-transform: rotate(135deg) skew(20deg, 20deg); - -moz-transform: rotate(135deg) skew(20deg, 20deg); - -ms-transform: rotate(135deg) skew(20deg, 20deg); - -o-transform: rotate(135deg) skew(20deg, 20deg); - position: absolute; - background: red; - border-radius: 6px; - -webkit-animation: movedown 3s infinite ease; - -moz-animation: movedown 3s infinite ease; - -ms-animation: movedown 3s infinite ease; - -o-animation: movedown 3s infinite ease; - animation: movedown 3s infinite ease; + @-moz-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - #blue { - z-index: 3; - background: #55bce6; - -webkit-animation-name: blue; - -moz-animation-name: blue; - -ms-animation-name: blue; - -o-animation-name: blue; - animation-name: blue; - } - - #red { - z-index:1; - background: #de7a59; - -webkit-animation-name: red; - -moz-animation-name: red; - -ms-animation-name: red; - -o-animation-name: red; - animation-name: red; - } - - #green { - z-index: 2; - background: #a1cb5c; - -webkit-animation-name: green; - -moz-animation-name: green; - -ms-animation-name: green; - -o-animation-name: green; - animation-name: green; - } - - @-webkit-keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0;} - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0; } - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @-webkit-keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @-webkit-keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } - } - - @keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } + @-webkit-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } @@ -187,6 +122,21 @@ +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    @@ -234,48 +184,17 @@ var params = getUrlParams(), lang = (params["lang"] || 'en').split(/[\-\_]/)[0], - customer = params["customer"] ? ('
    ' + encodeUrlParam(params["customer"]) + '
    ') : '', - margin = (customer !== '') ? 50 : 20, - loading = 'Loading...', - logo = params["logo"] ? ((params["logo"] !== 'none') ? ('') : '') : null; + logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null; window.frameEditorId = params["frameEditorId"]; - if ( lang == 'de') loading = 'Ladevorgang...'; - else if ( lang == 'es') loading = 'Cargando...'; - else if ( lang == 'fr') loading = 'Chargement en cours...'; - else if ( lang == 'it') loading = 'Caricamento in corso...'; - else if ( lang == 'pt') loading = 'Carregando...'; - else if ( lang == 'ru') loading = 'Загрузка...'; - else if ( lang == 'sl') loading = 'Nalaganje...'; - else if ( lang == 'tr') loading = 'Yükleniyor...'; - else if ( lang == 'bg') loading = 'Зареждане...'; - else if ( lang == 'cs') loading = 'Nahrávám...'; - else if ( lang == 'hu') loading = 'Betöltés...'; - else if ( lang == 'ja') loading = '読み込み中...'; - else if ( lang == 'ko') loading = '로드 중...'; - else if ( lang == 'lv') loading = 'Ieladēšana ...'; - else if ( lang == 'nl') loading = 'Laden...'; - else if ( lang == 'pl') loading = 'Ładowanie...'; - else if ( lang == 'sk') loading = 'Nahrávam...'; - else if ( lang == 'uk') loading = 'Завантаження...'; - else if ( lang == 'vi') loading = 'Đang tải...'; - else if ( lang == 'zh') loading = '加载中...'; - - document.write( - '
    ' + - '
    ' + - ((logo!==null) ? logo : - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ') + - '
    ' + - '
    ' + customer + - '
    ' + loading + '
    ' + - '
    ' + - '
    '); + var elem = document.querySelector('.loading-logo'); + if (elem && logo) { + elem.style.backgroundImage= 'none'; + var img = document.querySelector('.loading-logo img'); + img && img.setAttribute('src', logo); + img.style.opacity = 1; + }
    diff --git a/apps/spreadsheeteditor/embed/index.html.deploy b/apps/spreadsheeteditor/embed/index.html.deploy index 536173a9e..fd00e3355 100644 --- a/apps/spreadsheeteditor/embed/index.html.deploy +++ b/apps/spreadsheeteditor/embed/index.html.deploy @@ -21,160 +21,95 @@ overflow: hidden; border: none; background-color: #f4f4f4; - z-index: 20002; + z-index: 10000; } - - .loader-page { + .loadmask > .brendpanel { width: 100%; - height: 170px; - bottom: 42%; position: absolute; + height: 32px; + background-color: #e2e2e2; + } + + .loadmask > .brendpanel > div { + display: flex; + align-items: center; + height: 100%; + } + + .loadmask > .brendpanel .loading-logo { + max-width: 200px; + height: 24px; + margin: 0 auto; text-align: center; - line-height: 10px; } - .loader-logo { - max-height: 160px; - margin-bottom: 10px; - } - - .loader-page-romb { - width: 40px; + .loadmask > .brendpanel .loading-logo > img { display: inline-block; + max-width: 100px; + max-height: 20px; + margin-top: 2px; + opacity: 0; } - .loader-page-text { + .loadmask > .brendpanel .circle { + vertical-align: middle; + width: 24px; + height: 24px; + border-radius: 12px; + margin: 4px 10px; + background: rgba(255, 255, 255, 0.2); + } + + .loadmask > .placeholder { + background: #fbfbfb; width: 100%; - bottom: 42%; + height: 100%; + border: 1px solid #dfdfdf; + white-space: nowrap; + padding-top: 32px; + } + + .loadmask > .placeholder > .columns { + width: 100%; + height: 100%; + display: inline-block; + background: linear-gradient(90deg, #d5d5d5 0px, rgba(0,0,0,0) 1px) 0 0, + linear-gradient(rgba(0,255,0,0) 19px, #d5d5d5 20px) 0 0, + linear-gradient( #f1f1f1 0px, #f1f1f1 20px) 0 0 repeat-x; + background-size: 80px 20px; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + } + + .loadmask > .placeholder > .columns:first-child { position: absolute; - text-align: center; - color: #888; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 20px; + background: linear-gradient(#f1f1f1 19px, #d5d5d5 20px) 0 0; + background-size: 20px 20px; + width: 35px; } - .loader-page-text-loading { - font-size: 14px; + @keyframes flickerAnimation { + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - .loader-page-text-customer { - font-size: 16px; - margin-bottom: 5px; + @-o-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - .romb { - width: 40px; - height: 40px; - -webkit-transform: rotate(135deg) skew(20deg, 20deg); - -moz-transform: rotate(135deg) skew(20deg, 20deg); - -ms-transform: rotate(135deg) skew(20deg, 20deg); - -o-transform: rotate(135deg) skew(20deg, 20deg); - position: absolute; - background: red; - border-radius: 6px; - -webkit-animation: movedown 3s infinite ease; - -moz-animation: movedown 3s infinite ease; - -ms-animation: movedown 3s infinite ease; - -o-animation: movedown 3s infinite ease; - animation: movedown 3s infinite ease; + @-moz-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - #blue { - z-index: 3; - background: #55bce6; - -webkit-animation-name: blue; - -moz-animation-name: blue; - -ms-animation-name: blue; - -o-animation-name: blue; - animation-name: blue; - } - - #red { - z-index:1; - background: #de7a59; - -webkit-animation-name: red; - -moz-animation-name: red; - -ms-animation-name: red; - -o-animation-name: red; - animation-name: red; - } - - #green { - z-index: 2; - background: #a1cb5c; - -webkit-animation-name: green; - -moz-animation-name: green; - -ms-animation-name: green; - -o-animation-name: green; - animation-name: green; - } - - @-webkit-keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0;} - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0; } - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @-webkit-keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @-webkit-keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } - } - - @keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } + @-webkit-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } @@ -184,6 +119,21 @@ +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    diff --git a/apps/spreadsheeteditor/embed/index_loader.html b/apps/spreadsheeteditor/embed/index_loader.html new file mode 100644 index 000000000..746b49971 --- /dev/null +++ b/apps/spreadsheeteditor/embed/index_loader.html @@ -0,0 +1,378 @@ + + + + + Documents + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
      +
      + +
      +
        +
      • +
      • +
      +
      + +
      +
      + +
      +
      + +
      +
      +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/spreadsheeteditor/embed/index_loader.html.deploy b/apps/spreadsheeteditor/embed/index_loader.html.deploy new file mode 100644 index 000000000..0ff36eae5 --- /dev/null +++ b/apps/spreadsheeteditor/embed/index_loader.html.deploy @@ -0,0 +1,360 @@ + + + + + Documents + + + + + + + + + + + + + + + + + +
      +
      +
        +
        + +
        +
          +
        • +
        • +
        +
        + +
        +
        + +
        +
        + +
        +
        +
        +
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/spreadsheeteditor/main/app/controller/CellEditor.js b/apps/spreadsheeteditor/main/app/controller/CellEditor.js index 549455637..0530a7316 100644 --- a/apps/spreadsheeteditor/main/app/controller/CellEditor.js +++ b/apps/spreadsheeteditor/main/app/controller/CellEditor.js @@ -115,10 +115,7 @@ define([ }, onLaunch: function() { - this.editor = this.createView('CellEditor',{ - el: '#cell-editing-box' - }).render(); - + this.editor = this.getView('CellEditor'); this.bindViewEvents(this.editor, this.events); this.editor.$el.parent().find('.after').css({zIndex: '4'}); // for spreadsheets - bug 23127 diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index eaeca6982..e2d4d3570 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -99,32 +99,10 @@ define([ 'settings:apply': _.bind(this.applySettings, this) } }); - }, - onLaunch: function() { -// $(document.body).css('position', 'absolute'); - var me = this; - - this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false}; - this.translationTable = []; - this.isModalShowed = 0; - - if (!Common.Utils.isBrowserSupported()){ - Common.Utils.showBrowserRestriction(); - Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText); - return; - } else { -// this.getViewport().getEl().on('keypress', this.lockEscapeKey, this); -// viewport.applicationUI.setVisible(true); - } - - var value = Common.localStorage.getItem("sse-settings-fontrender"); - if (value===null) value = window.devicePixelRatio > 1 ? '1' : '3'; - Common.Utils.InternalSettings.set("sse-settings-fontrender", value); - - // Initialize api - var styleNames = ['Normal', 'Neutral', 'Bad', 'Good', 'Input', 'Output', 'Calculation', 'Check Cell', 'Explanatory Text', 'Note', 'Linked Cell', 'Warning Text', - 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Title', 'Total', 'Currency', 'Percent', 'Comma'], + var me = this, + styleNames = ['Normal', 'Neutral', 'Bad', 'Good', 'Input', 'Output', 'Calculation', 'Check Cell', 'Explanatory Text', 'Note', 'Linked Cell', 'Warning Text', + 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Title', 'Total', 'Currency', 'Percent', 'Comma'], translate = { 'Series': this.txtSeries, 'Diagram Title': this.txtDiagramTitle, @@ -144,23 +122,42 @@ define([ 'File': this.txtFile }; styleNames.forEach(function(item){ - translate[item] = me.translationTable[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item; + translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item; }); - translate['Currency [0]'] = me.translationTable['Currency [0]'] = me.txtStyle_Currency + ' [0]'; - translate['Comma [0]'] = me.translationTable['Comma [0]'] = me.txtStyle_Comma + ' [0]'; + translate['Currency [0]'] = me.txtStyle_Currency + ' [0]'; + translate['Comma [0]'] = me.txtStyle_Comma + ' [0]'; for (var i=1; i<7; i++) { - translate['Accent'+i] = me.translationTable['Accent'+i] = me.txtAccent + i; - translate['20% - Accent'+i] = me.translationTable['20% - Accent'+i] = '20% - ' + me.txtAccent + i; - translate['40% - Accent'+i] = me.translationTable['40% - Accent'+i] = '40% - ' + me.txtAccent + i; - translate['60% - Accent'+i] = me.translationTable['60% - Accent'+i] = '60% - ' + me.txtAccent + i; + translate['Accent'+i] = me.txtAccent + i; + translate['20% - Accent'+i] = '20% - ' + me.txtAccent + i; + translate['40% - Accent'+i] = '40% - ' + me.txtAccent + i; + translate['60% - Accent'+i] = '60% - ' + me.txtAccent + i; + } + me.translationTable = translate; + }, + + onLaunch: function() { +// $(document.body).css('position', 'absolute'); + var me = this; + + this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false}; + this.isModalShowed = 0; + + if (!Common.Utils.isBrowserSupported()){ + Common.Utils.showBrowserRestriction(); + Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText); + return; + } else { +// this.getViewport().getEl().on('keypress', this.lockEscapeKey, this); +// viewport.applicationUI.setVisible(true); } - this.api = new Asc.spreadsheet_api({ - 'id-view' : 'editor_sdk', - 'id-input' : 'ce-cell-content', - 'translate': translate - }); + var value = Common.localStorage.getItem("sse-settings-fontrender"); + if (value===null) value = window.devicePixelRatio > 1 ? '1' : '3'; + Common.Utils.InternalSettings.set("sse-settings-fontrender", value); + + // Initialize api + this.api = this.getApplication().getController('Viewport').getApi(); this.api.asc_setFontRenderingMode(parseInt(value)); this.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(this.onOpenDocument, this)); @@ -362,6 +359,9 @@ define([ if (this.appOptions.location == 'us' || this.appOptions.location == 'ca') Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch); + if (!this.editorConfig.customization || !(this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo)) + $('#editor_sdk').append('
        ' + '
        '.repeat(2) + '
        '); + this.isFrameClosed = (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge); Common.Controllers.Desktop.init(this.appOptions); }, @@ -769,7 +769,6 @@ define([ if (shapes) me.fillAutoShapes(shapes[0], shapes[1]); - me.fillTextArt(me.api.asc_getTextArtPreviews()); me.updateThemeColors(); toolbarController.activateControls(); } @@ -873,7 +872,7 @@ define([ } }); } - } else if (!this.appOptions.isDesktopApp && !this.appOptions.canBrandingExt && + } else if (!this.appOptions.isDesktopApp && !this.appOptions.canBrandingExt && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && this.editorConfig && this.editorConfig.customization && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo)) { Common.UI.warning({ title: this.textPaidFeature, @@ -1773,25 +1772,25 @@ define([ shapeStore.reset(); - var groupscount = groupNames.length; _.each(groupNames, function(groupName, index){ var store = new Backbone.Collection([], { model: SSE.Models.ShapeModel - }); + }), + arr = []; var cols = (shapes[index].length) > 18 ? 7 : 6, height = Math.ceil(shapes[index].length/cols) * 35 + 3, width = 30 * cols; _.each(shapes[index], function(shape, idx){ - store.add({ + arr.push({ data : {shapeType: shape.Type}, tip : me['txtShape_' + shape.Type] || (me.textShape + ' ' + (idx+1)), allowSelected : true, selected: false }); }); - + store.add(arr); shapegrouparray.push({ groupName : me.shapeGroupNames[index], groupStore : store, @@ -1803,16 +1802,19 @@ define([ shapeStore.add(shapegrouparray); setTimeout(function(){ - me.getApplication().getController('Toolbar').fillAutoShapes(); + me.getApplication().getController('Toolbar').onApiAutoShapes(); }, 50); }, fillTextArt: function(shapes){ - if (_.isEmpty(shapes)) return; - - var me = this, arr = [], + var arr = [], artStore = this.getCollection('Common.Collections.TextArt'); + if (!shapes && artStore.length>0) {// shapes == undefined when update textart collection (from asc_onSendThemeColors) + shapes = this.api.asc_getTextArtPreviews(); + } + if (_.isEmpty(shapes)) return; + _.each(shapes, function(shape, index){ arr.push({ imageUrl : shape, @@ -1822,15 +1824,6 @@ define([ }); }); artStore.reset(arr); - - setTimeout(function(){ - me.getApplication().getController('Toolbar').fillTextArt(); - }, 50); - - setTimeout(function(){ - me.getApplication().getController('RightMenu').fillTextArt(); - }, 50); - }, updateThemeColors: function() { @@ -1854,7 +1847,7 @@ define([ this.updateThemeColors(); var me = this; setTimeout(function(){ - me.fillTextArt(me.api.asc_getTextArtPreviews()); + me.fillTextArt(); }, 1); } }, diff --git a/apps/spreadsheeteditor/main/app/controller/RightMenu.js b/apps/spreadsheeteditor/main/app/controller/RightMenu.js index a1b0ddf0a..6018498c1 100644 --- a/apps/spreadsheeteditor/main/app/controller/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/RightMenu.js @@ -299,10 +299,6 @@ define([ this.rightmenu.imageSettings.updateMetricUnit(); }, - fillTextArt: function() { - this.rightmenu.textartSettings.fillTextArt(); - }, - createDelayedElements: function() { var me = this; if (this.api) { @@ -310,7 +306,7 @@ define([ this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this)); this.api.asc_registerCallback('asc_doubleClickOnObject', _.bind(this.onDoubleClickOnObject, this)); - this.rightmenu.shapeSettings.createDelayedElements(); + // this.rightmenu.shapeSettings.createDelayedElements(); this.onSelectionChanged(this.api.asc_getCellInfo()); } }, diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 01bc44b1a..355938900 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -72,6 +72,8 @@ define([ this.addListeners({ 'Toolbar': { 'change:compact': this.onClickChangeCompact.bind(me), + 'add:chart' : this.onSelectChart, + 'insert:textart': this.onInsertTextart, 'change:scalespn': this.onClickChangeScaleInMenu.bind(me), 'click:customscale': this.onScaleClick.bind(me) }, @@ -176,6 +178,7 @@ define([ pgorient: undefined, lock_doc: undefined }; + this.binding = {}; var checkInsertAutoshape = function(e, action) { var cmp = $(e.target), @@ -317,7 +320,6 @@ define([ toolbar.btnInsertTable.on('click', _.bind(this.onBtnInsertTableClick, this)); toolbar.btnInsertImage.menu.on('item:click', _.bind(this.onInsertImageMenu, this)); toolbar.btnInsertHyperlink.on('click', _.bind(this.onHyperlink, this)); - toolbar.mnuInsertChartPicker.on('item:click', _.bind(this.onSelectChart, this)); toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this)); toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this)); toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this)); @@ -385,7 +387,7 @@ define([ var config = SSE.getController('Main').appOptions; if ( !config.isEditDiagram && !config.isEditMailMerge ) { this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this)); - this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onMathTypes, this)); + this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this)); this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this)); } @@ -980,31 +982,30 @@ define([ } }, - onSelectChart: function(picker, item, record, e) { - if (!this.editMode || !record) return; + onSelectChart: function(group, type) { + if (!this.editMode) return; var me = this, info = me.api.asc_getCellInfo(), - type = info.asc_getFlags().asc_getSelectionType(), - group = record.get('group'), + seltype = info.asc_getFlags().asc_getSelectionType(), isSpark = (group == 'menu-chart-group-sparkcolumn' || group == 'menu-chart-group-sparkline' || group == 'menu-chart-group-sparkwin'); - if (type!=Asc.c_oAscSelectionType.RangeImage && me.api) { + if (seltype!=Asc.c_oAscSelectionType.RangeImage && me.api) { var win, props; - if (isSpark && (type==Asc.c_oAscSelectionType.RangeCells || type==Asc.c_oAscSelectionType.RangeCol || - type==Asc.c_oAscSelectionType.RangeRow || type==Asc.c_oAscSelectionType.RangeMax)) { + if (isSpark && (seltype==Asc.c_oAscSelectionType.RangeCells || seltype==Asc.c_oAscSelectionType.RangeCol || + seltype==Asc.c_oAscSelectionType.RangeRow || seltype==Asc.c_oAscSelectionType.RangeMax)) { var sparkLineInfo = info.asc_getSparklineInfo(); if (!!sparkLineInfo) { var props = new Asc.sparklineGroup(); - props.asc_setType(record.get('type')); + props.asc_setType(type); this.api.asc_setSparklineGroup(sparkLineInfo.asc_getId(), props); } else { // add sparkline } } else if (!isSpark) { - var ischartedit = ( type == Asc.c_oAscSelectionType.RangeChart || type == Asc.c_oAscSelectionType.RangeChartText); + var ischartedit = ( seltype == Asc.c_oAscSelectionType.RangeChart || seltype == Asc.c_oAscSelectionType.RangeChartText); props = me.api.asc_getChartObject(true); // don't lock chart object if (props) { - (ischartedit) ? props.changeType(record.get('type')) : props.putType(record.get('type')); + (ischartedit) ? props.changeType(type) : props.putType(type); var range = props.getRange(), isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, range, true, !props.getInColumns(), props.getType()); if (isvalid == Asc.c_oAscError.ID.No) { @@ -1022,11 +1023,22 @@ define([ } } } - if (e.type !== 'click') - me.toolbar.btnInsertChart.menu.hide(); Common.NotificationCenter.trigger('edit:complete', this.toolbar); }, + onInsertTextart: function (data) { + if (this.api) { + this.toolbar.fireEvent('inserttextart', this.toolbar); + this.api.asc_addTextArt(data); + + if (this.toolbar.btnInsertShape.pressed) + this.toolbar.btnInsertShape.toggle(false, true); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertTextArt); + Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art'); + } + }, + onBtnInsertTextClick: function(btn, e) { if (this.api) this._addAutoshape(btn.pressed, 'textRect'); @@ -1636,8 +1648,7 @@ define([ }); }); - store.reset(); - store.add(templates); + store.reset(templates); } this.fillTableTemplates(); @@ -2596,10 +2607,48 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.toolbar); }, + onApiAutoShapes: function() { + var me = this; + var onShowBefore = function(menu) { + me.fillAutoShapes(); + menu.off('show:before', onShowBefore); + }; + me.toolbar.btnInsertShape.menu.on('show:before', onShowBefore); + }, + fillAutoShapes: function() { var me = this, shapesStore = this.getApplication().getCollection('ShapeGroups'); + var onShowAfter = function(menu) { + for (var i = 0; i < shapesStore.length; i++) { + var shapePicker = new Common.UI.DataViewSimple({ + el: $('#id-toolbar-menu-shapegroup' + i, menu.items[i].$el), + store: shapesStore.at(i).get('groupStore'), + parentMenu: menu.items[i].menu, + itemTemplate: _.template('
        \">
        ') + }); + shapePicker.on('item:click', function(picker, item, record, e) { + if (me.api) { + if (record) { + me._addAutoshape(true, record.get('data').shapeType); + me._isAddingShape = true; + } + + if (me.toolbar.btnInsertText.pressed) { + me.toolbar.btnInsertText.toggle(false, true); + } + if (e.type !== 'click') + me.toolbar.btnInsertShape.menu.hide(); + Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertShape); + Common.component.Analytics.trackEvent('ToolBar', 'Add Shape'); + } + }); + } + menu.off('show:after', onShowAfter); + }; + me.toolbar.btnInsertShape.menu.on('show:after', onShowAfter); + for (var i = 0; i < shapesStore.length; i++) { var shapeGroup = shapesStore.at(i); @@ -2614,75 +2663,6 @@ define([ }); me.toolbar.btnInsertShape.menu.addItem(menuItem); - - var shapePicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-shapegroup' + i), - store: shapeGroup.get('groupStore'), - parentMenu: menuItem.menu, - showLast: false, - itemTemplate: _.template('
        \">
        ') - }); - - shapePicker.on('item:click', function(picker, item, record, e) { - if (me.api) { - if (record) { - me._addAutoshape(true, record.get('data').shapeType); - me._isAddingShape = true; - } - - if (me.toolbar.btnInsertText.pressed) { - me.toolbar.btnInsertText.toggle(false, true); - } - if (e.type !== 'click') - me.toolbar.btnInsertShape.menu.hide(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertShape); - Common.component.Analytics.trackEvent('ToolBar', 'Add Shape'); - } - }); - } - }, - - fillTextArt: function() { - if (!this.toolbar.btnInsertTextArt.rendered) return; - - var me = this; - - if ( this.toolbar.mnuTextArtPicker ) { - var models = this.getApplication().getCollection('Common.Collections.TextArt').models, - count = this.toolbar.mnuTextArtPicker.store.length; - if (count>0 && count==models.length) { - var data = this.toolbar.mnuTextArtPicker.store.models; - _.each(models, function(template, index){ - data[index].set('imageUrl', template.get('imageUrl')); - }); - } else { - this.toolbar.mnuTextArtPicker.store.reset(models); - } - } else { - this.toolbar.mnuTextArtPicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-insart'), - store: this.getApplication().getCollection('Common.Collections.TextArt'), - parentMenu: this.toolbar.btnInsertTextArt.menu, - showLast: false, - itemTemplate: _.template('
        ') - }); - - this.toolbar.mnuTextArtPicker.on('item:click', - function(picker, item, record, e) { - if (record) { - me.toolbar.fireEvent('inserttextart', me.toolbar); - me.api.asc_addTextArt(record.get('data')); - } - if ( me.toolbar.btnInsertShape.pressed ) - me.toolbar.btnInsertShape.toggle(false, true); - - if ( e.type !== 'click' ) - me.toolbar.btnInsertTextArt.menu.hide(); - - Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertTextArt); - Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art'); - } - ); } }, @@ -2691,12 +2671,44 @@ define([ var me = this, equationsStore = this.getApplication().getCollection('EquationGroups'); - me.equationPickers = []; me.toolbar.btnInsertEquation.menu.removeAll(); + var onShowAfter = function(menu) { + for (var i = 0; i < equationsStore.length; ++i) { + var equationPicker = new Common.UI.DataViewSimple({ + el: $('#id-toolbar-menu-equationgroup' + i), + parentMenu: menu.items[i].menu, + store: equationsStore.at(i).get('groupStore'), + scrollAlwaysVisible: true, + itemTemplate: _.template('
        ' + + '
        ' + + '
        ') + }); + equationPicker.on('item:click', function(picker, item, record, e) { + if (me.api) { + if (record) + me.api.asc_AddMath(record.get('data').equationType); + + if (me.toolbar.btnInsertText.pressed) { + me.toolbar.btnInsertText.toggle(false, true); + } + if (me.toolbar.btnInsertShape.pressed) { + me.toolbar.btnInsertShape.toggle(false, true); + } + + if (e.type !== 'click') + me.toolbar.btnInsertEquation.menu.hide(); + Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertEquation); + Common.component.Analytics.trackEvent('ToolBar', 'Add Equation'); + } + }); + } + menu.off('show:after', onShowAfter); + }; + me.toolbar.btnInsertEquation.menu.on('show:after', onShowAfter); for (var i = 0; i < equationsStore.length; ++i) { var equationGroup = equationsStore.at(i); - var menuItem = new Common.UI.MenuItem({ caption: equationGroup.get('groupName'), menu: new Common.UI.Menu({ @@ -2708,56 +2720,7 @@ define([ ] }) }); - me.toolbar.btnInsertEquation.menu.addItem(menuItem); - - var equationPicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-equationgroup' + i), - store: equationGroup.get('groupStore'), - parentMenu: menuItem.menu, - showLast: false, - itemTemplate: _.template('
        ' + - '
        ') - }); - if (equationGroup.get('groupHeight').length) { - - me.equationPickers.push(equationPicker); - me.toolbar.btnInsertEquation.menu.on('show:after', function () { - - if (me.equationPickers.length) { - var element = $(this.el).find('.over').find('.menu-shape'); - if (element.length) { - for (var i = 0; i < me.equationPickers.length; ++i) { - if (element[0].id == me.equationPickers[i].el.id) { - me.equationPickers[i].scroller.update({alwaysVisibleY: true}); - me.equationPickers.splice(i, 1); - return; - } - } - } - } - }); - } - - equationPicker.on('item:click', function(picker, item, record, e) { - if (me.api) { - if (record) - me.api.asc_AddMath(record.get('data').equationType); - - if (me.toolbar.btnInsertText.pressed) { - me.toolbar.btnInsertText.toggle(false, true); - } - if (me.toolbar.btnInsertShape.pressed) { - me.toolbar.btnInsertShape.toggle(false, true); - } - - if (e.type !== 'click') - me.toolbar.btnInsertEquation.menu.hide(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertEquation); - Common.component.Analytics.trackEvent('ToolBar', 'Add Equation'); - } - }); } }, @@ -2769,6 +2732,16 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertEquation); }, + onApiMathTypes: function(equation) { + this._equationTemp = equation; + var me = this; + var onShowBefore = function(menu) { + me.onMathTypes(me._equationTemp); + me.toolbar.btnInsertEquation.menu.off('show:before', onShowBefore); + }; + me.toolbar.btnInsertEquation.menu.on('show:before', onShowBefore); + }, + onMathTypes: function(equation) { var equationgrouparray = [], equationsStore = this.getCollection('EquationGroups'); @@ -2809,35 +2782,29 @@ define([ translationTable[Common.define.c_oAscMathType[name]] = this[translate]; } } - - var i,id = 0, count = 0, length = 0, width = 0, height = 0, store = null, list = null, eqStore = null, eq = null; + var i,id = 0, count = 0, length = 0, width = 0, height = 0, store = null, list = null, eqStore = null, eq = null, data; if (equation) { - - count = equation.get_Data().length; - + data = equation.get_Data(); + count = data.length; if (count) { for (var j = 0; j < count; ++j) { - id = equation.get_Data()[j].get_Id(); - width = equation.get_Data()[j].get_W(); - height = equation.get_Data()[j].get_H(); + var group = data[j]; + id = group.get_Id(); + width = group.get_W(); + height = group.get_H(); store = new Backbone.Collection([], { model: SSE.Models.EquationModel }); if (store) { - - var allItemsCount = 0, itemsCount = 0, ids = 0; - - length = equation.get_Data()[j].get_Data().length; - + var allItemsCount = 0, itemsCount = 0, ids = 0, arr = []; + length = group.get_Data().length; for (i = 0; i < length; ++i) { - eqStore = equation.get_Data()[j].get_Data()[i]; - + eqStore = group.get_Data()[i]; itemsCount = eqStore.get_Data().length; for (var p = 0; p < itemsCount; ++p) { - eq = eqStore.get_Data()[p]; ids = eq.get_Id(); @@ -2846,8 +2813,7 @@ define([ if (translationTable.hasOwnProperty(ids)) { translate = translationTable[ids]; } - - store.add({ + arr.push({ data : {equationType: ids}, tip : translate, allowSelected : true, @@ -2861,7 +2827,7 @@ define([ allItemsCount += itemsCount; } - + store.add(arr); width = c_oAscMathMainTypeStrings[id][1] * (width + 10); // 4px margin + 4px margin + 1px border + 1px border var normHeight = parseInt(370 / (height + 10)) * (height + 10); @@ -2873,9 +2839,7 @@ define([ }); } } - equationsStore.add(equationgrouparray); - this.fillEquations(); } } diff --git a/apps/spreadsheeteditor/main/app/controller/Viewport.js b/apps/spreadsheeteditor/main/app/controller/Viewport.js index 191521268..9002db7a2 100644 --- a/apps/spreadsheeteditor/main/app/controller/Viewport.js +++ b/apps/spreadsheeteditor/main/app/controller/Viewport.js @@ -130,6 +130,10 @@ define([ Common.NotificationCenter.on('api:disconnect', this.onApiCoAuthoringDisconnect.bind(this)); }, + getApi: function() { + return this.api; + }, + onAppShowed: function (config) { var me = this; me.appConfig = config; @@ -318,6 +322,14 @@ define([ onLaunch: function() { // Create and render main view this.viewport = this.createView('Viewport').render(); + this.getApplication().getController('CellEditor').createView('CellEditor',{ el: '#cell-editing-box' }).render(); + + this.api = new Asc.spreadsheet_api({ + 'id-view' : 'editor_sdk', + 'id-input' : 'ce-cell-content', + 'translate': this.getApplication().getController('Main').translationTable + }); + this.header = this.createView('Common.Views.Header', { headerCaption: 'Spreadsheet Editor', storeUsers: SSE.getCollection('Common.Collections.Users') diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettings.js b/apps/spreadsheeteditor/main/app/view/ChartSettings.js index 5159c589b..95f009c4d 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettings.js @@ -518,6 +518,7 @@ define([ }, UpdateThemeColors: function() { + if (this._initSettings) return; var defValue; if (!this.btnSparkColor) { defValue = this.defColor; @@ -863,10 +864,10 @@ define([ }, createDelayedElements: function() { + this._initSettings = false; this.createDelayedControls(); this.updateMetricUnit(); this.UpdateThemeColors(); - this._initSettings = false; }, ShowHideElem: function(isChart) { diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js index 1666b2ab4..a8ccbbf59 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenu.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js @@ -39,6 +39,7 @@ define([ SSE.Views.FileMenu = Common.UI.BaseView.extend(_.extend({ el: '#file-menu-panel', + rendered: false, options: {alias:'FileMenu'}, template: _.template(tpl), @@ -71,96 +72,99 @@ define([ }, render: function () { - this.$el = $(this.el); - this.$el.html(this.template()); + var $markup = $(this.template()); this.miSave = new Common.UI.MenuItem({ - el : $('#fm-btn-save',this.el), + el : $markup.elementById('#fm-btn-save'), action : 'save', caption : this.btnSaveCaption, canFocused: false, disabled: true }); + if ( !!this.options.miSave ) { + this.miSave.setDisabled(this.options.miSave.isDisabled()); + delete this.options.miSave; + } this.miEdit = new Common.UI.MenuItem({ - el : $('#fm-btn-edit',this.el), + el : $markup.elementById('#fm-btn-edit'), action : 'edit', caption : this.btnToEditCaption, canFocused: false }); this.miDownload = new Common.UI.MenuItem({ - el : $('#fm-btn-download',this.el), + el : $markup.elementById('#fm-btn-download'), action : 'saveas', caption : this.btnDownloadCaption, canFocused: false }); this.miSaveCopyAs = new Common.UI.MenuItem({ - el : $('#fm-btn-save-copy',this.el), + el : $markup.elementById('#fm-btn-save-copy'), action : 'save-copy', caption : this.btnSaveCopyAsCaption, canFocused: false }); this.miSaveAs = new Common.UI.MenuItem({ - el : $('#fm-btn-save-desktop',this.el), + el : $markup.elementById('#fm-btn-save-desktop'), action : 'save-desktop', caption : this.btnSaveAsCaption, canFocused: false }); this.miPrint = new Common.UI.MenuItem({ - el : $('#fm-btn-print',this.el), + el : $markup.elementById('#fm-btn-print'), action : 'print', caption : this.btnPrintCaption, canFocused: false }); this.miRename = new Common.UI.MenuItem({ - el : $('#fm-btn-rename',this.el), + el : $markup.elementById('#fm-btn-rename'), action : 'rename', caption : this.btnRenameCaption, canFocused: false }); this.miProtect = new Common.UI.MenuItem({ - el : $('#fm-btn-protect',this.el), + el : $markup.elementById('#fm-btn-protect'), action : 'protect', caption : this.btnProtectCaption, canFocused: false }); this.miRecent = new Common.UI.MenuItem({ - el : $('#fm-btn-recent',this.el), + el : $markup.elementById('#fm-btn-recent'), action : 'recent', caption : this.btnRecentFilesCaption, canFocused: false }); this.miNew = new Common.UI.MenuItem({ - el : $('#fm-btn-create',this.el), + el : $markup.elementById('#fm-btn-create'), action : 'new', caption : this.btnCreateNewCaption, canFocused: false }); this.miAccess = new Common.UI.MenuItem({ - el : $('#fm-btn-rights',this.el), + el : $markup.elementById('#fm-btn-rights'), action : 'rights', caption : this.btnRightsCaption, canFocused: false }); this.miSettings = new Common.UI.MenuItem({ - el : $('#fm-btn-settings',this.el), + el : $markup.elementById('#fm-btn-settings'), action : 'opts', caption : this.btnSettingsCaption, canFocused: false }); this.miHelp = new Common.UI.MenuItem({ - el : $('#fm-btn-help',this.el), + el : $markup.elementById('#fm-btn-help'), action : 'help', caption : this.btnHelpCaption, canFocused: false @@ -169,7 +173,7 @@ define([ this.items = []; this.items.push( new Common.UI.MenuItem({ - el : $('#fm-btn-return',this.el), + el : $markup.elementById('#fm-btn-return'), action : 'back', caption : this.btnCloseMenuCaption, canFocused: false @@ -185,7 +189,7 @@ define([ this.miRecent, this.miNew, new Common.UI.MenuItem({ - el : $('#fm-btn-info',this.el), + el : $markup.elementById('#fm-btn-info'), action : 'info', caption : this.btnInfoCaption, canFocused: false @@ -194,21 +198,25 @@ define([ this.miSettings, this.miHelp, new Common.UI.MenuItem({ - el : $('#fm-btn-back',this.el), + el : $markup.elementById('#fm-btn-back'), action : 'exit', caption : this.btnBackCaption, canFocused: false }) ); - var me = this; - me.panels = { - 'opts' : (new SSE.Views.FileMenuPanels.Settings({menu:me})).render(), - 'info' : (new SSE.Views.FileMenuPanels.DocumentInfo({menu:me})).render(), - 'rights' : (new SSE.Views.FileMenuPanels.DocumentRights({menu:me})).render() - }; + this.rendered = true; + this.$el.html($markup); + this.$el.find('.content-box').hide(); + this.applyMode(); - me.$el.find('.content-box').hide(); + if ( !!this.api ) { + this.panels['info'].setApi(this.api); + if ( this.panels['protect'] ) + this.panels['protect'].setApi(this.api); + if (this.panels['opts']) + this.panels['opts'].setApi(this.api); + } return this; }, @@ -216,6 +224,9 @@ define([ show: function(panel) { if (this.isVisible() && panel===undefined || !this.mode) return; + if ( !this.rendered ) + this.render(); + var defPanel = (this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info'; if (!panel) panel = this.active || defPanel; @@ -234,6 +245,16 @@ define([ }, applyMode: function() { + if (!this.panels) { + this.panels = { + 'opts' : (new SSE.Views.FileMenuPanels.Settings({menu:this})).render(this.$el.find('#panel-settings')), + 'info' : (new SSE.Views.FileMenuPanels.DocumentInfo({menu:this})).render(this.$el.find('#panel-info')), + 'rights' : (new SSE.Views.FileMenuPanels.DocumentRights({menu:this})).render(this.$el.find('#panel-rights')) + }; + } + + if (!this.mode) return; + this.miDownload[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide'](); this.miSaveCopyAs[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) ?'show':'hide'](); this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide'](); @@ -252,9 +273,6 @@ define([ this.miAccess[(!this.mode.isOffline && this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 || this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide'](); - // this.miSettings[(this.mode.isEdit || this.mode.canViewComments)?'show':'hide'](); - // this.miSettings.$el.prev()[(this.mode.isEdit || this.mode.canViewComments)?'show':'hide'](); - this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() : this.$el.find('#fm-btn-back').hide().prev().hide(); @@ -270,30 +288,28 @@ define([ if ( this.mode.canCreateNew ) { if (this.mode.templates && this.mode.templates.length) { $('a',this.miNew.$el).text(this.btnCreateNewCaption + '...'); - this.panels['new'] = ((new SSE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render()); + !this.panels['new'] && (this.panels['new'] = (new SSE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render()); } } - if ( this.mode.canOpenRecent ) { - if (this.mode.recent){ - this.panels['recent'] = (new SSE.Views.FileMenuPanels.RecentFiles({menu:this, recent: this.mode.recent})).render(); - } + if ( this.mode.canOpenRecent && this.mode.recent) { + !this.panels['recent'] && (this.panels['recent'] = (new SSE.Views.FileMenuPanels.RecentFiles({menu:this, recent: this.mode.recent})).render()); } if (this.mode.canProtect) { - this.panels['protect'] = (new SSE.Views.FileMenuPanels.ProtectDoc({menu:this})).render(); + !this.panels['protect'] && (this.panels['protect'] = (new SSE.Views.FileMenuPanels.ProtectDoc({menu:this})).render()); this.panels['protect'].setMode(this.mode); } if (this.mode.canDownload) { - this.panels['saveas'] = ((new SSE.Views.FileMenuPanels.ViewSaveAs({menu: this})).render()); + !this.panels['saveas'] && (this.panels['saveas'] = (new SSE.Views.FileMenuPanels.ViewSaveAs({menu: this})).render()); } if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) { - this.panels['save-copy'] = ((new SSE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render()); + !this.panels['save-copy'] && (this.panels['save-copy'] = (new SSE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render()); } - if (this.mode.canHelp) { + if (this.mode.canHelp && !this.panels['help']) { this.panels['help'] = ((new SSE.Views.FileMenuPanels.Help({menu: this})).render()); this.panels['help'].setLangConfig(this.mode.lang); } @@ -311,14 +327,19 @@ define([ this.mode = mode; } - if (!delay) this.applyMode(); + if (!delay) { + if ( this.rendered ) + this.applyMode(); + } }, setApi: function(api) { this.api = api; - this.panels['info'].setApi(api); - if (this.panels['opts']) this.panels['opts'].setApi(api); - if (this.panels['protect']) this.panels['protect'].setApi(api); + if ( this.rendered ) { + this.panels['info'].setApi(api); + if (this.panels['opts']) this.panels['opts'].setApi(api); + if (this.panels['protect']) this.panels['protect'].setApi(api); + } this.api.asc_registerCallback('asc_onDocumentName', _.bind(this.onDocumentName, this)); }, @@ -354,7 +375,8 @@ define([ onDocumentName: function(name) { this.document.title = name; - this.panels['info'].updateInfo(this.document); + if (this.rendered) + this.panels['info'].updateInfo(this.document); }, isVisible: function () { @@ -362,8 +384,12 @@ define([ }, getButton: function(type) { - if (type == 'save') - return this.miSave; + if (type == 'save') { + if (this.rendered) + return this.miSave; + else + return this.options.miSave ? this.options.miSave : (this.options.miSave = new Common.UI.MenuItem({})); + } }, btnSaveCaption : 'Save', diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 382d7f870..92ad5e049 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -78,12 +78,12 @@ define([ }, render: function() { - $(this.el).html(this.template({rows:this.formats})); + this.$el.html(this.template({rows:this.formats})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -139,12 +139,12 @@ define([ }, render: function() { - $(this.el).html(this.template({rows:this.formats})); + this.$el.html(this.template({rows:this.formats})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -181,19 +181,19 @@ define([ this.menu = options.menu; }, - render: function() { - $(this.el).html(this.template()); + render: function(node) { + var $markup = $(this.template({scope: this})); this.generalSettings = new SSE.Views.FileMenuPanels.MainSettingsGeneral({menu: this.menu}); this.generalSettings.options = {alias:'MainSettingsGeneral'}; - this.generalSettings.render(); + this.generalSettings.render($markup.findById('#panel-settings-general')); this.printSettings = SSE.getController('Print').getView('MainSettingsPrint'); this.printSettings.menu = this.menu; - this.printSettings.render($('#panel-settings-print')); + this.printSettings.render($markup.findById('#panel-settings-print')); this.viewSettingsPicker = new Common.UI.DataView({ - el: $('#id-settings-menu'), + el: $markup.findById('#id-settings-menu'), store: new Common.UI.DataViewStore([ {name: this.txtGeneral, panel: this.generalSettings, iconCls:'mnu-settings-general', selected: true}, {name: this.txtPageSettings, panel: this.printSettings, iconCls:'mnu-print'} @@ -212,6 +212,7 @@ define([ panel.show(); }, this)); + this.$el = $(node).html($markup); return this; }, @@ -303,12 +304,10 @@ define([ }, render: function(parentEl) { - if (parentEl) - this.setElement(parentEl, false); - $(this.el).html(this.template({scope: this})); + var $markup = $(this.template({scope: this})); this.cmbSheet = new Common.UI.ComboBox({ - el : $('#advsettings-print-combo-sheets'), + el : $markup.findById('#advsettings-print-combo-sheets'), style : 'width: 242px;', menuStyle : 'min-width: 242px;max-height: 280px;', editable : false, @@ -317,7 +316,7 @@ define([ }); this.cmbPaperSize = new Common.UI.ComboBox({ - el : $('#advsettings-print-combo-pages'), + el : $markup.findById('#advsettings-print-combo-pages'), style : 'width: 242px;', menuStyle : 'max-height: 280px; min-width: 242px;', editable : false, @@ -340,7 +339,7 @@ define([ }); this.cmbPaperOrientation = new Common.UI.ComboBox({ - el : $('#advsettings-print-combo-orient'), + el : $markup.findById('#advsettings-print-combo-orient'), style : 'width: 132px;', menuStyle : 'min-width: 132px;', editable : false, @@ -352,7 +351,7 @@ define([ }); this.cmbLayout = new Common.UI.ComboBox({ - el : $('#advsettings-print-combo-layout'), + el : $markup.findById('#advsettings-print-combo-layout'), style : 'width: 242px;', menuStyle : 'min-width: 242px;', editable : false, @@ -367,17 +366,17 @@ define([ }); this.chPrintGrid = new Common.UI.CheckBox({ - el: $('#advsettings-print-chb-grid'), + el: $markup.findById('#advsettings-print-chb-grid'), labelText: this.textPrintGrid }); this.chPrintRows = new Common.UI.CheckBox({ - el: $('#advsettings-print-chb-rows'), + el: $markup.findById('#advsettings-print-chb-rows'), labelText: this.textPrintHeadings }); this.spnMarginTop = new Common.UI.MetricSpinner({ - el: $('#advsettings-spin-margin-top'), + el: $markup.findById('#advsettings-spin-margin-top'), step: .1, width: 110, defaultUnit : "cm", @@ -388,7 +387,7 @@ define([ this.spinners.push(this.spnMarginTop); this.spnMarginBottom = new Common.UI.MetricSpinner({ - el: $('#advsettings-spin-margin-bottom'), + el: $markup.findById('#advsettings-spin-margin-bottom'), step: .1, width: 110, defaultUnit : "cm", @@ -399,7 +398,7 @@ define([ this.spinners.push(this.spnMarginBottom); this.spnMarginLeft = new Common.UI.MetricSpinner({ - el: $('#advsettings-spin-margin-left'), + el: $markup.findById('#advsettings-spin-margin-left'), step: .1, width: 110, defaultUnit : "cm", @@ -410,7 +409,7 @@ define([ this.spinners.push(this.spnMarginLeft); this.spnMarginRight = new Common.UI.MetricSpinner({ - el: $('#advsettings-spin-margin-right'), + el: $markup.findById('#advsettings-spin-margin-right'), step: .1, width: 110, defaultUnit : "cm", @@ -421,18 +420,21 @@ define([ this.spinners.push(this.spnMarginRight); this.btnOk = new Common.UI.Button({ - el: '#advsettings-print-button-save' + el: $markup.findById('#advsettings-print-button-save') }); + // if (parentEl) + // this.setElement(parentEl, false); + this.$el = $(parentEl).html($markup); + if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } this.fireEvent('render:after', this); - return this; }, @@ -565,29 +567,30 @@ define([ this.menu = options.menu; }, - render: function() { - $(this.el).html(this.template({scope: this})); + render: function(node) { + var me = this; + var $markup = $(this.template({scope: this})); /** coauthoring begin **/ this.chLiveComment = new Common.UI.CheckBox({ - el: $('#fms-chb-live-comment'), + el: $markup.findById('#fms-chb-live-comment'), labelText: this.strLiveComment - }).on('change', _.bind(function(field, newValue, oldValue, eOpts){ - this.chResolvedComment.setDisabled(field.getValue()!=='checked'); - }, this)); + }).on('change', function(field, newValue, oldValue, eOpts){ + me.chResolvedComment.setDisabled(field.getValue()!=='checked'); + }); this.chResolvedComment = new Common.UI.CheckBox({ - el: $('#fms-chb-resolved-comment'), + el: $markup.findById('#fms-chb-resolved-comment'), labelText: this.strResolvedComment }); this.chR1C1Style = new Common.UI.CheckBox({ - el: $('#fms-chb-r1c1-style'), + el: $markup.findById('#fms-chb-r1c1-style'), labelText: this.strR1C1 }); this.cmbCoAuthMode = new Common.UI.ComboBox({ - el : $('#fms-cmb-coauth-mode'), + el : $markup.findById('#fms-cmb-coauth-mode'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -595,17 +598,17 @@ define([ { value: 1, displayValue: this.strFast, descValue: this.strCoAuthModeDescFast}, { value: 0, displayValue: this.strStrict, descValue: this.strCoAuthModeDescStrict } ] - }).on('selected', _.bind(function(combo, record) { - if (record.value == 1 && (this.chAutosave.getValue()!=='checked')) - this.chAutosave.setValue(1); - this.lblCoAuthMode.text(record.descValue); - }, this)); + }).on('selected', function(combo, record) { + if (record.value == 1 && (me.chAutosave.getValue()!=='checked')) + me.chAutosave.setValue(1); + me.lblCoAuthMode.text(record.descValue); + }); - this.lblCoAuthMode = $('#fms-lbl-coauth-mode'); + this.lblCoAuthMode = $markup.findById('#fms-lbl-coauth-mode'); /** coauthoring end **/ this.cmbZoom = new Common.UI.ComboBox({ - el : $('#fms-cmb-zoom'), + el : $markup.findById('#fms-cmb-zoom'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -626,7 +629,7 @@ define([ }); this.cmbFontRender = new Common.UI.ComboBox({ - el : $('#fms-cmb-font-render'), + el : $markup.findById('#fms-cmb-font-render'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -638,23 +641,23 @@ define([ }); this.chAutosave = new Common.UI.CheckBox({ - el: $('#fms-chb-autosave'), + el: $markup.findById('#fms-chb-autosave'), labelText: this.strAutosave - }).on('change', _.bind(function(field, newValue, oldValue, eOpts){ - if (field.getValue()!=='checked' && this.cmbCoAuthMode.getValue()) { - this.cmbCoAuthMode.setValue(0); - this.lblCoAuthMode.text(this.strCoAuthModeDescStrict); + }).on('change', function(field, newValue, oldValue, eOpts){ + if (field.getValue()!=='checked' && me.cmbCoAuthMode.getValue()) { + me.cmbCoAuthMode.setValue(0); + me.lblCoAuthMode.text(me.strCoAuthModeDescStrict); } - }, this)); - this.lblAutosave = $('#fms-lbl-autosave'); + }); + this.lblAutosave = $markup.findById('#fms-lbl-autosave'); this.chForcesave = new Common.UI.CheckBox({ - el: $('#fms-chb-forcesave'), + el: $markup.findById('#fms-chb-forcesave'), labelText: this.strForcesave }); this.cmbUnit = new Common.UI.ComboBox({ - el : $('#fms-cmb-unit'), + el : $markup.findById('#fms-cmb-unit'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -666,7 +669,7 @@ define([ }); this.cmbFuncLocale = new Common.UI.ComboBox({ - el : $('#fms-cmb-func-locale'), + el : $markup.findById('#fms-cmb-func-locale'), style : 'width: 160px;', editable : false, cls : 'input-group-nr', @@ -679,9 +682,9 @@ define([ { value: 'ru', displayValue: this.txtRu, exampleValue: this.txtExampleRu }, { value: 'pl', displayValue: this.txtPl, exampleValue: this.txtExamplePl } ] - }).on('selected', _.bind(function(combo, record) { - this.updateFuncExample(record.exampleValue); - }, this)); + }).on('selected', function(combo, record) { + me.updateFuncExample(record.exampleValue); + }); var regdata = [{ value: 0x042C }, { value: 0x0402 }, { value: 0x0405 }, { value: 0x0407 }, {value: 0x0807}, { value: 0x0408 }, { value: 0x0C09 }, { value: 0x0809 }, { value: 0x0409 }, { value: 0x0C0A }, { value: 0x080A }, { value: 0x040B }, { value: 0x040C }, { value: 0x0410 }, { value: 0x0411 }, { value: 0x0412 }, { value: 0x0426 }, { value: 0x0413 }, { value: 0x0415 }, { value: 0x0416 }, @@ -693,7 +696,7 @@ define([ }); this.cmbRegSettings = new Common.UI.ComboBox({ - el : $('#fms-cmb-reg-settings'), + el : $markup.findById('#fms-cmb-reg-settings'), style : 'width: 160px;', menuStyle: 'max-height: 185px;', editable : false, @@ -715,20 +718,22 @@ define([ '<% }); %>', '', ''].join('')) - }).on('selected', _.bind(function(combo, record) { - this.updateRegionalExample(record.value); - }, this)); + }).on('selected', function(combo, record) { + me.updateRegionalExample(record.value); + }); if (this.cmbRegSettings.scroller) this.cmbRegSettings.scroller.update({alwaysVisibleY: true}); this.btnApply = new Common.UI.Button({ - el: '#fms-btn-apply' + el: $markup.findById('#fms-btn-apply') }); this.btnApply.on('click', _.bind(this.applySettings, this)); + this.$el = $(node).html($markup); + if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -928,7 +933,7 @@ define([ }, render: function() { - $(this.el).html(this.template()); + this.$el.html(this.template()); this.viewRecentPicker = new Common.UI.DataView({ el: $('#id-recent-view'), @@ -946,7 +951,7 @@ define([ if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -1008,14 +1013,14 @@ define([ }, render: function() { - $(this.el).html(this.template({ + this.$el.html(this.template({ scope: this, docs: this.options[0].docs })); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -1119,15 +1124,14 @@ define([ this._locked = false; }, - render: function() { - $(this.el).html(this.template({scope: this})); - + render: function(node) { var me = this; + var $markup = $(me.template()); // server info - this.lblPlacement = $('#id-info-placement'); - this.lblOwner = $('#id-info-owner'); - this.lblUploaded = $('#id-info-uploaded'); + this.lblPlacement = $markup.findById('#id-info-placement'); + this.lblOwner = $markup.findById('#id-info-owner'); + this.lblUploaded = $markup.findById('#id-info-uploaded'); // edited info var keyDownBefore = function(input, e){ @@ -1142,37 +1146,37 @@ define([ }; this.inputTitle = new Common.UI.InputField({ - el : $('#id-info-title'), + el : $markup.findById('#id-info-title'), style : 'width: 200px;', placeHolder : this.txtAddText, validateOnBlur: false }).on('keydown:before', keyDownBefore); this.inputSubject = new Common.UI.InputField({ - el : $('#id-info-subject'), + el : $markup.findById('#id-info-subject'), style : 'width: 200px;', placeHolder : this.txtAddText, validateOnBlur: false }).on('keydown:before', keyDownBefore); this.inputComment = new Common.UI.InputField({ - el : $('#id-info-comment'), + el : $markup.findById('#id-info-comment'), style : 'width: 200px;', placeHolder : this.txtAddText, validateOnBlur: false }).on('keydown:before', keyDownBefore); // modify info - this.lblModifyDate = $('#id-info-modify-date'); - this.lblModifyBy = $('#id-info-modify-by'); + this.lblModifyDate = $markup.findById('#id-info-modify-date'); + this.lblModifyBy = $markup.findById('#id-info-modify-by'); // creation info - this.lblDate = $('#id-info-date'); - this.lblApplication = $('#id-info-appname'); - this.tblAuthor = $('#id-info-author table'); - this.trAuthor = $('#id-info-add-author').closest('tr'); + this.lblDate = $markup.findById('#id-info-date'); + this.lblApplication = $markup.findById('#id-info-appname'); + this.tblAuthor = $markup.findById('#id-info-author table'); + this.trAuthor = $markup.findById('#id-info-add-author').closest('tr'); this.authorTpl = '
        '; this.tblAuthor.on('click', function(e) { - var btn = $(e.target); + var btn = $markup.find(e.target); if (btn.hasClass('close') && !btn.hasClass('disabled')) { var el = btn.closest('tr'), idx = me.tblAuthor.find('tr').index(el); @@ -1182,7 +1186,7 @@ define([ }); this.inputAuthor = new Common.UI.InputField({ - el : $('#id-info-add-author'), + el : $markup.findById('#id-info-add-author'), style : 'width: 200px;', validateOnBlur: false, placeHolder: this.txtAddAuthor @@ -1215,9 +1219,10 @@ define([ this.updateInfo(this.doc); + this.$el = $(node).html($markup); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } @@ -1435,12 +1440,12 @@ define([ this.menu = options.menu; }, - render: function() { - $(this.el).html(this.template()); + render: function(node) { + var $markup = $(this.template()); - this.cntRights = $('#id-info-rights'); + this.cntRights = $markup.findById('#id-info-rights'); this.btnEditRights = new Common.UI.Button({ - el: '#id-info-btn-edit' + el: $markup.findById('#id-info-btn-edit') }); this.btnEditRights.on('click', _.bind(this.changeAccessRights, this)); @@ -1448,15 +1453,16 @@ define([ this.updateInfo(this.doc); + this.$el = $(node).html($markup); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } - Common.NotificationCenter.on('collaboration:sharing', _.bind(this.changeAccessRights, this)); - Common.NotificationCenter.on('collaboration:sharingdeny', _.bind(this.onLostEditRights, this)); + Common.NotificationCenter.on('collaboration:sharing', this.changeAccessRights.bind(this)); + Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this)); return this; }, @@ -1601,7 +1607,7 @@ define([ render: function() { var me = this; - $(this.el).html(this.template()); + this.$el.html(this.template()); this.viewHelpPicker = new Common.UI.DataView({ el: $('#id-help-contents'), @@ -1732,7 +1738,7 @@ define([ }, render: function() { - $(this.el).html(this.template({scope: this})); + this.$el.html(this.template({scope: this})); var protection = SSE.getController('Common.Controllers.Protection').getView(); @@ -1759,7 +1765,7 @@ define([ this.cntSignatureView = $('#id-fms-signature-view'); if (_.isUndefined(this.scroller)) { this.scroller = new Common.UI.Scroller({ - el: $(this.el), + el: this.$el, suppressScrollX: true }); } diff --git a/apps/spreadsheeteditor/main/app/view/LeftMenu.js b/apps/spreadsheeteditor/main/app/view/LeftMenu.js index 2fd3376f3..eaebd99d9 100644 --- a/apps/spreadsheeteditor/main/app/view/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/view/LeftMenu.js @@ -79,13 +79,11 @@ define([ }, render: function () { - var el = $(this.el); - el.html(this.template({ - })); + var $markup = $(this.template({})); this.btnSearch = new Common.UI.Button({ action: 'search', - el: $('#left-btn-search', this.el), + el: $markup.elementById('#left-btn-search'), hint: this.tipSearch + Common.Utils.String.platformKey('Ctrl+F'), disabled: true, enableToggle: true @@ -93,7 +91,7 @@ define([ this.btnAbout = new Common.UI.Button({ action: 'about', - el: $('#left-btn-about', this.el), + el: $markup.elementById('#left-btn-about'), hint: this.tipAbout, enableToggle: true, disabled: true, @@ -102,14 +100,14 @@ define([ this.btnSupport = new Common.UI.Button({ action: 'support', - el: $('#left-btn-support', this.el), + el: $markup.elementById('#left-btn-support'), hint: this.tipSupport, disabled: true }); /** coauthoring begin **/ this.btnComments = new Common.UI.Button({ - el: $('#left-btn-comments', this.el), + el: $markup.elementById('#left-btn-comments'), hint: this.tipComments + Common.Utils.String.platformKey('Ctrl+Shift+H'), enableToggle: true, disabled: true, @@ -117,7 +115,7 @@ define([ }); this.btnChat = new Common.UI.Button({ - el: $('#left-btn-chat', this.el), + el: $markup.elementById('#left-btn-chat'), hint: this.tipChat + Common.Utils.String.platformKey('Alt+Q'), enableToggle: true, disabled: true, @@ -127,13 +125,13 @@ define([ this.btnComments.hide(); this.btnChat.hide(); - this.btnComments.on('click', _.bind(this.onBtnMenuClick, this)); - this.btnComments.on('toggle', _.bind(this.onBtnCommentsToggle, this)); - this.btnChat.on('click', _.bind(this.onBtnMenuClick, this)); + this.btnComments.on('toggle', this.onBtnCommentsToggle.bind(this)); + this.btnComments.on('click', this.onBtnMenuClick.bind(this)); + this.btnChat.on('click', this.onBtnMenuClick.bind(this)); /** coauthoring end **/ this.btnPlugins = new Common.UI.Button({ - el: $('#left-btn-plugins'), + el: $markup.elementById('#left-btn-plugins'), hint: this.tipPlugins, enableToggle: true, disabled: true, @@ -143,7 +141,7 @@ define([ this.btnPlugins.on('click', _.bind(this.onBtnMenuClick, this)); this.btnSpellcheck = new Common.UI.Button({ - el: $('#left-btn-spellcheck'), + el: $markup.elementById('#left-btn-spellcheck'), hint: this.tipSpellcheck, enableToggle: true, disabled: true, @@ -156,8 +154,8 @@ define([ this.btnAbout.on('toggle', _.bind(this.onBtnMenuToggle, this)); this.menuFile = new SSE.Views.FileMenu({}); - this.menuFile.render(); - this.btnAbout.panel = (new Common.Views.About({el: $('#about-menu-panel'), appName: 'Spreadsheet Editor'})).render(); + this.btnAbout.panel = (new Common.Views.About({el: '#about-menu-panel', appName: 'Spreadsheet Editor'})); + this.$el.html($markup); return this; }, diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js index f95f2bb96..370a0a0c9 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js @@ -77,6 +77,7 @@ define([ this.imgprops = null; this._sendUndoPoint = true; this._sliderChanged = false; + this._texturearray = null; this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt); @@ -96,7 +97,8 @@ define([ DisabledFillPanels: false, DisabledControls: false, HideShapeOnlySettings: false, - HideChangeTypeSettings: false + HideChangeTypeSettings: false, + isFromImage: false }; this.lockedControls = []; this._locked = false; @@ -741,7 +743,8 @@ define([ || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' || shapetype=='straightConnector1'; this.hideChangeTypeSettings(hidechangetype); - if (!hidechangetype) { + this._state.isFromImage = !!shapeprops.get_FromImage(); + if (!hidechangetype && this.btnChangeShape.menu.items.length) { this.btnChangeShape.menu.items[0].setVisible(shapeprops.get_FromImage()); this.btnChangeShape.menu.items[1].setVisible(!shapeprops.get_FromImage()); } @@ -1379,6 +1382,7 @@ define([ }, createDelayedElements: function() { + this._initSettings = false; this.createDelayedControls(); var global_hatch_menu_map = [ @@ -1412,36 +1416,17 @@ define([ this.PatternFillType = this.patternViewData[0].type; } - this.fillAutoShapes(); + this.onInitStandartTextures(); + this.onApiAutoShapes(); this.UpdateThemeColors(); - this._initSettings = false; }, onInitStandartTextures: function(texture) { var me = this; if (texture && texture.length>0){ - if (!this.btnTexture) { - this.btnTexture = new Common.UI.ComboBox({ - el: $('#shape-combo-fill-texture'), - template: _.template([ - '' - ].join('')) - }); - this.textureMenu = new Common.UI.Menu({ - items: [ - { template: _.template('
        ') } - ] - }); - this.textureMenu.render($('#shape-combo-fill-texture')); - this.fillControls.push(this.btnTexture); - } - var texturearray = []; + me._texturearray = []; _.each(texture, function(item){ - texturearray.push({ + me._texturearray.push({ imageUrl: item.asc_getImage(), name : me.textureNames[item.asc_getId()], type : item.asc_getId(), @@ -1449,15 +1434,41 @@ define([ selected: false }); }); - var mnuTexturePicker = new Common.UI.DataView({ - el: $('#id-shape-menu-texture'), - restoreHeight: 174, - parentMenu: me.textureMenu, - showLast: false, - store: new Common.UI.DataViewStore(texturearray), - itemTemplate: _.template('
        ') + } + + if (!me._texturearray || me._texturearray.length<1) return; + if (!this._initSettings && !this.btnTexture) { + this.btnTexture = new Common.UI.ComboBox({ + el: $('#shape-combo-fill-texture'), + template: _.template([ + '' + ].join('')) }); - mnuTexturePicker.on('item:click', _.bind(this.onSelectTexture, this)); + this.textureMenu = new Common.UI.Menu({ + items: [ + { template: _.template('
        ') } + ] + }); + this.textureMenu.render($('#shape-combo-fill-texture')); + this.fillControls.push(this.btnTexture); + + var onShowBefore = function(menu) { + var mnuTexturePicker = new Common.UI.DataView({ + el: $('#id-shape-menu-texture'), + restoreHeight: 174, + parentMenu: menu, + showLast: false, + store: new Common.UI.DataViewStore(me._texturearray || []), + itemTemplate: _.template('
        ') + }); + mnuTexturePicker.on('item:click', _.bind(me.onSelectTexture, me)); + menu.off('show:before', onShowBefore); + }; + this.textureMenu.on('show:before', onShowBefore); } }, @@ -1481,11 +1492,46 @@ define([ Common.NotificationCenter.trigger('edit:complete', this); }, + onApiAutoShapes: function() { + var me = this; + var onShowBefore = function(menu) { + me.fillAutoShapes(); + menu.off('show:before', onShowBefore); + }; + me.btnChangeShape.menu.on('show:before', onShowBefore); + }, + fillAutoShapes: function() { var me = this, - shapesStore = this.application.getCollection('ShapeGroups'); + shapesStore = this.application.getCollection('ShapeGroups'), + count = shapesStore.length; + + var onShowAfter = function(menu) { + for (var i=-1; i0; i++) { + var store = shapesStore.at(i > -1 ? i : 0).get('groupStore'); + if (i<0) { + store = store.clone(); + store.shift(); + } + var shapePicker = new Common.UI.DataViewSimple({ + el: $('#id-shape-menu-shapegroup' + (i+1), menu.items[i+1].$el), + store: store, + parentMenu: menu.items[i+1].menu, + itemTemplate: _.template('
        \">
        ') + }); + shapePicker.on('item:click', function(picker, item, record, e) { + if (me.api) { + me.api.asc_changeShapeType(record.get('data').shapeType); + Common.NotificationCenter.trigger('edit:complete', me); + } + if (e.type !== 'click') + me.btnChangeShape.menu.hide(); + }); + } + menu.off('show:after', onShowAfter); + }; + me.btnChangeShape.menu.on('show:after', onShowAfter); - var count = shapesStore.length; for (var i=-1; i0; i++) { var shapeGroup = shapesStore.at(i>-1 ? i : i+1); var menuItem = new Common.UI.MenuItem({ @@ -1498,29 +1544,9 @@ define([ }) }); me.btnChangeShape.menu.addItem(menuItem); - - var store = shapeGroup.get('groupStore'); - if (i<0) { - store = store.clone(); - store.shift(); - } - var shapePicker = new Common.UI.DataView({ - el: $('#id-shape-menu-shapegroup' + (i+1)), - store: store, - parentMenu: menuItem.menu, - showLast: false, - itemTemplate: _.template('
        \">
        ') - }); - - shapePicker.on('item:click', function(picker, item, record, e) { - if (me.api) { - me.api.asc_changeShapeType(record.get('data').shapeType); - Common.NotificationCenter.trigger('edit:complete', me); - } - if (e.type !== 'click') - me.btnChangeShape.menu.hide(); - }); } + me.btnChangeShape.menu.items[0].setVisible(me._state.isFromImage); + me.btnChangeShape.menu.items[1].setVisible(!me._state.isFromImage); }, onBtnRotateClick: function(btn) { @@ -1553,6 +1579,7 @@ define([ }, UpdateThemeColors: function() { + if (this._initSettings) return; if (!this.btnBackColor) { this.btnBackColor = new Common.UI.ColorButton({ style: "width:45px;", diff --git a/apps/spreadsheeteditor/main/app/view/TableSettings.js b/apps/spreadsheeteditor/main/app/view/TableSettings.js index 810f49060..e357a3c01 100644 --- a/apps/spreadsheeteditor/main/app/view/TableSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TableSettings.js @@ -456,7 +456,6 @@ define([ data[index].set('imageUrl', template.asc_getImage()); }); } else { - self.cmbTableTemplate.menuPicker.store.reset([]); var arr = []; _.each(Templates, function(template){ arr.push({ @@ -470,7 +469,7 @@ define([ tip : template.asc_getDisplayName() }); }); - self.cmbTableTemplate.menuPicker.store.add(arr); + self.cmbTableTemplate.menuPicker.store.reset(arr); } }, diff --git a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js index 8eef92f8b..d3d6291d7 100644 --- a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js @@ -76,6 +76,7 @@ define([ this.shapeprops = null; this._sendUndoPoint = true; this._sliderChanged = false; + this._texturearray = null; this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt); @@ -123,6 +124,10 @@ define([ this.FillPatternContainer = $('#textart-panel-pattern-fill'); this.FillGradientContainer = $('#textart-panel-gradient-fill'); this.TransparencyContainer = $('#textart-panel-transparent-fill'); + + SSE.getCollection('Common.Collections.TextArt').bind({ + reset: this.fillTextArt.bind(this) + }); }, render: function () { @@ -1298,6 +1303,7 @@ define([ }, createDelayedElements: function() { + this._initSettings = false; this.createDelayedControls(); var global_hatch_menu_map = [ @@ -1332,13 +1338,28 @@ define([ } this.UpdateThemeColors(); + this.onInitStandartTextures(); + this.fillTextArt(); this.fillTransform(this.api.asc_getPropertyEditorTextArts()); - this._initSettings = false; }, onInitStandartTextures: function(texture) { var me = this; if (texture && texture.length>0){ + me._texturearray = []; + _.each(texture, function(item){ + me._texturearray.push({ + imageUrl: item.get_image(), + name : me.textureNames[item.get_id()], + type : item.get_id(), +// allowSelected : false, + selected: false + }); + }); + } + + if (!me._texturearray || me._texturearray.length<1) return; + if (!this._initSettings && !this.btnTexture) { this.btnTexture = new Common.UI.ComboBox({ el: $('#textart-combo-fill-texture'), template: _.template([ @@ -1357,24 +1378,19 @@ define([ this.textureMenu.render($('#textart-combo-fill-texture')); this.lockedControls.push(this.btnTexture); - var texturearray = []; - _.each(texture, function(item){ - texturearray.push({ - imageUrl: item.get_image(), - name : me.textureNames[item.get_id()], - type : item.get_id(), - selected: false + var onShowBefore = function(menu) { + var mnuTexturePicker = new Common.UI.DataView({ + el: $('#id-textart-menu-texture'), + restoreHeight: 174, + parentMenu: menu, + showLast: false, + store: new Common.UI.DataViewStore(me._texturearray || []), + itemTemplate: _.template('
        ') }); - }); - var mnuTexturePicker = new Common.UI.DataView({ - el: $('#id-textart-menu-texture'), - restoreHeight: 174, - parentMenu: me.textureMenu, - showLast: false, - store: new Common.UI.DataViewStore(texturearray), - itemTemplate: _.template('
        ') - }); - mnuTexturePicker.on('item:click', _.bind(this.onSelectTexture, this)); + mnuTexturePicker.on('item:click', _.bind(me.onSelectTexture, me)); + menu.off('show:before', onShowBefore); + }; + this.textureMenu.on('show:before', onShowBefore); } }, @@ -1399,8 +1415,8 @@ define([ }, fillTextArt: function() { + if (this._initSettings) return; var me = this; - if (!this.cmbTextArt) { this.cmbTextArt = new Common.UI.ComboDataView({ itemWidth: 50, @@ -1424,6 +1440,10 @@ define([ var models = this.application.getCollection('Common.Collections.TextArt').models, count = this.cmbTextArt.menuPicker.store.length; + if (models.length<1) { + SSE.getController('Main').fillTextArt(this.api.asc_getTextArtPreviews()); + return; + } if (count>0 && count==models.length) { var data = this.cmbTextArt.menuPicker.store.models; _.each(models, function(template, index){ @@ -1480,6 +1500,7 @@ define([ }, UpdateThemeColors: function() { + if (this._initSettings) return; if (!this.btnBackColor) { this.btnBorderColor = new Common.UI.ColorButton({ style: "width:45px;", diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index d4eb4141e..de2a6bc64 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -668,12 +668,7 @@ define([ iconCls : 'btn-insertchart', lock : [_set.editCell, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText], caption : me.capInsertChart, - menu : new Common.UI.Menu({ - style: 'width: 435px;', - items: [ - { template: _.template('') } - ] - }) + menu : true }); me.btnInsertShape = new Common.UI.Button({ @@ -1866,60 +1861,98 @@ define([ } if ( this.btnInsertChart ) { - this.mnuInsertChartPicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-insertchart'), - parentMenu: this.btnInsertChart.menu, - showLast: false, - restoreHeight: 539, - groups: new Common.UI.DataViewGroupStore([ - { id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts }, - { id: 'menu-chart-group-line', caption: me.textLine }, - { id: 'menu-chart-group-pie', caption: me.textPie }, - { id: 'menu-chart-group-hbar', caption: me.textBar }, - { id: 'menu-chart-group-area', caption: me.textArea, inline: true }, - { id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true }, - { id: 'menu-chart-group-stock', caption: me.textStock, inline: true } - // { id: 'menu-chart-group-surface', caption: me.textSurface} - // ,{ id: 'menu-chart-group-sparkcolumn', inline: true, headername: me.textSparks }, - // { id: 'menu-chart-group-sparkline', inline: true }, - // { id: 'menu-chart-group-sparkwin', inline: true } - ]), - store: new Common.UI.DataViewStore([ - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, allowSelected: true, iconCls: 'column-normal', selected: true}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, allowSelected: true, iconCls: 'column-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, allowSelected: true, iconCls: 'column-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, allowSelected: true, iconCls: 'column-3d-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, allowSelected: true, iconCls: 'column-3d-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, allowSelected: true, iconCls: 'column-3d-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, allowSelected: true, iconCls: 'column-3d-normal-per'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, allowSelected: true, iconCls: 'line-normal'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, allowSelected: true, iconCls: 'line-stack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, allowSelected: true, iconCls: 'line-pstack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, allowSelected: true, iconCls: 'line-3d'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, allowSelected: true, iconCls: 'pie-normal'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, allowSelected: true, iconCls: 'pie-doughnut'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, allowSelected: true, iconCls: 'pie-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, allowSelected: true, iconCls: 'bar-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, allowSelected: true, iconCls: 'bar-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, allowSelected: true, iconCls: 'bar-pstack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, allowSelected: true, iconCls: 'bar-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, allowSelected: true, iconCls: 'bar-3d-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, allowSelected: true, iconCls: 'bar-3d-pstack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, allowSelected: true, iconCls: 'area-normal'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, allowSelected: true, iconCls: 'area-stack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, allowSelected: true, iconCls: 'area-pstack'}, - { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, allowSelected: true, iconCls: 'point-normal'}, - { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, allowSelected: true, iconCls: 'stock-normal'} - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, allowSelected: true, iconCls: 'surface-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, allowSelected: true, iconCls: 'surface-wireframe'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, allowSelected: true, iconCls: 'contour-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, allowSelected: true, iconCls: 'contour-wireframe'} - // ,{ group: 'menu-chart-group-sparkcolumn', type: Asc.c_oAscSparklineType.Column, allowSelected: true, iconCls: 'spark-column', tip: me.textColumnSpark}, - // { group: 'menu-chart-group-sparkline', type: Asc.c_oAscSparklineType.Line, allowSelected: true, iconCls: 'spark-line', tip: me.textLineSpark}, - // { group: 'menu-chart-group-sparkwin', type: Asc.c_oAscSparklineType.Stacked, allowSelected: true, iconCls: 'spark-win', tip: me.textWinLossSpark} - ]), - itemTemplate: _.template('
        ') - }); + this.btnInsertChart.setMenu(new Common.UI.Menu({ + style: 'width: 435px;', + items: [ + { template: _.template('') } + ] + })); + + var onShowBefore = function(menu) { + var picker = new Common.UI.DataView({ + el: $('#id-toolbar-menu-insertchart'), + parentMenu: menu, + showLast: false, + restoreHeight: 421, + groups: new Common.UI.DataViewGroupStore([ + {id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts}, + {id: 'menu-chart-group-line', caption: me.textLine}, + {id: 'menu-chart-group-pie', caption: me.textPie}, + {id: 'menu-chart-group-hbar', caption: me.textBar}, + {id: 'menu-chart-group-area', caption: me.textArea, inline: true}, + {id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true}, + {id: 'menu-chart-group-stock', caption: me.textStock, inline: true} + // { id: 'menu-chart-group-surface', caption: me.textSurface} + // ,{ id: 'menu-chart-group-sparkcolumn', inline: true, headername: me.textSparks }, + // { id: 'menu-chart-group-sparkline', inline: true }, + // { id: 'menu-chart-group-sparkwin', inline: true } + ]), + store: new Common.UI.DataViewStore([ + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'}, + { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'}, + { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'} + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'}, + // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'} + // ,{ group: 'menu-chart-group-sparkcolumn', type: Asc.c_oAscSparklineType.Column, allowSelected: true, iconCls: 'spark-column', tip: me.textColumnSpark}, + // { group: 'menu-chart-group-sparkline', type: Asc.c_oAscSparklineType.Line, allowSelected: true, iconCls: 'spark-line', tip: me.textLineSpark}, + // { group: 'menu-chart-group-sparkwin', type: Asc.c_oAscSparklineType.Stacked, allowSelected: true, iconCls: 'spark-win', tip: me.textWinLossSpark} + ]), + itemTemplate: _.template('
        ') + }); + picker.on('item:click', function (picker, item, record, e) { + if (record) + me.fireEvent('add:chart', [record.get('group'), record.get('type')]); + if (e.type !== 'click') menu.hide(); + }); + menu.off('show:before', onShowBefore); + }; + this.btnInsertChart.menu.on('show:before', onShowBefore); + } + + if (this.btnInsertTextArt) { + var onShowBeforeTextArt = function (menu) { + var collection = SSE.getCollection('Common.Collections.TextArt'); + if (collection.length<1) + SSE.getController('Main').fillTextArt(me.api.asc_getTextArtPreviews()); + var picker = new Common.UI.DataView({ + el: $('#id-toolbar-menu-insart'), + store: collection, + parentMenu: menu, + showLast: false, + itemTemplate: _.template('
        ') + }); + picker.on('item:click', function (picker, item, record, e) { + if (record) + me.fireEvent('insert:textart', [record.get('data')]); + if (e.type !== 'click') menu.hide(); + }); + menu.off('show:before', onShowBeforeTextArt); + }; + this.btnInsertTextArt.menu.on('show:before', onShowBeforeTextArt); } if (!this.mode.isEditMailMerge && !this.mode.isEditDiagram) diff --git a/apps/spreadsheeteditor/main/index.html b/apps/spreadsheeteditor/main/index.html index beffffca5..fc595782a 100644 --- a/apps/spreadsheeteditor/main/index.html +++ b/apps/spreadsheeteditor/main/index.html @@ -20,157 +20,110 @@ z-index: 1001; } - .loader-page { + .loadmask > .brendpanel { width: 100%; - height: 170px; - bottom: 42%; - position: absolute; - text-align: center; - line-height: 10px; + height: 56px; + background: #40865c; } - .loader-logo { - max-height: 160px; - margin-bottom: 10px; + .loadmask > .brendpanel > div { + display: flex; + align-items: center; } - .loader-page-romb { - width: 40px; + .loadmask > .brendpanel .loading-logo { + padding: 0 24px 0 12px; + max-width: 200px; + height: 20px; + } + + .loadmask > .brendpanel .loading-logo > img { display: inline-block; + max-width: 100px; + max-height: 20px; + opacity: 0; } - .loader-page-text { + .loadmask > .brendpanel .spacer { + margin-left: auto; + } + + .loadmask > .brendpanel .circle { + vertical-align: middle; + width: 20px; + height: 20px; + border-radius: 12px; + margin: 4px 10px; + background: rgba(255, 255, 255, 0.2); + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + } + + .loadmask > .brendpanel .rect { + vertical-align: middle; + width: 50px; + height: 12px; + border-radius: 3px; + margin: 0 10px; + background: rgba(255, 255, 255, 0.2); + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + } + + .loadmask > .placeholder { + background: #fbfbfb; width: 100%; - bottom: 42%; - position: absolute; - text-align: center; - color: #888; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 20px; + height: 100%; + border: 1px solid #dfdfdf; + white-space: nowrap; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; } - .loader-page-text-loading { - font-size: 14px; + .loadmask > .placeholder > .columns { + width: 100%; + height: 100%; + display: inline-block; + background: linear-gradient(90deg, #d5d5d5 0px, rgba(0,0,0,0) 1px) 0 0, + linear-gradient(rgba(0,255,0,0) 19px, #d5d5d5 20px) 0 0, + linear-gradient( #f1f1f1 0px, #f1f1f1 20px) 0 0 repeat-x; + background-size: 80px 20px; } - .loader-page-text-customer { - font-size: 16px; - margin-bottom: 5px; + .loadmask > .placeholder > .columns:first-child { + background: linear-gradient(#f1f1f1 19px, #d5d5d5 20px) 0 0; + background-size: 20px 20px; + width: 35px; } - .romb { - width: 40px; - height: 40px; - -webkit-transform: rotate(135deg) skew(20deg, 20deg); - -moz-transform: rotate(135deg) skew(20deg, 20deg); - -ms-transform: rotate(135deg) skew(20deg, 20deg); - -o-transform: rotate(135deg) skew(20deg, 20deg); - position: absolute; - background: red; - border-radius: 6px; - -webkit-animation: movedown 3s infinite ease; - -moz-animation: movedown 3s infinite ease; - -ms-animation: movedown 3s infinite ease; - -o-animation: movedown 3s infinite ease; - animation: movedown 3s infinite ease; + @keyframes flickerAnimation { + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - #blue { - z-index: 3; - background: #55bce6; - -webkit-animation-name: blue; - -moz-animation-name: blue; - -ms-animation-name: blue; - -o-animation-name: blue; - animation-name: blue; + @-o-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - #red { - z-index:1; - background: #de7a59; - -webkit-animation-name: red; - -moz-animation-name: red; - -ms-animation-name: red; - -o-animation-name: red; - animation-name: red; + @-moz-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - #green { - z-index: 2; - background: #a1cb5c; - -webkit-animation-name: green; - -moz-animation-name: green; - -ms-animation-name: green; - -o-animation-name: green; - animation-name: green; - } - - @-webkit-keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0;} - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0; } - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @-webkit-keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @-webkit-keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } - } - - @keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } + @-webkit-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } @@ -218,49 +171,9 @@ var params = getUrlParams(), lang = (params["lang"] || 'en').split(/[\-\_]/)[0], - customer = params["customer"] ? ('
        ' + encodeUrlParam(params["customer"]) + '
        ') : '', - margin = (customer !== '') ? 50 : 20, - loading = 'Loading...', - logo = params["logo"] ? ((params["logo"] !== 'none') ? ('') : '') : null; + logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null; window.frameEditorId = params["frameEditorId"]; - - if ( lang == 'de') loading = 'Ladevorgang...'; - else if ( lang == 'es') loading = 'Cargando...'; - else if ( lang == 'fr') loading = 'Chargement en cours...'; - else if ( lang == 'it') loading = 'Caricamento in corso...'; - else if ( lang == 'pt') loading = 'Carregando...'; - else if ( lang == 'ru') loading = 'Загрузка...'; - else if ( lang == 'sl') loading = 'Nalaganje...'; - else if ( lang == 'tr') loading = 'Yükleniyor...'; - else if ( lang == 'bg') loading = 'Зареждане...'; - else if ( lang == 'cs') loading = 'Nahrávám...'; - else if ( lang == 'hu') loading = 'Betöltés...'; - else if ( lang == 'ja') loading = '読み込み中...'; - else if ( lang == 'ko') loading = '로드 중...'; - else if ( lang == 'lv') loading = 'Ieladēšana ...'; - else if ( lang == 'nl') loading = 'Laden...'; - else if ( lang == 'pl') loading = 'Ładowanie...'; - else if ( lang == 'sk') loading = 'Nahrávam...'; - else if ( lang == 'uk') loading = 'Завантаження...'; - else if ( lang == 'vi') loading = 'Đang tải...'; - else if ( lang == 'zh') loading = '加载中...'; - - if (!stopLoading) - document.write( - '
        ' + - '
        ' + - ((logo!==null) ? logo : - '
        ' + - '
        ' + - '
        ' + - '
        ' + - '
        ') + - '
        ' + - '
        ' + customer + - '
        ' + loading + '
        ' + - '
        ' + - '
        '); @@ -270,9 +183,21 @@ - +
        + + @@ -294,7 +219,7 @@ - + diff --git a/apps/spreadsheeteditor/main/index.html.deploy b/apps/spreadsheeteditor/main/index.html.deploy index e3f5920b7..12a41bcb5 100644 --- a/apps/spreadsheeteditor/main/index.html.deploy +++ b/apps/spreadsheeteditor/main/index.html.deploy @@ -22,157 +22,110 @@ z-index: 1001; } - .loader-page { + .loadmask > .brendpanel { width: 100%; - height: 170px; - bottom: 42%; - position: absolute; - text-align: center; - line-height: 10px; + height: 56px; + background: #40865c; } - .loader-logo { - max-height: 160px; - margin-bottom: 10px; + .loadmask > .brendpanel > div { + display: flex; + align-items: center; } - .loader-page-romb { - width: 40px; + .loadmask > .brendpanel .loading-logo { + padding: 0 24px 0 12px; + max-width: 200px; + height: 20px; + } + + .loadmask > .brendpanel .loading-logo > img { display: inline-block; + max-width: 100px; + max-height: 20px; + opacity: 0; } - .loader-page-text { + .loadmask > .brendpanel .spacer { + margin-left: auto; + } + + .loadmask > .brendpanel .circle { + vertical-align: middle; + width: 20px; + height: 20px; + border-radius: 12px; + margin: 4px 10px; + background: rgba(255, 255, 255, 0.2); + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + } + + .loadmask > .brendpanel .rect { + vertical-align: middle; + width: 50px; + height: 12px; + border-radius: 3px; + margin: 0 10px; + background: rgba(255, 255, 255, 0.2); + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + } + + .loadmask > .placeholder { + background: #fbfbfb; width: 100%; - bottom: 42%; - position: absolute; - text-align: center; - color: #888; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 20px; + height: 100%; + border: 1px solid #dfdfdf; + white-space: nowrap; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; } - .loader-page-text-loading { - font-size: 14px; + .loadmask > .placeholder > .columns { + width: 100%; + height: 100%; + display: inline-block; + background: linear-gradient(90deg, #d5d5d5 0px, rgba(0,0,0,0) 1px) 0 0, + linear-gradient(rgba(0,255,0,0) 19px, #d5d5d5 20px) 0 0, + linear-gradient( #f1f1f1 0px, #f1f1f1 20px) 0 0 repeat-x; + background-size: 80px 20px; } - .loader-page-text-customer { - font-size: 16px; - margin-bottom: 5px; + .loadmask > .placeholder > .columns:first-child { + background: linear-gradient(#f1f1f1 19px, #d5d5d5 20px) 0 0; + background-size: 20px 20px; + width: 35px; } - .romb { - width: 40px; - height: 40px; - -webkit-transform: rotate(135deg) skew(20deg, 20deg); - -moz-transform: rotate(135deg) skew(20deg, 20deg); - -ms-transform: rotate(135deg) skew(20deg, 20deg); - -o-transform: rotate(135deg) skew(20deg, 20deg); - position: absolute; - background: red; - border-radius: 6px; - -webkit-animation: movedown 3s infinite ease; - -moz-animation: movedown 3s infinite ease; - -ms-animation: movedown 3s infinite ease; - -o-animation: movedown 3s infinite ease; - animation: movedown 3s infinite ease; + @keyframes flickerAnimation { + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - #blue { - z-index: 3; - background: #55bce6; - -webkit-animation-name: blue; - -moz-animation-name: blue; - -ms-animation-name: blue; - -o-animation-name: blue; - animation-name: blue; + @-o-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - #red { - z-index:1; - background: #de7a59; - -webkit-animation-name: red; - -moz-animation-name: red; - -ms-animation-name: red; - -o-animation-name: red; - animation-name: red; + @-moz-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - #green { - z-index: 2; - background: #a1cb5c; - -webkit-animation-name: green; - -moz-animation-name: green; - -ms-animation-name: green; - -o-animation-name: green; - animation-name: green; - } - - @-webkit-keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0;} - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0; } - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @-webkit-keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @-webkit-keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } - } - - @keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } + @-webkit-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } @@ -226,55 +179,30 @@ var params = getUrlParams(), lang = (params["lang"] || 'en').split(/[\-\_]/)[0], - customer = params["customer"] ? ('
        ' + encodeUrlParam(params["customer"]) + '
        ') : '', - margin = (customer !== '') ? 50 : 20, - loading = 'Loading...', - logo = params["logo"] ? ((params["logo"] !== 'none') ? ('') : '') : null; + logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null; window.frameEditorId = params["frameEditorId"]; - - if ( lang == 'de') loading = 'Ladevorgang...'; - else if ( lang == 'es') loading = 'Cargando...'; - else if ( lang == 'fr') loading = 'Chargement en cours...'; - else if ( lang == 'it') loading = 'Caricamento in corso...'; - else if ( lang == 'pt') loading = 'Carregando...'; - else if ( lang == 'ru') loading = 'Загрузка...'; - else if ( lang == 'sl') loading = 'Nalaganje...'; - else if ( lang == 'tr') loading = 'Yükleniyor...'; - else if ( lang == 'bg') loading = 'Зареждане...'; - else if ( lang == 'cs') loading = 'Nahrávám...'; - else if ( lang == 'hu') loading = 'Betöltés...'; - else if ( lang == 'ja') loading = '読み込み中...'; - else if ( lang == 'ko') loading = '로드 중...'; - else if ( lang == 'lv') loading = 'Ieladēšana ...'; - else if ( lang == 'nl') loading = 'Laden...'; - else if ( lang == 'pl') loading = 'Ładowanie...'; - else if ( lang == 'sk') loading = 'Nahrávam...'; - else if ( lang == 'uk') loading = 'Завантаження...'; - else if ( lang == 'vi') loading = 'Đang tải...'; - else if ( lang == 'zh') loading = '加载中...'; - - if (!stopLoading) - document.write( - '
        ' + - '
        ' + - ((logo!==null) ? logo : - '
        ' + - '
        ' + - '
        ' + - '
        ' + - '
        ') + - '
        ' + - '
        ' + customer + - '
        ' + loading + '
        ' + - '
        ' + - '
        '); +
        +
        + + + \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/index_loader.html b/apps/spreadsheeteditor/main/index_loader.html new file mode 100644 index 000000000..b2e3bcc9b --- /dev/null +++ b/apps/spreadsheeteditor/main/index_loader.html @@ -0,0 +1,300 @@ + + + + ONLYOFFICE Document Editor + + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/index_loader.html.deploy b/apps/spreadsheeteditor/main/index_loader.html.deploy new file mode 100644 index 000000000..678920fd3 --- /dev/null +++ b/apps/spreadsheeteditor/main/index_loader.html.deploy @@ -0,0 +1,319 @@ + + + + ONLYOFFICE Document Editor + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        + + + + \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/resources/less/app.less b/apps/spreadsheeteditor/main/resources/less/app.less index a5d13d177..1f11e5e24 100644 --- a/apps/spreadsheeteditor/main/resources/less/app.less +++ b/apps/spreadsheeteditor/main/resources/less/app.less @@ -142,4 +142,36 @@ } @huge-icon-size: 37px; -@x-huge-icon-size: 45px; \ No newline at end of file +@x-huge-icon-size: 45px; + +// Skeleton of workbook + +.doc-placeholder { + background: #fbfbfb; + display: flex; + width: 100%; + height: 100%; + border: 1px solid #dfdfdf; + white-space: nowrap; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + + > .columns { + width: 100%; + height: 100%; + display: inline-block; + background: linear-gradient(90deg, #d5d5d5 0px, rgba(0,0,0,0) 1px) 0 0, + linear-gradient(rgba(0,255,0,0) 19px, #d5d5d5 20px) 0 0, + linear-gradient( #f1f1f1 0px, #f1f1f1 20px) 0 0 repeat-x; + background-size: 80px 20px; + + &:first-child { + background: linear-gradient(#f1f1f1 19px, #d5d5d5 20px) 0 0; + background-size: 20px 20px; + width: 35px; + } + } +} \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index c120d514b..60577b4d4 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -125,6 +125,7 @@ define([ 'translate': translate }); + // Localization uiApp params uiApp.params.modalButtonOk = me.textOK; uiApp.params.modalButtonCancel = me.textCancel; @@ -238,6 +239,9 @@ define([ if (me.appOptions.location == 'us' || me.appOptions.location == 'ca') Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch); + + if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo)) + $('#editor_sdk').append('
        ' + '
        '.repeat(2) + '
        '); }, loadDocument: function(data) { @@ -579,6 +583,8 @@ define([ $(document).on('contextmenu', _.bind(me.onContextMenu, me)); Common.Gateway.documentReady(); + + $('.doc-placeholder').remove(); }, onLicenseChanged: function(params) { diff --git a/apps/spreadsheeteditor/mobile/index.html b/apps/spreadsheeteditor/mobile/index.html index f4a7051f9..e883cdb55 100644 --- a/apps/spreadsheeteditor/mobile/index.html +++ b/apps/spreadsheeteditor/mobile/index.html @@ -16,6 +16,7 @@ +
        +
        +
        +
        + +
        +
        +
        +
        +
        +
        +
        +
        diff --git a/apps/spreadsheeteditor/mobile/index.html.deploy b/apps/spreadsheeteditor/mobile/index.html.deploy index 79a4ef323..ac3aa97aa 100644 --- a/apps/spreadsheeteditor/mobile/index.html.deploy +++ b/apps/spreadsheeteditor/mobile/index.html.deploy @@ -22,164 +22,126 @@ overflow: hidden; border: none; background-color: #f4f4f4; - z-index: 100; + z-index: 10000; } - - .loader-page { + .loadmask > .brendpanel { width: 100%; - height: 170px; - bottom: 42%; position: absolute; - text-align: center; - line-height: 10px; + height: 44px; + background-color: #e2e2e2; + opacity: 0; } - .loader-logo { - max-height: 160px; - margin-bottom: 10px; + .loadmask > .brendpanel.visible { + opacity: 1; } - .loader-page-romb { - width: 40px; + .loadmask > .brendpanel.android { + height: 56px; + background: #40865c; + } + + .loadmask > .brendpanel > div { + display: flex; + align-items: center; + height: 100%; + } + + .loadmask > .brendpanel .loading-logo { + max-width: 200px; + height: 20px; + margin: 0 auto; + } + + .loadmask > .brendpanel .loading-logo > img { display: inline-block; + max-width: 100px; + max-height: 20px; + opacity: 0; } - .loader-page-text { + .loadmask > .brendpanel .circle { + vertical-align: middle; + width: 28px; + height: 28px; + border-radius: 14px; + margin: 4px 10px; + background: rgba(255, 255, 255, 0.2); + } + + .loadmask > .placeholder { + background: #fbfbfb; width: 100%; - bottom: 42%; + height: 100%; + border: 1px solid #dfdfdf; + white-space: nowrap; + padding-top: 43px; + } + + .loadmask > .placeholder.android { + padding-top: 56px; + } + + .loadmask > .placeholder > .columns { + width: 100%; + height: 100%; + display: inline-block; + background: linear-gradient(90deg, #d5d5d5 0px, rgba(0,0,0,0) 1px) 0 0, + linear-gradient(rgba(0,255,0,0) 19px, #d5d5d5 20px) 0 0, + linear-gradient( #f1f1f1 0px, #f1f1f1 20px) 0 0 repeat-x; + background-size: 80px 20px; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + } + + .loadmask > .placeholder > .columns:first-child { position: absolute; - text-align: center; - color: #888; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 20px; + background: linear-gradient(#f1f1f1 19px, #d5d5d5 20px) 0 0; + background-size: 20px 20px; + width: 35px; } - .loader-page-text-loading { - font-size: 14px; + @keyframes flickerAnimation { + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - .loader-page-text-customer { - font-size: 16px; - margin-bottom: 5px; + @-o-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - .romb { - width: 40px; - height: 40px; - -webkit-transform: rotate(135deg) skew(20deg, 20deg); - -moz-transform: rotate(135deg) skew(20deg, 20deg); - -ms-transform: rotate(135deg) skew(20deg, 20deg); - -o-transform: rotate(135deg) skew(20deg, 20deg); - position: absolute; - background: red; - border-radius: 6px; - -webkit-animation: movedown 3s infinite ease; - -moz-animation: movedown 3s infinite ease; - -ms-animation: movedown 3s infinite ease; - -o-animation: movedown 3s infinite ease; - animation: movedown 3s infinite ease; + @-moz-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } - - #blue { - z-index: 3; - background: #55bce6; - -webkit-animation-name: blue; - -moz-animation-name: blue; - -ms-animation-name: blue; - -o-animation-name: blue; - animation-name: blue; - } - - #red { - z-index:1; - background: #de7a59; - -webkit-animation-name: red; - -moz-animation-name: red; - -ms-animation-name: red; - -o-animation-name: red; - animation-name: red; - } - - #green { - z-index: 2; - background: #a1cb5c; - -webkit-animation-name: green; - -moz-animation-name: green; - -ms-animation-name: green; - -o-animation-name: green; - animation-name: green; - } - - @-webkit-keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0;} - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @keyframes red { - 0% { top:120px; background: #de7a59; } - 10% { top:120px; background: #F2CBBF; } - 14% { background: #f4f4f4; top:120px; } - 15% { background: #f4f4f4; top:0; } - 20% { background: #E6E4E4; } - 30% { background: #D2D2D2; } - 40% { top:120px; } - 100% { top:120px; background: #de7a59; } - } - - @-webkit-keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @keyframes green { - 0% { top:110px; background: #a1cb5c; opacity:1; } - 10% { top:110px; background: #CBE0AC; opacity:1; } - 14% { background: #f4f4f4; top:110px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #EFEFEF; top:0; opacity:1; } - 30% { background:#E6E4E4; } - 70% { top:110px; } - 100% { top:110px; background: #a1cb5c; } - } - - @-webkit-keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #f4f4f4; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } - } - - @keyframes blue { - 0% { top:100px; background: #55bce6; opacity:1; } - 10% { top:100px; background: #BFE8F8; opacity:1; } - 14% { background: #f4f4f4; top:100px; opacity:1; } - 15% { background: #f4f4f4; top:0; opacity:1; } - 20% { background: #f4f4f4; top:0; opacity:0; } - 25% { background: #fff; top:0; opacity:0; } - 45% { background: #EFEFEF; top:0; opacity:0.2; } - 100% { top:100px; background: #55bce6; } + @-webkit-keyframes flickerAnimation{ + 0% { opacity:1; } + 50% { opacity:0.3; } + 100% { opacity:1; } } +
        +
        +
        +
        + +
        +
        +
        +
        +
        +
        +
        +
        - diff --git a/apps/spreadsheeteditor/mobile/index_loader.html b/apps/spreadsheeteditor/mobile/index_loader.html new file mode 100644 index 000000000..02be1089c --- /dev/null +++ b/apps/spreadsheeteditor/mobile/index_loader.html @@ -0,0 +1,266 @@ + + + + + + + + + + ONLYOFFICE Spreadsheets + + + + + + + + + + + + +
        + + + + + + + + + + + \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/index_loader.html.deploy b/apps/spreadsheeteditor/mobile/index_loader.html.deploy new file mode 100644 index 000000000..79a4ef323 --- /dev/null +++ b/apps/spreadsheeteditor/mobile/index_loader.html.deploy @@ -0,0 +1,293 @@ + + + + + + + + + + ONLYOFFICE Spreadsheet Editor + + + + + + + + + +
        + + + + diff --git a/apps/spreadsheeteditor/mobile/resources/css/app-ios.css b/apps/spreadsheeteditor/mobile/resources/css/app-ios.css index 237a3ee33..74b26d6ad 100644 --- a/apps/spreadsheeteditor/mobile/resources/css/app-ios.css +++ b/apps/spreadsheeteditor/mobile/resources/css/app-ios.css @@ -7588,3 +7588,32 @@ html.pixel-ratio-3 .cell-styles.dataview .row li { .lang-flag.es-MX { background-position: -16px -192px; } +.doc-placeholder { + background: #fbfbfb; + width: 100%; + height: 100%; + border: 1px solid #dfdfdf; + white-space: nowrap; + padding-top: 0; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; +} +.doc-placeholder > .columns { + width: 100%; + height: 100%; + display: inline-block; + background: linear-gradient(90deg, #d5d5d5 0px, rgba(0, 0, 0, 0) 1px) 0 0, linear-gradient(rgba(0, 255, 0, 0) 19px, #d5d5d5 20px) 0 0, linear-gradient(#f1f1f1 0px, #f1f1f1 20px) 0 0 repeat-x; + background-size: 80px 20px; + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; +} +.doc-placeholder > .columns:first-child { + background: linear-gradient(#f1f1f1 19px, #d5d5d5 20px) 0 0; + background-size: 20px 20px; + width: 35px; +} diff --git a/apps/spreadsheeteditor/mobile/resources/css/app-material.css b/apps/spreadsheeteditor/mobile/resources/css/app-material.css index d1815863b..dd99508dd 100644 --- a/apps/spreadsheeteditor/mobile/resources/css/app-material.css +++ b/apps/spreadsheeteditor/mobile/resources/css/app-material.css @@ -7450,3 +7450,32 @@ html.pixel-ratio-3 .cell-styles.dataview .row li { .lang-flag.es-MX { background-position: -16px -192px; } +.doc-placeholder { + background: #fbfbfb; + width: 100%; + height: 100%; + border: 1px solid #dfdfdf; + white-space: nowrap; + padding-top: 0; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; +} +.doc-placeholder > .columns { + width: 100%; + height: 100%; + display: inline-block; + background: linear-gradient(90deg, #d5d5d5 0px, rgba(0, 0, 0, 0) 1px) 0 0, linear-gradient(rgba(0, 255, 0, 0) 19px, #d5d5d5 20px) 0 0, linear-gradient(#f1f1f1 0px, #f1f1f1 20px) 0 0 repeat-x; + background-size: 80px 20px; + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; +} +.doc-placeholder > .columns:first-child { + background: linear-gradient(#f1f1f1 19px, #d5d5d5 20px) 0 0; + background-size: 20px 20px; + width: 35px; +} diff --git a/apps/spreadsheeteditor/mobile/resources/less/app-ios.less b/apps/spreadsheeteditor/mobile/resources/less/app-ios.less index 44991a56a..c370b84f6 100644 --- a/apps/spreadsheeteditor/mobile/resources/less/app-ios.less +++ b/apps/spreadsheeteditor/mobile/resources/less/app-ios.less @@ -289,4 +289,41 @@ input, textarea { &.zh, &.zh-CN {background-position: -32px -180px;} &.ja, &.ja-JP {background-position: 0 -192px;} &.es-MX {background-position: -16px -192px;} +} + +// Skeleton of workbook + +.doc-placeholder { + background: #fbfbfb; + width: 100%; + height: 100%; + border: 1px solid #dfdfdf; + white-space: nowrap; + padding-top: 0; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + + > .columns { + width: 100%; + height: 100%; + display: inline-block; + background: linear-gradient(90deg, #d5d5d5 0px, rgba(0,0,0,0) 1px) 0 0, + linear-gradient(rgba(0,255,0,0) 19px, #d5d5d5 20px) 0 0, + linear-gradient( #f1f1f1 0px, #f1f1f1 20px) 0 0 repeat-x; + background-size: 80px 20px; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + + &:first-child { + background: linear-gradient(#f1f1f1 19px, #d5d5d5 20px) 0 0; + background-size: 20px 20px; + width: 35px; + } + } } \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/resources/less/app-material.less b/apps/spreadsheeteditor/mobile/resources/less/app-material.less index af682c430..b69f06340 100644 --- a/apps/spreadsheeteditor/mobile/resources/less/app-material.less +++ b/apps/spreadsheeteditor/mobile/resources/less/app-material.less @@ -277,4 +277,41 @@ input, textarea { &.zh, &.zh-CN {background-position: -32px -180px;} &.ja, &.ja-JP {background-position: 0 -192px;} &.es-MX {background-position: -16px -192px;} +} + +// Skeleton of workbook + +.doc-placeholder { + background: #fbfbfb; + width: 100%; + height: 100%; + border: 1px solid #dfdfdf; + white-space: nowrap; + padding-top: 0; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + + > .columns { + width: 100%; + height: 100%; + display: inline-block; + background: linear-gradient(90deg, #d5d5d5 0px, rgba(0,0,0,0) 1px) 0 0, + linear-gradient(rgba(0,255,0,0) 19px, #d5d5d5 20px) 0 0, + linear-gradient( #f1f1f1 0px, #f1f1f1 20px) 0 0 repeat-x; + background-size: 80px 20px; + + -webkit-animation: flickerAnimation 2s infinite ease-in-out; + -moz-animation: flickerAnimation 2s infinite ease-in-out; + -o-animation: flickerAnimation 2s infinite ease-in-out; + animation: flickerAnimation 2s infinite ease-in-out; + + &:first-child { + background: linear-gradient(#f1f1f1 19px, #d5d5d5 20px) 0 0; + background-size: 20px 20px; + width: 35px; + } + } } \ No newline at end of file diff --git a/build/documenteditor.json b/build/documenteditor.json index 0bdc55f0a..4576d80e6 100644 --- a/build/documenteditor.json +++ b/build/documenteditor.json @@ -168,6 +168,10 @@ { "src": "../apps/documenteditor/main/index.html.deploy", "dest": "../deploy/web-apps/apps/documenteditor/main/index.html" + }, + { + "src": "../apps/documenteditor/main/index_loader.html.deploy", + "dest": "../deploy/web-apps/apps/documenteditor/main/index_loader.html" } ] }, @@ -335,7 +339,8 @@ } ], "index-page": { - "../deploy/web-apps/apps/documenteditor/mobile/index.html": "../apps/documenteditor/mobile/index.html.deploy" + "../deploy/web-apps/apps/documenteditor/mobile/index.html": "../apps/documenteditor/mobile/index.html.deploy", + "../deploy/web-apps/apps/documenteditor/mobile/index_loader.html": "../apps/documenteditor/mobile/index_loader.html.deploy" }, "localization": [ { diff --git a/build/presentationeditor.json b/build/presentationeditor.json index aa44ac433..64a0c8ce9 100644 --- a/build/presentationeditor.json +++ b/build/presentationeditor.json @@ -162,6 +162,10 @@ { "src": "../apps/presentationeditor/main/index.html.deploy", "dest": "../deploy/web-apps/apps/presentationeditor/main/index.html" + }, + { + "src": "../apps/presentationeditor/main/index_loader.html.deploy", + "dest": "../deploy/web-apps/apps/presentationeditor/main/index_loader.html" } ] }, @@ -338,7 +342,8 @@ } ], "index-page": { - "../deploy/web-apps/apps/presentationeditor/mobile/index.html": "../apps/presentationeditor/mobile/index.html.deploy" + "../deploy/web-apps/apps/presentationeditor/mobile/index.html": "../apps/presentationeditor/mobile/index.html.deploy", + "../deploy/web-apps/apps/presentationeditor/mobile/index_loader.html": "../apps/presentationeditor/mobile/index_loader.html.deploy" }, "localization": [ { @@ -398,10 +403,10 @@ "copy": { "localization": [ { - "expand": true, - "cwd": "../apps/presentationeditor/embed/locale/", - "src": "*", - "dest": "../deploy/web-apps/apps/presentationeditor/embed/locale/" + "expand": true, + "cwd": "../apps/presentationeditor/embed/locale/", + "src": "*", + "dest": "../deploy/web-apps/apps/presentationeditor/embed/locale/" } ], "index-page": { diff --git a/build/spreadsheeteditor.json b/build/spreadsheeteditor.json index 03ddcf098..8dca7d52c 100644 --- a/build/spreadsheeteditor.json +++ b/build/spreadsheeteditor.json @@ -176,6 +176,10 @@ { "src": "../apps/spreadsheeteditor/main/index.html.deploy", "dest": "../deploy/web-apps/apps/spreadsheeteditor/main/index.html" + }, + { + "src": "../apps/spreadsheeteditor/main/index_loader.html.deploy", + "dest": "../deploy/web-apps/apps/spreadsheeteditor/main/index_loader.html" } ] }, @@ -340,7 +344,8 @@ } ], "index-page": { - "../deploy/web-apps/apps/spreadsheeteditor/mobile/index.html": "../apps/spreadsheeteditor/mobile/index.html.deploy" + "../deploy/web-apps/apps/spreadsheeteditor/mobile/index.html": "../apps/spreadsheeteditor/mobile/index.html.deploy", + "../deploy/web-apps/apps/spreadsheeteditor/mobile/index_loader.html": "../apps/spreadsheeteditor/mobile/index_loader.html.deploy" }, "localization": [ {