Commit graph

3407 commits

Author SHA1 Message Date
David Baker
fa7a9818c6 Fix i19n on truncatedlist & friends to be sane
Use the proper counterpart tool for plurals rather than if > 1.
Fix up all the translation files respectively.
2017-07-25 15:59:06 +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
b372e5d55d Merge pull request #1246 from matrix-org/luke/feature-async-pills
Get user pill profile remote data and show unrecognised rooms as links
2017-07-25 10:21:55 +01:00
Luke Barnard
76e281662b Merge pull request #1229 from matrix-org/dbkr/groupview_edit
UI for editing groups
2017-07-25 10:13:49 +01:00
Luke Barnard
11f3a1db72 Merge branch 'luke/feature-async-pills' of github.com:matrix-org/matrix-react-sdk into luke/feature-async-pills 2017-07-25 09:37:47 +01:00
Luke Barnard
ac597996e0 Remove outdated comment 2017-07-25 09:37:18 +01:00
Luke Barnard
026582bcf7 Add unmounted guard 2017-07-25 09:22:08 +01:00
Luke Barnard
5efd5bf927 done -> then, style 2017-07-25 09:20:14 +01:00
Luke Barnard
d13c4b510c Merge branch 'develop' into luke/feature-async-pills 2017-07-24 17:39:35 +01:00
Luke Barnard
bcd1ab5cd4 Merge pull request #1245 from matrix-org/luke/feature-mentions-ambiguate
Remove disambiguation from user mentions, add tooltip for mxid
2017-07-24 17:36:42 +01:00
Luke Barnard
61c16569cb Get user pill profile remote data
Instead of relying on the local avatar/displayname of a user, request the data from the server and update the pill if it shows up.

This required a slight refactor which means we're not doing everything in `render` now. Also I noticed unknown rooms weren't being rendered _at all_! So now you get something that looks like a normal link but with the room alias/ID in it.
2017-07-24 17:18:29 +01:00
Luke Barnard
727b1ca545 Remove disambiguation from user mentions, add tooltip for mxid
Also add a tooltip for room pills = room alias/ID

