Coder Social home page Coder Social logo

mrdumpty / web2py_ckeditor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rochacbruno-archive/web2py_ckeditor

0.0 2.0 0.0 7.31 MB

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

Python 9.59% Shell 0.07% HTML 54.43% CSS 25.77% JavaScript 9.63% PHP 0.51%

web2py_ckeditor's Introduction

web2py_ckeditor (2014 fork, v1.0)

v1.2 Updated to ckeditor 4.5.7 Feb 2016.

v1.1.1 Bugfix from flavour: Make unlink do something when uploadfs is None

v1.1 Update to ckeditor 4.5.3 September 09 2015

v 1.0 Updated to ckeditor 4.4.6 Merged cleanup and upload improvements from dmvieira

v 0.4 Updated to ckeditor 4.4.3 July 15 2014

v 0.3 The full version of the plugin is the default. The std version is included as well. Updated to ckeditor v4.3.4. March 25, 2014

This is a fork of Bruno Rocha's plugin. It's updated to v4 ckeditor, and works better with recent web2py versions. Tested against web2py v2.9.x The inline edit has been removed to simplify the code (and it seems that the javascript is no longer maintained upstream).

This web2py plugin 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. The repository comes with a full version. To use that, rename the 'full' plugin to static/plugin_ckeditor

CKEditor Plugin for web2py

Introduction

Sometimes you just need a WYSIWYG editor. This plugin integrates CKEditor into web2py. It acts much like the Auth object in its usage. For example, in your model, you need to import and initialize it:

from plugin_ckeditor import CKEditor
ckeditor = CKEditor(db)
ckeditor.define_tables()

Basic Usage

It's 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.

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.

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

Tips

(From Leonel Câmara) When using it in a loaded component, there may be some routing issues. To solve: ...use the following code in your model before ckeditor.define_tables()

# To avoid routing problems in case we're not the default app and in case we're in a LOAD and the extension for URLs isn't HTML
ckeditor.settings.url_upload = URL(request.app, 'plugin_ckeditor', 'upload', extension='html')
ckeditor.settings.url_browse = URL(request.app, 'plugin_ckeditor', 'browse', extension='html')

======= v 1.0 Updated to ckeditor 4.4.6 Merged cleanup and upload improvements from dmvieira

v 0.4 Updated to ckeditor 4.4.3 July 15 2014

v 0.3 The full version of the plugin is the default. The std version is included as well. Updated to ckeditor v4.3.4. March 25, 2014

This is a fork of Bruno Rocha's plugin. It's updated to v4 ckeditor, and works better with recent web2py versions. Tested against web2py v2.9.x The inline edit has been removed to simplify the code (and it seems that the javascript is no longer maintained upstream).

This web2py plugin 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. The repository comes with a full version. To use that, rename the 'full' plugin to static/plugin_ckeditor

CKEditor Plugin for web2py

Introduction

Sometimes you just need a WYSIWYG editor. This plugin integrates CKEditor into web2py. It acts much like the Auth object in its usage. For example, in your model, you need to import and initialize it:

from plugin_ckeditor import CKEditor
ckeditor = CKEditor(db)
ckeditor.define_tables()

Basic Usage

It's 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.

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.

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

Tips

(From Leonel Câmara) When using it in a loaded component, there may be some routing issues. To solve: ...use the following code in your model before ckeditor.define_tables()

# To avoid routing problems in case we're not the default app and in case we're in a LOAD and the extension for URLs isn't HTML
ckeditor.settings.url_upload = URL(request.app, 'plugin_ckeditor', 'upload', extension='html')
ckeditor.settings.url_browse = URL(request.app, 'plugin_ckeditor', 'browse', extension='html')

master Q: "I was wondering how to preserve the formatting that's done for a field Using CKEditor when the field is serialized in a view."

Leonel Câmara: "You use the XML helper. For instance, let's suppose I have a table 'page' with a field 'body' which I have set with ckeditor. In the view I can do: {{=XML(page.body, sanitize=False)}}

If you can trust the input "sanitize=False" is a good idea (for instance if it can only be changed in the backoffice by members of the administration), otherwise remove the sanitize=False."

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.