Migrate src/components/widget/LinkIconTooltip.js to TS

This commit is contained in:
Paulo Gustavo Veiga 2022-06-21 20:29:02 -07:00
parent d4fcb859f0
commit f3170dd11e

View File

@ -17,11 +17,13 @@
*/ */
import { $assert } from '@wisemapping/core-js'; import { $assert } from '@wisemapping/core-js';
import $ from 'jquery'; import $ from 'jquery';
import LinkIcon from '../LinkIcon';
import LinkModel from '../model/LinkModel';
import { $msg } from '../Messages'; import { $msg } from '../Messages';
import FloatingTip from './FloatingTip'; import FloatingTip from './FloatingTip';
class LinkIconTooltip extends FloatingTip { class LinkIconTooltip extends FloatingTip {
constructor(linkIcon) { constructor(linkIcon: LinkIcon) {
$assert(linkIcon, 'linkIcon can not be null'); $assert(linkIcon, 'linkIcon can not be null');
const nativeElement = $(linkIcon.getImage().peer._native); const nativeElement = $(linkIcon.getImage().peer._native);
super(nativeElement, { super(nativeElement, {
@ -38,8 +40,9 @@ class LinkIconTooltip extends FloatingTip {
}); });
} }
static _buildContent(linkIcon) { private static _buildContent(linkIcon: LinkIcon): JQuery<HTMLElement> {
const url = linkIcon.getModel().getUrl(); const model = linkIcon.getModel() as LinkModel;
const url = model.getUrl();
const linkText = `${url}`; const linkText = `${url}`;
const result = $('<div></div>').css({ const result = $('<div></div>').css({
@ -54,7 +57,6 @@ class LinkIconTooltip extends FloatingTip {
link.append(linkText); link.append(linkText);
result.append(link); result.append(link);
return result; return result;
} }
} }