Commit graph

135 commits

Author SHA1 Message Date
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
Bruno Windels
9bfba9db3e make PartCreator a bit more testable by not asking for deps of dep 2019-07-25 14:50:20 +02:00
Bruno Windels
419c800167 add tests for diffAtCaret 2019-07-25 14:50:20 +02:00
Bruno Windels
595dc82543 unit test + fixes + comments + simplication for diffDeletion 2019-07-25 14:50:20 +02:00
Bruno Windels
3753e5261d Implement diffing html messages in the edit history 2019-07-24 11:28:56 +02:00
Bruno Windels
ee9dd8ce81 adjust jsdoc 2019-07-12 10:06:38 +02:00
Bruno Windels
dedf978948 prevent inserting parts at index -1 for empty documents 2019-07-11 18:46:56 +02:00
Bruno Windels
06fb892df9 prevent autocomplete when doing bulk insertion (paste, drop text) 2019-07-11 18:46:56 +02:00
Bruno Windels
f6e71b2335 turn flag into options object 2019-07-08 16:55:56 +02:00
Bruno Windels
888e4d1ec2 preserve reply fallback when editing 2019-07-08 15:25:44 +02:00
Bruno Windels
1c7af38d83
Merge pull request #3126 from matrix-org/bwindels/caret-refactoring
Editor caret improvements
2019-06-21 15:02:41 +00:00
Bruno Windels
c443dd7a32 clarify why use a BOM marker for the caret nodes 2019-06-21 16:37:29 +02:00
Bruno Windels
503d702f47 take list nesting into account for indenting 2019-06-21 11:40:27 +02:00
Bruno Windels
da766b8cba caretNode is a better className 2019-06-21 11:21:38 +02:00
Bruno Windels
c5c987f62e use BOM marker instead of ZWS
that's what others do ...
2019-06-21 11:21:13 +02:00
Bruno Windels
366a4aa308 put zero-width spaces in caret nodes so chrome doesn't ignore them
this requires an update of the editor DOM > text & caret offset logic,
as the ZWS need to be ignored.
2019-06-20 14:44:18 +02:00
Bruno Windels
f0271b593d remove special casing for moving caret after newline and pills
not needed anymore with new caret logic and having caret nodes
2019-06-19 17:42:18 +02:00
Bruno Windels
a229641985 use caret nodes in caret positioning code, to move caret out of pills 2019-06-19 17:42:18 +02:00
Bruno Windels
607fc328ed also process first part when processing empty and mergeable parts
this was preventing clearing an emtpy plain part when inserting
a pill-candidate at the beginning of the model, which
prevented a caret node from being inserted before the pill.
2019-06-19 17:42:18 +02:00
Bruno Windels
75fc769742 insert "caret nodes" where pills don't have an adjacent text node
just empty spans, where the caret can be placed.
2019-06-19 17:42:18 +02:00