2019-10-21 17:18:05 +02:00
|
|
|
import { delegate } from '@utils';
|
2019-09-24 16:38:58 +02:00
|
|
|
|
|
|
|
function syncInputToElement(fromSelector, toSelector) {
|
|
|
|
const fromElement = document.querySelector(fromSelector);
|
|
|
|
const toElement = document.querySelector(toSelector);
|
|
|
|
if (toElement && fromElement) {
|
|
|
|
toElement.innerText = fromElement.value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function syncFormToPreview() {
|
2019-10-21 18:12:57 +02:00
|
|
|
syncInputToElement('#procedure_libelle', '.procedure-title');
|
2023-05-24 11:18:54 +02:00
|
|
|
syncInputToElement('#procedure_description', '.js_description p');
|
2023-05-22 16:26:50 +02:00
|
|
|
syncInputToElement(
|
2023-05-24 11:18:54 +02:00
|
|
|
'#procedure_description_target_audience',
|
|
|
|
'.js_description_target_audience p'
|
2023-05-22 16:26:50 +02:00
|
|
|
);
|
2019-09-24 16:38:58 +02:00
|
|
|
}
|
|
|
|
|
2019-10-21 18:12:57 +02:00
|
|
|
delegate('input', '.procedure-form #procedure_libelle', syncFormToPreview);
|
2023-05-24 11:48:17 +02:00
|
|
|
delegate('input', '.procedure-form #procedure_description', syncFormToPreview);
|
2023-05-22 16:26:50 +02:00
|
|
|
delegate(
|
|
|
|
'input',
|
2023-05-24 11:18:54 +02:00
|
|
|
'.procedure-form #procedure_description_target_audience',
|
2023-05-22 16:26:50 +02:00
|
|
|
syncFormToPreview
|
|
|
|
);
|