diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f648b..ad31abd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 6.2.4 + +- Expose default pattern + ## 6.2.3 - Upgrade dependencies diff --git a/addon/components/wrap-urls/index.js b/addon/components/wrap-urls/index.js index 59ac542..8ee222d 100644 --- a/addon/components/wrap-urls/index.js +++ b/addon/components/wrap-urls/index.js @@ -1,6 +1,9 @@ import Component from '@glimmer/component'; import Url from '@zestia/ember-wrap-urls/components/wrap-urls/url'; +export const URL_PATTERN = + /(https?|file|ftp):\/\/([a-zA-Z0-9~!@#$%^&*()_\-=+/?.:;',]*)?/g; + export default class WrapUrlsComponent extends Component { get parts() { return this._textToParts(this.args.text); @@ -10,12 +13,8 @@ export default class WrapUrlsComponent extends Component { return this.args.Url ?? Url; } - get defaultPattern() { - return /(https?|file|ftp):\/\/([a-zA-Z0-9~!@#$%^&*()_\-=+/?.:;',]*)?/g; - } - get pattern() { - return this.args.pattern ?? this.defaultPattern; + return this.args.pattern ?? URL_PATTERN; } _textToParts(text) {