Various commenting improvements (#4941)

* fix: New threads attached to previous as replies

* fix: Cannot use floating toolbar properly in comments

* perf: Avoid re-writing history on click in editor

* fix: Comment on text selection

* fix: 'Copy link' on comments uses wrong hostname

* Show comment buttons on input focus rather than non-empty input
Increase maximum sidebar size

* Allow opening comments from document menu

* fix: Clicking comment menu should not focus thread

* fix: Selection color

* fix: Draft comments not restored

* Add border above document level comment input

* fix: Floating toolbar not constrainted by offset parent

* fix flash of no comment on saving

* fix: Clicking on editor does not remove draft mark
This commit is contained in:
Tom Moor
2023-02-27 19:50:35 -05:00
committed by GitHub
parent 6b00ced48f
commit fff0812659
7 changed files with 91 additions and 72 deletions

View File

@@ -83,8 +83,8 @@ function usePosition({
const offsetParent = menuRef.current.offsetParent
? menuRef.current.offsetParent.getBoundingClientRect()
: ({
width: 0,
height: 0,
width: window.innerWidth,
height: window.innerHeight,
top: 0,
left: 0,
} as DOMRect);
@@ -141,8 +141,8 @@ function usePosition({
// instances leave a margin
const margin = 12;
const left = Math.min(
window.innerWidth - menuWidth - margin,
Math.max(margin, centerOfSelection - menuWidth / 2)
offsetParent.x + offsetParent.width - menuWidth - margin,
Math.max(offsetParent.x + margin, centerOfSelection - menuWidth / 2)
);
const top = Math.min(
window.innerHeight - menuHeight - margin,