Skip to content

Commit 11c6521

Browse files
authored
fix: Fixes 2 bugs in advanced panel (#4935)
## Description Use case 1 1. add a property 2. copy all 3. paste into any text editor 4. see that recent one is not copied Use case 2 1. add 2 properties 2. use backspace to reset the second property 3. focus should be on the first value after deleting the second one 4. use backspace to delete the first property 5. see focus jumped to search ## Steps for reproduction 1. click button 6. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent 36afe0c commit 11c6521

File tree

1 file changed

+5
-4
lines changed
  • apps/builder/app/builder/features/style-panel/sections/advanced

1 file changed

+5
-4
lines changed

apps/builder/app/builder/features/style-panel/sections/advanced/advanced.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ export const Section = () => {
451451
setSearchProperties(matched as CssProperty[]);
452452
};
453453

454-
const afterAddingStyles = () => {
454+
const afterChangingStyles = () => {
455455
setIsAdding(false);
456456
requestAnimationFrame(() => {
457457
// We are either focusing the last value input from the recent list if available or the search input.
@@ -476,7 +476,7 @@ export const Section = () => {
476476
</Box>
477477
<CopyPasteMenu
478478
onPaste={handleInsertStyles}
479-
properties={currentProperties}
479+
properties={[...recentProperties, ...currentProperties]}
480480
>
481481
<Flex gap="2" direction="column">
482482
<Flex
@@ -502,6 +502,7 @@ export const Section = () => {
502502
(recentProperty) => recentProperty !== property
503503
)
504504
);
505+
afterChangingStyles();
505506
}}
506507
/>
507508
);
@@ -519,10 +520,10 @@ export const Section = () => {
519520
onSubmit={(cssText: string) => {
520521
const styles = handleInsertStyles(cssText);
521522
if (styles.size > 0) {
522-
afterAddingStyles();
523+
afterChangingStyles();
523524
}
524525
}}
525-
onClose={afterAddingStyles}
526+
onClose={afterChangingStyles}
526527
onFocus={() => {
527528
if (isAdding === false) {
528529
handleShowAddStyleInput();

0 commit comments

Comments
 (0)