From 0b18b030600e937cd0a7f851207176da1ff59084 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 19 Feb 2018 14:56:44 +0300 Subject: [PATCH 01/14] [DE] Add bookmarks. --- .../less/advanced-settings-window.less | 6 +- apps/common/main/resources/less/toolbar.less | 1 + .../main/app/controller/Links.js | 18 +- .../main/app/template/Toolbar.template | 1 + .../main/app/view/BookmarksDialog.js | 210 ++++++++++++++++++ apps/documenteditor/main/app/view/Links.js | 19 +- .../main/resources/less/rightmenu.less | 4 + 7 files changed, 255 insertions(+), 4 deletions(-) create mode 100644 apps/documenteditor/main/app/view/BookmarksDialog.js diff --git a/apps/common/main/resources/less/advanced-settings-window.less b/apps/common/main/resources/less/advanced-settings-window.less index 58375bb9e..42c801961 100644 --- a/apps/common/main/resources/less/advanced-settings-window.less +++ b/apps/common/main/resources/less/advanced-settings-window.less @@ -36,12 +36,16 @@ } .footer { - padding-top: 15px; + padding: 15px 15px 0; &.center { text-align: center; } + &.right { + text-align: right; + } + &.justify { padding-left: 30px; padding-right: 30px; diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less index 964fd49d2..96baf8e3f 100644 --- a/apps/common/main/resources/less/toolbar.less +++ b/apps/common/main/resources/less/toolbar.less @@ -311,3 +311,4 @@ .button-normal-icon(~'x-huge .btn-contents', 53, @toolbar-big-icon-size); .button-normal-icon(btn-controls, 54, @toolbar-big-icon-size); .button-normal-icon(~'x-huge .btn-select-pivot', 55, @toolbar-big-icon-size); +.button-normal-icon(~'x-huge .btn-bookmarks', 56, @toolbar-big-icon-size); diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index 272074446..001b4fd64 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -44,7 +44,8 @@ define([ 'documenteditor/main/app/view/Links', 'documenteditor/main/app/view/NoteSettingsDialog', 'documenteditor/main/app/view/HyperlinkSettingsDialog', - 'documenteditor/main/app/view/TableOfContentsSettings' + 'documenteditor/main/app/view/TableOfContentsSettings', + 'documenteditor/main/app/view/BookmarksDialog' ], function () { 'use strict'; @@ -64,7 +65,8 @@ define([ 'links:contents': this.onTableContents, 'links:update': this.onTableContentsUpdate, 'links:notes': this.onNotesClick, - 'links:hyperlink': this.onHyperlinkClick + 'links:hyperlink': this.onHyperlinkClick, + 'links:bookmarks': this.onBookmarksClick }, 'DocumentHolder': { 'links:contents': this.onTableContents, @@ -306,6 +308,18 @@ define([ }, 50); break; } + }, + + onBookmarksClick: function(btn) { + var me = this; + (new DE.Views.BookmarksDialog({ + handler: function (result, settings) { + if (settings) { + } + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + }, + props: {} + })).show(); } }, DE.Controllers.Links || {})); diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template index e1f406f59..75f5398ae 100644 --- a/apps/documenteditor/main/app/template/Toolbar.template +++ b/apps/documenteditor/main/app/template/Toolbar.template @@ -171,6 +171,7 @@
+
diff --git a/apps/documenteditor/main/app/view/BookmarksDialog.js b/apps/documenteditor/main/app/view/BookmarksDialog.js new file mode 100644 index 000000000..d2169905c --- /dev/null +++ b/apps/documenteditor/main/app/view/BookmarksDialog.js @@ -0,0 +1,210 @@ +/* + * + * (c) Copyright Ascensio System Limited 2010-2017 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, + * EU, LV-1021. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +/** + * BookmarksDialog.js.js + * + * Created by Julia Radzhabova on 15.02.2018 + * Copyright (c) 2017 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'common/main/lib/util/utils', + 'common/main/lib/component/ListView', + 'common/main/lib/component/InputField', + 'common/main/lib/component/Button', + 'common/main/lib/component/RadioBox', + 'common/main/lib/view/AdvancedSettingsWindow' +], function () { 'use strict'; + + DE.Views.BookmarksDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + contentWidth: 300, + height: 340 + }, + + initialize : function(options) { + var me = this; + + _.extend(this.options, { + title: this.textTitle, + template: [ + '
', + '
', + '
', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '
', + '', + '
', + '
', + '', + '
', + '', + '
', + '
', + '
', + '
', + '
', + '', + '', + '
', + '
', + '
', + '
', + '' + ].join('') + }, options); + + this.api = options.api; + this.handler = options.handler; + this.props = options.props; + + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + }, + + render: function() { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + var me = this; + + this.txtName = new Common.UI.InputField({ + el : $('#bookmarks-txt-name'), + allowBlank : true, + validateOnChange: true, + validateOnBlur: false, + style : 'width: 195px;', + value : '' + }).on ('changing', function (input, value) { + }); + + this.radioName = new Common.UI.RadioBox({ + el: $('#bookmarks-radio-name'), + labelText: this.textName, + name: 'asc-radio-bookmark-sort', + checked: true + }); + // this.radioName.on('change', _.bind(this.onRadioNameChange, this)); + + this.radioLocation = new Common.UI.RadioBox({ + el: $('#bookmarks-radio-location'), + labelText: this.textLocation, + name: 'asc-radio-bookmark-sort' + }); + // this.radioName.on('change', _.bind(this.onRadioNameChange, this)); + + this.bookmarksList = new Common.UI.ListView({ + el: $('#bookmarks-list', this.$window), + store: new Common.UI.DataViewStore() + }); + this.bookmarksList.store.comparator = function(rec) { + return (me.radioName.getValue() ? rec.get("name") : rec.get("location")); + }; + // this.bookmarksList.on('item:dblclick', _.bind(this.onDblClickFunction, this)); + // this.bookmarksList.on('entervalue', _.bind(this.onPrimary, this)); + // this.bookmarksList.on('item:select', _.bind(this.onSelectBookmark, this)); + + this.btnAdd = new Common.UI.Button({ + el: $('#bookmarks-btn-add') + }); + this.$window.find('#bookmarks-btn-add').on('click', _.bind(this.onDlgBtnClick, this)); + + this.btnGoto = new Common.UI.Button({ + el: $('#bookmarks-btn-goto') + }); + + this.btnDelete = new Common.UI.Button({ + el: $('#bookmarks-btn-delete') + }); + + this.afterRender(); + }, + + afterRender: function() { + this._setDefaults(this.props); + }, + + show: function() { + Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); + }, + + _setDefaults: function (props) { + if (props) { + } + }, + + getSettings: function () { + return {}; + }, + + onDlgBtnClick: function(event) { + var state = (typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event; + if (state == 'add') { + this.handler && this.handler.call(this, state, (state == 'add') ? this.getSettings() : undefined); + } + + this.close(); + }, + + onPrimary: function() { + return true; + }, + + textTitle: 'Bookmarks', + textLocation: 'Location', + textBookmarkName: 'Bookmark name', + textSort: 'Sort by', + textName: 'Name', + textAdd: 'Add', + textGoto: 'Go to', + textDelete: 'Delete', + textClose: 'Close' + + }, DE.Views.BookmarksDialog || {})) +}); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/Links.js b/apps/documenteditor/main/app/view/Links.js index a40710f1f..6bb9f6525 100644 --- a/apps/documenteditor/main/app/view/Links.js +++ b/apps/documenteditor/main/app/view/Links.js @@ -91,6 +91,10 @@ define([ me.fireEvent('links:hyperlink'); }); }); + + this.btnBookmarks.on('click', function (b, e) { + me.fireEvent('links:bookmarks'); + }); } return { @@ -151,6 +155,15 @@ define([ _injectComponent('#slot-btn-contents-update', this.btnContentsUpdate); this.paragraphControls.push(this.btnContentsUpdate); + this.btnBookmarks = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'btn-bookmarks', + caption: this.capBtnBookmarks, + disabled: true + }); + _injectComponent('#slot-btn-bookmarks', this.btnBookmarks); + this.paragraphControls.push(this.btnBookmarks); + this._state = {disabled: false}; Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); }, @@ -229,6 +242,8 @@ define([ btn.updateHint(me.tipInsertHyperlink + Common.Utils.String.platformKey('Ctrl+K')); }); + me.btnBookmarks.updateHint(me.tipBookmarks); + setEvents.call(me); }); }, @@ -267,7 +282,9 @@ define([ capBtnInsFootnote: 'Footnotes', confirmDeleteFootnotes: 'Do you want to delete all footnotes?', capBtnInsLink: 'Hyperlink', - tipInsertHyperlink: 'Add Hyperlink' + tipInsertHyperlink: 'Add Hyperlink', + capBtnBookmarks: 'Bookmark', + tipBookmarks: 'Create a bookmark' } }()), DE.Views.Links || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/resources/less/rightmenu.less b/apps/documenteditor/main/resources/less/rightmenu.less index 90b026654..12a2b1681 100644 --- a/apps/documenteditor/main/resources/less/rightmenu.less +++ b/apps/documenteditor/main/resources/less/rightmenu.less @@ -31,6 +31,10 @@ display: block; } + .padding-extra-small { + padding-bottom: 2px; + } + .padding-small { padding-bottom: 8px; } From 7cbbdeccc99aa784e8dcd0d4a26d3591abbe65a4 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 27 Feb 2018 14:55:58 +0300 Subject: [PATCH 02/14] [DE] Change hyperlink settings. --- apps/common/main/resources/less/buttons.less | 7 +++ .../main/app/view/HyperlinkSettingsDialog.js | 58 +++++++++++++++++-- 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/apps/common/main/resources/less/buttons.less b/apps/common/main/resources/less/buttons.less index 90545b262..f38daee66 100644 --- a/apps/common/main/resources/less/buttons.less +++ b/apps/common/main/resources/less/buttons.less @@ -512,6 +512,12 @@ border: 1px solid @input-border; .border-radius(@border-radius-small); + &.auto { + width: auto; + padding-left: 10px; + padding-right: 10px; + } + &:hover:not(.disabled), .over:not(.disabled) { background-color: @secondary !important; @@ -520,6 +526,7 @@ &:active:not(.disabled), &.active:not(.disabled) { background-color: @primary !important; + border-color: @primary; color: white; } diff --git a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js index bd2efee0b..5840bfced 100644 --- a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js @@ -42,6 +42,11 @@ if (Common === undefined) var Common = {}; +var c_oHyperlinkType = { + InternalLink:0, + WebLink: 1 +}; + define([ 'common/main/lib/util/utils', 'common/main/lib/component/InputField', @@ -61,11 +66,20 @@ define([ }, options || {}); this.template = [ - '
', - '
', - '', + '
', + '
', + '', + '', + '
', + '', + '', - '', '
', '', '
', @@ -94,6 +108,23 @@ define([ var me = this, $window = this.getChild(); + me.btnExternal = new Common.UI.Button({ + el: $('#id-dlg-hyperlink-external'), + enableToggle: true, + toggleGroup: 'hyperlink-type', + allowDepress: false, + pressed: true + }); + me.btnExternal.on('click', _.bind(me.onLinkTypeClick, me, c_oHyperlinkType.WebLink)); + + me.btnInternal = new Common.UI.Button({ + el: $('#id-dlg-hyperlink-internal'), + enableToggle: true, + toggleGroup: 'hyperlink-type', + allowDepress: false + }); + me.btnInternal.on('click', _.bind(me.onLinkTypeClick, me, c_oHyperlinkType.InternalLink)); + me.inputUrl = new Common.UI.InputField({ el : $('#id-dlg-hyperlink-url'), allowBlank : false, @@ -124,6 +155,17 @@ define([ $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('input').on('keypress', _.bind(this.onKeyPress, this)); + me.externalPanel = $window.find('#id-external-link'); + me.internalPanel = $window.find('#id-internal-link'); + }, + + ShowHideElem: function(value) { + this.externalPanel.toggleClass('hidden', value !== c_oHyperlinkType.WebLink); + this.internalPanel.toggleClass('hidden', value !== c_oHyperlinkType.InternalLink); + }, + + onLinkTypeClick: function(type, btn, event) { + this.ShowHideElem(type); }, show: function() { @@ -139,6 +181,10 @@ define([ if (props) { var me = this; + var type = c_oHyperlinkType.WebLink;//props.get_Type(); + (type == c_oHyperlinkType.WebLink) ? me.btnExternal.toggle(true) : me.btnInternal.toggle(true); + me.ShowHideElem(type); + if (props.get_Value()) { me.inputUrl.setValue(props.get_Value().replace(new RegExp(" ",'g'), "%20")); } else { @@ -225,6 +271,8 @@ define([ txtNotUrl: 'This field should be a URL in the format \"http://www.example.com\"', textTooltip: 'ScreenTip text', textDefault: 'Selected text', - textTitle: 'Hyperlink Settings' + textTitle: 'Hyperlink Settings', + textExternal: 'External Link', + textInternal: 'Place in Document' }, DE.Views.HyperlinkSettingsDialog || {})) }); \ No newline at end of file From 0808629f4a41b7983ec79434d8047762ea58ae5b Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 27 Mar 2018 15:21:15 +0300 Subject: [PATCH 03/14] [DE] Load and sort bookmarks. --- .../main/app/controller/Links.js | 5 ++- .../main/app/view/BookmarksDialog.js | 45 +++++++++++++++++-- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index 148632a4a..cadc512f2 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -316,12 +316,13 @@ define([ onBookmarksClick: function(btn) { var me = this; (new DE.Views.BookmarksDialog({ + api: me.api, + props: me.api.asc_GetBookmarksManager(), handler: function (result, settings) { if (settings) { } Common.NotificationCenter.trigger('edit:complete', me.toolbar); - }, - props: {} + } })).show(); }, diff --git a/apps/documenteditor/main/app/view/BookmarksDialog.js b/apps/documenteditor/main/app/view/BookmarksDialog.js index d2169905c..3a41364c6 100644 --- a/apps/documenteditor/main/app/view/BookmarksDialog.js +++ b/apps/documenteditor/main/app/view/BookmarksDialog.js @@ -130,21 +130,21 @@ define([ name: 'asc-radio-bookmark-sort', checked: true }); - // this.radioName.on('change', _.bind(this.onRadioNameChange, this)); + this.radioName.on('change', _.bind(this.onRadioSort, this)); this.radioLocation = new Common.UI.RadioBox({ el: $('#bookmarks-radio-location'), labelText: this.textLocation, name: 'asc-radio-bookmark-sort' }); - // this.radioName.on('change', _.bind(this.onRadioNameChange, this)); + this.radioLocation.on('change', _.bind(this.onRadioSort, this)); this.bookmarksList = new Common.UI.ListView({ el: $('#bookmarks-list', this.$window), store: new Common.UI.DataViewStore() }); this.bookmarksList.store.comparator = function(rec) { - return (me.radioName.getValue() ? rec.get("name") : rec.get("location")); + return (me.radioName.getValue() ? rec.get("value") : rec.get("location")); }; // this.bookmarksList.on('item:dblclick', _.bind(this.onDblClickFunction, this)); // this.bookmarksList.on('entervalue', _.bind(this.onPrimary, this)); @@ -158,10 +158,12 @@ define([ this.btnGoto = new Common.UI.Button({ el: $('#bookmarks-btn-goto') }); + this.btnGoto.on('click', _.bind(this.gotoBookmark, this)); this.btnDelete = new Common.UI.Button({ el: $('#bookmarks-btn-delete') }); + this.btnDelete.on('click', _.bind(this.deleteBookmark, this)); this.afterRender(); }, @@ -176,6 +178,19 @@ define([ _setDefaults: function (props) { if (props) { + var store = this.bookmarksList.store, + count = props.get_Count(), + arr = []; + for (var i=0; i0) { + // this.api.gotoBookmark(rec.get('value')); + } + }, + + deleteBookmark: function(btn, eOpts){ + var rec = this.bookmarksList.getSelectedRec(); + if (rec.length>0) { + // this.api.deleteBookmark(rec.get('value')); + var store = this.bookmarksList.store; + var idx = _.indexOf(store.models, rec[0]); + store.remove(rec[0]); + } + }, + + onRadioSort: function(field, newValue, eOpts) { + if (newValue) { + this.bookmarksList.store.sort(); + this.bookmarksList.onResetItems(); + } + }, + textTitle: 'Bookmarks', textLocation: 'Location', textBookmarkName: 'Bookmark name', From 4be5400530553c174d9ca0178d6838dc5197d7bd Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 28 Mar 2018 12:01:24 +0300 Subject: [PATCH 04/14] [DE] Goto, Remove bookmarks --- apps/documenteditor/main/app/view/BookmarksDialog.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/documenteditor/main/app/view/BookmarksDialog.js b/apps/documenteditor/main/app/view/BookmarksDialog.js index 3a41364c6..1f9ce9b0f 100644 --- a/apps/documenteditor/main/app/view/BookmarksDialog.js +++ b/apps/documenteditor/main/app/view/BookmarksDialog.js @@ -179,12 +179,12 @@ define([ _setDefaults: function (props) { if (props) { var store = this.bookmarksList.store, - count = props.get_Count(), + count = props.asc_GetCount(), arr = []; for (var i=0; i0) { - // this.api.gotoBookmark(rec.get('value')); + this.props.asc_GoToBookmark(rec[0].get('value')); } }, deleteBookmark: function(btn, eOpts){ var rec = this.bookmarksList.getSelectedRec(); if (rec.length>0) { - // this.api.deleteBookmark(rec.get('value')); + this.props.asc_RemoveBookmark(rec[0].get('value')); var store = this.bookmarksList.store; var idx = _.indexOf(store.models, rec[0]); store.remove(rec[0]); From 685c3073f16b3cd06fd7dbc10195a5c7568a7361 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 28 Mar 2018 15:50:41 +0300 Subject: [PATCH 05/14] [DE] Add hidden bookmarks --- .../main/app/view/BookmarksDialog.js | 93 +++++++++++++------ 1 file changed, 67 insertions(+), 26 deletions(-) diff --git a/apps/documenteditor/main/app/view/BookmarksDialog.js b/apps/documenteditor/main/app/view/BookmarksDialog.js index 1f9ce9b0f..1b8def99e 100644 --- a/apps/documenteditor/main/app/view/BookmarksDialog.js +++ b/apps/documenteditor/main/app/view/BookmarksDialog.js @@ -51,7 +51,7 @@ define([ DE.Views.BookmarksDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ options: { contentWidth: 300, - height: 340 + height: 360 }, initialize : function(options) { @@ -88,11 +88,16 @@ define([ '', '', '', - '', + '', '', '', '', '', + '', + '', + '
', + '', + '', '', '
', '
', @@ -120,9 +125,9 @@ define([ validateOnChange: true, validateOnBlur: false, style : 'width: 195px;', - value : '' - }).on ('changing', function (input, value) { - }); + value : '', + maxLength: 40 + }).on('changing', _.bind(this.onNameChanging, this)); this.radioName = new Common.UI.RadioBox({ el: $('#bookmarks-radio-name'), @@ -141,14 +146,15 @@ define([ this.bookmarksList = new Common.UI.ListView({ el: $('#bookmarks-list', this.$window), - store: new Common.UI.DataViewStore() + store: new Common.UI.DataViewStore(), + itemTemplate: _.template('
<%= value %>
') }); this.bookmarksList.store.comparator = function(rec) { return (me.radioName.getValue() ? rec.get("value") : rec.get("location")); }; - // this.bookmarksList.on('item:dblclick', _.bind(this.onDblClickFunction, this)); - // this.bookmarksList.on('entervalue', _.bind(this.onPrimary, this)); - // this.bookmarksList.on('item:select', _.bind(this.onSelectBookmark, this)); + this.bookmarksList.on('item:dblclick', _.bind(this.onDblClickBookmark, this)); + this.bookmarksList.on('entervalue', _.bind(this.onPrimary, this)); + this.bookmarksList.on('item:select', _.bind(this.onSelectBookmark, this)); this.btnAdd = new Common.UI.Button({ el: $('#bookmarks-btn-add') @@ -165,6 +171,12 @@ define([ }); this.btnDelete.on('click', _.bind(this.deleteBookmark, this)); + this.chHidden = new Common.UI.CheckBox({ + el: $('#bookmarks-checkbox-hidden'), + labelText: this.textHidden + }); + this.chHidden.on('change', _.bind(this.onChangeHidden, this)); + this.afterRender(); }, @@ -177,21 +189,8 @@ define([ }, _setDefaults: function (props) { - if (props) { - var store = this.bookmarksList.store, - count = props.asc_GetCount(), - arr = []; - for (var i=0; i0) { @@ -218,6 +244,10 @@ define([ } }, + onDblClickBookmark: function(listView, itemView, record) { + this.props.asc_GoToBookmark(record.get('value')); + }, + deleteBookmark: function(btn, eOpts){ var rec = this.bookmarksList.getSelectedRec(); if (rec.length>0) { @@ -235,6 +265,16 @@ define([ } }, + onChangeHidden: function(field, newValue, oldValue, eOpts){ + this.refreshBookmarks(); + }, + + onNameChanging: function (input, value) { + this.bookmarksList.deselectAll(); + // this.btnGoto.setDisabled(true); + // this.btnDelete.setDisabled(true); + }, + textTitle: 'Bookmarks', textLocation: 'Location', textBookmarkName: 'Bookmark name', @@ -243,7 +283,8 @@ define([ textAdd: 'Add', textGoto: 'Go to', textDelete: 'Delete', - textClose: 'Close' + textClose: 'Close', + textHidden: 'Hidden bookmarks' }, DE.Views.BookmarksDialog || {})) }); \ No newline at end of file From 9f77f3d7920b4df769b00b349793ae6efce95d12 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 28 Mar 2018 17:44:38 +0300 Subject: [PATCH 06/14] [DE] Refactoring bookmarks --- .../main/app/view/BookmarksDialog.js | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/apps/documenteditor/main/app/view/BookmarksDialog.js b/apps/documenteditor/main/app/view/BookmarksDialog.js index 1b8def99e..923177ad6 100644 --- a/apps/documenteditor/main/app/view/BookmarksDialog.js +++ b/apps/documenteditor/main/app/view/BookmarksDialog.js @@ -157,17 +157,20 @@ define([ this.bookmarksList.on('item:select', _.bind(this.onSelectBookmark, this)); this.btnAdd = new Common.UI.Button({ - el: $('#bookmarks-btn-add') + el: $('#bookmarks-btn-add'), + disabled: true }); this.$window.find('#bookmarks-btn-add').on('click', _.bind(this.onDlgBtnClick, this)); this.btnGoto = new Common.UI.Button({ - el: $('#bookmarks-btn-goto') + el: $('#bookmarks-btn-goto'), + disabled: true }); this.btnGoto.on('click', _.bind(this.gotoBookmark, this)); this.btnDelete = new Common.UI.Button({ - el: $('#bookmarks-btn-delete') + el: $('#bookmarks-btn-delete'), + disabled: true }); this.btnDelete.on('click', _.bind(this.deleteBookmark, this)); @@ -215,17 +218,19 @@ define([ if (this.props) { var store = this.bookmarksList.store, count = this.props.asc_GetCount(), + showHidden = this.chHidden.getValue()=='checked', arr = []; for (var i=0; i Date: Thu, 29 Mar 2018 11:53:42 +0300 Subject: [PATCH 07/14] [DE] Bookmarks: save option for hidden bookmarks --- apps/documenteditor/main/app/view/BookmarksDialog.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/view/BookmarksDialog.js b/apps/documenteditor/main/app/view/BookmarksDialog.js index 923177ad6..8c0f0c2b1 100644 --- a/apps/documenteditor/main/app/view/BookmarksDialog.js +++ b/apps/documenteditor/main/app/view/BookmarksDialog.js @@ -176,7 +176,8 @@ define([ this.chHidden = new Common.UI.CheckBox({ el: $('#bookmarks-checkbox-hidden'), - labelText: this.textHidden + labelText: this.textHidden, + value: Common.Utils.InternalSettings.get("de-bookmarks-hidden") || false }); this.chHidden.on('change', _.bind(this.onChangeHidden, this)); @@ -191,6 +192,11 @@ define([ Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); }, + close: function() { + Common.Views.AdvancedSettingsWindow.prototype.close.apply(this, arguments); + Common.Utils.InternalSettings.set("de-bookmarks-hidden", this.chHidden.getValue()=='checked'); + }, + _setDefaults: function (props) { this.refreshBookmarks(); this.bookmarksList.scrollToRecord(this.bookmarksList.selectByIndex(0)); @@ -204,7 +210,6 @@ define([ var state = (typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event; if (state == 'add') { this.props.asc_AddBookmark(this.txtName.getValue()); - // this.handler && this.handler.call(this, state, (state == 'add') ? this.getSettings() : undefined); } this.close(); From d5444d9c4dac1895784b857c6fbb65590921204e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 29 Mar 2018 15:22:58 +0300 Subject: [PATCH 08/14] [DE] Add internal hyperlink --- .../main/app/view/HyperlinkSettingsDialog.js | 148 +++++++++++++++--- 1 file changed, 130 insertions(+), 18 deletions(-) diff --git a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js index 65440c651..233adfac9 100644 --- a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js @@ -78,7 +78,7 @@ define([ '', '', '', '
', '', @@ -98,6 +98,7 @@ define([ this.options.tpl = _.template(this.template)(this.options); this.api = this.options.api; this._originalProps = null; + this.linkType = c_oHyperlinkType.WebLink; Common.UI.Window.prototype.initialize.call(this, this.options); }, @@ -153,6 +154,12 @@ define([ maxLength : Asc.c_oAscMaxTooltipLength }); + me.internalList = new Common.UI.TreeView({ + el: $('#id-dlg-hyperlink-list'), + store: new Common.UI.TreeViewStore(), + enableKeyEvents: false + }); + $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('input').on('keypress', _.bind(this.onKeyPress, this)); me.externalPanel = $window.find('#id-external-link'); @@ -162,6 +169,81 @@ define([ ShowHideElem: function(value) { this.externalPanel.toggleClass('hidden', value !== c_oHyperlinkType.WebLink); this.internalPanel.toggleClass('hidden', value !== c_oHyperlinkType.InternalLink); + var store = this.internalList.store; + if (value==c_oHyperlinkType.InternalLink && store.length<1) { + var anchors = this.api.asc_GetHyperlinkAnchors(), + count = anchors.length, + prev_level = 0, + header_level = 0, + arr = []; + arr.push(new Common.UI.TreeViewModel({ + name : this.txtBeginning, + level: 0, + index: 0, + hasParent: false, + isEmptyItem: false, + isNotHeader: true, + hasSubItems: false + })); + arr.push(new Common.UI.TreeViewModel({ + name : this.txtHeadings, + level: 0, + index: 1, + hasParent: false, + isEmptyItem: false, + isNotHeader: false, + hasSubItems: false + })); + + for (var i=0; iprev_level) + arr[arr.length-1].set('hasSubItems', true); + if (level<=header_level) { + header_level = level; + hasParent = false; + } + arr.push(new Common.UI.TreeViewModel({ + name : anchor.asc_GetHeadingText(), + level: level, + index: i+2, + hasParent: hasParent + })); + prev_level = level; + } + } + arr.push(new Common.UI.TreeViewModel({ + name : this.txtBookmarks, + level: 0, + index: arr.length, + hasParent: false, + isEmptyItem: false, + isNotHeader: false, + hasSubItems: false + })); + + prev_level = 0; + for (var i=0; i0) { + props.put_Bookmark(rec[0].get('name')); + if (rec[0].get('index')==0) + props.put_TopOfDocument(); + } + } if (!me.inputDisplay.isDisabled() && ( this.isTextChanged || _.isEmpty(me.inputDisplay.getValue()))) { if (_.isEmpty(me.inputDisplay.getValue())) @@ -245,13 +350,17 @@ define([ _handleInput: function(state) { if (this.options.handler) { if (state == 'ok') { - var checkurl = this.inputUrl.checkValidate(), - checkdisp = this.inputDisplay.checkValidate(); - if (checkurl !== true) { - this.inputUrl.cmpEl.find('input').focus(); - return; + if (this.linkType == c_oHyperlinkType.WebLink) { + if (this.inputUrl.checkValidate() !== true) { + this.inputUrl.cmpEl.find('input').focus(); + return; + } + } else { + var rec = this.internalList.getSelectedRec(); + if (rec.length<1 || rec[0].get('level')==0 && rec[0].get('index')>0) + return; } - if (checkdisp !== true) { + if (this.inputDisplay.checkValidate() !== true) { this.inputDisplay.cmpEl.find('input').focus(); return; } @@ -273,6 +382,9 @@ define([ textDefault: 'Selected text', textTitle: 'Hyperlink Settings', textExternal: 'External Link', - textInternal: 'Place in Document' + textInternal: 'Place in Document', + txtBeginning: 'Beginning of document', + txtHeadings: 'Headings', + txtBookmarks: 'Bookmarks' }, DE.Views.HyperlinkSettingsDialog || {})) }); \ No newline at end of file From 29212eadfe7330fcfd8d6a58a169b92bb2741a8e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 29 Mar 2018 15:31:03 +0300 Subject: [PATCH 09/14] [DE] Refactoring hyperlinks --- .../main/app/view/HyperlinkSettingsDialog.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js index 233adfac9..6f3fc2cf7 100644 --- a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js @@ -302,7 +302,8 @@ define([ getSettings: function () { var me = this, - props = new Asc.CHyperlinkProperty(); + props = new Asc.CHyperlinkProperty(), + display = ''; if (this.linkType == c_oHyperlinkType.WebLink) { var url = $.trim(me.inputUrl.getValue()); @@ -313,18 +314,20 @@ define([ url = url.replace(new RegExp("%20",'g')," "); props.put_Value(url); props.put_Bookmark(null); + display = url; } else { var rec = this.internalList.getSelectedRec(); if (rec.length>0) { props.put_Bookmark(rec[0].get('name')); if (rec[0].get('index')==0) props.put_TopOfDocument(); + display = rec[0].get('name'); } } if (!me.inputDisplay.isDisabled() && ( this.isTextChanged || _.isEmpty(me.inputDisplay.getValue()))) { if (_.isEmpty(me.inputDisplay.getValue())) - me.inputDisplay.setValue(url); + me.inputDisplay.setValue(display); props.put_Text(me.inputDisplay.getValue()); } else { props.put_Text(null); From c23422465e60b6cf0fe705b3e2eff102ccd96781 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 29 Mar 2018 16:02:54 +0300 Subject: [PATCH 10/14] [DE] Hyperlink refactoring --- .../main/app/view/HyperlinkSettingsDialog.js | 152 ++++++++++-------- 1 file changed, 84 insertions(+), 68 deletions(-) diff --git a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js index 6f3fc2cf7..ef7595db9 100644 --- a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js @@ -157,7 +157,12 @@ define([ me.internalList = new Common.UI.TreeView({ el: $('#id-dlg-hyperlink-list'), store: new Common.UI.TreeViewStore(), - enableKeyEvents: false + enableKeyEvents: true + }); + me.internalList.on('item:select', _.bind(this.onSelectItem, this)); + + me.btnOk = new Common.UI.Button({ + el: $window.find('.primary') }); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); @@ -170,79 +175,86 @@ define([ this.externalPanel.toggleClass('hidden', value !== c_oHyperlinkType.WebLink); this.internalPanel.toggleClass('hidden', value !== c_oHyperlinkType.InternalLink); var store = this.internalList.store; - if (value==c_oHyperlinkType.InternalLink && store.length<1) { - var anchors = this.api.asc_GetHyperlinkAnchors(), - count = anchors.length, - prev_level = 0, - header_level = 0, - arr = []; - arr.push(new Common.UI.TreeViewModel({ - name : this.txtBeginning, - level: 0, - index: 0, - hasParent: false, - isEmptyItem: false, - isNotHeader: true, - hasSubItems: false - })); - arr.push(new Common.UI.TreeViewModel({ - name : this.txtHeadings, - level: 0, - index: 1, - hasParent: false, - isEmptyItem: false, - isNotHeader: false, - hasSubItems: false - })); + if (value==c_oHyperlinkType.InternalLink) { + if (store.length<1) { + var anchors = this.api.asc_GetHyperlinkAnchors(), + count = anchors.length, + prev_level = 0, + header_level = 0, + arr = []; + arr.push(new Common.UI.TreeViewModel({ + name : this.txtBeginning, + level: 0, + index: 0, + hasParent: false, + isEmptyItem: false, + isNotHeader: true, + hasSubItems: false + })); + arr.push(new Common.UI.TreeViewModel({ + name : this.txtHeadings, + level: 0, + index: 1, + hasParent: false, + isEmptyItem: false, + isNotHeader: false, + hasSubItems: false + })); - for (var i=0; iprev_level) - arr[arr.length-1].set('hasSubItems', true); - if (level<=header_level) { - header_level = level; - hasParent = false; + for (var i=0; iprev_level) + arr[arr.length-1].set('hasSubItems', true); + if (level<=header_level) { + header_level = level; + hasParent = false; + } + arr.push(new Common.UI.TreeViewModel({ + name : anchor.asc_GetHeadingText(), + level: level, + index: i+2, + hasParent: hasParent + })); + prev_level = level; } - arr.push(new Common.UI.TreeViewModel({ - name : anchor.asc_GetHeadingText(), - level: level, - index: i+2, - hasParent: hasParent - })); - prev_level = level; } - } - arr.push(new Common.UI.TreeViewModel({ - name : this.txtBookmarks, - level: 0, - index: arr.length, - hasParent: false, - isEmptyItem: false, - isNotHeader: false, - hasSubItems: false - })); + arr.push(new Common.UI.TreeViewModel({ + name : this.txtBookmarks, + level: 0, + index: arr.length, + hasParent: false, + isEmptyItem: false, + isNotHeader: false, + hasSubItems: false + })); - prev_level = 0; - for (var i=0; i0); + + } else + this.btnOk.setDisabled(false); + this.linkType = value; }, @@ -250,6 +262,10 @@ define([ this.ShowHideElem(type); }, + onSelectItem: function(picker, item, record, e){ + this.btnOk.setDisabled(record.get('level')==0 && record.get('index')>0); + }, + show: function() { Common.UI.Window.prototype.show.apply(this, arguments); From 469d3c1db11bca4694e370e6c382efe79b6598c9 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 30 Mar 2018 15:43:48 +0300 Subject: [PATCH 11/14] [DE] Refactoring hyperlinks to headings. --- .../main/app/view/HyperlinkSettingsDialog.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js index ef7595db9..cb1073a77 100644 --- a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js @@ -216,7 +216,9 @@ define([ name : anchor.asc_GetHeadingText(), level: level, index: i+2, - hasParent: hasParent + hasParent: hasParent, + type: Asc.c_oAscHyperlinkAnchor.Heading, + headingParagraph: anchor.asc_GetHeadingParagraph() })); prev_level = level; } @@ -242,7 +244,8 @@ define([ name : anchor.asc_GetBookmarkName(), level: 1, index: arr.length, - hasParent: false + hasParent: false, + type: Asc.c_oAscHyperlinkAnchor.Bookmark })); prev_level = 1; } @@ -294,8 +297,13 @@ define([ } else { if (props.is_TopOfDocument()) this.internalList.selectByIndex(0); - else { - var rec = this.internalList.store.findWhere({name: bookmark}); + else if (props.is_Heading()) { + var heading = props.get_Heading(), + rec = this.internalList.store.findWhere({type: Asc.c_oAscHyperlinkAnchor.Heading, headingParagraph: heading }); + if (rec) + this.internalList.scrollToRecord(this.internalList.selectRecord(rec)); + } else { + var rec = this.internalList.store.findWhere({type: Asc.c_oAscHyperlinkAnchor.Bookmark, name: bookmark}); if (rec) this.internalList.scrollToRecord(this.internalList.selectRecord(rec)); } @@ -337,6 +345,9 @@ define([ props.put_Bookmark(rec[0].get('name')); if (rec[0].get('index')==0) props.put_TopOfDocument(); + var para = rec[0].get('headingParagraph'); + if (para) + props.put_Heading(para); display = rec[0].get('name'); } } From bcfa677bf068b11a58929887cda6a2ea00f3c624 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 2 Apr 2018 16:56:14 +0300 Subject: [PATCH 12/14] [DE] Add translation for bookmarks --- apps/documenteditor/main/locale/en.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index fb020e770..17607887e 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -779,6 +779,16 @@ "DE.Controllers.Toolbar.txtSymbol_vdots": "Vertical ellipsis", "DE.Controllers.Toolbar.txtSymbol_xsi": "Xi", "DE.Controllers.Toolbar.txtSymbol_zeta": "Zeta", + "DE.Views.BookmarksDialog.textTitle": "Bookmarks", + "DE.Views.BookmarksDialog.textLocation": "Location", + "DE.Views.BookmarksDialog.textBookmarkName": "Bookmark name", + "DE.Views.BookmarksDialog.textSort": "Sort by", + "DE.Views.BookmarksDialog.textName": "Name", + "DE.Views.BookmarksDialog.textAdd": "Add", + "DE.Views.BookmarksDialog.textGoto": "Go to", + "DE.Views.BookmarksDialog.textDelete": "Delete", + "DE.Views.BookmarksDialog.textClose": "Close", + "DE.Views.BookmarksDialog.textHidden": "Hidden bookmarks", "DE.Views.ChartSettings.textAdvanced": "Show advanced settings", "DE.Views.ChartSettings.textArea": "Area", "DE.Views.ChartSettings.textBar": "Bar", @@ -1169,6 +1179,11 @@ "DE.Views.HyperlinkSettingsDialog.textUrl": "Link to", "DE.Views.HyperlinkSettingsDialog.txtEmpty": "This field is required", "DE.Views.HyperlinkSettingsDialog.txtNotUrl": "This field should be a URL in the \"http://www.example.com\" format", + "DE.Views.HyperlinkSettingsDialog.textExternal": "External Link", + "DE.Views.HyperlinkSettingsDialog.textInternal": "Place in Document", + "DE.Views.HyperlinkSettingsDialog.txtBeginning": "Beginning of document", + "DE.Views.HyperlinkSettingsDialog.txtHeadings": "Headings", + "DE.Views.HyperlinkSettingsDialog.txtBookmarks": "Bookmarks", "DE.Views.ImageSettings.textAdvanced": "Show advanced settings", "DE.Views.ImageSettings.textEdit": "Edit", "DE.Views.ImageSettings.textEditObject": "Edit Object", @@ -1283,6 +1298,8 @@ "DE.Views.Links.tipContentsUpdate": "Refresh table of contents", "DE.Views.Links.tipInsertHyperlink": "Add hyperlink", "DE.Views.Links.tipNotes": "Insert or edit footnotes", + "DE.Views.Links.capBtnBookmarks": "Bookmark", + "DE.Views.Links.tipBookmarks": "Create a bookmark", "DE.Views.MailMergeEmailDlg.cancelButtonText": "Cancel", "DE.Views.MailMergeEmailDlg.filePlaceholder": "PDF", "DE.Views.MailMergeEmailDlg.okButtonText": "Send", From 4998d4b774e9752558e66b0a672b2a19fb1de2dd Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 2 Apr 2018 17:06:10 +0300 Subject: [PATCH 13/14] [DE] Edit changelog (create bookmarks and internal hyperlinks). --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2515725c..b5569ea41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ * ### Document Editor -* +* Create and manage bookmarks +* Create internal hyperlinks to bookmarks and headings ### Spreadsheet Editor * Support Spanish in formulas From 23a49167f10e0a6a49431cb177e868fb3c8d3808 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 3 Apr 2018 13:22:24 +0300 Subject: [PATCH 14/14] [PE][SSE] Change interface for creating hyperlinks. --- .../main/app/view/HyperlinkSettingsDialog.js | 7 +- .../main/app/view/HyperlinkSettingsDialog.js | 60 ++++++++------- apps/presentationeditor/main/locale/en.json | 2 +- .../main/app/view/HyperlinkSettingsDialog.js | 76 +++++++++++-------- apps/spreadsheeteditor/main/locale/en.json | 2 +- 5 files changed, 78 insertions(+), 69 deletions(-) diff --git a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js index cb1073a77..739f09689 100644 --- a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js @@ -98,7 +98,6 @@ define([ this.options.tpl = _.template(this.template)(this.options); this.api = this.options.api; this._originalProps = null; - this.linkType = c_oHyperlinkType.WebLink; Common.UI.Window.prototype.initialize.call(this, this.options); }, @@ -257,8 +256,6 @@ define([ } else this.btnOk.setDisabled(false); - - this.linkType = value; }, onLinkTypeClick: function(type, btn, event) { @@ -329,7 +326,7 @@ define([ props = new Asc.CHyperlinkProperty(), display = ''; - if (this.linkType == c_oHyperlinkType.WebLink) { + if (this.btnExternal.isActive()) {//WebLink var url = $.trim(me.inputUrl.getValue()); if (! /(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url) ) @@ -380,7 +377,7 @@ define([ _handleInput: function(state) { if (this.options.handler) { if (state == 'ok') { - if (this.linkType == c_oHyperlinkType.WebLink) { + if (this.btnExternal.isActive()) {//WebLink if (this.inputUrl.checkValidate() !== true) { this.inputUrl.cmpEl.find('input').focus(); return; diff --git a/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js b/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js index 31cbe3712..796a8e1c9 100644 --- a/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js @@ -69,14 +69,14 @@ define([ }, options || {}); this.template = [ - '
', - '
', - '', + '
', + '
', + '', + '', '
', - '', '', @@ -89,11 +89,11 @@ define([ '', '
', '
', - '', + '', '
', '', '
', - '', + '', '
', '', '
', @@ -116,23 +116,22 @@ define([ var me = this, $window = this.getChild(); - me._arrTypeSrc = [ - {displayValue: me.textInternalLink, value: c_oHyperlinkType.InternalLink}, - {displayValue: me.textExternalLink, value: c_oHyperlinkType.WebLink} - ]; - - me.cmbLinkType = new Common.UI.ComboBox({ - el: $('#id-dlg-hyperlink-type'), - cls: 'input-group-nr', - style: 'width: 100%;', - menuStyle: 'min-width: 318px;', - editable: false, - data: this._arrTypeSrc + me.btnExternal = new Common.UI.Button({ + el: $('#id-dlg-hyperlink-external'), + enableToggle: true, + toggleGroup: 'hyperlink-type', + allowDepress: false, + pressed: true }); - me.cmbLinkType.setValue(me._arrTypeSrc[1].value); - me.cmbLinkType.on('selected', _.bind(function(combo, record) { - this.ShowHideElem(record.value); - }, me)); + me.btnExternal.on('click', _.bind(me.onLinkTypeClick, me, c_oHyperlinkType.WebLink)); + + me.btnInternal = new Common.UI.Button({ + el: $('#id-dlg-hyperlink-internal'), + enableToggle: true, + toggleGroup: 'hyperlink-type', + allowDepress: false + }); + me.btnInternal.on('click', _.bind(me.onLinkTypeClick, me, c_oHyperlinkType.InternalLink)); me.inputUrl = new Common.UI.InputField({ el : $('#id-dlg-hyperlink-url'), @@ -217,7 +216,7 @@ define([ var me = this; var type = me.parseUrl(props.get_Value()); - me.cmbLinkType.setValue(type); + (type == c_oHyperlinkType.WebLink) ? me.btnExternal.toggle(true) : me.btnInternal.toggle(true); me.ShowHideElem(type); if (props.get_Text()!==null) { @@ -239,7 +238,7 @@ define([ var me = this, props = new Asc.CHyperlinkProperty(); var def_display = ''; - if (me.cmbLinkType.getValue() == c_oHyperlinkType.InternalLink) { + if (this.btnInternal.isActive()) {//InternalLink var url = "ppaction://hlink"; var tip = ''; var txttip = me.inputTip.getValue(); @@ -298,7 +297,7 @@ define([ _handleInput: function(state) { if (this.options.handler) { if (state == 'ok') { - var checkurl = (this.cmbLinkType.getValue() == c_oHyperlinkType.WebLink) ? this.inputUrl.checkValidate() : true, + var checkurl = (this.btnExternal.isActive()) ? this.inputUrl.checkValidate() : true, checkdisp = this.inputDisplay.checkValidate(); if (checkurl !== true) { this.inputUrl.cmpEl.find('input').focus(); @@ -321,6 +320,10 @@ define([ this.internalPanel.toggleClass('hidden', value !== c_oHyperlinkType.InternalLink); }, + onLinkTypeClick: function(type, btn, event) { + this.ShowHideElem(type); + }, + parseUrl: function(url) { if (url===null || url===undefined || url=='' ) return c_oHyperlinkType.WebLink; @@ -364,13 +367,12 @@ define([ }, textTitle: 'Hyperlink Settings', - textInternalLink: 'Place In This Document', - textExternalLink: 'File or Web Page', + textInternalLink: 'Slide In This Presentation', + textExternalLink: 'External Link', textEmptyLink: 'Enter link here', textEmptyDesc: 'Enter caption here', textEmptyTooltip: 'Enter tooltip here', txtSlide: 'Slide', - textLinkType: 'Link Type', strDisplay: 'Display', textTipText: 'Screen Tip Text', strLinkTo: 'Link To', diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index a60255b37..6aba18f05 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -980,7 +980,7 @@ "PE.Views.HyperlinkSettingsDialog.textEmptyTooltip": "Enter tooltip here", "PE.Views.HyperlinkSettingsDialog.textExternalLink": "External Link", "PE.Views.HyperlinkSettingsDialog.textInternalLink": "Slide In This Presentation", - "PE.Views.HyperlinkSettingsDialog.textLinkType": "Link Type", + "del_PE.Views.HyperlinkSettingsDialog.textLinkType": "Link Type", "PE.Views.HyperlinkSettingsDialog.textTipText": "ScreenTip Text", "PE.Views.HyperlinkSettingsDialog.textTitle": "Hyperlink Settings", "PE.Views.HyperlinkSettingsDialog.txtEmpty": "This field is required", diff --git a/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js index 4dd36c427..8fb87634e 100644 --- a/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js @@ -63,18 +63,17 @@ define([ this.template = [ '
', - '
', - '', + '
', + '', + '', '
', - '', - '