0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 05:02:57 +01:00
Commit Graph

1819 Commits

Author SHA1 Message Date
LB
3697ee1f2a Eslint - fix location of storybook folder & remove eslint ignore 2024-11-20 07:52:43 +10:00
ayaan-qadri
b0c90d4be2 Removed preventDefault from openPreviewInNewTab in PreviewController
Relates to #10356
2024-11-06 07:47:10 +10:00
LB
825a77d6c2 Remove all eslint-disable no-undef & use global comments (#12527)
Recommendation is to either declare globals in config or in a `/* global ` comment
See https://eslint.org/docs/latest/rules/no-undef#rule-details
2024-11-05 20:11:09 +00:00
LB
21206dc3e7 Clean up JS comments to be aligned to JSDoc where suitable 2024-11-04 21:14:04 +10:00
manu
b2cd95bf3b Fix sidebar page explorer transitions - avoid overflow 2024-11-02 09:59:21 +10:00
Bojan Mihelac
cc1805dc86
Fix sub-menus within the main menu cannot be closed on mobile (#10747) 2024-11-01 12:10:53 +00:00
LB
93384a062e Update CloneController - added/cleared events should not be cancelable
- While no code uses the event.preventDefault on these it's good practice to advise when cancelling will do nothing
2024-10-31 22:10:00 +10:00
Joel William
4a933df9fb Rich Text (Draftail) - Ensure SVG paths are correctly handled for custom features #12418
Ensure the documented support for providing an array of SVG paths to the 'icon' attribute when using `register_rich_text_features` is correctly supported.

Fixes #11777
Fixes #11051
Fixes #10319

See https://docs.wagtail.org/en/stable/extending/extending_draftail.html#creating-new-blocks
> It can also be an array of strings, to use SVG paths, or SVG symbol references for example 'icon': ['M100 100 H 900 V 900 H 100 Z'],. The paths need to be set for a 1024x1024 viewbox.
2024-10-27 20:20:02 +10:00
Temidayo32
c611dd4056 Ensure the Icon react component can support custom icon paths #11122
- When provided with children (e.g. custom paths), render these instead of the `use` symbol reference
- Allow any valid SVG attribute to be passed to the component to render on the `svg` element
- Clean up rendering of className to avoid extra whitespace
- Clean up ordering of the props to be alphabetically sorted
- Update unit tests to be focused more on testing and less on snapshots
2024-10-27 20:20:02 +10:00
sag​e
3f6cd8c18f
Fix font size for custom listing button styles (#12456) 2024-10-24 09:33:28 +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