You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-19 05:22:13 +03:00
add quoting functionality to new composer
This commit is contained in:
@@ -26,6 +26,7 @@ import BasicMessageComposer from "./BasicMessageComposer";
|
||||
import ReplyPreview from "./ReplyPreview";
|
||||
import RoomViewStore from '../../../stores/RoomViewStore';
|
||||
import ReplyThread from "../elements/ReplyThread";
|
||||
import {parseEvent} from '../../../editor/deserialize';
|
||||
|
||||
function addReplyToMessageContent(content, repliedToEvent, permalinkCreator) {
|
||||
const replyContent = ReplyThread.makeReplyMixIn(repliedToEvent);
|
||||
@@ -137,6 +138,17 @@ export default class SendMessageComposer extends React.Component {
|
||||
this.model.insertPartsAt([userPillPart], this._editorRef.getCaret());
|
||||
break;
|
||||
}
|
||||
case 'quote': {
|
||||
const {partCreator} = this.model;
|
||||
const quoteParts = parseEvent(payload.event, partCreator, { isQuotedMessage: true });
|
||||
// add two newlines
|
||||
quoteParts.push(partCreator.newline());
|
||||
quoteParts.push(partCreator.newline());
|
||||
this.model.insertPartsAt(quoteParts, {offset: 0});
|
||||
// refocus on composer, as we just clicked "Quote"
|
||||
this._editorRef.focus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user