Using django-froala-editor, the editor works in admin page won't work in post page?Uncaught TypeError: $(…).froalaEditor is not a function

后端 未结 1 1006
南旧
南旧 2021-01-29 13:35

Sorry if my previous post wasn\'t clear. I\'m using django-froala-editor, https://github.com/froala/django-froala-editor but it just won\'t work. I remember using this in my la

相关标签:
1条回答
  • 2021-01-29 14:19

    If the getCookie function is not set, then perhaps add it as per this page: https://docs.djangoproject.com/en/1.9/ref/csrf/

    // using jQuery
    function getCookie(name) {
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
    

    So just add it to your project. Also make sure you have included all files. Perhaps you are missing a file which already has this function added.

    0 讨论(0)
提交回复
热议问题