Skip to main content

Django widget for Toast UI Editor (markdown mode)

Project description

django-toastui-markdown-editor

A Django widget that integrates Toast UI Editor into Django forms and admin as a drop-in replacement for standard textarea fields with rich markdown editing.

Features

  • TuiEditorWidget - Form widget that replaces textareas with Toast UI Editor
  • AdminTuiEditorWidget - Specialized widget with admin-specific styling (full width, larger height)
  • TuiEditorField - Model field (TextField) that automatically uses the Toast UI Editor in forms
  • Configurable - Editor settings (edit type, preview style, height, toolbar) via config parameter
  • Formset support - Works with Django admin inlines and dynamically added forms
  • content-editor plugin - Integrates with django-content-editor activation/deactivation events

Requirements

  • Python 3.10+
  • Django 4.2+

Installation

pip install django-toastui-markdown-editor

Add to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'tui_editor',
]

Quick Start

In a Model

from django.db import models
from tui_editor.fields import TuiEditorField

class Article(models.Model):
    body = TuiEditorField()

In a Form

from django import forms
from tui_editor.widgets import TuiEditorWidget

class ArticleForm(forms.Form):
    body = forms.CharField(widget=TuiEditorWidget())

In Django Admin

from django.contrib import admin
from tui_editor.widgets import AdminTuiEditorWidget

class ArticleAdmin(admin.ModelAdmin):
    formfield_overrides = {
        models.TextField: {'widget': AdminTuiEditorWidget()},
    }

Configuration

Pass a config dict to the widget to customize the editor:

TuiEditorWidget(config={
    'initialEditType': 'wysiwyg',  # or 'markdown' (default)
    'previewStyle': 'vertical',     # or 'tab' (default)
    'height': '500px',              # default: '300px'
})

Disclaimer

This project is not affiliated with, endorsed by, or associated with NHN or the Toast UI project. It is an independent, third-party Django integration that bundles the Toast UI Editor library.

License

MIT License - see LICENSE for details.

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

django_toastui_markdown_editor-0.1.0.tar.gz (290.7 kB view details)

Uploaded Source

Built Distribution

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

django_toastui_markdown_editor-0.1.0-py3-none-any.whl (292.3 kB view details)

Uploaded Python 3

File details

Details for the file django_toastui_markdown_editor-0.1.0.tar.gz.

File metadata

File hashes

Hashes for django_toastui_markdown_editor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fd4e4732b7c516be387e88cbef078c5499072d5dd00d871ebec87829100f3a20
MD5 0d0169835c14b4a445c17791cf664934
BLAKE2b-256 b208318884fb7655600224648408351a7bca2af73b2be1b00d2e62b48af48367

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_toastui_markdown_editor-0.1.0.tar.gz:

Publisher: publish.yml on arthanson/django-toastui-markdown-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 django_toastui_markdown_editor-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_toastui_markdown_editor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce716b8c4ac710679d3869a776ddd7847d8ab03bd3d53e2185ad1725f8cc2c44
MD5 8b93252347148a35654bc01830904204
BLAKE2b-256 05811b3762da2d07d8f5d6b2fe66c4a657f09924c218b59641fef70ba9f6a2d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_toastui_markdown_editor-0.1.0-py3-none-any.whl:

Publisher: publish.yml on arthanson/django-toastui-markdown-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