edwh-editorjs 2.0.0b5__tar.gz → 2.0.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.0.2/CHANGELOG.md +52 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/PKG-INFO +1 -3
- edwh_editorjs-2.0.2/editorjs/__about__.py +1 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/editorjs/blocks.py +20 -6
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/pyproject.toml +1 -1
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/tests/test_core.py +26 -0
- edwh_editorjs-2.0.0b5/CHANGELOG.md +0 -54
- edwh_editorjs-2.0.0b5/LICENSE +0 -22
- edwh_editorjs-2.0.0b5/editorjs/__about__.py +0 -1
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/.github/workflows/build_documentation.yml +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/.github/workflows/publish_to_pypi.yml +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/.github/workflows/pytest.yml +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/.gitignore +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/README.md +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/editorjs/__init__.py +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/editorjs/core.py +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/editorjs/exceptions.py +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/editorjs/helpers.py +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/editorjs/types.py +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/htmlcov/.gitignore +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/htmlcov/class_index.html +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/htmlcov/favicon_32_cb_58284776.png +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/htmlcov/function_index.html +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/htmlcov/index.html +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/htmlcov/keybd_closed_cb_ce680311.png +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/htmlcov/status.json +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/htmlcov/style_cb_8e611ae1.css +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/htmlcov/z_a93c8aeb4b8fa1f9___init___py.html +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/htmlcov/z_a93c8aeb4b8fa1f9_blocks_py.html +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/htmlcov/z_a93c8aeb4b8fa1f9_exceptions_py.html +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/htmlcov/z_a93c8aeb4b8fa1f9_parser_py.html +0 -0
- {edwh_editorjs-2.0.0b5 → edwh_editorjs-2.0.2}/tests/__init__.py +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
<!--next-version-placeholder-->
|
|
4
|
+
|
|
5
|
+
## v2.0.2 (2024-11-26)
|
|
6
|
+
|
|
7
|
+
### Fix
|
|
8
|
+
|
|
9
|
+
* Raw block pt2 ([`37ee6bc`](https://github.com/educationwarehouse/edwh-editorjs/commit/37ee6bc09dd8f54ca22f2652be1c5920d74779d1))
|
|
10
|
+
|
|
11
|
+
## v2.0.1 (2024-11-26)
|
|
12
|
+
|
|
13
|
+
### Fix
|
|
14
|
+
|
|
15
|
+
* Table block, raw html block ([`849aeee`](https://github.com/educationwarehouse/edwh-editorjs/commit/849aeee9fcafd51cb71416edeb127820ee3fc89f))
|
|
16
|
+
|
|
17
|
+
## v2.0.0 (2024-11-18)
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* Rebuilt the editor logic based on MDAST for improved extensibility and maintainability ([`28c12f1`](https://github.com/educationwarehouse/edwh-editorjs/commit/28c12f1f74c71a995f9f8097f1b26be45f835ad4))
|
|
22
|
+
* Added support for (basic) tables and custom Editor.js blocks, such as `linkTool` and `<editorjs>` ([`a6dfadf`](https://github.com/educationwarehouse/edwh-editorjs/commit/a6dfadf21ec008fe714704a056b9ffec751d731c))
|
|
23
|
+
* Integrated `markdown2` extras to handle custom `<editorjs>` blocks ([`31d8647`](https://github.com/educationwarehouse/edwh-editorjs/commit/31d8647b7275e245dabf27a99c43d400217705be))
|
|
24
|
+
|
|
25
|
+
### Fixes
|
|
26
|
+
|
|
27
|
+
* Corrected behavior for nested lists ([`52a7773`](https://github.com/educationwarehouse/edwh-editorjs/commit/52a7773470dce3eee6a2d17d46b594551ed043a5))
|
|
28
|
+
* Resolved an issue where rendered attachments were incorrectly marked as content-editable ([`58ab562`](https://github.com/educationwarehouse/edwh-editorjs/commit/58ab562daaca233455b3fe66b773af61f1abb0ad))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## v1.1.0 (2024-10-31)
|
|
32
|
+
|
|
33
|
+
### Feature
|
|
34
|
+
|
|
35
|
+
* Expose _sanitize via EditorJSBlock.sanitize for external usage ([`7daa67c`](https://github.com/educationwarehouse/edwh-editorjs/commit/7daa67c90440510c83b573c22edf377cc2fd801f))
|
|
36
|
+
|
|
37
|
+
### Documentation
|
|
38
|
+
|
|
39
|
+
* Added section on defining new custom blocks ([`51d7720`](https://github.com/educationwarehouse/edwh-editorjs/commit/51d77208d4f8156e895de914f41bdeb882a508c0))
|
|
40
|
+
|
|
41
|
+
## v1.0.1 (2024-10-31)
|
|
42
|
+
|
|
43
|
+
### Documentation
|
|
44
|
+
|
|
45
|
+
* Updated README ([`18d0216`](https://github.com/educationwarehouse/edwh-editorjs/commit/18d021629bcb223b89a9731e9ad8c574248f75c7))
|
|
46
|
+
|
|
47
|
+
## v1.0.0 (2024-10-31)
|
|
48
|
+
|
|
49
|
+
### Feature
|
|
50
|
+
|
|
51
|
+
* Implemented more blocks (raw, warning, code, table, quote) ([`fb93bd9`](https://github.com/educationwarehouse/edwh-editorjs/commit/fb93bd959f06fa86bc23c9bfc51a8b7fddfc65f2))
|
|
52
|
+
* Refactor to Registry Pattern so new block can be easily added ([`b06c86d`](https://github.com/educationwarehouse/edwh-editorjs/commit/b06c86da623dd2a2d92f7c48353a1f3208fb5749))
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: edwh-editorjs
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.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>
|
|
7
|
-
License: MIT
|
|
8
|
-
License-File: LICENSE
|
|
9
7
|
Keywords: bleach,clean,editor,editor.js,html,javascript,json,parser,wysiwyg
|
|
10
8
|
Classifier: Development Status :: 4 - Beta
|
|
11
9
|
Classifier: Intended Audience :: Developers
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.0.2"
|
|
@@ -130,6 +130,14 @@ class HeadingBlock(EditorJSBlock):
|
|
|
130
130
|
return child.get("value", "")
|
|
131
131
|
|
|
132
132
|
|
|
133
|
+
def paragraph_block(text: str):
|
|
134
|
+
return {"type": "paragraph", "data": {"text": text}}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def raw_block(html: str):
|
|
138
|
+
return {"type": "raw", "data": {"html": html}}
|
|
139
|
+
|
|
140
|
+
|
|
133
141
|
@block("paragraph")
|
|
134
142
|
class ParagraphBlock(EditorJSBlock):
|
|
135
143
|
@classmethod
|
|
@@ -144,6 +152,7 @@ class ParagraphBlock(EditorJSBlock):
|
|
|
144
152
|
|
|
145
153
|
skip = 0
|
|
146
154
|
nodes = node.get("children", [])
|
|
155
|
+
any_html = False
|
|
147
156
|
|
|
148
157
|
for idx, child in enumerate(nodes):
|
|
149
158
|
if skip:
|
|
@@ -151,6 +160,7 @@ class ParagraphBlock(EditorJSBlock):
|
|
|
151
160
|
continue
|
|
152
161
|
|
|
153
162
|
_type = child.get("type")
|
|
163
|
+
any_html |= _type == "html"
|
|
154
164
|
|
|
155
165
|
# deal with custom types
|
|
156
166
|
if _type == "html" and child.get("value", "").startswith("<editorjs"):
|
|
@@ -163,7 +173,7 @@ class ParagraphBlock(EditorJSBlock):
|
|
|
163
173
|
else:
|
|
164
174
|
# <editorjs>something</editorjs> = 3 children
|
|
165
175
|
result.extend(
|
|
166
|
-
EditorJSCustom.to_json({"children": nodes[idx
|
|
176
|
+
EditorJSCustom.to_json({"children": nodes[idx: idx + 2]})
|
|
167
177
|
)
|
|
168
178
|
|
|
169
179
|
skip = 2
|
|
@@ -171,8 +181,10 @@ class ParagraphBlock(EditorJSBlock):
|
|
|
171
181
|
|
|
172
182
|
elif _type == "image":
|
|
173
183
|
if current_text:
|
|
174
|
-
|
|
184
|
+
# {"id":"zksvpxQTDD","type":"raw","data":{"html":"<marquee> raw </marquee>"}}
|
|
185
|
+
result.append(raw_block(current_text) if any_html else paragraph_block(current_text))
|
|
175
186
|
current_text = ""
|
|
187
|
+
any_html = False # reset
|
|
176
188
|
|
|
177
189
|
result.extend(ImageBlock.to_json(child))
|
|
178
190
|
else:
|
|
@@ -191,7 +203,7 @@ class ParagraphBlock(EditorJSBlock):
|
|
|
191
203
|
|
|
192
204
|
# final text after image:
|
|
193
205
|
if current_text:
|
|
194
|
-
result.append(
|
|
206
|
+
result.append(raw_block(current_text) if any_html else paragraph_block(current_text))
|
|
195
207
|
|
|
196
208
|
return result
|
|
197
209
|
|
|
@@ -493,8 +505,10 @@ class TableBlock(EditorJSBlock):
|
|
|
493
505
|
return [
|
|
494
506
|
{
|
|
495
507
|
"type": "table",
|
|
496
|
-
"
|
|
497
|
-
|
|
508
|
+
"data": {
|
|
509
|
+
"content": table,
|
|
510
|
+
"withHeadings": with_headings,
|
|
511
|
+
}
|
|
498
512
|
}
|
|
499
513
|
]
|
|
500
514
|
|
|
@@ -585,7 +599,7 @@ class AttachmentBlock(EditorJSBlock):
|
|
|
585
599
|
</div>
|
|
586
600
|
</div>
|
|
587
601
|
<div class="cdx-attaches__file-info">
|
|
588
|
-
<div class="cdx-attaches__title"
|
|
602
|
+
<div class="cdx-attaches__title" data-placeholder="File title" data-empty="false">
|
|
589
603
|
{node.get("body", "")}
|
|
590
604
|
</div>
|
|
591
605
|
</div>
|
|
@@ -12,7 +12,7 @@ authors = [
|
|
|
12
12
|
{ name = "SKevo", email = "skevo.cw@gmail.com" },
|
|
13
13
|
{ name = "Robin van der Noord", email = "robin.vdn@educationwarehouse.nl" },
|
|
14
14
|
]
|
|
15
|
-
license = { text = "MIT" }
|
|
15
|
+
license-expression = { text = "MIT" }
|
|
16
16
|
keywords = ["editor.js", "parser", "clean", "bleach", "wysiwyg", "editor", "javascript", "html", "json"]
|
|
17
17
|
classifiers = [
|
|
18
18
|
"Development Status :: 4 - Beta",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import textwrap
|
|
2
3
|
|
|
3
4
|
from editorjs import EditorJS
|
|
@@ -110,3 +111,28 @@ def test_attachment():
|
|
|
110
111
|
print(e.to_markdown())
|
|
111
112
|
print(e.to_json())
|
|
112
113
|
print(e.to_html())
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def test_raw_html():
|
|
117
|
+
e = EditorJS.from_markdown(textwrap.dedent("""
|
|
118
|
+
# Raw HTML
|
|
119
|
+
|
|
120
|
+
<marquee>This ain't no paragraph</marquee>
|
|
121
|
+
"""))
|
|
122
|
+
|
|
123
|
+
blocks = json.loads(e.to_json())
|
|
124
|
+
|
|
125
|
+
assert blocks["blocks"][1]["type"] == "raw", blocks["blocks"][1]["type"]
|
|
126
|
+
|
|
127
|
+
def test_code():
|
|
128
|
+
e = EditorJS.from_markdown(textwrap.dedent("""
|
|
129
|
+
Read code:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
<marquee> code </marquee>
|
|
133
|
+
```
|
|
134
|
+
"""))
|
|
135
|
+
|
|
136
|
+
blocks = json.loads(e.to_json())
|
|
137
|
+
|
|
138
|
+
print(blocks)
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
<!--next-version-placeholder-->
|
|
4
|
-
|
|
5
|
-
## v2.0.0-beta.5 (2024-11-07)
|
|
6
|
-
|
|
7
|
-
### Feature
|
|
8
|
-
|
|
9
|
-
* Add markdown2 extra to deal with custom `<editorjs />` blocks ([`31d8647`](https://github.com/educationwarehouse/edwh-editorjs/commit/31d8647b7275e245dabf27a99c43d400217705be))
|
|
10
|
-
|
|
11
|
-
## v2.0.0-beta.4 (2024-11-07)
|
|
12
|
-
|
|
13
|
-
### Feature
|
|
14
|
-
|
|
15
|
-
* Support (basic) tables, custom editorjs blocks like linkTool via <editorjs> ([`a6dfadf`](https://github.com/educationwarehouse/edwh-editorjs/commit/a6dfadf21ec008fe714704a056b9ffec751d731c))
|
|
16
|
-
|
|
17
|
-
## v2.0.0-beta.3 (2024-11-06)
|
|
18
|
-
|
|
19
|
-
### Fix
|
|
20
|
-
|
|
21
|
-
* Various fixes with nested lists ([`52a7773`](https://github.com/educationwarehouse/edwh-editorjs/commit/52a7773470dce3eee6a2d17d46b594551ed043a5))
|
|
22
|
-
|
|
23
|
-
## v2.0.0-beta.2 (2024-11-06)
|
|
24
|
-
|
|
25
|
-
### Feature
|
|
26
|
-
|
|
27
|
-
* Work in progress to do a rebuild based on mdast ([`28c12f1`](https://github.com/educationwarehouse/edwh-editorjs/commit/28c12f1f74c71a995f9f8097f1b26be45f835ad4))
|
|
28
|
-
|
|
29
|
-
## v2.0.0-beta.1 (2024-11-06)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## v1.1.0 (2024-10-31)
|
|
34
|
-
|
|
35
|
-
### Feature
|
|
36
|
-
|
|
37
|
-
* Expose _sanitize via EditorJSBlock.sanitize for external usage ([`7daa67c`](https://github.com/educationwarehouse/edwh-editorjs/commit/7daa67c90440510c83b573c22edf377cc2fd801f))
|
|
38
|
-
|
|
39
|
-
### Documentation
|
|
40
|
-
|
|
41
|
-
* Added section on defining new custom blocks ([`51d7720`](https://github.com/educationwarehouse/edwh-editorjs/commit/51d77208d4f8156e895de914f41bdeb882a508c0))
|
|
42
|
-
|
|
43
|
-
## v1.0.1 (2024-10-31)
|
|
44
|
-
|
|
45
|
-
### Documentation
|
|
46
|
-
|
|
47
|
-
* Updated README ([`18d0216`](https://github.com/educationwarehouse/edwh-editorjs/commit/18d021629bcb223b89a9731e9ad8c574248f75c7))
|
|
48
|
-
|
|
49
|
-
## v1.0.0 (2024-10-31)
|
|
50
|
-
|
|
51
|
-
### Feature
|
|
52
|
-
|
|
53
|
-
* Implemented more blocks (raw, warning, code, table, quote) ([`fb93bd9`](https://github.com/educationwarehouse/edwh-editorjs/commit/fb93bd959f06fa86bc23c9bfc51a8b7fddfc65f2))
|
|
54
|
-
* Refactor to Registry Pattern so new block can be easily added ([`b06c86d`](https://github.com/educationwarehouse/edwh-editorjs/commit/b06c86da623dd2a2d92f7c48353a1f3208fb5749))
|
edwh_editorjs-2.0.0b5/LICENSE
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 SKevo
|
|
4
|
-
Copyright (c) 2024 Education Warehouse
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.0.0-beta.5"
|
|
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
|