@bison-lab/payload-core 4.28.0 → 4.28.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -580,7 +580,10 @@ be published without a section — and Publish names that fix instead of
580
580
  only `Content → Layout`. Title-follow does not wipe the folder prefix. A taken address is
581
581
  refused — never rewritten to `slug-2`. Unlock opens Parent and a
582
582
  "Page name in address" box (with Use title), and a parent or page-name
583
- change writes a 308 the same way a typed slug change does (BIS-171). `createRedirects()`
583
+ change writes a 308 the same way a typed slug change does (BIS-171). The
584
+ lock is a `beforeValidate` hook that keeps the stored address, not field
585
+ `access.update`: Payload renders a field with update denied as read-only
586
+ when the edit view loads, so Unlock could never open it. `createRedirects()`
584
587
  wraps `@payloadcms/plugin-redirects` for `pages` only (permanent 308) and
585
588
  collapses chains when a published slug changes. The plugin stores the
586
589
  rows; the site still has to serve them. Pin the plugin to the same
package/dist/admin.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { a as pageEditorLooks, c as colorDocFromState, n as clampIslandHeight, o as pageEditorTokens, r as islandHeightOf, s as SYSTEM_COLOR_KEYS, u as stateFromColorDoc } from "./island-97l5VY8l.mjs";
3
- import { ArrayField, Button, CheckboxInput, DefaultCell, FieldDescription, FieldError, FieldLabel, Link, Logout, NavGroup, NavToggler, SelectField, fieldBaseClass, useAllFormFields, useAuth, useBulkUpload, useConfig, useEntityVisibility, useField, useForm, useFormFields, useListDrawerContext, useListQuery, useModal, useNav, useRowLabel, useStepNav } from "@payloadcms/ui";
3
+ import { ArrayField, Button, CheckboxInput, DefaultCell, FieldDescription, FieldError, FieldLabel, Link, Logout, NavGroup, NavToggler, SelectField, fieldBaseClass, useAllFormFields, useAuth, useBulkUpload, useConfig, useDocumentInfo, useEntityVisibility, useField, useForm, useFormFields, useListDrawerContext, useListQuery, useModal, useNav, useRowLabel, useStepNav } from "@payloadcms/ui";
4
4
  import { GREY_SCALES, SHADE_STEPS, contrastForeground, contrastRatio, createColorScale, deriveDarkPalette, deriveLightPalette, hexToHSL, hslToString, includedShadeSteps, isThemeHex, presetHints, regenerateColorScale, setColorScaleInclude, updateColorScale } from "@bison-lab/tokens";
5
5
  import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -3215,7 +3215,9 @@ const SlugField = ({ field, path, readOnly }) => {
3215
3215
  const unlock = useField({ path: "slugUnlock" });
3216
3216
  const title = useFormFields(([fields]) => fields.title?.value);
3217
3217
  const root = isRootPageKey(useFormFields(([fields]) => fields.pageKey?.value));
3218
- const slugLocked = Boolean(useFormFields(([fields]) => fields.slugLocked?.value));
3218
+ const flaggedLocked = useFormFields(([fields]) => Boolean(fields.slugLocked?.value || fields.publishedSlug?.value));
3219
+ const { hasPublishedDoc } = useDocumentInfo();
3220
+ const slugLocked = flaggedLocked || Boolean(hasPublishedDoc);
3219
3221
  const locked = Boolean(readOnly) || root || slugLocked && !unlock.value;
3220
3222
  const folderRoots = useMemo(() => {
3221
3223
  return ((field.admin?.custom ?? {}).folderRoots ?? []).map(normalizeSlug).filter(Boolean);
@@ -3494,7 +3496,7 @@ const SlugField = ({ field, path, readOnly }) => {
3494
3496
  value: address,
3495
3497
  autoComplete: "off",
3496
3498
  spellCheck: false
3497
- }), slugLocked && !unlock.value ? /* @__PURE__ */ jsx(Button$1, {
3499
+ }), slugLocked && !unlock.value && !readOnly ? /* @__PURE__ */ jsx(Button$1, {
3498
3500
  variant: "outline",
3499
3501
  onClick: () => {
3500
3502
  setLeafDraft(slugLeaf(slugValue));