From 19a83364dc274e0f0540098811b3cafdd4da68a1 Mon Sep 17 00:00:00 2001 From: Thibaud Colas Date: Wed, 31 Jan 2018 01:06:05 +0200 Subject: [PATCH] Add missing release notes and dependencies as globals docs from Draftail work --- CHANGELOG.txt | 3 +++ .../customisation/admin_templates.rst | 22 +++++++++++++++++++ docs/releases/2.0.rst | 4 +++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 068510c56d..cc489e36c1 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -50,6 +50,7 @@ Changelog * Update autoprefixer configuration to better match browser support targets (Janneke Janssen) * Update React and related dependencies to latest versions (Janneke Janssen, Hugo van den Berg) * Remove Hallo editor `.richtext` CSS class in favour of more explicit extension points (Thibaud Colas) + * Expose React-related dependencies as global variables for extension in the admin interface (Thibaud Colas) * Fix: Do not remove stopwords when generating slugs from non-ASCII titles, to avoid issues with incorrect word boundaries (Sævar Öfjörð Magnússon) * Fix: The PostgreSQL search backend now preserves ordering of the `QuerySet` when searching with `order_by_relevance=False` (Bertrand Bordage) * Fix: Using `modeladmin_register` as a decorator no longer replaces the decorated class with `None` (Tim Heap) @@ -79,6 +80,8 @@ Changelog * Fix: Version comparison now handles custom primary keys on inline models correctly (LB (Ben Johnston)) * Fix: Fixed error when inserting chooser panels into FieldRowPanel (Florent Osmont, Bertrand Bordage) * Fix: Reinstated missing error reporting on image upload (Matt Westcott) + * Fix: Only load Hallo CSS if Hallo is in use (Thibaud Colas) + * Fix: Prevent style leak of Wagtail panel icons in widgets using ``h2`` elements (THibaud Colas) 1.13.1 (17.11.2017) diff --git a/docs/advanced_topics/customisation/admin_templates.rst b/docs/advanced_topics/customisation/admin_templates.rst index 4aff3f67c0..d2f4d70c8e 100644 --- a/docs/advanced_topics/customisation/admin_templates.rst +++ b/docs/advanced_topics/customisation/admin_templates.rst @@ -168,3 +168,25 @@ To completely customise the login form, override the ``login_form`` block. This

Some extra form content

{{ block.super }} {% endblock %} + +.. _extending_clientside_components: + +Extending client-side components +================================ + +Some of Wagtail’s admin interface is written as client-side JavaScript with `React `_. +In order to customise or extend those components, you may need to use React too, as well as other related libraries. +To make this easier, Wagtail exposes its React-related dependencies as global variables within the admin. Here are the available packages: + +.. code-block:: javascript + + // 'focus-trap-react' + window.FocusTrapReact; + // 'react' + window.React; + // 'react-dom' + window.ReactDOM; + // 'react-transition-group/CSSTransitionGroup' + window.CSSTransitionGroup; + // 'draft-js' + window.DraftJS; diff --git a/docs/releases/2.0.rst b/docs/releases/2.0.rst index da352130d4..8a8572318b 100644 --- a/docs/releases/2.0.rst +++ b/docs/releases/2.0.rst @@ -71,6 +71,7 @@ Other features * StreamField blocks now allow custom ``get_template`` methods for overriding templates in instances (Christopher Bledsoe) * Simplified edit handler API (Florent Osmont, Bertrand Bordage) * Made 'add/change/delete collection' permissions configurable from the group edit page (Matt Westcott) + * Expose React-related dependencies as global variables for extension in the admin interface (Thibaud Colas) Bug fixes @@ -106,7 +107,8 @@ Bug fixes * Version comparison now handles custom primary keys on inline models correctly (LB (Ben Johnston)) * Fixed error when inserting chooser panels into FieldRowPanel (Florent Osmont, Bertrand Bordage) * Reinstated missing error reporting on image upload (Matt Westcott) - + * Only load Hallo CSS if Hallo is in use (Thibaud Colas) + * Prevent style leak of Wagtail panel icons in widgets using ``h2`` elements (Thibaud Colas) Upgrade considerations ======================