This package has been deprecated

Author message:

repo moved to @zestia/ember-wrap-urls

ember-wrap-urls

1.0.14 • Public • Published

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 <span class="wrapped-url">http://example.com</span>

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 <a class="wrapped-url-link" href="http://example.com">http://example.com</a>

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:

import WrapUrlsComponent from 'ember-wrap-urls/components/wrap-urls';
 
WrapUrlsComponent.reopenClass({
  regex: /yourRegexGoesHere/g
});

Package Sidebar

Install

npm i ember-wrap-urls

Weekly Downloads

13

Version

1.0.14

License

MIT

Last publish

Collaborators

  • amk221