/*! * Jodit Editor PRO (https://xdsoft.net/jodit/) * See LICENSE.md in the project root for license information. * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/ */ import './autocomplete.less'; import type { IAutoCompleteItem } from '../interface'; import { UIElement } from 'jodit/core/ui'; // import { isFunction, isString } from 'jodit/core/helpers'; export class AutocompleteMentionItem extends UIElement { /** @override */ className(): string { return 'AutocompleteMentionItem'; } constructor( jodit: AutocompleteMentionItem['jodit'], public item: IAutoCompleteItem ) { super(jodit); const { container } = this; const avatarElement = this.jodit.c.element('img', { src: item.mentionUser?.avatar, className: 'jodit-autocomplete-mention-item__avatar' }); const usernameElement = this.jodit.c.element('span', { className: 'jodit-autocomplete-mention-item__username' }); usernameElement.innerText = item.title ?? item.value; container.appendChild(avatarElement); container.appendChild(usernameElement); } }