Skip to content

Commit 226b191

Browse files
committed
fix: dont remove the element highlighting when selected from a css selector
1 parent f03e0de commit 226b191

2 files changed

Lines changed: 9 additions & 19 deletions

File tree

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function RemoteFunctions(config = {}) {
3333
let _clickHighlight;
3434
let _cssSelectorHighlight; // temporary highlight for CSS selector matches in edit mode
3535
let _hoverLockTimer = null;
36-
let _cssSelectorHighlightTimer = null; // timer for clearing temporary CSS selector highlights
36+
let _cssSelectorHighlightTimer = null;
3737

3838
// this will store the element that was clicked previously (before the new click)
3939
// we need this so that we can remove click styling from the previous element when a new element is clicked
@@ -642,7 +642,7 @@ function RemoteFunctions(config = {}) {
642642
selectElement(element);
643643
}
644644

645-
// clear temporary CSS selector highlights
645+
// clear CSS selector highlights
646646
function clearCssSelectorHighlight() {
647647
if (_cssSelectorHighlightTimer) {
648648
clearTimeout(_cssSelectorHighlightTimer);
@@ -661,31 +661,26 @@ function RemoteFunctions(config = {}) {
661661
}
662662
}
663663

664-
// create temporary CSS selector highlights for edit mode
664+
// create CSS selector highlights for edit mode
665665
function createCssSelectorHighlight(nodes, rule) {
666-
// Clear any existing temporary highlights
666+
// Clear any existing highlights
667667
clearCssSelectorHighlight();
668668

669-
// Create new temporary highlight for all matching elements
670-
// Skip the selected element since it already has a click highlight
669+
// Highlight all matching elements except the selected one
670+
// (it already has a click highlight)
671671
_cssSelectorHighlight = new Highlight();
672672
for (let i = 0; i < nodes.length; i++) {
673673
if (nodes[i] !== previouslySelectedElement &&
674674
LivePreviewView.isElementInspectable(nodes[i], true) &&
675675
nodes[i].nodeType === Node.ELEMENT_NODE) {
676676
_cssSelectorHighlight.add(nodes[i]);
677-
// Apply outline to all matching elements so they are visible
678-
// even when they have no margin/padding
679677
nodes[i]._originalCssSelectorOutline = nodes[i].style.outline;
680678
const isEditable = nodes[i].hasAttribute(GLOBALS.DATA_BRACKETS_ID_ATTR);
681679
const outlineColor = isEditable ? COLORS.outlineEditable : COLORS.outlineNonEditable;
682680
nodes[i].style.outline = `1px solid ${outlineColor}`;
683681
}
684682
}
685683
_cssSelectorHighlight.selector = rule;
686-
687-
// Clear temporary highlights after 2 seconds
688-
_cssSelectorHighlightTimer = setTimeout(clearCssSelectorHighlight, 2000);
689684
}
690685

691686
// remove active highlights

src/nls/root/strings.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,6 @@ define({
266266
"LIVE_DEV_ELEMENT_PROPS_COMPUTED": "Computed:",
267267
"LIVE_DEV_ELEMENT_PROPS_USE_CUSTOM": "Use \u201c{0}\u201d",
268268
"LIVE_DEV_CB_EXCEEDED_CLASSES": "+{0} more",
269-
"LIVE_DEV_CB_TITLE_FONT": "Font",
270-
"LIVE_DEV_CB_TITLE_SPACING": "Spacing",
271-
"LIVE_DEV_CB_TITLE_BORDER": "Border",
272-
"LIVE_DEV_CB_TITLE_EFFECTS": "Effects",
273-
"LIVE_DEV_CB_TITLE_LAYOUT": "Layout",
274-
"LIVE_DEV_CB_TITLE_OBJECT_FIT": "Object Fit",
275-
"LIVE_DEV_CB_TITLE_LIST_STYLE": "List Style",
276269
"LIVE_DEV_CB_TIP_TEXT_COLOR": "Text Color",
277270
"LIVE_DEV_CB_TIP_BG_COLOR": "Background Color",
278271
"LIVE_DEV_CB_TIP_FONT": "Font",
@@ -347,7 +340,6 @@ define({
347340
"LIVE_DEV_CB_LIST_UPPER_ROMAN": "Upper Roman",
348341
"LIVE_DEV_CB_LIST_OUTSIDE": "Outside",
349342
"LIVE_DEV_CB_LIST_INSIDE": "Inside",
350-
"LIVE_DEV_CB_TITLE_SPACING_BOX": "Spacing",
351343
"LIVE_DEV_CB_TIP_SPACING": "Margin & Padding",
352344
"LIVE_DEV_CB_LABEL_MARGIN": "Margin",
353345
"LIVE_DEV_CB_LABEL_PADDING": "Padding",
@@ -363,6 +355,9 @@ define({
363355
"LIVE_DEV_CB_PER_CORNER": "Per corner",
364356
"LIVE_DEV_CB_SHADOW_ADD": "Add Shadow",
365357
"LIVE_DEV_CB_SHADOW_INSET": "Inset",
358+
"LIVE_DEV_CB_COLOR_RECENT": "Recent",
359+
"LIVE_DEV_CB_COLOR_FROM_PAGE": "From page",
360+
"LIVE_DEV_CB_COLOR_SUGGESTED": "Suggested",
366361
"LIVE_DEV_CB_LABEL_COLUMNS": "Columns",
367362
"LIVE_DEV_CB_LABEL_ROWS": "Rows",
368363
"LIVE_DEV_CB_LABEL_JUSTIFY_ITEMS": "Justify",

0 commit comments

Comments
 (0)