@include('admin.header')
        <div class="main-panel">
          <div class="content-wrapper">
            <div class="row">

@include('admin.blogs.form')

        </div>
              </div>
<script src="https://cdn.ckeditor.com/ckeditor5/41.2.0/classic/ckeditor.js"></script>
<script>
    let editorInstance;

    ClassicEditor
        .create(document.querySelector('#editor'))
        .then(editor => {
            editorInstance = editor;
        })
        .catch(error => {
            console.error(error);
        });

    // Ensure CKEditor data sync before form submit
    document.querySelector('#blogForm').addEventListener('submit', function (e) {
        document.querySelector('#editor').value = editorInstance.getData();
    });
</script>


<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
        
<script>
    $(document).ready(function(){
        $('#title').on('input', function(){
            var title = $(this).val();
            var slug = title.toLowerCase()
                            .replace(/[^\w ]+/g,'')
                            .replace(/ +/g,'-');
            $('#slug').val(slug);
        });
    });
</script>

@include('admin.footer')
