Workaround
- Создать onLoad скрипт для помещения iframe поля HTML в глобальный объект window
function waitForElm(selector) {
return new Promise(resolve => {
if (document.querySelector(selector)) {
return resolve(document.querySelector(selector));
}
const observer = new MutationObserver(mutations => {
if (document.querySelector(selector)) {
resolve(document.querySelector(selector));
observer.disconnect();
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
});
}
waitForElm('iframe[class="cke_wysiwyg_frame cke_reset"]').then((elm) => {
window.iFrameElm = elm;
});
- Установить значение в поле через onChange скрипт:
const templateHTML = `<p>Шаблон для услуги <strong>НАЗВАНИЕ УСЛУГИ</strong></p>`;
const iFrameElm = window.iFrameElm;
const ckeBodyElm = iFrameElm.contentDocument.querySelector('body');
ckeBodyElm.innerHTML = templateHTML;