Bruno Windels
4329d8c4ef
Merge pull request #3372 from matrix-org/bwindels/fix-command-tab-complete
...
New composer: fix tab-complete in commands
2019-09-02 11:38:13 +00:00
Bruno Windels
00d81eece9
don't accept @/#/: as part of command, allow to create pill candidate
...
so if you type these 3 characters, you get the correct autocomplete
2019-09-02 11:26:20 +02:00
Bruno Windels
a4376a76f0
only pass keyboard to autocomplete when it has selections
...
otherwise if tab is pressed, try to tab complete the last word
2019-09-02 11:25:29 +02:00
Bruno Windels
63be16beff
Merge pull request #3366 from matrix-org/bwindels/cider-user-pill-text-fallback
...
New composer: put display name in user pill text fallback instead of mxid
2019-08-30 16:03:28 +00:00
Bruno Windels
ec0d048cf0
Merge pull request #3361 from matrix-org/bwindels/autocomplete-colon
...
New composer: append colon to completed user pill when at start of message
2019-08-30 16:02:58 +00:00
Bruno Windels
b16f983a1f
put display name in user pill text fallback instead of mxid
2019-08-30 11:51:29 +02:00
Bruno Windels
c9572250be
only append colon to user-pill when at start of composer
...
by passing position to autocomplete, so completion
can depend on where the pill-candidate appears.
2019-08-29 17:47:14 +02:00
Bruno Windels
2ff2ff0e75
support autocomplete replacing text with multiple parts
...
and append ": " to user pills
2019-08-29 17:43:18 +02:00
Bruno Windels
80523f5dbe
still convert \n to NewlinePart when pasting/dropping
...
before we skipped the complete validation (which creates NewlineParts)
when pasting or dropping text. We don't want to create PillCandidatePart
when inserting text like this, as it would open the auto-complete, but
newlines should still be applied. So instead of skipping validation,
pass the inputType to the validation code so they can only reject
pill candidate characters when not pasting.
2019-08-29 13:00:31 +02:00
Bruno Windels
e531b29307
don't ignore BR elements when converting to editor dom to text
2019-08-29 13:00:31 +02:00
Bruno Windels
85efb71a23
add visual bell when no replacements are available
...
also add try/catch in _tabCompleteName so errors don't get swallowed
2019-08-28 15:53:16 +02:00
Bruno Windels
c44fbb73d0
fix bug when replacing range starting at end of previous part
2019-08-28 15:52:39 +02:00
Bruno Windels
d8bb9ecedf
bring insert method inline with transform callback, add docs
...
before the insertPartsAt method would call the update callback
on its own, but now we have the concept of a transformation session,
so lets bring the API in line
2019-08-27 16:43:05 +02:00
Bruno Windels
8e66d382de
don't crash on race with room members and initial composer render
...
not ideal, but for now this prevents a crash at startup
when a user-pill is persisted in local storage
2019-08-27 16:43:05 +02:00
Bruno Windels
e0ec827a64
extra docs
2019-08-27 16:43:05 +02:00
Bruno Windels
68c2bb7ca6
introduce transform
method so update can be called with a position
...
and also for multiple transformations at once. This removes
the need to call the update callback from `replaceRange()` as well
2019-08-27 16:43:05 +02:00
Bruno Windels
f76a23d5dd
return promise from updating autocomplete
...
so one can await if needed
2019-08-27 16:43:05 +02:00
Bruno Windels
0f6465a1db
don't close autocomplete when hitting tab
...
that's not what the slate impl does and it's not an improvement
2019-08-27 16:43:05 +02:00
Bruno Windels
713205e0ab
close autocomplete when removing auto-completed part
2019-08-27 16:43:05 +02:00
Bruno Windels
f10e1d7654
fix jsdoc comments
2019-08-27 09:54:13 +02:00
Bruno Windels
5c28b57681
always recalculate position after doing transform step
...
as the amount of characters might not have changed,
parts may still have been merged, removed or added which
requires a new position.
2019-08-27 09:49:22 +02:00
Bruno Windels
4fd4ad41c1
improve editor model documentation
2019-08-26 16:16:27 +02:00
Bruno Windels
f8f0e77bde
add transform step during editor model update
2019-08-26 16:16:27 +02:00
Bruno Windels
0e65f71a37
support incrementing/decrementing doc positions with predicate
2019-08-26 16:16:27 +02:00
Bruno Windels
10291bafe0
add support for selecting ranges in the editor model, and replacing them
...
this to support finding emoticons and replacing them with an emoji
2019-08-26 16:16:27 +02:00
Bruno Windels
5cebce9bbf
fix bug detected by tests
2019-08-22 14:41:40 +01:00
Bruno Windels
e2dfe888cc
only capture Enter when autocompletion list has selection
...
this is the old behaviour and makes sense IMO
also close the auto complete when resetting the composer model,
in case it was still open
2019-08-22 13:33:20 +01:00
Bruno Windels
c5cd8b943a
support auto complete for /commands
2019-08-22 13:33:20 +01:00
Bruno Windels
88cc1c428d
add support for emotes and running /commands
...
this does not yet include autocomplete for commands
2019-08-22 13:33:20 +01:00
Bruno Windels
9bc8ff7e1e
clear composer undo history when sending a message
2019-08-22 13:33:20 +01:00
Bruno Windels
0adca10f9f
make named options argument optional
2019-08-22 13:33:20 +01:00
Bruno Windels
10c218825b
allow inserting multiple parts at a position
2019-08-22 13:33:20 +01:00
Bruno Windels
ce44c651d0
keep deserialized parts compatible with part api,
...
to avoid breakage when passing real parts
2019-08-22 13:33:20 +01:00
Bruno Windels
d4fbe7ed69
make editor event parsing suitable for parsing messages to be quoted
2019-08-22 13:33:20 +01:00
Bruno Windels
c135cd60d2
restore insert mention
...
for this, we need to store the last caret in the editor,
to know where to insert the user pill.
Because clicking on a member blurs the editor, and the
selection is moved away from the editor.
For this reason, we keep as cache of the last caretOffset object,
invalidated by a selection with different values.
The selection needs to be cloned because apparently the browser
mutates the object instead of returning a new one.
2019-08-22 13:33:20 +01:00
Bruno Windels
f9992a1fc6
implement editor placeholder
2019-08-22 13:33:20 +01:00
Bruno Windels
d22745a5b2
make it obvious arguments are optional
...
because now they have a setter
2019-08-22 13:33:20 +01:00
Bruno Windels
063eabed71
don't return invalid indices from model, fix for #10358
2019-08-22 13:33:20 +01:00
Bruno Windels
299cf8542c
Split MessageEditor in edit-specifics & reusable part for main composer
2019-08-05 15:31:18 +02:00
Bruno Windels
c53708b245
set lastNode directly when not decending
2019-08-02 16:36:09 +02:00
Bruno Windels
af3eebd0a6
add undo steps after word boundary (or capped) when typing or removing
2019-08-02 11:31:01 +02:00
Bruno Windels
07b2e51dce
put max step length in constant
2019-08-01 16:27:17 +02:00
Bruno Windels
abde8b45d2
fix bug that prevented a line from being removed when undoing a newline
2019-08-01 11:28:40 +02:00
Bruno Windels
234404e598
add mod+z/y shortcuts, set editor state to what history manager returns
2019-08-01 11:27:09 +02:00
Bruno Windels
98bc0d24f4
push changes to history manager
2019-08-01 11:26:20 +02:00
Bruno Windels
aa22c90f2c
HistoryManager + unit tests
2019-08-01 11:25:04 +02:00
Bruno Windels
a999acbd04
fix argument order
2019-07-30 17:17:25 +02:00
Bruno Windels
44e4661198
document return type
2019-07-30 12:34:30 +02:00
Bruno Windels
0b92077bba
tests for turning caret position from model into dom position
2019-07-25 18:38:00 +02:00
Bruno Windels
f8e1977f0a
remove dead code
2019-07-25 14:50:20 +02:00