使用 mix('dist/js/ckeditor-classic.js') 时如何获取值 ckeditor }}

问题描述 投票:0回答:0

我通过添加这个脚本来使用 ckeditor5。我想获取该值,但出现错误 Uncaught ReferenceError: ClassicEditor is not defined。这是我做的,不知道哪里错了,你能帮我吗? image code image bug

<script src="{{ mix('dist/js/ckeditor-classic.js') }}"></script>
<script>
    const editorElement = document.querySelector('.editor');
    ClassicEditor
        .create(document.querySelector('.editor'))
        .then(editor => {
            console.log(editor);
        })
        .catch(error => {
            console.error(error);
        });

    function getDataFromDescriptionEditorEditor() {
        return ClassicEditor.getData();
    }
    $(".btn-primary").on('click', function() {
        console.log(getDataFromDescriptionEditorEditor());
    })
</script>
javascript php html ckeditor5
© www.soinside.com 2019 - 2024. All rights reserved.