v0.7.8 - Added Quill Editor to all sites - Fixed Event name/subname showance in news.index
This commit is contained in:
@@ -11,37 +11,48 @@
|
||||
|
||||
@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>Rediger nyhed:</h1>
|
||||
<form method="post" action="{{route("news.update", ["news" => $news])}}">
|
||||
@csrf
|
||||
@method("PUT")
|
||||
<label for="title">Navn</label>
|
||||
<input value="{{$news->name}}" type="text" name="name" id="title" required>
|
||||
<textarea name="content" id="editor">{{$news->content}}</textarea>
|
||||
<input value="{{$news->name}}" type="text" name="subname" id="title" required>
|
||||
<div id="editor">{!! $news->content !!}</div>
|
||||
<textarea name="content" class="d-none" id="hiddenArea"></textarea>
|
||||
<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")
|
||||
|
||||
Reference in New Issue
Block a user