Commit Graph

192 Commits

Author SHA1 Message Date
Luke Barnard
d3f9a3aeb5 Run eslint --fix
Fixing 1000s of lint issues. Some rules cannot be `--fix`ed but this goes some way to linting the entire codebase.
2017-10-11 17:56:17 +01:00
Stefan Parviainen
d4929b558e Add dummy translation function to mark translatable strings
Signed-off-by: Stefan Parviainen <pafcu@iki.fi>
2017-09-22 21:43:27 +02:00
Luke Barnard
8ed5422a45 Fix click to insert completion
And remedy weird API in the process. Autocomplete now exposes `onSelectionChange` to indicate that the user has selected another completion, rather than returning the chosen completion via onUpArrow etc.

Fixes vector-im/riot-web#4835
2017-08-23 16:22:14 +01:00
Luke Barnard
6b1b643d41 Merge branch 'develop' into luke/store-history-as-raw-content 2017-08-14 16:42:22 +01:00
Luke Barnard
9742962d61 preventDefault when moving autocomplete selection with vertical arrow
Otherwise the composer selection updates, in turn hiding the autocomplete box - fixes vector-im/riot-web#4790
2017-08-14 15:16:13 +01:00
Michael Telatynski
41843f021d
don't track two more potential risks
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-08-10 15:21:01 +01:00
Michael Telatynski
b19c1010aa
Merge branches 'develop' and 't3chguy/i18n_analytics' of github.com:matrix-org/matrix-react-sdk into t3chguy/i18n_analytics
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

# Conflicts:
#	src/Analytics.js
2017-08-10 13:54:55 +01:00
Michael Telatynski
24599ace32
don't track error messages
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-08-10 13:49:11 +01:00
Luke Barnard
b2fd4be166 Merge pull request #1289 from matrix-org/luke/fix-quote-innerText
Quote by taking the innerText of eventTiles
2017-08-10 10:35:49 +01:00
Luke Barnard
678c472b75 Quote by taking the innerText of eventTiles
because using `body` gives inconsistent results - sometimes it will contain markdown and sometimes not, and this may not correspond with the `formatted_body`.

TODO: Do quoting proper - using `in_response_to`.
2017-08-10 10:14:14 +01:00
Luke Barnard
390e77ee22 Merge pull request #1288 from matrix-org/luke/track-richtext-mode
Track whether the user has richtext mode enabled
2017-08-10 09:31:09 +01:00
Luke Barnard
fc6977e68d Track RT mode once we've retrieved the setting from account data 2017-08-09 19:00:38 +01:00
Luke Barnard
e121440d05 Track whether the user has richtext mode enabled 2017-08-09 18:39:06 +01:00
Luke Barnard
2d47d3d2c3 Hide autocomplete when RTE selection state (cursor) changes 2017-08-09 17:36:35 +01:00
Luke Barnard
610b2a3a42 For mentions, always use rawDisplayName and remove (IRC) 2017-08-09 10:40:06 +01:00
Luke Barnard
503fa6a7b3 Always use message body when quoting
(not formatted_body)

This is because draft-js has regressed with a bug that causes some entities to not exist within a given ContentState - see vector-im/riot-web#4756
2017-08-08 14:59:56 +01:00
David Baker
ca2273519d Merge pull request #1277 from matrix-org/luke/feature-pills-hide-avatar-setting
Add optional setting for hiding avatars in <Pill>s
2017-08-08 14:01:34 +01:00
Luke Barnard
91a1cc4431 Mandate ctrl/meta ONLY for a subset of key bindings
Because by default dratf-js doesn't check that other modifiers are _not_ pressed.
2017-08-08 13:36:43 +01:00
Luke Barnard
b08d32371d Add optional setting for hiding avatars in <Pill>s
As part of https://github.com/vector-im/riot-web/issues/4640#issuecomment-316659445
2017-08-08 11:13:29 +01:00
Luke Barnard
7018deee44 Fix ctrl+a, backspace toggling block format
Now it will delete the selected range (and not toggle the block format). Fixes vector-im/riot-web#4753
2017-08-07 17:16:42 +01:00
Luke Barnard
641fda0162 Adjust comment 2017-08-07 16:29:22 +01:00
Luke Barnard
d9d8f2055f Allow default for ctrl+shift+b, ctrl+shift+u in RTE
fixes vector-im/riot-web#4750
2017-08-07 16:23:37 +01:00
Luke Barnard
a27eefd893 Fix a couple of more errors due to API changes 2017-08-03 15:20:44 +01:00
Luke Barnard
901cbf495d Update decorator strategy API in accordance with recent changes to 0.11.0
See 590cdc6c54, which is a change to the API not mentioned in the migration to v0.10 notes https://draftjs.org/docs/v0-10-api-migration.html
2017-08-03 12:02:29 +01:00
Luke Barnard
1d1cd5f691 Reflect API change for decorator strategy 2017-08-03 11:36:07 +01:00
Luke Barnard
fb5dc295aa Reflect API change for getting an Entity 2017-08-03 11:29:26 +01:00
Luke Barnard
124795006c Reflect API change for creating an Entity 2017-08-03 11:18:56 +01:00
Luke Barnard
7fcb8c5ff0 Merge pull request #1261 from matrix-org/luke/fix-agressive-emoji-auto-replace
Only auto-replace emoji following ^ or \s
2017-08-01 15:56:42 +01:00
Luke Barnard
438b63bee2 Only auto-replace emoji following ^ or \s
So as not to cause issues when typing e.g. `This is what was tested: ` (the "d:" used to be transformed into an emoji)
2017-08-01 14:26:30 +01:00
Michael Telatynski
4bdaa15c47
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into t3chguy/i18n_analytics 2017-07-28 21:01:59 +01:00
Luke Barnard
8a5f2bf2ca Interpret a split-block as format toggle for an empty block
(`split-block` is emitted when "return" is pressed)

