0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 13:10:14 +01:00
Commit Graph

1769 Commits

Author SHA1 Message Date
Sage Abdullah
e6bcfb710b Remove focus-visible fallback in preview panel code
We're dropping support for Safari 15 soon
2024-09-19 08:22:54 +10:00
Sage Abdullah
8d6d772da0 Final clean up of PreviewController and usage
Move all bind() to connect()

Add renderUrl value to use different URLs for sending vs rendering preview data

Add docstrings for PreviewController properties

Rename cleared property to ready and dispatch w-preview:ready

Add events to PreviewController update lifecycle

Use zero interval delay to disable preview auto update

Rearrange PreviewController methods to better follow the update flow

Ensure only one preview iframe has the w-preview-iframe ID at a given time

This doesn't really affect how it functions, but it's semantically more correct

Ensure runContentChecks function does not crash in tests

Only clear stale data if there is a valid stale preview available

Fix preview on Firefox by not removing the only iframe

Reorder targets and values alphabetically and add JSDoc for events

Introduce w-preview__proxy class for invisible elements in preview panel
2024-09-19 08:22:54 +10:00
Sage Abdullah
054e72b4c2 Setup main PreviewController unit tests
Test loading the last device size from localStorage

Ensure selected device size class is applied on connect

Add test for using ResizeObserver in PreviewController

Add tests for default PreviewController behaviour

Add test for opening preview in a new tab

Add test for handling a request error when opening preview in a new tab

Add test for showing the spinner when loading the preview

Add test for enforcing rendered preview width when there are errors

Split PreviewController tests into separate describe blocks

Use fake timers for all PreviewController tests

Add more detailed assertions in initializeOpenedPanel

Add assertions for setTimeout in PreviewController test

Add test for auto-update cycle

Add test for disabling auto update on panel close

Add tests for manually updating the preview

Add tests for switching preview modes

Only add the mode select element for these tests, to ensure that the
preview panel works even without it (e.g. for models that only define a
single preview mode)

Add tests for PreviewController.disconnect and for requiring the url value

Add test for assuming the first size input is the default

Add ResizeObserver test for preview controller

Reuse url variable in PreviewController tests
2024-09-19 08:22:54 +10:00
Sage Abdullah
db4e86a2c1 Rename preview-panel class to w-preview 2024-09-19 08:22:54 +10:00
Sage Abdullah
55d57be7c5 Initial migration of preview panel to Stimulus PreviewController
Initialise preview panel as a Stimulus PreviewController

Fix TypeScript issues in PreviewController

Use Stimulus targets for preview device size inputs

Use Stimulus target for preview panel new tab button

Use Stimulus target for preview panel loading spinner

Use Stimulus target for preview panel refresh button

Use Stimulus target for preview panel mode select

Use Stimulus target for preview panel iframe

Also rename the id to w-preview-iframe to follow our new conventions for
singleton elements

Rely on Stimulus to replace the iframe target

Because we copy all the attributes from the old iframe to the new one,
this means that the new iframe will also become a target. When we remove
the old iframe, the target is disconnected, and subsequent references to
this.iframeTarget should point to the new one.

Access the preview panel's parent side panel element via this.element.parentElement

Bind preview device size inputs using Stimulus data-action

Extract PreviewController.observePanelSize() method

Extract PreviewController.restoreLastSavedPreferences() method

Use Stimulus value for preview panel url

Use Stimulus value for preview panel pending update state

Move edit form and spinner timeout references into instance variables

Extract PreviewController.finishUpdate() method

Extract PreviewController.reloadIframe() method

Extract PreviewController.clearPreviewData() and setPreviewData() methods

Replace preview panel refresh button target with data-action

Extract openPreviewInNewTab method and use it via data-action

Do not close the preview tab if the data is not valid

Use Stimulus values for preview panel auto update config

Extract PreviewController.initAutoUpdate() method

Extract handlePreviewModeChange method and use it via data-action

Use Stimulus classes for preview panel unavailable and has-errors CSS classes

Use Stimulus class for preview panel selected input size

This removes the reliance of having a predefined set of classes for each
device name, making it easier to add support for custom sizes later.

The outline styles have also been updated to make use of focus-visible
when available.

