0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-30 19:20:56 +01:00
Commit Graph

51 Commits

Author SHA1 Message Date
LB Johnston
39e188d040 Use correct ACTIVE_CONTENT_LOCALE name in wagtailConfig stubs
Fix up from #11166
2024-10-03 13:26:53 +10:00
Sage Abdullah
4bb47f7e25
Move wagtailConfig values to wagtail_config template tag
The first step on cleaning up our client-side metadata configuration. With this approach, the values are computed in the `wagtail_config` template tag and passed into the template using Django's json_script.

Then, it's parsed on the client-side and set as `global.wagtailConfig` to retain compatibility with existing code that rely on `window.wagtailConfig`.

This allows us to remove our existing approach of putting metadata values in a `<script>` tag using Django templates directly in the HTML, without changing too much of the existing code, and allowing new code to import the values as `WAGTAIL_CONFIG` from `wagtailConfig.js` instead of using `window.wagtailConfig`. It also means we remove the inline script tag from the core admin base template.

Refactor wagtailConfig util

- Avoid extraneous named exports when they are included in the named WAGTAIL_CONFIG
- Simplify locale map generation
- Avoid reading from global, instead export util that can be used as a global
- Update unit tests for more robust checks
2024-09-25 14:45:09 -04:00
Sage Abdullah
e7dac3e18d Allow SwapController to use the form element's method 2024-07-19 13:14:30 +01:00
elhussein almasri
69e32660db Add support for Draftail ModalWorkflow JS to use chooserUrls supplied
Instead of relying on global window.chooserUrls, add the support for also passing in entityType config objects that serve the same purpose.

