11 Commits

Author SHA1 Message Date
David Langley
0c95060797 feat: refactor DocumentView to use model as source of truth + remote cursors 2026-03-05 20:44:51 +00:00
David Langley
930cc4d51c fix(docs): stable left edge on save status indicator using min-width 2026-03-05 19:43:41 +00:00
David Langley
d21c92aa73 fix(docs): always persist deltas to Matrix timeline; add Editing/Saving/Saved status
Previously, when LiveKit/MatrixRTC was connected the debounced send would
only go to the LiveKit data channel and skip Matrix timeline events entirely.
This meant data could be lost if the user exited before the 50 ms RTC debounce
fired, since the fire-and-forget snapshot on unmount is unreliable once the
browser begins unloading.

Changes:
- Single 500 ms debounce timer (replaces the separate 50 ms RTC / 500 ms Matrix
  split).  On each debounce tick:
    1. save_incremental() captures pending local changes.
    2. If LiveKit is connected, the delta is published via the data channel for
       low-latency peer delivery.
    3. The delta is ALWAYS sent as a Matrix timeline event (or
Previously, when LiveKit/MatrixRTC was connected the debounced send would
only go to the LiveKit data channel and skip Matrix timeline events entirely.
This meant data could be lost if the user exited before the 50 ms RTC debounce
fired, since the fire-and-forget snapshot on unmount is unreliable once the
browser begins unloadi- Aonly go to the LiveKit data channel and skip Matrix timeline events entiDoThis meant data could be lost if the user exited before the 50 ms RTC debounngfired, since the fire-and-forget snapshot on unmount is unreliable once the
b mbrowser begins unloading.

Changes:
- Single 500 ms debounce timer (replacd;
Changes:
- Single 500 ms
2026-03-05 19:30:15 +00:00
David Langley
6c79900295 fix: room header height alignment and docs icon toggle colour
- Replace height:100% on .mx_DocumentView with flex:1 + min-height:0.
  In the flex-column mx_RoomView_body, height:100% resolves to the full
  parent height (not the remaining space), causing the total content to
  exceed the container and flex-shrinking the 64px RoomHeader — making
  the bottom border appear at the wrong vertical position. flex:1 takes
  only the leftover space after the header.

- Add mx_RoomHeader_toggled class to DocumentIcon when isViewingDocument
  is true, matching the same pattern used by ToggleableIcon for Threads,
  Notifications, and RoomInfo buttons. The existing CSS rule
  .mx_RoomHeader .mx_RoomHeader_toggled { fill: --cpd-color-icon-accent-primary }
  then turns the icon green.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-04 22:35:14 +00:00
David Langley
a3875fc854 fix(docs): fix document editor focus and cursor issues
Three problems prevented the document editor from being usable:

1. The contentEditable div inherited composer sizing (~22px tall) so
   clicks in the document content area landed outside it and bubbled up
   to the mx_RoomView div[tabIndex=-1], making the whole room view flash
   blue instead of focusing the editor. Fixed by making the Editor stack
   fill the full content area height in _DocumentView.pcss.

2. useSetCursorPosition was not called, so even when the editor received
   focus there was no selection range and no visible cursor. Added the
   hook call (same pattern as WysiwygComposer).

3. Any click outside the now-tall contentEditable div (e.g. in padding)
   still fell through. Added an onClick handler on the content wrapper
   that calls ref.current.focus() when the click target isn't the editor
   itself, ensuring any click in the document area focuses the editor.

Bonus: suppress the browser default outline on .mx_RoomView:focus so
pressing a key no longer shows a blue box around the entire room view.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-04 13:18:46 +00:00
David Langley
2853fefc16 fix(docs): add ComposerContext.Provider and link local RTE build
- Wrap DocumentView's Editor in ComposerContext.Provider so useSelection
  (used internally by the Editor) has the required context, enabling
  focus and keyboard input to work correctly.
- Add pnpm override pointing @vector-im/matrix-wysiwyg at the local
  matrix-rich-text-editor/platforms/web build so the automerge
  collaboration API (composerModel, useCollaboration, etc.) is available
  when running element-web locally end-to-end.
- Remove the wysiwyg patchedDependency entry (superseded by the override).
- Update pnpm-lock.yaml to reflect the link resolution.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-04 13:11:31 +00:00
David Langley
6245a5a5a0 feat(docs): add collaborative document view to rooms
Add a new 'Document' content type alongside Timeline/Call/Widget that
shows a full-room Automerge-backed collaborative editor.

Changes:
- Add `MainSplitContentType.Document` to RoomContext enum
- Add `view_document?: boolean` to ViewRoomPayload
- Track `viewingDocument` state in RoomViewStore with `isViewingDocument()`
- Update RoomView.getMainSplitContentType to return Document when active,
  and render <DocumentView> in the main split switch statement
- Add document toggle button (📄) to RoomHeader using the Compound
  IconButton / Tooltip pattern
- New DocumentView component:
  - Uses `useWysiwyg` for the rich text editor surface
  - Loads initial document from room-state event (org.element.doc.automerge)
  - Sends incremental Automerge deltas (debounced 500 ms) as
    org.element.doc.delta timeline events
  - Receives and applies remote deltas from other room participants
  - Full-height document layout with formatting toolbar
- New _DocumentView.pcss stylesheet + import in _components.pcss
- i18n strings: room.document.open / room.document.close

The collaboration methods (save_incremental, receive_changes, etc.) are
guarded by the isCollaborative() runtime type-check so the component
degrades gracefully with the current 2.40.0 npm package until the
langleyd/automerge build is published.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-04 12:55:55 +00:00
rbondesson
11030ae68d
Refactor DateSeparator using MVVM and move to shared-components (#32482)
* Refactor DateSeparator using MVVM and move to shared-components

* Add a few more stories, tests and screenshots

* Use the shared component and viewmodel in element-web

* Renaming custom content property an updating snapshots

* Fix lint errors and update snapshot after merge

* Change lifecycle handling for DateSeparatoreViewModel in components where manual handling is preferrable over wrapper component.

* Move context menu from viewmodel to shared components - step 1

* Create a jump to date picker component in shared components

* Add tests for coverage and fix layout issues and roving indexes

* Make element-web use the new component

* Simplify context menu and adjusting tests

* The HTMLExport now render shared components and need a I18nContext.Provider

* Updating unit tests for context menu

* Changed to {translate: _t} to let scripts pick up translations

* Fix lint issue and updating screenshots after merge

* Update snaps for element web components

* Renaming MVVM view components with suffix View.

* Fixing problem with input date calendar icon and system dark theme

* Changed the rendering of the menu and added a separate button component

* Handle input control with useRef in onKeyDown

* Updating DateSeparator snapshots on unit tests

* Updating layout after compound Menu got a className property

* Move files to new subfolder after merge

* Updated snapshot after merge

* Updating lock file

* Updates to styling from PR review

* Updates to focus/blur functionality

* Fixed tabbing and export documentation to stories

* Updated snapshots

---------

Co-authored-by: Zack <zazi21@student.bth.se>
2026-03-02 12:18:51 +00:00
David Baker
db3af8e653
Fix misaligned cross in complete security dialog (#32614)
* Fix misaligned cross in complete security dialog

* It's not a dialog

* Need to wait for login to finish

* Add screenshot

* Move snapshot to thr right place
2026-02-25 13:00:25 +00:00
Zack
e26cbba541
Refactor Reactions Row Button to shared-components (#31993)
* Refactoring of ReactionRowButton to shared component MVVM

* Removal of old component and creation of unit tests

* Update

* Update tests

* Update tests to mimic VM

* Update Lint Spacing

* Added onKeyDown to follow wcag rules

* Remove Unused code

* Update screenshots

* Removal of unessecery test and story

* Update snapshot

* Refactor reactions row VMs to granular setters and merge cheap snapshot updates

* Elist Fix

* Revert ReactionRowButtonToolTip Test

* Fix ReactionsRowButtonViewModel tooltip sync to use tooltip setProps

* Add dedicated ReactionsRowButtonViewModel unit tests for setters, tooltip sync, and click actions

* Better Wording On Functions

* Update snapshot

* Update packages/shared-components/src/message-body/ReactionsRowButton/ReactionsRowButtonView.tsx

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* use native button and tighten view model

* Update Snapshots + small fixes on reactionrow

* Removal of Null on viewmodel and adapting ReactionRow

* Update test and removal of unused test since me MVVMD ReactionRowButton

* align assertions with refactored update behavior

* FIx issue with classNames component

* Update snapshot

* Removal of old test snapshot

* Update Snapshot

* Implement Css + Snapshot Updates

* Update Snapshot and css to match old component style

* restore MatrixClientContext fallback in ReactionsRow for export/test rendering

* restore client fallback in ReactionsRow to preserve export rendering

* Remove Unused Pcss FIle

* Update Css

* Update misstake always having button default to disabled render

* Remove unsimiler css to original component

* Update Snapshot to reflect css adjustments

* Update css

* Update font to compund

* Update css to reflect old component

* Update css to compund

* Update Snapshot and css

* Update css

* Update HTML snapshot

* Update css

* Update Css

* Update snapshots

* Update HTML snapshot

* Update css + snapshot

* Update HTML snapshot

* Removal of mx css

* Update snapshot based on css removal

* Update Html snapshot

* Apply suggestion from @florianduros

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* remove setContext from ReactionsRowButtonViewModel

* Update packages/shared-components/src/message-body/ReactionsRowButton/ReactionsRowButtonView.tsx

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* add tooltipVm to ReactionsRowButtonViewSnapshot

* added compound token variables

* remove className from content and count inner elements

* use useMatrixClientContext() directly for ReactionsRowButtonViewModel

* Update snapshots

* Update snapshot + fix Typescript error on test file

* Removal of line-height in css

* Added line-height back and removed font: inherit;

* derive ReactionsRowButton className/ariaLabel types from HTML button attrs

* Update packages/shared-components/src/message-body/ReactionsRowButton/ReactionsRowButtonView.tsx

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* Update src/viewmodels/message-body/ReactionsRowButtonViewModel.ts

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* Update src/viewmodels/message-body/ReactionsRowButtonViewModel.ts

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* Update test/viewmodels/message-body/ReactionsRowButtonViewModel-test.tsx

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* Update snapshots and lint issues

* Update model to respond to changes

* Update aria label on view

---------

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>
2026-02-25 11:18:03 +00:00
Michael Telatynski
91a3cb03c1
mv element.io @types __mocks__/ debian docker module_system/ playwright res src test webapp Dockerfile .dockerignore .eslintignore .stylelintrc.cjs babel.config.cjs recorder-worklet-loader.cjs .modernizr.json components.json config.json config.sample.json package.json project.json tsconfig.json tsconfig.module_system.json jest.config.ts playwright.config.ts webpack.config.ts build_config.sample.yaml apps/web/
mkdir apps/web/scripts
mv scripts/{cleanup.sh,ci_package.sh,copy-res.ts,deploy.py,package.sh} apps/web/scripts

And a couple of gitignore tweaks

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2026-02-24 15:43:58 +00:00