Commit graph

15338 commits

Author SHA1 Message Date
Bruno Windels
d83e278f6b PR feedback, cleanup 2019-05-15 09:46:08 +01:00
Bruno Windels
dc21faa240 send edit also in n.new_content field
so we can have fallback content in the regular content for clients
that don't support edits. Note that we're not reading m.new_content
yet as it's going to be a bit of a headache to change this.

So for now just sending the edit in both the normal content and
the m.new_content subfield, so all events out there already
are well-formed
2019-05-14 16:32:08 +01:00
Bruno Windels
fd31e793d1 fix lint 2019-05-14 15:49:53 +01:00
Bruno Windels
0b18ff52c5 pass feature flag to js-sdk 2019-05-14 15:43:10 +01:00
Bruno Windels
45991bc3de replace original event if there have been previous edits 2019-05-14 15:39:24 +01:00
Bruno Windels
15df72e629 reload events when event gets replaced in the timeline 2019-05-14 15:39:24 +01:00
Bruno Windels
e2388afb51 consistent naming between serialize and deserialize modules 2019-05-14 15:39:24 +01:00
Bruno Windels
036cb02c0e add feature flag 2019-05-14 15:39:24 +01:00
Bruno Windels
759a4a54ef send the actual m.replace event from composer content 2019-05-14 15:38:16 +01:00
Bruno Windels
34dbe5f314 add newline parts for text messages as well 2019-05-14 15:38:16 +01:00
Bruno Windels
3abdf6b100 also serialize to text and method to tell us if we need html for model 2019-05-14 15:38:16 +01:00
Bruno Windels
2fbe73e658 draft of formatting 2019-05-14 15:38:16 +01:00
Bruno Windels
eaf43d7277 correctly parse BRs 2019-05-14 15:38:16 +01:00
Bruno Windels
c98e716cbd some pill styling 2019-05-14 15:38:16 +01:00
Bruno Windels
c44fed4bea even less logging 2019-05-14 15:38:16 +01:00
Bruno Windels
a3b02cf0cc make logging quiet 2019-05-14 15:38:16 +01:00
Bruno Windels
4ff37ca046 don't show model for now 2019-05-14 15:38:16 +01:00
Bruno Windels
9e0816c51c find caret offset and calculate editor text in same tree-walking algo
instead of having the same logic twice
2019-05-14 15:38:16 +01:00
Bruno Windels
7ebb6ce621 WIP commit, newlines sort of working 2019-05-14 15:38:16 +01:00
Bruno Windels
9f597c7ec0 no comment nodes without react,so can bring this back to simpler version 2019-05-14 15:38:16 +01:00
Bruno Windels
7a85dd4e61 after completion, set caret in next part at start
instead of end of current part
2019-05-14 15:38:16 +01:00
Bruno Windels
2c3453d307 put caret after replaced part if no caretOffset is given by autocomplete 2019-05-14 15:38:16 +01:00
Bruno Windels
1a577eed11 take non-editable parts into account for new caret position 2019-05-14 15:38:16 +01:00
Bruno Windels
8d97c0033e catch this for now as caret behaviour is still a bit flaky 2019-05-14 15:38:16 +01:00
Bruno Windels
580a89875a fix autocompl. not always appearing/being updated when there is no part 2019-05-14 15:38:16 +01:00
Bruno Windels
bc14d4f58f comment 2019-05-14 15:38:16 +01:00
Bruno Windels
22587da5ff close autocomplete on enter 2019-05-14 15:38:16 +01:00
Bruno Windels
ffff66a92d handle Escape properly
close autocomplete, and also replace with plain text part.

also remove leftover logging
2019-05-14 15:38:16 +01:00
Bruno Windels
64b171198c rerender through callback instead of after modifying model
this way rendering is centralized and we can better rerender
from interaction in the autocompleter
(we didn't have access to caret before)
2019-05-14 15:38:16 +01:00
Bruno Windels
aa1b4bb91e keep auto complete code close to each other 2019-05-14 15:38:16 +01:00
Bruno Windels
5e6367ab57 basic support for non-editable parts
e.g. pills, they get deleted when any character of them is removed
later on we also shouldn't allow the caret to be set inside of them
2019-05-14 15:38:16 +01:00
Bruno Windels
fc87a27c5d make editor nicer 2019-05-14 15:38:16 +01:00
Bruno Windels
4bb8b79942 initial auto complete wrapper, make existing autocompleter work w/ model 2019-05-14 15:38:16 +01:00
Bruno Windels
bb73521f0c prefer textContent over innerText as it's faster
and transforms the text less
2019-05-14 15:38:16 +01:00
Bruno Windels
317e88bef2 initial hacky hookup of Autocomplete menu in MessageEditor 2019-05-14 15:38:16 +01:00
Bruno Windels
1330b438d6 initial support for auto complete in model and parts
also move part creation out of model, into partcreator, which
can then also contain dependencies for creating the auto completer.
2019-05-14 15:38:16 +01:00
Bruno Windels
7507d0d7e1 complete proptypes 2019-05-14 15:38:16 +01:00
Bruno Windels
a765fdf98a run autocomplete after mounting
componentWillReceiveProps doesn't run after mount,
and is deprecated as well.

Update state after both on componentDidMount and componentDidUpdate
2019-05-14 15:38:16 +01:00
Bruno Windels
a2f1f49972 update the DOM manually as opposed through react rendering
react messes up the DOM sometimes because of, I assume, not
being aware of the changes to the real DOM by contenteditable.
2019-05-14 15:38:16 +01:00
Bruno Windels
85adc8953f remove logging 2019-05-14 15:38:16 +01:00
Bruno Windels
0f38753dba some comments 2019-05-14 15:38:16 +01:00
Bruno Windels
ebdb9fcb9c don't collapse whitespace in editor 2019-05-14 15:38:16 +01:00
Bruno Windels
8f0074f824 ignore react comment nodes when locating/setting caret 2019-05-14 15:38:16 +01:00
Bruno Windels
6be6492cd2 initial parsing of pills for editor 2019-05-14 15:38:16 +01:00
Bruno Windels
76bb56a2bf initial hookup editor code with react component 2019-05-14 15:38:16 +01:00
Bruno Windels
9f98a6c0e6 add converted prototype code 2019-05-14 15:38:16 +01:00
Bruno Windels
6599d605cd wire up editor component (somewhat hacky) 2019-05-14 15:38:16 +01:00
J. Ryan Stinnett
66aabdca9e
Merge pull request #2962 from matrix-org/jryans/gif-autoplay
Always thumbnail for GIFs
2019-05-14 14:07:58 +01:00
J. Ryan Stinnett
f19e70c219 Add comment about thumbnailing for GIFs 2019-05-14 13:55:38 +01:00
David Baker
0f13bb2738 Merge branch 'master' into develop 2019-05-14 13:49:44 +01:00