javascript - Django, django-ckeditor, Google MDL: Cannot read property 'getSelection' of undefined -


i using django 1.11 , django-ckeditor text fields in admin panel, , inputs outside admin (in public forms). css framework - google material design lite.

when trying integrate ckeditor public forms, charfield ckeditor not working @ all. can't focus field, , when click of ckeditor control elements errors

uncaught typeerror: cannot read property 'getselection' of undefined @ ckeditor.dom.selection.getnative (ckeditor.js:445)     @ ckeditor.dom.selection (ckeditor.js:443)     @ a.ckeditor.editor.getselection (ckeditor.js:440)     @ ckeditor.plugins.undo.image (ckeditor.js:1174)     @ ckeditor.plugins.undo.undomanager.save (ckeditor.js:1169)     @ a.b (ckeditor.js:1164)     @ a.n (ckeditor.js:10)     @ a.ckeditor.event.ckeditor.event.fire (ckeditor.js:12)     @ a.ckeditor.editor.ckeditor.editor.fire (ckeditor.js:13)     @ a.execcommand (ckeditor.js:271) 

and in firefox:

typeerror: this.document.getwindow(...).$ undefined getnative http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:445:29     ckeditor.dom.selection http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:443:54     ckeditor.editor.prototype.getselection http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:440:319     ckeditor.plugins.undo.image http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:1174:458     save http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:1169:123     b http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:1164:291     n http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:10:222     ckeditor.event.prototype</<.fire</< http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:12:42     ckeditor.editor.prototype.fire http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:13:212     execcommand http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:271:120     ckeditor.ui.button/<.click< http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:654:417     execute http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:655:478     render/q< http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:656:324     addfunction/< http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:31:216     callfunction http://127.0.0.1:8000/static/ckeditor/ckeditor/ckeditor.js:31:332     onclick http://127.0.0.1:8000/accounts/trip/2/:1:1 

ckeditor.js 445 line:

x?this.document.$.selection:this.document.getwindow().$.getselection()},gettype:x?function(){var a=this._.cache;if(a.type)return a.type;var b=ckeditor.selection_none;try{var c=this.getnative(),d=c.type;"text"==d&&(b=ckeditor.selection_text);"control"==d&&(b=ckeditor.selection_element);c.createrange().parentelement()&&(b=ckeditor.selection_text)}catch(e){}return a.type=b}:function(){var a=this._.cache;if(a.type)return a.type;var b=ckeditor.selection_text,c=this.getnative();if(!c||!c.rangecount)b=ckeditor.selection_none; 

forms.py:

from ckeditor_uploader.widgets import ckeditoruploadingwidget   class paymentform(forms.form):     comments = forms.charfield(widget=ckeditoruploadingwidget()) 

to integrate ckeditor js scripts i'm using {{ form.media }} in template.

first of tried search info errors , know fixes, of founded doesn't worked me. found similar questions ckeditor here, without working solution.

when checked js scripts, found problem in javascript of google material design lite css framework https://github.com/google/material-design-lite

when material.min.js integrated page scripts - ckeditor not work. not minified framework js: https://code.getmdl.io/1.3.0/material.js

ps: first question ever made here, sorry inconvenience.

thanks help!

made changes make django-ckeditor work google material design lite framework. if needed, can use version of django-ckeditor (my fork): https://github.com/wardal/django-ckeditor while waiting official answer , solutions here: https://github.com/django-ckeditor/django-ckeditor/issues/429


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -