change icons, css, add routing to merchandise, add mail templater, fixes

This commit is contained in:
Ludovic CANDELLIER
2023-02-12 23:34:48 +01:00
parent 8313e25f2e
commit f2f4788ce1
71 changed files with 1486 additions and 154 deletions

View File

@@ -0,0 +1,38 @@
@extends('layout.index', [
'title' => __('Admin.mail_logs.title'),
'subtitle' => __('Admin.mail_logs.list'),
])
@section('content')
@component('components.card')
@include('components.datatable', [
'route' => route('Admin.Core.Mail.MailLog.index'),
'model' => 'mail_logs',
'with_add' => false,
'with_print' => false,
'with_filters' => true,
'show_callback' => 'MailLogShow(id);',
])
@endcomponent
@component('components.layout.modal-filters', ['title' => 'Filters', 'id' => 'modal-mail_logs-filters'])
@include('admin.Core.Mail.MailLog.partials.filters', ['model' => 'mail_logs'])
@endcomponent
@endsection
@include('load.form.select2')
@push('js')
<script>
function MailLogShow(id) {
var url_open = "{{ route('Admin.Core.Mail.MailLog.show') }}/" + id;
openModal("{{ __('admin.Core.MailLog.modal') }}", '#mail_log-form', url_open, false, false, "xl");
}
$(document).ready(function () {
initSelect2();
});
</script>
@endpush

View File

@@ -0,0 +1,16 @@
<div class="row">
<div class="col-6">
<strong>@lang('from') : </strong>
{{ $message['from'] }}<br/>
<strong>@lang('subject') : </strong>
{{ $message['subject'] }}<br/>
<strong class="text-uppercase">@lang('to') : </strong>
{{ $message['to_name'] }} {{ $message['to_email'] }}<br/>
</div>
</div>
<div class="row mb-3">
<div class="col-12 text-dark">
{!! $message['content'] !!}
</div>
</div>

View File

@@ -0,0 +1,28 @@
<form id="{{ $model }}-filters">
<div class="row mb-3">
<label class="col-4 text-right">{{ __('application') }}</label>
<div class="col-8">
@include('components.form.select', [
'name' => 'application_id',
'list' => $applications ?? [],
'value' => $filters['application_id'] ?? null,
'class' => 'select2',
'with_empty' => __('all'),
])
</div>
</div>
<div class="row mb-3">
<label class="col-4 text-right">{{ __('module') }}</label>
<div class="col-8">
@include('components.form.select', [
'name' => 'application_module_id',
'list' => $application_modules ?? [],
'value' => $filters['application_module_id'] ?? null,
'class' => 'select2',
'with_empty' => __('all'),
])
</div>
</div>
</form>

View File

@@ -0,0 +1,63 @@
@extends('layout.index', [
'title' => __('Core.mail_templates.title'),
'subtitle' => __('Core.mail_templates.list'),
'breadcrumb' => [
]
])
@section('content')
<x-card>
@include('components.datatable', [
'route' => route('Admin.Core.Mail.MailTemplate.index'),
'model' => 'mail_templates',
'with_add' => true,
'with_print' => false,
'with_filters' => true,
'create_callback' => 'MailTemplateCreate();',
'edit_callback' => 'MailTemplateEdit(id);',
'show_callback' => 'MailTemplateView(id)',
])
</x-card>
@component('components.layout.modal-filters', ['title' => 'Filters', 'id' => 'modal-mail_templates-filters'])
@include('admin.Core.Mail.MailTemplate.partials.filters', ['model' => 'mail_templates'])
@endcomponent
@endsection
@include('load.form.datepicker')
@include('load.form.select2')
@include('load.form.editor')
@include('load.form.upload.fileinput')
@push('js')
<script>
function MailTemplateCreate() {
var url_open = "{{ route('Admin.Core.Mail.MailTemplate.modalCreate') }}";
var url_save = "{{ route('Admin.Core.Mail.MailTemplate.storeAjax') }}";
openModal("{{ __('Core.mail_templates.add') }}", '#mail_template-form', url_open, url_save, "MailTemplateRefresh();", "xl");
}
function MailTemplateEdit(id) {
var url_open = "{{ route('Admin.Core.Mail.MailTemplate.modalEdit') }}/" + id;
var url_save = "{{ route('Admin.Core.Mail.MailTemplate.storeAjax') }}";
openModal("{{ __('Core.mail_templates.edit') }}", '#mail_template-form', url_open, url_save, "MailTemplateRefresh();", "xl");
}
function MailTemplateView(id) {
var url_open = "{{ route('Admin.Core.Mail.MailTemplate.modalPreview') }}/" + id;
openModal("{{ __('Core.preview') }}", '#preview_template-form', url_open);
}
function MailTemplateRefresh()
{
reloadDatatable("mail_templates");
}
$(document).ready(function () {
initSelect2();
});
</script>
@endpush

