@@ -3927,21 +3927,23 @@ function RemoteFunctions(config = {}) {
39273927 function handleElementClick ( element , event ) {
39283928 if ( ! isElementInspectable ( element ) ) { return ; }
39293929
3930+ // if anything is currently selected, we need to clear that
3931+ const selection = window . getSelection ( ) ;
3932+ if ( selection && selection . toString ( ) . length > 0 ) {
3933+ selection . removeAllRanges ( ) ;
3934+ }
3935+
39303936 // send cursor movement message to editor so cursor jumps to clicked element
39313937 if ( element . hasAttribute ( "data-brackets-id" ) ) {
3932- const selection = window . getSelection ( ) ;
3933-
3934- if ( ! selection || selection . toString ( ) . length === 0 ) {
3935- window . _Brackets_MessageBroker . send ( {
3936- "tagId" : element . getAttribute ( "data-brackets-id" ) ,
3937- "nodeID" : element . id ,
3938- "nodeClassList" : element . classList ,
3939- "nodeName" : element . nodeName ,
3940- "allSelectors" : window . getAllInheritedSelectorsInOrder ( element ) ,
3941- "contentEditable" : element . contentEditable === "true" ,
3942- "clicked" : true
3943- } ) ;
3944- }
3938+ window . _Brackets_MessageBroker . send ( {
3939+ "tagId" : element . getAttribute ( "data-brackets-id" ) ,
3940+ "nodeID" : element . id ,
3941+ "nodeClassList" : element . classList ,
3942+ "nodeName" : element . nodeName ,
3943+ "allSelectors" : window . getAllInheritedSelectorsInOrder ( element ) ,
3944+ "contentEditable" : element . contentEditable === "true" ,
3945+ "clicked" : true
3946+ } ) ;
39453947 }
39463948
39473949 // call the selectElement as selectElement handles all the highlighting/boxes and all UI related stuff
0 commit comments