Commit Graph

104 Commits

Author SHA1 Message Date
Luke Barnard
6bc40a112c Always store sent MD messages as MD in history
Because converting them to HTML when they got sent as HTML seems a bit pointless when they're just going to get transformed back again when retrieved from history.

Fixes regression https://github.com/vector-im/riot-web/issues/4465
2017-06-30 15:47:48 +01:00
Luke Barnard
15cfe5b8e4 Only allow history selection when on the first or last line
(of a multi-line or otherwise message in the editor)
2017-06-30 14:27:26 +01:00
Luke Barnard
e7a2c3b975 Only send HTML when using RTE when necessary
When there are no styled blocks or inline styles applied within blocks, just send text instead of HTML.

Also, don't add <br /> for the last <p> (the last block).

Fixes https://github.com/vector-im/riot-web/issues/3147
2017-06-30 11:27:00 +01:00
Luke Barnard
8b8260c509 Move cursor to end of editor when quoting
When quoting a message, move the selection to the end of the input box. Fixes https://github.com/vector-im/riot-web/issues/2336
2017-06-29 17:22:34 +01:00
Luke Barnard
e5e7dec131 Fix #4422 by persisting the "currently composed" message
This allows for browsing through history without losing the message currently being composed.
2017-06-29 17:02:19 +01:00
Luke Barnard
6bd7284161 Be sensible about handling up/down vs tab/tab-shift
Fixes https://github.com/vector-im/riot-web/issues/4445
2017-06-29 15:07:06 +01:00
Luke Barnard
8912400675 Add XXX for https://github.com/vector-im/riot-web/issues/4445 2017-06-28 18:05:39 +01:00
Luke Barnard
d5585e29b1 Merge pull request #1155 from matrix-org/luke/fix-rte-cursor-at-start-of-history
Fix issue where the cursor is put at the start of selected history item
2017-06-28 17:17:56 +01:00
Luke Barnard
d696373bc2 Fix issue where the cursor is put at the start of selected history item
Leading to strange behaviour when selecting all and deleting it.

Fixes https://github.com/vector-im/riot-web/issues/4450
2017-06-28 15:29:07 +01:00
Luke Barnard
bcb67bb273 Refactor shared code between onUpArrow and onDownArrow 2017-06-28 15:20:16 +01:00
Luke Barnard
f73fa4b49b Move processing into renamed function processHtmlforSending
And explain why this fix is necessary
2017-06-28 11:49:50 +01:00
Luke Barnard
1523d304f2 WIP to prevent RTE from deleting current message input when up arrow pressed 2017-06-28 10:30:59 +01:00
Luke Barnard
69589c19e7 Work around draft-js-export-html#62 by post-processing <br>\n
Fixes https://github.com/vector-im/riot-web/issues/4446 by post-processing the output HTML from draft-js-export-html by replacing `<br>\n` with `<br>`. This works for content within or outside of `<pre>`. If we replace with `\n` instead, the newlines only apply in `<pre>` tags so we use `<br>`.
2017-06-27 18:33:45 +01:00
Luke Barnard
5307731dfd Overide default draft-js handling of pasting text/html
This is surprisingly needed to avoid an issue with draft-js that causes multi-line madness when pasting code and then applying format-as-code to it - https://github.com/vector-im/riot-web/issues/2120#issuecomment-271735729.

The issue sounds like it is https://github.com/facebook/draft-js/issues/170#issuecomment-195026203 and the suggstion is to override the text pasting handler https://github.com/facebook/draft-js/issues/170#issuecomment-215983216. Meanwhile they haven't modified the default pasting behaviour afaics.

I've discovered a separate issue that is apparent even after this suggested fix. (https://github.com/vector-im/riot-web/issues/4446)
2017-06-27 17:10:28 +01:00
Luke Barnard
ba31a32440 Allow toggling of dev tools when RTE focussed 2017-06-27 15:17:57 +01:00
Luke Barnard
9404dd30c5 Use <del> for strikeout
We've swapped to commonmark, which uses <del> instead of ~~ for strikeout, so make the RTE insert <del> when we apply strikeout. Also, when ~~ is inserted, transform them into <del> for simplicity. This means giving an input of ~~test~~ is effectively the same as giving an input of <del>test</del>.
2017-06-23 18:19:06 +01:00
Luke Barnard
89afcfd897 Linting 2017-06-23 17:35:07 +01:00
Luke Barnard
87609582c6 Merge branch 'develop' into rte-fixes2
Conflicts:
	package.json
	src/autocomplete/CommandProvider.js
	src/autocomplete/UserProvider.js
	src/components/structures/RoomView.js
	src/components/structures/UserSettings.js
	src/components/views/rooms/MessageComposerInput.js
