diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index df5a31c8e..02f4b27cf 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -79,8 +79,15 @@ define([ prcontrolsdisable:undefined }; Common.Gateway.on('setactionlink', function (url) { - console.log('url with actions: ' + url); - }.bind(this)); + 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) { @@ -328,6 +335,7 @@ define([ var me = this; (new DE.Views.BookmarksDialog({ api: me.api, + appOptions: me.toolbar.appOptions, props: me.api.asc_GetBookmarksManager(), handler: function (result, settings) { if (settings) { diff --git a/apps/documenteditor/main/app/view/BookmarksDialog.js b/apps/documenteditor/main/app/view/BookmarksDialog.js index 203b1e80c..8d74d61b2 100644 --- a/apps/documenteditor/main/app/view/BookmarksDialog.js +++ b/apps/documenteditor/main/app/view/BookmarksDialog.js @@ -90,7 +90,8 @@ define([ '', '', '', - '', + '', + '', '', '', '', @@ -111,6 +112,7 @@ define([ this.api = options.api; this.handler = options.handler; this.props = options.props; + this.appOptions = options.appOptions; Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); }, @@ -137,6 +139,7 @@ define([ me.btnAdd.setDisabled(!check && !exist); me.btnGoto.setDisabled(!exist); me.btnDelete.setDisabled(!exist); + me.btnGetLink.setDisabled(!exist); return (check || _.isEmpty(value)) ? true : me.txtInvalidName; } @@ -187,6 +190,12 @@ define([ }); this.btnDelete.on('click', _.bind(this.deleteBookmark, this)); + this.btnGetLink = new Common.UI.Button({ + el: $('#bookmarks-btn-link'), + disabled: true + }); + this.btnGetLink.on('click', _.bind(this.getBookmarkLink, this)); + this.chHidden = new Common.UI.CheckBox({ el: $('#bookmarks-checkbox-hidden'), labelText: this.textHidden, @@ -220,6 +229,7 @@ define([ _setDefaults: function (props) { this.refreshBookmarks(); this.bookmarksList.scrollToRecord(this.bookmarksList.selectByIndex(0)); + this.btnGetLink.setVisible(this.appOptions.canMakeActionLink); }, getSettings: function () { @@ -266,6 +276,7 @@ define([ this.btnAdd.setDisabled(false); this.btnGoto.setDisabled(false); this.btnDelete.setDisabled(false); + this.btnGetLink.setDisabled(false); }, gotoBookmark: function(btn, eOpts){ @@ -290,6 +301,14 @@ define([ this.btnAdd.setDisabled(true); this.btnGoto.setDisabled(true); this.btnDelete.setDisabled(true); + this.btnGetLink.setDisabled(true); + } + }, + + getBookmarkLink: function() { + var rec = this.bookmarksList.getSelectedRec(); + if (rec.length>0) { + Common.Gateway.requestMakeActionLink({action: "bookmark", data: rec[0].get('value')}); } }, @@ -314,7 +333,8 @@ define([ textDelete: 'Delete', textClose: 'Close', textHidden: 'Hidden bookmarks', - txtInvalidName: 'Bookmark name can only contain letters, digits and underscores, and should begin with the letter' + txtInvalidName: 'Bookmark name can only contain letters, digits and underscores, and should begin with the letter', + textGetLink: 'Get link' }, 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 a3e3265e7..01aca3261 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1009,6 +1009,7 @@ "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.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",