edwh-editorjs 2.4.0__tar.gz → 2.5.0a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {edwh_editorjs-2.4.0 → edwh_editorjs-2.5.0a1}/PKG-INFO +1 -1
- edwh_editorjs-2.5.0a1/editorjs/__about__.py +1 -0
- {edwh_editorjs-2.4.0 → edwh_editorjs-2.5.0a1}/editorjs/blocks.py +6 -6
- {edwh_editorjs-2.4.0 → edwh_editorjs-2.5.0a1}/editorjs/core.py +0 -1
- {edwh_editorjs-2.4.0 → edwh_editorjs-2.5.0a1}/tests/test_core.py +16 -0
- edwh_editorjs-2.4.0/editorjs/__about__.py +0 -1
- {edwh_editorjs-2.4.0 → edwh_editorjs-2.5.0a1}/.gitignore +0 -0
- {edwh_editorjs-2.4.0 → edwh_editorjs-2.5.0a1}/CHANGELOG.md +0 -0
- {edwh_editorjs-2.4.0 → edwh_editorjs-2.5.0a1}/README.md +0 -0
- {edwh_editorjs-2.4.0 → edwh_editorjs-2.5.0a1}/editorjs/__init__.py +0 -0
- {edwh_editorjs-2.4.0 → edwh_editorjs-2.5.0a1}/editorjs/exceptions.py +0 -0
- {edwh_editorjs-2.4.0 → edwh_editorjs-2.5.0a1}/editorjs/helpers.py +0 -0
- {edwh_editorjs-2.4.0 → edwh_editorjs-2.5.0a1}/editorjs/types.py +0 -0
- {edwh_editorjs-2.4.0 → edwh_editorjs-2.5.0a1}/pyproject.toml +0 -0
- {edwh_editorjs-2.4.0 → edwh_editorjs-2.5.0a1}/tests/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: edwh-editorjs
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0a1
|
|
4
4
|
Summary: EditorJS.py
|
|
5
5
|
Project-URL: Homepage, https://github.com/educationwarehouse/edwh-EditorJS
|
|
6
6
|
Author-email: SKevo <skevo.cw@gmail.com>, Robin van der Noord <robin.vdn@educationwarehouse.nl>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.5.0a1"
|
|
@@ -411,11 +411,8 @@ class ImageBlock(EditorJSBlock):
|
|
|
411
411
|
with_background = "1" if data.get("withBackground") else ""
|
|
412
412
|
stretched = "1" if data.get("stretched") else ""
|
|
413
413
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
return f"""<editorjs type="image" caption="{caption}" border="{with_border}" background="{with_background}" stretched="{stretched}" url="{url}" />\n\n"""
|
|
417
|
-
else:
|
|
418
|
-
return f"""\n\n"""
|
|
414
|
+
# always custom type so we can render as <figure> instead of markdown2's default (simple <img>)
|
|
415
|
+
return f"""<editorjs type="image" caption="{caption}" border="{with_border}" background="{with_background}" stretched="{stretched}" url="{url}" />\n\n"""
|
|
419
416
|
|
|
420
417
|
@classmethod
|
|
421
418
|
def _caption(cls, node: MDChildNode):
|
|
@@ -450,7 +447,10 @@ class ImageBlock(EditorJSBlock):
|
|
|
450
447
|
<div class="ce-block__content">
|
|
451
448
|
<div class="cdx-block image-tool image-tool--filled {background and 'image-tool--withBackground'} {stretched and 'image-tool--stretched'} {border and 'image-tool--withBorder'}">
|
|
452
449
|
<div class="image-tool__image">
|
|
453
|
-
<
|
|
450
|
+
<figure>
|
|
451
|
+
<img class="image-tool__image-picture" src="{url}" title="{caption}" alt="{caption}">
|
|
452
|
+
<figcaption>{caption}</figcaption>
|
|
453
|
+
</figure>
|
|
454
454
|
</div>
|
|
455
455
|
</div>
|
|
456
456
|
</div>
|
|
@@ -256,3 +256,19 @@ def test_image_options():
|
|
|
256
256
|
print(e.to_markdown())
|
|
257
257
|
print(e.to_html())
|
|
258
258
|
print(e.to_json())
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def test_figcaption():
|
|
262
|
+
# md = """"""
|
|
263
|
+
# e = EditorJS.from_markdown(md)
|
|
264
|
+
|
|
265
|
+
js = """{"time":1742471258492,"blocks":[{"id":"ZoA3rbc05C","type":"image","data":{"caption":"Party Time!","withBorder":false,"withBackground":false,"stretched":false,"file":{"url":"https://py4web.leiden.dockers.local/img/upload/23.png?hash=979795a433fc15cb94eccb3159f1f1e4054b1664"}}}],"version":"2.30.7"}"""
|
|
266
|
+
e = EditorJS.from_json(js)
|
|
267
|
+
|
|
268
|
+
html = e.to_html()
|
|
269
|
+
|
|
270
|
+
assert "figcaption" in html
|
|
271
|
+
|
|
272
|
+
print(
|
|
273
|
+
html
|
|
274
|
+
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.4.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|