Commit graph

260 commits

Author SHA1 Message Date
Jorik Schellekens
5c9398a6b1 Types exiliary files 2020-05-25 16:47:57 +01:00
Michael Telatynski
fc828378fa Fix post-ts autocomplete, it is not null
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-22 13:18:54 +01:00
Michael Telatynski
598cf21684 discard propTypes.
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-21 18:01:23 +01:00
Michael Telatynski
bf891c85e8 Enable esModuleInterop and iterate PR
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-21 10:01:05 +01:00
Michael Telatynski
3b245ee678 add more type annotations
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-20 21:05:00 +01:00
Michael Telatynski
66d2a67142 deduplicate emojibase loading
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-20 19:17:58 +01:00
Michael Telatynski
5c57b9ab9b delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-20 19:04:55 +01:00
Michael Telatynski
fced4ea51e Convert autocomplete stuff to TypeScript
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-20 19:00:54 +01:00
Michael Telatynski
e114effcfa make code more readable as per pr suggestion
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-14 13:07:44 +01:00
Michael Telatynski
3a0e1aeeaf Sort emoji by shortcodes for autocomplete so that :-1 and :+1 first results are correct
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-04-11 18:09:28 +01:00
Michael Telatynski
8c2b910c03 rework SlashCommands to better expose aliases
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-03-30 13:59:08 +01:00
Bruno Windels
2b19648786 fix cp error and lint 2020-02-21 13:35:14 +01:00
Bruno Windels
8870da6c24 Add alt_aliases to room completion candidates
but don't match on name otherwise you see multiple entries per room
when searching for a room name

Also pass the roomId to the composer autocomplete, so
it's easier to we don't need to loop through all the rooms and
it's also easier accept room with local aliases as well in the future
2020-02-21 13:02:41 +01:00
Michael Telatynski
b84fd245b1 Fix room completion for invited rooms and upgraded rooms
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-01-30 18:03:45 +00:00
Michael Telatynski
c97de43f69 Remove unused fetch polyfills, querystring, require-json. Move glob to dev-dep
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-01-18 02:01:45 +00:00
Travis Ralston
fde32f13a5 [CONFLICT CHUNKS] Merge branch 'develop' into travis/sourcemaps-develop 2020-01-09 14:15:09 -07:00
Michael Telatynski
d31c863563 Remove all usages of slate in favour of CIDER
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-01-06 00:15:48 +00:00
Travis Ralston
f1ac3d2f64 Convert imports to ES6 from CommonJS
This is needed because `require()` means something different in webpack - it ends up importing the module as something we didn't expect (and is occasionally async)
2019-12-22 21:16:06 -07:00
Travis Ralston
042bd35d79 Fix MatrixClientPeg imports 2019-12-22 21:15:54 -07:00
Travis Ralston
d56f0f2a25 Convert many imports to handle ES6 exports
Reliant upon https://github.com/matrix-org/matrix-react-sdk/pull/3761
2019-12-22 21:04:42 -07:00
Michael Telatynski
a25bc94343 remove unused, commented line of code 2019-12-19 17:22:02 +00:00
Michael Telatynski
d35b01b63a Get rid of stripped-emoji.json in favour of an in-memory single truth source 2019-12-18 15:40:19 +00:00
Michael Telatynski
d4d51dc61f Rip out the remainder of Bluebird 2019-11-18 10:03:05 +00:00
Michael Telatynski
54dcaf1302 Replace bluebird specific promise things. Fix uses of sync promise code.
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2019-11-14 13:52:17 +00:00
Michael Telatynski
c882b7f332 Improve A11Y for Autocomplete Commands and DDG
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2019-10-14 10:37:10 +01:00
Travis Ralston
7d1a04cb12
Merge pull request #3500 from matrix-org/travis/permalinks
Support local permalinks for unfederated instances
2019-10-01 08:41:23 -06:00
Travis Ralston
fc66e69c02 Rename RoomPermalinkCreator -> Permalinks due to scope
The file handles more than just a RoomPermalinkCreator, so we should name it accordingly.
2019-09-30 20:39:58 -06:00
Travis Ralston
64aa6695f5 Move matrix-to.js to utils/permalinks/RoomPermalinkCreator
Just a little bit of refactoring to make the feature of custom prefixes a bit easier.
2019-09-30 12:16:46 -06:00
Michael Telatynski
f299f7e092 delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2019-09-30 14:32:42 +01:00
Michael Telatynski
f160a308b4 Make Autocomplete more accessible to screen reader users
Use ARIA to:
 + notate that the composer has an autocomplete
 + notate the open/closed state of the autocomplete
 + notate the name of the open autocomplete options
 + notate the ID of the highlighted autocomplete option
 + improve naming of emoji autocomplete options for screen readers

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2019-09-30 14:04:39 +01:00
Bruno Windels
228905bec2 insert command completion as command part (instead of plain)
this prevents the command being sent as plain text

