mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Focus on box when adding a comment
This commit is contained in:
parent
7c3a4dfa4d
commit
77400b000b
2 changed files with 13 additions and 11 deletions
|
@ -271,14 +271,6 @@ define [
|
||||||
cursor_offset = @_aceRangeToShareJs(selection.start)
|
cursor_offset = @_aceRangeToShareJs(selection.start)
|
||||||
entries = @_getCurrentDocEntries()
|
entries = @_getCurrentDocEntries()
|
||||||
|
|
||||||
for id, entry of entries
|
|
||||||
if entry.type == "comment"
|
|
||||||
entry.focused = (entry.offset <= cursor_offset <= entry.offset + entry.length)
|
|
||||||
else if entry.type == "insert"
|
|
||||||
entry.focused = (entry.offset <= cursor_offset <= entry.offset + entry.content.length)
|
|
||||||
else if entry.type == "delete"
|
|
||||||
entry.focused = (entry.offset == cursor_offset)
|
|
||||||
|
|
||||||
if selection.start.column == selection.end.column and selection.start.row == selection.end.row
|
if selection.start.column == selection.end.column and selection.start.row == selection.end.row
|
||||||
# No selection
|
# No selection
|
||||||
delete entries["add-comment"]
|
delete entries["add-comment"]
|
||||||
|
@ -287,6 +279,16 @@ define [
|
||||||
type: "add-comment"
|
type: "add-comment"
|
||||||
offset: cursor_offset
|
offset: cursor_offset
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for id, entry of entries
|
||||||
|
if entry.type == "comment"
|
||||||
|
entry.focused = (entry.offset <= cursor_offset <= entry.offset + entry.length)
|
||||||
|
else if entry.type == "insert"
|
||||||
|
entry.focused = (entry.offset <= cursor_offset <= entry.offset + entry.content.length)
|
||||||
|
else if entry.type == "delete"
|
||||||
|
entry.focused = (entry.offset == cursor_offset)
|
||||||
|
else if entry.type == "add-comment" and !selection.isEmpty()
|
||||||
|
entry.focused = true
|
||||||
|
|
||||||
updateEntryGeneration: () ->
|
updateEntryGeneration: () ->
|
||||||
# Rather than making angular deep watch the whole entries array
|
# Rather than making angular deep watch the whole entries array
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: @review-panel-width;
|
width: @review-panel-width;
|
||||||
overflow: hidden;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
.rp-size-mini & {
|
.rp-size-mini & {
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -178,8 +178,8 @@
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|
||||||
&-focused {
|
&-focused {
|
||||||
left: 0px;
|
left: -2px;
|
||||||
right: 10px;
|
right: 12px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue