File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,12 @@ public function addReferenceFieldItem(FormField $field) {
176176 public function fillWysiwygEditor (IdentifiableFormFieldInterface $ field , $ content ) {
177177 $ selector = $ this ->webdriver ->grabAttributeFrom ($ field ->value , 'id ' );
178178 $ script = "jQuery(function(){CKEDITOR.instances[ \"$ selector \"].setData( \"$ content \")}); " ;
179+ // Check if CKEditor5 is in use. If so, override the script as global
180+ // registry of editor instances is no longer available and a different
181+ // approach is used to access them via DOM.
182+ if (!empty ($ this ->webdriver ->grabAttributeFrom ($ field ->value , 'data-ckeditor5-id ' ))) {
183+ $ script = "document.querySelector( \"# $ selector \").nextSibling.querySelector( \".ck-editor__editable_inline \").ckeditorInstance.setData( \"$ content \") " ;
184+ }
179185 $ this ->webdriver ->executeInSelenium (function (RemoteWebDriver $ webDriver ) use ($ script ) {
180186 $ webDriver ->executeScript ($ script );
181187 });
You can’t perform that action at this time.
0 commit comments