/** * PmWarning * * Warn users that their PM will be reviewed. */ import { $, hideEl, showEl } from './utils/dom'; export function warnAboutPMs() { const textarea = $('.js-toolbar-input'); const warning = $('.js-hidden-warning'); const imageEmbedRegex = /!+\[/g; if (!warning || !textarea) return; textarea.addEventListener('input', () => { const value = textarea.value; if (value.match(imageEmbedRegex)) { showEl(warning); } else if (!warning.classList.contains('hidden')) { hideEl(warning); } }); }