* add failing test
* WIP - pause work until we can implement with new patch release of RTE
* focus tests purely on the body output
* remove unused import
* fix logic error
* update types
* extract message content to variable
* use the new messageContent property
* sort out mention types to make them a map
* update getMentionAttributes to use AllowedMentionAttributes
* add plain text handling
* change type and handling for attributes when creating a mention in plain text
* tidy, add comment
* revert TS config change
* fix broken types in test
* update tests
* bump rte
* fix import and ts errors
* fix broken tests
* Move Room context threadId our of RoomView state
* Allow maintaining a different right panel width for thread panels
* Fix types
* Fix types
* Add tests
* Increase coverage
* Increase coverage
* Add comments
* Update src/components/structures/MainSplit.tsx
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* get rough funcitonality working
* try to tidy up types
* fix merge error
* fix signature change error
* type wrangling
* use onBeforeInput listener
* add onBeforeInput handler, add logic to onPaste
* fix type error
* bring plain text listeners in line with useInputEventProcessor
* extract common function to util file, move tests
* tidy comment
* tidy comments
* fix typo
* add util tests
* add text paste test
* add comments to rough first solution
* allow eventRelation prop to pass to both composers
* use eventRelation in image paste
* add image pasting to rich text mode of rich text editor
* extract error handling to function
* type the error handler
* add tests
* make behaviour mimic SendMessage
* add sad path tests
* refactor to use catch throughout
* update comments
* tidy up tests
* add special case and change function signature
* add comment
* bump rte to 2.2.2
* Remove mx_MemberInfo_profileField
* Merge mx_MemberInfo_profile with mx_MemberInfo_container
* Remove redundant div elements
* Update a Jest snapshot
* insert mentions as links styled as pills
* post merge fix and update test
* update comments, move typeguard out
* create a text node instead of setting innerText
* update test
* update test
* fix broken cypress test, remove .only
* make it able to deal with inserting in middle of blank lines
* update comment
* fix strict null error
* use typeguard
* avoid implicit truth check
* add hook tests
* add comment
* Update test/components/views/rooms/wysiwyg_composer/hooks/usePlainTextListeners-test.tsx
Co-authored-by: Andy Balaam <andy.balaam@matrix.org>
---------
Co-authored-by: Andy Balaam <andy.balaam@matrix.org>
* add the handlers for when autocomplete is open plus rough / handling
* hack in using the wysiwyg autocomplete
* switch to using onSelect for the behaviour
* expand comment
* add a handle command function to replace text
* add event firing step
* fix TS errors for RefObject
* extract common functionality to new util
* use util for plain text mode
* use util for rich text mode
* remove unused imports
* make util able to handle either type of keyboard event
* fix TS error for mxClient
* lift all new code into main component prior to extracting to custom hook
* shift logic into custom hook
* rename ref to editorRef for clarity
* remove comment
* try to add cypress test for behaviour
* remove unused imports
* fix various lint/TS errors for CI
* update cypress test
* add test for pressing escape to close autocomplete
* expand cypress tests
* add typing while autocomplete open test
* refactor to single piece of state and update comments
* update comment
* extract functions for testing
* add first tests
* improve tests
* remove console log
* call useSuggestion hook from different location
* update useSuggestion hook tests
* improve cypress tests
* remove unused import
* fix selector in cypress test
* add another set of util tests
* remove .only
* remove .only
* remove import
* improve cypress tests
* remove .only
* add comment
* improve comments
* tidy up tests
* consolidate all cypress tests to one
* add early return
* fix typo, add documentation
* add early return, tidy up comments
* change function expression to function declaration
* add documentation
* fix broken test
* add check to cypress tests
* update types
* update comment
* update comments
* shift ref declaration inside the hook
* remove unused import
* update cypress test and add comments
* update usePlainTextListener comments
* apply suggested changes to useSuggestion
* update tests
---------
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* add /me handling
* use typeguards to avoid fighting TS
* improve clarity and use of typeguards
* add createMessageContent tests
* remove completed TODO
* improve comments
* remove duplication and renaming of argument
* pass handleCommand prop down and use it in WysiwygAutocomplete
* allow a command to generate a query from buildQuery
* port command functionality into the sendMessage util
* tidy up comments
* remove use of shouldSend and update comments
* remove console log
* make logic more explicit and amend comment
* uncomment replyToEvent block
* update util test
* remove commented out test
* use local text over import from current composer
* expand tests
* expand tests
* handle the FocusAComposer action for the wysiwyg composer
* remove TODO comment
* remove TODO
* test for action dispatch
* fix failing tests
* tidy up tests
* fix TS error and improve typing
* fix TS error
* amend return types for sendMessage, editMessage
* fix null content TS error
* fix another null content TS error
* use as to correct final TS error
* remove undefined argument
* try to fix TS errors for editMessage function usage
* tidy up
* add TODO
* improve comments
* update comment
* Show room create button in RoomSublist if "UIComponent.roomCreation" is enabled
Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
* Revert "Show room create button in RoomSublist if "UIComponent.roomCreation" is enabled"
This reverts commit a332a0b02a6c3253ea7ac606211c41a09c409de5.
* Use UIComponent.ExploreRooms to display menu item "Explore public rooms" ("Explore rooms" in case of space room) in context menu of "Rooms" section of RoomList component. The context menu will be available if one of UIComponent.ExploreRooms or UIComponent.CreateRooms is enabled.
Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
* "Explore rooms" of space room should not be controlled by UIComponent.ExploreRooms.
Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
---------
Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
Co-authored-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
* Use grid layout instead
- BEM naming style
- Increase block gap from 4px to 8px
- Use flexbox inside 'header' grid-area to let the buttons wrapped
- Use variables
- Remove 4px gap when one of the buttons is not rendered
- Change 'body' to 'message'
- Set 'align-self: start' to the icon and spinner
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Unset height of spinner
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Break lines at newline characters with white-space: pre-line
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Edit tests to check decryption failure bars on narrow timeline
- checkTimelineNarrow() looks for buttons by default
- Test indicator as well
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Remove a line
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Edit the test to have it check mx_EventTile_last only inside mx_RoomView_body
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Fix double underscores
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Fix double underscores - pcss
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Iterate - buttons at the bottom
- Set common spacing to buttons with variables
- Remove line breaks, yarn run i18n
- Set data-testid for headlines and buttons in case the tested strings would be displayed elsewhere simultaneously
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Check waiting headline as well
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Increase spacing between the message and the buttons
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* lint
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Increase block gap between wrapped buttons for clickability
Apply 8px between wrapped buttons
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Revert bottom margin of buttons which are not expected to be wrapped
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Check visibility instead of existence
This commit removes data-testid from headlines and data-testid-button and checks whether the elements are really visible, not overflowing the viewport.
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Remove redundant gap between 'mx_DecryptionFailureBar_start' and the bottom edge
This commit adds '.mx_DecryptionFailureBar--withEnd' class name to have it applied to the bar only if it has button(s). This way the bar is rendered with a flexbox and the row-gap declaration is respected only if there is a 'mx_DecryptionFailureBar--withEnd' element. The element currently includes the button(s) only.
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* lint - prettier
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
* Have Percy take a snapshot of the bar loading spinner before checkTimelineNarrow()
The loading spinner is likely to disappear while checking the bar on the narrow timeline.
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
---------
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Co-authored-by: Kerry <kerrya@element.io>
* bumps the RTE dependency to introduce user/room mention handling
* adds autocomplete behaviour to allow users to insert user and room mentions as links
* sets up tests for the autocomplete behaviour
Implements the intentional mentions feature of MSC3952 (behind
a labs flag).
If enabled, this will send an org.matrix.msc3952.mentions property
on events that will contain the user IDs and/or whether the room is
being mentioned. These mentions also gets propagated via some
custom behaviour for replies and edits.
When previewing a room, we normally do not have a Room object. Currently, when the RoomPreviewBar is instantiated without a room, it doesn't raise the PreviewRoomNotLoggedIn and JoinFromRoomPreview module lifecycle events, meaning that modules are unable to intercept previews of non-peekable rooms.
To fix this, make sure that we pass the room ID into RoomPreviewBar irrespective of whether we have a Room object, and use it to raise the module lifecycle events.
Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
* Revert "Apply more general fix for base avatar regressions (#10045)"
This reverts commit 371a3c0d36.
* Revert "Fix layout and visual regressions around default avatars (#10031)"
This reverts commit 0d1fce37b2.
* Revert "Member avatars without canvas (#9990)"
This reverts commit a8aa4de4b4.
* Update snapshots
* Add tests for unread notification facilities
Add some tests to guarantee some consistency in `useUnreadNotifications` and
`RoomNotificationState`.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Add RoomNotifs#determineUnreadState
Intended as a singular replacement for the divergent implementations before.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Unify room unread state determination
Have both the class-based facility and the hook use the new unified logic in
`RoomNotifs#determineUnreadState`.
Addresses https://github.com/vector-im/element-web/issues/24229
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
---------
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* Strict typechecking fixes for Base/Member/Avatar
Update the core avatar files to pass `--strict --noImplicitAny` typechecks.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Add tests for Base/Member/Avatar
More thoroughly test the core avatar files. Not necessarily the most thorough,
but an improvement.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Extract TextAvatar from BaseAvatar
Extracted the fallback/textual avatar into its own component.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Use standard HTML for non-image avatars
Firefox users with `resistFingerprinting` enabled were seeing random noise
for rooms and users without avatars. There's no real reason to use data
URLs to present flat colors.
This converts non-image avatars to inline blocks with background colors.
See https://github.com/vector-im/element-web/issues/23936
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Have pills use solid backgrounds rather than colored images
Similar to room and member avatars, pills now use colored pseudo-elements
rather than background images.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
---------
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
Co-authored-by: Andy Balaam <andy.balaam@matrix.org>
* Applies small changes to code block display in timeline
* Makes the composer code block look like the timeline display, but without line numbers
* Adds a button to allow code blocks to be implemented
* Adds tests for the new button
* adds buttons to toggle bulleted and numbered lists on and off
* adds icons for those buttons
* css changes to timeline display
* adds tests for the new buttons, refactors existing tests
* allows switching between modes that retains formatting
* updates rich text composer dependency to 0.13.0 (@matrix-org/matrix-wysiwyg)
* improves handling of enter keypresses when ctrlEnterTosend setting is true in plain text editor
* changes the message event content when using the new editor
* adds tests for the changes to the plain text editor
* Improve decryption error UI by consolidating error messages and providing instructions when possible
* Fix TS strict errors
* Rename .scss to .pcss
* Avoid accessing clipboard, Cypress doesn't like it
* Display DecryptionFailureBar alongside other AuxPanel bars
* Add comments
* Add small margin off-screen for visible decryption failures
* Fix some more TS strict errors
* Add unit tests for DecryptionFailureBar
* Add button to resend key requests manually
* Remove references to matrix-js-sdk crypto internals
* Add hysteresis to visible decryption failures
* Add comment
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Add comment
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Don't create empty div if we're not showing resend requests button
* cancel updateSessions on unmount
* Update unit tests
* Fix lint and implicit any
* Simplify visible event bounds checking
* Adjust cypress test descriptions
* Add percy snapshots
* Update src/components/structures/TimelinePanel.tsx
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Add comments on TimelinePanel IState
* comment
* Add names to percy snapshots
* Show Resend Key Requests button when there are sessions that haven't already been requested via this bar
* We no longer request keys from senders
* update i18n
* update expected text in cypress test
* don't download keys ourselves, update device info in response to updates from client
* fix ts strict errors
* visibledecryptionfailures undefined handling
* Fix implicitAny errors
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>