@@ -3918,16 +3918,42 @@ function RemoteFunctions(config = {}) {
39183918 } , 800 ) ;
39193919 }
39203920
3921+ /**
3922+ * this function is called when user clicks on an element in the LP when in edit mode
3923+ *
3924+ * @param {HTMLElement } element - The clicked element
3925+ * @param {Event } event - The click event
3926+ */
3927+ function handleElementClick ( element , event ) {
3928+ if ( ! isElementInspectable ( element ) ) { return ; }
3929+
3930+ // send cursor movement message to editor so cursor jumps to clicked element
3931+ 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+ }
3945+ }
3946+
3947+ // call the selectElement as selectElement handles all the highlighting/boxes and all UI related stuff
3948+ _selectElement ( element ) ;
3949+ activateHoverLock ( ) ;
3950+ }
3951+
39213952 /**
39223953 * this acts as the "KILL SWITCH", it blocks all the click related events from user elements
39233954 * but we exclude all the phoenix interal elements
39243955 * we call this function from inside registerHandlers
39253956 */
3926- /**
3927- * Central event blocker for edit mode
3928- * Blocks all user page interactions but allows Phoenix UI to work
3929- * Stores handler references so they can be removed when switching modes
3930- */
39313957 function registerInteractionBlocker ( ) {
39323958 // Create an object to store handler references
39333959 _interactionBlockerHandlers = { } ;
@@ -3953,8 +3979,7 @@ function RemoteFunctions(config = {}) {
39533979 // Skip click handling on the second click of a double-click
39543980 // event.detail = 1 for first click, 2 for second click (during double-click)
39553981 if ( event . detail !== 2 ) {
3956- _selectElement ( element ) ;
3957- activateHoverLock ( ) ;
3982+ handleElementClick ( element , event ) ;
39583983 }
39593984 } else if ( eventType === "dblclick" ) {
39603985 if ( isElementEditable ( element ) && _shouldShowEditTextOption ( element ) ) {
0 commit comments