File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/LiveDevelopment/BrowserScripts Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -3755,9 +3755,10 @@ function RemoteFunctions(config = {}) {
37553755 * @param {Element } element - The DOM element to select
37563756 */
37573757 function _selectElement ( element ) {
3758- // dismiss all UI boxes and cleanup previous element state when selecting a different element
3759- dismissUIAndCleanupState ( ) ;
3760- dismissImageRibbonGallery ( ) ;
3758+ dismissNodeMoreOptionsBox ( ) ;
3759+ dismissAIPromptBox ( ) ;
3760+ dismissNodeInfoBox ( ) ;
3761+ cleanupPreviousElementState ( ) ;
37613762
37623763 // this should always happen before isElementEditable check because this is not a live preview edit feature
37633764 // this should also be there when users are in highlight mode
@@ -3769,10 +3770,14 @@ function RemoteFunctions(config = {}) {
37693770
37703771 // if imageGallerySelected is true, show the image gallery directly
37713772 if ( element && element . tagName . toLowerCase ( ) === 'img' && imageGallerySelected ) {
3772- if ( ! _imageRibbonGallery ) {
3773+ if ( ! _imageRibbonGallery || _imageRibbonGallery . element !== element ) {
3774+ dismissImageRibbonGallery ( ) ; // Dismiss only when creating new
37733775 _imageRibbonGallery = new ImageRibbonGallery ( element ) ;
37743776 scrollImageToViewportIfRequired ( element , _imageRibbonGallery ) ;
37753777 }
3778+ } else {
3779+ // Not an image or gallery not selected, dismiss if exists
3780+ dismissImageRibbonGallery ( ) ;
37763781 }
37773782
37783783 // make sure that the element is actually visible to the user
You can’t perform that action at this time.
0 commit comments