Search code examples
drupal-7ckeditor

CKeditor Images not displaying


My CKeditor is not displaying existing images. I have confirmed that it was added to the extraAllowedContent and I have the img button in the toolbar, I can add images and it shows them. But once the page is saved, and its loaded back the images are not showing, I can see them when I view source, and also if I use DevTools I can locate the hidden textarea tag and see the img src markup, but the editor just strips out the tags. I feel I have tried everything!

config.allowedContent = true;
config.extraAllowedContent =
"img(*)[*]{*};p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*};";

Stuff I have tried... https://drupal.stackexchange.com/questions/57876/images-not-displaying-on-site-or-in-view-source-after-uploading-them-with-cked

https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-extraAllowedContent

Using CKeditor 4.9.2


Solution

  • FIXED: I had added some code to allow <i></i> tags for font-awesome, and apparently it was catching the <img> tag??? Not sure but I removed the following and now tags are back showing up.

      // config.protectedSource.push(/<i[\s\S]*?\>/g); //allows beginning <i> tag
      // config.protectedSource.push(/<\/i[\s\S]*?\>/g); //allows ending </i> tag