diff --git a/core/modules/edit/js/edit.js b/core/modules/edit/js/edit.js index d66231f..6ee3650 100644 --- a/core/modules/edit/js/edit.js +++ b/core/modules/edit/js/edit.js @@ -385,8 +385,11 @@ function initializeEntityContextualLink (contextualLink) { }); fieldsAvailableQueue = _.difference(fieldsAvailableQueue, fields); - // Set up contextual link view after loading any missing in-place editors. - loadMissingEditors(function () { + /** + * Initialization should only be called once. Use underscore's once method + * to get a one-time use version of the function. + */ + var initContextualLink = _.once(function () { var $links = $(contextualLink.el).find('.contextual-links'); var contextualLinkView = new Drupal.edit.ContextualLinkView($.extend({ el: $('
  • ').prependTo($links), @@ -396,6 +399,9 @@ function initializeEntityContextualLink (contextualLink) { entityModel.set('contextualLinkView', contextualLinkView); }); + // Set up contextual link view after loading any missing in-place editors. + loadMissingEditors(initContextualLink); + return true; } // There was not at least one field that the current user may edit in-place,