View File

@@ -0,0 +1,123 @@
{{ Form::open(['route' => 'Admin.Core.Mail.MailTemplate.storeAjax', 'id' => 'mail_template-form', 'autocomplete' => 'off', 'files' => true]) }}
<input type="hidden" id="id" name="id" value="{{ $mail_template['id'] ?? null }}">
<div class="row mb-3">
<div class="col-3">
@include('components.form.input', [
'name' => 'name',
'value' => $mail_template['name'] ?? '',
'label' => __('Core.name'),
'required' => true,
])
</div>
<div class="col-3">
@include('components.form.select', [
'name' => 'mailable',
'value' => $mail_template['mailable'] ?? '',
'list' => $mailables ?? [],
'label' => __('Core.mailables'),
'with_empty' => '',
'required' => true,
])
</div>
<div class="col-4">
<div id="mail_template-vars">
@include('admin.Core.Mail.MailTemplate.partials.vars', ['vars' => $mail_template['vars'] ?? []])
</div>
</div>
<div class="col-2 text-right">
<label>@lang('Core.change_to')</label><br/>
<img id="lang_en" class="lang" data-lang="en" role="button" src="{{ asset('vendor/blade-flags/language-en.svg') }}" width="32" height="32"/>
<img id="lang_fr" class="lang d-none" data-lang="fr" role="button" src="{{ asset('vendor/blade-flags/language-fr.svg') }}" width="32" height="32"/>
</div>
</div>
<div id="mode_fr" class="">
<div class="row mb-3">
<div class="col-6">
@include('components.form.input', [
'name' => 'subject[fr]',
'value' => $mail_template['subject_translations']['fr'] ?? '',
'label' => __('Core.subject'),
'required' => true,
])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('components.form.editor', [
'name' => 'html_template[fr]',
'value' => $mail_template['html_template_translations']['fr'] ?? '',
'label' => 'HTML',
'rows' => 10,
])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('components.form.textarea', [
'name' => 'text_template[fr]',
'value' => $mail_template['text_template_translations']['fr'] ?? '',
'label' => 'Text',
])
</div>
</div>
</div>
<div id="mode_en" class="d-none">
<div class="row mb-3">
<div class="col-6">
@include('components.form.input', [
'name' => 'subject[en]',
'value' => $mail_template['subject_translations']['en'] ?? '',
'label' => __('Core.subject'),
'required' => true,
])
</div>
<div class ="col-6">
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('components.form.editor', [
'name' => 'html_template[en]',
'value' => $mail_template['html_template_translations']['en'] ?? '',
'label' => 'HTML',
'rows' => 10,
])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('components.form.textarea', [
'name' => 'text_template[en]',
'value' => $mail_template['text_template_translations']['en'] ?? '',
'label' => 'Text',
])
</div>
</div>
</div>
{{ Form::close() }}
<script>
$(function() {
initSelect2();
initEditor();
$('.lang').click(function() {
var lang = $(this).data('lang');
$('#mode_en').toggleClass('d-none');
$('#mode_fr').toggleClass('d-none');
$('#lang_en').toggleClass('d-none');
$('#lang_fr').toggleClass('d-none');
});
});
</script>

