Fix in-document links

This commit is contained in:
George Tryfonas 2020-10-20 09:11:24 +03:00
parent e902d82c3c
commit 200083d154
1 changed files with 5 additions and 1 deletions

View File

@ -329,7 +329,7 @@ Viewer.prototype = {
}, false);
// handle links
[this.container, this.outline].forEach(function(ele) {
[this.outline].concat(Array.from(this.container.querySelectorAll('a.l'))).forEach(function(ele) {
ele.addEventListener('click', self.link_handler.bind(self), false);
});
@ -804,6 +804,10 @@ Viewer.prototype = {
link_handler : function (e) {
var target = /** @type{Node} */(e.target);
var detail_str = /** @type{string} */ (target.getAttribute('data-dest-detail'));
if (!detail_str) {
target = /** @type{Node} */(e.currentTarget);
detail_str = /** @type{string} */ (target.getAttribute('data-dest-detail'));
}
if (!detail_str) return;
if (this.config['view_history_handler']) {