Commit graph

394 commits

Author SHA1 Message Date
Robin
741b13ab6f
Avoid a reflow when setting caret position on an empty composer (#8348)
This saves an extra ~12 ms on each room switch, because we can.
2022-04-17 09:45:34 -04:00
CommanderRoot
c35fc169f5
Replace deprecated String#substr with String#slice (#8314) 2022-04-14 07:52:42 +00:00
Michael Telatynski
04e79dffae
Fix editing <ol> tags with a non-1 start attribute (#8211) 2022-03-31 18:40:51 +01:00
Robin
666cab954a
Fix emoting with emoji or pills (#8105)
* Fix emoting with emoji or pills

* Fix some slash command errors not being shown

* Re-enable mistakenly skipped SendMessageComposer tests

* Test emoting with non-text parts
2022-03-21 19:09:43 +00:00
Travis Ralston
d8a939df5d
Use & enforce snake_case naming convention on config.json settings (#8062)
* Document and support the established naming convention for config opts

This change:
* Rename `ConfigOptions` to `IConfigOptions` to match code convention/style, plus move it to a dedicated file
* Update comments and surrounding documentation
* Define every single documented option (from element-web's config.md)
* Enable a linter to enforce the convention
* Invent a translation layer for a different change to use
* No attempt to fix build errors from doing this (at this stage)

* Add demo of lint rule in action

* Fix all obvious instances of SdkConfig case conflicts

* Fix tests to use SdkConfig directly

* Add docs to make unset() calling safer

* Appease the linter

* Update documentation to match snake_case_config

* Fix more instances of square brackets off SdkConfig
2022-03-18 10:12:36 -06:00
Alexander Stephan
26e6f8deca
Improve formatting features in the editor (#7104)
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2022-03-16 09:46:07 +00:00
Robin
225581de6a
Don't escape pasted text (#8014)
Signed-off-by: Robin Townsend <robin@robin.town>
2022-03-10 08:30:43 -05:00
Robin
c10ac9e4a0
Fix a variety of issues with HTML → Markdown conversion (#8004)
* Fix a variety of issues with HTML → Markdown conversion

Signed-off-by: Robin Townsend <robin@robin.town>

* Fix lint

Signed-off-by: Robin Townsend <robin@robin.town>

* Fix @room pill formatting not being applied to link text

Signed-off-by: Robin Townsend <robin@robin.town>
2022-03-09 07:43:05 -05:00
Šimon Brandner
675b4271e9
Rename MessageComposerInput.insertTrailingComma to MessageComposerInput.insertTrailingColon (#7981) 2022-03-04 15:13:50 +00:00
Michael Telatynski
881307e97c
Fix bad ternary statement in autocomplete user pill insertions (#7977) 2022-03-04 14:01:07 +00:00
Šimon Brandner
4c05b7da1f
Make trailing : into a setting (#6711)
* Make trailing `:` into a setting

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Make traling comma opt-out

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Write `insertTrailingComma` when reading for future opt-in setting

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Update src/editor/parts.ts

* Fix line length

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

Co-authored-by: Travis Ralston <travpc@gmail.com>
2022-03-04 00:23:26 -07:00
Robin
bfab09e977
Use a more correct test for emoji (#7685) 2022-02-01 09:45:22 +00:00
Michael Telatynski
056c7c8d65
Prevent infinite loops by dropping the input instead of crashing browser (#7632) 2022-01-26 10:16:01 +00:00
Michael Telatynski
2143845a3a
Fix issue with the new composer EmojiPart which caused infinite loops (#7629) 2022-01-25 20:22:41 +00:00
Robin
6806c2cdca
Enlarge emoji in composer (#7602) 2022-01-24 12:53:05 +00:00
Michael Telatynski
2ef36507fd
Support deserialising HR tags for editing (#7543) 2022-01-14 13:24:51 +00:00
Michael Telatynski
b835588331
Allow using room pills in slash commands (#7513) 2022-01-12 09:40:18 +00:00
Renan Cleyson
9ac85bcaa3
Fix list formatting alternating on edit (#7422)
Co-authored-by: Andy Balaam <andyb@element.io>
2021-12-21 10:07:44 +00:00
Aaron Raimist
7b94e13a84 Merge branch 'develop' into sort-imports
Signed-off-by: Aaron Raimist <aaron@raim.ist>
2021-12-09 08:34:20 +00:00
Renan Cleyson
b4b81a455e
Fix wrong indentation with nested ordered list unnesting list on edit (#7300) 2021-12-07 09:46:04 +00:00
Aaron Raimist
f3867ad0a9 Merge branch 'develop' into sort-imports 2021-10-27 21:50:56 -05:00
Šimon Brandner
ceb4c7e368
Add insert link button to the format bar (#5879) 2021-10-25 10:56:55 +01:00
Aaron Raimist
bdc56be863
Auto fix
Signed-off-by: Aaron Raimist <aaron@raim.ist>
2021-10-22 17:23:37 -05:00
Michael Telatynski
fd6d853bb1 Allow editing of /rainbow and /rainbowme 2021-10-12 14:02:05 +01:00
Michael Telatynski
ddc408690c Fix EditorModel clone to actually be useful 2021-10-12 11:02:06 +01:00
Michael Telatynski
fe70e64a40 Improve typing 2021-10-12 11:01:40 +01:00
Dariusz Niemczyk
8331d4c7b7
Happily handle empty text messages (#6825)
This commig refactors the message-deletion modal and reuses it for case of removing
the entire message and trying to send it, which should trigger removal flow instead.

Fix vector-im/element-web#18873
2021-09-28 15:04:25 +01:00
Šimon Brandner
fd022310b3
Merge remote-tracking branch 'upstream/develop' into fix/end-of-line-emoji
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-09-11 10:21:56 +02:00
Michael Telatynski
f9527c9d6b Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into t3chguy/a11y/composer-list-autocomplete
 Conflicts:
	src/components/views/rooms/BasicMessageComposer.tsx
	src/editor/autocomplete.ts
2021-08-12 11:21:20 +01:00
Šimon Brandner
422c27fcef
Reorder code
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-08-06 07:46:01 +02:00
Šimon Brandner
4f0c800cad
Merge remote-tracking branch 'upstream/develop' into feature/improved-composer
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-08-06 07:45:17 +02:00
Michael Telatynski
fa550a65af Fix editing of <sub> & <sup> & <u> 2021-07-23 19:01:12 +01:00
Michael Telatynski
ce78cdf4ad Conform to new react and typescript eslint rules 2021-07-19 22:43:11 +01:00
Michael Telatynski
ebfe38dc4a Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into t3chguy/a11y/composer-list-autocomplete
 Conflicts:
	src/components/views/rooms/BasicMessageComposer.tsx
	src/editor/autocomplete.ts
2021-07-15 09:59:40 +01:00
Michael Telatynski
51f0f5718a improve types 2021-07-12 13:26:34 +01:00
Michael Telatynski
8139aeb073 skip loading room & finding member, use existing member field 2021-07-12 12:51:49 +01:00
Michael Telatynski
3515b2ca05 Fix edge case behaviour caused by our weird reuse of DOM nodes between owners 2021-07-12 12:51:27 +01:00
Šimon Brandner
b79f2d0699
Fix the ugly solution
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-07-12 12:21:59 +02:00
Šimon Brandner
113b6319b1
This looks a bit nicer
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-07-12 09:52:01 +02:00
Šimon Brandner
667abca31f
Handle pill onclick
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-07-11 20:02:32 +02:00
Šimon Brandner
98808aabca
Set contentEditable for PillParts to false
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-07-11 18:53:29 +02:00
Michael Telatynski
e768ecb3d0 Typescript conversion of Composer components and more 2021-06-30 13:01:26 +01:00
J. Ryan Stinnett
ae0a8b8da4 Auto-fix lint errors 2021-06-29 13:11:58 +01:00
Michael Telatynski
1ffbaee560 update style of imports in all modified files 2021-05-26 14:14:55 +01:00
Michael Telatynski
d8acc0612a Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into t3chguy/fix/12740
 Conflicts:
	src/components/views/rooms/EditMessageComposer.js
	src/components/views/rooms/SendMessageComposer.js
2021-05-24 21:57:38 +01:00
Michael Telatynski
28eaac0ef8 remove dead code and fix some types 2021-05-20 22:25:19 +01:00
Michael Telatynski
60e7089c77 post-merge fixes, the new keybindings stuff made it messy 2021-05-11 11:14:21 +01:00
Michael Telatynski
60d3da2441 Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into t3chguy/a11y/composer-list-autocomplete
 Conflicts:
	src/components/structures/LoggedInView.tsx
	src/components/views/rooms/BasicMessageComposer.tsx
	src/editor/autocomplete.ts
2021-05-11 10:59:22 +01:00
J. Ryan Stinnett
7821e00bc6 Revert to internal option 2021-05-10 17:36:33 +01:00
J. Ryan Stinnett
9c8e89ff79 Fix importing 2021-05-10 16:55:27 +01:00
J. Ryan Stinnett
f41fc7e46c Upgrade cheerio and resolve type errors
This helps resolve some type errors with `domhandler`. In addition, we convert
to the new way of using `htmlparser2` with `cheerio`.
2021-05-10 16:10:39 +01:00
Michael Telatynski
ed8b05b730
Merge pull request #5951 from SimonBrandner/fix/room-pill-history
Fix saving room pill part to history
2021-05-04 12:32:04 +01:00
Šimon Brandner
0c869364e9
Don't serialize resourceId in AtRoomPill
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-05-01 12:27:52 +02:00
Šimon Brandner
c1549dfac5
Make optional params optional
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-05-01 11:32:35 +02:00
Šimon Brandner
ee8d688de1
Fix saving room pill part to history
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-05-01 10:59:28 +02:00
Sven Mäder
bbce1ac704 Disallow inline display maths 2021-04-28 19:39:38 +02:00
Travis Ralston
14f1388522
Merge pull request #5830 from SimonBrandner/fix-trailing-colon
Fix inserting trailing colon after mention/pill
2021-04-28 09:51:50 -06:00
Michael Telatynski
915f8b3c9c Scale all mxc thumbs using device pixel ratio for hidpi
as we are notoriously bad at doing it everywhere we ought to, like the TopLeftMenu avatar
2021-04-26 18:25:49 +01:00
Šimon Brandner
d36f8ccb95
Rename moveStart to moveStartForwards
So it it's clear what it does

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-04-18 10:18:49 +02:00
Šimon Brandner
609196a240
Replace emoticon before a newline
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-04-18 10:13:51 +02:00
Michael Telatynski
5f59e39958 Apply the same to quoting & inserting of emoji then consolidate 2021-04-13 15:09:37 +01:00
Sven Mäder
31e85ec580 Use cheerio api for code replacements 2021-04-08 11:38:05 +02:00
Sven Mäder
7205995dea Remove unused function arguments 2021-04-07 17:22:30 +02:00
Šimon Brandner
715fff6f0c
Redo and fix trailing characters in user pills
This removes the handling of trailing chars from createMentionParts as we need to determine whether or not to insert the trailing char differently in different situations

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-04-07 11:52:07 +02:00
Sven Mäder
1d70045065 Refactor maths config options to nested structure 2021-04-06 14:52:55 +02:00
Sven Mäder
3c1169c7a2 Merge remote-tracking branch 'upstream/develop' into maths-parsing-latex 2021-04-06 12:34:51 +02:00
Sven Mäder
73130cad02 Refactor latex replace code 2021-04-01 12:09:51 +02:00
Clemens Zeidler
57cd8afbc4 Split ApplySelection into CompleteOrPrevSelection and CompleteOrNextSelection
When moving through the autocomplete selection list distinguish between
the following cases:
1) When there is no autocomplete window open, only open one and select
the first item when the CompleteOrPrevSelection /
CompleteOrNextSelection actions are emitted (e.g. by pressing SHIFT +
TAB, TAB)
2) Otherwise navigate through the selection list (e.g. SHIFT + TAB, TAB,
UP, DOWN)

- Remove references to raw keyboard events in autocomplete.ts
- Clarify the purpose of startSelection (previously onTab)

Signed-off-by: Clemens Zeidler <clemens.zeidler@gmail.com>
2021-03-29 13:38:03 +13:00
Travis Ralston
7c8c85161d
Merge pull request #5748 from SimonBrandner/compat-for-non-rich-text-clients
Show room alias in plain/formatted body
2021-03-11 11:29:26 -07:00
Šimon Brandner
d4f67d94a4
Use resourceId in plain body
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-03-11 18:53:06 +01:00
Šimon Brandner
62fa60f109
Use resourceId in formatted body
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-03-11 18:50:54 +01:00
Panagiotis
a1eabde3a3 fix: create a PillCandidatePart on the beginning of a part string 2021-03-11 19:14:04 +02:00
J. Ryan Stinnett
b12cf7912a
Merge pull request #5624 from SimonBrandner/show-room-name
Display room name in pills instead of address
2021-03-08 16:27:43 +00:00
Jaiwanth
d731e82fba Fixed edit for markdown images
Signed-off-by: Jaiwanth <jaiwanth2011@gmail.com>
2021-03-01 22:44:48 +05:30
Michael Telatynski
c05eceef7f Rework composer autocomplete to be smarter and not trap tab 2021-02-17 15:39:07 +00:00
Šimon Brandner
cb5237a18b
Display room name instead of alias
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-02-12 14:21:07 +01:00
Sven Mäder
ac1f9b4247 Add config keys for alternative patterns 2021-01-29 15:49:20 +01:00
Sven Mäder
bcc0697710 Remove /tex command 2021-01-29 13:05:49 +01:00
Sven Mäder
c4f0987487 Use TeX and LaTeX delimiters by default for serialize 2021-01-29 00:11:06 +01:00
Sven Mäder
d5c72b9d70 Fix linting error
Signed-off-by: Sven Mäder <maeder@phys.ethz.ch>
2020-12-22 13:31:58 +01:00
Sven Mäder
fb57123e25 Improve inline latex regex matching
Signed-off-by: Sven Mäder <maeder@phys.ethz.ch>
2020-12-22 12:18:38 +01:00
Sven Mäder
78b3f50bfd Use LaTeX delimiters by default, add /tex command
Since parsing for $'s as maths delimiters is tricky, switch the default
to \(...\) for inline and \[...\] for display maths as it is used in
LaTeX. Add /tex command to explicitly parse in TeX mode, which uses
$...$ for inline and $$...$$ for display maths.

Signed-off-by: Sven Mäder <maeder@phys.ethz.ch>
2020-12-21 00:05:22 +01:00
macekj
0c85cb587d Merge branch 'develop' into emoji_quick_shortcut 2020-12-04 11:05:50 -05:00
macekj
ba8d02a808 add quick shortcut emoji feature and tests
Signed-off-by: macekj <macekj@umich.edu>
2020-11-17 17:36:58 -05:00
Aleks Kissinger
839bae21ae made single and double $ default delimiters 2020-11-10 18:18:53 +00:00
Aleks Kissinger
2204e6c64e generate valid block html for commonmark spec 2020-10-25 18:32:24 +00:00
Aleks Kissinger
06b20fad95 removed implicit "this" 2020-10-23 18:49:56 +01:00
Aleks Kissinger
cc713aff72 add fallback output in code block AFTER markdown processing 2020-10-14 09:35:57 +01:00
Aleks Kissinger
aafaf34233 Merge branch 'develop' into katex 2020-10-10 19:31:46 +01:00
Aleks Kissinger
96742fc309 latex math as labs setting 2020-10-10 16:32:49 +01:00
Michael Telatynski
af4c95e267 apply to whitespace in general
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-09-29 14:17:44 +01:00
Michael Telatynski
ffa7ceb70e Trim range when formatting so that it excludes leading/trailing spaces
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-09-29 14:15:20 +01:00
Aleks Kissinger
aded3c9de2 cosmetic changes (lint) 2020-09-22 11:54:23 +01:00
Aleks Kissinger
4df8754aad allow custom latex delimiters in config.json 2020-09-21 11:00:39 +01:00
Aleks Kissinger
24a1834f9b support multi-line and escaped $ 2020-09-21 09:00:24 +01:00
Aleks Kissinger
7e6d7053e0 Revert "send fallback in pre tags, not code" (code looks better)
This reverts commit e4448ae1ad.
2020-09-20 17:02:27 +01:00
Aleks Kissinger
e4448ae1ad send fallback in pre tags, not code 2020-09-20 16:52:29 +01:00
Aleks Kissinger
428a6b94ff math off by default, enable with latex_maths flag 2020-09-20 15:07:12 +01:00
Aleks Kissinger
e78734bbf6 Deserialize back to math delimiters for editing 2020-09-20 14:20:35 +01:00
Aleks Kissinger
becc79d67a send tex math as data-mx-maths attribute 2020-09-20 12:59:22 +01:00