Add data-mx-emote to emotes
This commit is contained in:
		
							parent
							
								
									772cb2cf1d
								
							
						
					
					
						commit
						6cd745bd1a
					
				|  | @ -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 New Issue