Skip to main content

Wagtail Draftail Hovercard

License: MIT Version

A Wagtail plugin that adds a hovercard to Wagtail's Draftail rich text editor. You are responsible for rendering the hovercard in your frontend.

Requirements

  • Wagtail 4.2+

Installation

  1. Install the package
pip install wagtail-draftail-hovercard
  1. Add wagtail_draftail_hovercard to your INSTALLED_APPS
INSTALLED_APPS = [
    # ...
    "wagtail_draftail_hovercard",
    # ...
]
  1. Add the hovercard feature to your RichTextField or RichTextBlock
class MyModel(models.Model):
    content = RichTextField(features=["hovercard"])

That's it! You now have a hovercard feature in your Draftail editor toolbar.

Rendering the hovercard on the frontend of your site

You are responsible for rendering the hovercard in your frontend. The rich text representation in limited to a <span> element with the extra fields added as data attributes. You need to write some JS to look for span[data-type="hovercard"] and replace it with your whatever you want to render.

Here's what the HTML rendered by Draftail looks like:

<span data-type="hovercard" data-text="I'm the text inside the hovercard" data-heading="I'm the heading or I can be blank">
    I'm the text that the hovercard is attached to
</span>

License

This project is licensed under the MIT License - see the LICENSE file for details.

Release files for wagtail-draftail-hovercard 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wagtail-draftail-hovercard 0.1.0
File Size Uploaded
wagtail_draftail_hovercard-0.1.0.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-draftail-hovercard 0.1.0
File Interpreter ABI Platform
wagtail_draftail_hovercard-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.5 kB

Release files / wagtail_draftail_hovercard-0.1.0.tar.gz

Download URL wagtail_draftail_hovercard-0.1.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d5862c6427fde7297677c6b3e7b24efa09597b4c130ed34f5401711c72a4f589
BLAKE2b-256 checksum
How to use checksums
843e6a0fd457c387c370d1e89d9f5ebdf73ad42d09ed7101ad6eb657015ccfda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / wagtail_draftail_hovercard-0.1.0-py3-none-any.whl

Download URL wagtail_draftail_hovercard-0.1.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3527f0073a833b597703ccdb4ac4eb87bf188c21969ae2968b416b3e17de917
BLAKE2b-256 checksum
How to use checksums
f39e909f17f7c50606a713a6b197213ac27b69c5a9e7b4b9ba215d225286e5ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page