wagtail-custom-code-editor


Namewagtail-custom-code-editor JSON
Version 1.0.5 PyPI version JSON
download
home_pageNone
SummaryAn Ace Editor that works in Wagtail CMS
upload_time2024-09-30 12:22:30
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT License Copyright (c) 2024 Amin Shazrin Bin Shaharrudean Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords wagtail cms custom-code-editor editor code acejs wagtailcms wagtail-cms field field-block
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # wagtail-custom-code-editor
![Wagtail Custom Code Editor Workflow](https://github.com/ammein/wagtail-custom-code-editor/actions/workflows/github-actions-check.yml/badge.svg)

A **Wagtail Custom Code Editor Field** for your own editor field.

This package adds a full-featured code editor that is perfect for coding tutorials, documentation containing code examples, or any other type of page that needs to display code.

This field uses the open-source Ace Editor library that you may found here [Ace Editor](https://ace.c9.io/)

![intro](https://raw.githubusercontent.com/ammein/wagtail-custom-code-editor/refs/heads/main/docs/intro.gif)

## Features
- Replace traditional textarea to Ace Editor that you can easily check the linting of the codes.
- Add snippet for better re-usable small region of source code, or any text format.
- Configure your own Ace Editor Options to your own editor preferences.
- Easily change mode available on your own default/custom mode's setup.
- You can save any code highlights so that it can retain the same highlight's code when you change to different mode.

## Documentation
- [Settings](https://github.com/ammein/wagtail-custom-code-editor/blob/main/docs/settings.md)
- [Widget Options](https://github.com/ammein/wagtail-custom-code-editor/blob/main/docs/options.md)
- [Change Modes](https://github.com/ammein/wagtail-custom-code-editor/blob/main/docs/modes.md)
- [Django Admin](https://github.com/ammein/wagtail-custom-code-editor/blob/main/docs/django-admin.md)
- [Extend JS Functionality](https://github.com/ammein/wagtail-custom-code-editor/blob/main/docs/extend-functionality.md)

## Install
Simply install in your project:
```shell
pip install wagtail-custom-code-editor
```

In your settings, add the package in `INSTALLED_APPS`:
```python
INSTALLED_APPS = [
    ...
    "wagtail_custom_code_editor",
    ...
]
```

### Usage

#### Field
You can easily add the `CustomCodeEditorField` to your model fields like this:
```python
from wagtail_custom_code_editor.fields import CustomCodeEditorField

class MyPage(Page):
    code = CustomCodeEditorField()
    ...
```
> The field is using [Django's JSONField](https://docs.djangoproject.com/en/5.1/ref/models/fields/#django.db.models.JSONField)

#### Panel
Then you add `CustomCodeEditorPanel` like this:

```python
from wagtail_custom_code_editor.panels import CustomCodeEditorPanel
from wagtail_custom_code_editor.fields import CustomCodeEditorField

class MyPage(Page):
    code = CustomCodeEditorField()

    content_panels = Page.content_panels + [
        CustomCodeEditorPanel('code')
    ]
```

#### Block
You can also add as `CustomCodeEditorBlock` like this:

```python
from wagtail_custom_code_editor.blocks import CustomCodeEditorBlock
from wagtail.blocks import (
    StructBlock,
)

class CodeBlock(StructBlock):
    code = CustomCodeEditorBlock()
```

#### Frontend
You can easily grab the JSON value like this:
```html
<pre><code>{{ page.code.code }}</code></pre>
```

The JSON returns this two key value:
```json
{
  "code": "Any Code here",
  "mode": "html" 
}
```

## License

wagtail-custom-code-editor is released under the [MIT License](http://www.opensource.org/licenses/MIT).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "wagtail-custom-code-editor",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "wagtail, cms, custom-code-editor, editor, code, acejs, wagtailcms, wagtail-cms, field, field-block",
    "author": null,
    "author_email": "Amin Shazrin <aminshazrin@yahoo.com>",
    "download_url": "https://files.pythonhosted.org/packages/44/3b/f00f10667595d98162141bea5d93a89d406fc49645beaca022f85c123e9f/wagtail_custom_code_editor-1.0.5.tar.gz",
    "platform": null,
    "description": "# wagtail-custom-code-editor\n![Wagtail Custom Code Editor Workflow](https://github.com/ammein/wagtail-custom-code-editor/actions/workflows/github-actions-check.yml/badge.svg)\n\nA **Wagtail Custom Code Editor Field** for your own editor field.\n\nThis package adds a full-featured code editor that is perfect for coding tutorials, documentation containing code examples, or any other type of page that needs to display code.\n\nThis field uses the open-source Ace Editor library that you may found here [Ace Editor](https://ace.c9.io/)\n\n![intro](https://raw.githubusercontent.com/ammein/wagtail-custom-code-editor/refs/heads/main/docs/intro.gif)\n\n## Features\n- Replace traditional textarea to Ace Editor that you can easily check the linting of the codes.\n- Add snippet for better re-usable small region of source code, or any text format.\n- Configure your own Ace Editor Options to your own editor preferences.\n- Easily change mode available on your own default/custom mode's setup.\n- You can save any code highlights so that it can retain the same highlight's code when you change to different mode.\n\n## Documentation\n- [Settings](https://github.com/ammein/wagtail-custom-code-editor/blob/main/docs/settings.md)\n- [Widget Options](https://github.com/ammein/wagtail-custom-code-editor/blob/main/docs/options.md)\n- [Change Modes](https://github.com/ammein/wagtail-custom-code-editor/blob/main/docs/modes.md)\n- [Django Admin](https://github.com/ammein/wagtail-custom-code-editor/blob/main/docs/django-admin.md)\n- [Extend JS Functionality](https://github.com/ammein/wagtail-custom-code-editor/blob/main/docs/extend-functionality.md)\n\n## Install\nSimply install in your project:\n```shell\npip install wagtail-custom-code-editor\n```\n\nIn your settings, add the package in `INSTALLED_APPS`:\n```python\nINSTALLED_APPS = [\n    ...\n    \"wagtail_custom_code_editor\",\n    ...\n]\n```\n\n### Usage\n\n#### Field\nYou can easily add the `CustomCodeEditorField` to your model fields like this:\n```python\nfrom wagtail_custom_code_editor.fields import CustomCodeEditorField\n\nclass MyPage(Page):\n    code = CustomCodeEditorField()\n    ...\n```\n> The field is using [Django's JSONField](https://docs.djangoproject.com/en/5.1/ref/models/fields/#django.db.models.JSONField)\n\n#### Panel\nThen you add `CustomCodeEditorPanel` like this:\n\n```python\nfrom wagtail_custom_code_editor.panels import CustomCodeEditorPanel\nfrom wagtail_custom_code_editor.fields import CustomCodeEditorField\n\nclass MyPage(Page):\n    code = CustomCodeEditorField()\n\n    content_panels = Page.content_panels + [\n        CustomCodeEditorPanel('code')\n    ]\n```\n\n#### Block\nYou can also add as `CustomCodeEditorBlock` like this:\n\n```python\nfrom wagtail_custom_code_editor.blocks import CustomCodeEditorBlock\nfrom wagtail.blocks import (\n    StructBlock,\n)\n\nclass CodeBlock(StructBlock):\n    code = CustomCodeEditorBlock()\n```\n\n#### Frontend\nYou can easily grab the JSON value like this:\n```html\n<pre><code>{{ page.code.code }}</code></pre>\n```\n\nThe JSON returns this two key value:\n```json\n{\n  \"code\": \"Any Code here\",\n  \"mode\": \"html\" \n}\n```\n\n## License\n\nwagtail-custom-code-editor is released under the [MIT License](http://www.opensource.org/licenses/MIT).\n",
    "bugtrack_url": null,
    "license": "MIT License Copyright (c) 2024 Amin Shazrin Bin Shaharrudean Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "An Ace Editor that works in Wagtail CMS",
    "version": "1.0.5",
    "project_urls": {
        "Homepage": "https://github.com/ammein/wagtail-custom-code-editor"
    },
    "split_keywords": [
        "wagtail",
        " cms",
        " custom-code-editor",
        " editor",
        " code",
        " acejs",
        " wagtailcms",
        " wagtail-cms",
        " field",
        " field-block"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "443bf00f10667595d98162141bea5d93a89d406fc49645beaca022f85c123e9f",
                "md5": "e674aabfeb1ecd2298ca310a797acfdc",
                "sha256": "5212228182a2404c7598fcae4170a7d4a1ce217c69b857dbb1b86687d531d95b"
            },
            "downloads": -1,
            "filename": "wagtail_custom_code_editor-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "e674aabfeb1ecd2298ca310a797acfdc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3010282,
            "upload_time": "2024-09-30T12:22:30",
            "upload_time_iso_8601": "2024-09-30T12:22:30.436710Z",
            "url": "https://files.pythonhosted.org/packages/44/3b/f00f10667595d98162141bea5d93a89d406fc49645beaca022f85c123e9f/wagtail_custom_code_editor-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-30 12:22:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ammein",
    "github_project": "wagtail-custom-code-editor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "wagtail-custom-code-editor"
}
        
Elapsed time: 2.59214s