Issue #1733Opened January 21, 2019by AkibDeraiya1232 reactions

How to remove script tag which is added by add block manager script

Question

Hello @artf

I want to export final/production based html content excluding the script(Only which is added by block manager). Suppose i am adding a new block using block-manager, like

bm.add("image-cropper",
    {
        label: '<div class="gjs-block-label">Image Cropper</div>',
        tab: "2",
        content: {
            script: function () {
              // This is for an example actually i want to do something difference which only used for the editor mode not in live/exported code.
               document.getElementById(''staticId').style.display = "none";
            },
            content: '<div><h1>Hello</h1><img id="staticId" /><div>'
        }
    }
)

Now when i put this block into the editor then it will create a div tag into the document and also creates the script like,

<script>
        setTimeout(function() {
          var item = document.getElementById('i5ziqj');
          if (!item) return;
          (function(){
            // Scripted code is here
         }.bind(item))()
        }, 1);
</script>

So, while i am trying to fetch whole page html code using editor.getHtml() i also get above mentioned script. Actually i don't want this generated script(generated by block-manger only script).

Can we prevent this block-manager generated script while we fetched?

Answers (3)

thinkanymoreJanuary 29, 20192 reactions

jsInHtml……false

thinkanymoreJanuary 21, 20190 reactions

editor.Canvas.getWrapperEl().innerHTML

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.