View File

@@ -0,0 +1,3 @@
<form id="{{ $model }}-filters">
</form>

View File

@@ -0,0 +1,37 @@
{{ Form::open(['route' => 'Admin.Core.Mail.MailTemplate.storeAjax', 'id' => 'preview_template-form', 'autocomplete' => 'off', 'files' => true]) }}
<input type="hidden" name="id" id="template_id" value="{{ $id ?? null }}">
<div class="row mb-3">
<div class="col-6">
@include('components.form.select', [
'id_name' => 'user_id',
'name' => 'user_id',
'list' => $users,
'class' => 'select2',
'with_empty' => '',
'label' => __('Core.users.name'),
])
</div>
</div>
<x-card title="Preview">
<div id="previewTemplate"></div>
</x-card>
{{ Form::close() }}
<script>
initSelect2();
$('#user_id').change(function() {
console.log('ici');
var user_id = $(this).find(":selected").val();
var template_id = $('#template_id').val();
console.log(user_id);
console.log(template_id);
var url = "{{ route('Admin.Core.Mail.MailTemplate.preview') }}/" + template_id + '/' + user_id;
$.get(url, function(data) {
$('#previewTemplate').html(data);
});
})
</script>

View File

@@ -0,0 +1,8 @@
@if ($vars)
<label>
@lang('Core.variables')
</label><br>
@foreach ($vars as $var)
<span class="badge badge-pill badge-light mr-2">{{ $var }}</span>
@endforeach
@endif

View File

@@ -1,3 +1,14 @@
<div class="row">
<div class="col-4">
{{ Form::label('product_type', 'Famille de produit') }}
@include('components.form.select', [
'name' => 'product_type',
'value' => $article_nature['product_type'] ?? null,
'list' => $product_types ?? null,
'required' => true,
])
</div>
</div>
<div class="row">
<div class="col-md-8">
<div class="row mb-3">

View File

@@ -10,6 +10,6 @@
<input type="hidden" name="id" id="id" value="{{ $article['id'] ?? null }}">
@include('Admin.Shop.Articles.form')
</form>
{{ Form::close() }}
@endsection

View File

