import { isString, escape } from 'lodash'; import $ from 'jquery'; import coreModule from 'app/core/core_module'; import alertDef from '../alerting/state/alertDef'; import { DashboardSrv } from '../dashboard/services/DashboardSrv'; import { ContextSrv } from 'app/core/services/context_srv'; /** @ngInject */ export function annotationTooltipDirective( $sanitize: any, dashboardSrv: DashboardSrv, contextSrv: ContextSrv, $compile: any ) { function sanitizeString(str: string) { try { return $sanitize(str); } catch (err) { console.log('Could not sanitize annotation string, html escaping instead'); return escape(str); } } return { restrict: 'E', scope: { event: '=', onEdit: '&', }, link: (scope: any, element: JQuery) => { const event = scope.event; let title = event.title; let text = event.text; const dashboard = dashboardSrv.getCurrent(); let tooltip = '