Skip to main content

Adds ace 1.9.6 to static files.

Project description

djangocms-static-ace

This app provides the ace source code editor files under the static files urls for the django cms admin interface (plugin modals essentially).

It is only needed if the project does not have internet access, or, if it prefers third party resources not to be loaded over the internet.

This app is a conditional dependency of, potentially amongst others, djangocms-frontend and djangocms-snippet.

Installation

The typical installation adds the [static-ace] optional argument to the app requiring the ace code editor, e.g., djangocms-frontend[static-ace]. If needed it can be installed explicitly by pip install djangocms-static-ace.

Finally, to make the static ace files available, djangocms_static_ace needs to be explicitly declared in the projects INSTALLED_APPS setting (in the project's settings.py):

INSTALLED_APPS = [
    ...,
    "djangocms_static_ace",
    ...,
]

Once made available, compliant apps will load the ace editor locally from static files.

Using the ace editor for your own plugins

To make your own plugin aware of djangocms-static-ace you will need to define a custom form for your plugin and add a Media class

from django.conf import settings as django_settings
from django import forms

from ... import MyFormModel


class MyPluginForm(forms.ModelForm):

    class Media:
        js = (
            "admin/vendor/ace/ace.js"
            if "djangocms_static_ace" in django_settings.INSTALLED_APPS
            else "https://cdnjs.cloudflare.com/ajax/libs/ace/1.9.6/ace.js",
        )

    class Meta:
        model = MyFormModel
        exclude = ()

Finally, you need to point your plugin's form attribute to MyPluginForm.

class MyPlugin(CMSPluginBase):
    ...
    form = MyPluginForm
    ...

Versions

Currently, django CMS uses ace 1.9.6

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

djangocms-static-ace-1.1.0.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

djangocms_static_ace-1.1.0-py3-none-any.whl (2.5 MB view details)

Uploaded Python 3

File details

Details for the file djangocms-static-ace-1.1.0.tar.gz.

File metadata

  • Download URL: djangocms-static-ace-1.1.0.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for djangocms-static-ace-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e932304b9bd54f598bddf60e030d44b8ca5dfe8eb521df8aacccf36395353216
MD5 6f43d64c5a3f64ef843505a6e1ffbee5
BLAKE2b-256 b25ed7d516887ac22d776111134b1ea5ce8141504d2886e5a9be9d23b9552578

See more details on using hashes here.

File details

Details for the file djangocms_static_ace-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for djangocms_static_ace-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ebff4e31bc00c7cc6c66c185c0bc4430f338eaec41f6718bdc3300e3d97a0f64
MD5 d9f0942b1bdc9586fa346291121df783
BLAKE2b-256 d47710b222723c14c69b97ad545c35b97035e235fa02650ebe51b14d506551eb

See more details on using hashes here.

Supported by

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