Embeddables, Truncation, and registerEndOfPageHtml

We are starting to use some embeddables that rely on registerEndOfPageHtml to render correctly. They are JS based and need jQuery to load. We are having an issue when truncating text. The embeddable text before registerEndOfPageHtml is populating, however i am not sure how to access the registerEndOfPageHtml portion? That part gets removed, is there any way to render just registerEndOfPageHtml of an embeddable?

Thank you!

Parents Reply Children
  • Absolutely! Below is my implementation. I know i can move the 2 script tags to be implemented at a more global level. I was going to try and use a data-equation data attribute or something, but the value can have new lines in it and couldn't find a easy way to handle that.

    <p id="$core_v2_widget.UniqueId('formula')" >$core_v2_widget.GetStringValue('graphviz','')</p>
    #registerEndOfPageHtml()
    <script type="text/javascript" src="$core_v2_encoding.HtmlAttributeEncode($core_v2_widget.GetExecutedFileUrl('viz.js'))"></script>
    <script type="text/javascript" src="$core_v2_encoding.HtmlAttributeEncode($core_v2_widget.GetExecutedFileUrl('full-render.js'))"></script><script>
        var graphvizEquation = `$core_v2_widget.GetStringValue('graphviz','')`;
        graphvizEquation = graphvizEquation.replace(/(\r\n|\n|\r)/gm,"");
           
            
              var viz = new Viz();
      
      viz.renderSVGElement(graphvizEquation)
      .then(function(element) {
        $("#$core_v2_widget.UniqueId('formula')").html(element);
      })
      .catch(error => {
        // Create a new Viz instance (@see Caveats page for more info)
        viz = new Viz();
    
        // Possibly display the error
        console.error(error);
      });
        </script>
    #end