part of fixing https://github.com/vector-im/riot-web/issues/4580
2017-07-28 14:46:57 +01:00
Luke Barnard
6cb8b12cda Instead of inserting MD for completion, convert the Entity later
This makes sure that the length of the range for a completed Entity = the length of the text in the decoration, which apparently draftjs assumes when calculating selection state offsets.

Fixes https://github.com/vector-im/riot-web/issues/4666
2017-07-27 18:17:41 +01:00
Michael Telatynski
bf98c0da7c
un-i18n Modal Analytics
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-27 17:19:18 +01:00
Luke Barnard
5c7891a25b Remove logs 2017-07-27 15:26:36 +01:00
Luke Barnard
e71df44fc9 Fix /join #alias command in markdown mode
Tab-completing a room alias inserts a markdown link, which is now stripped before a command is parsed. We also strip the MD links when doing the autocompletion itself (getAutocompleteQuery).

There is still an issue where `/invite` will not work at all with tab-completion - the text of a user Pill is not the userID but rather the display name, which cannot be used as an argument to the command.
2017-07-27 15:18:06 +01:00
Luke Barnard
fc00eaf546 Merge branch 'develop' into luke/store-history-as-raw-content 2017-07-25 17:19:35 +01:00
Luke Barnard
7e0fecbc8c Scroll to the bottom of editor if on last line
Make the MessageComposerInput scroll to the bottom if we are on the last line of the contents.

fixes https://github.com/vector-im/riot-web/issues/4652
2017-07-25 15:22:10 +01:00
Luke Barnard
eccdceae33 Rename props to entityProps for clarity 2017-07-25 11:43:12 +01:00
Luke Barnard
143994e44f Use data-offset-key in RTE decorators
This makes sure the selection state is correct when moving the cursor through an entity in the composer but only in rich text mode. https://github.com/vector-im/riot-web/issues/4666 still persists despite this, probably because the text content inserted during a completion in markdown mode has a different length to the text node within the entity.

fixes vector-im/riot-web#4654
2017-07-25 11:25:33 +01:00
Luke Barnard
6945fa54ea Reimplement so that only tab-completed mentions are stripped
Instead of blindly stripping all MD mentions, only strip those that were tab-completed. We do this by adding the `isCompleted` flag to the Entity data.
2017-07-24 14:41:13 +01:00
Luke Barnard
397201a74d Remove subjective comment 2017-07-24 09:41:46 +01:00
Luke Barnard
e315b30f6a Merge branch 'develop' into luke/fix-rte-pt-md-mentions 2017-07-21 18:06:31 +01:00
Luke Barnard
e8495f637f Strip MD mentions from the body of sent messages
Because previously we just sent the display name and MD links are not very readable.
2017-07-21 16:38:31 +01:00
Luke Barnard
7db7192701 Factor out shared logic in two code-paths for pill rendering
This isn't an entirely side-effect-free refactoring:
 - the text of the timeline pills is now either the room ID/alias or user ID/ display name of the linked resource (which means that until we do a roundtrip to get user displaynames, mentions for users not in the current room will have their user IDs shown instead of what was in the link body).
 - timeline links to rooms without avatars are now rendered as links
 - fixed issue that would throw an error whilst rendering (i.e. unusable client) a room link to a room that the client doesn't know about
2017-07-21 14:07:48 +01:00
Luke Barnard
bac22cfb7c Re-add removal of (IRC) suffix 2017-07-20 18:04:12 +01:00
Luke Barnard
08cc0c421d insert_displayname -> insert_mention 2017-07-20 18:02:54 +01:00
Luke Barnard
0cc890c020 WIP store history as raw content state
Not sure this solves any problems because we still have to convert from md and back
2017-07-20 18:01:39 +01:00
Luke Barnard
0600c5b049 Pretend that insert_displayname is a completion on that user
This has the advantage of us not reimplementing things and fixing the same bugs twice.
2017-07-20 16:46:53 +01:00
Luke Barnard
4bee9bd8c7 Merge branch 'develop' into luke/feature-rte-insert-pills-on-click-tl-profile 2017-07-20 15:48:38 +01:00
Luke Barnard
0419eff230 Insert pill onClick of timeline profile
When clicking someone in the timeline, insert a user pill instead of the plaintext "displayname:"
2017-07-20 15:46:36 +01:00