Images in Rich Text Editor - DragQuestion


I am trying to tweak the H5P.DragQuestion library to support images in the rich text editor of Advanced Text using hook_h5p_semantics_alter().

If I add the 'img' tag to the 'tags' array, the option to embed an image is not appearing. Below is my code:

if($machine_name == 'H5P.AdvancedText') array_push($semantics[0]->tags,'img');

Is it not permitted to add <img> to Advanced Text or am I doing something wrong?

Kindly advise.


Supriya Rajgopal


Supporter votes Members of the Supporter Network can vote for feature requests. When the supporter network has generated sufficient funding for the top voted feature request it will normally be implemented and released. More about the H5P Supporter Network
thomasmars's picture

I suspect this is because the CKEditor in "H5P Core" is built without the "Image" plugin. To get this feature you have several alternatives:

  1. Create an issue on the h5peditor repository on github for adding the plugin to the core ckeditor, which will need some convincing arguments since it means increasing the size of core.
  2. Add an image field to the semantics of H5P.DragQuestion that does the same as an in-text image would do
  3. Create a text widget with a text editor (such as ckeditor), which is bundled with the image plugin, then change the text widget on the fields that you want to have an rich text editor with images.

I think #3 is probably the most correct approach, but with compelling arguments for adding image to ckeditor tool, you might be able to push it through.