All Projects → dperetti → Django-wagtailmedium

dperetti / Django-wagtailmedium

Licence: other
A Medium Editor integration for the Wagtail CMS.

Programming Languages

python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects
shell
77523 projects

Projects that are alternatives of or similar to Django-wagtailmedium

vagrant-wagtail-develop
A script to painlessly set up a Vagrant environment for development of Wagtail
Stars: ✭ 36 (+111.76%)
Mutual labels:  wagtail
wagtail-react-project
Wagtail template with a React/Redux frontend.
Stars: ✭ 25 (+47.06%)
Mutual labels:  wagtail
react-streamfield
Powerful field for inserting multiple blocks with nesting. (NO LONGER MAINTAINED - See Wagtail 2.13 Release Notes)
Stars: ✭ 34 (+100%)
Mutual labels:  wagtail
wagtaildraftail
🐦📝🍸 Draft.js editor for Wagtail, built upon Draftail and draftjs_exporter
Stars: ✭ 23 (+35.29%)
Mutual labels:  wagtail
wagtailmodelchoosers
A Wagtail app to pick generic models (rather than snippets or pages)
Stars: ✭ 23 (+35.29%)
Mutual labels:  wagtail
wagtail-simple-gallery
A simple gallery app for Wagtail. https://pypi.org/project/wagtail-simple-gallery/
Stars: ✭ 41 (+141.18%)
Mutual labels:  wagtail
digihel
City of Helsinki Digital Helsinki Wagtail CMS
Stars: ✭ 19 (+11.76%)
Mutual labels:  wagtail
draftjs-filters
Filter Draft.js content to preserve only the formatting you allow
Stars: ✭ 53 (+211.76%)
Mutual labels:  wagtail
wagtail-import-export
UNMAINTAINED. Try wagtail-transfer, the evolution of this package: https://github.com/wagtail/wagtail-transfer/
Stars: ✭ 31 (+82.35%)
Mutual labels:  wagtail
wagtail-cache
A simple page cache for Wagtail based on the Django cache middleware.
Stars: ✭ 63 (+270.59%)
Mutual labels:  wagtail
WF-website
Website for Western Friend, part of the Religious Society of Friends
Stars: ✭ 34 (+100%)
Mutual labels:  wagtail
wagtail-filepreviews
Extend Wagtail's Documents with image previews and metadata from FilePreviews
Stars: ✭ 21 (+23.53%)
Mutual labels:  wagtail
wagtail-graphql
App to automatically add GraphQL support to a Wagtail website
Stars: ✭ 37 (+117.65%)
Mutual labels:  wagtail
wagtail-redirect-importer
Note: This library is now included in Wagtail 2.10, use the builtin version instead of this.
Stars: ✭ 15 (-11.76%)
Mutual labels:  wagtail
wagtailgridder
Wagtail Gridder is a Bootstrap 4 enabled layout for the Wagtail CMS. Grid Items are created within categories, and displayed on a Grid Index Page. The JavaScript libraries Gridder and MixItUp are included.
Stars: ✭ 59 (+247.06%)
Mutual labels:  wagtail
wagtailenforcer
The Wagtail arm of the law - enforce security protocols on your Wagtail site
Stars: ✭ 43 (+152.94%)
Mutual labels:  wagtail
gatsby-source-wagtail
Plugin for sourcing Gatsby data from Wagtail CMS
Stars: ✭ 16 (-5.88%)
Mutual labels:  wagtail
wagtailcolumnblocks
Streamfield columns for Wagtail
Stars: ✭ 38 (+123.53%)
Mutual labels:  wagtail
wagtailmath
Beautiful equations in your StreamField content
Stars: ✭ 27 (+58.82%)
Mutual labels:  wagtail
localore
Wagtail-based CMS and Ansible playbooks for Localore: Finding America
Stars: ✭ 16 (-5.88%)
Mutual labels:  wagtail

Django-WagtailMedium

Wagtailmedium is a Medium Editor integration for the Wagtail CMS.

https://raw.githubusercontent.com/dperetti/Django-wagtailmedium/master/Documentation.codestory/data/1a179310-b817-11e6-9f99-f91930e01b01.png

Note: A more detailed documentation is available in .codestory format, along with a sample project to fiddle with.

Features

  • Compatible with Wagtail internal links, plus the ability to add url fragments.
  • Configurable from the Django settings.
  • Ability to create custom buttons (ex: text marker).

Install

  1. Install from pip:

    pip install django-wagtailmedium
    
  2. Add wagtailmedium to your apps:

    INSTALLED_APPS = [
      ...
      'wagtailmedium',
    ]
    

3. Add a wagtailmedium widget to ``WAGTAILADMIN_RICH_TEXT_EDITORS`` (implemented by wagtail, undocumented yet)

WAGTAILADMIN_RICH_TEXT_EDITORS = {
     'default': {
         'WIDGET': 'wagtail.wagtailadmin.rich_text.HalloRichTextArea'
     },
     'medium': {
         'WIDGET': 'wagtailmedium.rich_text.MediumRichTextArea',
         'OPTIONS': {
             'custom_buttons': {
                 'code': {
                   'contentDefault': '<b>Code</b>',
                   'contentFA': '<i class="fa fa-code"></i>',
                   'tag': 'code',
                   'className': 'code',  # optional
                 },
                 'test': {
                     'contentDefault': '<b>Test</b>',
                     'contentFA': '<i class="fa fa-code"></i>',
                     'tag': 'span',
                     'className': 'test',  # optional
                 },
             },
             'medium': {  # https://github.com/yabwe/medium-editor#options-example
                 # 'buttonLabels': 'fontawesome',
                 'toolbar': {
                     'buttons': [  # https://github.com/yabwe/medium-editor#all-buttons
                         'bold', 'italic', 'underline',
                         'code',
                         'test',
                         'link',
                         'linkdoc',
                         'h2', 'h3', 'orderedlist', 'unorderedlist', 'strikethrough'
                     ]
                 },
             },
         },
     },
 }
  1. Register whitelister element rules

This wagtail hook defines which HTML elements are allowed in rich text areas.

wagtail_hooks.py:

from wagtail.wagtailcore import hooks
from wagtail.wagtailcore.whitelist import attribute_rule, allow_without_attributes


# http://docs.wagtail.io/en/v1.7/reference/hooks.html#construct-whitelister-element-rules
@hooks.register('construct_whitelister_element_rules')  # #7bFcf#
def whitelister_element_rules():
    return {
        'u': allow_without_attributes,
        'span': attribute_rule({'class': True}),
        'code': allow_without_attributes,
        'blockquote': allow_without_attributes,
    }
  1. Use wagtailmedium in a RichTextField of your model

models.py:

from wagtail.wagtailcore.models import Page, StreamField, RichTextField

class HomePage(Page):
    # a default, Hallo editor
    hallo = RichTextField(blank=True)
    # a medium editor
    medium = RichTextField(editor='medium', blank=True)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].