Started adding grapesJS to assistant area for the site view builder.

This commit is contained in:
2020-02-12 16:27:32 +02:00
parent 4664d89d0e
commit a6cdafb31f
17 changed files with 82 additions and 17 deletions

View File

@@ -21,6 +21,8 @@ defined('_JEXEC') or die('Restricted access');
</div>
<script type="text/javascript">
var active_view = 'view0';
var active_editors = {};
var last_editors = {};
var created_fields = {};
jQuery(document).on('subform-row-add', function(event, row){
setFieldNames();
@@ -33,8 +35,26 @@ function setJCBuilder(area, view, target){
if (target == 2){
setFieldNames();
setListViewFieldOptions();
} else if (target == 3 && !active_editors.hasOwnProperty(view)) {
// update the editor (let grape js know)
initializeGrapesjs();
}
}
function initializeGrapesjs(){
active_editors[active_view] = grapesjs.init({
// Indicate where to init the editor. You can also pass an HTMLElement
container: '#gjs-'+active_view,
// Get the content for the canvas directly from the element
fromElement: true,
// Size of the editor
height: '500px',
width: 'auto',
// Default configurations
storageManager: { autoload: 1 },
// basic block manager
plugins: ['gjs-preset-webpage'],
});
}
function setListViewFieldOptions(){
// build fields
if (created_fields.hasOwnProperty(active_view)){