wagtail_ace_editor
==================
Wagtail Ace Editor is a simple extension which provides access to the [Ace Editor Library](https://github.com/ajaxorg/ace).
Usage is simple and easy like you're used to from any django widget.
We provide a custom theme based on the default cobalt theme to fit into your wagtail application - this is the default theme.
The full library from [Ace Editor on UNPKG](https://unpkg.com/ace-builds@1.3.3/src-min/) has been included to be used.
This is for the people who want full control over their django templates for a specific page at runtime, or want to edit and create plain HTML.
It is a very powerfull block/widget, which can be used to provide django template functionality at runtime.
You will be able to have full access to the RequestContext of a regular Django template.
## Note
This widget is only for use in the wagtail's admin area - it does not do anything for your frontend.
If demand for this appears to be high in the future it will be added.
Quick start
-----------
1. Add 'wagtail_ace_editor' to your INSTALLED_APPS setting like this:
```
INSTALLED_APPS = [
...,
'wagtail_ace_editor',
]
```
2. Run `py manage.py collectstatic` to collect all the relevant javascript and css files.
3. Simply import the widget, or blocks into your django application and use them!
```python
from wagtail_ace_editor.blocks import AceEditorBlock
from wagtail_ace_editor.widgets import AceEditorWidget
# Formfield: from wagtail_ace_editor.forms import AceEditorField
# ... other imports
class MyModel(models.Model):
html_field = models.TextField(
...
)
content = StreamField([
('html_block', AceEditorBlock(
... Parameters
)),
])
panels = [
FieldPanel("html_field", widget=AceEditorWidget(
... Parameters
)),
FieldPanel("content"),
]
```
# Parameters
### mode
**Mode to use for your ace editor.**
What type of code do you want to edit? See the full catalog of [ace.js](https://unpkg.com/ace-builds@1.3.3/src-min/) modes.
`mode="ace/mode/django"`
### theme
**Theme to use for your ace editor.**
`theme="ace/theme/wagtail"`
### include_template_context (default False)
**Include parent template context when using wagtail's {% include_block %} method.**
I mean - why else would you use tempates? When this is true and the mode is ace/mode/(html or django)
the template will be rendered using django's `render_to_string`. Otherwise it will be output as HTML.
*(Only for use in the block!)*
`include_template_context: bool`
### use_frame_preview (default False)
**Render ace/mode/(html or django) inside of an iFrame as opposed to escaping it.**
`use_frame_preview: bool`
### frame_css (default None)
**When using ace/mode/(html or django), allows you to pass in custom CSS to style the iFrame**
If the path is relative, the `STATIC_URL` prefix will be appended to it.
`frame_css: list[str]`
### frame_js (default None)
**When using ace/mode/(html or django), allows you to pass in custom JS to script inside of iFrame**
If the path is relative, the `STATIC_URL` prefix will be appended to it.
`frame_js: list[str]`
### preview_checkbox_checked (default True)
**When using ace/mode/(html or django), allows you to set the default state of the preview checkbox**
`preview_checkbox_checked: bool`
### disable_preview (default False)
**Allows to disable the preview window**
`disable_preview: bool`
### clean_html (default false)
**If you are using `ace/mode/html` or `ace/mode/django` we allow you to clean the HTML if the parameter is specified.**
This might be useful if you want to include the full django-template or HTML editing experience yet still not let the user define any (inline) styles/javascript.
- *Will only work if [bleach ](https://pypi.org/project/bleach/)is installed!*
- *Will not work for the preview in the wagtail admin!*
`clean_html: bool`
#### Settings for cleaning (settings.py)
##### BLEACH_CLEAN_ACE_MODES
**Modes to use the bleach cleaner on.**
By default we clean the modes ace/mode/django and ace/mode/html.
`BLEACH_CLEAN_ACE_MODES: list[str]`
##### ALLOWED_HTML_TAGS
**HTML tags to allow for the bleach cleaner itself.**
By default all tags except Style and Script.
`ALLOWED_HTML_TAGS: list[str]`
##### CLEANER_KWARGS
**Extra keyword arguments to supply to the bleach.sanitizer.Cleaner class**
`CLEANER_KWARGS: dict`
Raw data
{
"_id": null,
"home_page": "https://github.com/Nigel2392/wagtail_ace_editor",
"name": "wagtail-ace-editor",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Nigel",
"author_email": "nigel@goodadvice.it",
"download_url": "https://files.pythonhosted.org/packages/82/a7/799e98b1b389e74a198042c10b00c8b1f8f4b0828e74d69120bed1dfc12d/wagtail_ace_editor-1.1.5.tar.gz",
"platform": null,
"description": "wagtail_ace_editor\r\n==================\r\n\r\nWagtail Ace Editor is a simple extension which provides access to the [Ace Editor Library](https://github.com/ajaxorg/ace).\r\n\r\nUsage is simple and easy like you're used to from any django widget.\r\n\r\nWe provide a custom theme based on the default cobalt theme to fit into your wagtail application - this is the default theme.\r\n\r\nThe full library from [Ace Editor on UNPKG](https://unpkg.com/ace-builds@1.3.3/src-min/) has been included to be used.\r\n\r\nThis is for the people who want full control over their django templates for a specific page at runtime, or want to edit and create plain HTML.\r\n\r\nIt is a very powerfull block/widget, which can be used to provide django template functionality at runtime.\r\n\r\nYou will be able to have full access to the RequestContext of a regular Django template.\r\n\r\n## Note\r\n\r\nThis widget is only for use in the wagtail's admin area - it does not do anything for your frontend.\r\n\r\nIf demand for this appears to be high in the future it will be added.\r\n\r\nQuick start\r\n-----------\r\n\r\n1. Add 'wagtail_ace_editor' to your INSTALLED_APPS setting like this:\r\n\r\n ```\r\n INSTALLED_APPS = [\r\n ...,\r\n 'wagtail_ace_editor',\r\n ]\r\n ```\r\n2. Run `py manage.py collectstatic` to collect all the relevant javascript and css files.\r\n3. Simply import the widget, or blocks into your django application and use them!\r\n\r\n ```python\r\n from wagtail_ace_editor.blocks import AceEditorBlock\r\n from wagtail_ace_editor.widgets import AceEditorWidget\r\n # Formfield: from wagtail_ace_editor.forms import AceEditorField\r\n\r\n # ... other imports\r\n\r\n class MyModel(models.Model):\r\n \thtml_field = models.TextField(\r\n \t\t...\r\n \t)\r\n\r\n \tcontent = StreamField([\r\n \t\t('html_block', AceEditorBlock(\r\n \t\t\t... Parameters\r\n \t\t)),\r\n \t])\r\n\r\n \tpanels = [\r\n \t\tFieldPanel(\"html_field\", widget=AceEditorWidget(\r\n \t\t\t... Parameters\r\n \t\t)),\r\n \t\tFieldPanel(\"content\"),\r\n \t]\r\n\r\n ```\r\n\r\n# Parameters\r\n\r\n### mode\r\n\r\n**Mode to use for your ace editor.**\r\n\r\nWhat type of code do you want to edit? See the full catalog of [ace.js](https://unpkg.com/ace-builds@1.3.3/src-min/) modes.\r\n\r\n`mode=\"ace/mode/django\"`\r\n\r\n### theme\r\n\r\n**Theme to use for your ace editor.**\r\n\r\n`theme=\"ace/theme/wagtail\"`\r\n\r\n### include_template_context (default False)\r\n\r\n**Include parent template context when using wagtail's {% include_block %} method.**\r\n\r\nI mean - why else would you use tempates? When this is true and the mode is ace/mode/(html or django)\r\n\r\nthe template will be rendered using django's `render_to_string`. Otherwise it will be output as HTML.\r\n\r\n*(Only for use in the block!)*\r\n`include_template_context: bool`\r\n\r\n### use_frame_preview (default False)\r\n\r\n**Render ace/mode/(html or django) inside of an iFrame as opposed to escaping it.**\r\n\r\n`use_frame_preview: bool`\r\n\r\n### frame_css (default None)\r\n\r\n**When using ace/mode/(html or django), allows you to pass in custom CSS to style the iFrame**\r\n\r\nIf the path is relative, the `STATIC_URL` prefix will be appended to it.\r\n\r\n`frame_css: list[str]`\r\n\r\n### frame_js (default None)\r\n\r\n**When using ace/mode/(html or django), allows you to pass in custom JS to script inside of iFrame**\r\n\r\nIf the path is relative, the `STATIC_URL` prefix will be appended to it.\r\n\r\n`frame_js: list[str]`\r\n\r\n### preview_checkbox_checked (default True)\r\n\r\n**When using ace/mode/(html or django), allows you to set the default state of the preview checkbox**\r\n\r\n`preview_checkbox_checked: bool`\r\n\r\n### disable_preview (default False)\r\n\r\n**Allows to disable the preview window** \r\n\r\n`disable_preview: bool`\r\n\r\n### clean_html (default false)\r\n\r\n**If you are using `ace/mode/html` or `ace/mode/django` we allow you to clean the HTML if the parameter is specified.**\r\n\r\nThis might be useful if you want to include the full django-template or HTML editing experience yet still not let the user define any (inline) styles/javascript.\r\n\r\n- *Will only work if [bleach ](https://pypi.org/project/bleach/)is installed!*\r\n- *Will not work for the preview in the wagtail admin!*\r\n\r\n`clean_html: bool`\r\n\r\n#### Settings for cleaning (settings.py)\r\n\r\n##### BLEACH_CLEAN_ACE_MODES\r\n\r\n**Modes to use the bleach cleaner on.**\r\n\r\nBy default we clean the modes ace/mode/django and ace/mode/html.\r\n\r\n`BLEACH_CLEAN_ACE_MODES: list[str]`\r\n\r\n##### ALLOWED_HTML_TAGS\r\n\r\n**HTML tags to allow for the bleach cleaner itself.**\r\nBy default all tags except Style and Script.\r\n\r\n`ALLOWED_HTML_TAGS: list[str]`\r\n\r\n##### CLEANER_KWARGS\r\n\r\n**Extra keyword arguments to supply to the bleach.sanitizer.Cleaner class**\r\n`CLEANER_KWARGS: dict`\r\n",
"bugtrack_url": null,
"license": "GPL-3.0-only",
"summary": "An application made for the Django Web Framework.",
"version": "1.1.5",
"project_urls": {
"Homepage": "https://github.com/Nigel2392/wagtail_ace_editor"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "82a7799e98b1b389e74a198042c10b00c8b1f8f4b0828e74d69120bed1dfc12d",
"md5": "3c851d1ffb0b28b2144618fa4d4ce2fa",
"sha256": "eaeb3639fd871010647d3609b408763aa2a03707c40db28e40ef4d2c0abe4d50"
},
"downloads": -1,
"filename": "wagtail_ace_editor-1.1.5.tar.gz",
"has_sig": false,
"md5_digest": "3c851d1ffb0b28b2144618fa4d4ce2fa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 2357429,
"upload_time": "2024-07-01T12:37:42",
"upload_time_iso_8601": "2024-07-01T12:37:42.635910Z",
"url": "https://files.pythonhosted.org/packages/82/a7/799e98b1b389e74a198042c10b00c8b1f8f4b0828e74d69120bed1dfc12d/wagtail_ace_editor-1.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-01 12:37:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Nigel2392",
"github_project": "wagtail_ace_editor",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "wagtail-ace-editor"
}