Skip to content

Commit

Permalink
expose url pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
amk221 committed May 10, 2024
1 parent 9dba012 commit 95c50ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 6.2.4

- Expose default pattern

## 6.2.3

- Upgrade dependencies
Expand Down
9 changes: 4 additions & 5 deletions addon/components/wrap-urls/index.js
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit 95c50ff

Please sign in to comment.