Add demo and improve docs (#4)
This commit is contained in:
parent
47c1a776c2
commit
48ebc6504f
1 changed files with 2 additions and 0 deletions
|
@ -2,9 +2,11 @@
|
||||||
|
|
||||||
Wagtail has support for adding numerous types of links to `RichTextBlock` content, but there is not a way to tie a link to an arbitrary `snippet` model currently. `wagtail-draftail-snippet` provides a way to add a new button to the Draftail rich text editor, which creates an `a href` element for a specific `snippet` model based on a template that can be provided.
|
Wagtail has support for adding numerous types of links to `RichTextBlock` content, but there is not a way to tie a link to an arbitrary `snippet` model currently. `wagtail-draftail-snippet` provides a way to add a new button to the Draftail rich text editor, which creates an `a href` element for a specific `snippet` model based on a template that can be provided.
|
||||||
|
|
||||||
|
![Demo of wagtail-draftail-snippet plugin](https://i.imgur.com/pyX25hg.gif)
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
1. `pip install wagtail-draftail-snippet`
|
||||||
1. Add `wagtail_draftail_snippet` to `INSTALLED_APPS` in Django settings
|
1. Add `wagtail_draftail_snippet` to `INSTALLED_APPS` in Django settings
|
||||||
1. Add `"snippet"` to the `features` keyword list argument when instantiating a `RichTextBlock`, e.g. `paragraph = RichTextBlock(features=["bold", "italic", "h1", "h2", "h3", "snippet"])`
|
1. Add `"snippet"` to the `features` keyword list argument when instantiating a `RichTextBlock`, e.g. `paragraph = RichTextBlock(features=["bold", "italic", "h1", "h2", "h3", "snippet"])`
|
||||||
1. Create a frontend template to determine how the snippet model will be rendered. Frontend templates are required for a snippet to be selected and are discovered when they match a path like `{app_name}/{model_name}_snippet.html`. For example, if you have an `Affiliate` snippet model in `affiliates/models.py`, then a file in `affiliates/templates/affiliates/affiliate_snippet.html` would be required.
|
1. Create a frontend template to determine how the snippet model will be rendered. Frontend templates are required for a snippet to be selected and are discovered when they match a path like `{app_name}/{model_name}_snippet.html`. For example, if you have an `Affiliate` snippet model in `affiliates/models.py`, then a file in `affiliates/templates/affiliates/affiliate_snippet.html` would be required.
|
||||||
|
|
Reference in a new issue