ep_comments_page
Advanced tools
Comparing version 0.0.28 to 0.0.29
@@ -5,3 +5,3 @@ { | ||
"name":"comments_page", | ||
"pre": ["ep_etherpad-lite/webaccess"], | ||
"pre": ["ep_etherpad-lite/webaccess", "ep_page_view/page_view"], | ||
"post": ["ep_etherpad-lite/static"], | ||
@@ -8,0 +8,0 @@ "client_hooks": { |
{ | ||
"description": "Adds comments on sidebar and link it to the text. Support for Page View, requires ep_page_view", | ||
"name": "ep_comments_page", | ||
"version": "0.0.28", | ||
"version": "0.0.29", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Nicolas Lescop", |
@@ -18,7 +18,7 @@ # Comments and annotations for Etherpad | ||
To use this way of displaying comments, add the following to your `settings.json`: | ||
To use this way of displaying comments, **make sure you have installed [ep_page_view](https://github.com/ether/ep_page_view)**, and add the following to your `settings.json`: | ||
``` | ||
// Display comments as icons, not boxes | ||
"ep_comments_page": { | ||
"displayCommentAsIcon": true, | ||
"displayCommentAsIcon": true | ||
}, | ||
@@ -25,0 +25,0 @@ ``` |
@@ -74,3 +74,3 @@ var $ = require('ep_etherpad-lite/static/js/rjquery').$; | ||
var addListeners = function() { | ||
var addListenersToCommentIcons = function() { | ||
getPadOuter().find('#commentIcons').on("mouseover", ".comment-icon", function(e){ | ||
@@ -101,2 +101,14 @@ var commentId = targetCommentIdOf(e); | ||
// Listen to Page View enabling/disabling, to adjust #commentIcons position | ||
var addListenersToPageView = function() { | ||
$("#options-pageview").on("click", function() { | ||
getPadOuter().find('#outerdocbody').toggleClass("pageViewDisabled"); | ||
}); | ||
// add class if Page View is disabled already | ||
if(!$('#options-pageview').is(':checked')) { | ||
getPadOuter().find('#outerdocbody').addClass("pageViewDisabled"); | ||
} | ||
} | ||
/* ***** Public methods: ***** */ | ||
@@ -112,3 +124,4 @@ | ||
adjustIconsForNewScreenSize(); | ||
addListeners(); | ||
addListenersToCommentIcons(); | ||
addListenersToPageView(); | ||
} | ||
@@ -115,0 +128,0 @@ |
@@ -123,15 +123,13 @@ /* TODO: | ||
this.waitForResizeToFinishThenCall(function() { | ||
commentIcons.adjustIconsForNewScreenSize(); | ||
self.editorResized(); | ||
}); | ||
// We try increasing timeouts, to make sure user gets the response as fast as we can | ||
setTimeout(function() { | ||
if (!self.allCommentsOnCorrectYPosition()) self.adjustCommentPositions(); | ||
setTimeout(function() { | ||
if (!self.allCommentsOnCorrectYPosition()) self.adjustCommentPositions(); | ||
setTimeout(function() { | ||
if (!self.allCommentsOnCorrectYPosition()) self.adjustCommentPositions(); | ||
}, 1000); | ||
}, 500); | ||
}, 250); | ||
// When Page View is enabled/disabled, we need to recalculate position of comments | ||
$('#options-pageview').on('click', function(e) { | ||
self.editorResized(); | ||
}); | ||
// When Page Breaks are enabled/disabled, we need to recalculate position of comments | ||
$('#options-pagebreaks').on('click', function(e) { | ||
self.editorResized(); | ||
}); | ||
@@ -635,2 +633,21 @@ // On click comment icon toolbar | ||
// Make the adjustments after editor is resized (due to a window resize or | ||
// enabling/disabling Page View) | ||
ep_comments.prototype.editorResized = function() { | ||
var self = this; | ||
commentIcons.adjustIconsForNewScreenSize(); | ||
// We try increasing timeouts, to make sure user gets the response as fast as we can | ||
setTimeout(function() { | ||
if (!self.allCommentsOnCorrectYPosition()) self.adjustCommentPositions(); | ||
setTimeout(function() { | ||
if (!self.allCommentsOnCorrectYPosition()) self.adjustCommentPositions(); | ||
setTimeout(function() { | ||
if (!self.allCommentsOnCorrectYPosition()) self.adjustCommentPositions(); | ||
}, 1000); | ||
}, 500); | ||
}, 250); | ||
} | ||
// Adjusts position on the screen for sidebar comments and comment icons | ||
@@ -637,0 +654,0 @@ ep_comments.prototype.adjustCommentPositions = function(){ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
146193
3348