Skip to content

Client Side Events (v1.x)

Simonas Mikulenas edited this page Dec 3, 2015 · 1 revision

Sometimes there is a need to listen for UI events. BetterCMS provides a set of events that can be attached to. Available events:

  • bcms
    • editModeOff
    • editModeOn
    • addPageContent
    • sortPageContent
    • contentModelCreated
    • pageCreated
    • editContentsTree
  • bcms.media
    • mediaListViewModeChanged
  • bcms.contextMenu
    • menuOn
    • menuOff
  • bcms.pages.sitemap
    • sitemapNodeAdded
    • sitemapNodeRemoved
    • sitemapNodeTranslationsUpdated
  • bcms.htmlEditor
    • insertImage
    • insertFile
    • insertDynamicRegion
    • insertWidget
    • editChildWidgetOptions
    • editWidget

Code samples how to use the events:

bettercms.require(['bcms'], function(bcms) {
  bcms.on(bcms.events.editModeOn, function() {
    console.log('Test: Edit mode on');
  });
});
bettercms.require(['bcms','bcms.htmlEditor'], function(bcms, htmlEditor) {
  bcms.on(htmlEditor.events.editWidget, function() {
    console.log('Test: Edit widget');
  });
});
Clone this wiki locally