this adds a `type` property to completions to decide which
parts should be inserted into the composer, hence deciding how
they will be rendered.
2019-09-23 14:39:19 +02:00
Matthew Hodgson
e3d3b155d6 remove errant debug 2019-05-20 10:08:34 +01:00
Matthew Hodgson
b0ec594c5a comment on the futility of stripped-emoji.json 2019-05-19 21:19:20 +01:00
Matthew Hodgson
81338306b0 fix lint 2019-05-19 21:00:14 +01:00
Matthew Hodgson
dbc6815abf make EmojiProvider and stripped-emoji.json work 2019-05-19 20:48:18 +01:00
Matthew Hodgson
497be91c4d combine regexps correctly 2019-05-19 17:53:36 +01:00
Matthew Hodgson
a8297a7698 fix build 2019-05-19 16:11:12 +01:00
Matthew Hodgson
dc72641264 replace emojione with twemoji. completely untested & debugged & unoptimised 2019-05-19 15:23:43 +01:00
Travis Ralston
85c8d4d0e5 Remove extra debug lines 2019-03-27 13:03:25 -06:00
Travis Ralston
340c24cfa7 Filter out upgraded rooms from autocomplete results
Fixes https://github.com/vector-im/riot-web/issues/9289

Theory is that this shouldn't happen in the first place (aliases should be transferred), but there's evidently some cases where this doesn't work, or gets state reset.
2019-03-26 15:13:20 -06:00
Travis Ralston
cb6f415a05 Be more positive with setting labels
Fixes https://github.com/vector-im/riot-web/issues/6435

This is done through an on-the-fly inverter for the settings. All the settings changed are boolean values, so this should be more than safe to just let happen throughout the SettingsStore. Typically a change like this would be done in the individual handlers (similar to how setting names are remapped to different properties or even different storage locations on the fly), however doing that for this many settings would be a huge nightmare and involve changing *all* the layers. By putting a global "invert this" flag on the setting, we can get away with doing the inversion as the last possible step during a read (or write).

To speed up calculations of the default values, we cache all the inverted values into a lookup table similar to how we represent the defaults already. Without this, the DefaultHandler would need to iterate the setting list and invert the values, slowing things down over time. We invert the value up front so we can keep the generic inversion logic without checking the level ahead of time. It is fully intended that a default value represents the new setting name, not the legacy name.

This commit also includes a debugger for settings because it was hard to visualize what the SettingsStore was doing during development. Some added information is included as it may be helpful for when someone has a problem with their settings and we need to debug it. Typically the debugger would be run in conjunction with `mxSendRageshake`: `mxSettingsStore.debugSetting('showJoinLeaves') && mxSendRageshake('Debugging showJoinLeaves setting')`.
2019-01-24 20:57:40 -07:00
David Baker
77efa0881e Gah, onjects 2019-01-11 14:09:29 +00:00
David Baker
fe4778b28b De-lint a few more files
& remove them from the ignored list
2019-01-11 13:54:11 +00:00
David Baker
8e4d8ccca7 Add spaces back to async arrow functions
As per https://github.com/matrix-org/matrix-js-sdk/pull/821

Requires https://github.com/matrix-org/matrix-js-sdk/pull/821
2019-01-09 18:10:35 +00:00
Aaron Raimist
49ce4ef117
eslint --fix src/
Signed-off-by: Aaron Raimist <aaron@raim.ist>
2018-10-26 22:50:38 -05:00
David Baker
9c8c84485a Fix user autocompleting
This rewrites quite a lot of QueryMatcher.
 * Remove FuzzyMatcher which was a whole file of commented out code
   that just deferred to QueryMatcher
 * Simplify & remove some cruft from QueryMatcher, eg. most of the
   KeyMap stuff was completely unused.
 * Don't rely on object iteration order, which fixes a bug where
   users whose display names were entirely numeric would always
   appear first...
 * Add options.funcs to QueryMatcher to allow for indexing by things
   other than keys on the objects
 * Use above to index users by username minus the leading '@'
 * Don't include the '@' in the query when autocomple is triggered
   by typing '@'.

