@code-name-jack/ngx-linkifyjs 16.0.1 → 17.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.
Files changed (2) hide show
  1. package/README.md +13 -399
  2. package/package.json +9 -9
package/README.md CHANGED
@@ -1,410 +1,24 @@
1
- # ngx-linkifyjs-v2 - Angular 14 wrapper for linkifyjs - library for finding links in plain text and converting them to HTML <a> tags via linkifyjs
1
+ # NgxLinkifyjs
2
2
 
3
- [![npm version](https://badge.fury.io/js/ngx-linkifyjs.svg)](https://badge.fury.io/js/ngx-linkifyjs),
4
- [![npm](https://img.shields.io/badge/demo-online-ed1c46.svg)](https://anthonynahas.github.io/ngx-linkifyjs)
5
- [![Join the chat at (https://gitter.im/angular-material-extensions/Lobby](https://badges.gitter.im/ngx-auth-firebaseui/Lobby.svg)](https://gitter.im/angular-material-extensions/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6
- [![CircleCI branch](https://img.shields.io/circleci/project/github/AnthonyNahas/ngx-linkifyjs/master.svg?label=circleci)](https://circleci.com/gh/AnthonyNahas/ngx-linkifyjs)
7
- [![Build Status](https://travis-ci.org/AnthonyNahas/ngx-linkifyjs.svg?branch=master)](https://travis-ci.org/AnthonyNahas/ngx-linkifyjs)
8
- [![Coverage Status](https://coveralls.io/repos/github/AnthonyNahas/ngx-linkifyjs/badge.svg?branch=master)](https://coveralls.io/github/AnthonyNahas/ngx-linkifyjs?branch=master)
9
- [![dependency Status](https://david-dm.org/anthonynahas/ngx-linkifyjs/status.svg)](https://david-dm.org/anthonynahas/ngx-linkifyjs)
10
- [![devDependency Status](https://david-dm.org/anthonynahas/ngx-linkifyjs/dev-status.svg?branch=master)](https://david-dm.org/anthonynahas/ngx-linkifyjs#info=devDependencies)
11
- [![Greenkeeper Badge](https://badges.greenkeeper.io/anthonynahas/ngx-linkifyjs.svg)](https://greenkeeper.io/)
12
- [![license](https://img.shields.io/github/license/anthonynahas/ngx-linkifyjs.svg?style=flat-square)](https://github.com/AnthonyNahas/ngx-linkifyjs/blob/master/LICENSE)
13
- [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](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
- <p align="center">
17
- <img alt="ngx-linkifyjs demo" width="320px" style="text-align: center;"
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
- ## Built by and for developers :heart:
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
- If you like this project, support [ngx-linkifyjs](https://github.com/anthonynahas/ngx-linkifyjs)
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`.
29
17
 
30
- ## Table of Contents
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
- <a name="demo"/>
20
+ Run `ng test ngx-linkifyjs-v2` to execute the unit tests via [Karma](https://karma-runner.github.io).
43
21
 
44
- ## Demo
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
- ![jetbrains logo](assets/jetbrains-variant-4_logos/jetbrains-variant-4.png)
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).
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 &lt;a&gt; tags via linkifyjs",
4
- "version": "16.0.1",
4
+ "version": "17.0.0",
5
5
  "homepage": "https://github.com/code-name-jack/ngx-linkifyjs-v2",
6
6
  "author": {
7
7
  "name": "Code Name Jack",
@@ -34,16 +34,13 @@
34
34
  "node": ">=16.0.0"
35
35
  },
36
36
  "peerDependencies": {
37
- "@angular/common": "~16.x",
38
- "@angular/core": "~16.x",
39
- "@schematics/angular": "~16.x"
40
- },
41
- "dependencies": {
37
+ "@angular/common": "~17.x",
38
+ "@angular/core": "~17.x",
39
+ "@schematics/angular": "~17.x",
42
40
  "linkify-plugin-hashtag": "^4.0.2",
43
41
  "linkify-plugin-mention": "^4.0.2",
44
42
  "linkify-string": "^4.0.2",
45
- "linkifyjs": "^4.0.2",
46
- "tslib": "^2.4.1"
43
+ "linkifyjs": "^4.0.2"
47
44
  },
48
45
  "release-it": {
49
46
  "github": {
@@ -142,5 +139,8 @@
142
139
  "default": "./fesm2020/code-name-jack-ngx-linkifyjs.mjs"
143
140
  }
144
141
  },
145
- "sideEffects": false
142
+ "sideEffects": false,
143
+ "dependencies": {
144
+ "tslib": "^2.4.1"
145
+ }
146
146
  }