skip to navigation
skip to content

Not Logged In

django-aloha-edit 0.1.0

Django Aloha Edit

Latest Version: 0.3.3

Provides easy integration of the Aloha Editor into your Django app as well as several additional Aloha plugins.

Installing

pip install django-aloha-edit

Usage

Using the HTMLField:

from aloha.fields import HTMLField

class myModel(models.Model):
    content = HTMLField()

This will allow you to sanitize the output while automatically using the Aloha Widget:

ALLOWED_TAGS = ['a', 'abbr', ]
ALLOWED_ATTRIBUTES = {
                'a'         : ['href', 'rel', 'target', 'title',],
             }
ALLOWED_STYLES = ['float','text-align','width','height',]
ALLOWED_CLASSES = ['error', 'success', 'warning', 'info',
                   ]
IFRAME_ORIGINS = ["http://www.youtube.com/embed/", "http://blip.tv/play/"]

Extra Plugins

Video Embed

This plugin provides video embedding capabilities. It currently supports both blip and youtube, but other services can easily be added. This plugin provides both a content handler (so you can copy/paste links) as well as UI elements in the Aloha bar to manipulate and add video embeds.

Bootstrap UI

This plugin provides manipulation of several [bootstrap](http://twitter.github.io/bootstrap/) elements including collapse (called spoiler here) and thumbnails. Make sure you include the appropriate css and javascript for those parts of bootstrap or they will not work.

Usage

Make sure to load the plugins in either the aloha config file or the script load specification. Use 'user/videoembed', 'user/bootstrapui'

You must also add the UI elements to the UI configuration. Below is a sample config:

Aloha = window.Aloha || {};
Aloha.settings = {
                sidebar: {
                        disabled: true
                },
                plugins: {
                        load: ['common/ui','common/commands','common/format','common/list', 'common/align',
                               'common/table','common/image','common/undo','common/abbr',
                               'common/link','common/contenthandler','common/paste','common/block','common/characterpicker',
                               'user/videoembed', 'user/bootstrapui'],
                },
                toolbar: {
                        tabs: [
                               {
                                 label: 'tab.format.label',
                                 showOn: { scope: 'Aloha.continuoustext' },
                                 components: [
                                              [
                                                                                        'bold', 'strong', 'italic', 'emphasis', '\n',
                                                                                        'subscript', 'superscript', 'strikethrough', 'quote',
                                                                                        ], [
                                                                                        'formatLink', 'formatAbbr', 'formatNumeratedHeaders', 'toggleDragDrop', '\n',
                                                                                        'formatSpoilers', 'formatThumbnail', 'addVideo', '\n',
                                                                                        'toggleMetaView', 'wailang', 'toggleFormatlessPaste',
                                                                                        ], [
                                                                                        'alignLeft', 'alignCenter', 'alignRight', 'alignJustify', '\n',
                                                                                        'orderedList', 'unorderedList', 'indentList', 'outdentList'
                                                                                        ], [
                                                                                        'formatBlock'
                                                                                        ]
                                              ]
                               },
                               {
                                 label: "tab.insert.label",
                                 showOn: { scope: 'Aloha.continuoustext' },
                                 components: [
                                              [ "createTable", "characterPicker", "insertLink",
                                                "insertImage", "insertAbbr", "insertToc",
                                                "insertHorizontalRule", "insertTag", 'insertSpoilers', 'insertVideo','insertThumbnail',]
                                              ]
                               },
                               {
                                 label: "tab.img.label",
                                 showOn: {scope: 'image'},
                                 components: [
                                              [ "imageSource", "\n",
                                                "imageTitle" ],
                                                [ "imageResizeWidth", "\n",
                                                  "imageResizeHeight" ],
                                                  [ "imageAlignLeft", "imageAlignRight", "imageAlignNone", "\n",
                                                    "imageCropButton", "imageCnrReset", "imageCnrRatio",   ],
                                                    [ "imageBrowser" ],
                                                                ["wrapThumbnail",]
                                              ]
                               },
                               {
                                 label: "Thumbnail",
                                 showOn: { scope: 'Aloha.Block.ThumbnailBlock' },
                                 components: [
                                              [ "thumbnailSrc", "thumbnailCaption","thumbnailRemove",],
                                              ["\n","thumbnailAlignLeft", "thumbnailAlignRight", "thumbnailAlignNone"]
                                              ]
                               },
                               {
                                 label: "Spoiler",
                                 showOn: { scope: 'Aloha.Block.SpoilerBlock' },
                                 components: [
                                              [ "spoilerTitle","spoilerRemove",],
                                              ]
                               },
                               {
                                 label: "Video",
                                 showOn: { scope: 'Aloha.Block.VideoBlock' },
                                 components: [
                                              [ "videoSrc",],
                                              ]
                               },
                               ]
                },
                bundles: {
                        // Path for custom bundle relative from require.js path
                        user: '../../js/aloha-plugins'
                }
};

About Aloha Editor

The [Aloha Editor](http://www.aloha-editor.org/) is a WYSIWYG that uses the HTML5 content-editable attribute of the browswer for the best editing experience.

 
File Type Py Version Uploaded on Size
django-aloha-edit-0.1.0.tar.gz (md5) Source 2013-07-07 0B
  • Downloads (All Versions):
  • 48 downloads in the last day
  • 355 downloads in the last week
  • 908 downloads in the last month
  • Author: Nathaniel Tucker
  • Home Page: https://github.com/ntucker/django-aloha-edit
  • Keywords: aloha, WYSIWYG
  • License:
    Copyright (c) 2012-2013, Nathaniel Tucker
    All rights reserved.
    
    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:
    
        1. Redistributions of source code must retain the above copyright
            notice, this list of conditions and the following disclaimer.
        2. Redistributions in binary form must reproduce the above copyright
            notice, this list of conditions and the following disclaimer in the
            documentation and/or other materials provided with the distribution.
    
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.
    
    Aloha Editor License:
     * Aloha Editor is a WYSIWYG HTML5 inline editing library and editor. 
     * Copyright (c) 2010-2012 Gentics Software GmbH, Vienna, Austria.
     * Contributors http://aloha-editor.org/contribution.php 
     * 
     * Aloha Editor is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * as published by the Free Software Foundation; either version 2
     * of the License, or any later version.
     *
     * Aloha Editor is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, write to the Free Software
     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     * 
     * As an additional permission to the GNU GPL version 2, you may distribute
     * non-source (e.g., minimized or compacted) forms of the Aloha-Editor
     * source code without the copy of the GNU GPL normally required,
     * provided you include this license notice and a URL through which
     * recipients can access the Corresponding Source.
  • Package Index Owner: ntucker
  • DOAP record: django-aloha-edit-0.1.0.xml