mirror of https://github.com/artf/grapesjs.git
7 changed files with 90 additions and 13 deletions
@ -0,0 +1,41 @@ |
|||
<template> |
|||
<div> |
|||
<div id="gjs2"> |
|||
<h1>Hello World Component!</h1> |
|||
</div> |
|||
<div id="blocks2"></div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
module.exports = { |
|||
mounted() { |
|||
window.editor2 = grapesjs.init({ |
|||
container: '#gjs2', |
|||
fromElement: true, |
|||
height: '300px', |
|||
storageManager: { type: null }, |
|||
panels: { defaults: [] }, |
|||
// ... |
|||
blockManager: { |
|||
appendTo: '#blocks2', |
|||
blocks: [ |
|||
{ |
|||
id: 'text', // id is mandatory |
|||
label: '<b>Text</b>', |
|||
attributes: { class:'gjs-text-block' }, |
|||
content: '<div>Insert your text here</div>', |
|||
}, { |
|||
id: 'image', |
|||
label: 'Image', |
|||
content: { type: 'image' }, |
|||
} |
|||
] |
|||
}, |
|||
}); |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
</style> |
|||
@ -0,0 +1,12 @@ |
|||
/* Let's highlight canvas boundaries */ |
|||
#gjs { |
|||
border-radius: 3px; |
|||
border: 3px solid #444; |
|||
} |
|||
|
|||
/* Reset some default styling */ |
|||
.gjs-cv-canvas { |
|||
top: 0; |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
@ -1,5 +1,13 @@ |
|||
var editor = grapesjs.init({ |
|||
const editor = grapesjs.init({ |
|||
// Indicate where to init the editor. You can also pass an HTMLElement
|
|||
container: '#gjs', |
|||
// Get the content for the canvas directly from the element
|
|||
// As an alternative we could use: `components: '<h1>Hello World Component!</h1>'`,
|
|||
fromElement: true, |
|||
// Height of the editor
|
|||
height: '300px', |
|||
// Disable the storage manager for the moment
|
|||
storageManager: { type: null }, |
|||
// Avoid any default panel
|
|||
panels: { defaults: [] }, |
|||
}); |
|||
|
|||
Loading…
Reference in new issue