v0.7.8 - Added Quill Editor to all sites - Fixed Event name/subname showance in news.index

This commit is contained in:
Anders
2020-08-12 08:42:58 +02:00
parent 511e0b783f
commit 746926d439
13 changed files with 261 additions and 113 deletions
@@ -11,23 +11,25 @@
@section("content")
<style>
.ck-editor__main {
margin-bottom: 1rem;
}
.toggle__label::before, .toggle__label::after {
border-color: black;
}
.toggle__text::before {
border-color: black;
}
#editor {
margin-bottom: 1rem;
}
</style>
<script src="https://cdn.ckeditor.com/ckeditor5/21.0.0/classic/ckeditor.js"></script>
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<h1>Opret Vejledning</h1>
<form method="post" action="{{ route("guides.store") }}">
@csrf
<label for="title">Titel guiden</label>
<input type="text" name="name" id="title" required>
<textarea name="guide_articles" id="editor"></textarea>
<div id="editor"></div>
<textarea name="guide_articles" class="d-none" id="hiddenArea"></textarea>
<label class="toggle">
<input class="toggle__input" type="checkbox" name="newsoption">
<span class="toggle__label">
@@ -37,19 +39,33 @@
<input type="submit" class="btn btn-dark text-white" value="Opret">
</form>
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script>
ClassicEditor
.create( document.querySelector( '#editor' ) )
.then( editor => {
console.log( editor );
} )
.catch( error => {
console.error( error );
} );
var container = document.getElementById("editor");
var fullEditor = new Quill(container, {
modules: {
'toolbar': [
[ 'bold', 'italic', 'underline', 'strike' ],
[{ 'color': [] }, { 'background': [] }],
[{ 'script': 'super' }, { 'script': 'sub' }],
[{ 'header': '1' }, { 'header': '2' }, 'blockquote', 'code-block' ],
[{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
[ {'direction': 'rtl'}, { 'align': [] }],
[ 'link' ],
[ 'clean' ]
],
},
theme: 'snow'
});
</script>
<script>
var form = document.querySelector('form');
form.onsubmit = function() {
var myEditor = document.getElementById('editor');
var html = myEditor.children[0].innerHTML;
document.getElementById('hiddenArea').innerText = html;
}
</script>
@endsection
@section("scripts")
<script>
@@ -11,17 +11,18 @@
@section("content")
<style>
.ck-editor__main {
margin-bottom: 1rem;
}
.toggle__label::before, .toggle__label::after {
border-color: black;
}
.toggle__text::before {
border-color: black;
}
#editor {
margin-bottom: 1rem;
}
</style>
<script src="https://cdn.ckeditor.com/ckeditor5/21.0.0/classic/ckeditor.js"></script>
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<h1>Rediger vejledning:</h1>
<form method="post" action="{{route("guides.update", ["guide" => $guide])}}">
@csrf
@@ -29,7 +30,8 @@
<label for="title">Navn</label>
<input value="{{$guide->name}}" type="text" name="name" id="title" required>
<label for="editor">Vejledning</label>
<textarea name="guide_articles" id="editor">{{$guide->guide_articles}}</textarea>
<div id="editor">{!! $guide->guide_articles !!}</div>
<textarea name="guide_articles" class="d-none" id="hiddenArea"></textarea>
<label class="toggle">
<input class="toggle__input" type="checkbox" name="newsoption">
<span class="toggle__label">
@@ -39,21 +41,32 @@
<input type="submit" class="btn btn-dark text-white" value="Rediger">
</form>
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script>
ClassicEditor
.create( document.querySelector( '#editor' ), {
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote' ],
heading: {
options: [
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
{ model: 'heading1', view: 'h3', title: 'Heading 1', class: 'sde-blue' },
{ model: 'heading2', view: 'h4', title: 'Heading 2', class: 'sde-blue' },
]
}
} )
.catch( error => {
console.log( error );
} );
var container = document.getElementById("editor");
var fullEditor = new Quill(container, {
modules: {
'toolbar': [
[ 'bold', 'italic', 'underline', 'strike' ],
[{ 'color': [] }, { 'background': [] }],
[{ 'script': 'super' }, { 'script': 'sub' }],
[{ 'header': '1' }, { 'header': '2' }, 'blockquote', 'code-block' ],
[{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
[ {'direction': 'rtl'}, { 'align': [] }],
[ 'link' ],
[ 'clean' ]
],
},
theme: 'snow'
});
</script>
<script>
var form = document.querySelector('form');
form.onsubmit = function() {
var myEditor = document.getElementById('editor');
var html = myEditor.children[0].innerHTML;
document.getElementById('hiddenArea').innerText = html;
}
</script>
@endsection
@section("scripts")