Skip to content

Instantly share code, notes, and snippets.

View benoitvogel's full-sized avatar

Benoît Vogel benoitvogel

  • Mulhouse
View GitHub Profile
@benoitvogel
benoitvogel / wagtail_hooks.py
Created April 8, 2018 23:26
Add a button linked to a span with a class in Wagtail/Draftail
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
from wagtail.admin.rich_text.converters.html_to_contentstate import InlineStyleElementHandler
from wagtail.core import hooks
@hooks.register('register_rich_text_features')
def register_custom_style_feature(features):
feature_name = 'mycustomstyle' # .mycustomstyle will have to be defined in the CSS in order to get frontend styles working
type_ = feature_name.upper()
tag = 'span'