move the reply preview one level higher so the buttons and avatar don't get centered with it
parent
d24ddc415b
commit
a3ca80b206
|
@ -29,6 +29,7 @@ import E2EIcon from './E2EIcon';
|
||||||
import SettingsStore from "../../../settings/SettingsStore";
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
import {aboveLeftOf, ContextMenu, ContextMenuTooltipButton, useContextMenu} from "../../structures/ContextMenu";
|
import {aboveLeftOf, ContextMenu, ContextMenuTooltipButton, useContextMenu} from "../../structures/ContextMenu";
|
||||||
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
|
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
|
||||||
|
import ReplyPreview from "./ReplyPreview";
|
||||||
|
|
||||||
function ComposerAvatar(props) {
|
function ComposerAvatar(props) {
|
||||||
const MemberStatusMessageAvatar = sdk.getComponent('avatars.MemberStatusMessageAvatar');
|
const MemberStatusMessageAvatar = sdk.getComponent('avatars.MemberStatusMessageAvatar');
|
||||||
|
@ -213,7 +214,7 @@ export default class MessageComposer extends React.Component {
|
||||||
this._onRoomViewStoreUpdate = this._onRoomViewStoreUpdate.bind(this);
|
this._onRoomViewStoreUpdate = this._onRoomViewStoreUpdate.bind(this);
|
||||||
this._onTombstoneClick = this._onTombstoneClick.bind(this);
|
this._onTombstoneClick = this._onTombstoneClick.bind(this);
|
||||||
this.renderPlaceholderText = this.renderPlaceholderText.bind(this);
|
this.renderPlaceholderText = this.renderPlaceholderText.bind(this);
|
||||||
|
this._dispatcherRef = null;
|
||||||
this.state = {
|
this.state = {
|
||||||
isQuoting: Boolean(RoomViewStore.getQuotingEvent()),
|
isQuoting: Boolean(RoomViewStore.getQuotingEvent()),
|
||||||
tombstone: this._getRoomTombstone(),
|
tombstone: this._getRoomTombstone(),
|
||||||
|
@ -222,7 +223,24 @@ export default class MessageComposer extends React.Component {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onAction = (payload) => {
|
||||||
|
if (payload.action === 'reply_to_event') {
|
||||||
|
// add a timeout for the reply preview to be rendered, so
|
||||||
|
// that the ScrollPanel listening to the resizeNotifier can
|
||||||
|
// correctly measure it's new height and scroll down to keep
|
||||||
|
// at the bottom if it already is
|
||||||
|
setTimeout(() => {
|
||||||
|
this.props.resizeNotifier.notifyTimelineHeightChanged();
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
dis.unregister(this.dispatcherRef);
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
MatrixClientPeg.get().on("RoomState.events", this._onRoomStateEvents);
|
MatrixClientPeg.get().on("RoomState.events", this._onRoomStateEvents);
|
||||||
this._roomStoreToken = RoomViewStore.addListener(this._onRoomViewStoreUpdate);
|
this._roomStoreToken = RoomViewStore.addListener(this._onRoomViewStoreUpdate);
|
||||||
this._waitForOwnMember();
|
this._waitForOwnMember();
|
||||||
|
@ -405,6 +423,7 @@ export default class MessageComposer extends React.Component {
|
||||||
return (
|
return (
|
||||||
<div className="mx_MessageComposer mx_GroupLayout">
|
<div className="mx_MessageComposer mx_GroupLayout">
|
||||||
<div className="mx_MessageComposer_wrapper">
|
<div className="mx_MessageComposer_wrapper">
|
||||||
|
<ReplyPreview permalinkCreator={this.props.permalinkCreator} />
|
||||||
<div className="mx_MessageComposer_row">
|
<div className="mx_MessageComposer_row">
|
||||||
{ controls }
|
{ controls }
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -29,7 +29,6 @@ import {
|
||||||
} from '../../../editor/serialize';
|
} from '../../../editor/serialize';
|
||||||
import {CommandPartCreator} from '../../../editor/parts';
|
import {CommandPartCreator} from '../../../editor/parts';
|
||||||
import BasicMessageComposer from "./BasicMessageComposer";
|
import BasicMessageComposer from "./BasicMessageComposer";
|
||||||
import ReplyPreview from "./ReplyPreview";
|
|
||||||
import RoomViewStore from '../../../stores/RoomViewStore';
|
import RoomViewStore from '../../../stores/RoomViewStore';
|
||||||
import ReplyThread from "../elements/ReplyThread";
|
import ReplyThread from "../elements/ReplyThread";
|
||||||
import {parseEvent} from '../../../editor/deserialize';
|
import {parseEvent} from '../../../editor/deserialize';
|
||||||
|
@ -365,13 +364,6 @@ export default class SendMessageComposer extends React.Component {
|
||||||
onAction = (payload) => {
|
onAction = (payload) => {
|
||||||
switch (payload.action) {
|
switch (payload.action) {
|
||||||
case 'reply_to_event':
|
case 'reply_to_event':
|
||||||
// add a timeout for the reply preview to be rendered, so
|
|
||||||
// that the ScrollPanel listening to the resizeNotifier can
|
|
||||||
// correctly measure it's new height and scroll down to keep
|
|
||||||
// at the bottom if it already is
|
|
||||||
setTimeout(() => {
|
|
||||||
this.props.resizeNotifier.notifyTimelineHeightChanged();
|
|
||||||
}, 100);
|
|
||||||
case Action.FocusComposer:
|
case Action.FocusComposer:
|
||||||
this._editorRef && this._editorRef.focus();
|
this._editorRef && this._editorRef.focus();
|
||||||
break;
|
break;
|
||||||
|
@ -451,7 +443,6 @@ export default class SendMessageComposer extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="mx_SendMessageComposer" onClick={this.focusComposer} onKeyDown={this._onKeyDown}>
|
<div className="mx_SendMessageComposer" onClick={this.focusComposer} onKeyDown={this._onKeyDown}>
|
||||||
<ReplyPreview permalinkCreator={this.props.permalinkCreator} />
|
|
||||||
<BasicMessageComposer
|
<BasicMessageComposer
|
||||||
ref={this._setEditorRef}
|
ref={this._setEditorRef}
|
||||||
model={this.model}
|
model={this.model}
|
||||||
|
|
Loading…
Reference in New Issue