diff --git a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js index d90077177..c0a739ef5 100644 --- a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js @@ -141,7 +141,10 @@ define([ me.isInputFirstChange && me.inputUrl.showError(); me.isInputFirstChange = false; var val = $(e.target).val(); - me.isAutoUpdate && me.inputDisplay.setValue(val); + if (me.isAutoUpdate) { + me.inputDisplay.setValue(val); + me.isTextChanged = true; + } me.btnOk.setDisabled($.trim(val)==''); }); @@ -279,12 +282,16 @@ define([ } else { this.inputDisplay.setValue(this.inputUrl.getValue()); } + this.isTextChanged = true; } }, onSelectItem: function(picker, item, record, e){ this.btnOk.setDisabled(record.get('level')==0 && record.get('index')>0); - this.isAutoUpdate && this.inputDisplay.setValue((record.get('level') || record.get('index')==0) ? record.get('name') : ''); + if (this.isAutoUpdate) { + this.inputDisplay.setValue((record.get('level') || record.get('index')==0) ? record.get('name') : ''); + this.isTextChanged = true; + } }, show: function() { @@ -336,7 +343,7 @@ define([ if (props.get_Text() !== null) { me.inputDisplay.setValue(props.get_Text()); me.inputDisplay.setDisabled(false); - me.isAutoUpdate = (me.inputDisplay.getValue()==''); + me.isAutoUpdate = (me.inputDisplay.getValue()=='' || type == c_oHyperlinkType.WebLink && me.inputUrl.getValue()==me.inputDisplay.getValue()); } else { me.inputDisplay.setValue(this.textDefault); me.inputDisplay.setDisabled(true); @@ -352,9 +359,10 @@ define([ getSettings: function () { var me = this, props = new Asc.CHyperlinkProperty(), - display = ''; + display = '', + type = this.btnExternal.isActive() ? c_oHyperlinkType.WebLink : c_oHyperlinkType.InternalLink; - if (this.btnExternal.isActive()) {//WebLink + if (type==c_oHyperlinkType.WebLink) {//WebLink var url = $.trim(me.inputUrl.getValue()); if (! /(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url) ) @@ -377,8 +385,8 @@ define([ } } - if (!me.inputDisplay.isDisabled() && ( this.isTextChanged || _.isEmpty(me.inputDisplay.getValue()))) { - if (_.isEmpty(me.inputDisplay.getValue())) + if (!me.inputDisplay.isDisabled() && ( me.isTextChanged || _.isEmpty(me.inputDisplay.getValue()))) { + if (_.isEmpty(me.inputDisplay.getValue()) || type==c_oHyperlinkType.WebLink && me.isAutoUpdate) me.inputDisplay.setValue(display); props.put_Text(me.inputDisplay.getValue()); } else { diff --git a/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js b/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js index 3c50a2b31..b06c3a42f 100644 --- a/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js @@ -143,7 +143,10 @@ define([ me.isInputFirstChange && me.inputUrl.showError(); me.isInputFirstChange = false; var val = $(e.target).val(); - me.isAutoUpdate && me.inputDisplay.setValue(val); + if (me.isAutoUpdate) { + me.inputDisplay.setValue(val); + me.isTextChanged = true; + } me.btnOk.setDisabled($.trim(val)==''); }); @@ -194,7 +197,7 @@ define([ if (props.get_Text()!==null) { me.inputDisplay.setValue(props.get_Text()); me.inputDisplay.setDisabled(false); - me.isAutoUpdate = (me.inputDisplay.getValue()==''); + me.isAutoUpdate = (me.inputDisplay.getValue()=='' || type == c_oHyperlinkType.WebLink && me.inputUrl.getValue()==me.inputDisplay.getValue()); } else { this.inputDisplay.setValue(this.textDefault); this.inputDisplay.setDisabled(true); @@ -213,8 +216,9 @@ define([ getSettings: function () { var me = this, props = new Asc.CHyperlinkProperty(); - var def_display = ''; - if (this.btnInternal.isActive()) {//InternalLink + var def_display = '', + type = this.btnExternal.isActive() ? c_oHyperlinkType.WebLink : c_oHyperlinkType.InternalLink; + if (type==c_oHyperlinkType.InternalLink) {//InternalLink var url = "ppaction://hlink"; var tip = ''; var txttip = me.inputTip.getValue(); @@ -237,7 +241,7 @@ define([ } if (!me.inputDisplay.isDisabled() && (me.isTextChanged || _.isEmpty(me.inputDisplay.getValue()))) { - if (_.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()); } @@ -380,6 +384,7 @@ define([ } else { this.inputDisplay.setValue(this.inputUrl.getValue()); } + this.isTextChanged = true; } }, @@ -399,7 +404,10 @@ define([ onSelectItem: function(picker, item, record, e){ this.btnOk.setDisabled(record.get('index')==4); - this.isAutoUpdate && this.inputDisplay.setValue((record.get('level') || record.get('index')<4) ? record.get('name') : ''); + if (this.isAutoUpdate) { + this.inputDisplay.setValue((record.get('level') || record.get('index')<4) ? record.get('name') : ''); + this.isTextChanged = true; + } }, textTitle: 'Hyperlink Settings', diff --git a/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js index 3873b34b8..606833b04 100644 --- a/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js @@ -243,16 +243,17 @@ define([ this.inputTip.setValue(settings.props.asc_getTooltip()); } this.inputDisplay.setDisabled(settings.isLock); - !settings.isLock && (this.isAutoUpdate = (this.inputDisplay.getValue()=='')); + !settings.isLock && (this.isAutoUpdate = (this.inputDisplay.getValue()=='' || type == Asc.c_oAscHyperlinkType.WebLink && me.inputUrl.getValue()==me.inputDisplay.getValue())); } }, getSettings: function() { var props = new Asc.asc_CHyperlink(), - def_display = ""; - props.asc_setType(this.btnInternal.isActive() ? Asc.c_oAscHyperlinkType.RangeLink : Asc.c_oAscHyperlinkType.WebLink); + def_display = "", + type = this.btnInternal.isActive() ? Asc.c_oAscHyperlinkType.RangeLink : Asc.c_oAscHyperlinkType.WebLink; + props.asc_setType(type); - if (this.btnInternal.isActive()) { + if (type==Asc.c_oAscHyperlinkType.RangeLink) { var rec = this.internalList.getSelectedRec(); if (rec && rec.get('level')>0) { if (rec.get('type')) {// named range @@ -277,7 +278,7 @@ define([ if (this.inputDisplay.isDisabled()) props.asc_setText(null); else { - if (_.isEmpty(this.inputDisplay.getValue())) + if (_.isEmpty(this.inputDisplay.getValue()) || type==Asc.c_oAscHyperlinkType.WebLink && this.isAutoUpdate) this.inputDisplay.setValue(def_display); props.asc_setText(this.inputDisplay.getValue()); }