Rich Text Editor

Basic rich text editor component (contenteditable + toolbar).

python 8 params

Preview

Draft release notes here.
Arguments
rich_text_editor(value='Draft <strong>release notes</strong> here.')

Usage

views.py
python
from djust import LiveView
from djust.decorators import event_handler
from djust.components import RichTextEditor


class MyView(LiveView):
    template_name = "my_template.html"

    def mount(self, request, **kwargs):
        self.component = RichTextEditor(value='Draft <strong>release notes</strong> here.')

    @event_handler()
    def update_content(self, value, **kwargs):
        self.component.value = value
my_template.html
django
{{ component }}

Events this component sends to the view: update_content.

Parameters

NameTypeDefault
namestr'content'
valuestr''
eventstr — renames the event'update_content'
placeholderstr'Start typing...'
heightstr'200px'
labelstr''
custom_classstr''
**kwargs— passed to `Component.__init__`: `id=` sets `component.id`, and any other keyword is kept as state
Source & styles
FilePathNotes
moduledjust.components.components.rich_text_editorSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 5 of this component's classes at line 500, 924, 925, 926, 929. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_theming/components.cssDefines 1 of this component's classes at line 1045. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_theming/scaffold.cssDefines 1 of this component's classes at line 437. Override those rules, or the custom properties they read, in a stylesheet loaded after it.