Use data-offset-key in RTE decorators

This makes sure the selection state is correct when moving the cursor through an entity in the composer but only in rich text mode. https://github.com/vector-im/riot-web/issues/4666 still persists despite this, probably because the text content inserted during a completion in markdown mode has a different length to the text node within the entity.

fixes vector-im/riot-web#4654
This commit is contained in:
Luke Barnard 2017-07-25 11:25:33 +01:00
parent b372e5d55d
commit 143994e44f
2 changed files with 4 additions and 4 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

@ -190,11 +190,11 @@ export default class MessageComposerInput extends React.Component {
const Pill = sdk.getComponent('elements.Pill');
const {url} = Entity.get(props.entityKey).getData();
if (Pill.isPillUrl(url)) {
return <Pill url={url} room={this.props.room}/>;
return <Pill url={url} room={this.props.room} offsetKey={props.offsetKey}/>;
}
return (
<a href={url}>
<a href={url} data-offset-key={props.offsetKey}>
{props.children}
</a>
);