2017-06-23 15:30:06 +01:00
Matthew Hodgson
c173861b27 Merge pull request #1021 from Bitim/feature/rtl-languages-support
Better RTL support
2017-06-08 14:43:18 +01:00
saul.kredi@krutt.org
159a920dc8 Better RTL support 2017-06-03 18:52:45 +03:00
Michael Telatynski
4032a820f0 move KEY_M to KeyCode
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-06-02 21:46:08 +01:00
Michael Telatynski
464863acd6 remove unused imports
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-06-02 21:35:55 +01:00
Kegan Dougal
547f10bcbb Add translations for slash command failures 2017-06-01 15:44:56 +01:00
David Baker
443ab1add7 Put back default strings on dialogs
But make them work by calling _t in render rather than
getDefaultProps().

Also sort out some 'Warning!' strings
2017-05-25 18:20:48 +01:00
David Baker
5c359e63ab Bulk change counterpart imports
to use languageHandler wrapper func
2017-05-25 11:39:08 +01:00
David Baker
d419c42a4f Squash merge https://github.com/matrix-org/matrix-react-sdk/pull/801 2017-05-23 15:16:31 +01:00
Richard van der Hoff
8695397abb Support for pasting files into normal composer
We don't seem to be in any danger of getting a working RTE any time soon, so
implement file pasting in the normal composer too.
2017-05-17 01:43:13 +01:00
Michael Telatynski
d7c88a9813 only removed /me , remove anyway to fix vector-im/riot-web#3733
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-05-13 15:20:31 +01:00
Luke Barnard
f5a23c14df Remove redundant bind 2017-05-08 17:32:26 +01:00
Luke Barnard
fe121126f5 Merge branch 'develop' into rte-fixes
Conflicts:
	src/UserSettingsStore.js
	src/autocomplete/EmojiProvider.js
	src/components/views/rooms/MessageComposerInput.js
2017-05-08 17:08:59 +01:00
Michael Telatynski
6cbd04045d change the now working defaults
to what they effectively were when defaultValue was broken
(hopefully tests now pass)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-04-25 22:17:25 +01:00
Matthew Hodgson
db996f678c show better errors when slash commands fail 2017-04-23 01:32:51 +01:00
turt2live
64e416e117 Add option to not send typing notifications
Addresses vector-im/riot-web#3220

Fix applies to both the RTE and plain editor.

Signed-off-by: Travis Ralston <travpc@gmail.com>
2017-04-21 14:50:26 -06:00
Matthew Hodgson
bf8973ad33 avoid leading space in HTML /me too 2017-03-19 21:33:18 +00:00
Lieuwe Rooijakkers
c697b48f99 fix leading extraneous space in emotes 2017-03-19 21:52:24 +01:00
Matthew Hodgson
3aaf37df1a beautify a tonne more errors 2017-03-12 22:59:41 +00:00
Aviral Dasgupta
8dc7f8efe2
rte: remove logging and fix new history 2017-03-10 21:10:27 +05:30
Aviral Dasgupta
6004f6d610
rte: fix history 2017-03-10 20:34:31 +05:30
Matthew Hodgson
6c7b191577 Merge pull request #605 from SijmenSchoon/feature/pastefiles
Add support for pasting files into the text box
2017-03-09 17:55:58 +00:00
Aviral Dasgupta
79f481f81e
rte: special return handling for some block types 2017-03-07 04:40:25 +05:30
Aviral Dasgupta
f5b52fb488
rte: change list behaviour in markdown mode 2017-03-07 04:15:28 +05:30
Aviral Dasgupta
3a07fc1601
fix code-block for markdown mode 2017-03-07 04:09:27 +05:30
Aviral Dasgupta
5fbe06ed91
force editor rerender when we swap editorStates 2017-03-07 04:09:26 +05:30
Aviral Dasgupta
46d30c378d
fix tab focus issue in MessageComposerInput
onTab was incorrectly implemented causing forceComplete instead of
focusing the editor
2017-03-07 04:09:26 +05:30
Aviral Dasgupta
aaac06c6d3
run eslint --fix over MessageComposerInput 2017-03-07 04:09:25 +05:30
Aviral Dasgupta
48376a32c2
refactor: MessageComposer.setEditorState to overridden setState
The old approach led to a confusing proliferation of repeated
setState calls.
2017-03-07 04:09:25 +05:30
Aviral Dasgupta
f4c0baaa2f
refactor MessageComposerInput: bind -> class props 2017-03-07 04:09:25 +05:30
Luke Barnard
fd146a732b Clarify non-e2e vs. e2e /w composers placeholder
For E2E rooms, display "Send an encrypted message…" otherwise display "Send a plaintext message…" as the placeholder for the input box in [old] message composer.
2017-02-21 15:33:44 +00:00
Richard van der Hoff
67bd2cf9dd Merge branch 'matthew/warn-unknown-devices' into matthew/blacklist-unverified 2017-01-26 14:09:25 +00:00
Richard van der Hoff
70190be65c Factor out common onSendMessageFailed 2017-01-25 22:23:21 +00:00