@@ -19,10 +19,8 @@ function RemoteFunctions(config = {}) {
1919 __description : "Use this to keep shared state for Live Preview Edit instead of window.*"
2020 } ;
2121
22- let _localHighlight ;
2322 let _hoverHighlight ;
2423 let _clickHighlight ;
25- let _setup = false ;
2624 let _hoverLockTimer = null ;
2725
2826 // this will store the element that was clicked previously (before the new click)
@@ -178,16 +176,6 @@ function RemoteFunctions(config = {}) {
178176 // the below code comment is replaced by added scripts for extensibility
179177 // DONT_STRIP_MINIFY:REPLACE_WITH_ADDED_REMOTE_CONSTANT_SCRIPTS
180178
181- // determine whether an event should be processed for Live Development
182- function _validEvent ( event ) {
183- if ( window . navigator . platform . substr ( 0 , 3 ) === "Mac" ) {
184- // Mac
185- return event . metaKey ;
186- }
187- // Windows
188- return event . ctrlKey ;
189- }
190-
191179 // helper function to check if an element is inside the HEAD tag
192180 // we need this because we don't wanna trigger the element highlights on head tag and its children,
193181 // except for <style> tags which should be allowed
@@ -568,26 +556,6 @@ function RemoteFunctions(config = {}) {
568556 }
569557 } ;
570558
571- function onMouseOver ( event ) {
572- if ( _validEvent ( event ) ) {
573- const element = event . target ;
574- if ( LivePreviewView . isElementInspectable ( element ) && element . nodeType === Node . ELEMENT_NODE ) {
575- _localHighlight . add ( element , true ) ;
576- }
577- }
578- }
579-
580- function onMouseOut ( event ) {
581- if ( _validEvent ( event ) ) {
582- _localHighlight . clear ( ) ;
583- }
584- }
585-
586- function onMouseMove ( event ) {
587- onMouseOver ( event ) ;
588- window . document . removeEventListener ( "mousemove" , onMouseMove ) ;
589- }
590-
591559 // helper function to get the current elements highlight mode
592560 // this is as per user settings (either click or hover)
593561 function getHighlightMode ( ) {
@@ -802,29 +770,6 @@ function RemoteFunctions(config = {}) {
802770 brieflyDisableHoverListeners ( ) ;
803771 }
804772
805- function onKeyUp ( event ) {
806- if ( _setup && ! _validEvent ( event ) ) {
807- window . document . removeEventListener ( "keyup" , onKeyUp ) ;
808- window . document . removeEventListener ( "mouseover" , onMouseOver ) ;
809- window . document . removeEventListener ( "mouseout" , onMouseOut ) ;
810- window . document . removeEventListener ( "mousemove" , onMouseMove ) ;
811- _localHighlight . clear ( ) ;
812- _localHighlight = undefined ;
813- _setup = false ;
814- }
815- }
816-
817- function onKeyDown ( event ) {
818- if ( ! _setup && _validEvent ( event ) ) {
819- window . document . addEventListener ( "keyup" , onKeyUp ) ;
820- window . document . addEventListener ( "mouseover" , onMouseOver ) ;
821- window . document . addEventListener ( "mouseout" , onMouseOut ) ;
822- window . document . addEventListener ( "mousemove" , onMouseMove ) ;
823- _localHighlight = new Highlight ( "#ecc" , true ) ;
824- _setup = true ;
825- }
826- }
827-
828773 // remove active highlights
829774 function hideHighlight ( ) {
830775 if ( _clickHighlight ) {
@@ -1275,13 +1220,7 @@ function RemoteFunctions(config = {}) {
12751220 delete previouslyClickedElement . _originalOutline ;
12761221
12771222 clearElementBackground ( previouslyClickedElement ) ;
1278- if ( _hoverHighlight ) {
1279- _hoverHighlight . clear ( ) ;
1280- }
1281- if ( _clickHighlight ) {
1282- _clickHighlight . clear ( ) ;
1283- _clickHighlight = null ;
1284- }
1223+ hideHighlight ( ) ;
12851224
12861225 // Notify handlers about cleanup
12871226 getAllToolHandlers ( ) . forEach ( handler => {
@@ -1309,7 +1248,6 @@ function RemoteFunctions(config = {}) {
13091248 function registerHandlers ( ) {
13101249 hideHighlight ( ) ; // clear previous highlighting
13111250 disableHoverListeners ( ) ; // Always remove existing listeners first to avoid duplicates
1312- window . document . removeEventListener ( "keydown" , onKeyDown ) ;
13131251 getAllToolHandlers ( ) . forEach ( handler => {
13141252 if ( handler . unregisterInteractionBlocker ) {
13151253 handler . unregisterInteractionBlocker ( ) ;
@@ -1325,7 +1263,6 @@ function RemoteFunctions(config = {}) {
13251263
13261264 // register the event handlers
13271265 enableHoverListeners ( ) ;
1328- window . document . addEventListener ( "keydown" , onKeyDown ) ;
13291266
13301267 // this is to block all the interactions of the user created elements
13311268 // so that lets say user created link doesn't redirect in edit mode
0 commit comments