Allow heading tags (h1-h6) in ContentSanitizer so news editor headings render
This commit is contained in:
@@ -389,6 +389,8 @@ export default function StudioContentBrowser({
|
||||
quickCreate = [],
|
||||
hideModuleFilter = false,
|
||||
hideBucketFilter = false,
|
||||
defaultSort = 'updated_desc',
|
||||
sortStorageKey = null,
|
||||
emptyTitle = 'Nothing here yet',
|
||||
emptyBody = 'Try adjusting filters or create something new.',
|
||||
}) {
|
||||
@@ -400,7 +402,7 @@ export default function StudioContentBrowser({
|
||||
const [pendingFilters, setPendingFilters] = useState({
|
||||
q: '',
|
||||
bucket: 'all',
|
||||
sort: 'updated_desc',
|
||||
sort: defaultSort,
|
||||
content_type: 'all',
|
||||
category: 'all',
|
||||
tag: '',
|
||||
@@ -466,12 +468,41 @@ export default function StudioContentBrowser({
|
||||
setPendingFilters({
|
||||
q: filters.q || '',
|
||||
bucket: filters.bucket || 'all',
|
||||
sort: filters.sort || 'updated_desc',
|
||||
sort: filters.sort || defaultSort,
|
||||
content_type: filters.content_type || 'all',
|
||||
category: filters.category || 'all',
|
||||
tag: filters.tag || '',
|
||||
})
|
||||
}, [filters.q, filters.bucket, filters.sort, filters.content_type, filters.category, filters.tag])
|
||||
}, [filters.q, filters.bucket, filters.sort, filters.content_type, filters.category, filters.tag, defaultSort])
|
||||
|
||||
useEffect(() => {
|
||||
if (!sortStorageKey) {
|
||||
return
|
||||
}
|
||||
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
if (params.has('sort')) {
|
||||
return
|
||||
}
|
||||
|
||||
const storedSort = window.localStorage.getItem(sortStorageKey)
|
||||
const sortOptions = new Set((listing?.sort_options || []).map((option) => option.value))
|
||||
const activeSort = filters.sort || defaultSort
|
||||
|
||||
if (!storedSort || !sortOptions.has(storedSort) || storedSort === activeSort) {
|
||||
return
|
||||
}
|
||||
|
||||
router.get(window.location.pathname, {
|
||||
...filters,
|
||||
sort: storedSort,
|
||||
page: 1,
|
||||
}, {
|
||||
preserveScroll: true,
|
||||
preserveState: true,
|
||||
replace: true,
|
||||
})
|
||||
}, [sortStorageKey, listing?.sort_options, filters, defaultSort])
|
||||
|
||||
const updateQuery = (patch) => {
|
||||
const next = {
|
||||
@@ -491,6 +522,10 @@ export default function StudioContentBrowser({
|
||||
},
|
||||
})
|
||||
|
||||
if (sortStorageKey && typeof next.sort === 'string' && next.sort !== '') {
|
||||
window.localStorage.setItem(sortStorageKey, next.sort)
|
||||
}
|
||||
|
||||
router.get(window.location.pathname, next, {
|
||||
preserveScroll: true,
|
||||
preserveState: true,
|
||||
@@ -882,7 +917,7 @@ export default function StudioContentBrowser({
|
||||
id="studio-filter-sort"
|
||||
options={selectOptions(listing?.sort_options || [])}
|
||||
value={pendingFilters.sort}
|
||||
onChange={(nextValue) => setPendingFilter('sort', nextValue ?? 'updated_desc')}
|
||||
onChange={(nextValue) => setPendingFilter('sort', nextValue ?? defaultSort)}
|
||||
placeholder="Recently updated"
|
||||
searchable={false}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user