Merge pull request #807 from ONLYOFFICE/fix/toc-preview
Fix/toc preview
This commit is contained in:
commit
abddd3a52e
|
@ -67,6 +67,7 @@ define([
|
||||||
this.addListeners({
|
this.addListeners({
|
||||||
'Links': {
|
'Links': {
|
||||||
'links:contents': this.onTableContents,
|
'links:contents': this.onTableContents,
|
||||||
|
'links:contents-open': this.onTableContentsOpen,
|
||||||
'links:update': this.onTableContentsUpdate,
|
'links:update': this.onTableContentsUpdate,
|
||||||
'links:notes': this.onNotesClick,
|
'links:notes': this.onNotesClick,
|
||||||
'links:hyperlink': this.onHyperlinkClick,
|
'links:hyperlink': this.onHyperlinkClick,
|
||||||
|
@ -79,6 +80,7 @@ define([
|
||||||
'DocumentHolder': {
|
'DocumentHolder': {
|
||||||
'links:contents': this.onTableContents,
|
'links:contents': this.onTableContents,
|
||||||
'links:update': this.onTableContentsUpdate,
|
'links:update': this.onTableContentsUpdate,
|
||||||
|
'links:contents-open': this.onTableContentsOpen,
|
||||||
'links:caption': this.onCaptionClick
|
'links:caption': this.onCaptionClick
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -309,6 +311,10 @@ define([
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onTableContentsOpen: function(menu) {
|
||||||
|
this.api.asc_getButtonsTOC(menu.items[0].options.previewId, menu.items[1].options.previewId);
|
||||||
|
},
|
||||||
|
|
||||||
onNotesClick: function(type) {
|
onNotesClick: function(type) {
|
||||||
var me = this;
|
var me = this;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
|
@ -56,12 +56,18 @@ define([
|
||||||
button.on('click', function (b, e) {
|
button.on('click', function (b, e) {
|
||||||
me.fireEvent('links:contents', [0]);
|
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) {
|
this.contentsMenu.on('item:click', function (menu, item, e) {
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
me.fireEvent('links:contents', [item.value, true]);
|
me.fireEvent('links:contents', [item.value, true]);
|
||||||
}, 10);
|
}, 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) {
|
this.btnContentsUpdate.menu.on('item:click', function (menu, item, e) {
|
||||||
me.fireEvent('links:update', [item.value]);
|
me.fireEvent('links:update', [item.value]);
|
||||||
|
@ -229,15 +235,15 @@ define([
|
||||||
(new Promise(function (accept, reject) {
|
(new Promise(function (accept, reject) {
|
||||||
accept();
|
accept();
|
||||||
})).then(function(){
|
})).then(function(){
|
||||||
var contentsTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem" class="item-contents"><div></div></a>');
|
var contentsTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem" class="item-contents"><div id="<%= options.previewId %>"></div></a>');
|
||||||
me.btnsContents.forEach( function(btn) {
|
me.btnsContents.forEach( function(btn) {
|
||||||
btn.updateHint( me.tipContents );
|
btn.updateHint( me.tipContents );
|
||||||
|
|
||||||
var _menu = new Common.UI.Menu({
|
var _menu = new Common.UI.Menu({
|
||||||
cls: 'toc-menu shifted-left',
|
cls: 'toc-menu shifted-left',
|
||||||
items: [
|
items: [
|
||||||
{template: contentsTemplate, offsety: 0, value: 0},
|
{template: contentsTemplate, offsety: 0, value: 0, previewId: 'id-toolbar-toc-0'},
|
||||||
{template: contentsTemplate, offsety: 72, value: 1},
|
{template: contentsTemplate, offsety: 72, value: 1, previewId: 'id-toolbar-toc-1'},
|
||||||
{caption: me.textContentsSettings, value: 'settings'},
|
{caption: me.textContentsSettings, value: 'settings'},
|
||||||
{caption: me.textContentsRemove, value: 'remove'}
|
{caption: me.textContentsRemove, value: 'remove'}
|
||||||
]
|
]
|
||||||
|
@ -249,8 +255,8 @@ define([
|
||||||
me.contentsMenu = new Common.UI.Menu({
|
me.contentsMenu = new Common.UI.Menu({
|
||||||
cls: 'toc-menu shifted-left',
|
cls: 'toc-menu shifted-left',
|
||||||
items: [
|
items: [
|
||||||
{template: contentsTemplate, offsety: 0, value: 0},
|
{template: contentsTemplate, offsety: 0, value: 0, previewId: 'id-toolbar-toc-menu-0'},
|
||||||
{template: contentsTemplate, offsety: 72, value: 1},
|
{template: contentsTemplate, offsety: 72, value: 1, previewId: 'id-toolbar-toc-menu-1'},
|
||||||
{caption: me.textContentsSettings, value: 'settings'},
|
{caption: me.textContentsSettings, value: 'settings'},
|
||||||
{caption: me.textContentsRemove, value: 'remove'}
|
{caption: me.textContentsRemove, value: 'remove'}
|
||||||
]
|
]
|
||||||
|
|
|
@ -44,10 +44,10 @@
|
||||||
|
|
||||||
> li > a.item-contents {
|
> li > a.item-contents {
|
||||||
div {
|
div {
|
||||||
.background-ximage-v2('toolbar/contents.png', 246px, @commonimage: false);
|
//.background-ximage-v2('toolbar/contents.png', 246px, @commonimage: false);
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
width: 246px;
|
width: 248px;
|
||||||
height: @contents-menu-item-height;
|
//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-ie @border-regular-control-ie);
|
||||||
.box-shadow(0 0 0 @scaled-one-px-value @border-regular-control);
|
.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(2);
|
||||||
.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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// page number position
|
// page number position
|
||||||
|
|
Loading…
Reference in a new issue