Documentation

Editor events

Attention! We strongly recommend first to learn more about Sites module REST documentation to understand how the module functions (with REST available in Bitrix24 Self-hosted editions). View this documentation as useful source when working with Bitrix24 Self-hosted editions and find out more details about API and only REST is not enough.

The editor can register several event handlers. It allows you to find solution for various tasks. In some cases, such handlers are essential. For example, block with a slider, where each slider - is separate details card. When the number of cards is changed, most likely the slider code must be re-initiated (depending on specific libraries).

Event Description Available from version
BX.Landing.Block:init Calls handlers after initializing a block
BX.Landing.Block:Card:beforeAdd Calls handlers before adding a details card
BX.Landing.Block:Card:add Calls handlers after adding a card
BX.Landing.Block:Card:beforeRemove Calls handlers before deleting a card
BX.Landing.Block:Card:remove Calls handlers after deleting a card
BX.Landing.Block:beforeApplyStyleChanges Calls handlers before applying styles from design panel
BX.Landing.Block:updateStyleWithoutDebounce Calls handlers immediately after each iteration, without debouncing
BX.Landing.Block:updateStyle Calls handlers after design update
BX.Landing.Block:remove Calls handlers at the moment when block is marked as deleted, but still exists in DOM
BX.Landing.Block:afterRemove Calls handlers after deleting from DOM
BX.Landing.Block:Node:update Calls handlers after updating the node
BX.Landing.Block:beforeApplyContentChanges Calls handlers before applying content updates from "Edit" panel (after clicking on save)
BX.Landing.Block:beforeApplyAttributesChanges Calls handlers before applying attribute changes
BX.Landing.Block:Node:updateAttr Calls handlers after updating the attribute

All event handlers pass the object BX.Landing.Event.Block in the first parameter or null.

Example

You can register your own custom handler via the method BX.addCustomEvent. Register a hander for adding a details card. Please note, the handler will be called when adding a card for any block and you need to additionally manage the necessary parameters.

BX.addCustomEvent('BX.Landing.Block:Card:add', BX.delegate(
   function (block) 
   {
      console.log(block);
   }
));


© «Bitrix24», 2001-2024
Up