@code-name-jack/ngx-linkifyjs 18.0.0 → 20.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -399
- package/fesm2022/code-name-jack-ngx-linkifyjs.mjs +31 -35
- package/fesm2022/code-name-jack-ngx-linkifyjs.mjs.map +1 -1
- package/index.d.ts +77 -5
- package/package.json +4 -57
- package/esm2022/code-name-jack-ngx-linkifyjs.mjs +0 -5
- package/esm2022/lib/enum/linktype.enum.mjs +0 -8
- package/esm2022/lib/interfaces/ngx-linkifyjs.interface.mjs +0 -2
- package/esm2022/lib/ngx-linkifyjs.module.mjs +0 -57
- package/esm2022/lib/pipes/ngx-linkifyjs.pipe.mjs +0 -17
- package/esm2022/lib/service/ngx-linkifyjs.service.mjs +0 -42
- package/esm2022/public-api.mjs +0 -9
- package/lib/enum/linktype.enum.d.ts +0 -6
- package/lib/interfaces/ngx-linkifyjs.interface.d.ts +0 -24
- package/lib/ngx-linkifyjs.module.d.ts +0 -20
- package/lib/pipes/ngx-linkifyjs.pipe.d.ts +0 -8
- package/lib/service/ngx-linkifyjs.service.d.ts +0 -26
- package/public-api.d.ts +0 -5
package/README.md
CHANGED
|
@@ -1,410 +1,24 @@
|
|
|
1
|
-
#
|
|
1
|
+
# NgxLinkifyjs
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
[](https://anthonynahas.github.io/ngx-linkifyjs)
|
|
5
|
-
[](https://gitter.im/angular-material-extensions/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
6
|
-
[](https://circleci.com/gh/AnthonyNahas/ngx-linkifyjs)
|
|
7
|
-
[](https://travis-ci.org/AnthonyNahas/ngx-linkifyjs)
|
|
8
|
-
[](https://coveralls.io/github/AnthonyNahas/ngx-linkifyjs?branch=master)
|
|
9
|
-
[](https://david-dm.org/anthonynahas/ngx-linkifyjs)
|
|
10
|
-
[](https://david-dm.org/anthonynahas/ngx-linkifyjs#info=devDependencies)
|
|
11
|
-
[](https://greenkeeper.io/)
|
|
12
|
-
[](https://github.com/AnthonyNahas/ngx-linkifyjs/blob/master/LICENSE)
|
|
13
|
-
[](https://github.com/gdi2290/awesome-angular)
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.
|
|
14
4
|
|
|
5
|
+
## Code scaffolding
|
|
15
6
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
src="https://cdn.jsdelivr.net/gh/anthonynahas/ngx-linkifyjs@master/assets/demo.gif">
|
|
19
|
-
</p>
|
|
7
|
+
Run `ng generate component component-name --project ngx-linkifyjs-v2` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-linkifyjs-v2`.
|
|
8
|
+
> Note: Don't forget to add `--project ngx-linkifyjs-v2` or else it will be added to the default project in your `angular.json` file.
|
|
20
9
|
|
|
21
|
-
##
|
|
22
|
-
Do you have any question or suggestion ? Please do not hesitate to contact us!
|
|
23
|
-
Alternatively, provide a PR | open an appropriate issue [here](https://github.com/anthonynahas/ngx-linkifyjs/issues)
|
|
10
|
+
## Build
|
|
24
11
|
|
|
25
|
-
|
|
26
|
-
by starring :star: and sharing it :loudspeaker:
|
|
12
|
+
Run `ng build ngx-linkifyjs-v2` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
27
13
|
|
|
14
|
+
## Publishing
|
|
28
15
|
|
|
16
|
+
After building your library with `ng build ngx-linkifyjs-v2`, go to the dist folder `cd dist/ngx-linkifyjs-v2` and run `npm publish --access=public`.
|
|
29
17
|
|
|
30
|
-
##
|
|
31
|
-
- [Demo](#demo)
|
|
32
|
-
- [Features](#features)
|
|
33
|
-
- [Documentation](#documentation)
|
|
34
|
-
- [Installation](#installation)
|
|
35
|
-
- [Usage](#usage)
|
|
36
|
-
- [Config](#config)
|
|
37
|
-
- [Run Demo App Locally](#run-demo-app-locally)
|
|
38
|
-
- [Other Angular Libraries](#other-angular-libraries)
|
|
39
|
-
- [Support](#support)
|
|
40
|
-
- [License](#license)
|
|
18
|
+
## Running unit tests
|
|
41
19
|
|
|
42
|
-
|
|
20
|
+
Run `ng test ngx-linkifyjs-v2` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
43
21
|
|
|
44
|
-
##
|
|
45
|
-
|
|
46
|
-
View all the directives in action at https://anthonynahas.github.io/ngx-linkifyjs
|
|
47
|
-
|
|
48
|
-
<a name="documentation"/>
|
|
49
|
-
|
|
50
|
-
## [Documentation](https://anthonynahas.github.io/ngx-linkifyjs/doc/index.html)
|
|
51
|
-
|
|
52
|
-
<a name="dependencies"/>
|
|
53
|
-
|
|
54
|
-
## Dependencies
|
|
55
|
-
* [Angular](https://angular.io) (*requires* Angular 2 or higher, tested with 7.x)
|
|
56
|
-
|
|
57
|
-
<a name="installation"/>
|
|
58
|
-
|
|
59
|
-
# Installation
|
|
60
|
-
|
|
61
|
-
## 1. Install via *ng add*. (Recommended)
|
|
62
|
-
|
|
63
|
-
Now add the library via the `angular schematics`
|
|
64
|
-
```shell
|
|
65
|
-
ng add ngx-linkifyjs
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## 2. Install via *npm*. (Alternative)
|
|
69
|
-
|
|
70
|
-
Now install `ngx-linkifyjs` via:
|
|
71
|
-
```shell
|
|
72
|
-
npm i -s ngx-linkifyjs
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
##### SystemJS
|
|
77
|
-
>**Note**:If you are using `SystemJS`, you should adjust your configuration to point to the UMD bundle.
|
|
78
|
-
In your systemjs config file, `map` needs to tell the System loader where to look for `ngx-linkifyjs`:
|
|
79
|
-
```js
|
|
80
|
-
{
|
|
81
|
-
'ngx-linkifyjs';: 'node_modules/ngx-linkifyjs/bundles/ngx-linkifyjs.umd.js',
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
Once installed you need to import the main module:
|
|
87
|
-
```js
|
|
88
|
-
import { NgxLinkifyjsModule } from 'ngx-linkifyjs';
|
|
89
|
-
```
|
|
90
|
-
The only remaining part is to list the imported module in your application module. The exact method will be slightly
|
|
91
|
-
different for the root (top-level) module for which you should end up with the code similar to (notice ` NgxLinkifyjsModule .forRoot()`):
|
|
92
|
-
```typescript
|
|
93
|
-
import { NgxLinkifyjsModule } from 'ngx-linkifyjs';
|
|
94
|
-
|
|
95
|
-
@NgModule({
|
|
96
|
-
declarations: [AppComponent, ...],
|
|
97
|
-
imports: [NgxLinkifyjsModule.forRoot(), ...],
|
|
98
|
-
bootstrap: [AppComponent]
|
|
99
|
-
})
|
|
100
|
-
export class AppModule {
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Other modules in your application can simply import ` NgxLinkifyjsModule `:
|
|
105
|
-
|
|
106
|
-
```js
|
|
107
|
-
import { NgxLinkifyjsModule } from 'ngx-linkifyjs';
|
|
108
|
-
|
|
109
|
-
@NgModule({
|
|
110
|
-
declarations: [OtherComponent, ...],
|
|
111
|
-
imports: [NgxLinkifyjsModule, ...],
|
|
112
|
-
})
|
|
113
|
-
export class OtherModule {
|
|
114
|
-
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
<a name="usage"/>
|
|
118
|
-
|
|
119
|
-
## Usage
|
|
120
|
-
|
|
121
|
-
Once the library is imported, you can use its components, directives and pipes in your Angular application:
|
|
122
|
-
|
|
123
|
-
### Options
|
|
124
|
-
|
|
125
|
-
`ngx-linkifyjs` provides an appropriate option interface called `NgxLinkifyOptions` to access [the native options of the linkifyjs library](https://soapbox.github.io/linkifyjs/docs/options.html)
|
|
126
|
-
and all of them are optional
|
|
127
|
-
- Default values
|
|
128
|
-
|
|
129
|
-
```typescript
|
|
130
|
-
|
|
131
|
-
import { NgxLinkifyOptions } from 'ngx-linkifyjs';
|
|
132
|
-
|
|
133
|
-
const options: NgxLinkifyOptions =
|
|
134
|
-
{
|
|
135
|
-
attributes: null,
|
|
136
|
-
className: 'linkified',
|
|
137
|
-
defaultProtocol: 'http',
|
|
138
|
-
events: null,
|
|
139
|
-
format: function (value, type) {
|
|
140
|
-
return value;
|
|
141
|
-
},
|
|
142
|
-
formatHref: function (href, type) {
|
|
143
|
-
return href;
|
|
144
|
-
},
|
|
145
|
-
ignoreTags: [],
|
|
146
|
-
nl2br: false,
|
|
147
|
-
tagName: 'a',
|
|
148
|
-
target: {
|
|
149
|
-
url: '_blank'
|
|
150
|
-
},
|
|
151
|
-
validate: true
|
|
152
|
-
};
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### Pipe
|
|
156
|
-
|
|
157
|
-
`{{text | linkify}}`
|
|
158
|
-
|
|
159
|
-
```html
|
|
160
|
-
<span [innerHTML]="'Linkify the following URL: https://github.com/anthonynahas/ngx-linkifyjs and share it <3' | linkify"></span>
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
**result**: Linkify the following URL: [https://github.com/anthonynahas/ngx-linkifyjs](https://github.com/anthonynahas/ngx-linkifyjs) and share it <3
|
|
164
|
-
|
|
165
|
-
if you prefer to provide your own option to the `pipe`, you can use it like the following:
|
|
166
|
-
|
|
167
|
-
- `{{text | linkify: 'options' }}`
|
|
168
|
-
- `{{text | linkify: '{/*your options*/}' }}`
|
|
169
|
-
- `{{text | linkify: '{target {url: "_self" }}' }}`
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
### Service
|
|
173
|
-
|
|
174
|
-
Inject the `NgxLinkifyjsService` service
|
|
175
|
-
|
|
176
|
-
```typescript
|
|
177
|
-
import {NgxLinkifyjsService, Link, LinkType} from 'ngx-linkifyjs';
|
|
178
|
-
|
|
179
|
-
constructor(public; NgxLinkifyjsService;) {
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
<a name="linkify_method"/>
|
|
185
|
-
|
|
186
|
-
#### linkify _(text: string, options?: NgxLinkifyOptions): string_
|
|
187
|
-
|
|
188
|
-
Convert a basic text string to a valid linkified text
|
|
189
|
-
|
|
190
|
-
**Params**
|
|
191
|
-
|
|
192
|
-
* **`text`** : _`String`_ Text to linkify --> to convert with links
|
|
193
|
-
* **`options`** : _`NgxLinkifyjsService`_ options to pass it to the linkifyjs library and it's optional
|
|
194
|
-
|
|
195
|
-
**Returns** _`String`_ converted text with links
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
```typescript
|
|
199
|
-
import {NgxLinkifyjsService, Link, LinkType, NgxLinkifyOptions} from 'ngx-linkifyjs';
|
|
200
|
-
|
|
201
|
-
constructor(public; NgxLinkifyjsService;) {
|
|
202
|
-
|
|
203
|
-
const options: NgxLinkifyOptions =
|
|
204
|
-
{
|
|
205
|
-
className: 'linkifiedYES',
|
|
206
|
-
target : {
|
|
207
|
-
url : '_self'
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
this.linkifyService.linkify('For help with GitHub.com, please email support@github.com');
|
|
212
|
-
// result 1 --> see below
|
|
213
|
-
|
|
214
|
-
this.linkifyService.linkify('For help with GitHub.com, please email support@github.com', options);
|
|
215
|
-
// result 2 --> see below
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
result 1
|
|
221
|
-
```typescript
|
|
222
|
-
'For help with <a href=\"http://github.com\" class=\"linkified\" target=\"_blank\">GitHub.com</a>, please email <a href=\"mailto:support@github.com\" class=\"linkified\">support@github.com</a>'
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
result 2
|
|
226
|
-
```typescript
|
|
227
|
-
'For help with <a href=\"http://github.com\" class=\"linkifiedYES\" target=\"_self\">GitHub.com</a>, please email <a href=\"mailto:support@github.com\" class=\"linkifiedYES\">support@github.com</a>'
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
#### `find` method
|
|
231
|
-
|
|
232
|
-
Finds all links in the given string
|
|
233
|
-
|
|
234
|
-
**Params**
|
|
235
|
-
|
|
236
|
-
* **`text`** : _`String`_ search text string
|
|
237
|
-
|
|
238
|
-
**Returns** _`Array<Link>`_ List of links where each element is a hash with properties type, value, and href:
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
* **type** is the type of entity found. Possible values are
|
|
242
|
-
- `'url'`
|
|
243
|
-
- `'email'`
|
|
244
|
-
- `'hashtag'` (if Hashtag is enabled via config/default `true`)
|
|
245
|
-
- `'mention'` (if Mention is enabled via config/default `true`)
|
|
246
|
-
* **value** is the original entity substring.
|
|
247
|
-
* **href** should be the value of this link's `href` attribute.
|
|
248
|
-
|
|
249
|
-
```typescript
|
|
250
|
-
import {Component, OnInit} from '@angular/core';
|
|
251
|
-
import {NgxLinkifyjsService, Link, LinkType} from 'ngx-linkifyjs';
|
|
252
|
-
|
|
253
|
-
@Component({
|
|
254
|
-
selector: 'app-home',
|
|
255
|
-
templateUrl: './home.component.html',
|
|
256
|
-
styleUrls: ['./home.component.scss']
|
|
257
|
-
})
|
|
258
|
-
export class HomeComponent {
|
|
259
|
-
|
|
260
|
-
constructor(public linkifyService: NgxLinkifyjsService) {
|
|
261
|
-
const foundLinks: Link[] = this.linkifyService.find('Any links to github.com here? If not, contact test@example.com');
|
|
262
|
-
|
|
263
|
-
// result - output --> see below
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
```typescript
|
|
270
|
-
// Result
|
|
271
|
-
[
|
|
272
|
-
{
|
|
273
|
-
type: LinkType.URL,
|
|
274
|
-
value: 'github.com',
|
|
275
|
-
href: 'http://github.com'
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
type: LinkType.EMAIL,
|
|
279
|
-
value: 'test@example.com',
|
|
280
|
-
href: 'mailto:test@example.com'
|
|
281
|
-
}
|
|
282
|
-
]
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
#### `test` method
|
|
286
|
-
|
|
287
|
-
Is the given string a link? Not to be used for strict validation - See [Caveats](caveats.html)
|
|
288
|
-
|
|
289
|
-
**Params**
|
|
290
|
-
|
|
291
|
-
* **`value`** : _`String`_ | _`Array<String>`_ Test string
|
|
292
|
-
|
|
293
|
-
**Returns** _`Boolean`_
|
|
294
|
-
|
|
295
|
-
```typescript
|
|
296
|
-
import {Component, OnInit} from '@angular/core';
|
|
297
|
-
import {NgxLinkifyjsService} from 'ngx-linkifyjs';
|
|
298
|
-
|
|
299
|
-
@Component({
|
|
300
|
-
selector: 'app-home',
|
|
301
|
-
templateUrl: './home.component.html',
|
|
302
|
-
styleUrls: ['./home.component.scss']
|
|
303
|
-
})
|
|
304
|
-
export class HomeComponent {
|
|
305
|
-
|
|
306
|
-
constructor(public linkifyService: NgxLinkifyjsService) {
|
|
307
|
-
this.linkifyService.test('github.com'); // return true
|
|
308
|
-
this.linkifyService.test('dev@example.com'); // return true
|
|
309
|
-
this.linkifyService.test(['github.com', 'email']); // return false
|
|
310
|
-
this.linkifyService.test('helloWorld'); // return false
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
<a name="config"/>
|
|
316
|
-
|
|
317
|
-
#### Enable/Disable the hash and mention
|
|
318
|
-
|
|
319
|
-
The config argument is 100% optional, otherwise we will take the default values `true`
|
|
320
|
-
|
|
321
|
-
```typescript
|
|
322
|
-
import { NgxLinkifyjsModule } from 'ngx-linkifyjs';
|
|
323
|
-
|
|
324
|
-
@NgModule({
|
|
325
|
-
declarations: [AppComponent, ...],
|
|
326
|
-
imports: [NgxLinkifyjsModule.forRoot(
|
|
327
|
-
{
|
|
328
|
-
enableHash: false, // optional - default true
|
|
329
|
-
enableMention: false // optional - default true
|
|
330
|
-
}), ...],
|
|
331
|
-
bootstrap: [AppComponent]
|
|
332
|
-
})
|
|
333
|
-
export class AppModule {
|
|
334
|
-
}
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
take a look @ [@angular-material-extensions/link-preview](https://github.com/angular-material-extensions/link-preview) which is using `ngx-linkifyjs`
|
|
338
|
-
|
|
339
|
-
## Run Demo App Locally
|
|
340
|
-
|
|
341
|
-
- [clone this repo](https://github.com/AnthonyNahas/ngx-linkifyjs.git) by running
|
|
342
|
-
```bash
|
|
343
|
-
$ git clone https://github.com/AnthonyNahas/ngx-linkifyjs.git
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
- setup the ngx-linkifyjs package
|
|
347
|
-
|
|
348
|
-
```bash
|
|
349
|
-
$ gulp steup
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
- navigate to the demo app directory
|
|
353
|
-
```bash
|
|
354
|
-
$ cd demo
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
- install the dependencies and run the app locally
|
|
358
|
-
```bash
|
|
359
|
-
$ npm i && npm start
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
- the app is now hosted by `http://localhost:4200/`
|
|
363
|
-
|
|
364
|
-
---
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
<a name="other-angular-libraries"/>
|
|
368
|
-
|
|
369
|
-
## Other Angular Libraries
|
|
370
|
-
- [ngx-auth-firebaseui](https://github.com/anthonynahas/ngx-auth-firebaseui)
|
|
371
|
-
- [@firebaseui/ng-bootstrap](https://github.com/firebaseui/ng-bootstrap)
|
|
372
|
-
- [@angular-material-extensions/password-strength](https://github.com/angular-material-extensions/password-strength)
|
|
373
|
-
- [@angular-material-extensions/link-preview](https://github.com/angular-material-extensions/link-preview)
|
|
374
|
-
- [@angular-material-extensions/select-country](https://github.com/angular-material-extensions/select-country)
|
|
375
|
-
- [@angular-material-extensions/pages](https://github.com/angular-material-extensions/pages)
|
|
376
|
-
- [@angular-material-extensions/contacts](https://github.com/angular-material-extensions/contacts)
|
|
377
|
-
- [@angular-material-extensions/faq](https://github.com/angular-material-extensions/faq)
|
|
378
|
-
- [@angular-material-extensions/jumbotron](https://github.com/angular-material-extensions/jumbotron)
|
|
379
|
-
- [@angular-material-extensions/google-maps-autocomplete](https://github.com/angular-material-extensions/google-maps-autocomplete)
|
|
380
|
-
- [@angular-material-extensions/combination-generator](https://github.com/angular-material-extensions/combination-generator)
|
|
381
|
-
|
|
382
|
-
---
|
|
383
|
-
|
|
384
|
-
<a name="support"/>
|
|
385
|
-
|
|
386
|
-
## Support
|
|
387
|
-
+ Drop an email to: [Anthony Nahas](mailto:anthony.na@hotmail.de)
|
|
388
|
-
+ or open an appropriate [issue](https://github.com/anthonynahas/ngx-linkifyjs/issues)
|
|
389
|
-
+ let us chat on [Gitter](https://gitter.im/angular-material-extensions/Lobby)
|
|
390
|
-
|
|
391
|
-
Built by and for developers :heart: we will help you :punch:
|
|
392
|
-
|
|
393
|
-
---
|
|
394
|
-
|
|
395
|
-
---
|
|
396
|
-
|
|
397
|
-

|
|
398
|
-
|
|
399
|
-
This project is supported by [jetbrains](https://www.jetbrains.com/) with 1 ALL PRODUCTS PACK OS LICENSE incl. [webstorm](https://www.jetbrains.com/webstorm)
|
|
400
|
-
|
|
401
|
-
---
|
|
402
|
-
|
|
403
|
-
<a name="license"/>
|
|
404
|
-
|
|
405
|
-
## License
|
|
406
|
-
|
|
407
|
-
Copyright (c) 2018 Anthony Nahas
|
|
408
|
-
Copyright (c) 2022 Ethan Gerardot
|
|
409
|
-
Licensed under the MIT License (MIT)
|
|
22
|
+
## Further help
|
|
410
23
|
|
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Pipe, Injectable, InjectionToken, NgModule
|
|
2
|
+
import { Pipe, Injectable, InjectionToken, NgModule } from '@angular/core';
|
|
3
3
|
import linkifyStr from 'linkify-string';
|
|
4
4
|
import * as linkify from 'linkifyjs';
|
|
5
|
-
import { CommonModule } from '@angular/common';
|
|
6
5
|
|
|
7
6
|
var LinkType;
|
|
8
7
|
(function (LinkType) {
|
|
@@ -16,13 +15,14 @@ class NgxLinkifyjsPipe {
|
|
|
16
15
|
transform(value, options) {
|
|
17
16
|
return value ? linkifyStr(value, options) : value;
|
|
18
17
|
}
|
|
19
|
-
static
|
|
20
|
-
static
|
|
18
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgxLinkifyjsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
19
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: NgxLinkifyjsPipe, isStandalone: true, name: "linkify" }); }
|
|
21
20
|
}
|
|
22
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgxLinkifyjsPipe, decorators: [{
|
|
23
22
|
type: Pipe,
|
|
24
23
|
args: [{
|
|
25
|
-
name: 'linkify'
|
|
24
|
+
name: 'linkify',
|
|
25
|
+
standalone: true
|
|
26
26
|
}]
|
|
27
27
|
}] });
|
|
28
28
|
|
|
@@ -57,18 +57,31 @@ class NgxLinkifyjsService {
|
|
|
57
57
|
}
|
|
58
58
|
return value.find(v => !linkify.test(v)) === undefined;
|
|
59
59
|
}
|
|
60
|
-
static
|
|
61
|
-
static
|
|
60
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgxLinkifyjsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
61
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgxLinkifyjsService }); }
|
|
62
62
|
}
|
|
63
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgxLinkifyjsService, decorators: [{
|
|
64
64
|
type: Injectable
|
|
65
65
|
}], ctorParameters: () => [] });
|
|
66
66
|
|
|
67
67
|
const NgxLinkifyjsConfigToken = new InjectionToken('NgxLinkifyjsConfig');
|
|
68
68
|
const DEFAULT_CONFIG = { enableHash: true, enableMention: true };
|
|
69
|
+
// Conditionally import plugins based on configuration
|
|
70
|
+
let pluginsLoaded = false;
|
|
71
|
+
function loadPlugins(config) {
|
|
72
|
+
if (pluginsLoaded)
|
|
73
|
+
return;
|
|
74
|
+
if (config?.enableHash) {
|
|
75
|
+
import('linkify-plugin-hashtag').catch(err => console.error('Failed to load hashtag plugin:', err));
|
|
76
|
+
}
|
|
77
|
+
if (config?.enableMention) {
|
|
78
|
+
import('linkify-plugin-mention').catch(err => console.error('Failed to load mention plugin:', err));
|
|
79
|
+
}
|
|
80
|
+
pluginsLoaded = true;
|
|
81
|
+
}
|
|
69
82
|
class NgxLinkifyjsModule {
|
|
70
|
-
config;
|
|
71
83
|
static forRoot(config = DEFAULT_CONFIG) {
|
|
84
|
+
loadPlugins(config);
|
|
72
85
|
return {
|
|
73
86
|
ngModule: NgxLinkifyjsModule,
|
|
74
87
|
providers: [
|
|
@@ -76,38 +89,21 @@ class NgxLinkifyjsModule {
|
|
|
76
89
|
{
|
|
77
90
|
provide: NgxLinkifyjsConfigToken,
|
|
78
91
|
useValue: config
|
|
79
|
-
}
|
|
92
|
+
}
|
|
80
93
|
]
|
|
81
94
|
};
|
|
82
95
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
// if (config.enableHash) {
|
|
87
|
-
// hashtag(linkify);
|
|
88
|
-
// }
|
|
89
|
-
//
|
|
90
|
-
// if (config.enableMention) {
|
|
91
|
-
// mention(linkify);
|
|
92
|
-
// }
|
|
93
|
-
}
|
|
94
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NgxLinkifyjsModule, deps: [{ token: NgxLinkifyjsConfigToken }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
95
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: NgxLinkifyjsModule, declarations: [NgxLinkifyjsPipe], imports: [CommonModule], exports: [NgxLinkifyjsPipe] });
|
|
96
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NgxLinkifyjsModule, imports: [CommonModule] });
|
|
96
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgxLinkifyjsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
97
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: NgxLinkifyjsModule, imports: [NgxLinkifyjsPipe], exports: [NgxLinkifyjsPipe] }); }
|
|
98
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgxLinkifyjsModule }); }
|
|
97
99
|
}
|
|
98
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgxLinkifyjsModule, decorators: [{
|
|
99
101
|
type: NgModule,
|
|
100
102
|
args: [{
|
|
101
|
-
imports: [
|
|
102
|
-
|
|
103
|
-
],
|
|
104
|
-
exports: [NgxLinkifyjsPipe],
|
|
105
|
-
declarations: [NgxLinkifyjsPipe]
|
|
103
|
+
imports: [NgxLinkifyjsPipe],
|
|
104
|
+
exports: [NgxLinkifyjsPipe]
|
|
106
105
|
}]
|
|
107
|
-
}]
|
|
108
|
-
type: Inject,
|
|
109
|
-
args: [NgxLinkifyjsConfigToken]
|
|
110
|
-
}] }] });
|
|
106
|
+
}] });
|
|
111
107
|
|
|
112
108
|
/*
|
|
113
109
|
* Public API Surface of ngx-linkifyjs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-name-jack-ngx-linkifyjs.mjs","sources":["../../../projects/ngx-linkifyjs-v2/src/lib/enum/linktype.enum.ts","../../../projects/ngx-linkifyjs-v2/src/lib/pipes/ngx-linkifyjs.pipe.ts","../../../projects/ngx-linkifyjs-v2/src/lib/service/ngx-linkifyjs.service.ts","../../../projects/ngx-linkifyjs-v2/src/lib/ngx-linkifyjs.module.ts","../../../projects/ngx-linkifyjs-v2/src/public-api.ts","../../../projects/ngx-linkifyjs-v2/src/code-name-jack-ngx-linkifyjs.ts"],"sourcesContent":["export enum LinkType {\n URL = 'url',\n HASHTAG = 'hashtag',\n MENTION = 'mention',\n EMAIL = 'email',\n}\n","import {Pipe, PipeTransform} from '@angular/core';\nimport {NgxLinkifyOptions} from '../interfaces/ngx-linkifyjs.interface';\nimport linkifyStr from 'linkify-string';\n\n@Pipe({\n name: 'linkify'\n})\nexport class NgxLinkifyjsPipe implements PipeTransform {\n\n transform(value: string, options?: NgxLinkifyOptions): string {\n return value ? linkifyStr(value, options) : value;\n }\n\n}\n","import {Injectable} from '@angular/core';\nimport * as linkify from 'linkifyjs';\nimport linkifyStr from 'linkify-string';\nimport {Link, NgxLinkifyOptions} from '../interfaces/ngx-linkifyjs.interface';\n\n@Injectable()\nexport class NgxLinkifyjsService {\n constructor() {\n }\n\n /**\n * Convert the passed text as a string to an appropriate url\n *\n * @param text - the string to convert\n * @param options - options to pass it to the linkifyjs library\n */\n linkify(text: string, options?: NgxLinkifyOptions): string {\n return linkifyStr(text, options);\n }\n\n /**\n * Find any links in a given text as a string\n *\n * @param text - the string to find some links\n */\n find(text: string): Array<Link> {\n return linkify.find(text);\n }\n\n /**\n * Test if a given value is a link or an array of all links\n *\n * @param value - the value to test\n */\n test(value: string | string[]): boolean {\n if (typeof value === 'string') {\n return linkify.test(value);\n }\n return value.find(v => !linkify.test(v)) === undefined;\n }\n\n}\n","import {
|
|
1
|
+
{"version":3,"file":"code-name-jack-ngx-linkifyjs.mjs","sources":["../../../projects/ngx-linkifyjs-v2/src/lib/enum/linktype.enum.ts","../../../projects/ngx-linkifyjs-v2/src/lib/pipes/ngx-linkifyjs.pipe.ts","../../../projects/ngx-linkifyjs-v2/src/lib/service/ngx-linkifyjs.service.ts","../../../projects/ngx-linkifyjs-v2/src/lib/ngx-linkifyjs.module.ts","../../../projects/ngx-linkifyjs-v2/src/public-api.ts","../../../projects/ngx-linkifyjs-v2/src/code-name-jack-ngx-linkifyjs.ts"],"sourcesContent":["export enum LinkType {\n URL = 'url',\n HASHTAG = 'hashtag',\n MENTION = 'mention',\n EMAIL = 'email',\n}\n","import {Pipe, PipeTransform} from '@angular/core';\nimport {NgxLinkifyOptions} from '../interfaces/ngx-linkifyjs.interface';\nimport linkifyStr from 'linkify-string';\n\n@Pipe({\n name: 'linkify',\n standalone: true\n})\nexport class NgxLinkifyjsPipe implements PipeTransform {\n\n transform(value: string, options?: NgxLinkifyOptions): string {\n return value ? linkifyStr(value, options) : value;\n }\n\n}\n","import {Injectable} from '@angular/core';\nimport * as linkify from 'linkifyjs';\nimport linkifyStr from 'linkify-string';\nimport {Link, NgxLinkifyOptions} from '../interfaces/ngx-linkifyjs.interface';\n\n@Injectable()\nexport class NgxLinkifyjsService {\n constructor() {\n }\n\n /**\n * Convert the passed text as a string to an appropriate url\n *\n * @param text - the string to convert\n * @param options - options to pass it to the linkifyjs library\n */\n linkify(text: string, options?: NgxLinkifyOptions): string {\n return linkifyStr(text, options);\n }\n\n /**\n * Find any links in a given text as a string\n *\n * @param text - the string to find some links\n */\n find(text: string): Array<Link> {\n return linkify.find(text);\n }\n\n /**\n * Test if a given value is a link or an array of all links\n *\n * @param value - the value to test\n */\n test(value: string | string[]): boolean {\n if (typeof value === 'string') {\n return linkify.test(value);\n }\n return value.find(v => !linkify.test(v)) === undefined;\n }\n\n}\n","import {InjectionToken, ModuleWithProviders, NgModule} from '@angular/core';\n\nimport {NgxLinkifyjsService} from './service/ngx-linkifyjs.service';\nimport {NgxLinkifyjsPipe} from './pipes/ngx-linkifyjs.pipe';\n\n// Export module's public API\nexport {Link} from './interfaces/ngx-linkifyjs.interface';\nimport {NgxLinkifyjsConfig} from './interfaces/ngx-linkifyjs.interface';\n\nexport {LinkType} from './enum/linktype.enum';\nexport {NgxLinkifyOptions} from './interfaces/ngx-linkifyjs.interface';\nexport {NgxLinkifyjsPipe} from './pipes/ngx-linkifyjs.pipe';\nexport {NgxLinkifyjsService} from './service/ngx-linkifyjs.service';\n\nexport const NgxLinkifyjsConfigToken = new InjectionToken<NgxLinkifyjsConfig>('NgxLinkifyjsConfig');\nexport const DEFAULT_CONFIG: NgxLinkifyjsConfig = {enableHash: true, enableMention: true};\n\n// Conditionally import plugins based on configuration\nlet pluginsLoaded = false;\n\nfunction loadPlugins(config: NgxLinkifyjsConfig) {\n if (pluginsLoaded) return;\n \n if (config?.enableHash) {\n import('linkify-plugin-hashtag').catch(err => console.error('Failed to load hashtag plugin:', err));\n }\n\n if (config?.enableMention) {\n import('linkify-plugin-mention').catch(err => console.error('Failed to load mention plugin:', err));\n }\n \n pluginsLoaded = true;\n}\n\n@NgModule({\n imports: [NgxLinkifyjsPipe],\n exports: [NgxLinkifyjsPipe]\n})\nexport class NgxLinkifyjsModule {\n\n static forRoot(config: NgxLinkifyjsConfig = DEFAULT_CONFIG): ModuleWithProviders<NgxLinkifyjsModule> {\n loadPlugins(config);\n \n return {\n ngModule: NgxLinkifyjsModule,\n providers: [\n NgxLinkifyjsService,\n {\n provide: NgxLinkifyjsConfigToken,\n useValue: config\n }\n ]\n };\n }\n\n}\n","/*\n * Public API Surface of ngx-linkifyjs\n */\n\nexport * from './lib/enum/linktype.enum';\nexport * from './lib/interfaces/ngx-linkifyjs.interface';\nexport * from './lib/pipes/ngx-linkifyjs.pipe';\nexport * from './lib/service/ngx-linkifyjs.service';\nexport * from './lib/ngx-linkifyjs.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;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AA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAlB,kBAAkB,EAAA,OAAA,EAAA,CAHnB,gBAAgB,CAAA,EAAA,OAAA,EAAA,CAChB,gBAAgB,CAAA,EAAA,CAAA,CAAA;+GAEf,kBAAkB,EAAA,CAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,gBAAgB,CAAC;oBAC3B,OAAO,EAAE,CAAC,gBAAgB;AAC3B,iBAAA;;;ACrCD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { PipeTransform, InjectionToken, ModuleWithProviders } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
declare enum LinkType {
|
|
5
|
+
URL = "url",
|
|
6
|
+
HASHTAG = "hashtag",
|
|
7
|
+
MENTION = "mention",
|
|
8
|
+
EMAIL = "email"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface Link {
|
|
12
|
+
type: string;
|
|
13
|
+
value: string;
|
|
14
|
+
href: string;
|
|
15
|
+
}
|
|
16
|
+
interface NgxLinkifyjsConfig {
|
|
17
|
+
enableHash?: boolean;
|
|
18
|
+
enableMention?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface NgxLinkifyOptions {
|
|
21
|
+
attributes?: any;
|
|
22
|
+
className?: string;
|
|
23
|
+
defaultProtocol?: string;
|
|
24
|
+
events?: any;
|
|
25
|
+
ignoreTags?: Array<any>;
|
|
26
|
+
nl2br?: boolean;
|
|
27
|
+
tagName?: string;
|
|
28
|
+
target?: {
|
|
29
|
+
url: string;
|
|
30
|
+
};
|
|
31
|
+
validate?: boolean;
|
|
32
|
+
format?(value: any, type: any): any;
|
|
33
|
+
formatHref?(href: any, type: any): any;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare class NgxLinkifyjsPipe implements PipeTransform {
|
|
37
|
+
transform(value: string, options?: NgxLinkifyOptions): string;
|
|
38
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxLinkifyjsPipe, never>;
|
|
39
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<NgxLinkifyjsPipe, "linkify", true>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare class NgxLinkifyjsService {
|
|
43
|
+
constructor();
|
|
44
|
+
/**
|
|
45
|
+
* Convert the passed text as a string to an appropriate url
|
|
46
|
+
*
|
|
47
|
+
* @param text - the string to convert
|
|
48
|
+
* @param options - options to pass it to the linkifyjs library
|
|
49
|
+
*/
|
|
50
|
+
linkify(text: string, options?: NgxLinkifyOptions): string;
|
|
51
|
+
/**
|
|
52
|
+
* Find any links in a given text as a string
|
|
53
|
+
*
|
|
54
|
+
* @param text - the string to find some links
|
|
55
|
+
*/
|
|
56
|
+
find(text: string): Array<Link>;
|
|
57
|
+
/**
|
|
58
|
+
* Test if a given value is a link or an array of all links
|
|
59
|
+
*
|
|
60
|
+
* @param value - the value to test
|
|
61
|
+
*/
|
|
62
|
+
test(value: string | string[]): boolean;
|
|
63
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxLinkifyjsService, never>;
|
|
64
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NgxLinkifyjsService>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
declare const NgxLinkifyjsConfigToken: InjectionToken<NgxLinkifyjsConfig>;
|
|
68
|
+
declare const DEFAULT_CONFIG: NgxLinkifyjsConfig;
|
|
69
|
+
declare class NgxLinkifyjsModule {
|
|
70
|
+
static forRoot(config?: NgxLinkifyjsConfig): ModuleWithProviders<NgxLinkifyjsModule>;
|
|
71
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxLinkifyjsModule, never>;
|
|
72
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxLinkifyjsModule, never, [typeof NgxLinkifyjsPipe], [typeof NgxLinkifyjsPipe]>;
|
|
73
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<NgxLinkifyjsModule>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { DEFAULT_CONFIG, LinkType, NgxLinkifyjsConfigToken, NgxLinkifyjsModule, NgxLinkifyjsPipe, NgxLinkifyjsService };
|
|
77
|
+
export type { Link, NgxLinkifyOptions, NgxLinkifyjsConfig };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-name-jack/ngx-linkifyjs",
|
|
3
3
|
"description": "Angular wrapper for linkifyjs(v4) - library for finding links in plain text and converting them to HTML <a> tags via linkifyjs",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "20.0.0",
|
|
5
5
|
"homepage": "https://github.com/code-name-jack/ngx-linkifyjs-v2",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Code Name Jack",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"node": ">=18.0.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@angular/common": "
|
|
38
|
-
"@angular/core": "
|
|
39
|
-
"@schematics/angular": "
|
|
37
|
+
"@angular/common": "^20.0.0",
|
|
38
|
+
"@angular/core": "^20.0.0",
|
|
39
|
+
"@schematics/angular": "^20.0.0",
|
|
40
40
|
"linkify-plugin-hashtag": "^4.0.2",
|
|
41
41
|
"linkify-plugin-mention": "^4.0.2",
|
|
42
42
|
"linkify-string": "^4.0.2",
|
|
@@ -69,57 +69,6 @@
|
|
|
69
69
|
"before:npm": "echo building the library..."
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
|
-
"globals": {
|
|
73
|
-
"ts-jest": {
|
|
74
|
-
"tsConfig": "<rootDir>/tsconfig.spec.json",
|
|
75
|
-
"stringifyContentPathRegex": "\\.html$",
|
|
76
|
-
"astTransformers": [
|
|
77
|
-
"jest-preset-angular/build/InlineFilesTransformer",
|
|
78
|
-
"jest-preset-angular/build/StripStylesTransformer"
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
"greenkeeper": {
|
|
83
|
-
"ignore": [
|
|
84
|
-
"@angular/core",
|
|
85
|
-
"@angular/common",
|
|
86
|
-
"@angular/compiler",
|
|
87
|
-
"@angular/platform-server",
|
|
88
|
-
"@angular/platform-browser",
|
|
89
|
-
"@angular/platform-browser-dynamic",
|
|
90
|
-
"@angular/compiler-cli",
|
|
91
|
-
"zone.js",
|
|
92
|
-
"rxjs",
|
|
93
|
-
"tslint",
|
|
94
|
-
"gulp-tslint",
|
|
95
|
-
"typescript",
|
|
96
|
-
"awesome-typescript-loader",
|
|
97
|
-
"codelyzer",
|
|
98
|
-
"@angular/animations",
|
|
99
|
-
"linkifyjs",
|
|
100
|
-
"@types/jasmine",
|
|
101
|
-
"@types/jest",
|
|
102
|
-
"@types/node",
|
|
103
|
-
"conventional-github-releaser",
|
|
104
|
-
"rollup-plugin-uglify"
|
|
105
|
-
]
|
|
106
|
-
},
|
|
107
|
-
"commitplease": {
|
|
108
|
-
"style": "angular",
|
|
109
|
-
"types": [
|
|
110
|
-
"feat",
|
|
111
|
-
"fix",
|
|
112
|
-
"docs",
|
|
113
|
-
"style",
|
|
114
|
-
"refactor",
|
|
115
|
-
"perf",
|
|
116
|
-
"test",
|
|
117
|
-
"chore",
|
|
118
|
-
"revert",
|
|
119
|
-
"demo"
|
|
120
|
-
],
|
|
121
|
-
"scope": "\\S+.*"
|
|
122
|
-
},
|
|
123
72
|
"module": "fesm2022/code-name-jack-ngx-linkifyjs.mjs",
|
|
124
73
|
"typings": "index.d.ts",
|
|
125
74
|
"exports": {
|
|
@@ -128,8 +77,6 @@
|
|
|
128
77
|
},
|
|
129
78
|
".": {
|
|
130
79
|
"types": "./index.d.ts",
|
|
131
|
-
"esm2022": "./esm2022/code-name-jack-ngx-linkifyjs.mjs",
|
|
132
|
-
"esm": "./esm2022/code-name-jack-ngx-linkifyjs.mjs",
|
|
133
80
|
"default": "./fesm2022/code-name-jack-ngx-linkifyjs.mjs"
|
|
134
81
|
}
|
|
135
82
|
},
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated bundle index. Do not edit.
|
|
3
|
-
*/
|
|
4
|
-
export * from './public-api';
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29kZS1uYW1lLWphY2stbmd4LWxpbmtpZnlqcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL25neC1saW5raWZ5anMtdjIvc3JjL2NvZGUtbmFtZS1qYWNrLW5neC1saW5raWZ5anMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export var LinkType;
|
|
2
|
-
(function (LinkType) {
|
|
3
|
-
LinkType["URL"] = "url";
|
|
4
|
-
LinkType["HASHTAG"] = "hashtag";
|
|
5
|
-
LinkType["MENTION"] = "mention";
|
|
6
|
-
LinkType["EMAIL"] = "email";
|
|
7
|
-
})(LinkType || (LinkType = {}));
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlua3R5cGUuZW51bS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY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YWNlIE5neExpbmtpZnlPcHRpb25zIHtcbiAgYXR0cmlidXRlcz86IGFueTtcbiAgY2xhc3NOYW1lPzogc3RyaW5nO1xuICBkZWZhdWx0UHJvdG9jb2w/OiBzdHJpbmc7XG4gIGV2ZW50cz86IGFueTtcbiAgaWdub3JlVGFncz86IEFycmF5PGFueT47XG4gIG5sMmJyPzogYm9vbGVhbjtcbiAgdGFnTmFtZT86IHN0cmluZztcbiAgdGFyZ2V0PzogeyB1cmw6IHN0cmluZyB9O1xuICB2YWxpZGF0ZT86IGJvb2xlYW47XG5cbiAgZm9ybWF0Pyh2YWx1ZTogYW55LCB0eXBlOiBhbnkpOiBhbnk7XG5cbiAgZm9ybWF0SHJlZj8oaHJlZjogYW55LCB0eXBlOiBhbnkpOiBhbnk7XG59XG4iXX0=
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { Inject, InjectionToken, NgModule } from '@angular/core';
|
|
3
|
-
// TODO REMOVE ME
|
|
4
|
-
// import * as linkify from 'linkifyjs';
|
|
5
|
-
// import hashtag from 'linkify-plugin-hashtag';
|
|
6
|
-
// import mention from 'linkify-plugin-mention';
|
|
7
|
-
import { NgxLinkifyjsService } from './service/ngx-linkifyjs.service';
|
|
8
|
-
import { NgxLinkifyjsPipe } from './pipes/ngx-linkifyjs.pipe';
|
|
9
|
-
import * as i0 from "@angular/core";
|
|
10
|
-
export { LinkType } from './enum/linktype.enum';
|
|
11
|
-
export { NgxLinkifyjsPipe } from './pipes/ngx-linkifyjs.pipe';
|
|
12
|
-
export { NgxLinkifyjsService } from './service/ngx-linkifyjs.service';
|
|
13
|
-
export const NgxLinkifyjsConfigToken = new InjectionToken('NgxLinkifyjsConfig');
|
|
14
|
-
export const DEFAULT_CONFIG = { enableHash: true, enableMention: true };
|
|
15
|
-
export class NgxLinkifyjsModule {
|
|
16
|
-
config;
|
|
17
|
-
static forRoot(config = DEFAULT_CONFIG) {
|
|
18
|
-
return {
|
|
19
|
-
ngModule: NgxLinkifyjsModule,
|
|
20
|
-
providers: [
|
|
21
|
-
NgxLinkifyjsService,
|
|
22
|
-
{
|
|
23
|
-
provide: NgxLinkifyjsConfigToken,
|
|
24
|
-
useValue: config
|
|
25
|
-
},
|
|
26
|
-
]
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
constructor(config) {
|
|
30
|
-
this.config = config;
|
|
31
|
-
// TODO REMOVE ME
|
|
32
|
-
// if (config.enableHash) {
|
|
33
|
-
// hashtag(linkify);
|
|
34
|
-
// }
|
|
35
|
-
//
|
|
36
|
-
// if (config.enableMention) {
|
|
37
|
-
// mention(linkify);
|
|
38
|
-
// }
|
|
39
|
-
}
|
|
40
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NgxLinkifyjsModule, deps: [{ token: NgxLinkifyjsConfigToken }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
41
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: NgxLinkifyjsModule, declarations: [NgxLinkifyjsPipe], imports: [CommonModule], exports: [NgxLinkifyjsPipe] });
|
|
42
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NgxLinkifyjsModule, imports: [CommonModule] });
|
|
43
|
-
}
|
|
44
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NgxLinkifyjsModule, decorators: [{
|
|
45
|
-
type: NgModule,
|
|
46
|
-
args: [{
|
|
47
|
-
imports: [
|
|
48
|
-
CommonModule
|
|
49
|
-
],
|
|
50
|
-
exports: [NgxLinkifyjsPipe],
|
|
51
|
-
declarations: [NgxLinkifyjsPipe]
|
|
52
|
-
}]
|
|
53
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
54
|
-
type: Inject,
|
|
55
|
-
args: [Ng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XG4gIH1cblxufVxuIl19
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Pipe } from '@angular/core';
|
|
2
|
-
import linkifyStr from 'linkify-string';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export class NgxLinkifyjsPipe {
|
|
5
|
-
transform(value, options) {
|
|
6
|
-
return value ? linkifyStr(value, options) : value;
|
|
7
|
-
}
|
|
8
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NgxLinkifyjsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
9
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: NgxLinkifyjsPipe, name: "linkify" });
|
|
10
|
-
}
|
|
11
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NgxLinkifyjsPipe, decorators: [{
|
|
12
|
-
type: Pipe,
|
|
13
|
-
args: [{
|
|
14
|
-
name: 'linkify'
|
|
15
|
-
}]
|
|
16
|
-
}] });
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWxpbmtpZnlqcy5waXBlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LWxpbmtpZnlqcy12Mi9zcmMvbGliL3BpcGVzL25neC1saW5raWZ5anMucGlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUMsSUFBSSxFQUFnQixNQUFNLGVBQWUsQ0FBQztBQUVsRCxPQUFPLFVBQVUsTUFBTSxnQkFBZ0IsQ0FBQzs7QUFLeEMsTUFBTSxPQUFPLGdCQUFnQjtJQUUzQixTQUFTLENBQUMsS0FBYSxFQUFFLE9BQTJCO1FBQ2xELE9BQU8sS0FBSyxDQUFDLENBQUMsQ0FBQyxVQUFVLENBQUMsS0FBSyxFQUFFLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUM7SUFDcEQsQ0FBQzt1R0FKVSxnQkFBZ0I7cUdBQWhCLGdCQUFnQjs7MkZBQWhCLGdCQUFnQjtrQkFINUIsSUFBSTttQkFBQztvQkFDSixJQUFJLEVBQUUsU0FBUztpQkFDaEIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQge1BpcGUsIFBpcGVUcmFuc2Zvcm19IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHtOZ3hMaW5raWZ5T3B0aW9uc30gZnJvbSAnLi4vaW50ZXJmYWNlcy9uZ3gtbGlua2lmeWpzLmludGVyZmFjZSc7XG5pbXBvcnQgbGlua2lmeVN0ciBmcm9tICdsaW5raWZ5LXN0cmluZyc7XG5cbkBQaXBlKHtcbiAgbmFtZTogJ2xpbmtpZnknXG59KVxuZXhwb3J0IGNsYXNzIE5neExpbmtpZnlqc1BpcGUgaW1wbGVtZW50cyBQaXBlVHJhbnNmb3JtIHtcblxuICB0cmFuc2Zvcm0odmFsdWU6IHN0cmluZywgb3B0aW9ucz86IE5neExpbmtpZnlPcHRpb25zKTogc3RyaW5nIHtcbiAgICByZXR1cm4gdmFsdWUgPyBsaW5raWZ5U3RyKHZhbHVlLCBvcHRpb25zKSA6IHZhbHVlO1xuICB9XG5cbn1cbiJdfQ==
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import * as linkify from 'linkifyjs';
|
|
3
|
-
import linkifyStr from 'linkify-string';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
export class NgxLinkifyjsService {
|
|
6
|
-
constructor() {
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Convert the passed text as a string to an appropriate url
|
|
10
|
-
*
|
|
11
|
-
* @param text - the string to convert
|
|
12
|
-
* @param options - options to pass it to the linkifyjs library
|
|
13
|
-
*/
|
|
14
|
-
linkify(text, options) {
|
|
15
|
-
return linkifyStr(text, options);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Find any links in a given text as a string
|
|
19
|
-
*
|
|
20
|
-
* @param text - the string to find some links
|
|
21
|
-
*/
|
|
22
|
-
find(text) {
|
|
23
|
-
return linkify.find(text);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Test if a given value is a link or an array of all links
|
|
27
|
-
*
|
|
28
|
-
* @param value - the value to test
|
|
29
|
-
*/
|
|
30
|
-
test(value) {
|
|
31
|
-
if (typeof value === 'string') {
|
|
32
|
-
return linkify.test(value);
|
|
33
|
-
}
|
|
34
|
-
return value.find(v => !linkify.test(v)) === undefined;
|
|
35
|
-
}
|
|
36
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NgxLinkifyjsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
37
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NgxLinkifyjsService });
|
|
38
|
-
}
|
|
39
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: NgxLinkifyjsService, decorators: [{
|
|
40
|
-
type: Injectable
|
|
41
|
-
}], ctorParameters: () => [] });
|
|
42
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWxpbmtpZnlqcy5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LWxpbmtpZnlqcy12Mi9zcmMvbGliL3NlcnZpY2Uvbmd4LWxpbmtpZnlqcy5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQy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HZhbHVlID09PSAnc3RyaW5nJykge1xuICAgICAgcmV0dXJuIGxpbmtpZnkudGVzdCh2YWx1ZSk7XG4gICAgfVxuICAgIHJldHVybiB2YWx1ZS5maW5kKHYgPT4gIWxpbmtpZnkudGVzdCh2KSkgPT09IHVuZGVmaW5lZDtcbiAgfVxuXG59XG4iXX0=
|
package/esm2022/public-api.mjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Public API Surface of ngx-linkifyjs
|
|
3
|
-
*/
|
|
4
|
-
export * from './lib/enum/linktype.enum';
|
|
5
|
-
export * from './lib/interfaces/ngx-linkifyjs.interface';
|
|
6
|
-
export * from './lib/pipes/ngx-linkifyjs.pipe';
|
|
7
|
-
export * from './lib/service/ngx-linkifyjs.service';
|
|
8
|
-
export * from './lib/ngx-linkifyjs.module';
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL25neC1saW5raWZ5anMtdjIvc3JjL3B1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMsMENBQTBDLENBQUM7QUFDekQsY0FBYyxnQ0FBZ0MsQ0FBQztBQUMvQyxjQUFjLHFDQUFxQyxDQUFDO0FBQ3BELGNBQWMsNEJBQTRCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIG5neC1saW5raWZ5anNcbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2xpYi9lbnVtL2xpbmt0eXBlLmVudW0nO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvaW50ZXJmYWNlcy9uZ3gtbGlua2lmeWpzLmludGVyZmFjZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9waXBlcy9uZ3gtbGlua2lmeWpzLnBpcGUnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvc2VydmljZS9uZ3gtbGlua2lmeWpzLnNlcnZpY2UnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LWxpbmtpZnlqcy5tb2R1bGUnO1xuIl19
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface Link {
|
|
2
|
-
type: string;
|
|
3
|
-
value: string;
|
|
4
|
-
href: string;
|
|
5
|
-
}
|
|
6
|
-
export interface NgxLinkifyjsConfig {
|
|
7
|
-
enableHash?: boolean;
|
|
8
|
-
enableMention?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface NgxLinkifyOptions {
|
|
11
|
-
attributes?: any;
|
|
12
|
-
className?: string;
|
|
13
|
-
defaultProtocol?: string;
|
|
14
|
-
events?: any;
|
|
15
|
-
ignoreTags?: Array<any>;
|
|
16
|
-
nl2br?: boolean;
|
|
17
|
-
tagName?: string;
|
|
18
|
-
target?: {
|
|
19
|
-
url: string;
|
|
20
|
-
};
|
|
21
|
-
validate?: boolean;
|
|
22
|
-
format?(value: any, type: any): any;
|
|
23
|
-
formatHref?(href: any, type: any): any;
|
|
24
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, ModuleWithProviders } from '@angular/core';
|
|
2
|
-
import { NgxLinkifyjsConfig } from './interfaces/ngx-linkifyjs.interface';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "./pipes/ngx-linkifyjs.pipe";
|
|
5
|
-
import * as i2 from "@angular/common";
|
|
6
|
-
export { Link } from './interfaces/ngx-linkifyjs.interface';
|
|
7
|
-
export { LinkType } from './enum/linktype.enum';
|
|
8
|
-
export { NgxLinkifyOptions } from './interfaces/ngx-linkifyjs.interface';
|
|
9
|
-
export { NgxLinkifyjsPipe } from './pipes/ngx-linkifyjs.pipe';
|
|
10
|
-
export { NgxLinkifyjsService } from './service/ngx-linkifyjs.service';
|
|
11
|
-
export declare const NgxLinkifyjsConfigToken: InjectionToken<NgxLinkifyjsConfig>;
|
|
12
|
-
export declare const DEFAULT_CONFIG: NgxLinkifyjsConfig;
|
|
13
|
-
export declare class NgxLinkifyjsModule {
|
|
14
|
-
config: NgxLinkifyjsConfig;
|
|
15
|
-
static forRoot(config?: NgxLinkifyjsConfig): ModuleWithProviders<NgxLinkifyjsModule>;
|
|
16
|
-
constructor(config: NgxLinkifyjsConfig);
|
|
17
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgxLinkifyjsModule, never>;
|
|
18
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxLinkifyjsModule, [typeof i1.NgxLinkifyjsPipe], [typeof i2.CommonModule], [typeof i1.NgxLinkifyjsPipe]>;
|
|
19
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<NgxLinkifyjsModule>;
|
|
20
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PipeTransform } from '@angular/core';
|
|
2
|
-
import { NgxLinkifyOptions } from '../interfaces/ngx-linkifyjs.interface';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class NgxLinkifyjsPipe implements PipeTransform {
|
|
5
|
-
transform(value: string, options?: NgxLinkifyOptions): string;
|
|
6
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgxLinkifyjsPipe, never>;
|
|
7
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<NgxLinkifyjsPipe, "linkify", false>;
|
|
8
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Link, NgxLinkifyOptions } from '../interfaces/ngx-linkifyjs.interface';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class NgxLinkifyjsService {
|
|
4
|
-
constructor();
|
|
5
|
-
/**
|
|
6
|
-
* Convert the passed text as a string to an appropriate url
|
|
7
|
-
*
|
|
8
|
-
* @param text - the string to convert
|
|
9
|
-
* @param options - options to pass it to the linkifyjs library
|
|
10
|
-
*/
|
|
11
|
-
linkify(text: string, options?: NgxLinkifyOptions): string;
|
|
12
|
-
/**
|
|
13
|
-
* Find any links in a given text as a string
|
|
14
|
-
*
|
|
15
|
-
* @param text - the string to find some links
|
|
16
|
-
*/
|
|
17
|
-
find(text: string): Array<Link>;
|
|
18
|
-
/**
|
|
19
|
-
* Test if a given value is a link or an array of all links
|
|
20
|
-
*
|
|
21
|
-
* @param value - the value to test
|
|
22
|
-
*/
|
|
23
|
-
test(value: string | string[]): boolean;
|
|
24
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgxLinkifyjsService, never>;
|
|
25
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<NgxLinkifyjsService>;
|
|
26
|
-
}
|
package/public-api.d.ts
DELETED