mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-01 03:46:44 +01:00
27 lines
576 B
JavaScript
27 lines
576 B
JavaScript
|
/**
|
||
|
* PmWarning
|
||
|
*
|
||
|
* Warn users that their PM will be reviewed.
|
||
|
*/
|
||
|
|
||
|
import { $ } from './utils/dom';
|
||
|
|
||
|
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))
|
||
|
warning.classList.remove('hidden');
|
||
|
else if (!warning.classList.contains('hidden'))
|
||
|
warning.classList.add('hidden');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
export { warnAboutPMs };
|