Skip to content

Commit

Permalink
feat(package): added the hashtag and mention plugins from linkifyjs
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyNahas committed Jul 23, 2018
1 parent 292462b commit 5b2f91e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/module/ngx-linkifyjs.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import {CommonModule} from '@angular/common';
import {NgModule, ModuleWithProviders} from '@angular/core';
import {ModuleWithProviders, NgModule} from '@angular/core';
// @ts-ignore
import * as linkify from 'linkifyjs';
// @ts-ignore
import * as hashtag from 'linkifyjs/plugins/hashtag';
// @ts-ignore
import * as mention from 'linkifyjs/plugins/mention';

import {NgxLinkifyjsService} from './service/ngx-linkifyjs.service';
import {NgxLinkifyjsPipe} from './pipes/ngx-linkifyjs.pipe';
Expand All @@ -19,6 +25,10 @@ export {NgxLinkifyjsService} from './service/ngx-linkifyjs.service';
})
export class NgxLinkifyjsModule {
static forRoot(): ModuleWithProviders {

hashtag(linkify);
mention(linkify);

return {
ngModule: NgxLinkifyjsModule,
providers: [NgxLinkifyjsService]
Expand Down
10 changes: 10 additions & 0 deletions src/module/service/ngx-linkifyjs.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import {inject, TestBed} from '@angular/core/testing';

// @ts-ignore
import * as linkify from 'linkifyjs';
// @ts-ignore
import * as hashtag from 'linkifyjs/plugins/hashtag';

import {NgxLinkifyjsService} from './ngx-linkifyjs.service';
import {Link, LinkType} from '../..';

describe('LibService', () => {

beforeAll(() => {
hashtag(linkify);
});

beforeEach(() => {
TestBed.configureTestingModule({
providers: [NgxLinkifyjsService]
Expand Down

0 comments on commit 5b2f91e

Please sign in to comment.