-
-
Notifications
You must be signed in to change notification settings - Fork 833
Add edit mode for messages (experimental) #588
Conversation
Can one of the admins verify this patch? |
// localize subscribe/dispatch? | ||
if (payload.action === 'edit' && payload.mxEvent === this.props.mxEvent) { | ||
this.state.editMode = !this.state.editMode | ||
this.forceUpdate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First time using React sorry about this =(
I assume there is somewhere I should register editMode
so that changes to it trigger re-render.. (will-fix)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, indeed, 99% of the time calling forceUpdate() is a mistake.
in react, you never ever directly mutate a component's state; instead you go via this.setState({editMode: !this.state.editMode});
, which does the necessary magic for the component to know it has to re-render itself.
this is looking very promising. the big concern I have is the duplication of MessageEditorInput relative to MessageComposerInput (and MessageComposerInputOld). It's bad enough that we have the pre-RTE and RTE composer duplication already, and adding another fork of the same codebase scares me to death, especially as the RTE composer still doesn't work. Instead, i'd be tempted to extend MessageComposerInput so that it can be used for in-place editing as well as normal entry (or alternatively consider a UX where 'editing' a message just lets you use the MessageComposer to edit the contents of said message) |
* Adds pending state for pending edits * final state for complete edit * Adds MessageEditorInput Component (a highly simplified composer)
8f381d3
to
61edf82
Compare
Apologies I haven't had time to update this until very recently. Looking at the current |
High-visibility, especially with theoretically-unlimited backlog as a feature (thus possibly many users searching/referencing), seems like a good approach. Slack's approach of following the edited message with a greyed-out '(edited)', which shows the edit date on mouseover seems like a good general approach. Down the line, as the feature matures, the '(edited)' could be made clickable, possibly to show previous versions of the message. |
Maybe it'll be an idea to stop allowing edits after a certain amount of time has passed, cutting down on abuse. |
@SijmenSchoon but that wouldn't be good, because this would lock down the users' freedom. making it available every time would be better. how can the user abuse the editing function? |
Perhaps something like what reddit does for editing messages, by putting a |
I also believe privileged users (perhaps above a configurable level) being able to edit any messages would allow a lot of fun features for bots. Having an "edit history" showing previous edits and which user made new ones is also important to preserve a timeline of events. |
Is this still being worked on? Not being able to edit messages seems like a pretty big negative, coming from Slack. |
@AlexCzar there's no support for it in matrix yet, as that is an immutable DAG |
Intended to be the companion PR to element-hq/element-web#2725
Adds an
MessageEditInput
which is a basic wrapper aroundEditor
to be triggered whenedit
action is received from dispatcher (triggered on context-menu click).Missing:
matrix-js-sdk
methods that send anedit
message to be functional.Escape - cancels edit mode.
Enter - should send edit message.