This Ember addon takes some text, which may or may not contain URLs and renders the text and each URL as an Ember component.
ember install @zestia/ember-wrap-urls
Add the following to ~/.npmrc
to pull @zestia scoped packages from Github instead of NPM.
@zestia:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=<YOUR_GH_TOKEN>
https://zestia.github.io/ember-wrap-urls
Given the following:
Will render:
Required. The text within which to find URLs.
Optional. The component used to display each URL discovered within @text
. Defaults to wrap-urls/url
. You can also set it to wrap-urls/link
, or a component of your choice.
Optional. The regular expression used to find URLs in the @text
. You may wish to set this to match mailto links for example.
When a URL is found, and a component is rendered in its place, that component will have this API available to it in the template as an argument @url
.
The URL that this component should render.
The position in the @text
where the URL starts.
The position in the @text
where the URL ends.