Commit Graph

81 Commits

Author SHA1 Message Date
Hubert Chathi
df71502dbb allow width, height, alt, title attributes in img
fixes vector-im/riot-web#4646

Signed-off-by: Hubert Chathi <hubert@uhoreg.ca>
2017-07-25 10:43:40 -04:00
Luke Barnard
0df144cb62 Update unicodeToImage to maintain compatibility with emojione
We recently updated our version of emojione but this update included the addition of emoji represented in unicode with ZWJ (Zero-Width-Joiners). These ZWJs are not present in the asset file names, so any emoji with ZWJ in them were just not found (404 on the web client).

This updates `unicodeToImage` to be compatible with emojione 2.2.7 so that the correct filenames are used when converting from unicode to <img>.
2017-07-11 18:27:35 +01:00
Luke Barnard
dfa97e8452 Add comment 2017-07-10 17:48:01 +01:00
Luke Barnard
6877b99435 Strip <img src="https?://..">s when transforming imgs instead of using allowedSchemesByTag 2017-07-10 17:44:49 +01:00
Luke Barnard
bb9080425a Allow image tags with src attributes with schemes http[s]
And transform `mxc:*` URLs to `https?://`
2017-07-10 16:27:23 +01:00
Luke Barnard
96f5f92c7f Disallow data attribute, we don't need it currently 2017-07-10 15:44:46 +01:00
Luke Barnard
f9ee89b2f4 Merge branch 'develop' into matthew/whitelist-uri-schemes 2017-07-10 15:42:03 +01:00
Luke Barnard
32a01b54b8 Merge branch 'develop' into erikj/group_server 2017-07-07 10:08:49 +01:00
Luke Barnard
e7a2c3b975 Only send HTML when using RTE when necessary
When there are no styled blocks or inline styles applied within blocks, just send text instead of HTML.

Also, don't add <br /> for the last <p> (the last block).

Fixes https://github.com/vector-im/riot-web/issues/3147
2017-06-30 11:27:00 +01:00
Luke Barnard
9b24f70d00 Update comment 2017-06-28 14:29:53 +01:00
Luke Barnard
eeb1c33868 Do the less invasive fix of replacing <br>\n with \n but only within <pre> 2017-06-28 14:27:24 +01:00
Luke Barnard
f73fa4b49b Move processing into renamed function processHtmlforSending
And explain why this fix is necessary
2017-06-28 11:49:50 +01:00
Johannes Löthberg
661e6a6d01 HtmlUtils: Allow language- classes on code blocks through the sanitizer
This is required to be able to specify the highlight language in fenced
blocks like the following:

    ```python
    print("foo")
    ```

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2017-06-26 17:45:38 +02:00
David Baker
2efa099de2 Use function from HTMLUtils for sanitizing
Encapsulates things a little nicer
2017-06-23 17:02:54 +01:00
David Baker
71eb405859 Add comments & remove redundant check 2017-06-08 14:53:21 +01:00
David Baker
b40636a425 Merge pull request #1040 from ollieh/issues/1974
Added button that copies code to clipboard
2017-06-08 14:45:58 +01:00
Oliver Hunt
dd6171a39e Review changes
Signed-off-by: Oliver Hunt <oliver@hunt.bz>
2017-06-06 12:34:03 +01:00
Oliver Hunt
a640e943f7 Added button that copies code to clipboard
Signed-off-by: Oliver Hunt <oliver@hunt.bz>
2017-06-06 12:33:44 +01:00
saul.kredi@krutt.org
4afba2f796 Add support for RTL languages 2017-05-29 18:44:39 +03:00
Matthew Hodgson
c0cead1546 workaround for https://github.com/vector-im/riot-web/issues/3633.
unsure our vector url match could ever return undefined, but apparently it is...
2017-05-15 01:32:37 +01:00
turt2live
3bd77d56db Allow h1 and h2 tags again. CSS handled by riot-web
Signed-off-by: Travis Ralston <travpc@gmail.com>
2017-04-24 08:45:22 -06:00
turt2live
80b8be64d1 Transform h1 and h2 tags to h3 tags
Addresses vector-im/riot-web#1772

Signed-off-by: Travis Ralston <travpc@gmail.com>
2017-04-21 15:09:56 -06:00
Luke Barnard
9cd7914ea5 Finishing off the first iteration on login UI
This makes the following changes:
 - Improve CountryDropdown by allowing all countries to be displayed at once and using PNGs for performance (trading of quality - the pngs are scaled down from 32px to 25px)
 - "I want to sign in with" dropdown to select login method
 - MXID login field that suffixes HS domain (whether custom or matrix.org) and prefixes "@"
 - Email field which is secretly the same as the username field but with a different placeholder
 - No more login flickering when changing ServerConfig (!) fixes https://github.com/vector-im/riot-web/issues/1517

