From 3120928e571868ff3e640fad19d5612d7191890b Mon Sep 17 00:00:00 2001
From: Tony CABAYE <tony.cabaye@smile.fr>
Date: Wed, 5 Mar 2025 14:29:59 +0100
Subject: [PATCH] Issue #3511168 by grimreaper, tocab: Node preview modal: use
 Drupal API

---
 core/modules/node/js/node.preview.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/core/modules/node/js/node.preview.js b/core/modules/node/js/node.preview.js
index 50bc58ade774..e23be0b71e22 100644
--- a/core/modules/node/js/node.preview.js
+++ b/core/modules/node/js/node.preview.js
@@ -34,13 +34,13 @@
           const $previewDialog = $(
             `<div>${Drupal.theme('nodePreviewModal')}</div>`,
           ).appendTo('body');
-          Drupal.dialog($previewDialog, {
+          const confirmationDialog = Drupal.dialog($previewDialog, {
             title: Drupal.t('Leave preview?'),
             buttons: [
               {
                 text: Drupal.t('Cancel'),
                 click() {
-                  $(this).dialog('close');
+                  confirmationDialog.close();
                 },
               },
               {
@@ -50,7 +50,8 @@
                 },
               },
             ],
-          }).showModal();
+          });
+          confirmationDialog.showModal();
         }
       }
 
-- 
GitLab