Wykres commitów

1814 Commity (825dda616c6c631dd2b53831354d044fd4e2d806)

Autor SHA1 Wiadomość Data
Sage Abdullah e1731902ca Fix white text on white background in previews for sites that use color-scheme without a background-color 2025-02-21 11:34:04 +00:00
Rishabh Sharma 6132652f1c Reduce confusing spacing below StreamField blocks help text. Fix #11888 (#11934)
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2025-01-14 10:01:44 +00:00
Srishti Jaiswal 4e23cb1c6d Correct positioning of comment buttons with DateField, TimeField and DateTimeField. Fix #12214 (#12685)
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2025-01-13 12:17:07 +00:00
Bartosz Cieliński 39d1bc816d
Ensure Draftail features wrap in case there is a lot of added features 2024-11-28 10:03:39 +00:00
sag​e 4760836769 Fix font size for custom listing button styles (#12456) 2024-10-24 09:49:40 +01:00
Sage Abdullah bf842b32ef Check for last dismissed upgrade check in UpgradeController using data-w-dismissible-value-param 2024-10-21 17:30:33 +01:00
Sage Abdullah 098b48e074 Allow DismissibleController to patch non-boolean values via params 2024-10-21 17:30:33 +01:00
Sage Abdullah f1c63186fd Improve typings in UpgradeController 2024-10-21 17:30:33 +01:00
Sage Abdullah 88342e944b Fix incorrect UpgradeController test
The current version is set to 2.3 at the top level of the test. If the
test case uses 5.15.1 as the latest version, then the test should've
failed – but it didn't because we're missing a few promises to be
awaited.

To verify, try reverting the version diff and re-run the test. It would
fail with the new assertions.
2024-10-21 17:30:33 +01:00
Sage Abdullah 0f0d871c5e Replace UpgradeController hiddenClass with the HTML hidden attribute 2024-10-21 17:30:33 +01:00
Sage Abdullah 0b45e6112c
Drop all trailing punctuations from URLs in a pasted text
This matches the common behaviour of various places, e.g. GitHub and
Slack.
2024-10-21 16:53:00 +01:00
Thibaud Colas 6b04961654
Account for terminal punctuation right after a pasted URL within text 2024-10-21 16:53:00 +01:00
Thibaud Colas b31319934a
Add unit tests for new auto-link paste behavior 2024-10-21 16:53:00 +01:00
Thibaud Colas ba6360446e
Add support for auto-linking URLs and emails within pasted rich text 2024-10-21 16:53:00 +01:00
Thibaud Colas 611d942c10
Refactor onPasteLink implementation to better support multi-link pasting 2024-10-21 16:53:00 +01:00
Thibaud Colas 9b6f617be1
Fix link paste detection concatenating URLs. Fix #12393 2024-10-21 16:52:59 +01:00
Matt Westcott 93f8600c31
ImageBlock for StreamField (rebase of #11791) (#12416)
Co-authored-by: Chiemezuo <chiemezuoakujobi@gmail.com>
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2024-10-21 16:11:34 +01:00
Rohit Singh 105338d0d6
Fix datetime fields overflowing its parent wrapper in listing filters 2024-10-21 09:45:19 +01:00
frankyiu 97fadba582 Fix long name issue in document chooser table cell (#12430, #12431)
Fixes #12357
2024-10-20 13:47:35 +01:00
Sage Abdullah bf139d688c
Tweak preview panel styles to accommodate more than three preview device sizes 2024-10-18 18:19:18 +01:00
Sage Abdullah aa4ceaddd0
Remove data-default-size from preview panel
Now that the preview sizes are customizable, we can't rely on the
default being the mobile size when we want to force the size of the
preview unavailable screen.
2024-10-18 18:19:18 +01:00
Sage Abdullah 47c2c0c82e Fix color contrast of bulk actions' 'Select all' button 2024-10-17 13:33:08 +01:00
Sage Abdullah efaa00d57c Remove action-secondary class from footer actions
It doesn't have good color contrast with the background, and these
'potentially-destructive' actions have a confirmation step anyway.
2024-10-17 13:33:08 +01:00
Sage Abdullah 5c4f83df72 Apply new footer actions styles 2024-10-17 13:33:08 +01:00
Sage Abdullah 4b54e79d7b Fix rounded border radius after closing footer actions dropdown 2024-10-17 13:33:08 +01:00
Albina 488c3583b7
'Prefers-contrast' admin theming (#12348)
Co-authored-by: Victoria Ottah <82820329+Toriasdesign@users.noreply.github.com>
2024-10-17 09:13:22 +01:00
Albina 9a7427a589
Incremental dashboard enhancements. Fix #12089 (#12233)
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2024-10-14 14:39:39 +01:00
Sage Abdullah 897b0415cd Ensure form is always dirty after doing edits when forceValue is true 2024-10-11 16:33:28 +10:00
LB Johnston 9cbe1a507a Deprecate `window.wagtailConfig.BULK_ACTION_ITEM_TYPE` usage in JS
- Avoid using a window global and inline scripts to declare the current bulk action's item time
- Deprecate the usage of `window.wagtailConfig.BULK_ACTION_ITEM_TYPE` with a release note and code comment so that it can be removed in a future release
- Update bulk actions footer template to accept a `item_type` arg, adding this to the DOM element for access within the JavaScript
- Allow a fallback on the model name for core models (e.g. page)
- Also ensure that `{{ block.super }}` is consistently added at the top of the `{% block extra_js %}` (as it is with most usage)
- Relates to #9771 and supports a future migration for bulk actions towards Stimulus
- Relates to ongoing work for CSP compliance #1288
2024-10-08 17:55:28 +10:00
LB Johnston 39e188d040 Use correct `ACTIVE_CONTENT_LOCALE` name in wagtailConfig stubs
Fix up from #11166
2024-10-03 13:26:53 +10:00
LB Johnston d80193ff30 Fix bulk controller example code in JSDoc 2024-10-03 13:26:34 +10:00
LB Johnston 3d5c20863c Clean up JSDoc on Slugify
- Ensure it's added directly above the function
- Update the description to match the options
2024-10-02 20:02:01 +10:00
Ishwari8104 f86161ba00
Ensure dropdown toggles show with border in high contrast mode
Update _dropdown.scss (#12365)
2024-09-29 16:37:38 +10:00
Sage Abdullah 3a9b975ba1 Fix UnsavedController.forceValue not immediately notifying the unsaved changes
Fixes #12355
2024-09-28 17:41:48 +10:00
Shubham e7de2f8955 Refactor UnsavedController to use event.preventDefault() to trigger browser confirmation dialog
Per https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event

"best practice is to trigger the dialog by invoking `preventDefault()`
on the event object, while also setting `returnValue` to support legacy
cases."

We don't need to support legacy cases, as our supported browsers all
support the `preventDefault()` approach.

See also:
https://caniuse.com/mdn-api_window_beforeunload_event_preventdefault_activation

Fixes #12132

From PR #12139
2024-09-28 17:41:48 +10:00
LB Johnston fa8fdaf72d
Simplify wagtailConfig.ts mocks in unit tests
- Avoid mock values that are already in the stub
- Only mock values that are needing to be mocked for unit tess
2024-09-25 14:45:43 -04: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
LB Johnston b52ca03702
Rename wagtailConfig.js to ts file 2024-09-25 14:45:07 -04:00
LB Johnston 46947fe740
Simplify unit tests for TooltipEntity
- Avoid the entire stubbed document element being in snapshots
- Reset the JSDom each test for better snapshot usage
2024-09-25 14:21:20 -04:00
Albina 722b79d9be
Fix minimap toggle visibility (#12279)
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2024-09-24 10:58:23 +01:00
Sage Abdullah 3b22cbf0a5 Fix content path links in usage view to scroll to the correct element 2024-09-24 10:52:01 +01:00
Sage Abdullah 86610560e6 Fix scrolling to anchored panels on Chromium-based browsers
On Chrome, using scrollIntoView() while elements are still being
rendered does not work as expected (i.e. it would intermittently stop
midway).

We start by using getElementById instead of selecting :target, as the
latter doesn't always yield result until the 'load' event is fired. This
does not fix the issue.

The initAnchoredPanels() function is already being called in a 'load'
event handler, so this is as late as it can be, even after the
StreamField blocks have been initialized. However, clearly this doesn't
seem to be enough.

The only solution that seems to work is to use setTimeout, and that does
not even consistently work if the delay isn't high enough for the
elements to render. For now, use 100ms as it seems to be enough in most
cases.
2024-09-24 10:52:01 +01:00
Sage Abdullah 42262484ce Fix editor crash when the URL anchor starts with a number 2024-09-24 10:52:01 +01:00
Sage Abdullah 3388f265a3 Remove ineffective code for scrolling to top on tab select
This never really had any effect. Since the new tabs and slim header
designs in v3.0, window.scrollY always equals 0 because the scroll
container is a content element rather than the window itself.

You can verify this by opening the page editor, scrolling down a bit,
and checking window.scrollY on the browser console. It will print 0,
and if you call window.scrollTo(0, 0) it does not do anything.

Even if it did work, we don't want this behaviour either, because this
would interfere with the functionality of scrolling into a panel that
is selected by the URL anchor (#).
2024-09-24 10:52:01 +01:00
sag​e e529b5b84e
Fix content metrics plugin to work on the main element before falling back to `body` (#12295)
Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2024-09-19 08:53:12 +01:00
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