Michael Telatynski
7e45979e00
change order of if or conditions as micro-optimization
...
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-01-30 20:59:30 +00: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
d7a4698db8
Merge pull request #3891 from matrix-org/t3chguy/fix_multi_paragraph_formatting
...
Fix paragraph-awareness of the composer formatting features
2020-01-23 13:31:12 +00:00
Michael Telatynski
13bb719a89
Add comment for operations loop
2020-01-23 11:22:22 +00:00
Michael Telatynski
832da062cc
Improve trailing spurious breaks + tests
2020-01-22 13:37:27 +00:00
Michael Telatynski
b5e902e1f2
Fix escaping commands using double-slash //, e.g //plain sends /plain
2020-01-21 15:55:21 +00:00
Michael Telatynski
b2aba6db35
Initial attempt to make toggleInlineFormat paragraph-aware
2020-01-21 15:32:32 +00:00
Travis Ralston
1b4ab856c9
Assume the position is at the end when the offset has no last part
...
We get an NPE when the user cuts their entire message, and this fixes it.
2020-01-15 21:05:00 -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
93ecc9839b
Fix linty failures
2019-10-22 13:49:02 +01:00
Tulir Asokan
75bcc3f849
Update src/editor/deserialize.js
...
Co-Authored-By: Bruno Windels <bruno@windels.cloud>
2019-10-18 19:58:55 +03:00
Tulir Asokan
a95f7be22d
Persist list indexes when editing
...
Signed-off-by: Tulir Asokan <tulir@maunium.net>
2019-10-13 14:31:32 +03:00
Tulir Asokan
29367766fd
Fix "decend" typo
...
Signed-off-by: Tulir Asokan <tulir@maunium.net>
2019-10-13 14:31:32 +03:00
Tulir Asokan
a160bdf4df
Persist code block language when editing
...
Signed-off-by: Tulir Asokan <tulir@maunium.net>
2019-10-13 14:31:32 +03:00
Bruno Windels
905aa81bf8
safeguard if the offsetnode is null when determining caret position
2019-10-10 16:39:41 +02: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
ce0a534db1
Fix pills for CIDER too
2019-09-30 20:37:24 -06:00
Bruno Windels
4933b9b050
Merge pull request #3468 from matrix-org/bwindels/cider-autocomplete-fixes
...
Fix: when using autocomplete, ensure command is not sent as text, and @room notifs gets needed suffix
2019-09-23 13:57:07 +00:00
Bruno Windels
04720db2a3
don't append extra newline after blockquote anymore
...
now that P prepends newline when not first element
2019-09-23 15:33:30 +02:00
Bruno Windels
2445421270
add extra newline before P tags (when not first node)
2019-09-23 15:06:22 +02:00
Bruno Windels
0a663398ed
Use underscore for <em> when doing html > md
...
to be consistent with the format bar, which also uses underscores for italics
2019-09-23 14:59:53 +02:00
Bruno Windels
40f7fa8f94
add suffixes from provider to room and @room completions
...
this prevents the @room not working when not typing an extra space
2019-09-23 14:40:41 +02: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
Bruno Windels
26bd694c6a
support toggling inline formatting
2019-09-06 16:25:55 +02:00
Bruno Windels
5014b606db
Merge pull request #3391 from matrix-org/bwindels/cider-format-history
...
New composer: ensure undo history is persisted before applying formatting
2019-09-06 09:28:18 +00:00
Bruno Windels
df4762871a
Merge pull request #3392 from matrix-org/bwindels/cider-paste-plain
...
New composer: fix pasting from word processors
2019-09-06 09:22:37 +00:00
Bruno Windels
6b104f6344
Merge pull request #3393 from matrix-org/bwindels/cider-fix-lastcaret
...
New composer: fix needing to push arrow-up twice after sending first message after switching to a room
2019-09-06 09:22:10 +00:00
Bruno Windels
9dac91a70d
ensure step before formatting is persisted in undo history
2019-09-06 11:20:24 +02:00
Bruno Windels
0252c7ae37
force pasting as plain text in new composer
2019-09-06 11:10:41 +02:00
Bruno Windels
2596281a7c
update last caret from update callback instead of input event
...
many editor updates are not caused by an input event, so
the last caret wasn't always up to date.
Updating the caret from the update callback ensures that every
time the editor contents is changed, the last caret is updated.
2019-09-06 11:09:01 +02:00
Bruno Windels
02681d50b9
Merge pull request #3386 from matrix-org/bwindels/cider-formatbar
...
New composer: show format bar on selection
2019-09-06 08:38:01 +00:00
Bruno Windels
d2949babcd
copyright is solely assigned to matrix foundation now, copy paste error
2019-09-06 10:29:12 +02:00
Bruno Windels
124b7135cd
make sure the update callback gets a caret when calling reset
2019-09-05 17:54:08 +02:00
Bruno Windels
2ea556e0b4
support update callback setting selection instead of caret
2019-09-04 16:40:34 +02:00
Bruno Windels
037ac29c57
be more forgiving with offset that don't have atNodeEnd=true
...
if index is not found, it means the last position should be returned
if there is any.
We still return -1 for empty documents, as index should always point
to a valid part if positive.
2019-09-04 16:40:34 +02:00
Bruno Windels
42c37d8293
fixup: improve quote and code block newline handling
2019-09-04 16:40:34 +02:00
Bruno Windels
e0668e8517
improve algorithm to reduce selection to text node + charactar offset
...
this follows the documentation of {focus|anchor}{Offset|Node} better
and was causing problems for creating ranges from the document selection
when doing ctrl+A in firefox as the anchorNode/Offset was expressed
as childNodes from the editor root.
2019-09-04 16:40:34 +02:00
Bruno Windels
4691108a16
only increase offset if caret hasn't been found yet
...
also rename caret away as this isn't used for the caret solely anymore
2019-09-04 16:40:34 +02:00
Bruno Windels
7a01d1407f
make _replaceRange internal only
2019-09-04 16:40:34 +02:00
Bruno Windels
6e694c113a
add support for inline/block code formatting
2019-09-04 16:40:34 +02:00
Bruno Windels
b35a3531bb
move quote formatting out of react component
2019-09-04 16:40:34 +02:00
Bruno Windels
b72d1a78ec
move inline formatting code out of react component
2019-09-04 16:40:34 +02:00
Bruno Windels
47d8d86bbe
whitespace (in model)
2019-09-04 16:40:23 +02:00
Bruno Windels
c15dfc3c05
make Range start and end public
2019-09-04 16:38:42 +02:00
Bruno Windels
77b14beb1f
add getter for intersecting parts of range, and total length
...
we'll need this when replacing selection, to preserve
newlines, etc ... in the selected range (e.g. we can't just
use range.text).
2019-09-04 16:35:03 +02:00
Bruno Windels
48f1bf1816
sort positions in Range constructor, so start always comes before end
2019-09-04 16:35:03 +02:00
Bruno Windels
4575aaa9f6
Merge pull request #3382 from matrix-org/bwindels/escape-command-slash
...
New composer: allow escaping the first slash to not write a command
2019-09-03 16:04:23 +00:00
Bruno Windels
0d02ab59d6
allow starting a range with both positions known already
...
we'll need this to start a range for the selection
2019-09-03 16:00:50 +02:00
Bruno Windels
eb87301855
allow getting the DocumentOffset for any node+offset, not just focusNode
...
we need this to get both offsets of the selection boundaries
getSelectionOffsetAndText offers the extra flexibility,
getCaretOffsetAndText keeps the old api for focusNode/focusOffset
Also did some renaming here now that it's not just for the caret anymore
2019-09-03 15:58:50 +02:00
Bruno Windels
648ae37ff4
make DocumentOffset compatible with what is returned from dom/getCaret
...
so we can return a DocumentOffset from there without breakage
2019-09-03 15:58:05 +02:00