ep_comments_page 11.0.18 → 11.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/static/js/index.js +36 -35
package/package.json
CHANGED
package/static/js/index.js
CHANGED
|
@@ -459,46 +459,47 @@ EpComments.prototype.collectComments = function (callback) {
|
|
|
459
459
|
commentElm.css({top: commentPos});
|
|
460
460
|
});
|
|
461
461
|
|
|
462
|
-
//
|
|
463
|
-
|
|
464
|
-
this.
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
hideCommentTimer = setTimeout(() => {
|
|
471
|
-
commentBoxes.hideComment(e.currentTarget.id);
|
|
472
|
-
}, 1000);
|
|
473
|
-
});
|
|
474
|
-
|
|
475
|
-
// HOVER OR CLICK THE COMMENTED TEXT IN THE EDITOR
|
|
476
|
-
// hover event
|
|
477
|
-
this.padInner.contents().on('mouseover', '.comment', function (e) {
|
|
478
|
-
if (container.is(':visible')) { // not on mobile
|
|
462
|
+
// Bind event handlers only once — collectComments is called repeatedly
|
|
463
|
+
// and re-binding causes handlers to stack up (fixes #214).
|
|
464
|
+
if (!this._eventsBound) {
|
|
465
|
+
this._eventsBound = true;
|
|
466
|
+
let hideCommentTimer;
|
|
467
|
+
|
|
468
|
+
// HOVER SIDEBAR COMMENT
|
|
469
|
+
this.container.on('mouseover', '.sidebar-comment', (e) => {
|
|
479
470
|
clearTimeout(hideCommentTimer);
|
|
471
|
+
commentBoxes.highlightComment(e.currentTarget.id, e);
|
|
472
|
+
}).on('mouseout', '.sidebar-comment', (e) => {
|
|
473
|
+
hideCommentTimer = setTimeout(() => {
|
|
474
|
+
commentBoxes.hideComment(e.currentTarget.id);
|
|
475
|
+
}, 1000);
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
// HOVER OR CLICK THE COMMENTED TEXT IN THE EDITOR
|
|
479
|
+
this.padInner.contents().on('mouseover', '.comment', function (e) {
|
|
480
|
+
if (container.is(':visible')) {
|
|
481
|
+
clearTimeout(hideCommentTimer);
|
|
482
|
+
const commentId = self.commentIdOf(e);
|
|
483
|
+
commentBoxes.highlightComment(commentId, e, $(this));
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
this.padInner.contents().on('click', '.comment', function (e) {
|
|
480
488
|
const commentId = self.commentIdOf(e);
|
|
481
489
|
commentBoxes.highlightComment(commentId, e, $(this));
|
|
482
|
-
}
|
|
483
|
-
});
|
|
484
|
-
|
|
485
|
-
// click event
|
|
486
|
-
this.padInner.contents().on('click', '.comment', function (e) {
|
|
487
|
-
const commentId = self.commentIdOf(e);
|
|
488
|
-
commentBoxes.highlightComment(commentId, e, $(this));
|
|
489
|
-
});
|
|
490
|
+
});
|
|
490
491
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
});
|
|
492
|
+
this.padInner.contents().on('mouseleave', '.comment', (e) => {
|
|
493
|
+
const commentOpenedByClickOnIcon = commentIcons.isCommentOpenedByClickOnIcon();
|
|
494
|
+
if (!commentOpenedByClickOnIcon && container.is(':visible')) {
|
|
495
|
+
hideCommentTimer = setTimeout(() => {
|
|
496
|
+
self.closeOpenedComment(e);
|
|
497
|
+
}, 1000);
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
500
|
|
|
501
|
-
|
|
501
|
+
this.addListenersToCloseOpenedComment();
|
|
502
|
+
}
|
|
502
503
|
|
|
503
504
|
this.setYofComments();
|
|
504
505
|
if (callback) callback();
|