0

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) {
        $(this).parent().next().find(".insert-button").trigger("click");
      });

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.

2
  • Hey @roland-snowe , what jQuery version are you currently using? Mar 22, 2018 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. Mar 22, 2018 at 19:47

1 Answer 1

0

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!

1
  • @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 Apr 16, 2018 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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