edwh-editorjs 2.0.0b5__py3-none-any.whl → 2.0.1__py3-none-any.whl

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.
editorjs/__about__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.0.0-beta.5"
1
+ __version__ = "2.0.1"
editorjs/blocks.py CHANGED
@@ -144,6 +144,7 @@ class ParagraphBlock(EditorJSBlock):
144
144
 
145
145
  skip = 0
146
146
  nodes = node.get("children", [])
147
+ any_html = False
147
148
 
148
149
  for idx, child in enumerate(nodes):
149
150
  if skip:
@@ -151,6 +152,7 @@ class ParagraphBlock(EditorJSBlock):
151
152
  continue
152
153
 
153
154
  _type = child.get("type")
155
+ any_html |= _type == "html"
154
156
 
155
157
  # deal with custom types
156
158
  if _type == "html" and child.get("value", "").startswith("<editorjs"):
@@ -163,7 +165,7 @@ class ParagraphBlock(EditorJSBlock):
163
165
  else:
164
166
  # <editorjs>something</editorjs> = 3 children
165
167
  result.extend(
166
- EditorJSCustom.to_json({"children": nodes[idx : idx + 2]})
168
+ EditorJSCustom.to_json({"children": nodes[idx: idx + 2]})
167
169
  )
168
170
 
169
171
  skip = 2
@@ -171,8 +173,9 @@ class ParagraphBlock(EditorJSBlock):
171
173
 
172
174
  elif _type == "image":
173
175
  if current_text:
174
- result.append({"data": {"text": current_text}, "type": "paragraph"})
176
+ result.append({"data": {"text": current_text}, "type": "raw" if any_html else "paragraph"})
175
177
  current_text = ""
178
+ any_html = False # reset
176
179
 
177
180
  result.extend(ImageBlock.to_json(child))
178
181
  else:
@@ -191,7 +194,7 @@ class ParagraphBlock(EditorJSBlock):
191
194
 
192
195
  # final text after image:
193
196
  if current_text:
194
- result.append({"data": {"text": current_text}, "type": "paragraph"})
197
+ result.append({"data": {"text": current_text}, "type": "raw" if any_html else "paragraph"})
195
198
 
196
199
  return result
197
200
 
@@ -493,8 +496,10 @@ class TableBlock(EditorJSBlock):
493
496
  return [
494
497
  {
495
498
  "type": "table",
496
- "content": table,
497
- "withHeadings": with_headings,
499
+ "data": {
500
+ "content": table,
501
+ "withHeadings": with_headings,
502
+ }
498
503
  }
499
504
  ]
500
505
 
@@ -585,7 +590,7 @@ class AttachmentBlock(EditorJSBlock):
585
590
  </div>
586
591
  </div>
587
592
  <div class="cdx-attaches__file-info">
588
- <div class="cdx-attaches__title" contenteditable="true" data-placeholder="File title" data-empty="false">
593
+ <div class="cdx-attaches__title" data-placeholder="File title" data-empty="false">
589
594
  {node.get("body", "")}
590
595
  </div>
591
596
  </div>
@@ -1,11 +1,9 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: edwh-editorjs
3
- Version: 2.0.0b5
3
+ Version: 2.0.1
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,10 @@
1
+ editorjs/__about__.py,sha256=wAxkK8w13vqoF47A8iqWdSlIgRRXmZiQ0R4wePZfzhs,22
2
+ editorjs/__init__.py,sha256=-OHUf7ZXfkbdFB1r85eIjpHRfql-GCNUCKuBEdEt2Rc,58
3
+ editorjs/blocks.py,sha256=QBHiAck6lX6454XhixRuWWzzsYEcMWTUGlxHzG1B8gM,21871
4
+ editorjs/core.py,sha256=CdZnprX-vkjFJATxPfG1acDqGKkHa3mDfbMEeXiR6eI,3331
5
+ editorjs/exceptions.py,sha256=TyfHvk2Z5RbKxTDK7lrjgwAgVgInXIuDW63eO5jzVFw,106
6
+ editorjs/helpers.py,sha256=q861o5liNibMTp-Ozay17taF7CTNsRe901lYhhxdwHg,73
7
+ editorjs/types.py,sha256=W7IZWMWgzJaQulybIt0Gx5N63rVj4mEy73VJWo4VAQA,1029
8
+ edwh_editorjs-2.0.1.dist-info/METADATA,sha256=ojEg0-0U-zubbzWHmU6raAtHdgwSWNWFSvyrNHk2iy8,972
9
+ edwh_editorjs-2.0.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
10
+ edwh_editorjs-2.0.1.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- editorjs/__about__.py,sha256=iiD2kTPXmXAM5kRpno4Whrabsdag8WZSPimzcYKughY,29
2
- editorjs/__init__.py,sha256=-OHUf7ZXfkbdFB1r85eIjpHRfql-GCNUCKuBEdEt2Rc,58
3
- editorjs/blocks.py,sha256=RJw1uxROQOw_dRwHnwPFD2gFcXCZnlCUw55iulh8-70,21687
4
- editorjs/core.py,sha256=CdZnprX-vkjFJATxPfG1acDqGKkHa3mDfbMEeXiR6eI,3331
5
- editorjs/exceptions.py,sha256=TyfHvk2Z5RbKxTDK7lrjgwAgVgInXIuDW63eO5jzVFw,106
6
- editorjs/helpers.py,sha256=q861o5liNibMTp-Ozay17taF7CTNsRe901lYhhxdwHg,73
7
- editorjs/types.py,sha256=W7IZWMWgzJaQulybIt0Gx5N63rVj4mEy73VJWo4VAQA,1029
8
- edwh_editorjs-2.0.0b5.dist-info/METADATA,sha256=qjO0kFBb6OYFksbsWyZP7NOTJB8GraJI2L3GUmPPyrM,1009
9
- edwh_editorjs-2.0.0b5.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
10
- edwh_editorjs-2.0.0b5.dist-info/licenses/LICENSE,sha256=zzllbk0pvnmgzk31iq8Zkg0GkA8vVx_Zc3OHjVlTjxo,1101
11
- edwh_editorjs-2.0.0b5.dist-info/RECORD,,
@@ -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.