Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): implement presence cursors (#6081)
* feat(portable-text-editor): improve range decorations perf by comparing prev values * test(portable-text-editor): add tests for range decorations rendering * fixup! feat(portable-text-editor): improve range decorations perf by comparing prev values * test(portable-text-editor): improve some minor test things * fix(core): update z-index on PTE activate overlay * feat(core): extend presence data model with `selection` * feat(structure): include `selection` in presence data * feat(core): implement presence cursors in PTE * test(core): add presence cursor workshop story * refactor(core): use `getTheme_v2` to access theme values * fix(core): introduce `OnPathFocusPayload` to improve typing * fix(form/inputs): perf optimization for PT-input decorators * refactor(form/inputs): also display user presence when user is selecting a range, but only the focus point of it * fix(core): render presence cursors inline instead of in a portal * fix(core): broken workshop story * feat(core): reset presence selection on blur in PTE * fix(structure): add accidentially removed setFocusPath (DocumentPaneProvider) This seems to have been lost in a rebase. * fix(core): use `useFormFieldPresence` in `usePresenceCursorDecorations` * fix(core): set `focusPath` when receiving a mutation event if there are pending patches * fix(form/inputs): break don't return * fix(form/inputs): remove ref that should not be set here This ref is supposed to be set elsewhere (on the PTE Editable component) See eca960e * fix(form/inputs): sort hook deps list * fix(form/inputs): reconcile presence decorations for PT-Input Make sure these objects stays as stable as possible in order to not redraw any range decorations unnecessary. * fix(form/inputs): return early if focusPath is already selected in PT-Input * refactor(form/inputs): throttle reporting of focusPath and presence updates for PT-input * fix(core): import of `FormNodePresence` * fix(form/inputs): remove lastActive as dep for PT-presence range decorations uniqueness We are not using this value anyway, and it complicates the reconciliation of the presence decorators * test(core): add presence cursor workshop story * fix(core): remove unnecessary z-index in PTE activate overlay * fix(core): prevent presence cursor user name from being selected * fix(form/inputs): fix issue where perf opt on focusPath tracking broke tests This perf opt. broke some tests. It's not clear if it is a problem with the test or the func. so restoring the old behaviour for now. * test(core): update snapshots in `Studio.test` * refactor(core): move presence decorations according to user edits Use a own state for this. * refactor(core/form): remove complexity from PortableTextInput Handle debouncing in the DocumentProvider instead. Setting focusPath must be synchronous * refactor(structure): announce presence throttled When we introduced presence in the PortableTextInput, we risk calling the presence updates very often. There should be no reason for not doing this throttled, as long as we have leading true. * refactor(core): clean up presence cursors code + add comments --------- Co-authored-by: Per-Kristian Nordnes <[email protected]>
- Loading branch information