From e5f0bbcdfc0c259a5f6ac6a45105cb28f2658fa6 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 15 Oct 2020 14:39:44 +0300 Subject: [PATCH] [DE] Fix preview, updating and adding TOF --- .../main/app/controller/Links.js | 27 +++++++++++++++---- apps/documenteditor/main/app/view/Links.js | 3 ++- .../main/app/view/TableOfContentsSettings.js | 20 +++++++------- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index 0c7b37cb6..c73d16374 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -48,7 +48,8 @@ define([ 'documenteditor/main/app/view/BookmarksDialog', 'documenteditor/main/app/view/CaptionDialog', 'documenteditor/main/app/view/NotesRemoveDialog', - 'documenteditor/main/app/view/CrossReferenceDialog' + 'documenteditor/main/app/view/CrossReferenceDialog', + 'common/main/lib/view/OptionsDialog' ], function () { 'use strict'; @@ -503,17 +504,33 @@ define([ onAscReplaceCurrentTOF: function(apiCallback) { Common.UI.warning({ msg: this.view.confirmReplaceTOF, - buttons: ['ok', 'cancel'], - primary: 'ok', + buttons: ['yes', 'no', 'cancel'], + primary: 'yes', callback: _.bind(function(btn) { - apiCallback && apiCallback(btn === 'ok'); + if (btn=='yes' || btn=='no') { + apiCallback && apiCallback(btn === 'yes'); + } Common.NotificationCenter.trigger('edit:complete', this.toolbar); }, this) }); }, onAscTOFUpdate: function(apiCallback) { - if (apiCallback) apiCallback.call(); + var me = this; + (new Common.Views.OptionsDialog({ + width: 300, + title: this.view.titleUpdateTOF, + items: [ + {caption: this.view.textUpdatePages, value: true, checked: true}, + {caption: this.view.textUpdateAll, value: false, checked: false} + ], + handler: function (dlg, result) { + if (result=='ok') { + apiCallback && apiCallback(dlg.getSettings()); + } + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } + })).show(); } }, DE.Controllers.Links || {})); diff --git a/apps/documenteditor/main/app/view/Links.js b/apps/documenteditor/main/app/view/Links.js index a721420f1..b6e264b9e 100644 --- a/apps/documenteditor/main/app/view/Links.js +++ b/apps/documenteditor/main/app/view/Links.js @@ -406,7 +406,8 @@ define([ capBtnTOF: 'Table of Figures', tipTableFiguresUpdate: 'Refresh table of figures', tipTableFigures: 'Insert table of figures', - confirmReplaceTOF: 'Do you want to replace the selected table of figures?' + confirmReplaceTOF: 'Do you want to replace the selected table of figures?', + titleUpdateTOF: 'Refresh Table of Figures' } }()), DE.Views.Links || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/TableOfContentsSettings.js b/apps/documenteditor/main/app/view/TableOfContentsSettings.js index 7217ed4b3..3fc4a5dd6 100644 --- a/apps/documenteditor/main/app/view/TableOfContentsSettings.js +++ b/apps/documenteditor/main/app/view/TableOfContentsSettings.js @@ -174,7 +174,7 @@ define([ properties.put_RightAlignTab(this.chAlign.getValue() == 'checked'); properties.put_TabLeader(this.cmbLeader.getValue()); } - this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); + (this.type==1) ? this.api.SetDrawImagePlaceTableOfFigures('tableofcontents-img', properties) : this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); this.scrollerY.update(); } }, this)); @@ -193,7 +193,7 @@ define([ if (checked) { properties.put_TabLeader(this.cmbLeader.getValue()); } - this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); + (this.type==1) ? this.api.SetDrawImagePlaceTableOfFigures('tableofcontents-img', properties) : this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); this.scrollerY.update(); } }, this)); @@ -216,7 +216,7 @@ define([ if (this.api && !this._noApply) { var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr(); properties.put_TabLeader(record.value); - this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); + (this.type==1) ? this.api.SetDrawImagePlaceTableOfFigures('tableofcontents-img', properties) : this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); this.scrollerY.update(); } }, this)); @@ -230,7 +230,7 @@ define([ if (this.api && !this._noApply) { var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr(); properties.put_Hyperlink(field.getValue()=='checked'); - this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); + (this.type==1) ? this.api.SetDrawImagePlaceTableOfFigures('tableofcontents-img', properties) : this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); this.scrollerY.update(); } }, this)); @@ -297,7 +297,7 @@ define([ if (this.api && !this._noApply) { var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr(); properties.put_IncludeLabelAndNumber(field.getValue()=='checked'); - this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); + this.api.SetDrawImagePlaceTableOfFigures('tableofcontents-img', properties); this.scrollerY.update(); } }, this)); @@ -410,7 +410,7 @@ define([ if (this.api && !this._noApply) { var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr(); properties.put_StylesType(record.value); - this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); + (this.type==1) ? this.api.SetDrawImagePlaceTableOfFigures('tableofcontents-img', properties) : this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); this.scrollerY.update(); } }, this)); @@ -438,7 +438,7 @@ define([ }, close: function() { - this.api.SetDrawImagePlaceContents(null); + (this.type==1) ? this.api.SetDrawImagePlaceTableOfFigures(null) : this.api.SetDrawImagePlaceContents(null); this.scrollerY.update(); Common.Views.AdvancedSettingsWindow.prototype.close.apply(this); }, @@ -482,7 +482,7 @@ define([ } } - this.api.SetDrawImagePlaceContents('tableofcontents-img', this._originalProps); + (this.type==1) ? this.api.SetDrawImagePlaceTableOfFigures('tableofcontents-img', this._originalProps) : this.api.SetDrawImagePlaceContents('tableofcontents-img', this._originalProps); this.scrollerY.update(); this._noApply = false; @@ -807,7 +807,7 @@ define([ var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr(); properties.put_Caption(record.value); properties.clear_Styles(); - this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); + this.api.SetDrawImagePlaceTableOfFigures('tableofcontents-img', properties); this.scrollerY.update(); } }, @@ -818,7 +818,7 @@ define([ properties.put_Caption(null); properties.clear_Styles(); properties.add_Style(record.displayValue, 0); - this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); + this.api.SetDrawImagePlaceTableOfFigures('tableofcontents-img', properties); this.scrollerY.update(); } },