diff --git a/client/src/entrypoints/admin/telepath/blocks.js b/client/src/entrypoints/admin/telepath/blocks.js index 5d9951b66a..ba987ab479 100644 --- a/client/src/entrypoints/admin/telepath/blocks.js +++ b/client/src/entrypoints/admin/telepath/blocks.js @@ -38,30 +38,6 @@ wagtailStreamField.blocks = { StreamBlockDefinition, }; -function initBlockWidget(id) { - /* - Initialises the top-level element of a BlockWidget - (the form widget for a StreamField). - Receives the ID of a DOM element with the attributes: - data-block: JSON-encoded block definition to be passed to telepath.unpack - to obtain a Javascript representation of the block - (an instance of one of the Block classes below) - data-value: JSON-encoded value for this block - */ - - const body = document.querySelector('#' + id + '[data-block]'); - - // unpack the block definition and value - const blockDefData = JSON.parse(body.dataset.block); - const blockDef = window.telepath.unpack(blockDefData); - const blockValue = JSON.parse(body.dataset.value); - const blockError = JSON.parse(body.dataset.error); - - // replace the 'body' element with the populated HTML structure for the block - blockDef.render(body, id, blockValue, blockError); -} -window.initBlockWidget = initBlockWidget; - window.telepath.register('wagtail.blocks.FieldBlock', FieldBlockDefinition); window.telepath.register('wagtail.blocks.StaticBlock', StaticBlockDefinition); window.telepath.register('wagtail.blocks.StructBlock', StructBlockDefinition);