This implements most of the design in https://github.com/vector-im/riot-web/issues/3524 but neglects the phone number login:
![login_with_msisdn](https://cloud.githubusercontent.com/assets/1922197/24864469/30a921fc-1dfc-11e7-95d1-76f619da1402.png)

This will be updated in another PR to implement desired things:
 - Country code visible once a country has been selected (propbably but as a prefix to the phone number input box.
 - Use square flags
 - Move CountryDropdown above phone input and make it show the full country name when not expanded
 - Auto-select country based on IP
2017-04-21 11:37:08 +01:00
Luke Barnard
ec2a5cce74 Merge branch 'develop' into matthew/whitelist-uri-schemes 2017-04-13 14:08:19 +01:00
Matthew Hodgson
bb25bee8fa Merge pull request #787 from VShell/patch-3
Add <ol start="..."> to allowed attributes list
2017-04-02 12:49:01 +01:00
Shell Turner
3ff54b8e4b Add <ol start="..."> to allowed attributes list
Fixes vector-im/riot-web#3273

Signed-off-by: Shell Turner <cam.turn@gmail.com>
2017-04-02 11:19:50 +01:00
David Baker
878413f6a4 Support msisdn signin
Changes from https://github.com/matrix-org/matrix-react-sdk/pull/742
2017-03-14 11:50:13 +00:00
Richard van der Hoff
2786fb0f46 Revert "Support registration & login with phone number (#742)"
This reverts commit 0269562383.

This breaks against the current synapse release. We need to think more
carefully about backwards compatibility.
2017-03-09 18:32:44 +00:00
David Baker
0269562383 Support registration & login with phone number (#742)
* WIP msisdn sign in

* A mostly working country picker

* Fix bug where you'dbe logged out after registering

Stop the guest sync, otherwise it gets 401ed for using a guest
access token for a non-guest, causing us to beliebe we've been
logged out.

* Use InteractiveAuth component for registration

* Fix tests

* Remove old signup code

* Signup -> Login

Now that Signup contains no code whatsoever related to signing up,
rename it to Login. Get rid of the Signup class.

* Stray newline

* Fix more merge failing

* Get phone country & number to the right place

* More-or-less working msisdn auth component

* Send the bind_msisdn param on registration

* Refinements to country dropdown

Rendering the whole lot when the component was rendered just makes
the page load really slow, so just show 2 at a time and rely on
type-to-search.

Make type-to-search always display an exact iso2 match first

* Propagate initial inputs to the phone input

* Support msisdn login

* semicolon

* Fix PropTypes

* Oops, use the 1qst element of the array

Not the array of object keys which has no particular order

* Make dropdown/countrydropdown controlled

* Unused line

* Add note on DOM layout

* onOptionChange is required

* More docs

* Add missing propTypes

* Don't resume promise on error

* Use React.Children to manipulate children

* Make catch less weird

* Fix null dereference

Assuming [0] of an empty list == undefined doesn't work if you're
then taking a property of it.
2017-03-09 10:59:22 +00:00
Luke Barnard
fa2cf41039 Make COLOR_REGEX stricter 2017-03-03 15:46:13 +00:00
Luke Barnard
f4278b61ea Update comment 2017-03-02 18:13:01 +00:00
Luke Barnard
0f8ab99158 Have COLOR_REGEX constant 2017-03-02 17:02:00 +00:00
Luke Barnard
b951713f7f Remove custom attribs as consumed 2017-03-02 11:39:40 +00:00
Luke Barnard
36795fa192 Use data-mx[-bg]-color instead of stripping style
This has the benefit of not needing a spec for custom CSS. Instead we rigourously sanitise the values for custom data attributes that are transformed to CSS equivalents. `data-mx-color` translates to CSS `color` for example.
2017-03-02 11:36:56 +00:00
Luke Barnard
5fc828f24c Allow span, and only allow style attrib 2017-02-27 11:32:57 +00:00
Luke Barnard
886b0a3f13 Sanitise for *, fix style issues 2017-02-27 11:23:37 +00:00
Matthew Hodgson
2db53c2284 whitelist data & mxc URIs on img tags: readds PR #333 now that punkave/sanitize-html#137 has landed 2017-02-19 03:04:42 +02:00
Luke Barnard
ae03244e6e Merge branch 'develop' into luke/feature-css-msg-colors 2017-02-09 13:14:15 +00:00
Matthew Hodgson
231997dd63 unbreak /markdown off 2017-02-09 01:18:09 +00:00
David Baker
18d4d3392a Fix a bunch of linting errors
eslint --fix and a few manual ones
2017-01-20 14:22:27 +00:00
Luke Barnard
32185befc0 Only transform <font> 2017-01-11 16:41:05 +00:00
Luke Barnard
8e3f2eb858 Allow [bf]g colors for <font> style attrib
Instead of dropping the style attribute on `<font>` tags entirely, sanitise aggressively and only keep `background-color` and `color` keys, and also sanitise the values to prevent `url(XXXXXX)` and `expression(XXXXXX)` type XSS attacks.
2017-01-11 16:35:37 +00:00
David Baker
8cf273a460 Run highlight.js asynchronously
Move the very minimal logic of highlightDOM into TextualBody
because then we can avoid scheduling a lot of timeouts which
would ultimately do nothing (ie. any messages that don't have code
blocks).
2016-10-26 18:41:28 +01:00
David Baker
5fff3bdf24 Document brokenness 2016-09-21 16:25:18 +01:00
David Baker
8ae210cbe2 Revert #333
Revert https://github.com/matrix-org/matrix-react-sdk/pull/333/files since sanitizer blindly allows urls with no scheme, meaning  // links can be used to fetch images over whatever scheme you serve vector over (ie. normally http/https).
2016-09-21 16:19:41 +01:00
Aviral Dasgupta
6befb09509 Replace <p>s with <br/>s consistently
Also, allow newlines in /commands.
Fixes vector-im/vector-web#2114, vector-im/vector-web#2165.
2016-09-16 21:40:00 +05:30
Aviral Dasgupta
7c6b1703f3 fix emojione sizing 2016-08-28 14:54:07 +05:30
Matthew Hodgson
de82ac3bc0 don't change URL bar when clicking on linkified rooms or users.
be aware of /user paths.
2016-08-28 02:05:31 +01:00
Matthew Hodgson
ad873c2b60 handle matrix.to links correctly. add partial support for #/user URLs 2016-08-28 01:55:42 +01:00
Matthew Hodgson
5b0d13c1fc switch to namespaced CSS 2016-08-27 23:59:55 +01:00