Skip to content

Commit a44c028

Browse files
committed
feat: inline property editing in layers panel
1 parent f430850 commit a44c028

2 files changed

Lines changed: 95 additions & 18 deletions

File tree

‎src/nls/root/strings.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,8 @@ define({
830830
"LIVE_PREVIEW_LAYERS_MOVE_UP": "Move Up",
831831
"LIVE_PREVIEW_LAYERS_MOVE_DOWN": "Move Down",
832832
"LIVE_PREVIEW_LAYERS_REVEAL_IN_CODE": "Reveal in Code",
833+
"LIVE_PREVIEW_LAYERS_ADD_ATTRIBUTE": "Add Attribute",
834+
"LIVE_PREVIEW_LAYERS_REMOVE_ATTRIBUTE": "Remove Attribute",
833835
"LIVE_PREVIEW_LAYERS_PROPERTIES": "Properties",
834836
"LIVE_PREVIEW_LAYERS_STYLES": "Styles",
835837
"LIVE_PREVIEW_LAYERS_NO_SELECTION": "Select an element to see its details",

‎src/styles/Extn-LayersPanel.less‎

Lines changed: 93 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -563,34 +563,115 @@
563563

564564
.layers-prop-row {
565565
display: flex;
566-
align-items: baseline;
567-
gap: 8px;
568-
min-height: 20px;
566+
align-items: center;
567+
gap: 6px;
568+
min-height: 24px;
569569

570570
.layers-label {
571571
flex: 0 0 44px;
572572
}
573573
}
574574

575-
.layers-prop-value {
575+
.layers-prop-input[type="text"] {
576576
flex: 1;
577577
min-width: 0;
578+
height: 22px;
579+
padding: 0 5px;
580+
margin: 0;
581+
border: 1px solid transparent;
582+
border-radius: 4px;
583+
outline: none;
584+
box-shadow: none;
585+
background: transparent;
586+
color: @project-panel-text-1;
578587
font-family: @layers-mono;
579588
font-size: @sidebar-xs-font-size;
580-
color: @project-panel-text-1;
581-
word-break: break-all;
582-
user-select: text;
589+
text-overflow: ellipsis;
590+
591+
&::placeholder {
592+
color: @project-panel-text-2;
593+
opacity: 0.6;
594+
}
595+
596+
&:hover:not([readonly]) {
597+
border-color: @layers-border;
598+
background: @layers-input-bg;
599+
}
600+
601+
&:focus {
602+
border-color: @layers-accent;
603+
background: @layers-input-bg-focus;
604+
text-overflow: clip;
605+
}
606+
607+
&[readonly] {
608+
color: @project-panel-text-2;
609+
cursor: default;
610+
}
583611
}
584612

585-
.layers-group {
613+
.layers-attrs {
586614
margin-top: 8px;
587-
padding-top: 6px;
615+
padding-top: 4px;
588616
border-top: 1px solid @layers-border;
617+
}
589618

590-
> .layers-label {
591-
display: block;
592-
margin-bottom: 2px;
619+
.layers-attrs-header {
620+
display: flex;
621+
align-items: center;
622+
min-height: 20px;
623+
624+
.layers-label {
625+
flex: 1;
593626
}
627+
628+
.layers-icon-btn {
629+
opacity: 0;
630+
}
631+
}
632+
633+
.layers-attrs:hover .layers-attrs-header .layers-icon-btn,
634+
.layers-attrs-header .layers-icon-btn:focus {
635+
opacity: 1;
636+
}
637+
638+
.layers-attrs-none {
639+
padding: 2px 0 2px 5px;
640+
color: @project-panel-text-2;
641+
opacity: 0.7;
642+
}
643+
644+
.layers-attr-row {
645+
display: flex;
646+
align-items: center;
647+
gap: 4px;
648+
min-height: 24px;
649+
650+
.layers-icon-btn {
651+
opacity: 0;
652+
}
653+
654+
&:hover .layers-icon-btn,
655+
.layers-icon-btn:focus {
656+
opacity: 1;
657+
}
658+
}
659+
660+
.layers-attr-name {
661+
flex: 0 0 44px;
662+
min-width: 0;
663+
padding-left: 5px;
664+
overflow: hidden;
665+
text-overflow: ellipsis;
666+
white-space: nowrap;
667+
font-family: @layers-mono;
668+
font-size: @sidebar-xs-font-size;
669+
color: @layers-prop-name;
670+
}
671+
672+
.layers-attr-row [data-role="name"] {
673+
flex: 0 0 44px;
674+
color: @layers-prop-name;
594675
}
595676

596677
.layers-decl {
@@ -671,12 +752,6 @@
671752
opacity: 1;
672753
}
673754

674-
.layers-pane-footer {
675-
display: flex;
676-
justify-content: flex-end;
677-
margin-top: 8px;
678-
}
679-
680755
.layers-rule {
681756
margin-bottom: 6px;
682757
padding-bottom: 6px;

0 commit comments

Comments
 (0)