diff --git a/apps/common/main/resources/img/toolbar/1.25x/btn-browse.png b/apps/common/main/resources/img/toolbar/1.25x/btn-browse.png new file mode 100644 index 0000000000..e4bed30dc0 Binary files /dev/null and b/apps/common/main/resources/img/toolbar/1.25x/btn-browse.png differ diff --git a/apps/common/main/resources/img/toolbar/1.5x/btn-browse.png b/apps/common/main/resources/img/toolbar/1.5x/btn-browse.png new file mode 100644 index 0000000000..1b174770a3 Binary files /dev/null and b/apps/common/main/resources/img/toolbar/1.5x/btn-browse.png differ diff --git a/apps/common/main/resources/img/toolbar/1.75x/btn-browse.png b/apps/common/main/resources/img/toolbar/1.75x/btn-browse.png new file mode 100644 index 0000000000..37b8175fda Binary files /dev/null and b/apps/common/main/resources/img/toolbar/1.75x/btn-browse.png differ diff --git a/apps/common/main/resources/img/toolbar/1x/btn-browse.png b/apps/common/main/resources/img/toolbar/1x/btn-browse.png new file mode 100644 index 0000000000..0f083984ab Binary files /dev/null and b/apps/common/main/resources/img/toolbar/1x/btn-browse.png differ diff --git a/apps/common/main/resources/img/toolbar/2.5x/btn-browse.svg b/apps/common/main/resources/img/toolbar/2.5x/btn-browse.svg new file mode 100644 index 0000000000..39acc5126d --- /dev/null +++ b/apps/common/main/resources/img/toolbar/2.5x/btn-browse.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/common/main/resources/img/toolbar/2x/btn-browse.png b/apps/common/main/resources/img/toolbar/2x/btn-browse.png new file mode 100644 index 0000000000..28030b6800 Binary files /dev/null and b/apps/common/main/resources/img/toolbar/2x/btn-browse.png differ diff --git a/apps/documenteditor/main/app/controller/DocumentHolder.js b/apps/documenteditor/main/app/controller/DocumentHolder.js index 986a2ccc36..4265bfbd7b 100644 --- a/apps/documenteditor/main/app/controller/DocumentHolder.js +++ b/apps/documenteditor/main/app/controller/DocumentHolder.js @@ -899,6 +899,7 @@ define([ if (text !== false) { win = new DE.Views.HyperlinkSettingsDialog({ api: me.api, + appOptions: me.mode, handler: handlerDlg }); @@ -918,6 +919,7 @@ define([ if (props) { win = new DE.Views.HyperlinkSettingsDialog({ api: me.api, + appOptions: me.mode, handler: handlerDlg }); win.show(); @@ -1759,6 +1761,7 @@ define([ if (me.api){ win = new DE.Views.HyperlinkSettingsDialog({ api: me.api, + appOptions: me.mode, handler: function(dlg, result) { if (result == 'ok') { me.api.add_Hyperlink(dlg.getSettings()); @@ -1779,6 +1782,7 @@ define([ if (me.api){ win = new DE.Views.HyperlinkSettingsDialog({ api: me.api, + appOptions: me.mode, handler: function(dlg, result) { if (result == 'ok') { me.api.change_Hyperlink(win.getSettings()); diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index 581aec446e..8c59b1e010 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -233,6 +233,7 @@ define([ if (text !== false) { win = new DE.Views.HyperlinkSettingsDialog({ api: me.api, + appOptions: me.toolbar.appOptions, handler: handlerDlg }); @@ -252,6 +253,7 @@ define([ if (props) { win = new DE.Views.HyperlinkSettingsDialog({ api: me.api, + appOptions: me.toolbar.appOptions, handler: handlerDlg }); win.show(); diff --git a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js index 4f607043f5..24a660cfc5 100644 --- a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js @@ -99,6 +99,7 @@ define([ this.api = this.options.api; this._originalProps = null; this.urlType = AscCommon.c_oAscUrlType.Invalid; + this.appOptions = this.options.appOptions; Common.UI.Window.prototype.initialize.call(this, this.options); }, @@ -126,12 +127,15 @@ define([ }); me.btnInternal.on('click', _.bind(me.onLinkTypeClick, me, c_oHyperlinkType.InternalLink)); - me.inputUrl = new Common.UI.InputField({ + var config = { el : $('#id-dlg-hyperlink-url'), allowBlank : false, blankError : me.txtEmpty, style : 'width: 100%;', validateOnBlur: false, + iconCls: 'toolbar__icon btn-browse', + placeHolder: me.appOptions.isDesktopApp ? me.txtUrlPlaceholder : '', + btnHint: me.textSelectFile, validation : function(value) { var trimmed = $.trim(value); if (trimmed.length>2083) return me.txtSizeLimit; @@ -139,7 +143,8 @@ define([ 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 && me.inputUrl.showError(); me.isInputFirstChange = false; @@ -150,6 +155,7 @@ define([ } me.btnOk.setDisabled($.trim(val)==''); }); + me.appOptions.isDesktopApp && me.inputUrl.on('button:click', _.bind(me.onSelectFile, me)); me.inputDisplay = new Common.UI.InputField({ el : $('#id-dlg-hyperlink-display'), @@ -447,6 +453,26 @@ define([ this.close(); }, + onSelectFile: function() { + var me = this; + if (me.api) { + var callback = function(result) { + if (result) { + me.inputUrl.setValue(result); + if (me.inputUrl.checkValidate() !== true) + me.isInputFirstChange = true; + if (me.isAutoUpdate) { + me.inputDisplay.setValue(result); + me.isTextChanged = true; + } + me.btnOk.setDisabled($.trim(result)==''); + } + }; + + me.api.asc_getFilePath(callback); // change sdk function + } + }, + textUrl: 'Link to', textDisplay: 'Display', txtEmpty: 'This field is required', @@ -459,6 +485,8 @@ define([ txtBeginning: 'Beginning of document', txtHeadings: 'Headings', txtBookmarks: 'Bookmarks', - 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' }, DE.Views.HyperlinkSettingsDialog || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index f6c6802850..df31cecfab 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -2331,6 +2331,8 @@ "DE.Views.HyperlinkSettingsDialog.txtHeadings": "Headings", "DE.Views.HyperlinkSettingsDialog.txtNotUrl": "This field should be a URL in the \"http://www.example.com\" format", "DE.Views.HyperlinkSettingsDialog.txtSizeLimit": "This field is limited to 2083 characters", + "DE.Views.HyperlinkSettingsDialog.txtUrlPlaceholder": "Enter the web address or select a file", + "DE.Views.HyperlinkSettingsDialog.textSelectFile": "Select file", "DE.Views.HyphenationDialog.textAuto": "Automatically hyphenate document", "DE.Views.HyphenationDialog.textCaps": "Hyphenate words in CAPS", "DE.Views.HyphenationDialog.textLimit": "Limit consecutive hyphens to", diff --git a/apps/presentationeditor/main/app/controller/DocumentHolder.js b/apps/presentationeditor/main/app/controller/DocumentHolder.js index 9b0e8b0256..c2619e7eb1 100644 --- a/apps/presentationeditor/main/app/controller/DocumentHolder.js +++ b/apps/presentationeditor/main/app/controller/DocumentHolder.js @@ -1139,6 +1139,7 @@ define([ if (text !== false) { win = new PE.Views.HyperlinkSettingsDialog({ api: me.api, + appOptions: me.mode, handler: handlerDlg, slides: _arr }); @@ -1159,6 +1160,7 @@ define([ if (props) { win = new PE.Views.HyperlinkSettingsDialog({ api: me.api, + appOptions: me.mode, handler: handlerDlg, slides: _arr }); @@ -1494,6 +1496,7 @@ define([ } win = new PE.Views.HyperlinkSettingsDialog({ api: me.api, + appOptions: me.mode, handler: function(dlg, result) { if (result == 'ok') { me.api.add_Hyperlink(dlg.getSettings()); @@ -1522,6 +1525,7 @@ define([ } win = new PE.Views.HyperlinkSettingsDialog({ api: me.api, + appOptions: me.mode, handler: function(dlg, result) { if (result == 'ok') { me.api.change_Hyperlink(win.getSettings()); diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 50525d371a..bdb371469d 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -1733,6 +1733,7 @@ define([ if (props) { win = new PE.Views.HyperlinkSettingsDialog({ api: me.api, + appOptions: me.appOptions, handler: handlerDlg, slides: _arr }); diff --git a/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js b/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js index 80d47736c3..456f2cdae8 100644 --- a/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js @@ -100,6 +100,7 @@ define([ this.slides = this.options.slides; this.api = this.options.api; this.urlType = AscCommon.c_oAscUrlType.Invalid; + this.appOptions = this.options.appOptions; Common.UI.Window.prototype.initialize.call(this, this.options); }, @@ -127,12 +128,15 @@ define([ }); me.btnInternal.on('click', _.bind(me.onLinkTypeClick, me, c_oHyperlinkType.InternalLink)); - 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-browse', + placeHolder: me.appOptions.isDesktopApp ? me.txtUrlPlaceholder : '', + btnHint: me.textSelectFile, validation : function(value) { var trimmed = $.trim(value); if (trimmed.length>2083) return me.txtSizeLimit; @@ -140,7 +144,8 @@ define([ 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 && me.inputUrl.showError(); me.isInputFirstChange = false; @@ -151,6 +156,7 @@ define([ } me.btnOk.setDisabled($.trim(val)==''); }); + me.appOptions.isDesktopApp && me.inputUrl.on('button:click', _.bind(me.onSelectFile, me)); me.inputDisplay = new Common.UI.InputField({ el : $('#id-dlg-hyperlink-display'), @@ -423,6 +429,26 @@ define([ } }, + onSelectFile: function() { + var me = this; + if (me.api) { + var callback = function(result) { + if (result) { + me.inputUrl.setValue(result); + if (me.inputUrl.checkValidate() !== true) + me.isInputFirstChange = true; + if (me.isAutoUpdate) { + me.inputDisplay.setValue(result); + me.isTextChanged = true; + } + me.btnOk.setDisabled($.trim(result)==''); + } + }; + + me.api.asc_getFilePath(callback); // change sdk function + } + }, + textTitle: 'Hyperlink Settings', textInternalLink: 'Place in Document', textExternalLink: 'External Link', @@ -441,6 +467,8 @@ define([ txtLast: 'Last Slide', textDefault: 'Selected text', textSlides: 'Slides', - 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' }, PE.Views.HyperlinkSettingsDialog || {})) }); \ No newline at end of file diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 0a67e1e2df..7fc6d54e7f 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -2061,6 +2061,8 @@ "PE.Views.HyperlinkSettingsDialog.txtPrev": "Previous slide", "PE.Views.HyperlinkSettingsDialog.txtSizeLimit": "This field is limited to 2083 characters", "PE.Views.HyperlinkSettingsDialog.txtSlide": "Slide", + "PE.Views.HyperlinkSettingsDialog.txtUrlPlaceholder": "Enter the web address or select a file", + "PE.Views.HyperlinkSettingsDialog.textSelectFile": "Select file", "PE.Views.ImageSettings.textAdvanced": "Show advanced settings", "PE.Views.ImageSettings.textCrop": "Crop", "PE.Views.ImageSettings.textCropFill": "Fill", diff --git a/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js index 3673a41a1c..3d3479d64b 100644 --- a/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js @@ -135,12 +135,15 @@ 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-browse', + 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; @@ -148,7 +151,8 @@ define([ 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; @@ -156,6 +160,7 @@ define([ 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'), @@ -570,6 +575,23 @@ define([ } }, + onSelectFile: function() { + var me = this; + if (me.api) { + var callback = function(result) { + if (result) { + me.inputUrl.setValue(result); + if (me.inputUrl.checkValidate() !== true) + me.isInputFirstChange_url = true; + me.isAutoUpdate && me.inputDisplay.setValue(result); + me.btnOk.setDisabled($.trim(result)==''); + } + }; + + me.api.asc_getFilePath(callback); // change sdk function + } + }, + textTitle: 'Hyperlink Settings', textInternalLink: 'Place in Document', textExternalLink: 'Web Link', @@ -590,6 +612,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 || {})) }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index e21f1985de..bc0983c399 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -3001,6 +3001,8 @@ "SSE.Views.HyperlinkSettingsDialog.txtEmpty": "This field is required", "SSE.Views.HyperlinkSettingsDialog.txtNotUrl": "This field should be a URL in the \"http://www.example.com\" format", "SSE.Views.HyperlinkSettingsDialog.txtSizeLimit": "This field is limited to 2083 characters", + "SSE.Views.HyperlinkSettingsDialog.txtUrlPlaceholder": "Enter the web address or select a file", + "SSE.Views.HyperlinkSettingsDialog.textSelectFile": "Select file", "SSE.Views.ImageSettings.textAdvanced": "Show advanced settings", "SSE.Views.ImageSettings.textCrop": "Crop", "SSE.Views.ImageSettings.textCropFill": "Fill",