Closed git-bone closed 5 years ago
There is a typo in your code: CKEDITOR_PKG_TYE
should be CKEDITOR_PKG_TYPE
.
yeah, you're right. Well, that is just a typo here, in the actual file it is written correctly.
Please try to update your init.py to this:
ckeditor = CKEditor()
def create_app(config_class = Config):
app = Flask(__name__)
app.config.from_object(config_class)
ckeditor.init_app(app) # <-- notice this line
...
That gives a NameError 'ckeditor' is not defined.
Could you provide the full traceback for the NameError
exception?
That would be this. In the meantime, may I thank you for the very fast response to my issue :)
Traceback (most recent call last):
File "run.py", line 9, in
wait a minute. I made a type elsewhere... app is running now, but still, not in basic mode.
You are welcome :p
Yeah, I notice you typo the ckeditor
to cdeditor
...
But how to get it to basic mode? the ckeditor field is still default 'standard'...
Please add this line under ckeditor.load()
in your template:
{{ ckeditor.config() }}
You also need to pass the name
parameter, the value should be the name of CKEditor form field:
{{ ckeditor.config(name='Your CKEditor form field name') }}
Tried both, with and without field name, but unfortunately still standard view. Am I missing something here?
Are you sure you pass the correct name value? Also, please provide the rendered HTML source for the page.
well, finally found the issue. Your hint on html source put me on the right track. There was an old link to ckeditor script still in the base html. Removed that, and now it works. thanks anyway, and keep on the good work :)
:)
btw, in the template this part is not needed. loading is sufficient to get it working;
{{ ckeditor.config() }}
You are right, I just found this part in docs:
Except
CKEDITOR_SERVE_LOCAL
andCKEDITOR_PKG_TYPE
, when you use other configuration variable, you have to callckeditor.config()
in template to make them register with CKEditor:<body> ... <!-- {{ ckeditor.load() }} or <script src="/path/to/ckeditor.js"> --> {{ ckeditor.config() }} </body>
yep, that's what I saw and tested it here. Again, many thanks for your fast response.
Hi,
I'm using Flask-CKeditor currently with Flask-Admin in standard view and trying to set configuration in config.py to get it to basic. Why isn't this working? simplified code is as follows. This code works fine but continues to show only the standard ckeditor. I would like it to be the basic view, as is set in the config.py file.
init.py:
config.py: class Config(object): CKEDITOR_PKG_TYE = 'basic'
Flask-Admin view: form_overrides = { 'fieldname': CKEditorField }
my_create.html: {% extends 'admin/model/create.html' %} {% block tail %} {{ super() }} {{ ckeditor.load() }} {% endblock %}>