ckeditor.js:347 Uncaught TypeError:无法读取属性' getEditor'未定义的

时间:2018-04-19 08:14:18

标签: javascript ckeditor

当页面加载时,编辑器不会出现。 javascript控制台显示以下错误" Uncaught TypeError:无法读取属性' getEditor'未定义"

  

ckeditor.js:347 Uncaught TypeError:无法读取属性' getEditor'未定义的

     

at a(ckeditor.js:347)

     

at Object.CKEDITOR.replace(ckeditor.js:351)

     

提交信息:793

enter image description here

我的加载jquery页面是后续行

<script src="{{ asset('themes/js/jquery.min.js') }}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.5/validator.min.js"></script>
<script src="{{ asset('themes/js/bootstrap.min.js') }}"></script>
<script src="{{ asset('themes/js/bootstrap-toggle.min.js') }}"></script>
<script src="{{ asset('themes/ckeditor/ckeditor.js') }}"></script>
<script>
CKEDITOR.replace('body' ,{
filebrowserUploadUrl : '/admin/panel/upload-image',
filebrowserImageUploadUrl :  '/admin/panel/upload-image'
});
</script>
<script type="text/javascript" src="{{ asset('themes/js/jquery.smartWizard.min.js') }}"></script>
<script type="text/javascript">
    $(document).ready(function(){

        // Toolbar extra buttons
        var btnFinish = $('<button ></button>').text('Final')
            .addClass('btn btn-info')
            .on('click', function(){
                if (!$(this).hasClass('disabled')){
                    var elmForm = $("#schools");
                    if(elmForm){
                        elmForm.validator('validate');
                        var elmErr = elmForm.find('.has-error');
                        if(elmErr && elmErr.length > 0){
                            alert('Oops we still have error in the form');
                            return false;
                        }else{
                            alert('Great! we are ready to submit form');
                            elmForm.submit();
                            return false;
                        }
                    }
                }
            });
        var btnCancel = $('<button></button>').text('Cancel')
            .addClass('btn btn-danger')
            .on('click', function(){
                $('#smartwizard').smartWizard("reset");
                $('#schools').find("input, textarea").val("");
            });



        // Smart Wizard
        $('#smartwizard').smartWizard({
            selected: 0,
            theme: 'dots',
            transitionEffect:'fade',
            toolbarSettings: {toolbarPosition: 'bottom',
                toolbarExtraButtons: [btnFinish, btnCancel]
            },
            anchorSettings: {
                markDoneStep: true, // add done css
                markAllPreviousStepsAsDone: true, // When a step selected by url hash, all previous steps are marked done
                removeDoneStepOnNavigateBack: true, // While navigate back done step after active step will be cleared
                enableAnchorOnDoneStep: true // Enable/Disable the done steps navigation
            }
        });

        $("#smartwizard").on("leaveStep", function(e, anchorObject, stepNumber, stepDirection) {
            var elmForm = $("#form-step-" + stepNumber);
            // stepDirection === 'forward' :- this condition allows to do the form validation
            // only on forward navigation, that makes easy navigation on backwards still do the validation when going next
            if(stepDirection === 'forward' && elmForm){
              //elmForm.validator('validate');
                var elmErr = elmForm.children('.has-error');
                if(elmErr && elmErr.length > 0){
                    // Form validation failed
                    return false;
                }
            }
            return true;
        });

        $("#smartwizard").on("showStep", function(e, anchorObject, stepNumber, stepDirection) {
            // Enable finish button only on last step
            if(stepNumber == 3){
                $('.btn-finish').removeClass('disabled');
            }else{
                $('.btn-finish').addClass('disabled');
            }
        });

    });
</script>
<script src="{{ asset('themes/js/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('themes/js/bootstrap-datepicker.fa.min.js') }}"></script>
<script>
    $(document).ready(function() {
        $("#birthdate").datepicker();
        $("#datepicker1btn").click(function(event) {
            event.preventDefault();
            $("#datepicker1").focus();
        });
    });
</script>

1 个答案:

答案 0 :(得分:0)

这里的问题是在完全加载DOM之前调用Ckeditor.replace。在$(document).ready();

之后调用它