Merge branch 'soru/update-emotes' into 'master'
Add data-mx-emote to emotes as per MSC See merge request famedly/famedlysdk!397
This commit is contained in:
commit
7cc14687c4
|
@ -65,6 +65,7 @@ class EmoteSyntax extends InlineSyntax {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final element = Element.empty('img');
|
final element = Element.empty('img');
|
||||||
|
element.attributes['data-mx-emote'] = '';
|
||||||
element.attributes['src'] = htmlEscape.convert(mxc);
|
element.attributes['src'] = htmlEscape.convert(mxc);
|
||||||
element.attributes['alt'] = htmlEscape.convert(emote);
|
element.attributes['alt'] = htmlEscape.convert(emote);
|
||||||
element.attributes['title'] = htmlEscape.convert(emote);
|
element.attributes['title'] = htmlEscape.convert(emote);
|
||||||
|
|
|
@ -54,11 +54,11 @@ void main() {
|
||||||
});
|
});
|
||||||
test('emotes', () {
|
test('emotes', () {
|
||||||
expect(markdown(':fox:', emotePacks),
|
expect(markdown(':fox:', emotePacks),
|
||||||
'<img src="mxc://roomfox" alt=":fox:" title=":fox:" height="32" vertical-align="middle" />');
|
'<img data-mx-emote="" src="mxc://roomfox" alt=":fox:" title=":fox:" height="32" vertical-align="middle" />');
|
||||||
expect(markdown(':user~fox:', emotePacks),
|
expect(markdown(':user~fox:', emotePacks),
|
||||||
'<img src="mxc://userfox" alt=":fox:" title=":fox:" height="32" vertical-align="middle" />');
|
'<img data-mx-emote="" src="mxc://userfox" alt=":fox:" title=":fox:" height="32" vertical-align="middle" />');
|
||||||
expect(markdown(':raccoon:', emotePacks),
|
expect(markdown(':raccoon:', emotePacks),
|
||||||
'<img src="mxc://raccoon" alt=":raccoon:" title=":raccoon:" height="32" vertical-align="middle" />');
|
'<img data-mx-emote="" src="mxc://raccoon" alt=":raccoon:" title=":raccoon:" height="32" vertical-align="middle" />');
|
||||||
expect(markdown(':invalid:', emotePacks), ':invalid:');
|
expect(markdown(':invalid:', emotePacks), ':invalid:');
|
||||||
expect(markdown(':room~invalid:', emotePacks), ':room~invalid:');
|
expect(markdown(':room~invalid:', emotePacks), ':room~invalid:');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue