Coder Social home page Coder Social logo

Comments (18)

git-bone avatar git-bone commented on August 25, 2024 1

yep, that's what I saw and tested it here. Again, many thanks for your fast response.

from flask-ckeditor.

greyli avatar greyli commented on August 25, 2024

There is a typo in your code: CKEDITOR_PKG_TYE should be CKEDITOR_PKG_TYPE.

from flask-ckeditor.

git-bone avatar git-bone commented on August 25, 2024

yeah, you're right. Well, that is just a typo here, in the actual file it is written correctly.

from flask-ckeditor.

greyli avatar greyli commented on August 25, 2024

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

...

from flask-ckeditor.

git-bone avatar git-bone commented on August 25, 2024

That gives a NameError 'ckeditor' is not defined.

from flask-ckeditor.

greyli avatar greyli commented on August 25, 2024

Could you provide the full traceback for the NameError exception?

from flask-ckeditor.

git-bone avatar git-bone commented on August 25, 2024

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
app = create_app()
File "/home/user/app/_init.py", line 26, in create_app
ckeditor.init_app(app)
NameError: name 'ckeditor' is not defined

from flask-ckeditor.

git-bone avatar git-bone commented on August 25, 2024

wait a minute. I made a type elsewhere... app is running now, but still, not in basic mode.

from flask-ckeditor.

greyli avatar greyli commented on August 25, 2024

You are welcome :p
Yeah, I notice you typo the ckeditor to cdeditor...

from flask-ckeditor.

git-bone avatar git-bone commented on August 25, 2024

But how to get it to basic mode? the ckeditor field is still default 'standard'...

from flask-ckeditor.

greyli avatar greyli commented on August 25, 2024

Please add this line under ckeditor.load() in your template:

{{ ckeditor.config() }}

from flask-ckeditor.

greyli avatar greyli commented on August 25, 2024

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') }}

from flask-ckeditor.

git-bone avatar git-bone commented on August 25, 2024

Tried both, with and without field name, but unfortunately still standard view. Am I missing something here?

from flask-ckeditor.

greyli avatar greyli commented on August 25, 2024

Are you sure you pass the correct name value? Also, please provide the rendered HTML source for the page.

from flask-ckeditor.

git-bone avatar git-bone commented on August 25, 2024

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 :)

from flask-ckeditor.

greyli avatar greyli commented on August 25, 2024

:)

from flask-ckeditor.

git-bone avatar git-bone commented on August 25, 2024

btw, in the template this part is not needed. loading is sufficient to get it working;

{{ ckeditor.config() }}

from flask-ckeditor.

greyli avatar greyli commented on August 25, 2024

You are right, I just found this part in docs:

Except CKEDITOR_SERVE_LOCAL and CKEDITOR_PKG_TYPE, when you use other configuration variable, you have to call ckeditor.config() in template to make them register with CKEditor:

<body>
    ...  <!-- {{ ckeditor.load() }} or <script src="/path/to/ckeditor.js"> -->
    {{ ckeditor.config() }}
</body>

from flask-ckeditor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.