ember-wrap-urls
This Ember addon takes some text, which may or may not contain URLs and renders the text and each URL as an Ember component.
Installation
ember install ember-wrap-urls
Example usage
Given the following:
{{wrap-urls text='Check out my link: http://example.com'}}
Will render:
Check out my link http://example.com
Built in components
This addon comes with two extra components:
wrap-urls/url
wrap-urls/link
By default, URLs will be rendered using wrap-urls/url
You can set component
to change which component is used to render each URL:
{{wrap-urls text='Visit http://example.com' component='wrap-urls/link'}}
Will result in:
Visit http://example.com
To send in your own attributes:
{{wrap-urls text='Visit http://example.com' component=(component 'wrap-urls/link' target="_blank")}}
Customising
Specify your own component to customise how URLs are rendered:
{{wrap-urls text=text component=(component 'my-tooltip')}}
You change the pattern used to find hyperlinks:
; WrapUrlsComponent;