[DE] Add text to table of contents
This commit is contained in:
parent
b0e59d6df8
commit
2fe8fb6cfa
|
@ -75,7 +75,9 @@ define([
|
||||||
'links:caption': this.onCaptionClick,
|
'links:caption': this.onCaptionClick,
|
||||||
'links:crossref': this.onCrossRefClick,
|
'links:crossref': this.onCrossRefClick,
|
||||||
'links:tof': this.onTableFigures,
|
'links:tof': this.onTableFigures,
|
||||||
'links:tof-update': this.onTableFiguresUpdate
|
'links:tof-update': this.onTableFiguresUpdate,
|
||||||
|
'links:addtext': this.onAddText,
|
||||||
|
'links:addtext-open': this.onAddTextOpen
|
||||||
},
|
},
|
||||||
'DocumentHolder': {
|
'DocumentHolder': {
|
||||||
'links:contents': this.onTableContents,
|
'links:contents': this.onTableContents,
|
||||||
|
@ -189,6 +191,8 @@ define([
|
||||||
this.lockToolbar(Common.enumLock.plainDelLock, plain_del_lock, {array: this.view.btnsContents.concat([this.view.btnTableFigures, this.view.btnTableFiguresUpdate])});
|
this.lockToolbar(Common.enumLock.plainDelLock, plain_del_lock, {array: this.view.btnsContents.concat([this.view.btnTableFigures, this.view.btnTableFiguresUpdate])});
|
||||||
this.lockToolbar(Common.enumLock.contentLock, content_locked, {array: [this.view.btnCrossRef]});
|
this.lockToolbar(Common.enumLock.contentLock, content_locked, {array: [this.view.btnCrossRef]});
|
||||||
this.lockToolbar(Common.enumLock.cantUpdateTOF, !this.api.asc_CanUpdateTablesOfFigures(), {array: [this.view.btnTableFiguresUpdate]});
|
this.lockToolbar(Common.enumLock.cantUpdateTOF, !this.api.asc_CanUpdateTablesOfFigures(), {array: [this.view.btnTableFiguresUpdate]});
|
||||||
|
this.lockToolbar(Common.enumLock.inFootnote, this.api.asc_IsCursorInFootnote() || this.api.asc_IsCursorInEndnote(), {array: [this.view.btnAddText]});
|
||||||
|
this.lockToolbar(Common.enumLock.inHeader, in_header, {array: [this.view.btnAddText]});
|
||||||
|
|
||||||
this.dlgCrossRefDialog && this.dlgCrossRefDialog.isVisible() && this.dlgCrossRefDialog.setLocked(this.view.btnCrossRef.isDisabled());
|
this.dlgCrossRefDialog && this.dlgCrossRefDialog.isVisible() && this.dlgCrossRefDialog.setLocked(this.view.btnCrossRef.isDisabled());
|
||||||
},
|
},
|
||||||
|
@ -314,6 +318,17 @@ define([
|
||||||
this.api.asc_getButtonsTOC(menu.items[0].options.previewId, menu.items[1].options.previewId);
|
this.api.asc_getButtonsTOC(menu.items[0].options.previewId, menu.items[1].options.previewId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onAddTextOpen: function(menu) {
|
||||||
|
var props = this.api.asc_GetTableOfContentsPr(),
|
||||||
|
end = props ? props.get_OutlineEnd() : 3;
|
||||||
|
(end<0) && (end = 9);
|
||||||
|
this.view.fillAddTextMenu(menu, end, this.api.asc_GetCurrentLevelTOC());
|
||||||
|
},
|
||||||
|
|
||||||
|
onAddText: function(value) {
|
||||||
|
this.api.asc_AddParagraphToTOC(value);
|
||||||
|
},
|
||||||
|
|
||||||
onNotesClick: function(type) {
|
onNotesClick: function(type) {
|
||||||
var me = this;
|
var me = this;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
|
@ -149,7 +149,14 @@
|
||||||
<section class="panel" data-tab="links">
|
<section class="panel" data-tab="links">
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<span class="btn-slot text x-huge btn-contents"></span>
|
<span class="btn-slot text x-huge btn-contents"></span>
|
||||||
<span class="btn-slot text x-huge" id="slot-btn-contents-update"></span>
|
</div>
|
||||||
|
<div class="group small">
|
||||||
|
<div class="elset">
|
||||||
|
<span class="btn-slot text" id="slot-btn-add-text"></span>
|
||||||
|
</div>
|
||||||
|
<div class="elset">
|
||||||
|
<span class="btn-slot text" id="slot-btn-contents-update"></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="separator long"></div>
|
<div class="separator long"></div>
|
||||||
<div class="group">
|
<div class="group">
|
||||||
|
|
|
@ -81,6 +81,13 @@ define([
|
||||||
}, 10);
|
}, 10);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.btnAddText.menu.on('item:click', function (menu, item, e) {
|
||||||
|
me.fireEvent('links:addtext', [item.value]);
|
||||||
|
});
|
||||||
|
this.btnAddText.menu.on('show:after', function (menu, e) {
|
||||||
|
me.fireEvent('links:addtext-open', [menu]);
|
||||||
|
});
|
||||||
|
|
||||||
this.btnsNotes.forEach(function(button) {
|
this.btnsNotes.forEach(function(button) {
|
||||||
button.menu.on('item:click', function (menu, item, e) {
|
button.menu.on('item:click', function (menu, item, e) {
|
||||||
me.fireEvent('links:notes', [item.value]);
|
me.fireEvent('links:notes', [item.value]);
|
||||||
|
@ -174,7 +181,7 @@ define([
|
||||||
|
|
||||||
this.btnContentsUpdate = new Common.UI.Button({
|
this.btnContentsUpdate = new Common.UI.Button({
|
||||||
parentEl: $host.find('#slot-btn-contents-update'),
|
parentEl: $host.find('#slot-btn-contents-update'),
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar',
|
||||||
iconCls: 'toolbar__icon btn-update',
|
iconCls: 'toolbar__icon btn-update',
|
||||||
lock: [ _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
|
lock: [ _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
|
||||||
caption: this.capBtnContentsUpdate,
|
caption: this.capBtnContentsUpdate,
|
||||||
|
@ -182,10 +189,25 @@ define([
|
||||||
menu: true,
|
menu: true,
|
||||||
dataHint: '1',
|
dataHint: '1',
|
||||||
dataHintDirection: 'bottom',
|
dataHintDirection: 'bottom',
|
||||||
dataHintOffset: 'small'
|
dataHintOffset: '0, -8'
|
||||||
});
|
});
|
||||||
this.paragraphControls.push(this.btnContentsUpdate);
|
this.paragraphControls.push(this.btnContentsUpdate);
|
||||||
|
|
||||||
|
this.btnAddText = new Common.UI.Button({
|
||||||
|
parentEl: $host.find('#slot-btn-add-text'),
|
||||||
|
cls: 'btn-toolbar',
|
||||||
|
iconCls: 'toolbar__icon btn-update',
|
||||||
|
lock: [ _set.inHeader, _set.inFootnote, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
|
||||||
|
caption: this.capBtnAddText,
|
||||||
|
menu: new Common.UI.Menu({
|
||||||
|
items: []
|
||||||
|
}),
|
||||||
|
dataHint: '1',
|
||||||
|
dataHintDirection: 'left',
|
||||||
|
dataHintOffset: 'medium'
|
||||||
|
});
|
||||||
|
this.paragraphControls.push(this.btnAddText);
|
||||||
|
|
||||||
this.btnBookmarks = new Common.UI.Button({
|
this.btnBookmarks = new Common.UI.Button({
|
||||||
parentEl: $host.find('#slot-btn-bookmarks'),
|
parentEl: $host.find('#slot-btn-bookmarks'),
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
|
@ -294,6 +316,8 @@ define([
|
||||||
]
|
]
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
me.btnAddText.updateHint(me.tipAddText);
|
||||||
|
|
||||||
me.contentsUpdateMenu = new Common.UI.Menu({
|
me.contentsUpdateMenu = new Common.UI.Menu({
|
||||||
items: [
|
items: [
|
||||||
{caption: me.textUpdateAll, value: 'all'},
|
{caption: me.textUpdateAll, value: 'all'},
|
||||||
|
@ -386,6 +410,27 @@ define([
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fillAddTextMenu: function(menu, endlevel, current) {
|
||||||
|
endlevel = Math.max(endlevel || 3, current+1);
|
||||||
|
menu.removeAll();
|
||||||
|
menu.addItem(new Common.UI.MenuItem({
|
||||||
|
caption: this.txtDontShowTof,
|
||||||
|
value: -1,
|
||||||
|
checkable: true,
|
||||||
|
checked: current<0,
|
||||||
|
toggleGroup : 'addTextGroup'
|
||||||
|
}));
|
||||||
|
for (var i=0; i<endlevel; i++) {
|
||||||
|
menu.addItem(new Common.UI.MenuItem({
|
||||||
|
caption: this.txtLevel + ' ' + (i+1),
|
||||||
|
value: i,
|
||||||
|
checkable: true,
|
||||||
|
checked: current===i,
|
||||||
|
toggleGroup : 'addTextGroup'
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
show: function () {
|
show: function () {
|
||||||
Common.UI.BaseView.prototype.show.call(this);
|
Common.UI.BaseView.prototype.show.call(this);
|
||||||
this.fireEvent('show', this);
|
this.fireEvent('show', this);
|
||||||
|
@ -437,7 +482,11 @@ define([
|
||||||
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'
|
titleUpdateTOF: 'Refresh Table of Figures',
|
||||||
|
capBtnAddText: 'Add Text',
|
||||||
|
tipAddText: 'Include heading in the Table of Contents',
|
||||||
|
txtDontShowTof: 'Do Not Show in Table of Contents',
|
||||||
|
txtLevel: 'Level'
|
||||||
}
|
}
|
||||||
}()), DE.Views.Links || {}));
|
}()), DE.Views.Links || {}));
|
||||||
});
|
});
|
|
@ -2082,6 +2082,10 @@
|
||||||
"DE.Views.Links.tipTableFigures": "Insert table of figures",
|
"DE.Views.Links.tipTableFigures": "Insert table of figures",
|
||||||
"DE.Views.Links.tipTableFiguresUpdate": "Update table of figures",
|
"DE.Views.Links.tipTableFiguresUpdate": "Update table of figures",
|
||||||
"DE.Views.Links.titleUpdateTOF": "Update Table of Figures",
|
"DE.Views.Links.titleUpdateTOF": "Update Table of Figures",
|
||||||
|
"DE.Views.Links.capBtnAddText": "Add Text",
|
||||||
|
"DE.Views.Links.tipAddText": "Include heading in the Table of Contents",
|
||||||
|
"DE.Views.Links.txtDontShowTof": "Do Not Show in Table of Contents",
|
||||||
|
"DE.Views.Links.txtLevel": "Level",
|
||||||
"DE.Views.ListSettingsDialog.textAuto": "Automatic",
|
"DE.Views.ListSettingsDialog.textAuto": "Automatic",
|
||||||
"DE.Views.ListSettingsDialog.textCenter": "Center",
|
"DE.Views.ListSettingsDialog.textCenter": "Center",
|
||||||
"DE.Views.ListSettingsDialog.textLeft": "Left",
|
"DE.Views.ListSettingsDialog.textLeft": "Left",
|
||||||
|
|
Loading…
Reference in a new issue