edwh-editorjs 2.2.0__tar.gz → 2.2.2__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.2.0 → edwh_editorjs-2.2.2}/CHANGELOG.md +12 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/PKG-INFO +1 -1
- edwh_editorjs-2.2.2/editorjs/__about__.py +1 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/editorjs/blocks.py +3 -3
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/editorjs/core.py +5 -3
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/tests/test_core.py +33 -2
- edwh_editorjs-2.2.0/editorjs/__about__.py +0 -1
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/.github/workflows/build_documentation.yml +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/.github/workflows/publish_to_pypi.yml +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/.github/workflows/pytest.yml +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/.gitignore +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/README.md +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/editorjs/__init__.py +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/editorjs/exceptions.py +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/editorjs/helpers.py +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/editorjs/types.py +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/htmlcov/.gitignore +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/htmlcov/class_index.html +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/htmlcov/favicon_32_cb_58284776.png +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/htmlcov/function_index.html +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/htmlcov/index.html +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/htmlcov/keybd_closed_cb_ce680311.png +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/htmlcov/status.json +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/htmlcov/style_cb_8e611ae1.css +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/htmlcov/z_a93c8aeb4b8fa1f9___init___py.html +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/htmlcov/z_a93c8aeb4b8fa1f9_blocks_py.html +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/htmlcov/z_a93c8aeb4b8fa1f9_exceptions_py.html +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/htmlcov/z_a93c8aeb4b8fa1f9_parser_py.html +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/pyproject.toml +0 -0
- {edwh_editorjs-2.2.0 → edwh_editorjs-2.2.2}/tests/__init__.py +0 -0
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
<!--next-version-placeholder-->
|
|
4
4
|
|
|
5
|
+
## v2.2.2 (2024-11-26)
|
|
6
|
+
|
|
7
|
+
### Fix
|
|
8
|
+
|
|
9
|
+
* Support 'html' as alias for 'raw' block ([`4627f90`](https://github.com/educationwarehouse/edwh-editorjs/commit/4627f900a30bf6d6b202790958a78d4ef745ee11))
|
|
10
|
+
|
|
11
|
+
## v2.2.1 (2024-11-26)
|
|
12
|
+
|
|
13
|
+
### Fix
|
|
14
|
+
|
|
15
|
+
* Quick fix to prevent unlimited spaces being added by mdast ([`a196a22`](https://github.com/educationwarehouse/edwh-editorjs/commit/a196a221b623f7d4808aec64ef455197bdcfacaf))
|
|
16
|
+
|
|
5
17
|
## v2.2.0 (2024-11-26)
|
|
6
18
|
|
|
7
19
|
### Feature
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: edwh-editorjs
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.2
|
|
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.2.2"
|
|
@@ -470,7 +470,7 @@ class QuoteBlock(EditorJSBlock):
|
|
|
470
470
|
return default_to_text(node)
|
|
471
471
|
|
|
472
472
|
|
|
473
|
-
@block("raw")
|
|
473
|
+
@block("raw", "html")
|
|
474
474
|
class RawBlock(EditorJSBlock):
|
|
475
475
|
|
|
476
476
|
@classmethod
|
|
@@ -480,11 +480,11 @@ class RawBlock(EditorJSBlock):
|
|
|
480
480
|
|
|
481
481
|
@classmethod
|
|
482
482
|
def to_json(cls, node: MDChildNode) -> list[dict]:
|
|
483
|
-
|
|
483
|
+
return [raw_block(cls.to_text(node))]
|
|
484
484
|
|
|
485
485
|
@classmethod
|
|
486
486
|
def to_text(cls, node: MDChildNode) -> str:
|
|
487
|
-
|
|
487
|
+
return node.get("value", "")
|
|
488
488
|
|
|
489
489
|
|
|
490
490
|
@block("table")
|
|
@@ -41,7 +41,7 @@ class EditorJS:
|
|
|
41
41
|
for child in blocks:
|
|
42
42
|
_type = child["type"]
|
|
43
43
|
if not (block := BLOCKS.get(_type)):
|
|
44
|
-
raise TypeError(f"Unsupported block type `{_type}`")
|
|
44
|
+
raise TypeError(f"from_json: Unsupported block type `{_type}`")
|
|
45
45
|
|
|
46
46
|
data = child.get("data", {})
|
|
47
47
|
# forward any 'tunes' via data:
|
|
@@ -76,7 +76,7 @@ class EditorJS:
|
|
|
76
76
|
for child in self._mdast["children"]:
|
|
77
77
|
_type = child["type"]
|
|
78
78
|
if not (block := BLOCKS.get(_type)):
|
|
79
|
-
raise TypeError(f"Unsupported block type `{_type}`")
|
|
79
|
+
raise TypeError(f"to_json: Unsupported block type `{_type}`")
|
|
80
80
|
|
|
81
81
|
blocks.extend(block.to_json(child))
|
|
82
82
|
|
|
@@ -92,7 +92,9 @@ class EditorJS:
|
|
|
92
92
|
# idk why this happens:
|
|
93
93
|
md = md.replace(r"\[ ]", "[ ]")
|
|
94
94
|
md = md.replace(r"\[x]", "[x]")
|
|
95
|
-
return md
|
|
95
|
+
return md.replace(
|
|
96
|
+
" <", " <"
|
|
97
|
+
) # replace double space (added by mdast) with single one
|
|
96
98
|
|
|
97
99
|
def to_mdast(self) -> str:
|
|
98
100
|
"""
|
|
@@ -135,12 +135,43 @@ def test_raw_html():
|
|
|
135
135
|
e = EditorJS.from_json(raw_html_json)
|
|
136
136
|
blocks = json.loads(e.to_json())
|
|
137
137
|
|
|
138
|
-
print(blocks)
|
|
139
|
-
|
|
140
138
|
assert blocks["blocks"][0]["type"] == "paragraph", blocks["blocks"][0]["type"]
|
|
141
139
|
assert blocks["blocks"][1]["type"] == "raw", blocks["blocks"][1]["type"]
|
|
142
140
|
assert blocks["blocks"][2]["type"] == "paragraph", blocks["blocks"][2]["type"]
|
|
143
141
|
|
|
142
|
+
raw_html_json = r"""[{"id":"xGbqrb40Uz","type":"raw","data":{"html":"<marquee><kaas>mannetje</kaas></marquee>"}}]"""
|
|
143
|
+
|
|
144
|
+
e = EditorJS.from_json(raw_html_json)
|
|
145
|
+
|
|
146
|
+
print(e.to_mdast(), e.to_markdown())
|
|
147
|
+
e = EditorJS.from_markdown(e.to_markdown())
|
|
148
|
+
print(e.to_mdast(), e.to_markdown())
|
|
149
|
+
|
|
150
|
+
e = EditorJS.from_markdown(e.to_markdown())
|
|
151
|
+
e = EditorJS.from_markdown(e.to_markdown())
|
|
152
|
+
e = EditorJS.from_markdown(e.to_markdown())
|
|
153
|
+
e = EditorJS.from_markdown(e.to_markdown())
|
|
154
|
+
e = EditorJS.from_markdown(e.to_markdown())
|
|
155
|
+
|
|
156
|
+
print(e.to_markdown())
|
|
157
|
+
assert " " not in e.to_markdown(), "added too many whitespaces"
|
|
158
|
+
|
|
159
|
+
another_md = r"""<marquee> <kaas>mannetje </kaas> </marquee> <yep>pa
|
|
160
|
+
|
|
161
|
+
</yep>
|
|
162
|
+
|
|
163
|
+
sdafasdgasdgdsag
|
|
164
|
+
|
|
165
|
+
asdfsadfsdf dsfasdf
|
|
166
|
+
|
|
167
|
+
asdfsdajgdsjaklgkjds
|
|
168
|
+
"""
|
|
169
|
+
|
|
170
|
+
e = EditorJS.from_markdown(another_md)
|
|
171
|
+
print(e.to_markdown())
|
|
172
|
+
print(e.to_json())
|
|
173
|
+
assert e.to_json()
|
|
174
|
+
|
|
144
175
|
|
|
145
176
|
def test_code():
|
|
146
177
|
e = EditorJS.from_markdown(textwrap.dedent("""
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.2.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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|