diff --git a/core/modules/node/node.js b/core/modules/node/node.js index ebf68eb..f6ec3f2 100644 --- a/core/modules/node/node.js +++ b/core/modules/node/node.js @@ -40,4 +40,17 @@ Drupal.behaviors.nodeFieldsetSummaries = { } }; +/** + * Destroys all links in node previews to prevent users from leaving the page. + */ +Drupal.behaviors.nodePreviewDestroyLinks = { + attach: function (context) { + $('.node.preview', context).once('node-preview', function () { + $(this).find('a').each(function () { + $(this).attr('href', '#' + $(this).attr('href')); + }); + }); + } +}; + })(jQuery);