From 9962c62171fcc1eab3e83d8efbf102cf98b8e83b Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Mon, 17 Mar 2025 23:33:21 +0900 Subject: [PATCH] Fix: No alert when leaving the theme/plugin editor --- src/theme-plugin-editor/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/theme-plugin-editor/index.js b/src/theme-plugin-editor/index.js index e93022b..1a2c48c 100644 --- a/src/theme-plugin-editor/index.js +++ b/src/theme-plugin-editor/index.js @@ -42,6 +42,10 @@ initLoader().then( ( monaco ) => { return; } textarea.value = editorValue; + // Update the dirty state to display an alert when leaving the page. + if ( window.wp && window.wp.themePluginEditor ) { + window.wp.themePluginEditor.dirty = true; + } } ); // Enable Emmet.