From 48ebc6504fb9aec492cfc31fd15665f5bed63dca Mon Sep 17 00:00:00 2001 From: Parbhat Puri Date: Wed, 12 Feb 2020 01:24:50 +0530 Subject: [PATCH] Add demo and improve docs (#4) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5c05307..93b5e4b 100644 --- a/README.md +++ b/README.md @@ -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. +![Demo of wagtail-draftail-snippet plugin](https://i.imgur.com/pyX25hg.gif) ## Install +1. `pip install wagtail-draftail-snippet` 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. 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.