Does anyone have an issue with the fancy insert module, not actually inserting the image on click recently?

It looks like the javascript in the fancy insert was hooking into the insert button by traversing up from each image thumbnail.

// Click on Insert button when an image is clicked
      $('#' + value + ' img').bind('click', function (e) {

I can't see any obvious reason why this would have stopped functioning with updates.

So my question is, has anyone else run into this issue with the latest Drupal core updates? At first I thought it was a lack of unique id on each imagefield, but after reviewing the code again I don't think that is the case.

At any rate am looking for anyone who may have run into this and found a fix.

| improve this question | | | | |
  • Hey @roland-snowe , what jQuery version are you currently using? – Stefanos Petrakis Mar 22 '18 at 19:42
  • ah yes sorry, running: Drupal 7.56 and jquery 1.5- tested with other jquery versions just to see if any worked, no luck. – Roland Snowe Mar 22 '18 at 19:47

The issue is caused by the insert module. The latest version (1.4) switched from using click to mousedown events, in this issue https://www.drupal.org/node/2295507

The patch submitted here (https://www.drupal.org/project/fancy_insert/issues/2955599#comment-12571625) should solve your issue, it basically switches from triggering click to triggering mousedown events as a way to connect to the insert module's functionality.

Here is the code change for reference:

diff --git a/fancy_insert.js b/fancy_insert.js
index 8325c96..0b99824 100644
--- a/fancy_insert.js
+++ b/fancy_insert.js
@@ -21,7 +21,7 @@ Drupal.behaviors.fancy_insert = {
-            $(this).parent().next().find(".insert-button").trigger("click");
+            $(this).parent().next().find(".insert-button").trigger("mousedown");

Good luck!

| improve this answer | | | | |
  • @roland-snowe : the provided patch was already committed by fancy insert's maintainer. So, all you need to do is get that patch, either directly, or by updating to the latest dev version of fancy insert – Stefanos Petrakis Apr 16 '18 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.