mirror of
https://github.com/overleaf/overleaf.git
synced 2024-09-16 02:52:31 -04:00
Merge pull request #420 from sharelatex/ja-track-changes
List track changes in beta program
This commit is contained in:
commit
bb3589ab2d
7 changed files with 25 additions and 17 deletions
|
@ -18,11 +18,9 @@ block content
|
||||||
| #{translate("beta_program_badge_description")}
|
| #{translate("beta_program_badge_description")}
|
||||||
span.beta-feature-badge
|
span.beta-feature-badge
|
||||||
p.text-centered
|
p.text-centered
|
||||||
| #{translate("beta_program_current_beta_features_description")}
|
strong We're currently testing track changes and commenting:
|
||||||
ul.list-unstyled.text-center
|
p.text-centered
|
||||||
li
|
img(src="/img/teasers/track-changes/track-changes-beta.png", style="max-width: 100%; border-bottom: 1px solid #ddd")
|
||||||
i.fa.fa-fw.fa-book
|
|
||||||
| #{translate("syntax_checking")}
|
|
||||||
.row.text-centered
|
.row.text-centered
|
||||||
.col-md-12
|
.col-md-12
|
||||||
if user.betaProgram
|
if user.betaProgram
|
||||||
|
|
|
@ -92,7 +92,9 @@ header.toolbar.toolbar-header.toolbar-with-labels(
|
||||||
ng-click="toggleReviewPanel()"
|
ng-click="toggleReviewPanel()"
|
||||||
)
|
)
|
||||||
i.review-icon
|
i.review-icon
|
||||||
p.toolbar-label Review
|
p.toolbar-label
|
||||||
|
| Review
|
||||||
|
span(style="vertical-align: 20%; margin-left: 4px; padding: 2px 4px;").beta-feature-badge
|
||||||
a.btn.btn-full-height(
|
a.btn.btn-full-height(
|
||||||
href,
|
href,
|
||||||
ng-if="permissions.admin",
|
ng-if="permissions.admin",
|
||||||
|
|
|
@ -332,6 +332,7 @@ script(type='text/ng-template', id='addCommentEntryTemplate')
|
||||||
ng-keypress="handleCommentKeyPress($event);"
|
ng-keypress="handleCommentKeyPress($event);"
|
||||||
placeholder="Add your comment here"
|
placeholder="Add your comment here"
|
||||||
focus-on="comment:new:open"
|
focus-on="comment:new:open"
|
||||||
|
ng-blur="submitNewComment()"
|
||||||
)
|
)
|
||||||
.rp-entry-actions
|
.rp-entry-actions
|
||||||
button.rp-entry-button(
|
button.rp-entry-button(
|
||||||
|
|
|
@ -20,8 +20,8 @@ define [
|
||||||
@rangesTracker = doc.ranges
|
@rangesTracker = doc.ranges
|
||||||
@connectToRangesTracker()
|
@connectToRangesTracker()
|
||||||
|
|
||||||
@$scope.$on "comment:add", (e, thread_id) =>
|
@$scope.$on "comment:add", (e, thread_id, offset, length) =>
|
||||||
@addCommentToSelection(thread_id)
|
@addCommentToSelection(thread_id, offset, length)
|
||||||
|
|
||||||
@$scope.$on "comment:select_line", (e) =>
|
@$scope.$on "comment:select_line", (e) =>
|
||||||
@selectLineIfNoSelection()
|
@selectLineIfNoSelection()
|
||||||
|
@ -45,7 +45,7 @@ define [
|
||||||
@recalculateReviewEntriesScreenPositions()
|
@recalculateReviewEntriesScreenPositions()
|
||||||
|
|
||||||
changingSelection = false
|
changingSelection = false
|
||||||
onChangeSelection = (args...) =>
|
onChangeSelection = () =>
|
||||||
# Deletes can send about 5 changeSelection events, so
|
# Deletes can send about 5 changeSelection events, so
|
||||||
# just act on the last one.
|
# just act on the last one.
|
||||||
if !changingSelection
|
if !changingSelection
|
||||||
|
@ -53,7 +53,6 @@ define [
|
||||||
@$scope.$evalAsync () =>
|
@$scope.$evalAsync () =>
|
||||||
changingSelection = false
|
changingSelection = false
|
||||||
@updateFocus()
|
@updateFocus()
|
||||||
@recalculateReviewEntriesScreenPositions()
|
|
||||||
|
|
||||||
onResize = () =>
|
onResize = () =>
|
||||||
@recalculateReviewEntriesScreenPositions()
|
@recalculateReviewEntriesScreenPositions()
|
||||||
|
@ -64,11 +63,13 @@ define [
|
||||||
|
|
||||||
bindToAce = () =>
|
bindToAce = () =>
|
||||||
@editor.on "changeSelection", onChangeSelection
|
@editor.on "changeSelection", onChangeSelection
|
||||||
|
@editor.on "change", onChangeSelection # Selection also moves with updates elsewhere in the document
|
||||||
@editor.on "changeSession", onChangeSession
|
@editor.on "changeSession", onChangeSession
|
||||||
@editor.renderer.on "resize", onResize
|
@editor.renderer.on "resize", onResize
|
||||||
|
|
||||||
unbindFromAce = () =>
|
unbindFromAce = () =>
|
||||||
@editor.off "changeSelection", onChangeSelection
|
@editor.off "changeSelection", onChangeSelection
|
||||||
|
@editor.off "change", onChangeSelection
|
||||||
@editor.off "changeSession", onChangeSession
|
@editor.off "changeSession", onChangeSession
|
||||||
@editor.renderer.off "resize", onResize
|
@editor.renderer.off "resize", onResize
|
||||||
|
|
||||||
|
@ -174,10 +175,11 @@ define [
|
||||||
# @rangesTracker.applyOp op # Will apply via sharejs
|
# @rangesTracker.applyOp op # Will apply via sharejs
|
||||||
@$scope.sharejsDoc.submitOp op
|
@$scope.sharejsDoc.submitOp op
|
||||||
|
|
||||||
addCommentToSelection: (thread_id) ->
|
addCommentToSelection: (thread_id, offset, length) ->
|
||||||
range = @editor.getSelectionRange()
|
start = @_shareJsOffsetToAcePosition(offset)
|
||||||
content = @editor.getSelectedText()
|
end = @_shareJsOffsetToAcePosition(offset + length)
|
||||||
offset = @_aceRangeToShareJs(range.start)
|
range = new Range(start.row, start.column, end.row, end.column)
|
||||||
|
content = @editor.session.getTextRange(range)
|
||||||
@addComment(offset, content, thread_id)
|
@addComment(offset, content, thread_id)
|
||||||
|
|
||||||
selectLineIfNoSelection: () ->
|
selectLineIfNoSelection: () ->
|
||||||
|
|
|
@ -280,6 +280,7 @@ define [
|
||||||
entries["add-comment"] = {
|
entries["add-comment"] = {
|
||||||
type: "add-comment"
|
type: "add-comment"
|
||||||
offset: selection_offset_start
|
offset: selection_offset_start
|
||||||
|
length: selection_offset_end - selection_offset_start
|
||||||
}
|
}
|
||||||
|
|
||||||
for id, entry of entries
|
for id, entry of entries
|
||||||
|
@ -310,10 +311,15 @@ define [
|
||||||
$scope.$broadcast "review-panel:layout"
|
$scope.$broadcast "review-panel:layout"
|
||||||
|
|
||||||
$scope.submitNewComment = (content) ->
|
$scope.submitNewComment = (content) ->
|
||||||
|
return if !content? or content == ""
|
||||||
|
doc_id = $scope.editor.open_doc_id
|
||||||
|
entries = getDocEntries(doc_id)
|
||||||
|
return if !entries["add-comment"]?
|
||||||
|
{offset, length} = entries["add-comment"]
|
||||||
thread_id = RangesTracker.generateId()
|
thread_id = RangesTracker.generateId()
|
||||||
thread = getThread(thread_id)
|
thread = getThread(thread_id)
|
||||||
thread.submitting = true
|
thread.submitting = true
|
||||||
$scope.$broadcast "comment:add", thread_id
|
$scope.$broadcast "comment:add", thread_id, offset, length
|
||||||
$http.post("/project/#{$scope.project_id}/thread/#{thread_id}/messages", {content, _csrf: window.csrfToken})
|
$http.post("/project/#{$scope.project_id}/thread/#{thread_id}/messages", {content, _csrf: window.csrfToken})
|
||||||
.error (error) ->
|
.error (error) ->
|
||||||
ide.showGenericMessageModal("Error submitting comment", "Sorry, there was a problem submitting your comment")
|
ide.showGenericMessageModal("Error submitting comment", "Sorry, there was a problem submitting your comment")
|
||||||
|
|
|
@ -28,7 +28,6 @@ define [
|
||||||
if ev.keyCode == 13 and !ev.shiftKey and !ev.ctrlKey and !ev.metaKey
|
if ev.keyCode == 13 and !ev.shiftKey and !ev.ctrlKey and !ev.metaKey
|
||||||
ev.preventDefault()
|
ev.preventDefault()
|
||||||
if scope.state.content.length > 0
|
if scope.state.content.length > 0
|
||||||
ev.target.blur()
|
|
||||||
scope.submitNewComment()
|
scope.submitNewComment()
|
||||||
|
|
||||||
scope.submitNewComment = () ->
|
scope.submitNewComment = () ->
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
Loading…
Reference in a new issue