Update to latest draftjs_exporter

See draftjs_exporter v2.0.0 release notes: https://github.com/springload/draftjs_exporter/releases/tag/v2.0.0
pull/4136/head
Loic Teixeira 2018-01-11 16:19:32 +10:00 zatwierdzone przez Thibaud Colas
rodzic 73ed313a9f
commit 2fe31ddd84
2 zmienionych plików z 10 dodań i 14 usunięć

Wyświetl plik

@ -26,7 +26,7 @@ install_requires = [
"django-taggit>=0.22.2,<1.0",
"django-treebeard>=4.2.0,<5.0",
"djangorestframework>=3.1.3,<4.0",
"draftjs_exporter>=1.0,<2.0",
"draftjs_exporter>=2.0,<2.1",
"Pillow>=2.6.1,<5.0",
"beautifulsoup4>=4.5.1,<5.0",
"html5lib>=0.999,<1",

Wyświetl plik

@ -28,18 +28,11 @@ def Link(props):
return DOM.create_element('a', link_props, props['children'])
class BR:
"""
Replace line breaks (\n) with br tags.
"""
SEARCH_RE = re.compile(r'\n')
def br(props):
if props['block']['type'] == BLOCK_TYPES.CODE:
return props['children']
def render(self, props):
# Do not process matches inside code blocks.
if props['block']['type'] == BLOCK_TYPES.CODE:
return props['children']
return DOM.create_element('br')
return DOM.create_element('br')
def BlockFallback(props):
@ -70,9 +63,12 @@ class ContentstateConverter():
ENTITY_TYPES.FALLBACK: EntityFallback,
},
'composite_decorators': [
BR,
{
'strategy': re.compile(r'\n'),
'component': br,
},
],
'engine': 'string',
'engine': DOM.STRING,
}
for feature in self.features: