Skip to main content

A zero-dependency, CSP-strict, bidirectional rich-text editor for Django.

Project description

Jalgo-editor

A zero-dependency, CSP-strict, bidirectional rich-text editor that feels like Notion but lives natively inside the Django Admin.

Why Jalgo?

Right now, if a Django developer wants a rich-text editor, they have to compromise:

  • CKEditor / TinyMCE: Bloated, and fails strict Content Security Policies (CSP) because they inject style="..." everywhere.
  • Editor.js: Block-based, making mixed-language typing (Persian and English in the same article) a frustrating experience.
  • Tiptap/ProseMirror: Requires NPM, React/Vue, and complex build pipelines.

Jalgo-editor is the anti-bloat editor. It is a pure Python and Vanilla JavaScript package that drops into any Django project instantly. No NPM, no build steps, no external CSS frameworks required.

Killer Features

  1. Smart Bi-Directional (Bidi) Engine: Users don't click an "RTL" or "LTR" button for every block. The editor automatically detects the language of every new paragraph natively applying dir="rtl" to Persian/Arabic blocks, and dir="ltr" to English. Plus, a global RTL/LTR toggle lets you flip the entire editor's base direction instantly.
  2. Bank-Grade Security (Double Sanitization): 100% CSP compliant with zero inline styles by default. A rigorous backend Python parser provides defense-in-depth Stored XSS protection. Safely handles Base64 image embedding while aggressively stripping malicious data URIs.
  3. The "Zen" Interface & Block UI: Notion-like Bubble Menus, fully keyboard-navigable Slash Commands (/), and a beautiful premium glassmorphism design. Headings, Quotes, and Code Blocks feature beautiful, distinct "Boxed UI" layouts with floating badges so you always know what block you are editing.
  4. Dynamic Themes: Instantly switch between multiple themes including Default, Dark, Retro, and an 8-Bit pixel aesthetic using a custom-built, sleek dropdown selector. Themes dynamically update syntax highlighting colors and UI accents.
  5. Live Syntax Highlighting: A lightweight, zero-dependency generic syntax highlighter automatically colorizes programming languages (keywords, strings, comments) in <pre> code blocks as you type.
  6. Unrestricted HTML Code View (Base64-Free): A rock-solid, fully editable dark-mode <textarea> for raw HTML tweaking. Huge Base64 image strings are intelligently swapped for clean placeholders while editing HTML, keeping your source code beautiful and snappy. We bypass restrictive frontend DOM sanitizers in this view, trusting developers to inject custom classes and tags, deferring final sanitization to the backend.
  7. Seamless Admin Integration: Automatically initializes in Django Admin, fully supporting dynamic Inline Formsets without any configuration.
  8. Drag & Drop Images with Dynamic Alt Text: Works out-of-the-box using local Base64 embedding with secure validation. Features a sleek, inline floating input field to instantly add and edit SEO-friendly alt text right from the image's bubble menu.

Installation

Install using pip:

pip install jalgo-editor

Add to your INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    # ...
    "jalgo_editor",
]

Usage

Simply swap your standard models.TextField with FluidTextField:

from django.db import models
from jalgo_editor.fields import FluidTextField

class Article(models.Model):
    title = models.CharField(max_length=200)
    content = FluidTextField() # Automatically renders the Notion-style editor

No widget configuration needed! It will seamlessly appear in your Django Admin with beautiful Glassmorphism styling and dark-mode support.

Displaying Content

To securely render the stored HTML in your frontend templates, use Django's safe filter. We highly recommend including the editor's CSS file and wrapping your content in the .jalgo-content class. This provides a premium, modern, and minimal dark-themed typography design out-of-the-box (including styled headers, quotes, lists, and syntax-highlighted code blocks):

{% load static %}
<!DOCTYPE html>
<html>
<head>
    <!-- Include the editor CSS to load the beautiful frontend typography -->
    <link rel="stylesheet" href="{% static 'jalgo_editor/css/editor.css' %}">
</head>
<!-- Add a dark background to your body to match the styling -->
<body class="dark-background">
    <!-- Wrap your content in jalgo-content -->
    <div class="jalgo-content">
        {{ article.content|safe }}
    </div>
</body>
</html>

Using with Docker

Because jalgo-editor is pure Python/JS and has zero external build dependencies, using it in a Dockerized Django project is extremely simple. Just add it to your requirements.txt:

jalgo-editor>=1.0.1

Then in your Dockerfile:

RUN pip install -r requirements.txt

Note: Ensure you run python manage.py collectstatic during your deployment pipeline so the editor's static files are correctly served by your web server (e.g., Nginx, WhiteNoise).

Monetizable Extensions (Premium API)

Jalgo-editor includes configuration hooks for premium integrations:

  • JALGO_AI_LICENSE_KEY: Unlocks the /ai autocomplete translation and phrasing engine inside the bubble menu.
  • JALGO_CDN_TOKEN: Bypasses your local media storage to automatically drag-and-drop upload and WebP-optimize images to the Jalgo CDN.

License

MIT License

Jalgo Editor Feature Jalgo Editor AI feature

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jalgo_editor-1.1.1.tar.gz (274.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jalgo_editor-1.1.1-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file jalgo_editor-1.1.1.tar.gz.

File metadata

  • Download URL: jalgo_editor-1.1.1.tar.gz
  • Upload date:
  • Size: 274.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jalgo_editor-1.1.1.tar.gz
Algorithm Hash digest
SHA256 a7d3dd47e034332fcde3ddd7f492cc2307e895049de5fb03c96d3a14b880b5b9
MD5 f8d364ba9bea8d8d0eab57315b472117
BLAKE2b-256 045d572823317fad8fd49751b49b7e1e3fde7b86bf8a9496014284058679f809

See more details on using hashes here.

Provenance

The following attestation bundles were made for jalgo_editor-1.1.1.tar.gz:

Publisher: publish.yml on iamjalipo/Jalgo-editor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jalgo_editor-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: jalgo_editor-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jalgo_editor-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4be50fef252fa55a0c1576ecca09c9c77b1c4f40e68ecb1f753a37b1f89e9b6
MD5 5a66fe97ab5950884ad681915ba000fd
BLAKE2b-256 1b3fb0076b8d3f65d32c9893101005d1ebab35e051a67ad097942e948761a838

See more details on using hashes here.

Provenance

The following attestation bundles were made for jalgo_editor-1.1.1-py3-none-any.whl:

Publisher: publish.yml on iamjalipo/Jalgo-editor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page