Update JS unit tests to reflect that the future will no longer support the window.chooserUrls
2024-02-28 21:36:49 +10:00
Viktor Szépe
5679b30d1b
Fix typos (#11687) 2024-02-22 17:39:16 +00:00
LB Johnston
51353c7c43
Do not use jest inside stubs.js to prevent Storybook from crashing 2023-09-13 15:04:04 +01:00
LB Johnston
f90e03ab35 Update Jest to v29, uuid v9 & update stubs
- `uuid` update is required to avoid import errors - https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md#900-2022-09-05
- Add stubs for window.scrollTo to avoid console errors when running tests
- Filter out warnings for Draftail React warnings, these are unlikely to be resolved anytime soon and add noise to the Jests tests that are unhelpful
- Closes #10043
2023-07-13 07:51:26 +01:00
Thibaud Colas
a517ee6dc9 Fix Storybook stories intialisation broken due to script config dependencies 2023-02-15 22:52:49 +10:00
Matt Westcott
947a7883f9 Add a higher-level API for chooser modals
Previously, anything invoking the chooser modal needed to make its own call to ModalWorkflow, which meant it needed to import the corresponding 'onloadHandlers' dict, know the appropriate chosen response identifier to listen to, and know how to modify the chooser URL to pass parameters (if applicable). This would mean a lot of duplicated logic if there were multiple places where the modal is invoked.

Here we introduce a ChooserModal base class which encapsulates those details - a caller just needs to instantiate it with the base URL, and call `open` on it to open the modal (passing an options dict and a response callback).
2023-01-18 14:31:07 +00:00
Lovelyfin00
004faac53c
Migrate workflow and workflow tasks enable action to a Stimulus controller (#9844)
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2023-01-12 21:55:40 +00:00
Karl Hobley
849ac514a2 Define gettext functions in an importable module 2022-04-01 17:01:26 -04:00
Karl Hobley
1e884285a1 Replace STRINGS constants with gettext 2022-04-01 17:01:26 -04:00
Thibaud Colas
d2d4651853 Remove polyfills only installed for IE11 2022-02-15 16:31:57 +00:00
Thibaud Colas
af942a27e4
Reformat codebase with Prettier (#7912)
- Automated reformatting
- Manually change code where Prettier reformatting causes issues
- Revert "Disable Prettier formatting in CI for now"
2022-02-04 11:57:55 +00:00
Thibaud Colas
7c4b82bb8e Add ARIA markup for sidebar regions and toggle buttons 2022-01-12 16:46:08 +00:00
Karl Hobley
b9d61ab82a Use stubs in storybook 2021-05-03 17:05:56 +01:00
Karl Hobley
f15699414a Put notices straight after the relevant comment/reply 2021-04-26 17:38:52 +01:00
Karl Hobley
331a4f5719
Tweak comment warnings (#7102)
* Make "Are you sure?" on comment reply deletion correct size

* Update wording of warning after editing comment

* Tighten up height of comment warnings
2021-04-26 15:51:17 +01:00
Karl Hobley
c97bc56c68
Add warning to bottom of draft comments (#7089)
* Add warning to bottom of draft comments

* Add a warning to bottom of edited comments

* Add a warning at the bottom of comments with unsaved replies

* Set role="status" on the comment notice
2021-04-23 17:53:54 +01:00
Jacob Topp-Mugglestone
7f528e7c93 Feature/redux comments (#6856)
Adds inline commenting to the Draftail editor (FE only), and refactors field level comments to subscribe to updates from the store directly



* Refactor field level comments to subscribe to updates directly from the commenting store, rather than calling methods on supplied widgets and annotations directly from the commenting app

* Update Draftail and React-Redux packages in preparation for Draftail inline commenting

* Add CommentableEditor version of Draftail as controlled component, in preparation for manipulating state from the comments system

* Only initialize CommentableEditor if comments are on and the contentpath is valid. Add a comment-adding control to CommentableEditor

* Update eslint

* Remove comment adding control from Draftail if comments are disabled

* fixup! Only initialize CommentableEditor if comments are on and the contentpath is valid. Add a comment-adding control to CommentableEditor

* Add decorator to comments, allowing them to be focused

* Add inline styling to comments

* Make Draftail instance accessible via the DOM node on CommentableEditor as well

* Force rerender for styles and decorators when necessary, and filter out deleted comments

* Remove comment styles when saving Draftail content

* Fix formatting error

* Remove unnecessary comment

* Don't use addition for string concatenation

* Newline

* Add explanatory comment about save logic

* fixup! Don't use addition for string concatenation

* Use more idiomatic undefined check

* Fix aria-label for comment button

* Use span to decorate link

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>

* Update getFullSelectionState comment

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>

* Reorder selection state generation

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>

* Remove unused argument

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>

* Make draftail position comments by median annotation, and pin by clicked comment

* Remove inline return

* Make setPinnedComment an option on setFocusedComment

* Add JSDoc comments and remove unused attribute

* use decoratorRef instead of Ref for clarity in annotation

* fixup! Update eslint

* Update Draftail snapshot

* Move entrypoint

* Prettier reformat and eslint fix

* Use Typescript for CommentableEditor

* Install types for react-redux and draft-js

* Remove unused popPage from interface

* Add draftjs-filters as an explicit dependency

* fixup! Use Typescript for CommentableEditor

* Add explicit type for timeout

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2021-04-20 18:25:30 +01:00
Jacob Topp-Mugglestone
ee5a147573 Add js translatable string for comment save warning (#6644) 2021-04-20 18:25:30 +01:00
jacobtoppm
54ce2f067f Remove 'SHOW_RESOLVED_COMMENTS' string 2021-04-20 18:25:30 +01:00
Jacob Topp-Mugglestone
2ab917bc92 Feature/field comment frontend (#6530)
* Initial working version of comment frontend in edit view

* Make comment js text translatable

* Add comment icon

* Basic hardcoded comment adding widget

* Create widget object and register it with the comment app to subscribe to updates about related annotations and whether comments are shown

* Add data-contentpath attributes to field (and data-contentpath-disabled to fields which prevent a stable contentpath existing at this point - ie ListBlock block positions are not uniquely identified), and to ensure newly generated streamfield blocks also have a stable contentpath identifiable from the frontend, make streamfield uuids generate clientside

* Make comments detect new contentpaths, and move hardcoded comment widget on chooser template into js initialisation, also making new comment buttons init properly in new streamfield blocks

* Fix tests to expect contentpaths

* Remove two step comment widget initialisation, and replace with stored callbacks for widgets that try to initialise themselves before the comment app itself. Refactor widgets to receive the makeComment function directly from the commenting system via an onRegister method to accommodate this

* Use object argument instead of positional for FieldLevelCommentWidget constructor

* Use json_script to pass author to the comments system
2021-04-20 18:25:30 +01:00
Helen C
5682aea460 Add the option to set images as decorative
If an image is decorative, the alt text will be set to be empty. If an image is not decorative, then alt text must be supplied for screen readers.
2021-01-29 10:24:14 +00:00
Karl Hobley
123d9cef92 Add locale indication to the React page explorer 2020-10-23 09:09:52 +01:00
Matt Westcott
499193d05c Pass snippet chooser URL via data attribute instead of chooserUrls 2020-09-30 22:05:45 +01:00
Maylon Pedroso
93a8227a52
Add edit button to draftail images and embeds blocks tooltip. Fix #2674 (#5885) 2020-07-23 13:55:38 +01:00
Karl Hobley
33b6d82033 Rename Admin API endpoint to "main" 2019-11-28 09:00:35 +00:00
Iman Syed
794d40b86b Add ability to create anchor link tab within rich text link
- add tests

- Update changelog & release notes
2019-08-18 15:56:20 +10:00
Helen Chapman
1e85ff454c Move focus to the pages explorer menu when open (#5336, #5394)
* Ensure that when you open the explorer the focus moves to the first link of the menu, and add a label for the explorer navigation
* Add dialog role to pages explorer popup, and ensure that there is an option to close the dialog window when tabbing by making the close button visually hidden rather than display none
2019-06-20 18:02:28 +01:00
Helen Chapman
e33732cc63 Add more contextual information for screen readers in the explorer menu’s links (#5335, #5386) 2019-06-19 15:19:41 +01:00
Helen Chapman
4b4db7d771 Adds screen-reader-only text to the close button for modals (#5274, #5377)
* Adds clearer text to the close button for modals
* Use existing wagtailConfig.STRINGS to store the new translatable string for JS, rather than introducing a new library.
* Update list of string constants for translation in the tests file
* Remove aria-hidden on modal dialog close button
2019-06-17 15:56:48 +01:00
Brady
e77338f1a3 Highlight broken links to pages and documents in rich text. Fix #4802 (#4813) 2019-02-02 17:04:01 +00:00
Matt Westcott
d9d1529cc0 Convert the document chooser modal to use static onload handlers 2018-06-20 15:35:41 +01:00
Matt Westcott
630a887d58 Convert the embed chooser modal to use static onload handlers 2018-06-20 15:35:41 +01:00
Matt Westcott
0ebf393b31 Convert the page/link chooser to use static onload handlers 2018-06-20 15:35:40 +01:00
Matt Westcott
aa9de4758f Use static onload handlers in the image chooser modal
Instead of passing an 'onload' JS function as part of the AJAX response for each step of the workflow,
we specify all onload handlers up-front when initialising ModalWorkflow, and return a 'step' field
in the response to indicate which one to trigger.
2018-06-20 15:35:39 +01:00
Thibaud Colas
c309753378
Expose reusable client-side code to build Draftail extensions (#4467)
* Expose Draftail package as global variable for reuse
* Expose Wagtail React components for reuse
* Expose Draftail-related React components for reuse
2018-04-18 00:27:07 +03:00
Thibaud Colas
7238f22ebd Improve error display cross-browsers, and add translatable string 2018-04-02 19:05:02 +03:00
Thibaud Colas
411895e450 Update labels to make editor reload feature more understandable 2018-04-02 19:04:38 +03:00
Thibaud Colas
19725330af Implement basic editor reloading 2018-04-02 17:24:57 +03:00
Thibaud Colas
7740d2d615 Add Draftail error handling component 2018-04-02 17:24:57 +03:00
Thibaud Colas
9861c2a0d4 Move Draftail tooltips portal closer to the editor to prevent background flickering 2018-02-12 21:54:08 +00:00
Thibaud Colas
ad2ec0b601 Add missing unit tests for Draftail JS code 2018-02-09 15:24:24 +00:00
Thibaud Colas
e4a06083af Add missed ellipsis in test stubs 2018-01-26 14:59:48 +00:00
Thibaud Colas
239365705c Finish making Draftail toolbar translatable 2018-01-18 18:32:16 +02:00
Thibaud Colas
4054fb2f18 Make all Draftail interface translatable 2018-01-17 22:19:37 +02:00
Janneke Janssen
2ff4a5aad1 Update explorer for latest scope, UI, with tests 2017-05-13 23:53:10 +03:00
Sævar Öfjörð Magnússon
81c6f3e3b1 Change explorer behavior for pages w/ children, with tests 2017-05-13 23:53:10 +03:00
Thibaud Colas
8bf2c9bf2e Refactor explorer code with tests using Jest 2017-05-13 23:53:10 +03:00