diff --git a/apps/presentationeditor/main/app/controller/SlideMasterTab.js b/apps/presentationeditor/main/app/controller/SlideMasterTab.js index c7ec4c5f63..5045dd77d5 100644 --- a/apps/presentationeditor/main/app/controller/SlideMasterTab.js +++ b/apps/presentationeditor/main/app/controller/SlideMasterTab.js @@ -31,9 +31,9 @@ */ /** - * ViewTab.js + * SlideMasterTab.js * - * Created on 07.12.2021 + * Created on 01.06.2025 * */ @@ -56,30 +56,13 @@ define([ var me = this; this.checkInsertAutoshape = function(e) { - console.log('check inster autoshape') var cmp = $(e.target), - cmp_sdk = cmp.closest('#editor_sdk'), - btn_id = cmp.closest('button').attr('id'); - if (btn_id===undefined) - btn_id = cmp.closest('.btn-group').attr('id'); - if (btn_id===undefined) - btn_id = cmp.closest('.combo-dataview').attr('id'); - - if (cmp.attr('id') != 'editor_sdk' && cmp_sdk.length<=0) { - if ( me.toolbar.btnsInsertText && me.toolbar.btnsInsertText.pressed() && !me.toolbar.btnsInsertText.contains(btn_id) || - me.toolbar.cmbsInsertShape && me.toolbar.cmbsInsertShape.some(function(cmb) { - return cmb.isComboViewRecActive() && cmb.id !== btn_id; - }) || - me.toolbar.btnInsertPlaceholder && me.toolbar.btnInsertPlaceholder.pressed && me.toolbar.btnInsertPlaceholder.id !== btn_id) - { + cmp_sdk = cmp.closest('#editor_sdk'); + if (cmp.attr('id') !== 'editor_sdk' && cmp_sdk.length <= 0) { + if (me.view.btnInsertPlaceholder && me.view.btnInsertPlaceholder.pressed) { me._isAddingShape = false; - - me.toolbar.btnsInsertText && me.toolbar.btnsInsertText.toggle(false, true); - me.toolbar.cmbsInsertShape && me.toolbar.cmbsInsertShape.forEach(function(cmb) { - cmb.deactivateRecords(); - }); - me.toolbar.btnInsertPlaceholder && me.toolbar.btnInsertPlaceholder.toggle(false, true); - Common.NotificationCenter.trigger('edit:complete', this.view); + me.view.btnInsertPlaceholder.toggle(false, true); + Common.NotificationCenter.trigger('edit:complete', me.view); } } }; @@ -136,7 +119,7 @@ define([ in_slide_master = pr.get_IsMasterSelected(); } } - this.toolbar.toolbar.lockToolbar(Common.enumLock.inSlideMaster, in_slide_master, { + Common.Utils.lockControls(Common.enumLock.inSlideMaster, in_slide_master, { array: [ this.view.btnInsertPlaceholder, this.view.chTitle, @@ -272,7 +255,7 @@ define([ this._addPlaceHolder(btn.pressed, value, isVertical); - Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.NotificationCenter.trigger('edit:complete', this.view); Common.component.Analytics.trackEvent('SlideMasterTab', 'Add Placeholder'); }, diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 9895d194b4..593abb5cb5 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -135,12 +135,6 @@ define([ 'insert:smartart' : this.onInsertSmartArt, 'smartart:mouseenter': this.mouseenterSmartArt, 'smartart:mouseleave': this.mouseleaveSmartArt, - 'insert:slide-master': this.onInsertSlideMaster.bind(this), - 'insert:layout' : this.onInsertLayout.bind(this), - 'insert:placeholder-btn': this.onBtnInsertPlaceholder.bind(this), - 'insert:placeholder-menu': this.onMenuInsertPlaceholder.bind(this), - 'title:hide' : this.onTitleHide.bind(this), - 'footers:hide' : this.onFootersHide.bind(this), 'tab:active' : this.onActiveTab.bind(this), 'tab:collapse' : this.onTabCollapse.bind(this) }, @@ -225,8 +219,7 @@ define([ if ( me.toolbar.btnsInsertText.pressed() && !me.toolbar.btnsInsertText.contains(btn_id) || me.toolbar.cmbsInsertShape.some(function(cmb) { return cmb.isComboViewRecActive() && cmb.id !== btn_id; - }) || - me.toolbar.btnInsertPlaceholder.pressed && me.toolbar.btnInsertPlaceholder.id !== btn_id) + })) { me._isAddingShape = false; @@ -235,7 +228,6 @@ define([ me.toolbar.cmbsInsertShape.forEach(function(cmb) { cmb.deactivateRecords(); }); - me.toolbar.btnInsertPlaceholder.toggle(false, true); Common.NotificationCenter.trigger('edit:complete', me.toolbar); } } @@ -256,9 +248,6 @@ define([ cmb.deactivateRecords(); }); - if (this.toolbar.btnInsertPlaceholder.pressed) - this.toolbar.btnInsertPlaceholder.toggle(false, true); - $(document.body).off('mouseup', checkInsertAutoshape); }; @@ -273,18 +262,6 @@ define([ } } }; - - this._addPlaceHolder = function (isstart, type, isVertical) { - if (this.api) { - if (isstart) { - this.api.asc_StartAddPlaceholder(type, isVertical, true); - $(document.body).on('mouseup', checkInsertAutoshape); - } else { - this.api.asc_StartAddPlaceholder('', undefined, false); - $(document.body).off('mouseup', checkInsertAutoshape); - } - } - } }, onLaunch: function() { @@ -482,8 +459,6 @@ define([ this.api.asc_registerCallback('asc_onLockSlideHdrFtrApplyToAll', _.bind(this.onApiLockSlideHdrFtrApplyToAll, this, true)); this.api.asc_registerCallback('asc_onUnLockSlideHdrFtrApplyToAll', _.bind(this.onApiLockSlideHdrFtrApplyToAll, this, false)); - this.api.asc_registerCallback('asc_onLayoutTitle', _.bind(this.onApiLayoutTitle, this)); - this.api.asc_registerCallback('asc_onLayoutFooter', _.bind(this.onApiLayoutFooter, this)); } else if (this.mode.isRestrictedEdit) { this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPagesRestricted, this)); } @@ -999,11 +974,6 @@ define([ this.toolbar.mnuArrangeBackward.setDisabled(in_smartart_internal); } - if (this._state.in_slide_master !== in_slide_master) { - this.toolbar.lockToolbar(Common.enumLock.inSlideMaster, in_slide_master, {array: [me.toolbar.btnInsertPlaceholder, me.toolbar.chTitle, me.toolbar.chFooters]}); - this._state.in_slide_master = in_slide_master; - } - if (!this.toolbar.btnShapesMerge.isDisabled() && this.toolbar.isTabActive('home')) Common.UI.TooltipManager.showTip('mergeShapes'); }, @@ -2846,6 +2816,7 @@ define([ me.toolbar.setVisible('slideMaster', !visible); !editmode && !compactview && visible && Common.Utils.InternalSettings.set('toolbar-active-tab', 'view'); // need to activate later } + config.isEdit && Array.prototype.push.apply(me.toolbar.lockControls, slideMasterTab.getView('SlideMasterTab').getButtons()); }, onAppReady: function (config) { @@ -3046,7 +3017,7 @@ define([ this.toolbar.setTab('slideMaster'); } else { Common.NotificationCenter.trigger('tab:visible', 'slideMaster', false); - this.toolbar.setTab('view'); + this.toolbar.setTab('home'); this.showStaticElements(); } @@ -3054,96 +3025,6 @@ define([ Common.NotificationCenter.trigger('tab:visible', 'animate', !isMaster); }, - onInsertSlideMaster: function () { - this.api.asc_AddMasterSlide(); - }, - - onInsertLayout: function () { - this.api.asc_AddSlideLayout(); - }, - - onBtnInsertPlaceholder: function (btn, e) { - btn.menu.getItems(true).forEach(function(item) { - if(item.value == btn.options.currentType) - item.setChecked(true); - }); - if(!btn.pressed) { - btn.menu.clearAll(true); - } - this.onInsertPlaceholder(btn.options.currentType, btn, e); - }, - - onMenuInsertPlaceholder: function (btn, e) { - var oldType = btn.options.currentType; - var newType = e.value; - - if(newType != oldType){ - btn.updateHint([e.options.hintForMainBtn, this.views.Toolbar.prototype.tipInsertPlaceholder]); - btn.changeIcon({ - next: e.options.iconClsForMainBtn, - curr: btn.menu.getItems(true).filter(function(item){return item.value == oldType})[0].options.iconClsForMainBtn - }); - btn.options.currentType = newType; - } - this.onInsertPlaceholder(newType, btn, e); - }, - - onInsertPlaceholder: function (type, btn, e) { - var value, - isVertical; - switch (type) { - case 1: - value = null; - break; - case 2: - value = null; - isVertical = true; - break; - case 3: - value = AscFormat.phType_body; - break; - case 4: - value = AscFormat.phType_body; - isVertical = true; - break; - case 5: - value = AscFormat.phType_pic; - break; - case 6: - value = AscFormat.phType_chart; - break; - case 7: - value = AscFormat.phType_tbl; - break; - case 8: - value = AscFormat.phType_dgm; - break; - } - - this._addPlaceHolder(btn.pressed, value, isVertical); - - Common.NotificationCenter.trigger('edit:complete', this.toolbar); - Common.component.Analytics.trackEvent('ToolBar', 'Add Placeholder'); - }, - - onTitleHide: function (view, status) { - this.api.asc_setLayoutTitle(status); - }, - - onFootersHide: function (view, status) { - this.api.asc_setLayoutFooter(status); - }, - - onApiLayoutTitle: function (status) { - if ((this.toolbar.chTitle.getValue() === 'checked') !== status) - this.toolbar.chTitle.setValue(status, true); - }, - - onApiLayoutFooter: function (status) { - if ((this.toolbar.chFooters.getValue() === 'checked') !== status) - this.toolbar.chFooters.setValue(status, true); - }, - onActiveTab: function(tab) { if (tab !== 'home') { Common.UI.TooltipManager.closeTip('tabDesign'); diff --git a/apps/presentationeditor/main/app/template/Toolbar.template b/apps/presentationeditor/main/app/template/Toolbar.template index 8f7ebc4fc6..40c5004145 100644 --- a/apps/presentationeditor/main/app/template/Toolbar.template +++ b/apps/presentationeditor/main/app/template/Toolbar.template @@ -46,11 +46,6 @@ -
-