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

后端 未结 1 680
离开以前
离开以前 2021-01-29 13:15

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 13:58

    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)
提交回复
热议问题