Merge pull request #1247 from matrix-org/luke/fix-rte-offset-bug

Use `data-offset-key` in RTE decorators
This commit is contained in:
Luke Barnard 2017-07-25 12:24:02 +01:00 committed by GitHub
commit d7f4e7c8c0
2 changed files with 7 additions and 7 deletions

View file

@ -173,11 +173,11 @@ const Pill = React.createClass({
if (this.state.pillType) {
return this.props.inMessage ?
<a className={classes} href={this.props.url} title={resource}>
<a className={classes} href={this.props.url} title={resource} data-offset-key={this.props.offsetKey}>
{avatar}
{linkText}
</a> :
<span className={classes} title={resource}>
<span className={classes} title={resource} data-offset-key={this.props.offsetKey}>
{avatar}
{linkText}
</span>;

View file

@ -186,16 +186,16 @@ export default class MessageComposerInput extends React.Component {
RichText.getScopedMDDecorators(this.props);
decorators.push({
strategy: this.findLinkEntities.bind(this),
component: (props) => {
component: (entityProps) => {
const Pill = sdk.getComponent('elements.Pill');
const {url} = Entity.get(props.entityKey).getData();
const {url} = Entity.get(entityProps.entityKey).getData();
if (Pill.isPillUrl(url)) {
return <Pill url={url} room={this.props.room}/>;
return <Pill url={url} room={this.props.room} offsetKey={entityProps.offsetKey}/>;
}
return (
<a href={url}>
{props.children}
<a href={url} data-offset-key={entityProps.offsetKey}>
{entityProps.children}
</a>
);
},