Metadata-Version: 2.4
Name: ophix-codemirror
Version: 2026.10.6.1
Summary: Vendored CodeMirror editor widgets for Ophix Project Servers
Author: Ophix Project
License-Expression: MIT
Project-URL: Homepage, https://ophix.io
Project-URL: Documentation, https://github.com/ophixproject/ophix-codemirror#readme
Project-URL: Source, https://github.com/ophixproject/ophix-codemirror
Keywords: django,codemirror,editor,widget,ophix
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django<6.0,>=4.2; python_version < "3.12"
Requires-Dist: Django>=4.2; python_version >= "3.12"
Dynamic: license-file

# ophix-codemirror

Vendored CodeMirror editor plugin for [ophix-server-base](https://github.com/ophixproject/ophix-server-base).

Bundles CodeMirror 5 as static assets and provides Django form widgets for use in the
admin interface. Air-gap safe — no CDN dependencies at runtime.

---

## Installation

```bash
pip install ophix-codemirror
```

---

## What this plugin provides

- Vendored CodeMirror 5.65.16 JavaScript and CSS assets (MIT licensed, from
  [codemirror/codemirror5](https://github.com/codemirror/codemirror5); its license is
  bundled alongside the vendored files at
  `static/ophix_codemirror/codemirror/LICENSE`)
- `JSONCodeMirrorWidget` — JSON editor with fold gutter and auto pretty-print
- `DynamicCodeMirrorWidget` — format-switching editor; switches CodeMirror mode
  based on a format dropdown with `data-codemirror-mode` attributes on each option.
  Used by `ophix-confs` for configuration snippet editing.

---

## Usage

Used automatically by domain plugins that include a content editor in the admin.
`ophix-confs` wires `DynamicCodeMirrorWidget` into its `Configuration` admin form.
Other domains with content fields should use `DynamicCodeMirrorWidget` for any
format-aware text field.

```python
from ophix_codemirror.widgets import DynamicCodeMirrorWidget, JSONCodeMirrorWidget
```

---

## Server

This plugin is part of the [Ophix Project](https://ophix.io) server stack.
