Skip to content

Commit

Permalink
For bug 59194
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Jan 31, 2024
1 parent 1f3f690 commit b71f108
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,27 +135,32 @@ define([
});
me.btnInternal.on('click', _.bind(me.onLinkTypeClick, me, Asc.c_oAscHyperlinkType.RangeLink));

me.inputUrl = new Common.UI.InputField({
var config = {
el : $('#id-dlg-hyperlink-url'),
allowBlank : false,
blankError : me.txtEmpty,
validateOnBlur: false,
style : 'width: 100%;',
iconCls: 'toolbar__icon btn-goback',
placeHolder: me.appOptions.isDesktopApp ? me.txtUrlPlaceholder : '',
btnHint: me.textSelectFile,
validation : function(value) {
var trimmed = $.trim(value);
if (me.api.asc_getFullHyperlinkLength(trimmed)>2083) return me.txtSizeLimit;

me.urlType = me.api.asc_getUrlType(trimmed);
return (me.urlType!==AscCommon.c_oAscUrlType.Invalid) ? true : me.txtNotUrl;
}
});
};
me.inputUrl = me.appOptions.isDesktopApp ? new Common.UI.InputFieldBtn(config) : new Common.UI.InputField(config);
me.inputUrl._input.on('input', function (e) {
me.isInputFirstChange_url && me.inputUrl.showError();
me.isInputFirstChange_url = false;
var val = $(e.target).val();
me.isAutoUpdate && me.inputDisplay.setValue(val);
me.btnOk.setDisabled($.trim(val)=='');
});
me.appOptions.isDesktopApp && me.inputUrl.on('button:click', _.bind(me.onSelectFile, me));

me.inputRange = new Common.UI.InputFieldBtn({
el : $('#id-dlg-hyperlink-range'),
Expand Down Expand Up @@ -570,6 +575,24 @@ define([
}
},

onSelectFile: function() {
var me = this;
if (me.api) {
var callback = function(result) {
if (result) {
me.inputUrl.setValue(result);
me.inputUrl.checkValidate();
me.isInputFirstChange_url && me.inputUrl.showError();
me.isInputFirstChange_url = false;
me.isAutoUpdate && me.inputDisplay.setValue(result);
me.btnOk.setDisabled($.trim(result)=='');
}
};

me.api.asc_addImage(callback); // change sdk function
}
},

textTitle: 'Hyperlink Settings',
textInternalLink: 'Place in Document',
textExternalLink: 'Web Link',
Expand All @@ -590,6 +613,8 @@ define([
textGetLink: 'Get Link',
textCopy: 'Copy',
textSelectData: 'Select data',
txtSizeLimit: 'This field is limited to 2083 characters'
txtSizeLimit: 'This field is limited to 2083 characters',
txtUrlPlaceholder: 'Enter the web address or select a file',
textSelectFile: 'Select file'
}, SSE.Views.HyperlinkSettingsDialog || {}))
});

0 comments on commit b71f108

Please sign in to comment.