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

|
|
399
|
+
|
|
400
|
+
This project is supported by [jetbrains](https://www.jetbrains.com/) with 1 ALL PRODUCTS PACK OS LICENSE incl. [webstorm](https://www.jetbrains.com/webstorm)
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
<a name="license"/>
|
|
405
|
+
|
|
406
|
+
## License
|
|
407
|
+
|
|
408
|
+
Copyright (c) 2018 Anthony Nahas
|
|
409
|
+
Copyright (c) 2022 Ethan Gerardot
|
|
410
|
+
Licensed under the MIT License (MIT)
|
|
411
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-name-jack-ngx-linkifyjs.d.ts","sourceRoot":"","sources":["../../projects/ngx-linkifyjs-v2/src/code-name-jack-ngx-linkifyjs.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './public-api';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29kZS1uYW1lLWphY2stbmd4LWxpbmtpZnlqcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL25neC1saW5raWZ5anMtdjIvc3JjL2NvZGUtbmFtZS1qYWNrLW5neC1saW5raWZ5anMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
|
|
@@ -0,0 +1,8 @@
|
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlua3R5cGUuZW51bS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1saW5raWZ5anMtdjIvc3JjL2xpYi9lbnVtL2xpbmt0eXBlLmVudW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxDQUFOLElBQVksUUFLWDtBQUxELFdBQVksUUFBUTtJQUNsQix1QkFBVyxDQUFBO0lBQ1gsK0JBQW1CLENBQUE7SUFDbkIsK0JBQW1CLENBQUE7SUFDbkIsMkJBQWUsQ0FBQTtBQUNqQixDQUFDLEVBTFcsUUFBUSxLQUFSLFFBQVEsUUFLbkIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZW51bSBMaW5rVHlwZSB7XG4gIFVSTCA9ICd1cmwnLFxuICBIQVNI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lZj8oaHJlZjogYW55LCB0eXBlOiBhbnkpOiBhbnk7XG59XG4iXX0=
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
constructor(config) {
|
|
17
|
+
this.config = config;
|
|
18
|
+
// TODO REMOVE ME
|
|
19
|
+
// if (config.enableHash) {
|
|
20
|
+
// hashtag(linkify);
|
|
21
|
+
// }
|
|
22
|
+
//
|
|
23
|
+
// if (config.enableMention) {
|
|
24
|
+
// mention(linkify);
|
|
25
|
+
// }
|
|
26
|
+
}
|
|
27
|
+
static forRoot(config = DEFAULT_CONFIG) {
|
|
28
|
+
return {
|
|
29
|
+
ngModule: NgxLinkifyjsModule,
|
|
30
|
+
providers: [
|
|
31
|
+
NgxLinkifyjsService,
|
|
32
|
+
{
|
|
33
|
+
provide: NgxLinkifyjsConfigToken,
|
|
34
|
+
useValue: config
|
|
35
|
+
},
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
NgxLinkifyjsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsModule, deps: [{ token: NgxLinkifyjsConfigToken }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
41
|
+
NgxLinkifyjsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsModule, declarations: [NgxLinkifyjsPipe], imports: [CommonModule], exports: [NgxLinkifyjsPipe] });
|
|
42
|
+
NgxLinkifyjsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsModule, imports: [CommonModule] });
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsModule, decorators: [{
|
|
44
|
+
type: NgModule,
|
|
45
|
+
args: [{
|
|
46
|
+
imports: [
|
|
47
|
+
CommonModule
|
|
48
|
+
],
|
|
49
|
+
exports: [NgxLinkifyjsPipe],
|
|
50
|
+
declarations: [NgxLinkifyjsPipe]
|
|
51
|
+
}]
|
|
52
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
53
|
+
type: Inject,
|
|
54
|
+
args: [NgxLinkifyjsConfigToken]
|
|
55
|
+
}] }]; } });
|
|
56
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWxpbmtpZnlqcy5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtbGlua2lmeWpzLXYyL3NyYy9saWIvbmd4LWxpbmtpZnlqcy5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLFlBQVksRUFBQyxNQUFNLGlCQUFpQixDQUFDO0FBQzdD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FRfQ09ORklHKTogTW9kdWxlV2l0aFByb3ZpZGVyczxOZ3hMaW5raWZ5anNNb2R1bGU+IHtcbiAgICByZXR1cm4ge1xuICAgICAgbmdNb2R1bGU6IE5neExpbmtpZnlqc01vZHVsZSxcbiAgICAgIHByb3ZpZGVyczpcbiAgICAgICAgW1xuICAgICAgICAgIE5neExpbmtpZnlqc1NlcnZpY2UsXG4gICAgICAgICAge1xuICAgICAgICAgICAgcHJvdmlkZTogTmd4TGlua2lmeWpzQ29uZmlnVG9rZW4sXG4gICAgICAgICAgICB1c2VWYWx1ZTogY29uZmlnXG4gICAgICAgICAgfSxcbiAgICAgICAgXVxuICAgIH07XG4gIH1cblxuICBjb25zdHJ1Y3RvcihASW5qZWN0KE5neExpbmtpZnlqc0NvbmZpZ1Rva2VuKVxuICAgICAgICAgICAgICBwdWJsaWMgY29uZmlnOiBOZ3hMaW5raWZ5anNDb25maWcpIHtcbiAgICAvLyBUT0RPIFJFTU9WRSBNRVxuICAgIC8vIGlmIChjb25maWcuZW5hYmxlSGFzaCkge1xuICAgIC8vICAgaGFzaHRhZyhsaW5raWZ5KTtcbiAgICAvLyB9XG4gICAgLy9cbiAgICAvLyBpZiAoY29uZmlnLmVuYWJsZU1lbnRpb24pIHtcbiAgICAvLyAgIG1lbnRpb24obGlua2lmeSk7XG4gICAgLy8gfVxuICB9XG5cbn1cbiJdfQ==
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|
|
9
|
+
NgxLinkifyjsPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
10
|
+
NgxLinkifyjsPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsPipe, name: "linkify" });
|
|
11
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsPipe, decorators: [{
|
|
12
|
+
type: Pipe,
|
|
13
|
+
args: [{
|
|
14
|
+
name: 'linkify'
|
|
15
|
+
}]
|
|
16
|
+
}] });
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWxpbmtpZnlqcy5waXBlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LWxpbmtpZnlqcy12Mi9zcmMvbGliL3BpcGVzL25neC1saW5raWZ5anMucGlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUMsSUFBSSxFQUFnQixNQUFNLGVBQWUsQ0FBQztBQUVsRCxPQUFPLFVBQVUsTUFBTSxnQkFBZ0IsQ0FBQzs7QUFLeEMsTUFBTSxPQUFPLGdCQUFnQjtJQUUzQixTQUFTLENBQUMsS0FBYSxFQUFFLE9BQTJCO1FBQ2xELE9BQU8sS0FBSyxDQUFDLENBQUMsQ0FBQyxVQUFVLENBQUMsS0FBSyxFQUFFLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUM7SUFDcEQsQ0FBQzs7OEdBSlUsZ0JBQWdCOzRHQUFoQixnQkFBZ0I7NEZBQWhCLGdCQUFnQjtrQkFINUIsSUFBSTttQkFBQztvQkFDSixJQUFJLEVBQUUsU0FBUztpQkFDaEIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQge1BpcGUsIFBpcGVUcmFuc2Zvcm19IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHtOZ3hMaW5raWZ5T3B0aW9uc30gZnJvbSAnLi4vaW50ZXJmYWNlcy9uZ3gtbGlua2lmeWpzLmludGVyZmFjZSc7XG5pbXBvcnQgbGlua2lmeVN0ciBmcm9tICdsaW5raWZ5LXN0cmluZyc7XG5cbkBQaXBlKHtcbiAgbmFtZTogJ2xpbmtpZnknXG59KVxuZXhwb3J0IGNsYXNzIE5neExpbmtpZnlqc1BpcGUgaW1wbGVtZW50cyBQaXBlVHJhbnNmb3JtIHtcblxuICB0cmFuc2Zvcm0odmFsdWU6IHN0cmluZywgb3B0aW9ucz86IE5neExpbmtpZnlPcHRpb25zKTogc3RyaW5nIHtcbiAgICByZXR1cm4gdmFsdWUgPyBsaW5raWZ5U3RyKHZhbHVlLCBvcHRpb25zKSA6IHZhbHVlO1xuICB9XG5cbn1cbiJdfQ==
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
}
|
|
37
|
+
NgxLinkifyjsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
38
|
+
NgxLinkifyjsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsService });
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsService, decorators: [{
|
|
40
|
+
type: Injectable
|
|
41
|
+
}], ctorParameters: function () { return []; } });
|
|
42
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LWxpbmtpZnlqcy5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LWxpbmtpZnlqcy12Mi9zcmMvbGliL3NlcnZpY2Uvbmd4LWxpbmtpZnlqcy5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQyxVQUFVLEVBQUMsTUFBTSxlQUFlLENBQUM7QUFDekMsT0FBTyxLQUFLLE9BQU8sTUFBTSxXQUFXLENBQUM7QUFDckMsT0FBTyxVQUFVLE1BQU0sZ0JBQWdCLENBQUM7O0FBSXhDLE1BQU0sT0FBTyxtQkFBbUI7SUFDOUI7SUFDQSxDQUFDO0lBRUQ7Ozs7O09BS0c7SUFDSCxPQUFPLENBQUMsSUFBWSxFQUFFLE9BQTJCO1FBQy9DLE9BQU8sVUFBVSxDQUFDLElBQUksRUFBRSxPQUF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|
|
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
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Pipe, Injectable, InjectionToken, NgModule, Inject } from '@angular/core';
|
|
3
|
+
import linkifyStr from 'linkify-string';
|
|
4
|
+
import * as linkify from 'linkifyjs';
|
|
5
|
+
import { CommonModule } from '@angular/common';
|
|
6
|
+
|
|
7
|
+
var LinkType;
|
|
8
|
+
(function (LinkType) {
|
|
9
|
+
LinkType["URL"] = "url";
|
|
10
|
+
LinkType["HASHTAG"] = "hashtag";
|
|
11
|
+
LinkType["MENTION"] = "mention";
|
|
12
|
+
LinkType["EMAIL"] = "email";
|
|
13
|
+
})(LinkType || (LinkType = {}));
|
|
14
|
+
|
|
15
|
+
class NgxLinkifyjsPipe {
|
|
16
|
+
transform(value, options) {
|
|
17
|
+
return value ? linkifyStr(value, options) : value;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
NgxLinkifyjsPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
21
|
+
NgxLinkifyjsPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsPipe, name: "linkify" });
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsPipe, decorators: [{
|
|
23
|
+
type: Pipe,
|
|
24
|
+
args: [{
|
|
25
|
+
name: 'linkify'
|
|
26
|
+
}]
|
|
27
|
+
}] });
|
|
28
|
+
|
|
29
|
+
class NgxLinkifyjsService {
|
|
30
|
+
constructor() {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Convert the passed text as a string to an appropriate url
|
|
34
|
+
*
|
|
35
|
+
* @param text - the string to convert
|
|
36
|
+
* @param options - options to pass it to the linkifyjs library
|
|
37
|
+
*/
|
|
38
|
+
linkify(text, options) {
|
|
39
|
+
return linkifyStr(text, options);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Find any links in a given text as a string
|
|
43
|
+
*
|
|
44
|
+
* @param text - the string to find some links
|
|
45
|
+
*/
|
|
46
|
+
find(text) {
|
|
47
|
+
return linkify.find(text);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Test if a given value is a link or an array of all links
|
|
51
|
+
*
|
|
52
|
+
* @param value - the value to test
|
|
53
|
+
*/
|
|
54
|
+
test(value) {
|
|
55
|
+
if (typeof value === 'string') {
|
|
56
|
+
return linkify.test(value);
|
|
57
|
+
}
|
|
58
|
+
return value.find(v => !linkify.test(v)) === undefined;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
NgxLinkifyjsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
62
|
+
NgxLinkifyjsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsService });
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsService, decorators: [{
|
|
64
|
+
type: Injectable
|
|
65
|
+
}], ctorParameters: function () { return []; } });
|
|
66
|
+
|
|
67
|
+
const NgxLinkifyjsConfigToken = new InjectionToken('NgxLinkifyjsConfig');
|
|
68
|
+
const DEFAULT_CONFIG = { enableHash: true, enableMention: true };
|
|
69
|
+
class NgxLinkifyjsModule {
|
|
70
|
+
constructor(config) {
|
|
71
|
+
this.config = config;
|
|
72
|
+
// TODO REMOVE ME
|
|
73
|
+
// if (config.enableHash) {
|
|
74
|
+
// hashtag(linkify);
|
|
75
|
+
// }
|
|
76
|
+
//
|
|
77
|
+
// if (config.enableMention) {
|
|
78
|
+
// mention(linkify);
|
|
79
|
+
// }
|
|
80
|
+
}
|
|
81
|
+
static forRoot(config = DEFAULT_CONFIG) {
|
|
82
|
+
return {
|
|
83
|
+
ngModule: NgxLinkifyjsModule,
|
|
84
|
+
providers: [
|
|
85
|
+
NgxLinkifyjsService,
|
|
86
|
+
{
|
|
87
|
+
provide: NgxLinkifyjsConfigToken,
|
|
88
|
+
useValue: config
|
|
89
|
+
},
|
|
90
|
+
]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
NgxLinkifyjsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsModule, deps: [{ token: NgxLinkifyjsConfigToken }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
95
|
+
NgxLinkifyjsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsModule, declarations: [NgxLinkifyjsPipe], imports: [CommonModule], exports: [NgxLinkifyjsPipe] });
|
|
96
|
+
NgxLinkifyjsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsModule, imports: [CommonModule] });
|
|
97
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsModule, decorators: [{
|
|
98
|
+
type: NgModule,
|
|
99
|
+
args: [{
|
|
100
|
+
imports: [
|
|
101
|
+
CommonModule
|
|
102
|
+
],
|
|
103
|
+
exports: [NgxLinkifyjsPipe],
|
|
104
|
+
declarations: [NgxLinkifyjsPipe]
|
|
105
|
+
}]
|
|
106
|
+
}], ctorParameters: function () {
|
|
107
|
+
return [{ type: undefined, decorators: [{
|
|
108
|
+
type: Inject,
|
|
109
|
+
args: [NgxLinkifyjsConfigToken]
|
|
110
|
+
}] }];
|
|
111
|
+
} });
|
|
112
|
+
|
|
113
|
+
/*
|
|
114
|
+
* Public API Surface of ngx-linkifyjs
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Generated bundle index. Do not edit.
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
export { DEFAULT_CONFIG, LinkType, NgxLinkifyjsConfigToken, NgxLinkifyjsModule, NgxLinkifyjsPipe, NgxLinkifyjsService };
|
|
122
|
+
//# sourceMappingURL=code-name-jack-ngx-linkifyjs.mjs.map
|
|
@@ -0,0 +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 {CommonModule} from '@angular/common';\nimport {Inject, InjectionToken, ModuleWithProviders, NgModule} from '@angular/core';\n// TODO REMOVE ME\n// import * as linkify from 'linkifyjs';\n// import hashtag from 'linkify-plugin-hashtag';\n// import mention from 'linkify-plugin-mention';\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@NgModule({\n imports: [\n CommonModule\n ],\n exports: [NgxLinkifyjsPipe],\n declarations: [NgxLinkifyjsPipe]\n})\nexport class NgxLinkifyjsModule {\n\n static forRoot(config: NgxLinkifyjsConfig = DEFAULT_CONFIG): ModuleWithProviders<NgxLinkifyjsModule> {\n return {\n ngModule: NgxLinkifyjsModule,\n providers:\n [\n NgxLinkifyjsService,\n {\n provide: NgxLinkifyjsConfigToken,\n useValue: config\n },\n ]\n };\n }\n\n constructor(@Inject(NgxLinkifyjsConfigToken)\n public config: NgxLinkifyjsConfig) {\n // TODO REMOVE ME\n // if (config.enableHash) {\n // hashtag(linkify);\n // }\n //\n // if (config.enableMention) {\n // mention(linkify);\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":";;;;;;AAAY,IAAA,SAKX;AALD,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACX,IAAA,QAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,QAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,QAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACjB,CAAC,EALW,QAAQ,KAAR,QAAQ,GAKnB,EAAA,CAAA,CAAA;;MCEY,gBAAgB,CAAA;IAE3B,SAAS,CAAC,KAAa,EAAE,OAA2B,EAAA;AAClD,QAAA,OAAO,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC;KACnD;;8GAJU,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;4GAAhB,gBAAgB,EAAA,IAAA,EAAA,SAAA,EAAA,CAAA,CAAA;4FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAH5B,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,SAAS;iBAChB,CAAA;;;MCAY,mBAAmB,CAAA;AAC9B,IAAA,WAAA,GAAA;KACC;AAED;;;;;AAKG;IACH,OAAO,CAAC,IAAY,EAAE,OAA2B,EAAA;AAC/C,QAAA,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KAClC;AAED;;;;AAIG;AACH,IAA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A,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,kBAgBT,uBAAuB,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAhBhC,kBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,EAFd,YAAA,EAAA,CAAA,gBAAgB,CAH7B,EAAA,OAAA,EAAA,CAAA,YAAY,aAEJ,gBAAgB,CAAA,EAAA,CAAA,CAAA;AAGf,kBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,YAL3B,YAAY,CAAA,EAAA,CAAA,CAAA;4FAKH,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAP9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;oBACD,OAAO,EAAE,CAAC,gBAAgB,CAAC;oBAC3B,YAAY,EAAE,CAAC,gBAAgB,CAAC;iBACjC,CAAA;;;8BAiBc,MAAM;+BAAC,uBAAuB,CAAA;;;;AC7C7C;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Pipe, Injectable, InjectionToken, NgModule, Inject } from '@angular/core';
|
|
3
|
+
import linkifyStr from 'linkify-string';
|
|
4
|
+
import * as linkify from 'linkifyjs';
|
|
5
|
+
import { CommonModule } from '@angular/common';
|
|
6
|
+
|
|
7
|
+
var LinkType;
|
|
8
|
+
(function (LinkType) {
|
|
9
|
+
LinkType["URL"] = "url";
|
|
10
|
+
LinkType["HASHTAG"] = "hashtag";
|
|
11
|
+
LinkType["MENTION"] = "mention";
|
|
12
|
+
LinkType["EMAIL"] = "email";
|
|
13
|
+
})(LinkType || (LinkType = {}));
|
|
14
|
+
|
|
15
|
+
class NgxLinkifyjsPipe {
|
|
16
|
+
transform(value, options) {
|
|
17
|
+
return value ? linkifyStr(value, options) : value;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
NgxLinkifyjsPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
21
|
+
NgxLinkifyjsPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsPipe, name: "linkify" });
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsPipe, decorators: [{
|
|
23
|
+
type: Pipe,
|
|
24
|
+
args: [{
|
|
25
|
+
name: 'linkify'
|
|
26
|
+
}]
|
|
27
|
+
}] });
|
|
28
|
+
|
|
29
|
+
class NgxLinkifyjsService {
|
|
30
|
+
constructor() {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Convert the passed text as a string to an appropriate url
|
|
34
|
+
*
|
|
35
|
+
* @param text - the string to convert
|
|
36
|
+
* @param options - options to pass it to the linkifyjs library
|
|
37
|
+
*/
|
|
38
|
+
linkify(text, options) {
|
|
39
|
+
return linkifyStr(text, options);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Find any links in a given text as a string
|
|
43
|
+
*
|
|
44
|
+
* @param text - the string to find some links
|
|
45
|
+
*/
|
|
46
|
+
find(text) {
|
|
47
|
+
return linkify.find(text);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Test if a given value is a link or an array of all links
|
|
51
|
+
*
|
|
52
|
+
* @param value - the value to test
|
|
53
|
+
*/
|
|
54
|
+
test(value) {
|
|
55
|
+
if (typeof value === 'string') {
|
|
56
|
+
return linkify.test(value);
|
|
57
|
+
}
|
|
58
|
+
return value.find(v => !linkify.test(v)) === undefined;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
NgxLinkifyjsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
62
|
+
NgxLinkifyjsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsService });
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsService, decorators: [{
|
|
64
|
+
type: Injectable
|
|
65
|
+
}], ctorParameters: function () { return []; } });
|
|
66
|
+
|
|
67
|
+
const NgxLinkifyjsConfigToken = new InjectionToken('NgxLinkifyjsConfig');
|
|
68
|
+
const DEFAULT_CONFIG = { enableHash: true, enableMention: true };
|
|
69
|
+
class NgxLinkifyjsModule {
|
|
70
|
+
constructor(config) {
|
|
71
|
+
this.config = config;
|
|
72
|
+
// TODO REMOVE ME
|
|
73
|
+
// if (config.enableHash) {
|
|
74
|
+
// hashtag(linkify);
|
|
75
|
+
// }
|
|
76
|
+
//
|
|
77
|
+
// if (config.enableMention) {
|
|
78
|
+
// mention(linkify);
|
|
79
|
+
// }
|
|
80
|
+
}
|
|
81
|
+
static forRoot(config = DEFAULT_CONFIG) {
|
|
82
|
+
return {
|
|
83
|
+
ngModule: NgxLinkifyjsModule,
|
|
84
|
+
providers: [
|
|
85
|
+
NgxLinkifyjsService,
|
|
86
|
+
{
|
|
87
|
+
provide: NgxLinkifyjsConfigToken,
|
|
88
|
+
useValue: config
|
|
89
|
+
},
|
|
90
|
+
]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
NgxLinkifyjsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsModule, deps: [{ token: NgxLinkifyjsConfigToken }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
95
|
+
NgxLinkifyjsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsModule, declarations: [NgxLinkifyjsPipe], imports: [CommonModule], exports: [NgxLinkifyjsPipe] });
|
|
96
|
+
NgxLinkifyjsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsModule, imports: [CommonModule] });
|
|
97
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: NgxLinkifyjsModule, decorators: [{
|
|
98
|
+
type: NgModule,
|
|
99
|
+
args: [{
|
|
100
|
+
imports: [
|
|
101
|
+
CommonModule
|
|
102
|
+
],
|
|
103
|
+
exports: [NgxLinkifyjsPipe],
|
|
104
|
+
declarations: [NgxLinkifyjsPipe]
|
|
105
|
+
}]
|
|
106
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
107
|
+
type: Inject,
|
|
108
|
+
args: [NgxLinkifyjsConfigToken]
|
|
109
|
+
}] }]; } });
|
|
110
|
+
|
|
111
|
+
/*
|
|
112
|
+
* Public API Surface of ngx-linkifyjs
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Generated bundle index. Do not edit.
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
export { DEFAULT_CONFIG, LinkType, NgxLinkifyjsConfigToken, NgxLinkifyjsModule, NgxLinkifyjsPipe, NgxLinkifyjsService };
|
|
120
|
+
//# sourceMappingURL=code-name-jack-ngx-linkifyjs.mjs.map
|
|
@@ -0,0 +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 {CommonModule} from '@angular/common';\nimport {Inject, InjectionToken, ModuleWithProviders, NgModule} from '@angular/core';\n// TODO REMOVE ME\n// import * as linkify from 'linkifyjs';\n// import hashtag from 'linkify-plugin-hashtag';\n// import mention from 'linkify-plugin-mention';\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@NgModule({\n imports: [\n CommonModule\n ],\n exports: [NgxLinkifyjsPipe],\n declarations: [NgxLinkifyjsPipe]\n})\nexport class NgxLinkifyjsModule {\n\n static forRoot(config: NgxLinkifyjsConfig = DEFAULT_CONFIG): ModuleWithProviders<NgxLinkifyjsModule> {\n return {\n ngModule: NgxLinkifyjsModule,\n providers:\n [\n NgxLinkifyjsService,\n {\n provide: NgxLinkifyjsConfigToken,\n useValue: config\n },\n ]\n };\n }\n\n constructor(@Inject(NgxLinkifyjsConfigToken)\n public config: NgxLinkifyjsConfig) {\n // TODO REMOVE ME\n // if (config.enableHash) {\n // hashtag(linkify);\n // }\n //\n // if (config.enableMention) {\n // mention(linkify);\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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A,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,EAFd,YAAA,EAAA,CAAA,gBAAgB,CAH7B,EAAA,OAAA,EAAA,CAAA,YAAY,aAEJ,gBAAgB,CAAA,EAAA,CAAA,CAAA;AAGf,kBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,YAL3B,YAAY,CAAA,EAAA,CAAA,CAAA;4FAKH,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAP9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;oBACD,OAAO,EAAE,CAAC,gBAAgB,CAAC;oBAC3B,YAAY,EAAE,CAAC,gBAAgB,CAAC;AACjC,iBAAA,CAAA;;0BAiBc,MAAM;2BAAC,uBAAuB,CAAA;;;AC7C7C;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linktype.enum.d.ts","sourceRoot":"","sources":["../../../../projects/ngx-linkifyjs-v2/src/lib/enum/linktype.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
}
|
|
25
|
+
//# sourceMappingURL=ngx-linkifyjs.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-linkifyjs.interface.d.ts","sourceRoot":"","sources":["../../../../projects/ngx-linkifyjs-v2/src/lib/interfaces/ngx-linkifyjs.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,UAAU,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,MAAM,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAEpC,UAAU,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;CACxC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
}
|
|
21
|
+
//# sourceMappingURL=ngx-linkifyjs.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-linkifyjs.module.d.ts","sourceRoot":"","sources":["../../../projects/ngx-linkifyjs-v2/src/lib/ngx-linkifyjs.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,cAAc,EAAE,mBAAmB,EAAW,MAAM,eAAe,CAAC;AAWpF,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;;;;AADxE,OAAO,EAAC,IAAI,EAAC,MAAM,sCAAsC,CAAC;AAG1D,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAC,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AAEpE,eAAO,MAAM,uBAAuB,oCAA+D,CAAC;AACpG,eAAO,MAAM,cAAc,EAAE,kBAA4D,CAAC;AAE1F,qBAOa,kBAAkB;IAiBV,MAAM,EAAE,kBAAkB;IAf7C,MAAM,CAAC,OAAO,CAAC,MAAM,GAAE,kBAAmC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC;gBAejF,MAAM,EAAE,kBAAkB;yCAjBlC,kBAAkB;0CAAlB,kBAAkB;0CAAlB,kBAAkB;CA4B9B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
}
|
|
9
|
+
//# sourceMappingURL=ngx-linkifyjs.pipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-linkifyjs.pipe.d.ts","sourceRoot":"","sources":["../../../../projects/ngx-linkifyjs-v2/src/lib/pipes/ngx-linkifyjs.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,aAAa,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,EAAC,iBAAiB,EAAC,MAAM,uCAAuC,CAAC;;AAGxE,qBAGa,gBAAiB,YAAW,aAAa;IAEpD,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM;yCAFlD,gBAAgB;uCAAhB,gBAAgB;CAM5B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
}
|
|
27
|
+
//# sourceMappingURL=ngx-linkifyjs.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-linkifyjs.service.d.ts","sourceRoot":"","sources":["../../../../projects/ngx-linkifyjs-v2/src/lib/service/ngx-linkifyjs.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,IAAI,EAAE,iBAAiB,EAAC,MAAM,uCAAuC,CAAC;;AAE9E,qBACa,mBAAmB;;IAI9B;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM;IAI1D;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC;IAI/B;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO;yCA5B5B,mBAAmB;6CAAnB,mBAAmB;CAmC/B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@code-name-jack/ngx-linkifyjs",
|
|
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": "14.0.1",
|
|
5
|
+
"homepage": "https://github.com/code-name-jack/ngx-linkifyjs-v2",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Code Name Jack",
|
|
8
|
+
"url": "https://github.com/code-name-jack"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git://github.com/code-name-jack/ngx-linkifyjs.git"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"schematics": "./schematics/collection.json",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"ngx",
|
|
18
|
+
"angular",
|
|
19
|
+
"library",
|
|
20
|
+
"linkifyjs",
|
|
21
|
+
"links",
|
|
22
|
+
"find-links",
|
|
23
|
+
"autolink",
|
|
24
|
+
"text",
|
|
25
|
+
"url",
|
|
26
|
+
"email",
|
|
27
|
+
"hashtags",
|
|
28
|
+
"mentionsm"
|
|
29
|
+
],
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/code-name-jack/ngx-linkifyjs-v2/issues"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@angular/common": "<15",
|
|
35
|
+
"@angular/core": "<15"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=10.0.0"
|
|
39
|
+
},
|
|
40
|
+
"release-it": {
|
|
41
|
+
"github": {
|
|
42
|
+
"release": true
|
|
43
|
+
},
|
|
44
|
+
"npm": {
|
|
45
|
+
"publish": true,
|
|
46
|
+
"publishPath": "../../dist/angular-material-extensions/select-country"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"plugins": {
|
|
52
|
+
"@release-it/conventional-changelog": {
|
|
53
|
+
"preset": "angular",
|
|
54
|
+
"infile": "../../CHANGELOG.md"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"hooks": {
|
|
58
|
+
"before:init": [
|
|
59
|
+
"npm run clean"
|
|
60
|
+
],
|
|
61
|
+
"after:bump": "echo \"building lib v${version}... \" && npm run build",
|
|
62
|
+
"before:git:release": "echo \"Updating CHANGELOG.md for v${version} \" && git commit -m \"Updating CHANGELOG.md for v${version} \" ../../CHANGELOG.md",
|
|
63
|
+
"after:release": "echo Successfully released ${name} v${version} to ${repo.repository}.",
|
|
64
|
+
"before:npm": "echo building the library..."
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"globals": {
|
|
68
|
+
"ts-jest": {
|
|
69
|
+
"tsConfig": "<rootDir>/tsconfig.spec.json",
|
|
70
|
+
"stringifyContentPathRegex": "\\.html$",
|
|
71
|
+
"astTransformers": [
|
|
72
|
+
"jest-preset-angular/build/InlineFilesTransformer",
|
|
73
|
+
"jest-preset-angular/build/StripStylesTransformer"
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"greenkeeper": {
|
|
78
|
+
"ignore": [
|
|
79
|
+
"@angular/core",
|
|
80
|
+
"@angular/common",
|
|
81
|
+
"@angular/compiler",
|
|
82
|
+
"@angular/platform-server",
|
|
83
|
+
"@angular/platform-browser",
|
|
84
|
+
"@angular/platform-browser-dynamic",
|
|
85
|
+
"@angular/compiler-cli",
|
|
86
|
+
"zone.js",
|
|
87
|
+
"rxjs",
|
|
88
|
+
"tslint",
|
|
89
|
+
"gulp-tslint",
|
|
90
|
+
"typescript",
|
|
91
|
+
"awesome-typescript-loader",
|
|
92
|
+
"codelyzer",
|
|
93
|
+
"@angular/animations",
|
|
94
|
+
"linkifyjs",
|
|
95
|
+
"@types/jasmine",
|
|
96
|
+
"@types/jest",
|
|
97
|
+
"@types/node",
|
|
98
|
+
"conventional-github-releaser",
|
|
99
|
+
"rollup-plugin-uglify"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"dependencies": {
|
|
103
|
+
"tslib": "^2.4.1",
|
|
104
|
+
"linkifyjs": "^4.0.2",
|
|
105
|
+
"linkify-plugin-hashtag": "^4.0.2",
|
|
106
|
+
"linkify-plugin-mention": "^4.0.2",
|
|
107
|
+
"linkify-string": "^4.0.2"
|
|
108
|
+
},
|
|
109
|
+
"commitplease": {
|
|
110
|
+
"style": "angular",
|
|
111
|
+
"types": [
|
|
112
|
+
"feat",
|
|
113
|
+
"fix",
|
|
114
|
+
"docs",
|
|
115
|
+
"style",
|
|
116
|
+
"refactor",
|
|
117
|
+
"perf",
|
|
118
|
+
"test",
|
|
119
|
+
"chore",
|
|
120
|
+
"revert",
|
|
121
|
+
"demo"
|
|
122
|
+
],
|
|
123
|
+
"scope": "\\S+.*"
|
|
124
|
+
},
|
|
125
|
+
"module": "fesm2015/code-name-jack-ngx-linkifyjs.mjs",
|
|
126
|
+
"es2020": "fesm2020/code-name-jack-ngx-linkifyjs.mjs",
|
|
127
|
+
"esm2020": "esm2020/code-name-jack-ngx-linkifyjs.mjs",
|
|
128
|
+
"fesm2020": "fesm2020/code-name-jack-ngx-linkifyjs.mjs",
|
|
129
|
+
"fesm2015": "fesm2015/code-name-jack-ngx-linkifyjs.mjs",
|
|
130
|
+
"typings": "index.d.ts",
|
|
131
|
+
"exports": {
|
|
132
|
+
"./package.json": {
|
|
133
|
+
"default": "./package.json"
|
|
134
|
+
},
|
|
135
|
+
".": {
|
|
136
|
+
"types": "./index.d.ts",
|
|
137
|
+
"esm2020": "./esm2020/code-name-jack-ngx-linkifyjs.mjs",
|
|
138
|
+
"es2020": "./fesm2020/code-name-jack-ngx-linkifyjs.mjs",
|
|
139
|
+
"es2015": "./fesm2015/code-name-jack-ngx-linkifyjs.mjs",
|
|
140
|
+
"node": "./fesm2015/code-name-jack-ngx-linkifyjs.mjs",
|
|
141
|
+
"default": "./fesm2020/code-name-jack-ngx-linkifyjs.mjs"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"sideEffects": false
|
|
145
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './lib/enum/linktype.enum';
|
|
2
|
+
export * from './lib/interfaces/ngx-linkifyjs.interface';
|
|
3
|
+
export * from './lib/pipes/ngx-linkifyjs.pipe';
|
|
4
|
+
export * from './lib/service/ngx-linkifyjs.service';
|
|
5
|
+
export * from './lib/ngx-linkifyjs.module';
|
|
6
|
+
//# sourceMappingURL=public-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../../projects/ngx-linkifyjs-v2/src/public-api.ts"],"names":[],"mappings":"AAIA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0CAA0C,CAAC;AACzD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,4BAA4B,CAAC"}
|