Merge pull request #1247 from matrix-org/luke/fix-rte-offset-bug
Use `data-offset-key` in RTE decorators
This commit is contained in:
commit
d7f4e7c8c0
2 changed files with 7 additions and 7 deletions
|
@ -173,11 +173,11 @@ const Pill = React.createClass({
|
||||||
|
|
||||||
if (this.state.pillType) {
|
if (this.state.pillType) {
|
||||||
return this.props.inMessage ?
|
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}
|
{avatar}
|
||||||
{linkText}
|
{linkText}
|
||||||
</a> :
|
</a> :
|
||||||
<span className={classes} title={resource}>
|
<span className={classes} title={resource} data-offset-key={this.props.offsetKey}>
|
||||||
{avatar}
|
{avatar}
|
||||||
{linkText}
|
{linkText}
|
||||||
</span>;
|
</span>;
|
||||||
|
|
|
@ -186,16 +186,16 @@ export default class MessageComposerInput extends React.Component {
|
||||||
RichText.getScopedMDDecorators(this.props);
|
RichText.getScopedMDDecorators(this.props);
|
||||||
decorators.push({
|
decorators.push({
|
||||||
strategy: this.findLinkEntities.bind(this),
|
strategy: this.findLinkEntities.bind(this),
|
||||||
component: (props) => {
|
component: (entityProps) => {
|
||||||
const Pill = sdk.getComponent('elements.Pill');
|
const Pill = sdk.getComponent('elements.Pill');
|
||||||
const {url} = Entity.get(props.entityKey).getData();
|
const {url} = Entity.get(entityProps.entityKey).getData();
|
||||||
if (Pill.isPillUrl(url)) {
|
if (Pill.isPillUrl(url)) {
|
||||||
return <Pill url={url} room={this.props.room}/>;
|
return <Pill url={url} room={this.props.room} offsetKey={entityProps.offsetKey}/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a href={url}>
|
<a href={url} data-offset-key={entityProps.offsetKey}>
|
||||||
{props.children}
|
{entityProps.children}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue