← Back to team overview

mahara-contributors team mailing list archive

[Bug 1521781] [NEW] Make TinyMCE Embedded Image support more automatic

 

Public bug reported:

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.

** Affects: mahara
     Importance: Medium
     Assignee: Aaron Wells (u-aaronw)
         Status: Confirmed


** Tags: api embeddedimages images tinymce

** Changed in: mahara
    Milestone: None => 16.04.0

** Changed in: mahara
     Assignee: (unassigned) => Aaron Wells (u-aaronw)

** Changed in: mahara
   Importance: Undecided => Medium

** Changed in: mahara
       Status: New => Confirmed

** Tags added: api embeddedimages images tinymce

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1521781

Title:
  Make TinyMCE Embedded Image support more automatic

Status in Mahara:
  Confirmed

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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1521781/+subscriptions


Follow ups