@@ -2208,6 +2208,9 @@ function RemoteFunctions(config) {
22082208 * @param {Element } element - The DOM element to select
22092209 */
22102210 function _selectElement ( element ) {
2211+ // dismiss all UI boxes and cleanup previous element state when selecting a different element
2212+ dismissUIAndCleanupState ( ) ;
2213+
22112214 // make sure that the feature is enabled and also the element has the attribute 'data-brackets-id'
22122215 if (
22132216 ! config . isLPEditFeaturesActive ||
@@ -2219,37 +2222,13 @@ function RemoteFunctions(config) {
22192222 return ;
22202223 }
22212224
2222- if ( _nodeMoreOptionsBox ) {
2223- _nodeMoreOptionsBox . remove ( ) ;
2224- _nodeMoreOptionsBox = null ;
2225- }
2226-
2227- // to remove the outline styling from the previously clicked element
2228- if ( previouslyClickedElement ) {
2229- if ( previouslyClickedElement . _originalOutline !== undefined ) {
2230- previouslyClickedElement . style . outline = previouslyClickedElement . _originalOutline ;
2231- } else {
2232- previouslyClickedElement . style . outline = "" ;
2233- }
2234- delete previouslyClickedElement . _originalOutline ;
2235-
2236- // Remove highlighting from previously clicked element
2237- if ( getHighlightMode ( ) === "click" ) {
2238- clearElementBackground ( previouslyClickedElement ) ;
2239- }
2240- }
2241-
22422225 // make sure that the element is actually visible to the user
22432226 if ( isElementVisible ( element ) ) {
22442227 _nodeMoreOptionsBox = new NodeMoreOptionsBox ( element ) ;
2245-
2246- // show the info box when a DOM element is selected, but first remove any existing info box
2247- dismissNodeInfoBox ( ) ;
22482228 _nodeInfoBox = new NodeInfoBox ( element ) ;
22492229 } else {
22502230 // Element is hidden, so don't show UI boxes but still apply visual styling
22512231 _nodeMoreOptionsBox = null ;
2252- dismissNodeInfoBox ( ) ;
22532232 }
22542233
22552234 element . _originalOutline = element . style . outline ;
0 commit comments