Commit Graph

68 Commits (c47b5872259cc51c9a0969669e0f37f264f3b8e3)

Author SHA1 Message Date
alunturner 0d981326ac
RTE plain text mentions as pills (#10852)
* 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>
2023-05-16 11:54:16 +00:00
alunturner 0889dc55da
Room and user mentions for plain text editor (#10665)
* update useSuggestion

* update useSuggestion-tests

* add processMention tests

* add test

* add getMentionOrCommand tests

* change mock href for codeQL reasons

* fix TS issue in test

* add a big old cypress test

* fix lint error

* update comments

* reorganise functions in order of importance

* rename functions and variables

* add endOffset to return object

* fix failing tests

* update function names and comments

* update comment, remove delay

* update comments and early return

* nest mappedSuggestion inside Suggestion state and update test

* rename suggestion => suggestionData

* update comment

* add argument to findSuggestionInText

* make findSuggestionInText return mappedSuggestion

* fix TS error

* update comments and index check from === -1 to < 0

* tidy logic in increment functions

* rename variable

* Big refactor to address multiple comments, improve behaviour and add tests

* improve comments

* tidy up comment

* extend comment

* combine similar returns

* update comment

* remove single use variable

* fix comments
2023-05-11 14:28:42 +00:00
alunturner ca25c8f430
Commands for plain text editor (#10567)
* 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>
2023-04-27 07:37:47 +00:00
Michael Telatynski daad630827
Conform more of the codebase to `strictNullChecks` (#10602)
* Conform more of the codebase to `strictNullChecks`

* Conform more of the codebase to `strictNullChecks`

* Fix types
2023-04-17 08:31:58 +01:00
alunturner e4ebcf5731
Handle more completion types in rte autocomplete (#10560)
* handle at-room

* remove console log

* update and add tests

* tidy up

* refactor to switch statement

* fix TS error

* expand tests

* consolidate similar if/else if blocks
2023-04-14 09:09:38 +00:00
alunturner 4d5744008e
Handle /me in rte (#10558)
* 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
2023-04-11 08:23:03 +00:00
alunturner 96c62ea03d
Fix avatar text issue in rte (#10559)
* replace - with zwsp

* improve comments

* fix broken tests

* fix typo
2023-04-11 08:13:48 +00:00
alunturner 3fa6f8cbf0
Handle command completions in RTE (#10521)
* 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
2023-04-10 12:47:42 +00:00
alunturner e03eac12c3
Add room and user avatars to rte (#10497)
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2023-04-06 08:43:49 +00:00
alunturner 6f791d28c8
Add mentions as links to rte (#10463)
* adds autocomplete behaviour for mentions in rich text editor
* allows adding mentions as links
* adds tests
2023-03-31 14:14:55 +01:00
Janne Mareike Koschinski 63678603e0
Revert "Mentions as links rte (#10422)" (#10458)
This reverts commit 1af71089dd.
2023-03-27 12:57:05 +02:00
alunturner 1af71089dd
Mentions as links rte (#10422)
* 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
2023-03-24 17:07:24 +00:00
Michael Telatynski af1ec76149
Fix jest/no-conditional-expect lint and enable it (#10307) 2023-03-07 13:58:10 +00:00
Michael Weimann 5398db21ad
Add ESLint Jest (#10261) 2023-03-01 16:23:35 +01:00
Michael Telatyński 629e5cb01f
Properly type Modal props to ensure useful typescript checking (#10238
* Properly type Modal props to ensure useful typescript checking

* delint

* Iterate

* Iterate

* Fix modal.close loop

* Iterate

* Fix tests

* Add comment

* Fix test
2023-02-28 10:31:48 +00:00
alunturner 18c9b2bed2
Hide indent button in rte (#10149)
* add conditional rendering for indent and unindent buttons
* bump rte to 1.1.1
2023-02-14 11:07:36 +00:00
Michael Telatynski 61a63e47f4
Comply with noImplicitAny (#9940)
* Stash noImplicitAny work

* Stash

* Fix imports

* Iterate

* Fix tests

* Delint

* Fix tests
2023-02-13 11:39:16 +00:00
Florian Duros 2b66cfc25f
Open message in editing mode when keyboard up is pressed (RTE) (#10079)
Move to previous message when arrow up is pressed in the main composer (RTE)
2023-02-03 17:43:02 +01:00
Florian Duros 469228f45e
Fix new line created when enter is pressed (#10064) 2023-02-03 10:48:12 +01:00
Florian Duros afda774471
Add RTE keyboard navigation in editing (#9980)
Add Keyboard navigation in editing
2023-02-01 13:12:12 +01:00
Florian Duros 918f151384
Add indentation increasing/decreasing to RTE (#10034)
Add indent and unindent actions to RTE
2023-01-31 18:13:24 +01:00
Florian Duros 406edfc27d
Fix link creation with backward selection (#9986)
Fix link creation with backward selection
2023-01-26 10:08:23 +00:00
Florian Duros 1da78fa6bc
Fix RTE focus behaviour in threads 2023-01-23 15:41:01 +01:00
alunturner 9dbc5f3773
Add quotes to rich text editor (#9932)
* bump rich text editor to 0.20.0
* add new svg for the button
* show the button
* make the composer display look like the timeline display
2023-01-20 10:55:46 +00:00
alunturner a63da74f06
Add code blocks to rich text editor (#9921)
* 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
2023-01-19 15:49:21 +00:00
alunturner 8a2e386531
Add disabled button state to rich text editor (#9930)
* add disabled css state
* conditionally apply disabled css state
* hides disabled tooltips
2023-01-19 09:24:29 +00:00
Florian Duros b47588fc5c
Fix {enter} press in RTE (#9927)
Fix enter combination in RTE
2023-01-19 09:17:18 +00:00
Florian Duros e4a9684d76
Fix cypress RTE flaky test (#9920)
* Update @matrix-org/matrix-wysiwyg to 0.19.0
* Press {enter} to send message
2023-01-18 10:09:25 +01:00
alunturner 6052db1e8a
Add list functionality to rich text editor (#9871)
* 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
2023-01-13 15:44:35 +00:00
Florian Duros a691e634b0
Add edit and remove actions to link in RTE (#9864)
Add edit and remove actions to link in RTE
2023-01-11 10:10:55 +00:00
alunturner 432ce3ca31
Improve switching between rich and plain editing modes (#9776)
* 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
2023-01-04 12:57:09 +00:00
Florian Duros 6b155620e4
Fix emoji in RTE editing (#9827)
Fix emoji in RTE editing
2023-01-03 15:35:14 +00:00
Florian Duros fe0273b1a6
Add link creation to rich text editor (#9775)
Add link creation to RTE
2022-12-23 11:34:15 +00:00
Florian Duros 7db2ee749f
Fix rte flaky test (#9811) 2022-12-21 11:22:17 +00:00
Florian Duros d6e447b934
Load RTE component only when needed (#9804)
Use react lazy to load rte component
2022-12-20 14:59:18 +00:00
Michael Weimann 526645c791
Apply prettier formatting 2022-12-12 12:24:14 +01:00
Florian Duros 73986faa7d
Add inline code to rich text editor (#9720)
Add inline code to rich text editor
2022-12-09 14:06:15 +01:00
Florian Duros 65f9843576
Add emoji handling for plain text mode (#9727)
Add emoji handling for plain text mode
2022-12-09 11:38:14 +01:00
Andy Balaam 0f17728aa1
Merge branch 'develop' into feat/emoji-picker-rich-text-mode 2022-12-08 09:39:30 +00:00
Florian Duros 7943f83858
Change formatting buttons behavior (#9715)
Change formatting buttons behaviour
2022-12-07 12:13:35 +01:00
Florian Duros bc001c2b88
Fix types 2022-12-06 16:45:25 +01:00
Florian Duros 27139ca68e
Add test for emoji 2022-12-06 16:38:25 +01:00
Florian Duros f5efa85882
Fix types and console.log 2022-12-05 17:40:33 +01:00
Florian Duros 033c26ab53
Fix edit a reply in rich text editor (#9615)
Fix edit a reply in rich text editor
2022-11-28 16:01:49 +01:00
Florian Duros 7c63d52500
Add placeholder for rich text editor (#9613)
* Add placeholder for rich text editor
2022-11-24 10:31:56 +00:00
Florian Duros 3243d215e6
Remove useWysiwyg mock (#9578) 2022-11-16 15:38:00 +00:00
Florian Duros 45d53d3404
Update @matrix-org/matrix-wysiwyg dependency 2022-11-14 14:12:09 +01:00
Florian Duros 5ca9accce2
Improve design of the rich text editor (#9533)
New design for rich text composer
2022-11-04 15:36:50 +00:00
Florian Duros 92b4c8bf4e
Review clean 2022-10-26 19:05:27 +02:00
Florian Duros fb751c3c7b
Add test for plain mode 2022-10-26 17:16:13 +02:00