Make TinyMCE Embedded Image support more automatic

Bug #1521781 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Confirmed
Wishlist
Unassigned

Bug Description

We've added that great plugin to TinyMCE that lets you select and embed your Mahara images easily, and we've added some library code to make sure that people can view your images if they're embedded (instead of the old system of relying on the image being shared specifically in an image block).

However, the current implementation relies on the developer specifically calling a series of functions in the form submission function, and there's no warning or penalty if they fail to do that, so it is often overlooked when creating new places that use a wysiwyg text editor.

I'd like to see the support for this become more automatic, ideally by making the pieform "wysiwyg" form element handle all of the linking logic for the embedded images.

My proposal is this:

1. Check to see if there is a post-submit hook in Pieforms for pieform elements. If there isn't, add one.

2. Write a post-submit hook handler for the wysiwyg element, that takes care of calling the necessary embedded image libraries

3. Add settings for the wysiwyg element to get the extra data we needed for this (i.e., the "resource type" for artefact_file_embedded).

4. Add another setting to the wysiwyg element (off by default) to say "don't use the Mahara image picker in this one". For wysiwygs where we don't want to support embedded Mahara images (if there are any)

5. The tricky part here is that the embedded image thing will need to know the id of the "Resource" that you're embedding the image in. And if you're creating a new resource, you won't know that until after the form's submit method has finished. So, we'll have to expect the developer to provide the new resource's ID back to the $form object, and to help enforce that, we can make the wysiwyg post-submit hook throw an error if the wysiwyg element has embedded images turned on but it did not receive a resource ID.

Aaron Wells (u-aaronw)
Changed in mahara:
milestone: none → 16.04.0
assignee: nobody → Aaron Wells (u-aaronw)
importance: Undecided → Medium
status: New → Confirmed
tags: added: api embeddedimages images tinymce
Changed in mahara:
milestone: 16.04.0 → 16.10.0
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.0 → 16.10.1
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.1 → 17.04.0
Changed in mahara:
importance: Medium → Wishlist
assignee: Aaron Wells (u-aaronw) → nobody
milestone: 17.04.0 → none
tags: added: third-party
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.