Issue #1311Opened July 24, 2018by inventorbit0 reactions

[Question]: Initializing Canvas Scripts and Styles dynamically

Question

Hello Grapejs team,

Thanks for this wonderful project saved my time and so far I had great experience with integration and your community support.

I want to load Canvas Styles and Scripts after the page is loaded from DB (Rest API) canvas: { styles: ['https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css'], scripts: ['https://code.jquery.com/jquery-3.3.1.slim.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js'] }

Is it possible to load this dynamically like

editor.Canvas or something. Please help me with this.

Answers (2)

artfJuly 26, 20180 reactions

Hi @inventorbit for such a case you should manipulate directly the canvas document

const scriptEl = document.createElement('script');
scriptEl.src = '...';
editor.Canvas.getDocument().head.appendChild(scriptEl);
lock[bot]September 17, 20190 reactions

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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.