@@ -25,17 +25,6 @@
])
</div>
<div class="col-3">
{{ Form::label('ref', 'Référence') }}<br>
@include('components.form.input', ['name' => 'ref', 'value' => $article['ref'] ?? null])
</div>
</div>
<div class="row mb-3">
<div class="col-8">
{{ Form::label('name', 'Nom') }}<br>
@include('components.form.input', ['name' => 'name', 'value' => $article['name'] ?? null, 'required' => true])
</div>
<div class="col-4">
{{ Form::label('article_nature_id', __('shop.article_natures.name')) }}<br>
@include('components.form.select', [
'name' => 'article_nature_id',
@@ -49,6 +38,17 @@
</div>
</div>
<div class="row mb-3">
<div class="col-8">
{{ Form::label('name', 'Nom') }}<br>
@include('components.form.input', ['name' => 'name', 'value' => $article['name'] ?? null, 'required' => true])
</div>
<div class="col-4">
{{ Form::label('ref', 'Référence') }}<br>
@include('components.form.input', ['name' => 'ref', 'value' => $article['ref'] ?? null])
</div>
</div>
<div class="row mb-3">
<div class="col-8">
{{ Form::label('categories', __('shop.shelves.title')) }}<br>
@@ -156,25 +156,37 @@
switch (product_type) {
case 'App\\Models\\Botanic\\Specie':
var url = '{{ route('Admin.Botanic.Species.getSelect') }}';
var product_type = 1;
break;
case 'App\\Models\\Botanic\\Variety':
var url = '{{ route('Admin.Botanic.Varieties.getSelect') }}';
var product_type = 1;
break;
case 'App\\Models\\Shop\\Merchandise':
var url = '{{ route('Admin.Shop.Merchandises.getSelect') }}';
var product_type = 2;
break;
}
loadProducts(url);
var url = '{{ route('Admin.Shop.ArticleNatures.getOptions') }}';
loadArticleNatures(url);
});
function loadArticleNatures(url) {
$.ajax({
url : url,
method : 'POST',
data: {product_type: $('#product_type').val()},
success : function(data) {
setOptions('#article_nature_id', data);
// $("#product_id").select2({data: data});
// $("#product_id").trigger('change');
}
});
}
function loadProducts(url) {
$.ajax({
url : url,
method : 'POST',
data: {model: $('#product_type').val()},
data: {article_nature_id: $('#article_nature_id').val()},
success : function(data) {
setOptions('#product_id', data);
// $("#product_id").select2({data: data});

View File

@@ -11,7 +11,7 @@
@if ($inherited['tags'])
<h6> Tags</h6>
@foreach ($inherited['tags'] as $tag)
<button type="button" class="btn btn-secondary btn-xs">{{ $tag['tag_group']['name'] }}-{{ $tag['name'] ?? $tag['name'] }}</button>
<button type="button" class="btn btn-secondary btn-xs">{{ $tag['tag_group']['name'] ?? '' }}-{{ $tag['name'] ?? '' }}</button>
@endforeach
@endif
@endcomponent

View File

@@ -3,7 +3,7 @@
'data' => $article['offers']['semences'],
'title' => 'Semence',
'model' => 'semences',
'bgClass' => 'bg-yellow',
'bgClass' => 'bg-green-light',
])
@endif
@@ -12,7 +12,7 @@
'data' => $article['offers']['plants'],
'title' => 'Plant',
'model' => 'plants',
'bgClass' => 'bg-green-dark',
'bgClass' => 'bg-green-light',
])
@endif
@@ -21,6 +21,7 @@
'data' => $article['offers']['legumes'],
'title' => 'Légume',
'model' => 'legumes',
'bgClass' => 'bg-green-light',
])
@endif

View File

@@ -1,4 +1,4 @@
<a href="{{ route('Shop.Articles.show', ['id' => $article['semences']['article_id'] ?? false ]) }}" class="{{ ($product_type == 'botanic') ? 'green-dark' : 'green-dark' }}">
<a href="{{ route('Shop.Articles.show', ['id' => $article['id'] ?? false ]) }}" class="green-dark">
<div class="card">
<img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="{{ $product_name }}">
<div class="card-body p-2 pb-1">
@@ -9,7 +9,7 @@
</div>
</div>
@include('Shop.Articles.partials.article_' . $product_type)
<button type="button" class="btn btn-link bg-green text-white w-100">
<button type="button" class="btn btn-link bg-green text-white w-100" data-id=="{{ $article['id'] }}">
Ajout rapide
</button>
</div>

View File

@@ -9,12 +9,12 @@
</div>
</div>
<div class="row">
<div class="col-4">
<div class="col-lg-4 col-xs-12">
<div style="max-width: 360px;">
@include('components.multi-images', ['images' => $article['images']])
@include('components.multi-images', ['image' => $article['image'], 'images' => $article['images']])
</div>
</div>
<div class="col-5 text-justify">
<div class="col-lg-5 col-xs-12 text-justify">
{!! $article['description']['semences'] ?? null !!}
{!! $article['description']['plants'] ?? null !!}
{!! $article['description']['variety'] ?? null !!}
@@ -44,7 +44,7 @@
@endif
</div>
<div class="col-3">
<div class="col-lg-3 col-xs-12">
@include('Shop.Articles.partials.ArticleAddBasket')
</div>
</div>

View File

@@ -1,4 +1,31 @@
<div class="row">
<div class="row mb-3">
<div class="col-4">
<div class="row h-100 products @if($article_nature == 1) shadow2 @endif" data-id="semences">
<div class="col-lg-6 col-xs-12">
<img src="/img/article_natures/semences.png" class="img-fluid">
</div>
<div class="col-lg-6 col-xs-12 green-dark" style="font-size: 2rem;"> Semences </div>
</div>
</div>
<div class="col-4">
<div class="row h-100 products @if($article_nature == 2) shadow2 @endif" data-id="plants">
<div class="col-lg-6 col-xs-12">
<img src="/img/article_natures/plants.png" class="img-fluid" class="img-fluid">
</div>
<div class="col-lg-6 col-xs-12 green-dark" style="font-size: 2rem;"> Plants </div>
</div>
</div>
<div class="col-4">
<div class="row h-100 products @if($article_nature == 3) shadow2 @endif" data-id="legumes">
<div class="col-lg-6 col-xs-12">
<img src="/img/article_natures/legumes.png" class="img-fluid" class="img-fluid">
</div>
<div class="col-lg-6 col-xs-12 green-dark" style="font-size: 2rem;"> Légumes </div>
</div>
</div>
</div>
<div class="row d-none">
<div class="col-12 text-right">
@include('components.form.button', [
'data_id' => 'semences',
@@ -12,7 +39,6 @@
'class' => 'products bg-green text-white' . (($article_nature == 'plants') ? ' d-none' : ''),
'title' => 'Par plants',
])
</div>
</div>

View File

@@ -1,11 +1,9 @@
<div class="row">
@if ($articles ?? false)
@foreach ($articles as $product_name => $article)
@if ((($product_type == 'botanic') && (($article['semences'] ?? false) || ($article['plants'] ?? false))) || (($product_type == 'merchandise') &&($article['mercchandises'] ?? false)))
<div class="col-3 mb-3">
@include('Shop.Articles.partials.article')
</div>
@endif
<div class="col-lg-3 col-xs-12 mb-3">
@include('Shop.Articles.partials.article')
</div>
@endforeach
@endif
</div>

View File

@@ -17,14 +17,6 @@
@include('Shop.Shelves.partials.display-type')
</div>
</div>
<div class="row">
<div class="col-3">
@include('Shop._partials.display_filters')
</div>
<div class="col-9">
@include('Shop.Shelves.partials.category_add')
</div>
</div>
<div class="row">
<div class="col-12">
@@ -32,8 +24,17 @@
</div>
</div>
<div class="row">
<div class="col-12">
@include('Shop.Shelves.partials.category_add')
</div>
</div>
<div class="mb-3">
@include('Shop._partials.display_filters')
</div>
@include('Shop.Tags.partials.filter')
@if ($display_by_rows ?? false)
@include('Shop.Shelves.partials.category_articles_rows')
@else

View File

@@ -1,6 +1,8 @@
<a href="{{ route('Shop.Basket.basket') }}" class="text-white">
<button type="button" class="btn green p-0">
<i class="fa fa-2x fa-fw fa-shopping-basket mr-2"></i>
<button type="button" class="btn green-dark p-0">
<img src="/img/header/basket.svg" width="36px">
<span class="ml-2 badge bg-yellow green-dark">
<span id="count-basket">{{ \App\Repositories\Core\User\ShopCart::getTotalQuantity() }}</span>
Articles

View File

@@ -1,5 +1,5 @@
<a href="https://www.jardinenvie.com/boutique/commander">
<button type="button" class="btn bg-light green p-0">
<i class="fa fa-2x fa-fw fa-book-open"></i>
<button type="button" class="btn bg-light green-dark p-0">
<img src="/img/header/catalogue.svg" width="36px">
</button>
</a>

View File

