Commit graph

81 commits

Author SHA1 Message Date
Johannes Marbach
c7c51d764f
Deserialise spoilers back into slash command form (#11805)
* Deserialise spoilers back into slash command form

Fixes: vector-im/element-web#26344

* Appease the linter
2023-10-26 13:35:02 +00:00
Denis Kasak
5aefd4652a
Treat lists with a single empty item as plain text, not Markdown. (#6833)
* Treat lists with a single empty item as plain text, not Markdown.

This allows users to send simple messages such as `-`, `+`, `*` and
`2021.` without Element Web mangling them into a nonsensical empty list.
As soon as any non-whitespace content is added to the item, it switches
back to treating it as a list of one item.

Fixes vector-im/element-web#7631.

* Fix type errors.

* Lint.

---------

Co-authored-by: Michael Weimann <michaelw@matrix.org>
Co-authored-by: Johannes Marbach <johannesm@element.io>
2023-08-17 16:37:19 +00:00
Johannes Marbach
d7677c7e21
Handle newlines in user pills (#11166)
* Handle newlines in user pills

Fixes: vector-im/element-web#10994

* Fix typo in comment

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

* Refactor link generation for better readability

* Use `<br>` instead of `<br/>`

* Fix copy/paste error

---------

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2023-07-05 22:00:27 +00:00
Johannes Marbach
ab98268901
Fix caret jump when backspacing into empty line at beginning of editor (#11128)
Fixes: vector-im/element-web#22335
2023-06-23 15:24:05 +00:00
Michael Telatynski
72d1bd910a
Switch from cheerio to DOMParser (#10929)
* Add tests around feature_latex_maths

* Switch from cheerio to DOMParser

* strict

* Iterate
2023-05-23 13:31:05 +00:00
Michael Telatynski
6a3f59cc76
Make more of the codebase conform to strict types (#10857) 2023-05-16 14:25:43 +01:00
Michael Telatynski
f819853cad
Fix autocomplete not resetting properly on message send (#10741) 2023-04-28 13:31:02 +00:00
Florian Duros
e4dfb21e56
Fix strict strictNullChecks to src/editor/* (#10428
* Fix strict `strictNullChecks` to `src/editor/*`

* Fix autoComplete creation

* Fix dom regression

* Remove changes
2023-03-23 13:35:55 +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 Telatynski
e8b92b308b
Conform more code to strict null checking (#10169)
* Conform more code to strict null checking

* delint

* Iterate

* delint

* Fix bad test
2023-02-16 09:38:44 +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
Michael Telatynski
21c3967010
Revert "Member avatars without canvas" (#10057
* 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
2023-02-02 10:22:19 +00:00
grimhilt
5a08859e37
fix regional emojis converted to flags (#9294)
Co-authored-by: grimhilt <grimhilt@users.noreply.github.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: Faye Duxovni <duxovni@duxovni.org>
Co-authored-by: Faye Duxovni <fayed@element.io>
Fixes https://github.com/vector-im/element-web/issues/19000
2023-01-31 13:08:35 +00:00
Clark Fischer
a8aa4de4b4
Member avatars without canvas (#9990)
* 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>
2023-01-30 09:50:08 +00:00
alunturner
b034ada6fd
Convert enzyme to rtl: BasicMessageComposer (#9839) 2022-12-29 20:52:51 +00:00
Michael Weimann
526645c791
Apply prettier formatting 2022-12-12 12:24:14 +01:00
Michael Telatynski
04bc8fb71c
Optimise Jest run in CI (#9542) 2022-11-04 10:48:08 +00:00
Michael Telatynski
fa2ec7f6c9
Fix soft crash around unknown room pills (#9301)
* Fix soft crash around unknown room pills

* Add tests

* Fix types
2022-09-20 17:00:31 +00:00
Johannes Marbach
abd39c61b1
Add support for MD / HTML in room topics (#8215)
* Add support for MD / HTML in room topics

Setting MD / HTML supported:
- /topic command
- Room settings overlay
- Space settings overlay

Display of MD / HTML supported:
- /topic command
- Room header
- Space home

Based on extensible events as defined in [MSC1767]

Fixes: vector-im/element-web#5180
Signed-off-by: Johannes Marbach <johannesm@element.io>

[MSC1767]: matrix-org/matrix-spec-proposals#1767

* Fix build error

* Add comment to explain origin of styles

Co-authored-by: Travis Ralston <travpc@gmail.com>

* Empty commit to retrigger build

* Fix import grouping

* Fix useTopic test

* Add tests for HtmlUtils

* Add slash command test

* Add further serialize test

* Fix ternary formatting

Co-authored-by: Travis Ralston <travpc@gmail.com>

* Add blank line

Co-authored-by: Travis Ralston <travpc@gmail.com>

* Properly mock SettingsStore access

* Remove trailing space

* Assert on HTML content and add test for plain text in HTML parameter

* Appease the linter

* Fix JSDoc comment

* Fix toEqual call formatting

* Repurpose test for literal HTML case

* Empty commit to fix CI

Co-authored-by: Travis Ralston <travpc@gmail.com>
Co-authored-by: Travis Ralston <travisr@matrix.org>
2022-06-07 14:20:32 -06:00
Andy Balaam
2649c6fd75
Tests for roundtrips md<->HTML (#8696)
* Tests for roundtrips md<->HTML

* Convert roundtrip tests to it.each table style

* Fix lint errors

* Remove extraneous "f "

Co-authored-by: Travis Ralston <travisr@matrix.org>

* Test __ -> **

* Test for code blocks containing markdown

* Test for more ordered lists

* Test for code blocks with language specifiers

* Additional cases for HTML->markdown->HTML

Co-authored-by: Travis Ralston <travisr@matrix.org>
2022-05-27 13:10:22 -06:00
Michael Telatynski
e69ba24f96
Fix edge case around composer handling gendered facepalm emoji (#8686)
* Write tests around composer badly handling gendered facepalm emoji

* Commit export for tests to be happy

* Fix edge case around composer handling gendered facepalm emoji

* Fix offset calculations and make code more readable
2022-05-25 12:41:36 +01:00
Michael Telatynski
674aec4050
Fix regression around pasting links (#8537)
* Fix regression around pasting links

* Add tests
2022-05-09 12:39:32 +00:00
Michael Telatynski
83ab266533
Fix editing of non-html replies (#8418) 2022-04-27 10:43:10 +02:00
Janne Mareike Koschinski
bca9caa98e
Settings toggle to disable Composer Markdown (#8358) 2022-04-19 14:53:59 +01:00
Yaya Usman
6b13988eaa
Fix: "Code formatting button does not escape backticks" (#8181)
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2022-04-19 09:20:56 +00:00
Kerry
b9da2255c4
Unit test typescriptification - editor utils (#8226)
* editor/mock ts

Signed-off-by: Kerry Archibald <kerrya@element.io>

* test/editor/serialize-test.js -> test/editor/serialize-test.ts

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix ts in serialize-test

Signed-off-by: Kerry Archibald <kerrya@element.io>

* test/editor/range-test.js -> test/editor/range-test.ts

Signed-off-by: Kerry Archibald <kerrya@element.io>

* test/editor/position-test.js -> test/editor/position-test.ts

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix position-test

Signed-off-by: Kerry Archibald <kerrya@element.io>

* test/editor/operations-test.js -> test/editor/operations-test.ts

Signed-off-by: Kerry Archibald <kerrya@element.io>

* test/editor/model-test.js -> test/editor/model-test.ts

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix ts in model-test

Signed-off-by: Kerry Archibald <kerrya@element.io>

* test/editor/history-test.js -> test/editor/history-test.ts

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix ts in history-test

Signed-off-by: Kerry Archibald <kerrya@element.io>

* test/editor/diff-test.js -> test/editor/diff-test.ts

Signed-off-by: Kerry Archibald <kerrya@element.io>

* test/editor/deserialize-test.js -> test/editor/deserialize-test.ts

Signed-off-by: Kerry Archibald <kerrya@element.io>

* ts in deserialize-test

Signed-off-by: Kerry Archibald <kerrya@element.io>

* test/editor/caret-test.js -> test/editor/caret-test.ts

Signed-off-by: Kerry Archibald <kerrya@element.io>

* ts caret-test

Signed-off-by: Kerry Archibald <kerrya@element.io>
2022-04-06 12:40:13 +01:00
Travis Ralston
a987ead7d2 Step 8.1: Remove skinning setup from all tests 2022-03-28 14:02:31 -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
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
Kerry
8b9263c808
Clean up some unit test logs (#7857)
* kill some unit test logs in arrays-test

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove mock logs that are asserted against anyway

* remove more logs

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix safeCOunterpartTranslate warnings in tests

Signed-off-by: Kerry Archibald <kerrya@element.io>

* more safeCounterpartTranslate warnings

Signed-off-by: Kerry Archibald <kerrya@element.io>

* lint

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove more logs

Signed-off-by: Kerry Archibald <kerrya@element.io>

* add helper

Signed-off-by: Kerry Archibald <kerrya@element.io>

* naming

Signed-off-by: Kerry Archibald <kerrya@element.io>
2022-02-21 16:57:44 +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
Renan Cleyson
b4b81a455e
Fix wrong indentation with nested ordered list unnesting list on edit (#7300) 2021-12-07 09:46:04 +00:00
Dariusz Niemczyk
e3187ed15c
Fix links being parsed as markdown links improperly (#7200)
* Fix links being parsed as markdown links improperly

Fixes #4674

* Fix a typo

* Fix overriding too much stuff

* Fix parsing

* Remove useless console.log

* Remove unnecessary emph function

* Properly fix tests

* Add some better docs

* Add missing license header
2021-11-30 18:09:05 +00:00
Michael Telatynski
316b21408d Fix tests 2021-07-15 10:59:52 +01:00
J. Ryan Stinnett
ae0a8b8da4 Auto-fix lint errors 2021-06-29 13:11:58 +01:00
Šimon Brandner
1fe2085309
Fix deserialize test
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2021-05-01 12:28:18 +02:00
Travis Ralston
375ffafda6 Fix tests failing to load skin
We should find a better way to do this, but this works well enough.
2021-03-09 10:13:16 -07: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
J. Ryan Stinnett
ce226ab534 Replace Riot with Element in docs and comments
This only covers the simple cases of references to issues and repos. More
complex areas, such as deployment scripts, will be handled separately.

Part of https://github.com/vector-im/element-web/issues/14864
2020-08-03 18:33:36 +01:00
Michael Telatynski
93b0287e11 s/semi-colon/colon/
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-07-24 00:04:50 +01:00
Michael Telatynski
8018a20680 create acceptance tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-07-21 17:40:34 +01:00
Justin Sleep
bdc451d66b Remove escape backslashes in non-Markdown messages 2020-06-03 17:08:13 -05:00
Michael Telatynski
9c1939b756 match all, not just first instance of tokens to escape
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-15 02:31:30 +01:00
Michael Telatynski
4454db30d6 Escape opening square bracket too
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-15 01:02:08 +01:00
Michael Telatynski
f1def8b0de delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-15 00:50:28 +01:00
Michael Telatynski
95eaf94cd8 Fix pills being broken by unescaped characters
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-15 00:40:38 +01:00
Bruno Windels
13b08b5fcc
Revert "Fix escaped markdown passing backslashes through" 2020-02-24 11:27:22 +00:00
BobVul
1df6837649 Missing semicolon 2020-02-04 10:38:43 +11:00
BobVul
fde30577e4 Fix escaped markdown passing backslashes through
Fixes https://github.com/vector-im/riot-web/issues/11230

Signed-off-by: Bob Rao <bob+git@vulpin.com>
2020-01-31 12:33:57 +11:00