Skip to content

Commit f77d539

Browse files
author
Hwashiang Yu
committed
MC-3477: Polish prototype and apply rearranging in preview
- Cleaned up button styling - Updated docblocks - Updated syntax for button item options
1 parent d16498e commit f77d539

File tree

5 files changed

+38
-43
lines changed

5 files changed

+38
-43
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/css/source/content-type/button-item/_default.less

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,29 @@
99

1010
.pagebuilder-content-type {
1111
.pagebuilder-button-item {
12+
font-size: 0;
13+
width: auto;
14+
z-index: auto;
15+
.pagebuilder-options {
16+
bottom: 0;
17+
left: calc(50% - 5px);
18+
transform: translate(-50%, -50%);
19+
li.pagebuilder-options-link {
20+
margin: 0;
21+
}
22+
}
23+
[contenteditable=true] {
24+
display: inline-block;
25+
min-height: 18px;
26+
min-width: 20px;
27+
}
1228
&.pagebuilder-content-type-active {
1329
.button-item-drag-handle {
30+
color: @color-dark-gray0;
1431
position: absolute;
15-
&.disabled:before {
16-
color: @color-light-gray;
17-
cursor: not-allowed;
18-
}
19-
20-
&.disabled:active:before {
21-
cursor: not-allowed;
22-
}
2332

2433
&:before {
2534
.abs-icon;
26-
color: @color-dark-gray0;
2735
content: @icon-gripper__content;
2836
cursor: move; /* fallback if grab cursor is unsupported */
2937
cursor: grab;
@@ -35,30 +43,19 @@
3543
line-height: 2.2rem;
3644
position: relative;
3745
width: 0;
46+
47+
&:active {
48+
cursor: grabbing;
49+
cursor: -moz-grabbing;
50+
cursor: -webkit-grabbing;
51+
}
3852
}
3953

40-
&:active:before {
41-
cursor: grabbing;
42-
cursor: -moz-grabbing;
43-
cursor: -webkit-grabbing;
54+
&.disabled:before {
55+
color: @color-light-gray;
56+
cursor: not-allowed;
4457
}
4558
}
4659
}
47-
[contenteditable=true] {
48-
display: inline-block;
49-
min-height: 18px;
50-
min-width: 20px;
51-
}
52-
font-size: 0;
53-
width: auto;
54-
z-index: auto;
55-
.pagebuilder-options {
56-
bottom: 0;
57-
left: calc(50% - 5px);
58-
transform: translate(-50%, -50%);
59-
li.pagebuilder-options-link {
60-
margin: 0;
61-
}
62-
}
6360
}
6461
}

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/button-item/preview.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/buttons/preview.js

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/button-item/preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class Preview extends BasePreview {
2222
public retrieveOptions(): OptionInterface[] {
2323
const options = super.retrieveOptions();
2424
const newOptions = options.filter((option) => {
25-
return (option.code !== "remove" && option.code !== "title" && option.code !== "move");
25+
return ["remove", "title", "move"].indexOf(option.code) !== -1;
2626
});
2727
const removeClasses = ["remove-structural"];
2828
let removeFn = this.onOptionRemove;

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/buttons/preview.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ export default class Preview extends PreviewCollection {
152152
},
153153
},
154154
/**
155-
* Logic for starting the sorting
156-
* Adding the placeholderGhost
155+
* Logic for starting the sorting and adding the placeholderGhost
157156
*
158157
* @param {Event} event
159158
* @param {JQueryUI.Sortable} element
@@ -171,9 +170,10 @@ export default class Preview extends PreviewCollection {
171170
events.trigger("stage:interactionStart");
172171
},
173172
/**
174-
* Logic for changing element position during the sorting
173+
* Logic for changing element position
174+
*
175175
* Set the width and height of the moving placeholder animation
176-
* Add animation of placeholder ghost to the placeholder position
176+
* and then add animation of placeholder ghost to the placeholder position.
177177
*
178178
* @param {Event} event
179179
* @param {JQueryUI.Sortable} element
@@ -194,8 +194,7 @@ export default class Preview extends PreviewCollection {
194194
}, 200);
195195
},
196196
/**
197-
* Logic for post sorting
198-
* Removing the placeholderGhost
197+
* Logic for post sorting and removing the placeholderGhost
199198
*/
200199
stop() {
201200
placeholderGhost.remove();

0 commit comments

Comments
 (0)