[DE] Fix preview, updating and adding TOF

This commit is contained in:
Julia Radzhabova 2020-10-15 14:39:44 +03:00
parent 9a857fee19
commit e5f0bbcdfc
3 changed files with 34 additions and 16 deletions

View file

@ -48,7 +48,8 @@ define([
'documenteditor/main/app/view/BookmarksDialog', 'documenteditor/main/app/view/BookmarksDialog',
'documenteditor/main/app/view/CaptionDialog', 'documenteditor/main/app/view/CaptionDialog',
'documenteditor/main/app/view/NotesRemoveDialog', 'documenteditor/main/app/view/NotesRemoveDialog',
'documenteditor/main/app/view/CrossReferenceDialog' 'documenteditor/main/app/view/CrossReferenceDialog',
'common/main/lib/view/OptionsDialog'
], function () { ], function () {
'use strict'; 'use strict';
@ -503,17 +504,33 @@ define([
onAscReplaceCurrentTOF: function(apiCallback) { onAscReplaceCurrentTOF: function(apiCallback) {
Common.UI.warning({ Common.UI.warning({
msg: this.view.confirmReplaceTOF, msg: this.view.confirmReplaceTOF,
buttons: ['ok', 'cancel'], buttons: ['yes', 'no', 'cancel'],
primary: 'ok', primary: 'yes',
callback: _.bind(function(btn) { callback: _.bind(function(btn) {
apiCallback && apiCallback(btn === 'ok'); if (btn=='yes' || btn=='no') {
apiCallback && apiCallback(btn === 'yes');
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.NotificationCenter.trigger('edit:complete', this.toolbar);
}, this) }, this)
}); });
}, },
onAscTOFUpdate: function(apiCallback) { 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 || {})); }, DE.Controllers.Links || {}));

View file

@ -406,7 +406,8 @@ define([
capBtnTOF: 'Table of Figures', capBtnTOF: 'Table of Figures',
tipTableFiguresUpdate: 'Refresh table of figures', tipTableFiguresUpdate: 'Refresh table of figures',
tipTableFigures: 'Insert 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 || {})); }()), DE.Views.Links || {}));
}); });

View file

@ -174,7 +174,7 @@ define([
properties.put_RightAlignTab(this.chAlign.getValue() == 'checked'); properties.put_RightAlignTab(this.chAlign.getValue() == 'checked');
properties.put_TabLeader(this.cmbLeader.getValue()); 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.scrollerY.update();
} }
}, this)); }, this));
@ -193,7 +193,7 @@ define([
if (checked) { if (checked) {
properties.put_TabLeader(this.cmbLeader.getValue()); 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.scrollerY.update();
} }
}, this)); }, this));
@ -216,7 +216,7 @@ define([
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr(); var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr();
properties.put_TabLeader(record.value); 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.scrollerY.update();
} }
}, this)); }, this));
@ -230,7 +230,7 @@ define([
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr(); var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr();
properties.put_Hyperlink(field.getValue()=='checked'); 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.scrollerY.update();
} }
}, this)); }, this));
@ -297,7 +297,7 @@ define([
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr(); var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr();
properties.put_IncludeLabelAndNumber(field.getValue()=='checked'); properties.put_IncludeLabelAndNumber(field.getValue()=='checked');
this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); this.api.SetDrawImagePlaceTableOfFigures('tableofcontents-img', properties);
this.scrollerY.update(); this.scrollerY.update();
} }
}, this)); }, this));
@ -410,7 +410,7 @@ define([
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr(); var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr();
properties.put_StylesType(record.value); 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.scrollerY.update();
} }
}, this)); }, this));
@ -438,7 +438,7 @@ define([
}, },
close: function() { close: function() {
this.api.SetDrawImagePlaceContents(null); (this.type==1) ? this.api.SetDrawImagePlaceTableOfFigures(null) : this.api.SetDrawImagePlaceContents(null);
this.scrollerY.update(); this.scrollerY.update();
Common.Views.AdvancedSettingsWindow.prototype.close.apply(this); 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.scrollerY.update();
this._noApply = false; this._noApply = false;
@ -807,7 +807,7 @@ define([
var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr(); var properties = (this._originalProps) ? this._originalProps : new Asc.CTableOfContentsPr();
properties.put_Caption(record.value); properties.put_Caption(record.value);
properties.clear_Styles(); properties.clear_Styles();
this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); this.api.SetDrawImagePlaceTableOfFigures('tableofcontents-img', properties);
this.scrollerY.update(); this.scrollerY.update();
} }
}, },
@ -818,7 +818,7 @@ define([
properties.put_Caption(null); properties.put_Caption(null);
properties.clear_Styles(); properties.clear_Styles();
properties.add_Style(record.displayValue, 0); properties.add_Style(record.displayValue, 0);
this.api.SetDrawImagePlaceContents('tableofcontents-img', properties); this.api.SetDrawImagePlaceTableOfFigures('tableofcontents-img', properties);
this.scrollerY.update(); this.scrollerY.update();
} }
}, },