A plugin for ckEditor including image uploads and management of images on the server.
Includes the full edition of ckEditor v4.5.7 (2016-02) and tested with web2py 2.9.x -> 2.13
It is easy to update the ckEditor content yourself rather than waiting for me to make a new version.
This is a fork of Bruno Rocha's plugin. It's updated to v4 ckeditor, and works better with recent web2py versions. Code is on github, fixes are welcome. There are two maintainers at present.
This web2py plugin to add ckeditor to web2py apps is based on the original https://bitbucket.org/PhreeStyle/web2py_ckeditor/wiki/Home)
To upgrade to a newer version of ckeditor, replace the directory static/plugin_ckeditor with the directory downloaded from the ckeditor site. You will probably need to refresh or delete browser caches.
This plugin integrates the CKEditor into web2py.
In your model, you need to import and initialize it:
from plugin_ckeditor import CKEditor ckeditor = CKEditor(db) ckeditor.define_tables()
Note that define_tables defines a table when it is executed, even if lazy tables is used. To avoid this happening on every request, you could move .define_tables to controllers where ckeditor is used.
Its most basic usage is to assign it to a Field widget:
db.define_table('content', Field('title', length=255), Field('public', 'boolean', default=True), Field('text', 'text', widget=ckeditor.widget) )
The CKEditor now automatically becomes available every time SQLFORM is used.
It includes integrated upload and browse functionality for images. The plugin defines a table to store images. This works using ckeditor's custom browser integration, which means web2py controls the display of contents when the user cliick browse.
Look at the file views/plugin_ckeditor/browse.html to alter the appearance of the uploaded file browser. By default it's not very attractive.
The upload and browse functionality is all taken care of by the plugin and does not require you to do anything on your end once you have initialized the plugin in your model as demonstrated above. You can also delete images from the server.
Thanks and References
Bruno used the following resources in developing this plugin, so a special thanks to the authors of these for providing the ground work required to make this possible:
So far three other GitHub users have contributed improvements: