Skip to content

Commit

Permalink
Replace slugify by stringToPathname
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasKn committed Apr 25, 2024
1 parent 66f8fed commit 0081faf
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import {
usePresentationParams,
} from "@sanity/presentation";
import { Box, Button, Card, Flex, Stack, Text, TextInput } from "@sanity/ui";
import {
getDocumentPath,
slugify,
stringToPathname,
} from "@tinloof/sanity-web";
import { getDocumentPath, stringToPathname } from "@tinloof/sanity-web";
import React, { useCallback, useMemo, useRef, useState } from "react";
import { ObjectFieldProps, set, SlugValue, unset, useFormValue } from "sanity";
import { styled } from "styled-components";
Expand Down Expand Up @@ -56,7 +52,7 @@ export function PathnameFieldComponent(

const updateFinalSegment = useCallback(
(e: React.FormEvent<HTMLInputElement>) => {
const segment = slugify(e.currentTarget.value);
const segment = stringToPathname(e.currentTarget.value);
// When updating only the final path segment, we don't allow slashes / sub-paths.
// User must unlock the folder before doing so.
const finalValue = [folder, segment]
Expand Down

0 comments on commit 0081faf

Please sign in to comment.