mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Remove markers correctly
This commit is contained in:
parent
084838926d
commit
f68c615f61
1 changed files with 12 additions and 12 deletions
|
@ -103,23 +103,21 @@ define [
|
||||||
expected_markers = []
|
expected_markers = []
|
||||||
for change in @changesTracker.changes
|
for change in @changesTracker.changes
|
||||||
op = change.op
|
op = change.op
|
||||||
{background_marker_id} = @changeIdToMarkerIdMap[change.id]
|
{background_marker_id, callout_marker_id} = @changeIdToMarkerIdMap[change.id]
|
||||||
start = @_shareJsOffsetToAcePosition(op.p)
|
start = @_shareJsOffsetToAcePosition(op.p)
|
||||||
if op.i?
|
if op.i?
|
||||||
end = @_shareJsOffsetToAcePosition(op.p + op.i.length)
|
end = @_shareJsOffsetToAcePosition(op.p + op.i.length)
|
||||||
else if op.d?
|
else if op.d?
|
||||||
end = start
|
end = start
|
||||||
expected_markers.push {
|
expected_markers.push { marker_id: background_marker_id, start, end }
|
||||||
marker_id: background_marker_id, start, end
|
expected_markers.push { marker_id: callout_marker_id, start, end: start }
|
||||||
}
|
|
||||||
|
|
||||||
for comment in @changesTracker.comments
|
for comment in @changesTracker.comments
|
||||||
{background_marker_id} = @changeIdToMarkerIdMap[comment.id]
|
{background_marker_id, callout_marker_id} = @changeIdToMarkerIdMap[comment.id]
|
||||||
start = @_shareJsOffsetToAcePosition(comment.offset)
|
start = @_shareJsOffsetToAcePosition(comment.offset)
|
||||||
end = @_shareJsOffsetToAcePosition(comment.offset + comment.length)
|
end = @_shareJsOffsetToAcePosition(comment.offset + comment.length)
|
||||||
expected_markers.push {
|
expected_markers.push { marker_id: background_marker_id, start, end }
|
||||||
marker_id: background_marker_id, start, end
|
expected_markers.push { marker_id: callout_marker_id, start, end: start }
|
||||||
}
|
|
||||||
|
|
||||||
for {marker_id, start, end} in expected_markers
|
for {marker_id, start, end} in expected_markers
|
||||||
marker = markers[marker_id]
|
marker = markers[marker_id]
|
||||||
|
@ -213,15 +211,17 @@ define [
|
||||||
@updateReviewEntriesScope()
|
@updateReviewEntriesScope()
|
||||||
|
|
||||||
_onInsertRemoved: (change) ->
|
_onInsertRemoved: (change) ->
|
||||||
marker_id = @changeIdToMarkerIdMap[change.id]
|
{background_marker_id, callout_marker_id} = @changeIdToMarkerIdMap[change.id]
|
||||||
session = @editor.getSession()
|
session = @editor.getSession()
|
||||||
session.removeMarker marker_id
|
session.removeMarker background_marker_id
|
||||||
|
session.removeMarker callout_marker_id
|
||||||
@updateReviewEntriesScope()
|
@updateReviewEntriesScope()
|
||||||
|
|
||||||
_onDeleteRemoved: (change) ->
|
_onDeleteRemoved: (change) ->
|
||||||
marker_id = @changeIdToMarkerIdMap[change.id]
|
{background_marker_id, callout_marker_id} = @changeIdToMarkerIdMap[change.id]
|
||||||
session = @editor.getSession()
|
session = @editor.getSession()
|
||||||
session.removeMarker marker_id
|
session.removeMarker background_marker_id
|
||||||
|
session.removeMarker callout_marker_id
|
||||||
@updateReviewEntriesScope()
|
@updateReviewEntriesScope()
|
||||||
|
|
||||||
_onCommentAdded: (comment) ->
|
_onCommentAdded: (comment) ->
|
||||||
|
|
Loading…
Reference in a new issue