@@ -1,8 +1,8 @@
<button type="button" class="btn bg-light green p-0" data-toggle="dropdown">
<button type="button" class="btn bg-light green-dark p-0" data-toggle="dropdown">
@if (App\Repositories\Shop\Customers::isConnected())
<img src="{{ App\Repositories\Shop\Customers::getAvatar() }}" class="img-fluid" title="{{ App\Repositories\Shop\Customers::getName() }}">
@else
<i class="fa fa-2x fa-fw fa-user"></i>
<img src="/img/header/login.svg" width="36px">
@endif
</button>

View File

@@ -5,11 +5,9 @@
<div class="container p-0">
<div class="row m-0 shadow bg-white p-2 w-100">
<div class="col mb-4">
<strong>
<a class="green-dark @if (($category['id'] ?? false) == $menu['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $menu['id']]) }}">
Tous les articles
</a>
</strong><br>
<a class="green-dark @if (($category['id'] ?? false) == $menu['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $menu['id']]) }}">
<div class="w-100"><strong>Tous les articles</strong></div>
</a>
@for ($i = 0; $i < count($submenu[0]); $i++)
@include('Shop.layout.partials.megamenu_leafs', ['menu_children' => $submenu[0][$i]])
@endfor

View File

@@ -1,8 +1,6 @@
<strong>
<a class="green-dark @if (($category['id'] ?? false) == $menu_children['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $menu_children['id']]) }}">
{{ $menu_children['name'] }}
</a>
</strong><br>
<a class="green-dark @if (($category['id'] ?? false) == $menu_children['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $menu_children['id']]) }}">
<div class="w-100"><strong>{{ $menu_children['name'] }}</strong></div>
</a>
@foreach ($menu_children['children'] ?? [] as $leaf)
<a class="green-dark @if (($category['id'] ?? false) == $leaf['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $leaf['id']]) }}">
<div class="w-100">{{ $leaf['name'] }}</div>

View File

@@ -1,8 +1,14 @@
<div class="sp-loading"><img src="images/sp-loading.gif" alt=""><br>LOADING IMAGES</div>
<div class="sp-wrap" style="width: 100%;">
@foreach ($images as $image)
<a href="{{ App\Repositories\Core\Images::getImageSrc($image) }}"><img src="{{ App\Repositories\Core\Images::getNormalSrc($image) }}"></a>
@endforeach
@if ($images)
@foreach ($images as $image)
<a href="{{ App\Repositories\Core\Images::getImageSrc($image) }}">
<img src="{{ App\Repositories\Core\Images::getNormalSrc($image) }}" class="img-fluid">
</a>
@endforeach
@else
<img src="{{ $image }}" class="img-fluid">
@endif
</div>
@push('js')

View File

