Skip to content

Commit 40359e9

Browse files
PB-265: Video background for Banner
- fix CR comments
1 parent f331b38 commit 40359e9

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

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

Lines changed: 4 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/js/data-store.js

Lines changed: 11 additions & 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/ts/js/content-type/banner/preview.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ export default class Preview extends BasePreview {
466466
nestingLinkDialog(this.contentType.dataStore, this.wysiwyg, "message", "link_url");
467467
});
468468
this.contentType.dataStore.subscribe(function(data: DataObject) {
469-
if (this.isVideoShouldBeUpdated(data)) {
469+
if (this.shouldUpdateVideo(data)) {
470470
this.buildJarallax();
471471
}
472472
}.bind(this));
@@ -492,12 +492,12 @@ export default class Preview extends BasePreview {
492492
}
493493

494494
/**
495-
* Adjust textarea's height based on scrollHeight
495+
* Check if video options has been updated.
496496
*
497497
* @return boolean
498498
*/
499-
private isVideoShouldBeUpdated(state: DataObject): boolean {
500-
const previousState = this.contentType.dataStore.previousState;
499+
private shouldUpdateVideo(state: DataObject): boolean {
500+
const previousState = this.contentType.dataStore.getPreviousState();
501501
const diff = mageUtils.compare(previousState, state).changes;
502502

503503
if (diff.length > 0) {

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/data-store.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export interface DataObject<T = any> {
1515
}
1616

1717
export default class DataStore {
18-
public previousState: DataObject = {};
1918
private state: DataObject = {};
2019
private events: JQuery = $({});
20+
private previousState: DataObject = {};
2121

2222
/**
2323
* Retrieve specific data from the data store
@@ -39,6 +39,15 @@ export default class DataStore {
3939
return this.state;
4040
}
4141

42+
/**
43+
* Retrieve the entire previous state of the data object
44+
*
45+
* @returns {DataObject}
46+
*/
47+
public getPreviousState() {
48+
return this.previousState;
49+
}
50+
4251
/**
4352
* Set a specific keys value in the data store
4453
*

0 commit comments

Comments
 (0)