diff --git a/apps/common/main/lib/component/DataView.js b/apps/common/main/lib/component/DataView.js index 1ecdf581b8..90c05193a5 100644 --- a/apps/common/main/lib/component/DataView.js +++ b/apps/common/main/lib/component/DataView.js @@ -672,10 +672,11 @@ define([ }); } + this.attachKeyEvents(); + if (this.disabled) this.setDisabled(this.disabled); - this.attachKeyEvents(); this.lastSelectedRec = null; this._layoutParams = undefined; }, @@ -989,7 +990,7 @@ define([ if (this.enableKeyEvents && this.handleSelect) { var el = $(this.el).find('.inner').addBack().filter('.inner'); el.addClass('canfocused'); - el.attr('tabindex', this.tabindex.toString()); + el.attr('tabindex', (this.tabindex || 0).toString()); el.on((this.parentMenu && this.useBSKeydown) ? 'dataview:keydown' : 'keydown', _.bind(this.onKeyDown, this)); el.on((this.parentMenu && this.useBSKeydown) ? 'dataview:keyup' : 'keyup', _.bind(this.onKeyUp, this)); } @@ -1013,6 +1014,12 @@ define([ disabled = !!disabled; this.disabled = disabled; $(this.el).find('.inner').addBack().filter('.inner').toggleClass('disabled', disabled); + + if (this.tabindex!==undefined) { + var el = $(this.el).find('.inner').addBack().filter('.inner'); + disabled && (this.tabindex = el.attr('tabindex')); + el.attr('tabindex', disabled ? "-1" : this.tabindex); + } }, isDisabled: function() { diff --git a/apps/common/main/lib/component/TreeView.js b/apps/common/main/lib/component/TreeView.js index 3d2d73fb70..2ef0e97cea 100644 --- a/apps/common/main/lib/component/TreeView.js +++ b/apps/common/main/lib/component/TreeView.js @@ -254,6 +254,8 @@ define([ }, onClickItem: function(view, record, e) { + if ( this.disabled ) return; + var btn = $(e.target); if (btn && (btn.hasClass('tree-caret') || btn.hasClass('btn-tree-caret'))) { var tip = view.$el.data('bs.tooltip'); diff --git a/apps/common/main/resources/less/treeview.less b/apps/common/main/resources/less/treeview.less index d2c3db66d8..ca7ce5cd5a 100644 --- a/apps/common/main/resources/less/treeview.less +++ b/apps/common/main/resources/less/treeview.less @@ -20,7 +20,7 @@ } } - &:focus { + &:focus:not(.disabled) { border-color: @border-preview-select-ie; border-color: @border-preview-select; } @@ -31,12 +31,6 @@ .box-shadow(none); margin: 0; - &:hover, - &.over { - background-color: @highlight-button-hover-ie; - background-color: @highlight-button-hover; - } - &.selected { background-color: @highlight-button-pressed-ie; background-color: @highlight-button-pressed; @@ -47,7 +41,14 @@ &.selected .empty { visibility: hidden; } + } + &:not(.disabled) > .item { + &:hover, + &.over { + background-color: @highlight-button-hover-ie; + background-color: @highlight-button-hover; + } } .tree-item { @@ -95,6 +96,18 @@ } } } + + &.disabled { + > .item { + cursor: default; + opacity: @component-disabled-opacity-ie; + opacity: @component-disabled-opacity; + } + + .tree-caret { + cursor: default; + } + } } .safari { diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index b41e906d5a..6761785c19 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -165,7 +165,7 @@ define([ me.api.asc_enableKeyEvents(false); }, 'modal:close': function(dlg) { - Common.Utils.ModalWindow.close(); + dlg && dlg.isVisible() && Common.Utils.ModalWindow.close(); // close can be called after hiding if (!Common.Utils.ModalWindow.isVisible()) me.api.asc_enableKeyEvents(true); }, diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index a10e65c41a..5519e3d2ec 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -356,7 +356,7 @@ define([ me.api.asc_enableKeyEvents(false); }, 'modal:close': function(dlg) { - Common.Utils.ModalWindow.close(); + dlg && dlg.isVisible() && Common.Utils.ModalWindow.close(); // close can be called after hiding if (!Common.Utils.ModalWindow.isVisible()) me.api.asc_enableKeyEvents(true); }, diff --git a/apps/pdfeditor/main/app/controller/DocumentHolder.js b/apps/pdfeditor/main/app/controller/DocumentHolder.js index 65ba69af6b..16d710c698 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolder.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolder.js @@ -286,6 +286,7 @@ define([ var i = -1, in_equation = false, in_chart = false, + no_paragraph = true, locked = false; while (++i < selectedElements.length) { var type = selectedElements[i].get_ObjectType(); @@ -294,12 +295,17 @@ define([ } else if (type === Asc.c_oAscTypeSelectElement.Paragraph) { var value = selectedElements[i].get_ObjectValue(); value && (locked = locked || value.get_Locked()); + no_paragraph = false; } else if (type === Asc.c_oAscTypeSelectElement.Shape) { // shape var value = selectedElements[i].get_ObjectValue(); if (value && value.get_FromChart()) { in_chart = true; locked = locked || value.get_Locked(); } + if (value && !value.get_FromImage() && !value.get_FromChart()) + no_paragraph = false; + } else if (type == Asc.c_oAscTypeSelectElement.Table) { + no_paragraph = false; } } if (in_equation) { @@ -310,6 +316,7 @@ define([ this._state.chartLocked = locked; this.disableChartElementButton(); } + this._state.no_paragraph = no_paragraph; } }, diff --git a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js index 86f7b23052..99342fa8cc 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js @@ -162,6 +162,7 @@ define([], function () { view.menuAddHyperlinkTable.on('click', _.bind(me.addHyperlink, me)); view.menuEditHyperlinkPara.on('click', _.bind(me.editHyperlink, me)); view.menuEditHyperlinkTable.on('click', _.bind(me.editHyperlink, me)); + view.menuPDFEditHyperlink.on('click', _.bind(me.editHyperlink, me)); view.menuRemoveHyperlinkPara.on('click', _.bind(me.removeHyperlink, me)); view.menuRemoveHyperlinkTable.on('click', _.bind(me.removeHyperlink, me)); view.menuChartEdit.on('click', _.bind(me.editChartClick, me, undefined)); @@ -1963,7 +1964,8 @@ define([], function () { dh.editHyperlink = function(item, e){ var win, me = this; if (me.api){ - var _arr = []; + var _arr = [], + isAnnotation = item.annotProps && item.annotProps.value; for (var i=0; i', + '
', '
', '', '', @@ -78,25 +77,27 @@ define([], function () { 'use strict'; '', '
', '', + '', '
', - '
', + '
', '', '
', - '', - '
', + '', + '
', '', '
', - '', + '', '
' ].join(''); - this.options.tpl = _.template(this.template)(this.options); - this.slides = this.options.slides; - this.api = this.options.api; + _options.tpl = _.template(this.template)(_options); + this.slides = _options.slides; + this.api = _options.api; this.urlType = AscCommon.c_oAscUrlType.Invalid; - this.appOptions = this.options.appOptions; + this.appOptions = _options.appOptions; + this.isAnnotation = !!_options.isAnnotation; - Common.UI.Window.prototype.initialize.call(this, this.options); + Common.UI.Window.prototype.initialize.call(this, _options); }, render: function() { @@ -180,6 +181,15 @@ define([], function () { 'use strict'; }); me.internalList.on('item:select', _.bind(this.onSelectItem, this)); + me.chPageView = new Common.UI.CheckBox({ + el: $window.find('#id-dlg-hyperlink-chb-page'), + labelText: this.txtPageView + }).on('change', function(field, newValue, oldValue, eOpts){ + me.internalList.setDisabled(newValue==='checked'); + var rec = me.internalList.getSelectedRec(); + me.btnOk.setDisabled((!rec || rec.get('index')==4) && (newValue!=='checked')); + }); + me.btnOk = _.find(this.getFooterButtons(), function (item) { return (item.$el && item.$el.find('.primary').addBack().filter('.primary').length>0); }) || new Common.UI.Button({ el: $window.find('.primary') }); @@ -189,10 +199,15 @@ define([], function () { 'use strict'; me.internalList.on('entervalue', _.bind(me.onPrimary, me)); me.externalPanel = $window.find('#id-external-link'); me.internalPanel = $window.find('#id-internal-link'); + + if (me.isAnnotation) { + $window.find('.not-annotation').addClass('hidden'); + } else + me.chPageView.setVisible(false); }, getFocusedComponents: function() { - return [this.btnExternal, this.btnInternal, this.inputUrl, this.internalList, this.inputDisplay, this.inputTip].concat(this.getFooterButtons()); + return [this.btnExternal, this.btnInternal, this.inputUrl, this.internalList, this.inputDisplay, this.inputTip, this.chPageView].concat(this.getFooterButtons()); }, setSettings: function (props) { @@ -214,7 +229,11 @@ define([], function () { 'use strict'; this.isTextChanged = false; this.inputTip.setValue(props.get_ToolTip()); + this.isAnnotation && this.chPageView.setValue(props.get_PageView()); me._originalProps = props; + } else { + this.btnExternal.toggle(true); + this.ShowHideElem(c_oHyperlinkType.WebLink); } }, @@ -233,7 +252,7 @@ define([], function () { 'use strict'; tip = rec.get('tiptext'); } props.put_Value( url ); - props.put_ToolTip(_.isEmpty(txttip) ? tip : txttip); + !this.isAnnotation && props.put_ToolTip(_.isEmpty(txttip) ? tip : txttip); def_display = tip; } else { var url = $.trim(me.inputUrl.getValue()); @@ -241,17 +260,17 @@ define([], function () { 'use strict'; url = ( (me.urlType==AscCommon.c_oAscUrlType.Email) ? 'mailto:' : 'http://' ) + url; url = url.replace(new RegExp("%20",'g')," "); props.put_Value( url ); - props.put_ToolTip(me.inputTip.getValue()); + !this.isAnnotation && props.put_ToolTip(me.inputTip.getValue()); def_display = url; } if (!me.inputDisplay.isDisabled() && (me.isTextChanged || _.isEmpty(me.inputDisplay.getValue()))) { if (_.isEmpty(me.inputDisplay.getValue()) || type==c_oHyperlinkType.WebLink && me.isAutoUpdate) me.inputDisplay.setValue(def_display); - props.put_Text(me.inputDisplay.getValue()); + !this.isAnnotation && props.put_Text(me.inputDisplay.getValue()); } else - props.put_Text(null); + !this.isAnnotation && props.put_Text(null); return props; }, @@ -272,18 +291,77 @@ define([], function () { 'use strict'; if (this.options.handler) { if (state == 'ok') { - var checkurl = (this.btnExternal.isActive()) ? this.inputUrl.checkValidate() : true, - checkdisp = this.inputDisplay.checkValidate(); + if (this.isAnnotation && this.btnInternal.isActive() && this.chPageView.getValue()==='checked') { + var me = this; + me.hide(); + + Common.NotificationCenter.trigger('editing:disable', true, { + viewMode: true, + allowSignature: false, + statusBar: true, + rightMenu: {clear: true, disable: true}, + leftMenu: {disable: true, previewMode: true}, + fileMenu: {protect: true}, + navigation: {disable: true, previewMode: true}, + comments: {disable: true, previewMode: true}, + chat: true, + viewport: true, + documentHolder: {clear: true, disable: true}, + toolbar: true, + plugins: false, + header: {docmode: true, search: true}, + shortcuts: true + }, 'setlink'); + me.api.SetCanInteract(false); + Common.UI.alert({ + modal: false, + maxwidth: 400, + title: this.txtCreateLink, + msg: this.txtCreateDesc, + buttons: [ {caption: this.txtSetLink, primary: true, value: 'ok'}, + 'cancel'], + callback: function(btn){ + if (btn === 'ok') { + me.options.handler.call(me, me, 'view'); + } + me.close(); + Common.NotificationCenter.trigger('editing:disable', false, { + viewMode: false, + allowSignature: false, + statusBar: true, + rightMenu: {clear: true, disable: true}, + leftMenu: {disable: true, previewMode: true}, + fileMenu: {protect: true}, + navigation: {disable: true, previewMode: true}, + comments: {disable: true, previewMode: true}, + chat: true, + viewport: true, + documentHolder: {clear: true, disable: true}, + toolbar: true, + plugins: false, + header: {docmode: true, search: true}, + shortcuts: true + }, 'setlink'); + me.api.SetCanInteract(true); + } + }); + return; + } + + var checkurl = (this.btnExternal.isActive()) ? this.inputUrl.checkValidate() : true; if (checkurl !== true) { this.isInputFirstChange = true; this.inputUrl.focus(); return; } - if (checkdisp !== true) { - this.inputDisplay.focus(); - return; + if (!this.isAnnotation) { + var checkdisp = this.inputDisplay.checkValidate(); + if (checkdisp !== true) { + this.inputDisplay.focus(); + return; + } + !this._originalProps.get_Value() && Common.Utils.InternalSettings.set("pdfe-settings-link-type", this.btnInternal.isActive()); } - !this._originalProps.get_Value() && Common.Utils.InternalSettings.set("pdfe-settings-link-type", this.btnInternal.isActive()); } this.options.handler.call(this, this, state); } @@ -378,7 +456,7 @@ define([], function () { 'use strict'; } var rec = this.internalList.getSelectedRec(); rec && this.internalList.scrollToRecord(rec); - this.btnOk.setDisabled(!rec || rec.get('index')==4); + this.btnOk.setDisabled((!rec || rec.get('index')==4) && !(this.isAnnotation && this.chPageView.getValue()==='checked')); var me = this; _.delay(function(){ me.inputDisplay.focus(); @@ -421,7 +499,7 @@ define([], function () { 'use strict'; onSelectItem: function(picker, item, record, e){ if (!record) return; - this.btnOk.setDisabled(record.get('index')==4); + this.btnOk.setDisabled(record.get('index')==4 && !(this.isAnnotation && this.chPageView.getValue()==='checked')); if (this.isAutoUpdate) { this.inputDisplay.setValue((record.get('level') || record.get('index')<4) ? record.get('name') : ''); this.isTextChanged = true; diff --git a/apps/pdfeditor/main/app/view/InsTab.js b/apps/pdfeditor/main/app/view/InsTab.js index 03614f0357..ae5472b588 100644 --- a/apps/pdfeditor/main/app/view/InsTab.js +++ b/apps/pdfeditor/main/app/view/InsTab.js @@ -218,7 +218,8 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon btn-big-inserthyperlink', caption: me.capInsertHyperlink, - lock: [_set.hyperlinkLock, _set.paragraphLock, _set.lostConnect, _set.noParagraphSelected], + lock: [_set.hyperlinkLock, _set.paragraphLock, _set.lostConnect, _set.objectWithoutParagraph], + enableToggle: true, dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' diff --git a/apps/pdfeditor/main/app/view/Toolbar.js b/apps/pdfeditor/main/app/view/Toolbar.js index 0dee1d5213..cb10de8a7c 100644 --- a/apps/pdfeditor/main/app/view/Toolbar.js +++ b/apps/pdfeditor/main/app/view/Toolbar.js @@ -105,7 +105,8 @@ define([ cantAlign: 'cant-align', cantSave: 'cant-save', cantRotatePage: 'cant-rotate-page', - cantDelPage: 'cant-del-page' + cantDelPage: 'cant-del-page', + objectWithoutParagraph: 'object-without-paragraph', }; for (var key in enumLock) { if (enumLock.hasOwnProperty(key)) { diff --git a/apps/pdfeditor/main/locale/en.json b/apps/pdfeditor/main/locale/en.json index bcd5dc7fb8..89e28f2f61 100644 --- a/apps/pdfeditor/main/locale/en.json +++ b/apps/pdfeditor/main/locale/en.json @@ -2329,6 +2329,10 @@ "PDFE.Views.HyperlinkSettingsDialog.txtPrev": "Previous page", "PDFE.Views.HyperlinkSettingsDialog.txtSizeLimit": "This field is limited to 2083 characters", "PDFE.Views.HyperlinkSettingsDialog.txtUrlPlaceholder": "Enter the web address or select a file", + "PDFE.Views.HyperlinkSettingsDialog.txtCreateLink": "Create Go to view", + "PDFE.Views.HyperlinkSettingsDialog.txtCreateDesc": "Use the scrollbars, mouse, and zoom to select the target view, then press Set link to create the link destination.", + "PDFE.Views.HyperlinkSettingsDialog.txtSetLink": "Set link", + "PDFE.Views.HyperlinkSettingsDialog.txtPageView": "Go to a page view", "PDFE.Views.ImageSettings.strTransparency": "Opacity", "PDFE.Views.ImageSettings.textAdvanced": "Show advanced settings", "PDFE.Views.ImageSettings.textCrop": "Crop", diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 3f77fa975d..988a6889b1 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -326,7 +326,7 @@ define([ me.api.asc_enableKeyEvents(false); }, 'modal:close': function(dlg) { - Common.Utils.ModalWindow.close(); + dlg && dlg.isVisible() && Common.Utils.ModalWindow.close(); // close can be called after hiding if (!Common.Utils.ModalWindow.isVisible()) me.api.asc_enableKeyEvents(true); }, diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index ce7c2b0e5a..6b8935a032 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -355,7 +355,7 @@ define([ me.api.asc_enableKeyEvents(false); }, 'modal:close': function(dlg) { - Common.Utils.ModalWindow.close(); + dlg && dlg.isVisible() && Common.Utils.ModalWindow.close(); // close can be called after hiding if (!Common.Utils.ModalWindow.isVisible()) me.api.asc_enableKeyEvents(true); }, diff --git a/apps/visioeditor/main/app/controller/Main.js b/apps/visioeditor/main/app/controller/Main.js index 1d8ec365ab..fa3d4a1a5f 100644 --- a/apps/visioeditor/main/app/controller/Main.js +++ b/apps/visioeditor/main/app/controller/Main.js @@ -263,7 +263,7 @@ define([ me.api.asc_enableKeyEvents(false); }, 'modal:close': function(dlg) { - Common.Utils.ModalWindow.close(); + dlg && dlg.isVisible() && Common.Utils.ModalWindow.close(); // close can be called after hiding if (!Common.Utils.ModalWindow.isVisible()) me.api.asc_enableKeyEvents(true); },