Merge pull request #96 from gtryf/in-doc-links
Fix in-document links (supersedes #95)
This commit is contained in:
commit
7c9086b958
|
@ -329,7 +329,7 @@ Viewer.prototype = {
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
// handle links
|
// 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);
|
ele.addEventListener('click', self.link_handler.bind(self), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -804,6 +804,10 @@ Viewer.prototype = {
|
||||||
link_handler : function (e) {
|
link_handler : function (e) {
|
||||||
var target = /** @type{Node} */(e.target);
|
var target = /** @type{Node} */(e.target);
|
||||||
var detail_str = /** @type{string} */ (target.getAttribute('data-dest-detail'));
|
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 (!detail_str) return;
|
||||||
|
|
||||||
if (this.config['view_history_handler']) {
|
if (this.config['view_history_handler']) {
|
||||||
|
|
Loading…
Reference in New Issue