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,31 +11,47 @@
@section("content")
<style>
.ck-editor__main {
#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 Nyhed</h1>
<form method="post" action="{{ route("news.store") }}">
@csrf
<label for="title">Titel nyheden:</label>
<input type="text" name="name" id="title" placeholder="OBS: Menuplanen er ændret" required>
<textarea name="content" id="editor"></textarea>
<input type="text" name="subname" id="title" placeholder="OBS: Menuplanen er ændret" required>
<div id="editor"></div>
<textarea name="content" class="d-none" id="hiddenArea"></textarea>
<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