Merge pull request #3255 from vvlladd28/feature/sanitier
[3.0] Add angular Sanitizer for widgetContext
This commit is contained in:
commit
cc27993b00
@ -40,6 +40,7 @@ import { DialogService } from '@core/services/dialog.service';
|
||||
import { CustomDialogService } from '@home/components/widget/dialog/custom-dialog.service';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
export class DynamicWidgetComponent extends PageComponent implements IDynamicWidgetComponent, OnInit, OnDestroy {
|
||||
|
||||
@ -74,6 +75,7 @@ export class DynamicWidgetComponent extends PageComponent implements IDynamicWid
|
||||
this.ctx.date = $injector.get(DatePipe);
|
||||
this.ctx.translate = $injector.get(TranslateService);
|
||||
this.ctx.http = $injector.get(HttpClient);
|
||||
this.ctx.sanitizer = $injector.get(DomSanitizer);
|
||||
|
||||
this.ctx.$scope = this;
|
||||
if (this.ctx.defaultSubscription) {
|
||||
|
||||
@ -75,6 +75,7 @@ import { DatePipe } from '@angular/common';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { PageLink } from '@shared/models/page/page-link';
|
||||
import { SortOrder } from '@shared/models/page/sort-order';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
export interface IWidgetAction {
|
||||
name: string;
|
||||
@ -155,6 +156,7 @@ export class WidgetContext {
|
||||
date: DatePipe;
|
||||
translate: TranslateService;
|
||||
http: HttpClient;
|
||||
sanitizer: DomSanitizer;
|
||||
|
||||
private changeDetectorValue: ChangeDetectorRef;
|
||||
|
||||
|
||||
@ -1382,5 +1382,11 @@ export const serviceCompletions: TbEditorCompletions = {
|
||||
'See <a href="https://angular.io/api/common/http/HttpClient">HttpClient</a> for API reference.',
|
||||
meta: 'service',
|
||||
type: '<a href="https://angular.io/api/common/http/HttpClient">HttpClient</a>'
|
||||
},
|
||||
sanitizer: {
|
||||
description: 'DomSanitizer Service<br>' +
|
||||
'See <a href="https://angular.io/api/platform-browser/DomSanitizer">DomSanitizer</a> for API reference.',
|
||||
meta: 'service',
|
||||
type: '<a href="https://angular.io/api/platform-browser/DomSanitizer">DomSanitizer</a>'
|
||||
}
|
||||
}
|
||||
|
||||
@ -579,6 +579,23 @@ export const widgetContextCompletions: TbEditorCompletions = {
|
||||
}
|
||||
]
|
||||
},
|
||||
pushAndOpenState: {
|
||||
description: 'Navigate to new dashboard state and adding intermediate states.',
|
||||
meta: 'function',
|
||||
args: [
|
||||
{
|
||||
name: 'id',
|
||||
description: 'An array state object of the target dashboard state.',
|
||||
type: 'Array <a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/core/api/widget-api.models.ts#L140">StateObject</a>',
|
||||
},
|
||||
{
|
||||
name: 'openRightLayout',
|
||||
description: 'An optional boolean argument to force open right dashboard layout if present in mobile view mode.',
|
||||
type: 'boolean',
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
},
|
||||
updateState: {
|
||||
description: 'Updates current dashboard state.',
|
||||
meta: 'function',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user