diff --git a/apps/common/main/lib/component/Mixtbar.js b/apps/common/main/lib/component/Mixtbar.js index 96169d94e..6e48e4261 100644 --- a/apps/common/main/lib/component/Mixtbar.js +++ b/apps/common/main/lib/component/Mixtbar.js @@ -74,7 +74,7 @@ define([ if ( this.isFolded ) { if ( $(e.target).parents('.toolbar, #file-menu-panel').length ){ } else { - this.collapse(); + optsFold.$bar && optsFold.$bar.hasClass('expanded') && this.collapse(); } } } diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index ac62e2895..1903c5307 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -41,7 +41,6 @@ define([ 'core', - 'common/main/lib/component/Calendar', 'documenteditor/main/app/view/Links', 'documenteditor/main/app/view/NoteSettingsDialog', 'documenteditor/main/app/view/HyperlinkSettingsDialog', @@ -96,7 +95,6 @@ define([ Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onShowContentControlsActions',_.bind(this.onShowContentControlsActions, this)); this.api.asc_registerCallback('asc_onHideContentControlsActions',_.bind(this.onHideContentControlsActions, this)); - } return this; }, @@ -402,155 +400,10 @@ define([ onHideContentControlsActions: function() { this.view.contentsMenu && this.view.contentsMenu.hide(); this.view.contentsUpdateMenu && this.view.contentsUpdateMenu.hide(); - this.view.listControlMenu && this.view.listControlMenu.isVisible() && this.view.listControlMenu.hide(); - var controlsContainer = this.getApplication().getController('DocumentHolder').documentHolder.cmpEl.find('#calendar-control-container'); - if (controlsContainer.is(':visible')) - controlsContainer.hide(); - }, - - onShowDateActions: function(obj, x, y) { - var props = obj.pr, - specProps = props.get_DateTimePr(), - documentHolderView = this.getApplication().getController('DocumentHolder').documentHolder, - controlsContainer = documentHolderView.cmpEl.find('#calendar-control-container'), - me = this; - - this._state.dateObj = props; - - if (controlsContainer.length < 1) { - controlsContainer = $('
'); - documentHolderView.cmpEl.append(controlsContainer); - } - - Common.UI.Menu.Manager.hideAll(); - - controlsContainer.css({left: x, top : y}); - controlsContainer.show(); - - if (!this.cmpCalendar) { - this.cmpCalendar = new Common.UI.Calendar({ - el: documentHolderView.cmpEl.find('#id-document-calendar-control'), - enableKeyEvents: true, - firstday: 1 - }); - this.cmpCalendar.on('date:click', function (cmp, date) { - var props = me._state.dateObj, - specProps = props.get_DateTimePr(), - id = props.get_InternalId(); - specProps.put_FullDate(new Date(date)); - me.api.asc_SetContentControlProperties(props, id); - controlsContainer.hide(); - me.api.asc_UncheckContentControlButtons(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar); - }); - this.cmpCalendar.on('calendar:keydown', function (cmp, e) { - if (e.keyCode==Common.UI.Keys.ESC) { - controlsContainer.hide(); - me.api.asc_UncheckContentControlButtons(); - } - }); - } - this.cmpCalendar.setDate(new Date(specProps ? specProps.get_FullDate() : undefined)); - - // align - var offset = controlsContainer.offset(), - docW = Common.Utils.innerWidth(), - docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number - menuW = this.cmpCalendar.cmpEl.outerWidth(), - menuH = this.cmpCalendar.cmpEl.outerHeight(), - buttonOffset = 22, - left = offset.left - menuW, - top = offset.top; - if (top + menuH > docH) { - top = docH - menuH; - left -= buttonOffset; - } - if (top < 0) - top = 0; - if (left + menuW > docW) - left = docW - menuW; - this.cmpCalendar.cmpEl.css({left: left, top : top}); - - documentHolderView._preventClick = true; - }, - - onShowListActions: function(obj, x, y) { - var type = obj.type, - props = obj.pr, - specProps = (type == Asc.c_oAscContentControlSpecificType.ComboBox) ? props.get_ComboBoxPr() : props.get_DropDownListPr(), - menu = this.view.listControlMenu, - documentHolderView = this.getApplication().getController('DocumentHolder').documentHolder, - menuContainer = menu ? documentHolderView.cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null, - me = this; - - this._state.listObj = props; - - this._fromShowContentControls = true; - Common.UI.Menu.Manager.hideAll(); - - if (!menu) { - this.view.listControlMenu = menu = new Common.UI.Menu({ - menuAlign: 'tr-bl', - items: [] - }); - menu.on('item:click', function(menu, item) { - setTimeout(function(){ - me.api.asc_SelectContentControlListItem(item.value, me._state.listObj.get_InternalId()); - }, 1); - }); - - // Prepare menu container - if (!menuContainer || menuContainer.length < 1) { - menuContainer = $(Common.Utils.String.format('', menu.id)); - documentHolderView.cmpEl.append(menuContainer); - } - - menu.render(menuContainer); - menu.cmpEl.attr({tabindex: "-1"}); - menu.on('hide:after', function(){ - me.view.listControlMenu.removeAll(); - if (!me._fromShowContentControls) - me.api.asc_UncheckContentControlButtons(); - }); - } - if (specProps) { - var count = specProps.get_ItemsCount(); - for (var i=0; i
'); + this.cmpEl.append(controlsContainer); + } + + Common.UI.Menu.Manager.hideAll(); + + controlsContainer.css({left: x, top : y}); + controlsContainer.show(); + + if (!this.cmpCalendar) { + this.cmpCalendar = new Common.UI.Calendar({ + el: this.cmpEl.find('#id-document-calendar-control'), + enableKeyEvents: true, + firstday: 1 + }); + this.cmpCalendar.on('date:click', function (cmp, date) { + var props = me._dateObj, + specProps = props.get_DateTimePr(), + id = props.get_InternalId(); + specProps.put_FullDate(new Date(date)); + me.api.asc_SetContentControlProperties(props, id); + controlsContainer.hide(); + me.api.asc_UncheckContentControlButtons(); + me.fireEvent('editcomplete', me); + }); + this.cmpCalendar.on('calendar:keydown', function (cmp, e) { + if (e.keyCode==Common.UI.Keys.ESC) { + controlsContainer.hide(); + me.api.asc_UncheckContentControlButtons(); + } + }); + } + this.cmpCalendar.setDate(new Date(specProps ? specProps.get_FullDate() : undefined)); + + // align + var offset = controlsContainer.offset(), + docW = Common.Utils.innerWidth(), + docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number + menuW = this.cmpCalendar.cmpEl.outerWidth(), + menuH = this.cmpCalendar.cmpEl.outerHeight(), + buttonOffset = 22, + left = offset.left - menuW, + top = offset.top; + if (top + menuH > docH) { + top = docH - menuH; + left -= buttonOffset; + } + if (top < 0) + top = 0; + if (left + menuW > docW) + left = docW - menuW; + this.cmpCalendar.cmpEl.css({left: left, top : top}); + + this._preventClick = true; + }, + + onShowListActions: function(obj, x, y) { + var type = obj.type, + props = obj.pr, + specProps = (type == Asc.c_oAscContentControlSpecificType.ComboBox) ? props.get_ComboBoxPr() : props.get_DropDownListPr(), + menu = this.listControlMenu, + menuContainer = menu ? this.cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null, + me = this; + + this._listObj = props; + + this._fromShowContentControls = true; + Common.UI.Menu.Manager.hideAll(); + + if (!menu) { + this.listControlMenu = menu = new Common.UI.Menu({ + menuAlign: 'tr-bl', + items: [] + }); + menu.on('item:click', function(menu, item) { + setTimeout(function(){ + me.api.asc_SelectContentControlListItem(item.value, me._listObj.get_InternalId()); + }, 1); + }); + + // Prepare menu container + if (!menuContainer || menuContainer.length < 1) { + menuContainer = $(Common.Utils.String.format('', menu.id)); + this.cmpEl.append(menuContainer); + } + + menu.render(menuContainer); + menu.cmpEl.attr({tabindex: "-1"}); + menu.on('hide:after', function(){ + me.listControlMenu.removeAll(); + if (!me._fromShowContentControls) + me.api.asc_UncheckContentControlButtons(); + }); + } + if (specProps) { + var count = specProps.get_ItemsCount(); + for (var i=0; i