ep_comments_page
Advanced tools
Comparing version 0.0.29 to 0.0.30
@@ -12,3 +12,4 @@ { | ||
"aceEditorCSS": "ep_comments_page/static/js/index", | ||
"aceEditEvent": "ep_comments_page/static/js/index" | ||
"aceEditEvent": "ep_comments_page/static/js/index", | ||
"aceInitialized": "ep_comments_page/static/js/index" | ||
}, | ||
@@ -15,0 +16,0 @@ "hooks": { |
@@ -8,4 +8,6 @@ { | ||
"ep_comments_page.comments_template.suggested_change" : "Suggested Change:", | ||
"ep_comments_page.comments_template.suggested_change_from" : "From:", | ||
"ep_comments_page.comments_template.from" : "From:", | ||
"ep_comments_page.comments_template.accept_change.value" : "Accept Change", | ||
"ep_comments_page.comments_template.revert_change.value" : "Revert Change", | ||
"ep_comments_page.comments_template.suggested_change_from" : "Suggested change From:", | ||
"ep_comments_page.comments_template.suggest_change_from" : "Suggest change From:", | ||
@@ -12,0 +14,0 @@ "ep_comments_page.comments_template.to" : "To:", |
@@ -8,4 +8,7 @@ { | ||
"ep_comments_page.comments_template.suggested_change" : "Alteração Sugerida:", | ||
"ep_comments_page.comments_template.from" : "De:", | ||
"ep_comments_page.comments_template.accept_change.value" : "Aceitar Sugestão", | ||
"ep_comments_page.comments_template.suggest_change_from" : "Sugerir alteração De:", | ||
"ep_comments_page.comments_template.revert_change.value" : "Reverter Sugestão", | ||
"ep_comments_page.comments_template.suggested_change_from" : "Alteração sugerida de:", | ||
"ep_comments_page.comments_template.suggest_change_from" : "Sugerir alteração de:", | ||
"ep_comments_page.comments_template.to" : "Para:", | ||
@@ -15,2 +18,3 @@ "ep_comments_page.comments_template.include_suggestion" : "Incluir alteração sugerida", | ||
"ep_comments_page.comments_template.cancel.value" : "Cancelar", | ||
"ep_comments_page.comments_template.reply_input_label":"Sua Resposta (clique ENTER para enviar)", | ||
"ep_comments_page.time.seconds.past" : "{{count}} segundos atrás", | ||
@@ -46,2 +50,2 @@ "ep_comments_page.time.seconds.future" : "daqui a {{count}} segundos", | ||
"ep_comments_page.time.centuries.future" : "daqui a {{count}} séculos" | ||
} | ||
} |
{ | ||
"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.29", | ||
"version": "0.0.30", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Nicolas Lescop", |
@@ -28,3 +28,3 @@ // Easier access to outter pad | ||
getPadOuter().contents().find('.comment-modal').hide(); | ||
getPadOuter().find('.comment-modal').hide(); | ||
}; | ||
@@ -36,3 +36,3 @@ | ||
getPadOuter().contents().find('.comment-modal').hide(); | ||
getPadOuter().find('.comment-modal').hide(); | ||
} | ||
@@ -53,8 +53,19 @@ | ||
var commentElm = container.find('#'+ commentId); | ||
getPadOuter().contents().find('.comment-modal').show().css({ | ||
left: e.clientX +"px", | ||
top: e.clientY + 25 +"px" | ||
// hovering comment view | ||
getPadOuter().find('.comment-modal-comment').html(commentElm.html()); | ||
// get modal position | ||
var containerWidth = getPadOuter().find('#outerdocbody').outerWidth(true); | ||
var modalWitdh = getPadOuter().find('.comment-modal').outerWidth(true); | ||
var targetLeft = e.clientX; | ||
var targetTop = $(e.target).offset().top; | ||
// if positioning modal on target left will make part of the modal to be | ||
// out of screen, we place it closer to the middle of the screen | ||
if (targetLeft + modalWitdh > containerWidth) { | ||
targetLeft = containerWidth - modalWitdh - 2; | ||
} | ||
getPadOuter().find('.comment-modal').show().css({ | ||
left: targetLeft +"px", | ||
top: targetTop + 25 +"px" | ||
}); | ||
// hovering comment view | ||
getPadOuter().contents().find('.comment-modal-comment').html(commentElm.html()); | ||
} | ||
@@ -61,0 +72,0 @@ } |
@@ -287,3 +287,3 @@ /* TODO: | ||
if($(this).parent().parent().find(".reply-suggestion-checkbox").is(':checked')){ | ||
$(this).parent().parent().find(".reply-suggestion-checkbox:clicked").click(); | ||
$(this).parent().parent().find(".reply-suggestion-checkbox:clicked").click(); | ||
//Only uncheck checked boxes. TODO: is a cleanup operation. Should we do it here? | ||
@@ -483,2 +483,4 @@ } | ||
var content = $("#replyTemplate").tmpl(reply); | ||
// localize comment reply | ||
self.localize(content); | ||
$('iframe[name="ace_outer"]').contents().find('#'+commentId + ' .comment-reply-input-label').before(content); | ||
@@ -774,15 +776,19 @@ // Should we show "Revert" instead of "Accept" | ||
var selector = "."+commentId; | ||
var repArr = getRepFromSelector(selector, padInner); | ||
// rep is an array of reps.. I will need to iterate over each to do something meaningful.. | ||
var ace = this.ace; | ||
$.each(repArr, function(index, rep){ | ||
ace.callWithAce(function(aceTop){ | ||
var repArr = aceTop.ace_getRepFromSelector(selector, padInner); | ||
// rep is an array of reps.. I will need to iterate over each to do something meaningful.. | ||
$.each(repArr, function(index, rep){ | ||
// I don't think we need this nested call | ||
ace.callWithAce(function (ace){ | ||
ace.ace_performSelectionChange(rep[0],rep[1],true); | ||
ace.ace_setAttributeOnSelection('comment', 'comment-deleted'); | ||
// Note that this is the correct way of doing it, instead of there being | ||
// a commentId we now flag it as "comment-deleted" | ||
}); | ||
}); | ||
},'deleteCommentedSelection', true); | ||
ace.callWithAce(function (ace){ | ||
ace.ace_performSelectionChange(rep[0],rep[1],true); | ||
ace.ace_setAttributeOnSelection('comment', 'comment-deleted'); | ||
// Note that this is the correct way of doing it, instead of there being | ||
// a commentId we now flag it as "comment-deleted" | ||
},'deleteCommentedSelection', true); | ||
}); | ||
// }); | ||
// }, 'getRep'); | ||
} | ||
@@ -905,4 +911,6 @@ | ||
var comment = self.container.find("#"+commentId); | ||
comment.find("input[type='submit']").val("Revert"); | ||
comment.find("input[type='submit']").addClass("revert"); | ||
var button = comment.find("input[type='submit']"); | ||
button.attr("data-l10n-id", "ep_comments_page.comments_template.revert_change.value"); | ||
button.addClass("revert"); | ||
self.localize(button); | ||
} | ||
@@ -915,4 +923,6 @@ | ||
var comment = self.container.find("#"+commentId); | ||
comment.find("input[type='submit']").val("Accept"); | ||
comment.find("input[type='submit']").removeClass("revert"); | ||
var button = comment.find("input[type='submit']"); | ||
button.attr("data-l10n-id", "ep_comments_page.comments_template.accept_change.value"); | ||
button.removeClass("revert"); | ||
self.localize(button); | ||
} | ||
@@ -1012,4 +1022,6 @@ | ||
function getRepFromSelector(selector, container){ | ||
var attributeManager = this.documentAttributeManager; | ||
var repArr = []; | ||
// first find the element | ||
@@ -1063,4 +1075,9 @@ var elements = container.contents().find(selector); | ||
// If the line has a lineAttribute then leftOffset should be +1 | ||
var hasLineAttribute = $(span).parent("li, ul"); | ||
if(hasLineAttribute.length !== 0) leftOffset++; | ||
// Get each line Attribute on this line.. | ||
var hasLineAttribute = false; | ||
var attrArr = attributeManager.getAttributesOnLine(lineNumber); | ||
$.each(attrArr, function(attrK, value){ | ||
if(value[0] === "lmkr") hasLineAttribute = true; | ||
}); | ||
if(hasLineAttribute) leftOffset++; | ||
@@ -1074,2 +1091,4 @@ $(span).prevAll("span").each(function(){ | ||
// All we need to know is span text length and it's left offset in chars | ||
var spanLength = $(span).text().length; | ||
rep[1][1] = rep[0][1] + $(span).text().length; // Easy! | ||
@@ -1080,1 +1099,8 @@ repArr.push(rep); | ||
} | ||
// Once ace is initialized, we set ace_doInsertHeading and bind it to the context | ||
exports.aceInitialized = function(hook, context){ | ||
var editorInfo = context.editorInfo; | ||
editorInfo.ace_getRepFromSelector = _(getRepFromSelector).bind(context); | ||
} | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
148268
3390