data-slot=text
Page Builder events
The pattern for consuming Page Builder events in JavaScript, such as within the preview.js component, is to import Magento_PageBuilder/js/events and use the events.on() method to bind to the event you want to handle, as shown here:
define([
'Magento_PageBuilder/js/events',
], function (events) {
'use strict';
events.on("event:name", function (args) {
// do logic
});
});
Events list
The following table lists the Page Builder events you can bind to and handle within your content type.
Event details
contentType:* events
Events starting with contentType: are triggered for every content type on the stage. These events can also be called for specific content types by prefixing the content type's name before the event (name:event). For example:
text:createAfterrow:mountAftertab-item:mountAfter
contentType:createAfter
events.on("contentType:createAfter", function (params) {});
idstringcontentTypeContentType or ContentTypeCollectioncontentType:mountAfter
ContentType
events.on("contentType:mountAfter", function (params) {});
idstringcontentTypeContentTypeContentTypeCollection
events.on("contentType:mountAfter", function (params) {});
idstringcontentTypeContentTypeCollectionexpectChildrennumbercontentType:dropAfter
events.on("contentType:dropAfter", function (params) {});
idstringcontentTypeContentType or ContentTypeCollectioncontentType:renderAfter
events.on("contentType:renderAfter", function (params) {});
idstringelementHTMLElementcontentTypeContentType or ContentTypeCollectioncontentType:removeAfter
events.on("contentType:removeAfter", function (params) {});
contentTypeContentType or ContentTypeCollectionindexnumberparentContentTypeContentType or ContentTypeCollectionstageIdstringcontentType:duplicateAfter
events.on("contentType:duplicateAfter", function (params) {});
originalContentTypeContentType or ContentTypeCollectionduplicateContentTypeContentType or ContentTypeCollectionindexnumberdirectbooleancontentType:moveBefore
events.on("contentType:moveBefore", function (params) {});
contentTypeContentTypesourceParentContentTypeCollectiontargetParentContentTypeCollectiontargetIndexnumberstageIdstringcontentType:moveAfter
events.on("contentType:moveAfter", function (params) {});
contentTypeContentTypesourceParentContentTypeCollectiontargetParentContentTypeCollectiontargetIndexnumberstageIdstringcontentType:redrawAfter
events.on("contentType:redrawAfter", function (params) {});
Backend
idstringcontentTypeContentType or ContentTypeCollectionFrontend
elementHTMLElementcolumn:dragStart
events.on("column:dragStart", function (params) {});
columnContentTypeCollectionstageIdstringcolumn:dragStop
events.on("column:dragStop", function (params) {});
columnContentTypeCollectionstageIdstringcolumn:initializeAfter
events.on("column:initializeAfter", function (params) {});
columnColumnelementElementcolumnGroupColumnGroupimage:{{preview.contentType.id}}:assignAfter
events.on(`image:${this.contentType.id}:assignAfter`, function (params) {});
imageObjectFileimage:mountAfter
events.on("image:mountAfter", function (params) {});
idstringcontentTypeContentTypeexpectChildrennumberimage:uploadAfter
events.on("image:uploadAfter", function (params) {});
fileFilestage:{{preview.contentType.stageId}}:readyAfter
events.on(`stage:${this.contentType.stageId}:readyAfter`, function (params) {});
stageStagestage:{{preview.contentType.stageId}}:renderAfter
events.on(`stage:${this.contentType.stageId}:renderAfter`, function (params) {});
stageStagestage:interactionStart
events.on("stage:interactionStart", function (params) {});
stageIdstringstage:interactionStop
events.on("stage:interactionStop", function (params) {});
stageIdstringstage:{{preview.contentType.stageId}}:fullScreenModeChangeAfter
events.on(`stage:${this.contentType.stageId}:fullScreenModeChangeAfter`, function (params) {});
fullScreenbooleanchildContentType:sortStart
events.on("childContentType:sortStart", function (params) {});
instanceContentTypeCollectionoriginalPositionnumberuiJQueryUI.SortableUIParamschildContentType:sortUpdate
events.on("childContentType:sortUpdate", function (params) {});
instanceContentTypeCollectionnewPositionnumberoriginalPositionnumberuiJQueryUI.SortableUIParamseventjQuery.Eventstage:error
events.on("stage:error", function (params) {});
errorErrorstage:{{preview.contentType.stageId}}:readyAfter
events.on(`stage:${this.contentType.stageId}:readyAfter`, function (params) {});
stageStagestage:{{preview.contentType.stageId}}:masterFormatRenderAfter
events.on(`stage:${this.contentType.stageId}:masterFormatRenderAfter`, function (params) {});
renderedOutputstringstage:updateAfter
events.on("stage:updateAfter", function (params) {});
stageIdstringstage:childFocusStart
events.on("stage:childFocusStart", function () {});
Nonestage:childFocusStop
events.on("stage:childFocusStop", function () {});
Nonestage:viewportChangeAfter
Triggered on viewport changes in the Admin stage. Handle this event to control in your content type's widget (widget.js) for cases in which your content type is rendered on the Admin stage from within a Block or Dynamic Block. In these cases, Page Builder loads your widget, not the preview component, to the Admin stage. This means that your widget as to make changes to your content type when users change the viewports on the stage.
events.on(`stage:viewportChangeAfter`, function (args) {});
viewportstringpreviousViewportstringstage:{{preview.contentType.stageId}}:viewportChangeAfter
Triggered on viewport changes in the Admin stage. Handle this event to control responsive changes to your content type from within your preview component.
events.on(`stage:${this.contentType.stageId}:viewportChangeAfter`, function (args) {});
viewportstringpreviousViewportstringstate
events.on("state", function (params) {});
stateDataStore{{config.name}}:{{preview.contentType.id}}:updateAfter
events.on(`${this.config.name}:${this.contentType.id}:updateAfter`, function (params) {});
contentTypeContentTypegoogleMaps:authFailure
events.on("googleMaps:authFailure", function () {});
None