If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!
Marked:
Package type:
plugin

Repository

  • Project:web2py_ckeditor4
  • Type:Git
  • Project's site
  • Root location:https://github.com/timrichardson/web2py_ckeditor4

Links

License


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.

The inline edit has been removed to simplify the code (and it seems that the javascript is no longer maintained upstream).

This web2py plugin to add ckeditor to web2py apps is based on the original https://bitbucket.org/PhreeStyle/web2py_ckeditor/wiki/Home)

Upgrading

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.

Installation

 

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.

 

Basic Usage

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:

http://www.web2pyslices.com/main/slices/take_slice/18

http://www.bitsntuts.com/jquery/ckeditor-edit-in-place-jquery-plugin

So far three other GitHub users have contributed improvements: 

dmvieirapyner and flavour. Thanks.

 

Related slices

Comments (2)

  • Login to post



  • 0
    ben9 6 years ago

    Tim, I would like to use your plugin as a git submodule for convenience. Have you done this for your own web2py applications? If so, can you give some tips on how to do this? It seems at present, the github repo folder structure is not geared to do this.


  • 0
    carlosarmenta 7 years ago

    Hi Tim, I use your widget, i'm very impressed, thank you. But i need some of your help, I Can´t install a Code Snipet plugin. I tried in some many ways with no results (in the ckeditor webpage the code snippet plugin is compatible only with tha latest version of ckeditor.).

    It could be a good idea to package a plugin like the web2splices version.

     

    I will apreciate your help. Regards.

    replies (2)

Hosting graciously provided by:
Python Anywhere