1.0.14 • Published 6 years ago

ember-wrap-urls v1.0.14

Weekly downloads
53
License
MIT
Repository
github
Last release
6 years ago

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
});
1.0.14

6 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago