mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Use snakecase for draftjs_exporter entities
Respect PEP8 convention for function names
This commit is contained in:
parent
2fe31ddd84
commit
7e0882f751
@ -12,7 +12,7 @@ from wagtail.admin.rich_text.converters.html_to_contentstate import HtmlToConten
|
||||
from wagtail.core.rich_text import features as feature_registry
|
||||
|
||||
|
||||
def Link(props):
|
||||
def link_entity(props):
|
||||
"""
|
||||
<a linktype="page" id="1">internal page link</a>
|
||||
"""
|
||||
|
@ -9,7 +9,7 @@ from wagtail.admin.menu import MenuItem, SubmenuMenuItem, settings_menu
|
||||
from wagtail.admin.navigation import get_explorable_root_page
|
||||
from wagtail.admin.rich_text import (
|
||||
HalloFormatPlugin, HalloHeadingPlugin, HalloListPlugin, HalloPlugin)
|
||||
from wagtail.admin.rich_text.converters.contentstate import Link
|
||||
from wagtail.admin.rich_text.converters.contentstate import link_entity
|
||||
from wagtail.admin.rich_text.converters.editor_html import LinkTypeRule, WhitelistRule
|
||||
from wagtail.admin.rich_text.converters.html_to_contentstate import (
|
||||
BlockElementHandler, ExternalLinkElementHandler, HorizontalRuleHandler, InlineStyleElementHandler,
|
||||
@ -409,6 +409,6 @@ def register_core_features(features):
|
||||
'a[linktype="page"]': PageLinkElementHandler('LINK'),
|
||||
},
|
||||
'to_database_format': {
|
||||
'entity_decorators': {ENTITY_TYPES.LINK: Link}
|
||||
'entity_decorators': {ENTITY_TYPES.LINK: link_entity}
|
||||
}
|
||||
})
|
||||
|
@ -42,7 +42,7 @@ EditorHTMLDocumentLinkConversionRule = [
|
||||
|
||||
# draft.js / contentstate conversion
|
||||
|
||||
def DocumentLinkEntity(props):
|
||||
def document_link_entity(props):
|
||||
"""
|
||||
Helper to construct elements of the form
|
||||
<a id="1" linktype="document">document link</a>
|
||||
@ -78,6 +78,6 @@ ContentstateDocumentLinkConversionRule = {
|
||||
'a[linktype="document"]': DocumentLinkElementHandler('DOCUMENT'),
|
||||
},
|
||||
'to_database_format': {
|
||||
'entity_decorators': {ENTITY_TYPES.DOCUMENT: DocumentLinkEntity}
|
||||
'entity_decorators': {ENTITY_TYPES.DOCUMENT: document_link_entity}
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ EditorHTMLEmbedConversionRule = [
|
||||
|
||||
# draft.js / contentstate conversion
|
||||
|
||||
def MediaEmbedEntity(props):
|
||||
def media_embed_entity(props):
|
||||
"""
|
||||
Helper to construct elements of the form
|
||||
<embed embedtype="media" url="https://www.youtube.com/watch?v=y8Kyi0WNg40"/>
|
||||
@ -96,6 +96,6 @@ ContentstateMediaConversionRule = {
|
||||
'embed[embedtype="media"]': MediaEmbedElementHandler(),
|
||||
},
|
||||
'to_database_format': {
|
||||
'entity_decorators': {ENTITY_TYPES.EMBED: MediaEmbedEntity}
|
||||
'entity_decorators': {ENTITY_TYPES.EMBED: media_embed_entity}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ EditorHTMLImageConversionRule = [
|
||||
|
||||
# draft.js / contentstate conversion
|
||||
|
||||
def ImageEntity(props):
|
||||
def image_entity(props):
|
||||
"""
|
||||
Helper to construct elements of the form
|
||||
<embed alt="Right-aligned image" embedtype="image" format="right" id="1"/>
|
||||
@ -133,6 +133,6 @@ ContentstateImageConversionRule = {
|
||||
'embed[embedtype="image"]': ImageElementHandler(),
|
||||
},
|
||||
'to_database_format': {
|
||||
'entity_decorators': {ENTITY_TYPES.IMAGE: ImageEntity}
|
||||
'entity_decorators': {ENTITY_TYPES.IMAGE: image_entity}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user