Use hidden attribute for hiding preview panel spinner

Replace PreviewController isUpdating value with an updatePromise instance variable

Extract PreviewController.hasChanges() method

Extract PreviewController.checkAndUpdatePreview() method

Add default values for PreviewController values

Use ProgressController outlet for preview panel refresh button

This allows the use of the button-longrunning handling for the loading state.

Also, turn the button into an icon-only button as there might not be enough space when the panel is resized to the smallest size

Use cloneNode() instead of manually copying the attributes

Extract PreviewController.replaceIframe() and use it as the iframe's action

Extract PreviewController.sidePanelContainer instance attribute

Extract PreviewController.checksSidePanel instance attribute

Extract PreviewController.updateInterval instance attribute

Clean up PreviewController event listeners on disconnect

Extract preview panel device localStorage key into PreviewController Stimulus value

Extract preview panel's width CSS property names into Stimulus values

Disconnect preview panel ResizeObserver on controller disconnect

Use an instance variable for tracking preview availability
2024-09-19 08:22:54 +10:00
Sage Abdullah
5aa0dde2a4 Move preview-panel.js to PreviewController.ts 2024-09-19 08:22:54 +10:00
Sage Abdullah
a5b42936ec Extract setOptionalInterval util from SessionController 2024-09-19 08:22:54 +10:00
Sage Abdullah
7b67723da9 Fix error if the preview iframe does not have the userbar loaded 2024-09-19 08:22:54 +10:00
Sage Abdullah
014ffb5ce9 Ensure the side panel's show event is dispatched after any hide events
If the event is dispatched in the loop, then the show event may be
dispatched before the hide event is dispatched. For example, if you're
switching from the checks panel to the preview panel, as the preview
panel is ordered before the checks panel in the DOM.

This could cause an issue with the preview panel code, where we listen
for the show event to activate the auto update, and listen to the hide
event to deactivate it. We're listening to both the preview and checks
side panels.

Without this fix, the preview auto-update will get deactivated upon
switching from the checks panel to the preview panel, as the hide event
is dispatched after the show event.
2024-09-19 08:22:54 +10:00
Sage Abdullah
30f1115353 Fix debounce() return type to follow original function
Without typing Promise and Promise.resolve with R, it defaults to
unknown, so the R generic type can't be used.

Also, the debounced function's args should take the generic A parameter
instead of redefining it as any[].
2024-09-19 08:22:54 +10:00
Atif2077
96f8324458 Modified slugify/urlify to according to django's slug validator (#12319)
Fixes #12300
2024-09-17 13:14:51 +01:00
Matt Westcott
b3e68b69fc Upgrade puppeteer to 22.x 2024-09-06 11:46:43 +01:00
Matt Westcott
3567c15e72 Upgrade puppeteer to 21.x 2024-09-06 11:46:43 +01:00
Matt Westcott
726d4c05e1 Upgrade puppeteer to 19.x 2024-09-06 11:46:43 +01:00
Matt Westcott
83562ab03c Upgrade puppeteer to 16.x 2024-09-06 11:46:43 +01:00
Matt Westcott
41f768b2ab Bump patch versions in wagtail/client/tests/integration/package-lock.json 2024-09-06 11:46:43 +01:00
Matt Westcott
d87d34b7d1 update caniuse-lite to prevent warning about outdated browser list 2024-09-06 11:46:43 +01:00
Matt Westcott
482f5a0ec7 Set timeouts of 30 seconds for axe tests 2024-09-06 11:46:43 +01:00
LB Johnston
1790bdd158 Align recent docs & release notes to US spelling 2024-08-29 18:28:07 +01:00
Sage Abdullah
1825f5c60f Fix error when shift+clicking across groups in object permissions table 2024-08-13 19:14:54 +01:00
Sage Abdullah
f8589b3dcd Fix text alignment of model names in object permissions section 2024-08-13 19:14:54 +01:00
Sage Abdullah
e83d23ca2a Fix broken task type filter in workflow task chooser modal (#12213)
Fixes #12210
2024-08-08 18:52:26 +01:00
Vaughn Dickson
0dc233b0fa Add missing getTextLabel implementation for BaseDateTimeWidget, so the value is displayed if it is available instead of a JavaScript 'null'. (#12162)
Fixes #12094
2024-07-31 18:05:37 +01:00
Sage Abdullah
aadad14ee8
Improve styles for overly long selectors in checks results 2024-07-31 11:10:49 +01:00
Thibaud Colas
96db233bf0 Disable pointer events on checker highlights to simplify DevTools inspections 2024-07-31 10:43:07 +02:00
Thibaud Colas
aa070ef08e Log accessibility checker results when present 2024-07-31 10:43:07 +02:00
Thibaud Colas
a684273227 Re-instate accessibility check selectors in CMS. Fix #12157 2024-07-31 10:43:07 +02:00
Sage Abdullah
a5bb99bf67 Fix duplicated rich text input inside choosers (#12173)
Fixes #12002
2024-07-29 15:08:33 +01:00
Sage Abdullah
4f7db41030 Ensure submit buttons inside dialogs also trigger the overwrite confirmation dialog 2024-07-29 07:43:05 +01:00
Sage Abdullah
f8564055b1 Add WAGTAIL_EDITING_SESSION_PING_INTERVAL setting 2024-07-19 13:14:30 +01:00
Sage Abdullah
3f4566dfa3 Destroy tippy on DropdownController disconnect 2024-07-19 13:14:30 +01:00
Sage Abdullah
8845a8091e Improve display of editing sessions on smaller screens 2024-07-19 13:14:30 +01:00
Sage Abdullah
52cf4de58c Use lighter shade of red for unsaved changes indicator in dark mode 2024-07-19 13:14:30 +01:00
Sage Abdullah
6689c2abdd Fix warning icon filler for custom font sizes 2024-07-19 13:14:30 +01:00
Sage Abdullah
28006a13c3 Use has-edits-value to test w-action#forceReload with w-unsaved 2024-07-19 13:14:30 +01:00
Sage Abdullah
2a47ad1da2 Rename w-editing-sessions__session--latest to w-editing-sessions__session--saved 2024-07-19 13:14:30 +01:00
Sage Abdullah
756913c44d Restore ping effect for session with latest revision
Was lost when refactoring the styles to a separate component because @apply doesn't work with custom classes
2024-07-19 13:14:30 +01:00
Sage Abdullah
7d5252200f Only make the reload button show the 'unsaved changes' dialog if there are unsaved changes 2024-07-19 13:14:30 +01:00
Sage Abdullah
72934a5049 Fix spacing in editing sessions dialog buttons 2024-07-19 13:14:30 +01:00
Sage Abdullah
865df0e03e Don't add aria-busy and spinner icon when w-swap is deferred 2024-07-19 13:14:30 +01:00
Sage Abdullah
914e8fc88a Defer w-swap write when there's a visible tooltip in the target container
Tooltips may be triggered by other events, not just focus. Use MutationObserver to handle this.
2024-07-19 13:14:30 +01:00
Sage Abdullah
a0117bb6b3 Only serialise the form data in SwapController if the method is GET 2024-07-19 13:14:30 +01:00
Sage Abdullah
f7c7e5fbd4 Add code comments per review 2024-07-19 13:14:30 +01:00
Sage Abdullah
74c0c25f74 Fill the hole in the warning icon 2024-07-19 13:14:30 +01:00
Sage Abdullah
5de63bd1b3 Use list elements for the editing sessions list 2024-07-19 13:14:30 +01:00
Sage Abdullah
57f34ac6ed Extract editing sessions styles into its own component 2024-07-19 13:14:30 +01:00
Sage Abdullah
c46dd53254 Do not swap sessions list HTML until focus has left the container
Prevent disrupting the flow of keyboard users when they are focusing on
the sessions list.
2024-07-19 13:14:30 +01:00
Sage Abdullah
fba4389f08 Only show the overwrite confirmation dialog if there's a newer revision 2024-07-19 13:14:30 +01:00
Sage Abdullah
edb3a1ab80 Update ping and release URLs on every editing session ping
In case the original session has been cleaned up
2024-07-19 13:14:30 +01:00
Sage Abdullah
5750502772 Include unsaved changes flag as is_editing in session ping request 2024-07-19 13:14:30 +01:00