Skip to content

Commit

Permalink
django-prose-editor 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Apr 9, 2024
1 parent 90cecb4 commit 33ca0c2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ Change log
Next version
~~~~~~~~~~~~


0.3 (2024-04-09)
~~~~~~~~~~~~~~~~

- Made the editor usable in dark mode.
- Changed the cancel buttons in dialogs to not validate the form.
- Switched the ``SanitizedProseEditorField`` from html-sanitizer (which at the
moment uses the problematic lxml HTML cleaner under the hood) with `nh3
<https://nh3.readthedocs.io/en/latest/>`__. html-sanitizer is still a good
choice but since we build on ProseMirror we only require a sanitizer, we
don't have to clean up strange HTML.
- Added customization options to the fields and widgets.


0.2 (2024-03-12)
Expand Down
27 changes: 23 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,26 @@ above.
Customization
~~~~~~~~~~~~~

It's not possible (yet), sorry. I plan to add some way of customizing the
editor schema so that it's easily possible to build an editor which supports an
even more restricted set of tags, for example only paragraps, bold and italic
for a teaser body.
It's possible to slightly customize the field or widget by passing an optional
``config`` dictionary. The default configuration is:

.. code-block:: python
config = {
"types": None, # Allow all nodes and marks
"history": True, # Enable undo and redo
"html": True, # Add a button which allows editing the raw HTML
}
If you only want to support paragraphs, strong, emphasis, sub- and superset and
no history or HTML editing you could add the following field:

.. code-block:: python
text = SanitizedProseEditorField(
config={"types": ["strong", "em", "sub", "sup"]},
)
Paragraphs cannot be removed at the moment. Note that the backend doesn't
sanitize the content to ensure that the HTML doesn't contain only the provided
tags, that's out of scope for now.
2 changes: 1 addition & 1 deletion django_prose_editor/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.2.1"
version = "0.3.0"

0 comments on commit 33ca0c2

Please sign in to comment.