Fixes https://github.com/vector-im/riot-web/issues/6782
2018-10-11 18:34:01 +01:00
David Baker
b267798010 Kill FuzzyMatcher
This has been commented out for ages. Just remove it and make things
use QueryMatcher directly rather than looking like they do fuzzy matching
but not.
2018-10-10 19:18:06 +01:00
Will Hunt
1e5101aa0c
The comment can go 2018-10-03 19:39:47 +01:00
Will Hunt
17915b5082
Merge branch 'develop' into hs/purge-irc-hack 2018-10-03 19:39:14 +01:00
Will Hunt
fe788486b7 Drop (IRC) suffix hacks 2018-10-03 19:34:06 +01:00
David Baker
a00c2b753a
Merge pull request #2085 from matrix-org/t3chguy/emoji_aliases
allow autocompleting Emoji by common aliases, e.g 👍 to 👍
2018-07-25 10:40:59 +01:00
Michael Telatynski
07f0713a56
allow autocompleting Emoji by common aliases, e.g 👍 to 👍
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-24 17:06:45 +01:00
Michael Telatynski
ef39327073
fix CommandMap typo
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-24 13:21:36 +01:00
Michael Telatynski
7c3873b449
fix @room pill href=undefined and @room parsing breaking subsequent pills
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-24 12:18:10 +01:00
David Baker
3c895e5a0d
Merge pull request #2074 from matrix-org/t3chguy/hide_ddg_me_after_space
hide some commands after space as they have special semantics
2018-07-19 13:51:05 +01:00
Michael Telatynski
5867fe73dd
hide some commands after space as they have special semantics
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-18 15:38:21 +01:00
Michael Telatynski
5b79e3bcd5
fix user autocomplete not adding : if at the start
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-17 11:56:24 +01:00
Michael Telatynski
8bcb987f50
delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-09 20:14:37 +01:00
Matthew Hodgson
021409aafe
apply review feedback from @lukebarnard1
(cherry picked from commit 37d4bce)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-09 19:54:57 +01:00
Matthew Hodgson
efdc5430d7 merge develop 2018-07-09 17:50:07 +01:00
David Baker
7ef4377e57
Merge pull request #2007 from matrix-org/t3chguy/accent_insensitive_userprovider
accent insensitive autocomplete
2018-06-25 12:13:20 +01:00
Michael Telatynski
f21f7eff45
add word boundary to Community,Room,User provider regexps
to stop the autocompleter firing mid-word
and remove any unused capture groups

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-25 09:32:51 +01:00
Michael Telatynski
6a84a7ab32
apply stripDiacritics to QueryMatcher instead of individually
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-23 02:22:07 +01:00
Michael Telatynski
7cdc91856b
retain pre-stripped text so it can be used for rendering
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-23 02:12:01 +01:00
Michael Telatynski
54bccd2016
make Accent Insensitive match more generic and apply to rooms too
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-23 02:10:31 +01:00
Michael Telatynski
104e8d9cba
delint and add flow annotations to make my editor happy
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-23 02:00:36 +01:00
Michael Telatynski
ce04c745e5
strip diacritics for user autocomplete
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-23 01:56:24 +01:00
Michael Telatynski
9ee78de7e5
pr iteration, don't assume js-sdk stores group stuff other than groupId
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-22 12:05:46 +01:00
Michael Telatynski
561b9699fc
Merge branch 'develop' into t3chguy/community_autocomplete 2018-06-22 12:00:34 +01:00
Michael Telatynski
884fa3b913
use existing command hashmap over linear array search
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-20 17:25:23 +01:00
Michael Telatynski
7d9d17145c
change so that if someone enters invalid command with args we strict match
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-20 17:21:06 +01:00
Michael Telatynski
287745f8c6
delint, remove unused imports and fix flow annotations
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-19 12:06:13 +01:00
Michael Telatynski
b79cd205a0
Support autocompleting Communities
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-19 11:52:48 +01:00
Michael Telatynski
9de6bf4f5a
once command has a space, strict match instead of fuzzy match
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

