/** * @module preview */ import { renderPopup } from '../popup/popup'; import { escapeHTML } from '../templateUtil'; /** * @param {ext.popups.PreviewModel} model * @param {boolean} showTitle * @param {string} extractMsg * @param {string} linkMsg * @return {string} HTML string. */ export function renderPreview( model, showTitle, extractMsg, linkMsg ) { const title = escapeHTML( model.title ), url = escapeHTML( model.url ), type = escapeHTML( model.type ); extractMsg = escapeHTML( extractMsg ); linkMsg = escapeHTML( linkMsg ); return renderPopup( model.type, `
${ showTitle ? `${ title }` : '' } ${ extractMsg } ` ); }