diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index 02f4b27cf..20196414e 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -78,16 +78,6 @@ define([ this._state = { prcontrolsdisable:undefined }; - Common.Gateway.on('setactionlink', function (url) { - var copytext = document.createElement('input'); - copytext.value = url; - document.body.appendChild(copytext); - copytext.select(); - try { - document.execCommand("copy"); - } catch (err) {} - document.body.removeChild(copytext); - }); }, setApi: function (api) { diff --git a/apps/documenteditor/main/app/view/BookmarksDialog.js b/apps/documenteditor/main/app/view/BookmarksDialog.js index 1e1a5d0d2..362b0e7b0 100644 --- a/apps/documenteditor/main/app/view/BookmarksDialog.js +++ b/apps/documenteditor/main/app/view/BookmarksDialog.js @@ -50,7 +50,7 @@ define([ DE.Views.BookmarksDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ options: { - contentWidth: 300, + contentWidth: 310, height: 360 }, @@ -89,9 +89,15 @@ define([ '', '', '', - '', - '', - '', + '', + '', + '
', + '', + '', + '
', '', '', '', @@ -126,7 +132,7 @@ define([ allowBlank : true, validateOnChange: true, validateOnBlur: true, - style : 'width: 195px;', + style : 'width: 205px;', value : '', maxLength: 40, validation : function(value) { @@ -203,6 +209,37 @@ define([ }); this.chHidden.on('change', _.bind(this.onChangeHidden, this)); + if (this.appOptions.canMakeActionLink) { + var inputCopy = new Common.UI.InputField({ + el : $('#id-dlg-clip-copy'), + editable : false, + style : 'width: 176px;' + }); + + var copyBox = this.$window.find('#id-clip-copy-box'); + copyBox.on('click', _.bind(function() { + return false; + }, this)); + copyBox.parent().on({ + 'shown.bs.dropdown': function () { + _.delay(function(){ + inputCopy._input.select().focus(); + },100); + }, + 'hide.bs.dropdown': function () { + me.txtName._input.select().focus(); + } + }); + copyBox.find('button').on('click', function() { + inputCopy._input.select(); + document.execCommand("copy"); + }); + + Common.Gateway.on('setactionlink', function (url) { + inputCopy.setValue(url); + }); + } + this.afterRender(); }, @@ -215,8 +252,7 @@ define([ var me = this; _.delay(function(){ - var input = $('input', me.txtName.cmpEl).select(); - input.focus(); + $('input', me.txtName.cmpEl).select().focus(); },100); }, @@ -305,7 +341,9 @@ define([ } }, - getBookmarkLink: function() { + getBookmarkLink: function(btn) { + if (btn.cmpEl && btn.cmpEl.parent().hasClass('open')) return; + var rec = this.bookmarksList.getSelectedRec(); if (rec.length>0) { Common.Gateway.requestMakeActionLink({ @@ -338,7 +376,8 @@ define([ textClose: 'Close', textHidden: 'Hidden bookmarks', txtInvalidName: 'Bookmark name can only contain letters, digits and underscores, and should begin with the letter', - textGetLink: 'Get link' + textGetLink: 'Link to bookmark', + textCopy: 'Copy' }, DE.Views.BookmarksDialog || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index afb7ae85c..64de7844a 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1009,7 +1009,8 @@ "DE.Views.BookmarksDialog.textName": "Name", "DE.Views.BookmarksDialog.textSort": "Sort by", "DE.Views.BookmarksDialog.textTitle": "Bookmarks", - "DE.Views.BookmarksDialog.textGetLink": "Get link", + "DE.Views.BookmarksDialog.textGetLink": "Link to Bookmark", + "DE.Views.BookmarksDialog.textCopy": "Copy", "DE.Views.BookmarksDialog.txtInvalidName": "Bookmark name can only contain letters, digits and underscores, and should begin with the letter", "DE.Views.ChartSettings.textAdvanced": "Show advanced settings", "DE.Views.ChartSettings.textArea": "Area",