From b7d96a14b3aff27b2f41fd66a0c28461a34b232a Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Thu, 13 Nov 2025 12:55:08 +0300 Subject: [PATCH 01/11] [PDF] Enable adding link annotation --- apps/pdfeditor/main/app/controller/InsTab.js | 9 ++++++++- apps/pdfeditor/main/app/view/InsTab.js | 2 +- apps/pdfeditor/main/app/view/Toolbar.js | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/InsTab.js b/apps/pdfeditor/main/app/controller/InsTab.js index 6b0983bc70..8280041fff 100644 --- a/apps/pdfeditor/main/app/controller/InsTab.js +++ b/apps/pdfeditor/main/app/controller/InsTab.js @@ -917,7 +917,8 @@ define([ paragraph_locked = false, no_paragraph = true, in_chart = false, - page_deleted = false; + page_deleted = false, + has_object = false; while (++i < selectedObjects.length) { type = selectedObjects[i].get_ObjectType(); @@ -937,6 +938,7 @@ define([ } else if (type == Asc.c_oAscTypeSelectElement.PdfPage) { page_deleted = pr.asc_getDeleteLock(); } + has_object = has_object || type !== Asc.c_oAscTypeSelectElement.PdfPage; // not only page } if (in_chart !== this._state.in_chart) { @@ -954,6 +956,11 @@ define([ Common.Utils.lockControls(Common.enumLock.noParagraphSelected, no_paragraph, {array: this.view.lockedControls}); } + if (this._state.object_without_paragraph !== no_paragraph && has_object) { + if (this._state.activated) this._state.object_without_paragraph = no_paragraph && has_object; + Common.Utils.lockControls(Common.enumLock.noParagraphSelected, no_paragraph && has_object, {array: this.view.lockedControls}); + } + if (page_deleted !== undefined && this._state.pagecontrolsdisable !== page_deleted) { if (this._state.activated) this._state.pagecontrolsdisable = page_deleted; Common.Utils.lockControls(Common.enumLock.pageDeleted, page_deleted, {array: this.view.lockedControls}); diff --git a/apps/pdfeditor/main/app/view/InsTab.js b/apps/pdfeditor/main/app/view/InsTab.js index 03614f0357..551bff7536 100644 --- a/apps/pdfeditor/main/app/view/InsTab.js +++ b/apps/pdfeditor/main/app/view/InsTab.js @@ -218,7 +218,7 @@ 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], 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)) { From 01fdbf392dc2e3e731caa3b584a062aeb6f838f8 Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Wed, 26 Nov 2025 20:30:32 +0300 Subject: [PATCH 02/11] [PDF] Add link annotation --- apps/pdfeditor/main/app/controller/InsTab.js | 85 +++++++++++++++++-- .../main/app/view/HyperlinkSettingsDialog.js | 64 +++++++------- apps/pdfeditor/main/app/view/InsTab.js | 1 + 3 files changed, 113 insertions(+), 37 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/InsTab.js b/apps/pdfeditor/main/app/controller/InsTab.js index 8280041fff..696e9e4bb9 100644 --- a/apps/pdfeditor/main/app/controller/InsTab.js +++ b/apps/pdfeditor/main/app/controller/InsTab.js @@ -66,7 +66,8 @@ define([ Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this)); this.binding = { - checkInsertAutoshape: _.bind(this.checkInsertAutoshape, this) + checkInsertAutoshape: _.bind(this.checkInsertAutoshape, this), + checkInsertHyperlinkAnnot: _.bind(this.checkInsertHyperlinkAnnot, this) }; PDFE.getCollection('ShapeGroups').bind({ reset: this.onResetAutoshapes.bind(this) @@ -85,6 +86,7 @@ define([ this.api.asc_registerCallback('asc_onEndSmartArtPreview', _.bind(this.onApiEndSmartArtPreview, this)); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); this.api.asc_registerCallback('asc_onCanAddHyperlink', _.bind(this.onApiCanAddHyperlink, this)); + this.api.asc_registerCallback('asc_onDialogAddAnnotLink', _.bind(this.onDialogAddAnnotLink, this)); Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this)); Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this)); Common.Gateway.on('insertimage', _.bind(this.insertImage, this)); @@ -311,12 +313,26 @@ define([ }); }, - onHyperlinkClick: function(btn) { + onHyperlinkClick: function() { var me = this, win, props, text; - if (me.api){ + if (this._state.no_paragraph) {//add hyperlink annotation + if (this.view.btnInsertHyperlink.pressed) { + var stroke = new Asc.asc_CStroke(); + stroke.put_type( Asc.c_oAscStrokeType.STROKE_COLOR); + stroke.put_color(Common.Utils.ThemeColor.getRgbColor('#1755A0')); + this.api.StartAddAnnot(AscPDF.ANNOTATIONS_TYPES.Link, stroke, true); + $(document.body).on('mouseup', this.binding.checkInsertHyperlinkAnnot); + } else { + this.api.StartAddAnnot('', undefined, false); + $(document.body).off('mouseup', this.binding.checkInsertHyperlinkAnnot); + } + return; + } + if (me.api){// add hyperlink to text in shape + this.view.btnInsertHyperlink.toggle(false, true); var handlerDlg = function(dlg, result) { if (result == 'ok') { props = dlg.getSettings(); @@ -364,6 +380,59 @@ define([ Common.component.Analytics.trackEvent('ToolBar', 'Add Hyperlink'); }, + onDialogAddAnnotLink: function(arrIds) { + if ( this.view.btnInsertHyperlink.pressed ) { + this.view.btnInsertHyperlink.toggle(false, true); + } + $(document.body).off('mouseup', this.binding.checkInsertHyperlinkAnnot); + + if (!this.api) return; + + var me = this, + res; + var handlerDlg = function(dlg, result) { + res = result; + if (result === 'ok') { + me.api.add_Hyperlink(dlg.getSettings()); + } + Common.NotificationCenter.trigger('edit:complete', me.view); + }; + var _arr = []; + for (var i=0; i', + '
', '
', '', '', @@ -79,24 +78,25 @@ 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() { @@ -189,6 +189,10 @@ 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'); + } }, getFocusedComponents: function() { @@ -233,7 +237,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 +245,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; }, @@ -269,18 +273,20 @@ define([], function () { 'use strict'; _handleInput: function(state) { if (this.options.handler) { if (state == 'ok') { - var checkurl = (this.btnExternal.isActive()) ? this.inputUrl.checkValidate() : true, - checkdisp = this.inputDisplay.checkValidate(); + 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); } diff --git a/apps/pdfeditor/main/app/view/InsTab.js b/apps/pdfeditor/main/app/view/InsTab.js index 551bff7536..ae5472b588 100644 --- a/apps/pdfeditor/main/app/view/InsTab.js +++ b/apps/pdfeditor/main/app/view/InsTab.js @@ -219,6 +219,7 @@ define([ iconCls: 'toolbar__icon btn-big-inserthyperlink', caption: me.capInsertHyperlink, lock: [_set.hyperlinkLock, _set.paragraphLock, _set.lostConnect, _set.objectWithoutParagraph], + enableToggle: true, dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' From ad67511a31a228a1d309c36662d3880fa0fa9b37 Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Wed, 26 Nov 2025 20:43:09 +0300 Subject: [PATCH 03/11] [PDF] Fix hot key for adding hyperlink (use hot key only for shape/table) --- apps/pdfeditor/main/app/controller/DocumentHolder.js | 7 +++++++ apps/pdfeditor/main/app/controller/DocumentHolderExt.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/pdfeditor/main/app/controller/DocumentHolder.js b/apps/pdfeditor/main/app/controller/DocumentHolder.js index aa1086bffe..afdb331949 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 27eb96b5b5..69419f6da1 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js @@ -2474,7 +2474,7 @@ define([], function () { dh.onDialogAddHyperlink = function() { var win, props, text; var me = this; - if (me.api && me.mode.isEdit && !me._isDisabled && !PDFE.getController('LeftMenu').leftMenu.menuFile.isVisible()){ + if (me.api && me.mode.isEdit && !me._isDisabled && !PDFE.getController('LeftMenu').leftMenu.menuFile.isVisible() && !this._state.no_paragraph){ // show dialog only for table/shape var handlerDlg = function(dlg, result) { if (result == 'ok') { props = dlg.getSettings(); From 4e948eaacb722d9750c558600a4f39ab97dde4a2 Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Wed, 26 Nov 2025 23:25:33 +0300 Subject: [PATCH 04/11] [PDF] Set link to page view --- apps/pdfeditor/main/app/controller/InsTab.js | 4 +- .../main/app/view/HyperlinkSettingsDialog.js | 67 ++++++++++++++++++- apps/pdfeditor/main/locale/en.json | 4 ++ 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/InsTab.js b/apps/pdfeditor/main/app/controller/InsTab.js index 696e9e4bb9..37f7ba689a 100644 --- a/apps/pdfeditor/main/app/controller/InsTab.js +++ b/apps/pdfeditor/main/app/controller/InsTab.js @@ -394,6 +394,8 @@ define([ res = result; if (result === 'ok') { me.api.add_Hyperlink(dlg.getSettings()); + } else if (result === 'view') { + me.api.SetLinkAnnotGoToAction(arrIds); } Common.NotificationCenter.trigger('edit:complete', me.view); }; @@ -411,7 +413,7 @@ define([ handler: handlerDlg, slides: _arr }).on('close', function() { - (res!=='ok') && me.api.asc_removeAnnots(arrIds); + (res!=='ok' && res!=='view') && me.api.asc_removeAnnots(arrIds); }); win.show(); win.setSettings(); diff --git a/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js b/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js index 572cf719b1..23944abebe 100644 --- a/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js @@ -77,6 +77,7 @@ define([], function () { 'use strict'; '', '
', '', + '', '', '
', '', @@ -180,6 +181,13 @@ 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'); + }); + 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') }); @@ -192,7 +200,8 @@ define([], function () { 'use strict'; if (me.isAnnotation) { $window.find('.not-annotation').addClass('hidden'); - } + } else + me.chPageView.setVisible(false); }, getFocusedComponents: function() { @@ -273,6 +282,62 @@ define([], function () { 'use strict'; _handleInput: function(state) { if (this.options.handler) { if (state == 'ok') { + if (this.isAnnotation && 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'); + + 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'); + } + }); + return; + } + var checkurl = (this.btnExternal.isActive()) ? this.inputUrl.checkValidate() : true; if (checkurl !== true) { this.isInputFirstChange = true; diff --git a/apps/pdfeditor/main/locale/en.json b/apps/pdfeditor/main/locale/en.json index 9984b1d2a6..dd82f262e4 100644 --- a/apps/pdfeditor/main/locale/en.json +++ b/apps/pdfeditor/main/locale/en.json @@ -2309,6 +2309,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", From d0dcf5be5965bcd8c8302593e67a1cd10cc9b7ae Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Thu, 27 Nov 2025 15:10:50 +0300 Subject: [PATCH 05/11] [PDF] Change adding link --- apps/pdfeditor/main/app/controller/InsTab.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/InsTab.js b/apps/pdfeditor/main/app/controller/InsTab.js index 37f7ba689a..6c12541db4 100644 --- a/apps/pdfeditor/main/app/controller/InsTab.js +++ b/apps/pdfeditor/main/app/controller/InsTab.js @@ -86,6 +86,7 @@ define([ this.api.asc_registerCallback('asc_onEndSmartArtPreview', _.bind(this.onApiEndSmartArtPreview, this)); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); this.api.asc_registerCallback('asc_onCanAddHyperlink', _.bind(this.onApiCanAddHyperlink, this)); + this.api.asc_registerCallback('asc_onLinkToolState', _.bind(this.onLinkToolState, this)); this.api.asc_registerCallback('asc_onDialogAddAnnotLink', _.bind(this.onDialogAddAnnotLink, this)); Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this)); Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this)); @@ -313,19 +314,20 @@ define([ }); }, + onLinkToolState: function (state) { + this.view && this.view.btnInsertHyperlink.toggle(state, true); + }, + onHyperlinkClick: function() { var me = this, win, props, text; if (this._state.no_paragraph) {//add hyperlink annotation if (this.view.btnInsertHyperlink.pressed) { - var stroke = new Asc.asc_CStroke(); - stroke.put_type( Asc.c_oAscStrokeType.STROKE_COLOR); - stroke.put_color(Common.Utils.ThemeColor.getRgbColor('#1755A0')); - this.api.StartAddAnnot(AscPDF.ANNOTATIONS_TYPES.Link, stroke, true); + this.api.SetLinkTool(true); $(document.body).on('mouseup', this.binding.checkInsertHyperlinkAnnot); } else { - this.api.StartAddAnnot('', undefined, false); + this.api.SetLinkTool(false); $(document.body).off('mouseup', this.binding.checkInsertHyperlinkAnnot); } return; @@ -381,9 +383,6 @@ define([ }, onDialogAddAnnotLink: function(arrIds) { - if ( this.view.btnInsertHyperlink.pressed ) { - this.view.btnInsertHyperlink.toggle(false, true); - } $(document.body).off('mouseup', this.binding.checkInsertHyperlinkAnnot); if (!this.api) return; @@ -427,7 +426,7 @@ define([ btn_id = cmp.closest('.btn-group').attr('id'); if (cmp.attr('id') !== 'editor_sdk' && cmp_sdk.length<=0) { if ( this.view.btnInsertHyperlink.pressed && this.view.btnInsertHyperlink.id !== btn_id ) { - this.api.StartAddAnnot('', undefined, false); + this.api.SetLinkTool(false); $(document.body).off('mouseup', this.binding.checkInsertHyperlinkAnnot); this.view.btnInsertHyperlink.toggle(false, true); Common.NotificationCenter.trigger('edit:complete', this.view); From ab6bd89de1af93c7ab6bb2eefcfbae74115bea31 Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Thu, 27 Nov 2025 15:33:05 +0300 Subject: [PATCH 06/11] [PDF] Fix adding link to page view --- apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js b/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js index 23944abebe..16de3fa35a 100644 --- a/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js @@ -303,7 +303,7 @@ define([], function () { 'use strict'; header: {docmode: true, search: true}, shortcuts: true }, 'setlink'); - + me.api.SetCanInteract(false); Common.UI.alert({ modal: false, maxwidth: 400, @@ -333,6 +333,7 @@ define([], function () { 'use strict'; header: {docmode: true, search: true}, shortcuts: true }, 'setlink'); + me.api.SetCanInteract(true); } }); return; From 43df04f827b9172080a026c3bceed47c638acc6c Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Fri, 28 Nov 2025 13:55:20 +0300 Subject: [PATCH 07/11] [PDF] Fix adding link --- apps/pdfeditor/main/app/controller/InsTab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pdfeditor/main/app/controller/InsTab.js b/apps/pdfeditor/main/app/controller/InsTab.js index 6c12541db4..af236da28e 100644 --- a/apps/pdfeditor/main/app/controller/InsTab.js +++ b/apps/pdfeditor/main/app/controller/InsTab.js @@ -392,7 +392,7 @@ define([ var handlerDlg = function(dlg, result) { res = result; if (result === 'ok') { - me.api.add_Hyperlink(dlg.getSettings()); + me.api.add_Hyperlink(dlg.getSettings(), arrIds); } else if (result === 'view') { me.api.SetLinkAnnotGoToAction(arrIds); } From 616220f286c78921e3c4892ae1f6790efd5d5af9 Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Thu, 4 Dec 2025 16:57:57 +0300 Subject: [PATCH 08/11] [PDF] Edit link annotation --- .../main/app/controller/DocumentHolderExt.js | 11 ++++++++--- apps/pdfeditor/main/app/view/DocumentHolderExt.js | 11 +++++++++++ .../main/app/view/HyperlinkSettingsDialog.js | 3 ++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js index 69419f6da1..381b9b2a93 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)); @@ -1954,7 +1955,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 Date: Fri, 5 Dec 2025 17:44:19 +0300 Subject: [PATCH 09/11] Disable tree view component --- apps/common/main/lib/component/DataView.js | 11 ++++++-- apps/common/main/lib/component/TreeView.js | 2 ++ apps/common/main/resources/less/treeview.less | 27 ++++++++++++++----- .../main/app/view/HyperlinkSettingsDialog.js | 7 +++-- 4 files changed, 36 insertions(+), 11 deletions(-) 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/pdfeditor/main/app/view/HyperlinkSettingsDialog.js b/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js index c87ed01d19..d5384a9a6f 100644 --- a/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js @@ -185,7 +185,7 @@ define([], function () { 'use strict'; el: $window.find('#id-dlg-hyperlink-chb-page'), labelText: this.txtPageView }).on('change', function(field, newValue, oldValue, eOpts){ - // me.internalList.setDisabled(newValue==='checked'); + me.internalList.setDisabled(newValue==='checked'); }); me.btnOk = _.find(this.getFooterButtons(), function (item) { @@ -205,7 +205,7 @@ define([], function () { 'use strict'; }, 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) { @@ -229,6 +229,9 @@ define([], function () { 'use strict'; this.isAnnotation && this.chPageView.setValue(props.get_PageView()); me._originalProps = props; + } else { + this.btnExternal.toggle(true); + this.ShowHideElem(c_oHyperlinkType.WebLink); } }, From be5c7c2fbdfcdc5982e3f6275659b2f49c4c9944 Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Fri, 5 Dec 2025 18:03:42 +0300 Subject: [PATCH 10/11] [PDF] Fix adding link to page view --- apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js b/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js index d5384a9a6f..506e7e69bf 100644 --- a/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/pdfeditor/main/app/view/HyperlinkSettingsDialog.js @@ -186,6 +186,8 @@ define([], function () { 'use strict'; 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) { @@ -451,7 +453,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(); @@ -494,7 +496,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; From c5a563eceb64f1978155ca729a19221aa9f5e6aa Mon Sep 17 00:00:00 2001 From: "Julia.Radzhabova" Date: Fri, 5 Dec 2025 22:52:07 +0300 Subject: [PATCH 11/11] [PDF] Fix focus in the window (when close Hyperlink dialog after hiding) --- .../forms/app/controller/ApplicationController.js | 2 +- apps/documenteditor/main/app/controller/Main.js | 2 +- apps/pdfeditor/main/app/controller/Main.js | 2 +- apps/presentationeditor/main/app/controller/Main.js | 2 +- apps/spreadsheeteditor/main/app/controller/Main.js | 2 +- apps/visioeditor/main/app/controller/Main.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index 00b01f393b..9833e18ccd 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 958df260bd..922280b48f 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -352,7 +352,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/Main.js b/apps/pdfeditor/main/app/controller/Main.js index 7bcdbb3d26..e06c8d0225 100644 --- a/apps/pdfeditor/main/app/controller/Main.js +++ b/apps/pdfeditor/main/app/controller/Main.js @@ -300,7 +300,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/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 83ea23fa36..5cdc58175e 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 726b4178d6..605a0496df 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 237c024314..a20e0af96a 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); },