Skip to content

Commit

Permalink
Fix register_embed_type call in Wagtail <2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
juan0tron committed Feb 29, 2020
1 parent 5f16dc4 commit 1e04fbf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions wagtailmedia/wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext

from wagtail import VERSION as WAGTAIL_VERSION
from wagtail.admin.menu import MenuItem
from wagtail.admin.rich_text.editors.draftail import features as draftail_features
from wagtail.admin.search import SearchArea
Expand Down Expand Up @@ -110,14 +111,16 @@ def describe_collection_media(collection):

@hooks.register('register_rich_text_features')
def register_custom_media_feature(features):
# Register a handler for converting <embed type="customimage"> to frontend HTML
features.register_embed_type(MediaEmbedHandler)
# Register a handler for converting <embed type="customimage"> to frontend HTML
if WAGTAIL_VERSION < (2, 5):
features.register_embed_type(embed_type='media', handler=MediaEmbedHandler)
else:
features.register_embed_type(handler=MediaEmbedHandler)

feature_name = 'wagtailmedia'
type_ = 'MEDIA'

control = {
'type': type_,
'type': 'MEDIA',
'icon': 'media',
'description': 'Media',
}
Expand Down

0 comments on commit 1e04fbf

Please sign in to comment.