Skip to content

Commit 1a5eff1

Browse files
author
Hwashiang Yu
committed
MC-3477: Polish prototype and apply rearranging in preview
- Updated button item link appearance style to be inline block - Updated options filter logic - Resolved issue with dragging to first and last position
1 parent f77d539 commit 1a5eff1

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/css/source/_buttons.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
@_line-height: @pagebuilder-button__line-height
4242
);
4343
.lib-css(font-weight, @font-weight__semibold);
44+
display: inline-block;
4445
}
4546

4647
.placeholder-text {

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 & 4 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 ["remove", "title", "move"].indexOf(option.code) !== -1;
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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ export default class Preview extends PreviewCollection {
108108
items: ".pagebuilder-content-type-wrapper",
109109
cursor: "grabbing",
110110
containment: "parent",
111+
tolerance: this.data.main.attributes()["data-appearance"] === "stacked" ? "pointer" : "intersect",
111112
revert: 200,
112-
cursorAt: { left: 25, top: 25 },
113+
cursorAt: { left: 15, top: 15 },
113114
disabled: this.parent.children().length <= 1,
114115
/**
115116
* Provide custom helper element
@@ -181,11 +182,11 @@ export default class Preview extends PreviewCollection {
181182
change(event, element) {
182183
element.placeholder.stop(true, false);
183184
if (this.getAttribute("data-appearance") === "stacked") {
184-
element.placeholder.css({height: element.item.height() / 2});
185+
element.placeholder.css({height: element.item.height() / 1.2});
185186
element.placeholder.animate({height: element.item.height()}, 200, "linear");
186187
}
187188
if (this.getAttribute("data-appearance") === "inline") {
188-
element.placeholder.css({width: element.item.width() / 2});
189+
element.placeholder.css({width: element.item.width() / 1.2});
189190
element.placeholder.animate({width: element.item.width()}, 200, "linear");
190191
}
191192
placeholderGhost.stop(true, false).animate({

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ button {
1818
);
1919
.lib-css(font-weight, @font-weight__semibold);
2020
box-shadow: none;
21+
display: inline-block;
2122
}
2223

2324
&.pagebuilder-button-primary {

0 commit comments

Comments
 (0)