mirror of https://github.com/vector-im/riot-web
add quoting functionality to new composer
parent
10c218825b
commit
60e10364b0
|
@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue