mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-15 15:42:51 +01:00
50 lines
1.5 KiB
PHP
50 lines
1.5 KiB
PHP
<script type="text/javascript">
|
|
|
|
$(function() {
|
|
|
|
window.grapesjsEditor = grapesjs.init({
|
|
container : '#gjs',
|
|
components: '{!! $entity ? $entity->html : '' !!}',
|
|
style: '{!! $entity ? $entity->css : '' !!}',
|
|
showDevices: false,
|
|
categoryLabel: 'tes',
|
|
plugins: ['gjs-preset-newsletter'],
|
|
pluginsOpts: {
|
|
'gjs-preset-newsletter': {
|
|
'categoryLabel': "{{ trans('texts.standard') }}"
|
|
}
|
|
},
|
|
storageManager: {type: 'none'},
|
|
});
|
|
|
|
var blockManager = grapesjsEditor.BlockManager;
|
|
|
|
@foreach ($snippets as $snippet)
|
|
blockManager.add("h{{ ($loop->index + 1) }}-block", {
|
|
label: '{{ $snippet->name }}',
|
|
category: '{{ $snippet->proposal_category ? $snippet->proposal_category->name : trans('texts.custom') }}',
|
|
content: '{!! $snippet->html !!}',
|
|
style: '{!! $snippet->css !!}',
|
|
attributes: {
|
|
title: '{!! $snippet->private_notes !!}',
|
|
class:'fa fa-{!! $snippet->icon ?: 'font' !!}'
|
|
}
|
|
});
|
|
@endforeach
|
|
|
|
@if (count($snippets))
|
|
var blockCategories = blockManager.getCategories();
|
|
for (var i=0; i<blockCategories.models.length; i++) {
|
|
var blockCategory = blockCategories.models[i];
|
|
blockCategory.set('open', false);
|
|
}
|
|
@endif
|
|
|
|
grapesjsEditor.on('component:update', function(a, b) {
|
|
NINJA.formIsChanged = true;
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|