text-marker
Version:
Simple text marker with custom styles
101 lines (94 loc) • 3.52 kB
JavaScript
import { Injectable, ɵɵdefineInjectable, Component, ViewChild, Input, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
/**
* @fileoverview added by tsickle
* Generated from: lib/text-marker.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class TextMarkerService {
constructor() { }
}
TextMarkerService.decorators = [
{ type: Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
TextMarkerService.ctorParameters = () => [];
/** @nocollapse */ TextMarkerService.ngInjectableDef = ɵɵdefineInjectable({ factory: function TextMarkerService_Factory() { return new TextMarkerService(); }, token: TextMarkerService, providedIn: "root" });
/**
* @fileoverview added by tsickle
* Generated from: lib/text-marker.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class TextMarkerComponent {
constructor() { }
/**
* @param {?} value
* @return {?}
*/
set inputQuery(value) {
this.innerHtmlContent = this.originalContent;
this.innerHtmlContent = value ? this.innerHtmlContent && this.innerHtmlContent.replace(new RegExp(value, 'g'), `<span class="${this.styleClass}">${value}</span>`) : this.innerHtmlContent;
}
/**
* @return {?}
*/
ngOnInit() {
this.innerHtmlContent = this.originalContent = this.content ? this.content.nativeElement.textContent : '';
}
}
TextMarkerComponent.decorators = [
{ type: Component, args: [{
selector: 'jk-text-marker',
template: `
<div #content [hidden]="true">
<ng-content></ng-content>
</div>
<div [innerHTML]="innerHtmlContent"></div>
`
}] }
];
/** @nocollapse */
TextMarkerComponent.ctorParameters = () => [];
TextMarkerComponent.propDecorators = {
content: [{ type: ViewChild, args: ['content', null,] }],
styleClass: [{ type: Input }],
inputQuery: [{ type: Input }]
};
if (false) {
/** @type {?} */
TextMarkerComponent.prototype.content;
/** @type {?} */
TextMarkerComponent.prototype.styleClass;
/** @type {?} */
TextMarkerComponent.prototype.innerHtmlContent;
/** @type {?} */
TextMarkerComponent.prototype.originalContent;
}
/**
* @fileoverview added by tsickle
* Generated from: lib/text-marker.module.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class TextMarkerModule {
}
TextMarkerModule.decorators = [
{ type: NgModule, args: [{
declarations: [TextMarkerComponent],
imports: [CommonModule],
exports: [TextMarkerComponent]
},] }
];
/**
* @fileoverview added by tsickle
* Generated from: public-api.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: text-marker.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
export { TextMarkerComponent, TextMarkerModule, TextMarkerService };
//# sourceMappingURL=text-marker.js.map