Skip to content

Commit 1c0cd9c

Browse files
committed
chore: expose live preview seelcted element globally
1 parent 52351eb commit 1c0cd9c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ function RemoteFunctions(config = {}) {
3636
// this will store the element that was clicked previously (before the new click)
3737
// we need this so that we can remove click styling from the previous element when a new element is clicked
3838
let previouslySelectedElement = null;
39+
// Expose the currently selected element globally for external access
40+
window.__current_ph_lp_selected = null;
3941

4042
var req, timeout;
4143
function animateHighlight(time) {
@@ -710,6 +712,7 @@ function RemoteFunctions(config = {}) {
710712
_clickHighlight.add(element, true);
711713

712714
previouslySelectedElement = element;
715+
window.__current_ph_lp_selected = element;
713716
}
714717

715718
function disableHoverListeners() {
@@ -1317,6 +1320,7 @@ function RemoteFunctions(config = {}) {
13171320
}
13181321
delete previouslySelectedElement._originalOutline;
13191322
previouslySelectedElement = null;
1323+
window.__current_ph_lp_selected = null;
13201324
}
13211325

13221326
if (config.mode === 'edit') {

0 commit comments

Comments
 (0)