(cherry picked from commit a852033)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-18 19:36:11 +01:00
Michael Telatynski
107802fa29
simplify arrow func
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-18 19:34:46 +01:00
Michael Telatynski
85ddc0651b
consolidate the two locations commands are defined, as it was a MESS
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-18 19:34:40 +01:00
Michael Telatynski
a50f6094cc
allow / + wait to also show all commands
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-16 16:44:13 +01:00
Michael Telatynski
f152ad84b8
Improve CommandProvider for Autocomplete
improve Regexp so it leaves autocomplete up whilst typing arguments
improve completion so it doesn't discard your arguments on-hover
add a way to list all commands by using `/<TAB>`

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-06-16 16:40:44 +01:00
Matthew Hodgson
4439a04689 fix lint 2018-05-20 23:43:42 +01:00
Matthew Hodgson
9aba046f21 fix MD pill serialization 2018-05-20 14:32:20 +01:00
Matthew Hodgson
c3a6a41e5d support links in RTE 2018-05-20 00:49:29 +01:00
Matthew Hodgson
c1000a7cd5 emojioneify the composer
and also fix up the selectedness CSS for pills and emoji
2018-05-14 03:02:12 +01:00
Matthew Hodgson
e06763cd59 show all slashcommands on / 2018-05-13 03:18:41 +01:00
Matthew Hodgson
c967ecc4e5 autocomplete polishing
* suppress autocomplete when navigating through history
* only search for slashcommands if in the first block of the editor
* handle suffix returns from providers correctly
* fix SelectionRange typing in the providers
* fix bugs when pressing ctrl-a, typing and then tab to complete a replacement by collapsing selection to anchor when inserting a completion in the editor
* fix https://github.com/vector-im/riot-web/issues/4762
2018-05-13 03:04:40 +01:00
Matthew Hodgson
c91dcffe82 fix cursor behaviour around pills 2018-05-13 00:40:54 +01:00
Matthew Hodgson
9c0c806af4 correctly send pills in messages 2018-05-12 20:04:58 +01:00
Luke Barnard
a3c407992b Don't autocomplete users for single "@" 2018-04-24 13:59:18 +01:00
David Baker
8342f441df
Merge pull request #1778 from matrix-org/t3chguy/devtools_autocomplete
Add /devtools to Autocomplete and run gen-i18n
2018-03-22 09:54:26 +00:00
Michael Telatynski
9df5638c8e
make linter happy - add missing trailing comma
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-03-21 11:00:07 +00:00
David Baker
7ac583bc96
Merge pull request #1800 from ma1uta/develop
Enable autocompletion for non-English languages.
2018-03-20 10:39:20 +00:00
Matthew Hodgson
b68da579f0 don't crash on missing room members 2018-03-16 01:21:52 +00:00
Anatoliy Sablin
953a520f38 Enable autocompletion for non-English languages. 2018-03-14 00:33:19 +03:00
Michael Telatynski
03676a68ac
Add /devtools to Autocomplete and run gen-i18n
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-02-28 00:57:14 +00:00
Luke Barnard
c5da1015fe Do not truncate autocompleted users in composer
so that disambiguation is possible at a glance.

Fixes https://github.com/vector-im/riot-web/issues/6024
2018-02-08 17:47:36 +00:00
Michael Telatynski
1bc9d344ae
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into t3chguy/nvl/rich_quoting
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

# Conflicts:
#	src/components/views/messages/TextualBody.js
2018-01-10 11:54:58 +00:00
Aidan Gauland
35780f5ae0 Remove use of deprecated React.PropTypes
Replace all uses of React.PropTypes with PropTypes and importing PropTypes from
'prop-types'.
2017-12-26 14:03:18 +13:00
Michael Telatynski
5c229b9ef8
DRY matrix.to link generation so it is all changeable in one class
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-12-12 23:33:40 +00:00
David Baker
c23a3fd7fe Add some null checks 2017-12-05 11:14:55 +00:00
Luke Barnard
dad797d4a2 Run linting --fix 2017-11-16 13:19:36 +00:00
Travis Ralston
289b0c2b6a
Merge branch 'develop' into travis/granular-settings 2017-11-07 14:55:12 -07:00