[DE] Fix Bug 36778

This commit is contained in:
Julia Radzhabova 2018-02-08 16:03:10 +03:00
parent 5489a637d6
commit f2ae20c36d
4 changed files with 100 additions and 15 deletions

View file

@ -65,6 +65,10 @@ define([
'links:update': this.onTableContentsUpdate,
'links:notes': this.onNotesClick,
'links:hyperlink': this.onHyperlinkClick
},
'DocumentHolder': {
'links:contents': this.onTableContents,
'links:update': this.onTableContentsUpdate
}
});
},
@ -201,7 +205,7 @@ define([
Common.component.Analytics.trackEvent('ToolBar', 'Add Hyperlink');
},
onTableContents: function(type){
onTableContents: function(type, currentTOC){
switch (type) {
case 0:
var props = this.api.asc_GetTableOfContentsPr(),
@ -229,7 +233,8 @@ define([
this.api.asc_AddTableOfContents(null, props);
break;
case 'settings':
var props = this.api.asc_GetTableOfContentsPr(),
currentTOC = !!currentTOC;
var props = this.api.asc_GetTableOfContentsPr(currentTOC),
me = this;
var win = new DE.Views.TableOfContentsSettings({
api: this.api,
@ -249,8 +254,10 @@ define([
}
},
onTableContentsUpdate: function(type){
this.api.asc_UpdateTableOfContents(type == 'pages');
onTableContentsUpdate: function(type, currentTOC){
if (currentTOC)
currentTOC = this.api.asc_GetTableOfContentsPr(currentTOC).get_InternalClass();
this.api.asc_UpdateTableOfContents(type == 'pages', currentTOC);
},
onNotesClick: function(type) {

View file

@ -2515,6 +2515,30 @@ define([
})
});
var menuTableTOC = new Common.UI.MenuItem({
caption : me.textTOC,
menu : new Common.UI.Menu({
menuAlign: 'tl-tr',
items : [
{
caption: me.textSettings,
value: 'settings'
},
{
caption: me.textUpdateAll,
value: 'all'
},
{
caption: me.textUpdatePages,
value: 'pages'
}
]
})
});
menuTableTOC.menu.on('item:click', function (menu, item, e) {
me.fireEvent((item.value=='settings') ? 'links:contents' : 'links:update', [item.value, true]);
});
/** coauthoring begin **/
var menuAddCommentTable = new Common.UI.MenuItem({
caption : me.addCommentText
@ -2783,13 +2807,16 @@ define([
me.clearEquationMenu(false, 6);
menuEquationSeparatorInTable.setVisible(isEquation && eqlen>0);
var in_control = me.api.asc_IsContentControl();
var in_toc = me.api.asc_GetTableOfContentsPr(true),
in_control = !in_toc && me.api.asc_IsContentControl();
menuTableControl.setVisible(in_control);
if (in_control) {
var control_props = me.api.asc_GetContentControlProperties(),
lock_type = (control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked;
menuTableRemoveControl.setDisabled(lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.SdtLocked);
}
menuTableTOC.setVisible(in_toc);
menuTableTOC.setDisabled(disabled);
},
items: [
me.menuSpellCheckTable,
@ -2911,6 +2938,7 @@ define([
menuHyperlinkTable,
menuHyperlinkSeparator,
menuTableControl,
menuTableTOC,
menuParagraphAdvancedInTable
]
}).on('hide:after', function(menu, e, isFromInputControl) {
@ -3181,6 +3209,37 @@ define([
caption : '--'
});
var menuParaTOCSettings = new Common.UI.MenuItem({
caption: me.textTOCSettings,
value: 'settings'
}).on('click', function (item, e) {
me.fireEvent('links:contents', [item.value, true]);
});
var menuParaTOCRefresh = new Common.UI.MenuItem({
caption : me.textUpdateTOC,
menu : new Common.UI.Menu({
menuAlign: 'tl-tr',
items : [
{
caption: me.textUpdateAll,
value: 'all'
},
{
caption: me.textUpdatePages,
value: 'pages'
}
]
})
});
menuParaTOCRefresh.menu.on('item:click', function (menu, item, e) {
me.fireEvent('links:update', [item.value, true]);
});
var menuParaTOCSeparator = new Common.UI.MenuItem({
caption : '--'
});
this.textMenu = new Common.UI.Menu({
initMenu: function(value){
var isInShape = (value.imgProps && value.imgProps.value && !_.isNull(value.imgProps.value.get_ShapeProperties()));
@ -3282,7 +3341,8 @@ define([
me.menuStyleUpdate.setCaption(me.updateStyleText.replace('%1', DE.getController('Main').translationTable[window.currentStyleName] || window.currentStyleName));
}
var in_control = me.api.asc_IsContentControl();
var in_toc = me.api.asc_GetTableOfContentsPr(true),
in_control = !in_toc && me.api.asc_IsContentControl() ;
menuParaRemoveControl.setVisible(in_control);
menuParaControlSettings.setVisible(in_control);
menuParaControlSeparator.setVisible(in_control);
@ -3291,6 +3351,11 @@ define([
lock_type = (control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked;
menuParaRemoveControl.setDisabled(lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.SdtLocked);
}
menuParaTOCSettings.setVisible(in_toc);
menuParaTOCRefresh.setVisible(in_toc);
menuParaTOCSeparator.setVisible(in_toc);
menuParaTOCSettings.setDisabled(disabled);
menuParaTOCRefresh.setDisabled(disabled);
},
items: [
me.menuSpellPara,
@ -3308,6 +3373,9 @@ define([
menuParaRemoveControl,
menuParaControlSettings,
menuParaControlSeparator,
menuParaTOCSettings,
menuParaTOCRefresh,
menuParaTOCSeparator,
menuParagraphBreakBefore,
menuParagraphKeepLines,
menuParagraphVAlign,
@ -3631,7 +3699,12 @@ define([
textRemoveControl: 'Remove content control',
textEditControls: 'Content control settings',
textDistributeRows: 'Distribute rows',
textDistributeCols: 'Distribute columns'
textDistributeCols: 'Distribute columns',
textUpdateTOC: 'Refresh table of contents',
textUpdateAll: 'Refresh entire table',
textUpdatePages: 'Refresh page numbers only',
textTOCSettings: 'Table of contents settings',
textTOC: 'Table of contents'
}, DE.Views.DocumentHolder || {}));
});

View file

@ -255,10 +255,10 @@ define([
tipContents: 'Insert table of contents',
textContentsSettings: 'Settings',
textContentsRemove: 'Remove table of contents',
capBtnContentsUpdate: 'Update',
tipContentsUpdate: 'Update table of contents',
textUpdateAll: 'Update entire table',
textUpdatePages: 'Update page numbers only',
capBtnContentsUpdate: 'Refresh',
tipContentsUpdate: 'Refresh table of contents',
textUpdateAll: 'Refresh entire table',
textUpdatePages: 'Refresh page numbers only',
tipNotes: 'Footnotes',
mniInsFootnote: 'Insert Footnote',
mniDelFootnote: 'Delete All Footnotes',

View file

@ -995,6 +995,11 @@
"DE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
"DE.Views.DocumentHolder.textDistributeRows": "Distribute rows",
"DE.Views.DocumentHolder.textDistributeCols": "Distribute columns",
"DE.Views.DocumentHolder.textUpdateTOC": "Refresh table of contents",
"DE.Views.DocumentHolder.textUpdateAll": "Refresh entire table",
"DE.Views.DocumentHolder.textUpdatePages": "Refresh page numbers only",
"DE.Views.DocumentHolder.textTOCSettings": "Table of contents settings",
"DE.Views.DocumentHolder.textTOC": "Table of contents",
"DE.Views.DropcapSettingsAdvanced.cancelButtonText": "Cancel",
"DE.Views.DropcapSettingsAdvanced.okButtonText": "Ok",
"DE.Views.DropcapSettingsAdvanced.strBorders": "Borders & Fill",
@ -1257,7 +1262,7 @@
"DE.Views.LeftMenu.tipTitles": "Titles",
"DE.Views.LeftMenu.txtDeveloper": "DEVELOPER MODE",
"DE.Views.LeftMenu.txtTrial": "TRIAL MODE",
"DE.Views.Links.capBtnContentsUpdate": "Update",
"DE.Views.Links.capBtnContentsUpdate": "Refresh",
"DE.Views.Links.capBtnInsContents": "Table of Contents",
"DE.Views.Links.capBtnInsFootnote": "Footnote",
"DE.Views.Links.capBtnInsLink": "Hyperlink",
@ -1268,10 +1273,10 @@
"DE.Views.Links.textContentsRemove": "Remove table of contents",
"DE.Views.Links.textContentsSettings": "Settings",
"DE.Views.Links.textGotoFootnote": "Go to Footnotes",
"DE.Views.Links.textUpdateAll": "Update entire table",
"DE.Views.Links.textUpdatePages": "Update page numbers only",
"DE.Views.Links.textUpdateAll": "Refresh entire table",
"DE.Views.Links.textUpdatePages": "Refresh page numbers only",
"DE.Views.Links.tipContents": "Insert table of contents",
"DE.Views.Links.tipContentsUpdate": "Update table of contents",
"DE.Views.Links.tipContentsUpdate": "Refresh table of contents",
"DE.Views.Links.tipInsertHyperlink": "Add hyperlink",
"DE.Views.Links.tipNotes": "Insert or edit footnotes",
"DE.Views.MailMergeEmailDlg.cancelButtonText": "Cancel",