[DE] Preview for TOC menu

This commit is contained in:
Julia Radzhabova 2021-04-13 12:14:15 +03:00
parent b896c021f4
commit 1799fb270c
3 changed files with 30 additions and 18 deletions

View file

@ -67,6 +67,7 @@ define([
this.addListeners({
'Links': {
'links:contents': this.onTableContents,
'links:contents-open': this.onTableContentsOpen,
'links:update': this.onTableContentsUpdate,
'links:notes': this.onNotesClick,
'links:hyperlink': this.onHyperlinkClick,
@ -79,6 +80,7 @@ define([
'DocumentHolder': {
'links:contents': this.onTableContents,
'links:update': this.onTableContentsUpdate,
'links:contents-open': this.onTableContentsOpen,
'links:caption': this.onCaptionClick
}
});
@ -309,6 +311,10 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onTableContentsOpen: function(menu) {
this.api.asc_getButtonsTOC(menu.items[0].id, menu.items[1].id);
},
onNotesClick: function(type) {
var me = this;
switch (type) {

View file

@ -56,12 +56,18 @@ define([
button.on('click', function (b, e) {
me.fireEvent('links:contents', [0]);
});
button.menu.on('show:after', function (menu, e) {
me.fireEvent('links:contents-open', [menu]);
});
});
this.contentsMenu.on('item:click', function (menu, item, e) {
setTimeout(function(){
me.fireEvent('links:contents', [item.value, true]);
}, 10);
});
this.contentsMenu.on('show:after', function (menu, e) {
me.fireEvent('links:contents-open', [menu]);
});
this.btnContentsUpdate.menu.on('item:click', function (menu, item, e) {
me.fireEvent('links:update', [item.value]);
@ -236,8 +242,8 @@ define([
var _menu = new Common.UI.Menu({
cls: 'toc-menu shifted-left',
items: [
{template: contentsTemplate, offsety: 0, value: 0},
{template: contentsTemplate, offsety: 72, value: 1},
{template: contentsTemplate, offsety: 0, value: 0, id: 'id-toolbar-toc-0'},
{template: contentsTemplate, offsety: 72, value: 1, id: 'id-toolbar-toc-1'},
{caption: me.textContentsSettings, value: 'settings'},
{caption: me.textContentsRemove, value: 'remove'}
]
@ -249,8 +255,8 @@ define([
me.contentsMenu = new Common.UI.Menu({
cls: 'toc-menu shifted-left',
items: [
{template: contentsTemplate, offsety: 0, value: 0},
{template: contentsTemplate, offsety: 72, value: 1},
{template: contentsTemplate, offsety: 0, value: 0, id: 'id-toolbar-toc-menu-0'},
{template: contentsTemplate, offsety: 72, value: 1, id: 'id-toolbar-toc-menu-1'},
{caption: me.textContentsSettings, value: 'settings'},
{caption: me.textContentsRemove, value: 'remove'}
]

View file

@ -44,10 +44,10 @@
> li > a.item-contents {
div {
.background-ximage-v2('toolbar/contents.png', 246px, @commonimage: false);
//.background-ximage-v2('toolbar/contents.png', 246px, @commonimage: false);
background-color: #fff;
width: 246px;
height: @contents-menu-item-height;
width: 248px;
//height: @contents-menu-item-height;
.box-shadow(0 0 0 @scaled-one-px-value-ie @border-regular-control-ie);
.box-shadow(0 0 0 @scaled-one-px-value @border-regular-control);
@ -68,18 +68,18 @@
}
}
}
//
//.loop(@counter) when (@counter > 0) {
// .loop((@counter - 1));
// li:nth-child(@{counter}) > a.item-contents {
// div {
// @incr-height: (@counter - 1)*@contents-menu-item-height;
// background-position: 0 ~"calc(var(--bckgHOffset) - @{incr-height})";
// }
// }
//}
.loop(@counter) when (@counter > 0) {
.loop((@counter - 1));
li:nth-child(@{counter}) > a.item-contents {
div {
@incr-height: (@counter - 1)*@contents-menu-item-height;
background-position: 0 ~"calc(var(--bckgHOffset) - @{incr-height})";
}
}
}
.loop(2);
//.loop(2);
}
// page number position