javascript in app.js: Result: Blank editor","answerCount":2,"author":{"@type":"Person","name":"dukie66","url":"https://github.com/dukie66"},"dateCreated":"2019-11-01T11:10:38Z","dateModified":"2019-11-02T14:21:01Z","acceptedAnswer":{"@type":"Answer","text":"template","dateCreated":"2019-11-01T11:51:27Z","upvoteCount":2,"author":{"@type":"Person","name":"pouyamiralayi","url":"https://github.com/pouyamiralayi"},"url":"https://github.com/GrapesJS/grapesjs/issues/2365#issuecomment-548761781"},"suggestedAnswer":[{"@type":"Answer","text":"@dukie66
style=\"background-color=\"red\"; height=\"100px\"; width=\"100px\"
this is not how you supposed to write HTML","dateCreated":"2019-11-02T14:21:01Z","upvoteCount":0,"author":{"@type":"Person","name":"artf","url":"https://github.com/artf"},"url":"https://github.com/GrapesJS/grapesjs/issues/2365#issuecomment-549048117"}]}}
Issue #2365✓ SolvedOpened November 1, 2019by dukie662 reactions

Unable load predefined template.

快速解答by pouyamiralayi2

template

Read full answer below ↓

Question

I want to show a predefined template when users open grapesJs something like this: Storage manager. image HTML: <div id="gjs" style="height:0px; overflow:hidden"></div> <script src="app.js"></script>

javascript in app.js:

// Set up GrapesJS editor with the Newsletter plugin
const LandingPage = {
	html: '<div> style="background-color="red"; height="100px"; width="100px"</div>',
	css: null,
	components: null,
	style: null,
};
components: LandingPage.components || LandingPage.html,
	style: LandingPage.style || LandingPage.css,
	clearOnRender: true,
	storageManager: {
		id: 'gjs-',
		type: 'local',
		autoload: true,
		autosave: true,
		storeComponents: true,
		storeStyles: true,
		stepsBeforeSave: 1,
		// contentTypeJson: true,
	},

Result: Blank editor image

Answers (2)

👍 Most helpfulpouyamiralayiNovember 1, 2019
artfNovember 2, 2019

@dukie66 <div> style="background-color="red"; height="100px"; width="100px"</div> this is not how you supposed to write HTML

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.