mirror of https://github.com/vector-im/riot-web
Merge pull request #1247 from matrix-org/luke/fix-rte-offset-bug
Use `data-offset-key` in RTE decoratorspull/21833/head
commit
d7f4e7c8c0
|
@ -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>;
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue