bd-editor 0.1.0__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.
- bd_editor-0.1.0/Agents.md +87 -0
- bd_editor-0.1.0/LICENSE +21 -0
- bd_editor-0.1.0/MANIFEST.in +13 -0
- bd_editor-0.1.0/PKG-INFO +101 -0
- bd_editor-0.1.0/Progress.md +68 -0
- bd_editor-0.1.0/README.md +58 -0
- bd_editor-0.1.0/bd_editor/__init__.py +5 -0
- bd_editor-0.1.0/bd_editor/apps.py +12 -0
- bd_editor-0.1.0/bd_editor/conf.py +468 -0
- bd_editor-0.1.0/bd_editor/embeds.py +61 -0
- bd_editor-0.1.0/bd_editor/fields.py +55 -0
- bd_editor-0.1.0/bd_editor/forms.py +23 -0
- bd_editor-0.1.0/bd_editor/locale/en/LC_MESSAGES/django.mo +0 -0
- bd_editor-0.1.0/bd_editor/locale/en/LC_MESSAGES/django.po +6 -0
- bd_editor-0.1.0/bd_editor/locale/en.json +91 -0
- bd_editor-0.1.0/bd_editor/locale/tr/LC_MESSAGES/django.mo +0 -0
- bd_editor-0.1.0/bd_editor/locale/tr/LC_MESSAGES/django.po +71 -0
- bd_editor-0.1.0/bd_editor/locale/tr.json +91 -0
- bd_editor-0.1.0/bd_editor/sanitizer.py +131 -0
- bd_editor-0.1.0/bd_editor/static/bd_editor/THIRD_PARTY_NOTICES.txt +1143 -0
- bd_editor-0.1.0/bd_editor/static/bd_editor/editor.css +738 -0
- bd_editor-0.1.0/bd_editor/static/bd_editor/editor.js +566 -0
- bd_editor-0.1.0/bd_editor/templates/bd_editor/widget.html +122 -0
- bd_editor-0.1.0/bd_editor/templatetags/__init__.py +0 -0
- bd_editor-0.1.0/bd_editor/templatetags/bd_editor_tags.py +24 -0
- bd_editor-0.1.0/bd_editor/uploads.py +114 -0
- bd_editor-0.1.0/bd_editor/urls.py +7 -0
- bd_editor-0.1.0/bd_editor/views.py +155 -0
- bd_editor-0.1.0/bd_editor/widgets.py +55 -0
- bd_editor-0.1.0/bd_editor.egg-info/PKG-INFO +101 -0
- bd_editor-0.1.0/bd_editor.egg-info/SOURCES.txt +81 -0
- bd_editor-0.1.0/bd_editor.egg-info/dependency_links.txt +1 -0
- bd_editor-0.1.0/bd_editor.egg-info/requires.txt +19 -0
- bd_editor-0.1.0/bd_editor.egg-info/top_level.txt +1 -0
- bd_editor-0.1.0/demo/README.md +40 -0
- bd_editor-0.1.0/demo/README.tr.md +40 -0
- bd_editor-0.1.0/demo/blog_a/__init__.py +0 -0
- bd_editor-0.1.0/demo/blog_a/admin.py +9 -0
- bd_editor-0.1.0/demo/blog_a/apps.py +7 -0
- bd_editor-0.1.0/demo/blog_a/migrations/0001_initial.py +27 -0
- bd_editor-0.1.0/demo/blog_a/migrations/__init__.py +0 -0
- bd_editor-0.1.0/demo/blog_a/models.py +15 -0
- bd_editor-0.1.0/demo/blog_b/__init__.py +0 -0
- bd_editor-0.1.0/demo/blog_b/admin.py +9 -0
- bd_editor-0.1.0/demo/blog_b/apps.py +7 -0
- bd_editor-0.1.0/demo/blog_b/migrations/0001_initial.py +27 -0
- bd_editor-0.1.0/demo/blog_b/migrations/__init__.py +0 -0
- bd_editor-0.1.0/demo/blog_b/models.py +15 -0
- bd_editor-0.1.0/demo/demo_project/__init__.py +0 -0
- bd_editor-0.1.0/demo/demo_project/asgi.py +6 -0
- bd_editor-0.1.0/demo/demo_project/settings.py +135 -0
- bd_editor-0.1.0/demo/demo_project/urls.py +17 -0
- bd_editor-0.1.0/demo/demo_project/views.py +112 -0
- bd_editor-0.1.0/demo/demo_project/wsgi.py +6 -0
- bd_editor-0.1.0/demo/locale/en/LC_MESSAGES/django.mo +0 -0
- bd_editor-0.1.0/demo/locale/en/LC_MESSAGES/django.po +6 -0
- bd_editor-0.1.0/demo/locale/tr/LC_MESSAGES/django.mo +0 -0
- bd_editor-0.1.0/demo/locale/tr/LC_MESSAGES/django.po +97 -0
- bd_editor-0.1.0/demo/manage.py +14 -0
- bd_editor-0.1.0/demo/static/demo/demo.css +462 -0
- bd_editor-0.1.0/demo/templates/demo/article_detail.html +18 -0
- bd_editor-0.1.0/demo/templates/demo/base.html +42 -0
- bd_editor-0.1.0/demo/templates/demo/home.html +79 -0
- bd_editor-0.1.0/docs/en/api.md +78 -0
- bd_editor-0.1.0/docs/en/configuration.md +173 -0
- bd_editor-0.1.0/docs/en/quickstart.md +188 -0
- bd_editor-0.1.0/docs/en/security.md +93 -0
- bd_editor-0.1.0/docs/tr/api.md +75 -0
- bd_editor-0.1.0/docs/tr/configuration.md +163 -0
- bd_editor-0.1.0/docs/tr/quickstart.md +176 -0
- bd_editor-0.1.0/docs/tr/security.md +91 -0
- bd_editor-0.1.0/frontend/README.md +18 -0
- bd_editor-0.1.0/frontend/package-lock.json +1107 -0
- bd_editor-0.1.0/frontend/package.json +25 -0
- bd_editor-0.1.0/frontend/src/editor.js +1340 -0
- bd_editor-0.1.0/pyproject.toml +73 -0
- bd_editor-0.1.0/scripts/compile_translations.py +19 -0
- bd_editor-0.1.0/scripts/generate_third_party_notices.py +45 -0
- bd_editor-0.1.0/setup.cfg +4 -0
- bd_editor-0.1.0/tests/test_admin.py +22 -0
- bd_editor-0.1.0/tests/test_core.py +287 -0
- bd_editor-0.1.0/tests/test_demo_settings.py +60 -0
- bd_editor-0.1.0/tests/test_uploads.py +292 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Agent and contributor guide
|
|
2
|
+
|
|
3
|
+
## Project boundaries
|
|
4
|
+
|
|
5
|
+
BD-Editor is an installable Django application, distributed as `bd-editor` and
|
|
6
|
+
imported as `bd_editor`. Keep runtime Python dependencies small. Browser assets
|
|
7
|
+
must be bundled with the package; do not load scripts or styles from a CDN.
|
|
8
|
+
Package metadata and build configuration live in `pyproject.toml`; the
|
|
9
|
+
public-facing overview is `README.md`.
|
|
10
|
+
|
|
11
|
+
## Important modules
|
|
12
|
+
|
|
13
|
+
- `bd_editor/conf.py` validates built-in, global, and per-app settings.
|
|
14
|
+
- `bd_editor/sanitizer.py` owns HTML cleaning and plain-text helpers.
|
|
15
|
+
- `bd_editor/fields.py` applies sanitization to the Django model field.
|
|
16
|
+
- `bd_editor/uploads.py` contains the optional Pillow image pipeline.
|
|
17
|
+
- `bd_editor/locale/` stores editor JSON labels and Django message catalogs.
|
|
18
|
+
- `frontend/src/editor.js` is the Tiptap-based browser editor source. Build its
|
|
19
|
+
local static bundle before packaging.
|
|
20
|
+
- Keep document typography and color styles scoped to the editor content
|
|
21
|
+
surface, separate from Django admin styles.
|
|
22
|
+
- `bd_editor/static/bd_editor/THIRD_PARTY_NOTICES.txt` includes bundled
|
|
23
|
+
frontend component licenses.
|
|
24
|
+
- The public two-app demo lives under `demo/`; its localized article index,
|
|
25
|
+
configuration descriptions, and Django catalogs are source-distribution
|
|
26
|
+
content, not runtime package dependencies.
|
|
27
|
+
|
|
28
|
+
## Security invariants
|
|
29
|
+
|
|
30
|
+
- Treat editor input, pasted HTML, URLs, uploaded files, and settings as
|
|
31
|
+
untrusted.
|
|
32
|
+
- Enforce the HTML allowlist on the server with the selected `nh3` sanitizer.
|
|
33
|
+
Never allow `script` elements,
|
|
34
|
+
inline event handlers, executable URL schemes, arbitrary iframes, or video
|
|
35
|
+
uploads.
|
|
36
|
+
- Embeds must be normalized for explicitly supported providers. Do not accept
|
|
37
|
+
arbitrary iframe hosts or user-provided iframe permissions.
|
|
38
|
+
- Restrict CSS to a safe property allowlist; never allow CSS capable of loading
|
|
39
|
+
remote resources.
|
|
40
|
+
- Validate images by their decoded content, size, and pixel dimensions. Use
|
|
41
|
+
generated storage names rather than client-supplied paths.
|
|
42
|
+
- Optional editor drafts are stored only in browser localStorage and must stay
|
|
43
|
+
opt-in with a documented expiration and shared-browser privacy warning.
|
|
44
|
+
- Persist the demo's development `SECRET_KEY` in its gitignored key file so
|
|
45
|
+
autoreloads preserve sessions. Production mode must require an explicit
|
|
46
|
+
`DJANGO_SECRET_KEY`.
|
|
47
|
+
- Protect image uploads with CSRF, an active staff check, and add/change
|
|
48
|
+
permission for the associated model.
|
|
49
|
+
- Only mark sanitized output safe in the dedicated template integration.
|
|
50
|
+
Document that raw SQL and direct database writes bypass Django field
|
|
51
|
+
validation.
|
|
52
|
+
- Invalid security-sensitive configuration must raise a clear error; do not
|
|
53
|
+
silently widen an allowlist or fall back to unsafe output.
|
|
54
|
+
|
|
55
|
+
## Development workflow
|
|
56
|
+
|
|
57
|
+
- Python package metadata is in `pyproject.toml`; Django code lives in
|
|
58
|
+
`bd_editor/`.
|
|
59
|
+
- Frontend source and its lockfile live in `frontend/`; generated, locally
|
|
60
|
+
bundled assets belong under `bd_editor/static/bd_editor/`.
|
|
61
|
+
- Run focused tests with `python -m pytest`.
|
|
62
|
+
- The current compatibility matrix covers Django 5.2, 6.0, and 6.1 on valid
|
|
63
|
+
Python versions; do not test unsupported Python/Django pairs.
|
|
64
|
+
- Build and inspect distributions with `python -m build` and
|
|
65
|
+
`python -m twine check dist/*`.
|
|
66
|
+
- Build frontend assets with `npm --prefix frontend run build`.
|
|
67
|
+
- Regenerate bundled license notices with
|
|
68
|
+
`python scripts/generate_third_party_notices.py` after changing frontend
|
|
69
|
+
dependencies.
|
|
70
|
+
- Compile Django message catalogs with `python scripts/compile_translations.py`.
|
|
71
|
+
- Demo UI templates and localized catalogs live under `demo/templates/` and
|
|
72
|
+
`demo/locale/`; the catalog compiler handles both demo and package messages.
|
|
73
|
+
- Keep compatibility tests limited to valid Django/Python combinations.
|
|
74
|
+
- Add English comments for non-obvious security and integration decisions, not
|
|
75
|
+
for routine code.
|
|
76
|
+
- After each meaningful implementation milestone, update both `Agents.md` and
|
|
77
|
+
`Progress.md` before moving to the next milestone.
|
|
78
|
+
|
|
79
|
+
## Release checklist
|
|
80
|
+
|
|
81
|
+
- Run tests and linting, build frontend assets, build wheel and sdist, inspect
|
|
82
|
+
bundled static files, and verify package metadata.
|
|
83
|
+
- Compile locale catalogs and regenerate third-party license notices after
|
|
84
|
+
changing translations or frontend dependencies.
|
|
85
|
+
- Retain notices for all bundled third-party assets and confirm the selected
|
|
86
|
+
packages' licenses before upgrading them.
|
|
87
|
+
- Do not publish a release or upload credentials as part of local validation.
|
bd_editor-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BD-Editor contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
include Agents.md
|
|
2
|
+
include LICENSE
|
|
3
|
+
include Progress.md
|
|
4
|
+
include README.md
|
|
5
|
+
include pyproject.toml
|
|
6
|
+
recursive-include bd_editor *.css *.html *.js *.json *.mo *.po *.py *.txt
|
|
7
|
+
recursive-include demo *.md *.py *.html *.css *.po *.mo
|
|
8
|
+
recursive-include docs *.md
|
|
9
|
+
recursive-include frontend *.js *.json *.md
|
|
10
|
+
recursive-include scripts *.py
|
|
11
|
+
prune frontend/node_modules
|
|
12
|
+
prune frontend/dist
|
|
13
|
+
global-exclude __pycache__ *.py[cod] *.db *.sqlite3
|
bd_editor-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bd-editor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A secure, configurable rich-text editor for Django admin and forms.
|
|
5
|
+
Author: BD-Editor contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: django,editor,rich-text,admin,sanitization
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Web Environment
|
|
10
|
+
Classifier: Framework :: Django
|
|
11
|
+
Classifier: Framework :: Django :: 5.2
|
|
12
|
+
Classifier: Framework :: Django :: 6.0
|
|
13
|
+
Classifier: Framework :: Django :: 6.1
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
23
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: Django<6.2,>=5.2
|
|
28
|
+
Requires-Dist: nh3>=0.2.18
|
|
29
|
+
Provides-Extra: images
|
|
30
|
+
Requires-Dist: Pillow>=10.4; extra == "images"
|
|
31
|
+
Provides-Extra: test
|
|
32
|
+
Requires-Dist: build>=1.2; extra == "test"
|
|
33
|
+
Requires-Dist: Pillow>=10.4; extra == "test"
|
|
34
|
+
Requires-Dist: polib>=1.2; extra == "test"
|
|
35
|
+
Requires-Dist: pytest>=8.3; extra == "test"
|
|
36
|
+
Requires-Dist: pytest-django>=4.10; extra == "test"
|
|
37
|
+
Requires-Dist: twine>=6.0; extra == "test"
|
|
38
|
+
Provides-Extra: i18n
|
|
39
|
+
Requires-Dist: polib>=1.2; extra == "i18n"
|
|
40
|
+
Provides-Extra: lint
|
|
41
|
+
Requires-Dist: ruff>=0.9; extra == "lint"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# BD-Editor
|
|
45
|
+
|
|
46
|
+
BD-Editor is a configurable rich-text editor for Django admin and forms. It
|
|
47
|
+
provides a bundled editor UI, server-side HTML sanitization, per-app toolbar
|
|
48
|
+
settings and toolbar presets, editable HTML tables, optional browser drafts,
|
|
49
|
+
modal link/image editing, text and highlight color palettes, image format and
|
|
50
|
+
quality selection, and allowlisted video embeds.
|
|
51
|
+
|
|
52
|
+
The PyPI distribution is named `bd-editor`; import it as `bd_editor`.
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```shell
|
|
57
|
+
pip install bd-editor
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
For image upload and conversion support:
|
|
61
|
+
|
|
62
|
+
```shell
|
|
63
|
+
pip install "bd-editor[images]"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Quick start
|
|
67
|
+
|
|
68
|
+
1. Add `bd_editor` to `INSTALLED_APPS`.
|
|
69
|
+
2. Add `path("bd-editor/", include("bd_editor.urls"))` to the root URLconf.
|
|
70
|
+
3. Use `bd_editor.fields.RichTextField` on a model. Django admin and
|
|
71
|
+
`ModelForm` will use the bundled editor widget automatically.
|
|
72
|
+
4. Configure global and app-specific editor behavior in `BD_EDITOR`.
|
|
73
|
+
|
|
74
|
+
See [the documentation](docs/en/quickstart.md) for a runnable example,
|
|
75
|
+
configuration reference, localization, and security model. A two-app example
|
|
76
|
+
project with localized article listings and live configuration explanations
|
|
77
|
+
is in [demo/](demo/).
|
|
78
|
+
|
|
79
|
+
## Security boundary
|
|
80
|
+
|
|
81
|
+
The editing interface uses JavaScript, but submitted content is sanitized on
|
|
82
|
+
the server and does not permit executable scripts, inline event handlers,
|
|
83
|
+
unsafe URL schemes, or arbitrary iframes. Script-like examples entered in code
|
|
84
|
+
blocks are escaped text. Images are validated from their decoded content;
|
|
85
|
+
video uploads are rejected. Image uploads require CSRF protection and a staff
|
|
86
|
+
user with add/change permission for the associated model.
|
|
87
|
+
|
|
88
|
+
No Django library can intercept direct SQL or writes made outside Django's
|
|
89
|
+
validated ORM paths. Applications must still render through BD-Editor's
|
|
90
|
+
sanitizing template integration and must not mark untrusted values safe
|
|
91
|
+
themselves. See [the security guide](docs/en/security.md).
|
|
92
|
+
|
|
93
|
+
## Development status
|
|
94
|
+
|
|
95
|
+
The project is under active development. See [Progress.md](Progress.md) for
|
|
96
|
+
milestones and [Agents.md](Agents.md) for development and security invariants.
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
BD-Editor is released under the MIT license. Bundled third-party components
|
|
101
|
+
retain their own copyright and license notices.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# BD-Editor progress
|
|
2
|
+
|
|
3
|
+
## Current status
|
|
4
|
+
|
|
5
|
+
- Milestone 1: complete.
|
|
6
|
+
- Milestone 2: complete.
|
|
7
|
+
- Milestone 3: complete.
|
|
8
|
+
- Milestone 4: complete.
|
|
9
|
+
- Milestone 5: complete.
|
|
10
|
+
- Milestone 6: complete.
|
|
11
|
+
- Follow-up admin and demo UX changes: complete.
|
|
12
|
+
- Demo autoreload session-key fix: complete.
|
|
13
|
+
- Editor content-style isolation, full-width layout, and color palettes: complete.
|
|
14
|
+
|
|
15
|
+
## Completed milestones
|
|
16
|
+
|
|
17
|
+
- Added the initial PyPI metadata, MIT license, package entry point, and
|
|
18
|
+
contributor/security guide.
|
|
19
|
+
- Implemented validated global/per-app settings, HTML helpers, the
|
|
20
|
+
`RichTextField`, form/widget integration, uploads and embeds.
|
|
21
|
+
- Added focused sanitizer, ORM, form, CSRF, model-permission, and
|
|
22
|
+
image-conversion tests.
|
|
23
|
+
- Built and headlessly smoke-tested the local Tiptap editor, including toolbar,
|
|
24
|
+
source mode, and inert script-like code samples.
|
|
25
|
+
- Added English/Turkish editor strings and Django catalogs.
|
|
26
|
+
- Added the two-app demo, migrations, English/Turkish guides, and Django
|
|
27
|
+
catalog compilation. The demo passes Django checks and migrations.
|
|
28
|
+
- Built and validated the universal wheel and source distribution; Twine
|
|
29
|
+
metadata checks pass and the wheel contains the required static, template,
|
|
30
|
+
and localization assets.
|
|
31
|
+
- The 35-test suite passes on Python 3.14 with Django 6.1.3; the
|
|
32
|
+
earlier 20-test suite also passed on Django 5.2.19, 6.0.10, and
|
|
33
|
+
6.1.3. CI is configured for the supported Python/Django combinations.
|
|
34
|
+
- Added `small`, `standard`, and `full` toolbar presets with app-level
|
|
35
|
+
overrides, editable HTML tables, and an opt-in localStorage draft setting.
|
|
36
|
+
- Added icon-based CKEditor-style toolbar rows, modal link/image/video/table
|
|
37
|
+
workflows, and server-validated per-upload image format/quality choices.
|
|
38
|
+
- Added focused tests for profile resolution, table attributes, and image
|
|
39
|
+
format/quality selection.
|
|
40
|
+
- Prevented Enter in image/link/embed/table dialog inputs from implicitly
|
|
41
|
+
submitting the containing admin form; verified image upload by keyboard in
|
|
42
|
+
Django admin without navigating away or saving the article.
|
|
43
|
+
- Added a bilingual demo homepage with combined sanitized article listings,
|
|
44
|
+
actual global/app configuration snippets, and localized explanations.
|
|
45
|
+
- Verified English/Turkish demo views, app article detail, and Turkish admin
|
|
46
|
+
editor in a live browser.
|
|
47
|
+
- The demo now persists its generated development secret to the ignored
|
|
48
|
+
`demo/.secret_key` file; production mode requires `DJANGO_SECRET_KEY`.
|
|
49
|
+
- Added regression checks for stable development keys, empty key files, and
|
|
50
|
+
production startup without an explicit key.
|
|
51
|
+
- The final source distribution includes both localized demo catalogs,
|
|
52
|
+
templates, and static assets; Twine metadata checks and archive-content
|
|
53
|
+
verification both pass.
|
|
54
|
+
- Replaced the demo's per-process random development key with a stable
|
|
55
|
+
gitignored local key file and made an explicit environment key mandatory in
|
|
56
|
+
production.
|
|
57
|
+
- Added settings regression tests for reload stability and production-key
|
|
58
|
+
requirements.
|
|
59
|
+
- Scoped neutral article typography to the editor surface, increased its
|
|
60
|
+
width to fill its form field, and added accessible foreground/highlight color
|
|
61
|
+
palettes backed by the server's CSS allowlist.
|
|
62
|
+
|
|
63
|
+
## Known boundaries
|
|
64
|
+
|
|
65
|
+
- Django-managed ORM and form write paths are validated; raw SQL and direct
|
|
66
|
+
database writes cannot be intercepted by the package.
|
|
67
|
+
- Image processing will be an optional Pillow extra. Video uploads are not
|
|
68
|
+
supported; only configured video embeds will be accepted.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# BD-Editor
|
|
2
|
+
|
|
3
|
+
BD-Editor is a configurable rich-text editor for Django admin and forms. It
|
|
4
|
+
provides a bundled editor UI, server-side HTML sanitization, per-app toolbar
|
|
5
|
+
settings and toolbar presets, editable HTML tables, optional browser drafts,
|
|
6
|
+
modal link/image editing, text and highlight color palettes, image format and
|
|
7
|
+
quality selection, and allowlisted video embeds.
|
|
8
|
+
|
|
9
|
+
The PyPI distribution is named `bd-editor`; import it as `bd_editor`.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
pip install bd-editor
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
For image upload and conversion support:
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
pip install "bd-editor[images]"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick start
|
|
24
|
+
|
|
25
|
+
1. Add `bd_editor` to `INSTALLED_APPS`.
|
|
26
|
+
2. Add `path("bd-editor/", include("bd_editor.urls"))` to the root URLconf.
|
|
27
|
+
3. Use `bd_editor.fields.RichTextField` on a model. Django admin and
|
|
28
|
+
`ModelForm` will use the bundled editor widget automatically.
|
|
29
|
+
4. Configure global and app-specific editor behavior in `BD_EDITOR`.
|
|
30
|
+
|
|
31
|
+
See [the documentation](docs/en/quickstart.md) for a runnable example,
|
|
32
|
+
configuration reference, localization, and security model. A two-app example
|
|
33
|
+
project with localized article listings and live configuration explanations
|
|
34
|
+
is in [demo/](demo/).
|
|
35
|
+
|
|
36
|
+
## Security boundary
|
|
37
|
+
|
|
38
|
+
The editing interface uses JavaScript, but submitted content is sanitized on
|
|
39
|
+
the server and does not permit executable scripts, inline event handlers,
|
|
40
|
+
unsafe URL schemes, or arbitrary iframes. Script-like examples entered in code
|
|
41
|
+
blocks are escaped text. Images are validated from their decoded content;
|
|
42
|
+
video uploads are rejected. Image uploads require CSRF protection and a staff
|
|
43
|
+
user with add/change permission for the associated model.
|
|
44
|
+
|
|
45
|
+
No Django library can intercept direct SQL or writes made outside Django's
|
|
46
|
+
validated ORM paths. Applications must still render through BD-Editor's
|
|
47
|
+
sanitizing template integration and must not mark untrusted values safe
|
|
48
|
+
themselves. See [the security guide](docs/en/security.md).
|
|
49
|
+
|
|
50
|
+
## Development status
|
|
51
|
+
|
|
52
|
+
The project is under active development. See [Progress.md](Progress.md) for
|
|
53
|
+
milestones and [Agents.md](Agents.md) for development and security invariants.
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
BD-Editor is released under the MIT license. Bundled third-party components
|
|
58
|
+
retain their own copyright and license notices.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from django.apps import AppConfig
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class BDEditorConfig(AppConfig):
|
|
5
|
+
default_auto_field = "django.db.models.BigAutoField"
|
|
6
|
+
name = "bd_editor"
|
|
7
|
+
verbose_name = "BD-Editor"
|
|
8
|
+
|
|
9
|
+
def ready(self):
|
|
10
|
+
from .conf import validate_settings
|
|
11
|
+
|
|
12
|
+
validate_settings()
|