Skip to content

Commit b693c5a

Browse files
committed
feat: improved copy paste support
1 parent 442f4c9 commit b693c5a

2 files changed

Lines changed: 68 additions & 12 deletions

File tree

‎src/nls/root/strings.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,8 +830,10 @@ define({
830830
"LIVE_PREVIEW_LAYERS_INSERT_ELEMENT": "Insert Element",
831831
"LIVE_PREVIEW_LAYERS_CHANGE_COLOR": "Change color",
832832
"LIVE_PREVIEW_LAYERS_COPY_DECLARATION": "Copy property",
833-
"LIVE_PREVIEW_LAYERS_COPY_RULE": "Copy selector and properties",
834-
"LIVE_PREVIEW_LAYERS_PASTE_HINT": "Paste properties or a CSS rule here",
833+
"LIVE_PREVIEW_LAYERS_COPY_RULE": "Copy rule",
834+
"LIVE_PREVIEW_LAYERS_PASTE_PROPERTIES": "Paste properties",
835+
"LIVE_PREVIEW_LAYERS_PASTE": "Paste",
836+
"LIVE_PREVIEW_LAYERS_STYLES_MENU_HINT": "Right-click to copy or paste styles",
835837
"LIVE_PREVIEW_LAYERS_PASTE_INVALID": "Paste CSS properties or one complete selector at a time.",
836838
"LIVE_PREVIEW_LAYERS_PASTE_FAILED": "Couldn’t paste these properties. Try again.",
837839
"LIVE_PREVIEW_LAYERS_PASTED": "Properties pasted into {0}",

‎src/styles/Extn-LayersPanel.less‎

Lines changed: 64 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,10 +1087,56 @@
10871087
display: flex;
10881088
}
10891089

1090-
.layers-decl.layers-editing .layers-decl-actions {
1090+
.layers-decl.layers-editing .layers-decl-actions,
1091+
.layers-decl.layers-copied .layers-decl-actions {
10911092
display: none;
10921093
}
10931094

1095+
.layers-decl.layers-menu-target,
1096+
.layers-rule-header.layers-menu-target {
1097+
background: @layers-hover-bg;
1098+
}
1099+
1100+
.layers-decl.layers-copied {
1101+
animation: layers-flash-row 800ms ease-out;
1102+
}
1103+
1104+
.layers-rule-header.layers-copied {
1105+
border-radius: 3px;
1106+
animation: layers-flash-row 800ms ease-out;
1107+
}
1108+
1109+
.layers-copied-tip {
1110+
position: fixed;
1111+
z-index: 10;
1112+
display: flex;
1113+
align-items: center;
1114+
gap: 4px;
1115+
box-sizing: border-box;
1116+
height: 20px;
1117+
margin-top: -10px;
1118+
padding: 0 8px 0 6px;
1119+
border: 1px solid fade(@layers-accent, 55%);
1120+
border-radius: 10px;
1121+
background: #2a2a2a;
1122+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
1123+
color: @project-panel-text-1;
1124+
font-size: @sidebar-xs-font-size;
1125+
white-space: nowrap;
1126+
pointer-events: none;
1127+
animation: layers-copied-tip 1400ms ease-out forwards;
1128+
1129+
.layers-copied-icon {
1130+
display: flex;
1131+
color: @layers-accent;
1132+
1133+
svg {
1134+
width: 12px;
1135+
height: 12px;
1136+
}
1137+
}
1138+
}
1139+
10941140
.layers-decl.layers-overridden {
10951141
.layers-decl-field {
10961142
text-decoration: line-through;
@@ -1130,15 +1176,6 @@
11301176
min-height: 20px;
11311177
}
11321178

1133-
.layers-rule-copy {
1134-
opacity: 0;
1135-
}
1136-
1137-
.layers-rule-header:hover .layers-rule-copy,
1138-
.layers-rule-header:focus-within .layers-rule-copy {
1139-
opacity: 1;
1140-
}
1141-
11421179
.layers-rule-header:focus-visible {
11431180
outline: 1px solid @layers-accent;
11441181
outline-offset: 2px;
@@ -1819,6 +1856,23 @@ body.layers-dnd-invalid {
18191856
}
18201857
}
18211858

1859+
@keyframes layers-copied-tip {
1860+
0% {
1861+
opacity: 0;
1862+
transform: translateY(4px);
1863+
}
1864+
1865+
12%, 80% {
1866+
opacity: 1;
1867+
transform: none;
1868+
}
1869+
1870+
100% {
1871+
opacity: 0;
1872+
transform: none;
1873+
}
1874+
}
1875+
18221876
@keyframes layers-notice-in {
18231877
0% {
18241878
opacity: 0;

0 commit comments

Comments
 (0)