diff --git a/core/modules/node/node.preview.js b/core/modules/node/node.preview.js index f864179..2cd1b04 100644 --- a/core/modules/node/node.preview.js +++ b/core/modules/node/node.preview.js @@ -8,41 +8,44 @@ "use strict"; /** - * Provides a modal confirmation before leaving node previews. + * Provides a modal confirmation before leaving a node preview. */ Drupal.behaviors.nodePreviewDestroyLinks = { attach: function (context) { // Display a modal confirmation for all links within preview, except // for local fragment identifiers such as href="#frag". - $('a:not([href^=#])', context).on('click.preview', function (event) { + $(context).find('.node').on('click.preview', 'a:not([href^=#])', function (event) { // Only confirm leaving previews when left-clicking and user is not // pressing the ALT, CTRL, META (Command key on the Macintosh keyboard) // or SHIFT key. if (event.button === 0 && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) { event.preventDefault(); - event.stopPropagation(); - var previewElementId = 'node-preview-dialog'; - // Create the preview dialog element. - $('
' + Drupal.t('Are you sure you want to leave the preview? If you navigate away without saving, your changes will be lost.') + '