Requires: https://github.com/matrix-org/matrix-js-sdk/pull/513
2017-07-24 15:08:22 +01:00
Luke Barnard
dc09ad8db4 Re-add NL 2017-07-24 14:50:44 +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
Michael Telatynski
8e66e64621
fix for loop - check happens before pre-inc so cause issues at end of TL
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-22 13:16:16 +01:00
Michael Telatynski
c9b547368b
add algo to ensure that RM always moves forwards
this is needed so that if a client which does not hide any events
sets and RM at bottom of timeline, then riot-web which hides events
sets the RM it'd set it at X-N where X is bottom and N is the amount of
hidden events at bottom of the timeline, this way now an RM will
fall through to the hidden events below a seen event.

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-22 13:10:57 +01:00
Michael Telatynski
a4abd1baa7
fix comment and remove unused const
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-22 12:03:32 +01:00
Michael Telatynski
ae973e1e99
unrevert some more...
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-22 11:37:21 +01:00
Michael Telatynski
7e355f7cda
unrevert most of the logic.
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-21 23:18:18 +01:00
Michael Telatynski
1fa4fe0b9a
remove comments/commented code
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-21 22:51:31 +01:00
Michael Telatynski
5808fce60e
fix logic ordering
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-21 22:45:19 +01:00
Michael Telatynski
17758cd1db
attempt to incorporate more code #2
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-21 20:43:03 +01:00
Michael Telatynski
e47e14ed19
attempt to incorporate more code #1
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-21 20:22:01 +01:00
Michael Telatynski
928294eba3
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into t3chguy/hide-join-part-2 2017-07-21 19:23:42 +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
eb0575d9c1 Merge pull request #1241 from matrix-org/luke/refactor-pills
Factor out shared logic in two code-paths for pill rendering
2017-07-21 17:54:20 +01:00
Luke Barnard
feaafc7a1a Remove logging 2017-07-21 17:18:48 +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
David Baker
f9cff50ef5 _loadGroupFromServer doesn't return a promise 2017-07-21 14:41:29 +01:00
David Baker
d48924e768 Lint 2017-07-21 14:30:09 +01:00
David Baker
be7228996a This should be null rather than false 2017-07-21 14:18:28 +01:00
David Baker
4eda2ab083 Swap classes instead of using 0 height elements 2017-07-21 14:13:57 +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
David Baker
3c44af11f7 Revert changes to ChangeAvatar
This component was basically adding nothing for group editing
2017-07-21 14:06:08 +01:00
David Baker
f2afd852d8 Make group editing work 2017-07-21 14:03:10 +01:00
Richard Lewis
b589fcc3b0 Merge pull request #1240 from matrix-org/rxl881/deleteWidgets
Hide widget panel while it is being deleted.
2017-07-21 11:14:42 +01:00
David Baker
571fada77e Make group profile editing mostly work
apart from avatars
2017-07-21 11:12:15 +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
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
Luke Barnard
26b16b076c Merge pull request #1238 from matrix-org/luke/fix-rte-md-mentions
Insert MD links when autocompleting in MD mode
2017-07-20 15:32:36 +01:00
Luke Barnard
e893f994e1 Default to first room alias and then roomID 2017-07-20 15:17:07 +01:00
Luke Barnard
84fe51a162 Insert MD links when autocompleting in MD mode
These will appear decorated because they are inserted as entities. It was necessary to modify pills to have an explicit linkText that is derived from the `href` being pillified (and is thus no longer the inserted completion but rather the display name (or user ID) or room alias.
2017-07-20 15:09:59 +01:00
Richard Lewis
563f5f7bac Merge pull request #1226 from matrix-org/rxl881/beta
Show beta testing icon and help message for widgets tile.
2017-07-20 14:04:53 +01:00
Luke Barnard
352f70f9ce Implement old composer feature that inserts ': ' or ' '
after a user completion
2017-07-20 11:52:18 +01:00
Richard van der Hoff
0e8ad75248 Merge pull request #1233 from matrix-org/rav/async_crypto
Prepare for asynchronous e2e APIs
2017-07-19 21:11:36 +01:00
Luke Barnard
2f293adad5 Fix userId undefined in pillifyLinks 2017-07-19 18:21:26 +01:00
Luke Barnard
ecaf6e5223 Merge pull request #1234 from matrix-org/luke/feature-mention-pill
Add mx_UserPill_me class to user pills that match credentials.userId
2017-07-19 17:56:24 +01:00
Luke Barnard
61d5d078dd Merge pull request #1235 from matrix-org/luke/fix-rte-inline-code-format
Mimic ctrl+j of RT mode in MD mode
2017-07-19 17:44:56 +01:00
Luke Barnard
5d1b33d2a8 Merge branch 'develop' into luke/feature-mention-pill 2017-07-19 17:22:03 +01:00
Luke Barnard
3a53fabb87 Merge pull request #1228 from matrix-org/luke/feature-auto-complete-matrixto-pills
Implement composer completion user/room pill insertion
2017-07-19 17:19:47 +01:00
Luke Barnard
29b6d70aff Merge branch 'develop' into luke/fix-rte-inline-code-format 2017-07-19 17:19:25 +01:00
Luke Barnard
d179398cf2 Merge pull request #1227 from matrix-org/luke/feature-matrixto-timeline-pills
Decorate matrix.to anchor tags as mx_UserPill and mx_RoomPill
2017-07-19 17:17:48 +01:00
Luke Barnard
28c98d93d1 Mimic ctrl+j of RT mode in MD mode
by inspecting whether multiple lines are selected or the selection is empty. If either of these are true, insert a code block surrounding the selection, otherwise insert single backticks around the selection for inline code formatting.
2017-07-19 16:13:47 +01:00
Luke Barnard
b131637a11 Add mx_UserPill_me class to user pills that match credentials.userId 2017-07-19 11:00:26 +01:00
Richard van der Hoff
4998d1b359 Prepare for asynchronous e2e APIs
the js-sdk is making some of its APIs asynchronous, and adding an `initCrypto`
method which you have to call.

Particular methods we need to worry about are:

* `getStoredDevice`
* `getStoredDevicesForUser`
* `getEventSenderDeviceInfo`
* `isEventSenderVerified`
2017-07-18 23:47:36 +01:00
Luke Barnard
98ca937fef Interpret backspace at start of style block as block style toggle
Part of fixing https://github.com/vector-im/riot-web/issues/4580
2017-07-18 17:52:04 +01:00
Luke Barnard
d207ee5244 Expand groups into variables with readable names 2017-07-17 19:31:36 +01:00
David Baker
859239f881 Lint / comment out line correctly 2017-07-17 18:13:20 +01:00
David Baker
7041106bf2 Merge remote-tracking branch 'origin/develop' into dbkr/groupview_edit 2017-07-17 17:23:02 +01:00
David Baker
6f65128928 Disable edit button again
until we have an API to edit group profile info
2017-07-17 17:18:46 +01:00
David Baker
1cd79fc918 Rename group settings to 'Edit Group' 2017-07-17 17:17:18 +01:00
Luke Barnard
29757fcf11 Merge branch 'luke/feature-matrixto-timeline-pills' into pills 2017-07-17 16:43:46 +01:00
Luke Barnard
897ff05d87 Implement composer completion user/room pill insertion
This modifies the composer completion such that completing a room or user will insert an IMMUTABLE matrix.to LINK Entity for the range that was replaced. Display names will not have a colon after their name anymore as it seemed strange that we would insert one after a pill.
2017-07-17 15:53:29 +01:00
Luke Barnard
b1e3dc406c Decorate matrix.to anchor tags as mx_UserPill and mx_RoomPill
Requires https://github.com/vector-im/riot-web/pull/4597 to look OK
2017-07-17 14:50:45 +01:00
David Baker
a32113ad97 Add onChange handlers & tabIndexes 2017-07-17 14:40:38 +01:00
Richard Lewis
6aa0f68ee9 Show beta testing icon and help message for widgets tile. 2017-07-14 23:31:57 +01:00
Luke Barnard
ee5117525c Merge pull request #1225 from matrix-org/luke/feature-rte-pills
Decorate http://matrix.to links in the composer as pills
2017-07-14 17:47:16 +01:00
David Baker
f6f80bf9ce Remove now unused 'edit' block
And add some css classes
2017-07-14 17:22:17 +01:00
Luke Barnard
434660166c Decorate http://matrix.to links in the composer as pills
Any links in the composer that are recognised as matrix.to links will be decorated as `<span>`s with CSS classes (one of mx_UserPill or mx_RoomPill). This implementation has the nice bonus that switching to markdown (and back) will Just Work.

This will have some CSS changes coming to better match the design.
2017-07-14 17:04:28 +01:00
Richard van der Hoff
2a52c902e2 Merge pull request #1223 from matrix-org/rav/roomsettings_promise_usage
Fix RoomSettings save
2017-07-14 14:47:14 +01:00
Richard van der Hoff
9df1fb91ff Fix RoomSettings save
Looks like saving RoomSettings had been broken since 0d7cc59. `isFulfilled`
cannot be used as a static function.
2017-07-14 14:24:42 +01:00
Kegsay
5274cf59a0 Hook up the edit widget button (#1218)
* Hook up the edit widget button

* Review comments
2017-07-14 11:17:59 +01:00
Luke Barnard
219c00bbc3 Add code-block to the list of blocks where hitting return will split-block
Hitting return in a code-block will now split the block into two code blocks. (Holding shift will still insert a soft newline into the current block).

We still need to make it a bit more obvious that consecutive code-blocks
are not contiguous - https://github.com/vector-im/riot-web/issues/4535
2017-07-13 18:42:37 +01:00
David Baker
381f685013 Start on editing groups 2017-07-13 18:41:51 +01:00
Luke Barnard
d97de4d576 Implement disabled-by-default setting for auto-replacement of plaintext emojis
FTR a list of plaintexts and their unicode equivalents can be found here - https://github.com/vector-im/riot-web/issues/4554#issuecomment-314374303

Pressing space after a matching emoji will replace the plaintext emoji with the equivalent unicode emoji.
2017-07-13 17:37:43 +01:00
Luke Barnard
7fc10789fc Merge pull request #1217 from matrix-org/luke/fix-rte-html-links
Improve RTE HTML link handling
2017-07-13 13:57:58 +01:00
Luke Barnard
f1a4209d6b Fix indentation 2017-07-13 13:47:08 +01:00
Luke Barnard
5826b6f22a Instead of sending HTML for any Entity, only send HTML for Links
Otherwise emoji messages are sent as HTML, needlessly
2017-07-13 13:41:17 +01:00
Luke Barnard
be045a6dc0 Interpret whitespace after entity as the end of the entity
The easiest way to stop the user from inserting whitespace onto the end of an entity is to toggle the entity state of the whitespace that was just entered. This allows the user to continue drafting a message without editing the link content.

This is for pasted `<a>` tags that have been copied from a website. We probably also want to be storing entities for substrings of content that are determined to be URLs.
2017-07-13 13:28:51 +01:00
Luke Barnard
4b96963408 Send HTML if there are any entities present in the composer
This is so that pasted HTML links that are represented as entities are sent as HTML.
2017-07-13 13:27:49 +01:00
Luke Barnard
55e1202c09 Decorate pasted links so that they look like links
By default, draftjs will represent pasted `<a>` tags as `LINK` entities, but it doesn't do any default decoration of these links. Add a decorator to do so.

Most of this was taken from https://github.com/facebook/draft-js/blob/v0.8.1/examples/link/link.html (note the version, v0.8.1).
2017-07-13 13:26:13 +01:00
David Baker
2a68cce3d5 Merge pull request #1216 from matrix-org/dbkr/history_save_unload_nullcheck
Prevent exception on page unload
2017-07-13 12:38:28 +01:00
Richard van der Hoff
086304532e Merge pull request #1213 from matrix-org/rav/bluebird
Switch matrix-react-sdk to bluebird
2017-07-13 12:06:11 +01:00
David Baker
917133219f Remove sentHistory save altogether 2017-07-13 11:53:22 +01:00
Luke Barnard
ce0f9e8803 Merge pull request #1214 from matrix-org/luke/fix-rte-remove-old-disable-md-setting
Remove `disableMarkdown` setting
2017-07-13 11:33:42 +01:00
Luke Barnard
4d844ebc34 Merge pull request #1215 from matrix-org/luke/remove-old-composer
Remove MessageComposerInputOld
2017-07-13 11:33:23 +01:00
David Baker
1e80edb43c Prevent exception on page unload
Null check when saving sent history
2017-07-13 11:30:25 +01:00
Luke Barnard
04dd98e6e9 Remove references to tabComplete, which are now redundant
(since the old composer has been removed)
2017-07-13 10:16:59 +01:00
Luke Barnard
0e12e384cb Remove TabComplete-related files 2017-07-13 10:16:42 +01:00
Richard Lewis
9a1e7ad170 Hide widget panel while it is being deleted. 2017-07-13 00:27:03 +01:00
Luke Barnard
4cc8b5621d Merge pull request #1212 from matrix-org/luke/fix-ctrl-k
Enable ctrl+k room filter focus
2017-07-12 18:20:45 +01:00
Richard van der Hoff
33f330d434 Manual fixup for remaining q incantaions
* don't try to use `finally` as a static method
* work around absence of `allSettled`
2017-07-12 18:05:40 +01:00
Richard van der Hoff
0d7cc59d99 replace q method calls with bluebird ones
```
find src test -name '*.js' |
    xargs perl -i -pe 's/q\.(all|defer|reject|delay|try|isFulfilled)\(/Promise.$1(/'
```
2017-07-12 18:05:40 +01:00
Richard van der Hoff
0254d2b3a2 q(...) -> Promise.resolve
```
find src test -name '*.js' | xargs perl -i -pe 's/\b[qQ]\(/Promise.resolve(/'
```
2017-07-12 18:05:08 +01:00