Skip to content

Show custom notification in editor

You can use callback on Alert. This is a callback which is called when built in notifications are disabled by:

js
disableAlerts: true; //in TOPOL_OPTIONS
js

callbacks: {
  //other callbacks...

  onAlert(notification) {
    //use your own notification, or create proxy for built-in notifications
  }
}

This is useful when you want to use built in notifications in the editor. You can create notification with following function:

js
TopolPlugin.createNotification({
  title: 'Title of the notification',
  text: 'Important message you want to display',
  type: 'info' // info | error | success,
  expectSideEffect: true | false //this is used when you want to wait for your server to save the template and then call the notification,
  persistant: true | false
});

Default notification type is info.