@@ -26,10 +26,8 @@ function RemoteFunctions(config = {}) {
2626 __description : "Use this to keep shared state for Live Preview Edit instead of window.*"
2727 } ;
2828
29- let _localHighlight ;
3029 let _hoverHighlight ;
3130 let _clickHighlight ;
32- let _setup = false ;
3331 let _hoverLockTimer = null ;
3432
3533 // this will store the element that was clicked previously (before the new click)
@@ -185,16 +183,6 @@ function RemoteFunctions(config = {}) {
185183 // the below code comment is replaced by added scripts for extensibility
186184 // DONT_STRIP_MINIFY:REPLACE_WITH_ADDED_REMOTE_CONSTANT_SCRIPTS
187185
188- // determine whether an event should be processed for Live Development
189- function _validEvent ( event ) {
190- if ( window . navigator . platform . substr ( 0 , 3 ) === "Mac" ) {
191- // Mac
192- return event . metaKey ;
193- }
194- // Windows
195- return event . ctrlKey ;
196- }
197-
198186 // helper function to check if an element is inside the HEAD tag
199187 // we need this because we don't wanna trigger the element highlights on head tag and its children,
200188 // except for <style> tags which should be allowed
@@ -575,26 +563,6 @@ function RemoteFunctions(config = {}) {
575563 }
576564 } ;
577565
578- function onMouseOver ( event ) {
579- if ( _validEvent ( event ) ) {
580- const element = event . target ;
581- if ( LivePreviewView . isElementInspectable ( element ) && element . nodeType === Node . ELEMENT_NODE ) {
582- _localHighlight . add ( element , true ) ;
583- }
584- }
585- }
586-
587- function onMouseOut ( event ) {
588- if ( _validEvent ( event ) ) {
589- _localHighlight . clear ( ) ;
590- }
591- }
592-
593- function onMouseMove ( event ) {
594- onMouseOver ( event ) ;
595- window . document . removeEventListener ( "mousemove" , onMouseMove ) ;
596- }
597-
598566 // helper function to get the current elements highlight mode
599567 // this is as per user settings (either click or hover)
600568 function getHighlightMode ( ) {
@@ -809,29 +777,6 @@ function RemoteFunctions(config = {}) {
809777 brieflyDisableHoverListeners ( ) ;
810778 }
811779
812- function onKeyUp ( event ) {
813- if ( _setup && ! _validEvent ( event ) ) {
814- window . document . removeEventListener ( "keyup" , onKeyUp ) ;
815- window . document . removeEventListener ( "mouseover" , onMouseOver ) ;
816- window . document . removeEventListener ( "mouseout" , onMouseOut ) ;
817- window . document . removeEventListener ( "mousemove" , onMouseMove ) ;
818- _localHighlight . clear ( ) ;
819- _localHighlight = undefined ;
820- _setup = false ;
821- }
822- }
823-
824- function onKeyDown ( event ) {
825- if ( ! _setup && _validEvent ( event ) ) {
826- window . document . addEventListener ( "keyup" , onKeyUp ) ;
827- window . document . addEventListener ( "mouseover" , onMouseOver ) ;
828- window . document . addEventListener ( "mouseout" , onMouseOut ) ;
829- window . document . addEventListener ( "mousemove" , onMouseMove ) ;
830- _localHighlight = new Highlight ( "#ecc" , true ) ;
831- _setup = true ;
832- }
833- }
834-
835780 // remove active highlights
836781 function hideHighlight ( ) {
837782 if ( _clickHighlight ) {
@@ -1282,13 +1227,7 @@ function RemoteFunctions(config = {}) {
12821227 delete previouslyClickedElement . _originalOutline ;
12831228
12841229 clearElementBackground ( previouslyClickedElement ) ;
1285- if ( _hoverHighlight ) {
1286- _hoverHighlight . clear ( ) ;
1287- }
1288- if ( _clickHighlight ) {
1289- _clickHighlight . clear ( ) ;
1290- _clickHighlight = null ;
1291- }
1230+ hideHighlight ( ) ;
12921231
12931232 // Notify handlers about cleanup
12941233 getAllToolHandlers ( ) . forEach ( handler => {
@@ -1316,7 +1255,6 @@ function RemoteFunctions(config = {}) {
13161255 function registerHandlers ( ) {
13171256 hideHighlight ( ) ; // clear previous highlighting
13181257 disableHoverListeners ( ) ; // Always remove existing listeners first to avoid duplicates
1319- window . document . removeEventListener ( "keydown" , onKeyDown ) ;
13201258 getAllToolHandlers ( ) . forEach ( handler => {
13211259 if ( handler . unregisterInteractionBlocker ) {
13221260 handler . unregisterInteractionBlocker ( ) ;
@@ -1332,7 +1270,6 @@ function RemoteFunctions(config = {}) {
13321270
13331271 // register the event handlers
13341272 enableHoverListeners ( ) ;
1335- window . document . addEventListener ( "keydown" , onKeyDown ) ;
13361273
13371274 // this is to block all the interactions of the user created elements
13381275 // so that lets say user created link doesn't redirect in edit mode
0 commit comments