ep_comments_page 11.0.17 → 11.0.19
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 +37 -36
package/package.json
CHANGED
package/static/js/index.js
CHANGED
|
@@ -19,8 +19,8 @@ const preCommentMark = require('ep_comments_page/static/js/preCommentMark');
|
|
|
19
19
|
const getCommentIdOnFirstPositionSelected = events.getCommentIdOnFirstPositionSelected;
|
|
20
20
|
const hasCommentOnSelection = events.hasCommentOnSelection;
|
|
21
21
|
const Security = require('ep_etherpad-lite/static/js/security');
|
|
22
|
-
|
|
23
|
-
const io =
|
|
22
|
+
const socketIoClient = require('socket.io-client');
|
|
23
|
+
const io = socketIoClient.default || socketIoClient;
|
|
24
24
|
|
|
25
25
|
const cssFiles = [
|
|
26
26
|
'ep_comments_page/static/css/comment.css',
|
|
@@ -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
|
-
commentBoxes.highlightComment(e.currentTarget.id, e);
|
|
468
|
-
}).on('mouseout', '.sidebar-comment', (e) => {
|
|
469
|
-
// do not hide directly the comment, because sometime the mouse get out accidently
|
|
470
|
-
hideCommentTimer = setTimeout(() => {
|
|
471
|
-
commentBoxes.hideComment(e.currentTarget.id);
|
|
472
|
-
}, 1000);
|
|
473
|
-
});
|
|
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;
|
|
474
467
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
this.padInner.contents().on('mouseover', '.comment', function (e) {
|
|
478
|
-
if (container.is(':visible')) { // not on mobile
|
|
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();
|