function _createRichTextEditor( initialValue ) {
        var id = 'table-block-editor'
        var input = $( '#' + id );
        var richText = $( '<div class="richtext"></div>' ).html( initialValue );
        var removeStylingPending = false;

        richText.insertBefore( input );
        input.hide();

        function removeStyling() {
            /* Strip the 'style' attribute from spans that have no other attributes.
            (we don't remove the span entirely as that messes with the cursor position,
            and spans will be removed anyway by our whitelisting)
            */
            $('span[style]', richText).filter(function() {
                return this.attributes.length === 1;
            }).removeAttr('style');
            removeStylingPending = false;
        }

        /* Workaround for faulty change-detection in hallo */
        function setModified() {
            var hallo = richText.data( 'IKS-hallo' );
            if ( hallo ) {
                hallo.setModified();
            }
        }

        var closestObj = input.closest( '.object' );


        richText.hallo({
            toolbar: 'halloToolbarFixed',
            toolbarCssClass: ( closestObj.hasClass( 'full' ) ) ? 'full' : (closestObj.hasClass( 'stream-field' )) ? 'stream-field' : '',
            plugins: halloPlugins,
            editable: true,
        } ).bind( 'hallomodified', function( event, data ) {
            input.val( data.content );
            if ( !removeStylingPending ) {
                setTimeout( removeStyling, 100 );
                removeStylingPending = true;
            }
        } ).bind( 'paste drop', function( event, data ) {
            setTimeout(function() {
                removeStyling();
                setModified();
            }, 1);
        /* Animate the fields open when you click into them. */
        } ).bind( 'halloactivated', function( event, data ) {
            $( event.target ).addClass( 'expanded', 200, function(e) {
                /* Hallo's toolbar will reposition itself on the scroll event.
                This is useful since animating the fields can cause it to be
                positioned badly initially. */
                $( window ).trigger( 'scroll' );
            } );
        } ).bind( 'hallodeactivated', function( event, data ) {
            $( window ).trigger( 'scroll' );
        } );

        window.setTimeout( function() {
            richText.focus();
        }, 500 );

        setupLinkTooltips( richText );

        return richText;
    }
/*
     *  createRichTextEditor
     *
     *  Code copied from
     *  https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailadmin/
     *  static_src/wagtailadmin/js/hallo-bootstrap.js
     *
     *  Modifications were made to add new form fields to the TableBlock in Wagtail admin.
     *  TODO: Refactor this code and submit PR to Wagtail repo.
     */


Modifications were made to add new form fields to the TableBlock in Wagtail admin.
TODO: Refactor this code and submit PR to Wagtail repo.
Modifications were made to add new form fields to the TableBlock in Wagtail admin . TODO : Refactor this code and submit PR to Wagtail repo .
function _createRichTextEditor( initialValue ) {
        var id = 'table-block-editor'
        var input = $( '#' + id );
        var richText = $( '<div class="richtext"></div>' ).html( initialValue );
        var removeStylingPending = false;
        richText.insertBefore( input );
        input.hide();
        function removeStyling() {
            $('span[style]', richText).filter(function() {
                return this.attributes.length === 1;
            }).removeAttr('style');
            removeStylingPending = false;
        }
        function setModified() {
            var hallo = richText.data( 'IKS-hallo' );
            if ( hallo ) {
                hallo.setModified();
            }
        }
        var closestObj = input.closest( '.object' );
        richText.hallo({
            toolbar: 'halloToolbarFixed',
            toolbarCssClass: ( closestObj.hasClass( 'full' ) ) ? 'full' : (closestObj.hasClass( 'stream-field' )) ? 'stream-field' : '',
            plugins: halloPlugins,
            editable: true,
        } ).bind( 'hallomodified', function( event, data ) {
            input.val( data.content );
            if ( !removeStylingPending ) {
                setTimeout( removeStyling, 100 );
                removeStylingPending = true;
            }
        } ).bind( 'paste drop', function( event, data ) {
            setTimeout(function() {
                removeStyling();
                setModified();
            }, 1);
        } ).bind( 'halloactivated', function( event, data ) {
            $( event.target ).addClass( 'expanded', 200, function(e) {
                $( window ).trigger( 'scroll' );
            } );
        } ).bind( 'hallodeactivated', function( event, data ) {
            $( window ).trigger( 'scroll' );
        } );
        window.setTimeout( function() {
            richText.focus();
        }, 500 );
        setupLinkTooltips( richText );
        return richText;
    }
function _createRichTextEditor ( initialValue ) { var id = 'table-block-editor' var input = $ ( '#' + id ) ; var richText = $ ( '<div class="richtext"></div>' ) . html ( initialValue ) ; var removeStylingPending = false ; richText . insertBefore ( input ) ; input . hide ( ) ; function removeStyling ( ) { $ ( 'span[style]' , richText ) . filter ( function ( ) { return this . attributes . length === 1 ; } ) . removeAttr ( 'style' ) ; removeStylingPending = false ; } function setModified ( ) { var hallo = richText . data ( 'IKS-hallo' ) ; if ( hallo ) { hallo . setModified ( ) ; } } var closestObj = input . closest ( '.object' ) ; richText . hallo ( { toolbar : 'halloToolbarFixed' , toolbarCssClass : ( closestObj . hasClass ( 'full' ) ) ? 'full' : ( closestObj . hasClass ( 'stream-field' ) ) ? 'stream-field' : '' , plugins : halloPlugins , editable : true , } ) . bind ( 'hallomodified' , function ( event , data ) { input . val ( data . content ) ; if ( ! removeStylingPending ) { setTimeout ( removeStyling , 100 ) ; removeStylingPending = true ; } } ) . bind ( 'paste drop' , function ( event , data ) { setTimeout ( function ( ) { removeStyling ( ) ; setModified ( ) ; } , 1 ) ; } ) . bind ( 'halloactivated' , function ( event , data ) { $ ( event . target ) . addClass ( 'expanded' , 200 , function ( e ) { $ ( window ) . trigger ( 'scroll' ) ; } ) ; } ) . bind ( 'hallodeactivated' , function ( event , data ) { $ ( window ) . trigger ( 'scroll' ) ; } ) ; window . setTimeout ( function ( ) { richText . focus ( ) ; } , 500 ) ; setupLinkTooltips ( richText ) ; return richText ; }
createRichTextEditor
  Code copied from
  https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailadmin
  static_src/wagtailadmin/js/hallo-bootstrap.js
createRichTextEditor Code copied from https : // github . com / torchbox / wagtail / blob / master / wagtail / wagtailadmin static_src / wagtailadmin / js / hallo - bootstrap . js
/* Strip the 'style' attribute from spans that have no other attributes.
            (we don't remove the span entirely as that messes with the cursor position,
            and spans will be removed anyway by our whitelisting)
            */ /* Workaround for faulty change-detection in hallo */ /* Animate the fields open when you click into them. */ /* Hallo's toolbar will reposition itself on the scroll event.
                This is useful since animating the fields can cause it to be
                positioned badly initially. */