Skip to main content

Editor script

Description​

The user website editor is looking for YUP in scripts/editor/scripts.js and if there is one it will trigger the following events. These events are helpful for the template developer to initialize its own plugings used by the template. When the user, in website editor, is inserting new components into the page, the component is being rendered by the app and the resulting html is inserted into the page. Some times the template is using third party components, like sliders, menus etc and these components need to be initialized once they are inserted into the page. You can use these hooks to trigger your components. You can use templateComponentId and/or templateComponentName to narrow your componet to trigger specific actions.

There are three types of blocks. As seen below, the blocks are: Content, Menu and Footer. These can be used to narrow down your component hooks for a better and faster app responsiveness.

Warning!​

You can isolate the whole module with hostElement and element. If you have third party components that need to initialized after each website editor operation, run your third party scripts only for elements inside hostElement and element. Running scripts on whole page in website editor mode, it will affect all the elements across the modules, so make sure you isolate them.

var YUP = {
onPageLoad: function (completeCallback) {

},

get Content() {
return {
onItemInit: function (
element,
hostElement,
completeCallback,
templateComponentId,
templateComponentName) {
},
onItemCreated: function (
element,
hostElement,
completeCallback,
templateComponentId,
templateComponentName) {
},
onItemOrderChanged: function (
hostElement,
completeCallback,
templateComponentId,
templateComponentName) {
},
onItemRemoved: function (
element,
hostElement,
completeCallback,
templateComponentId,
templateComponentName) {
}
}
},

get Menu() {
return {
onItemInit: function (
element,
hostElement,
completeCallback,
templateComponentId,
templateComponentName) {
},
onItemCreated: function (
element,
hostElement,
completeCallback,
templateComponentId,
templateComponentName) {
},
onItemOrderChanged: function (
hostElement,
completeCallback,
templateComponentId,
templateComponentName) {
},
onItemRemoved: function (
element,
hostElement,
completeCallback,
templateComponentId,
templateComponentName) {
}
}
},

get Footer() {
return {
onItemInit: function (
element,
hostElement,
completeCallback,
templateComponentId,
templateComponentName) {
},
onItemCreated: function (
element,
hostElement,
completeCallback,
templateComponentId,
templateComponentName) {
},
onItemOrderChanged: function (
hostElement,
completeCallback,
templateComponentId,
templateComponentName) {
},
onItemRemoved: function (
element,
hostElement,
completeCallback,
templateComponentId,
templateComponentName) {
}
}
}
};