@@ -1,42 +1,90 @@
@if(!defined('LOAD_TINYMCE'))
@push('js')
<script src="{!! asset('/assets/plugins/tinymce/jquery.tinymce.min.js') !!}"></script>
<script src="{!! asset('/assets/plugins/tinymce/tinymce.min.js') !!}"></script>
<script>
tinymce.defaultSettings = {
plugins: "autoresize fullscreen codemirror link lists table media image imagetools paste customalign stickytoolbar",
toolbar: "undo redo | styleselect | bold italic underline | customalignleft aligncenter customalignright | link media image | bullist numlist | table | code fullscreen",
contextmenu: "link image imagetools table spellchecker bold italic underline",
sticky_toolbar_container: '.tox-editor-header',
toolbar_drawer: "sliding",
sticky_offset: $('nav.main-header').outerHeight(),
codemirror: { config: { theme: 'storm' } },
menubar: false,
removed_menuitems: 'newdocument',
remove_linebreaks: false,
forced_root_block: false,
force_p_newlines: true,
relative_urls: false,
verify_html: false,
branding: false,
statusbar: false,
browser_spellcheck: true,
encoding: 'UTF-8',
image_uploadtab: false,
paste_preprocess: function(plugin, args) {
args.content = args.content.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi, ''); // Unwanted tags
args.content = args.content.replace(/\s(class|style|type|start)=("(.*?)"|(\w*))/gi, ''); // Unwanted attributes
args.content = args.content.replace(/<(p|a|div|span|strike|strong|i|u)[^>]*?>(\s|&nbsp;|<br\/>|\r|\n)*?<\/(p|a|div|span|strike|strong|i|u)>/gi, ''); // Empty tags
},
skin : "boilerplate",
language: '{{ App::getLocale() }}'
};
<script src="/assets/plugins/tinymce/jquery.tinymce.min.js"></script>
<script src="/assets/plugins/tinymce/tinymce.min.js"></script>
@component('boilerplate::minify')
<script>
function initEditor(sel) {
var selector = (typeof(sel) == 'undefined') ? '.editor' : sel;
$(selector).tinymce({});
}
</script>
tinymce.defaultSettings = {
path_absolute : "/",
plugins: "autolink autoresize fullscreen codemirror link lists table media preview image paste customalign stickytoolbar",
toolbar: "insertfile undo redo | styleselect | bold italic underline | customalignleft aligncenter customalignright | link media image | bullist numlist | table | code fullscreen",
contextmenu: "link image imagetools table spellchecker bold italic underline",
sticky_toolbar_container: '.tox-editor-header',
toolbar_drawer: "sliding",
sticky_offset: $('nav.main-header').outerHeight(),
codemirror: { config: { theme: 'storm' } },
menubar: false,
removed_menuitems: 'newdocument',
remove_linebreaks: false,
forced_root_block: false,
force_p_newlines: true,
relative_urls: false,
verify_html: false,
branding: false,
statusbar: false,
browser_spellcheck: true,
encoding: 'UTF-8',
image_uploadtab: false,
paste_preprocess: function(plugin, args) {
args.content = args.content.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi, ''); // Unwanted tags
args.content = args.content.replace(/\s(class|style|type|start)=("(.*?)"|(\w*))/gi, ''); // Unwanted attributes
args.content = args.content.replace(/<(p|a|div|span|strike|strong|i|u)[^>]*?>(\s|&nbsp;|<br\/>|\r|\n)*?<\/(p|a|div|span|strike|strong|i|u)>/gi, ''); // Empty tags
},
skin : "boilerplate",
language: '{{ App::getLocale() }}',
file_picker_callback : function(callback, value, meta) {
var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight;
var cmsURL = tinymce.defaultSettings.path_absolute + 'filemanager?editor=' + meta.fieldname;
if (meta.filetype == 'image') {
cmsURL = cmsURL + "&type=Images";
} else {
cmsURL = cmsURL + "&type=Files";
}
tinyMCE.activeEditor.windowManager.openUrl({
url : cmsURL,
title : 'Filemanager',
width : x * 0.8,
height : y * 0.8,
resizable : "yes",
close_previous : "no",
onMessage: (api, message) => {
callback(message.content);
}
});
}
};
// Prevent Bootstrap dialog from blocking focusin
$(document).on('focusin', function(e) {
if ($(e.target).closest(".tox-tinymce, .tox-tinymce-aux, .moxman-window, .tam-assetmanager-root").length) {
e.stopImmediatePropagation();
}
});
function initEditor(sel, options) {
var selector = (typeof(sel) == 'undefined') ? '.editor' : sel;
var options = (typeof(options) == 'undefined') ? {} : options;
var setup = {
setup: function(ed) {
if ($('#'+ed.id).prop('readonly')) {
ed.settings.readonly = true;
}
}
};
options = Object.assign(options, setup);
for (var i = tinymce.editors.length - 1 ; i > -1 ; i--) {
tinyMCE.execCommand("mceRemoveEditor", true, tinymce.editors[i].id);
}
$(selector).tinymce(options);
}
</script>
@endcomponent
@endpush
@php(define('LOAD_TINYMCE', true))
@endif