Commit graph

4535 commits

Author SHA1 Message Date
Luke Barnard
b315ed630e Match by emoji ascii regex first before shorthand
Plaintext emojis that start with ":" will also match against the shorthand regex but the match won't include the important part of the plaintext emoji. This means some emoji like ":)" won't be matched.

To fix this, put the ascii emoji regex first so that the match will be plaintext or otherwise it will fall through to the shorthand match (if there is one).

Fixes https://github.com/vector-im/riot-web/issues/4467
2017-06-30 16:31:40 +01:00
Luke Barnard
0b46184a21 Merge pull request #1166 from matrix-org/luke/fix-rte-wrong-history-format
Always store sent MD messages as MD in history
2017-06-30 16:05:45 +01:00
Luke Barnard
6bc40a112c Always store sent MD messages as MD in history
Because converting them to HTML when they got sent as HTML seems a bit pointless when they're just going to get transformed back again when retrieved from history.

Fixes regression https://github.com/vector-im/riot-web/issues/4465
2017-06-30 15:47:48 +01:00
Kegsay
11309f34e3 Reference count calls to start/stopListening on ScalarMessaging (#1164)
Otherwise component mounting/unmounting can race and you end up with nothing
listening.
2017-06-30 15:42:51 +01:00
Kegan Dougal
b8941f76d3 Fix bug which breaks the close button on scalar 2017-06-30 15:42:36 +01:00
Luke Barnard
15cfe5b8e4 Only allow history selection when on the first or last line
(of a multi-line or otherwise message in the editor)
2017-06-30 14:27:26 +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
8b8260c509 Move cursor to end of editor when quoting
When quoting a message, move the selection to the end of the input box. Fixes https://github.com/vector-im/riot-web/issues/2336
2017-06-29 17:22:34 +01:00
Luke Barnard
e5e7dec131 Fix #4422 by persisting the "currently composed" message
This allows for browsing through history without losing the message currently being composed.
2017-06-29 17:02:19 +01:00
Luke Barnard
6bd7284161 Be sensible about handling up/down vs tab/tab-shift
Fixes https://github.com/vector-im/riot-web/issues/4445
2017-06-29 15:07:06 +01:00
Luke Barnard
982b009b90 Implement ascii emoji tab completion
When a fully plaintext, ascii emoji is typed like ";-)", pressing tab will suggest emojione to replace it with based off of the meta data provided by emojione.

e.g. the aliases_ascii for `😃` are [":D",":-D","=D"] so typing ":D *tab*" will insert a real 😃
2017-06-29 11:29:55 +01:00
Luke Barnard
8912400675 Add XXX for https://github.com/vector-im/riot-web/issues/4445 2017-06-28 18:05:39 +01:00
Luke Barnard
a3e02f470f Merge pull request #1156 from matrix-org/luke/fix-rte-debounce
Do debouncing for autocomplete in a sane way
2017-06-28 18:03:36 +01:00
Luke Barnard
de81188b13 Do debouncing for autocomplete in a sane way
- Fixes https://github.com/vector-im/riot-web/issues/4419
 - Fixes https://github.com/matrix-org/matrix-react-sdk/pull/518#issuecomment-285901871
 - Fixes https://github.com/matrix-org/matrix-react-sdk/pull/518#issuecomment-285910503
 - Fixes bug where the setting being used was the `autocompleteDelay` "syncedSetting" when it should have been the "localSetting" (so the setting being used was always the default)
2017-06-28 17:27:21 +01:00
Luke Barnard
d5585e29b1 Merge pull request #1155 from matrix-org/luke/fix-rte-cursor-at-start-of-history
Fix issue where the cursor is put at the start of selected history item
2017-06-28 17:17:56 +01:00
Richard Lewis
d61525e420 Merge pull request #1152 from matrix-org/rxl881/apps
Add support for apps
2017-06-28 16:06:20 +01:00
Richard Lewis
ea83d7eee2 Add missing import and fix apps reference. 2017-06-28 15:53:18 +01:00
Luke Barnard
d696373bc2 Fix issue where the cursor is put at the start of selected history item
Leading to strange behaviour when selecting all and deleting it.

Fixes https://github.com/vector-im/riot-web/issues/4450
2017-06-28 15:29:07 +01:00
Luke Barnard
bcb67bb273 Refactor shared code between onUpArrow and onDownArrow 2017-06-28 15:20:16 +01:00
Luke Barnard
b3eee0c007 Merge pull request #1153 from matrix-org/luke/fix-rte-pre-extra-nls
Work around draft-js-export-html#62 by post-processing <br>\n
2017-06-28 15:13:39 +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
Richard Lewis
3a10cda2ca Add translations. 2017-06-28 13:55:18 +01:00
Richard Lewis
f8c064ec25 REmove redundant call to _getApps 2017-06-28 13:45:29 +01:00
Luke Barnard
30f80b57f2 Instead of making this part of the build process, let the devs generate stripped-emoji.json
With the expectation that when the file needs to be regenerated to include other keys, the developer will run this script.
2017-06-28 13:28:48 +01:00
Richard Lewis
e70eca0b0c Comment unused code and add TODO to handle scalar errors. 2017-06-28 12:58:09 +01:00
Richard Lewis
d06d066050 Move getInitialState to top of file. 2017-06-28 12:54:47 +01:00
Richard Lewis
e752cc8557 Use 'this' in preference to local reference. 2017-06-28 12:32:38 +01:00
Richard Lewis
481a66ef3c Fix header. 2017-06-28 12:26:05 +01:00
Richard Lewis
93bdfc99df i18n "Cancel" alt text. 2017-06-28 12:25:36 +01:00
Richard Lewis
ddea1f35d2 Fix header. 2017-06-28 12:23:33 +01:00
Richard Lewis
ff1636aaf5 Simplify boolean assignment. 2017-06-28 12:21:05 +01:00
Richard Lewis
06dafdc099 Remove unused state variable. 2017-06-28 12:20:07 +01:00
Richard Lewis
bf2a4afce5 Change to allow setting of DEBUG at run-time. 2017-06-28 12:02:07 +01:00
Richard Lewis
2b1d15717a Add translation for Matrix Apps labs setting. 2017-06-28 12:00:22 +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
Luke Barnard
2b8da85726 Strip the emoji meta-data for the data we need
This is done at build time by parsing emojione/emoji.json, stripping it and then writing to ./lib/stripped-emoji.json.
2017-06-28 11:36:19 +01:00
Luke Barnard
8ca3b382ed Use emojione/emoji.json because we don't want two sets of emoji meta 2017-06-28 11:19:16 +01:00
Luke Barnard
f4db765239 Fix indentation 2017-06-28 10:32:46 +01:00
Luke Barnard
907aaebe2f Remove redundant emoji data file 2017-06-28 10:31:59 +01:00
Luke Barnard
1523d304f2 WIP to prevent RTE from deleting current message input when up arrow pressed 2017-06-28 10:30:59 +01:00
Richard Lewis
ad2517bd8b Uppercase the first letter of the app tile name. 2017-06-28 10:27:06 +01:00
Luke Barnard
9d339b96bd Order emojis by standard ordering, add alternate shortnames
Also, increase the maximum number of emoji shown to 20.
2017-06-27 20:13:48 +01:00
Luke Barnard
69589c19e7 Work around draft-js-export-html#62 by post-processing <br>\n
Fixes https://github.com/vector-im/riot-web/issues/4446 by post-processing the output HTML from draft-js-export-html by replacing `<br>\n` with `<br>`. This works for content within or outside of `<pre>`. If we replace with `\n` instead, the newlines only apply in `<pre>` tags so we use `<br>`.
2017-06-27 18:33:45 +01:00
Richard Lewis
3872f0750c Only show apps button if labs feature enabled. 2017-06-27 17:40:28 +01:00
Richard Lewis
338a4db87f Only show apps drawer if matrix apps labs setting ids enabled 2017-06-27 17:40:09 +01:00
Richard Lewis
8dfd047f03 Don't show widgets when editing room settings and lint fixes. 2017-06-27 17:39:29 +01:00
Richard Lewis
7a7687699b Add matrix apps to Labs settings 2017-06-27 17:38:33 +01:00
Luke Barnard
5307731dfd Overide default draft-js handling of pasting text/html
This is surprisingly needed to avoid an issue with draft-js that causes multi-line madness when pasting code and then applying format-as-code to it - https://github.com/vector-im/riot-web/issues/2120#issuecomment-271735729.

The issue sounds like it is https://github.com/facebook/draft-js/issues/170#issuecomment-195026203 and the suggstion is to override the text pasting handler https://github.com/facebook/draft-js/issues/170#issuecomment-215983216. Meanwhile they haven't modified the default pasting behaviour afaics.

I've discovered a separate issue that is apparent even after this suggested fix. (https://github.com/vector-im/riot-web/issues/4446)
2017-06-27 17:10:28 +01:00
Luke Barnard
4645ba1bba Merge pull request #1150 from matrix-org/luke/fix-rte-dev-tools-toggle
Allow toggling of dev tools when RTE focussed
2017-06-27 15:38:19 +01:00