fix: change local post prefix, fix mustLocal in getPage
This commit is contained in:
@@ -97,14 +97,14 @@ export default function SubdomainEditor() {
|
||||
let key
|
||||
if (!pageId) {
|
||||
const randomId = nanoid()
|
||||
key = `draft-${site.data?.characterId}-local-${randomId}`
|
||||
key = `draft-${site.data?.characterId}-!local-${randomId}`
|
||||
setDraftKey(key)
|
||||
queryClient.invalidateQueries([
|
||||
"getPagesBySite",
|
||||
site.data?.characterId,
|
||||
])
|
||||
router.replace(
|
||||
`/dashboard/${subdomain}/editor?id=local-${randomId}&type=${searchParams?.get(
|
||||
`/dashboard/${subdomain}/editor?id=!local-${randomId}&type=${searchParams?.get(
|
||||
"type",
|
||||
)}`,
|
||||
)
|
||||
@@ -114,7 +114,7 @@ export default function SubdomainEditor() {
|
||||
setDraftKey(key)
|
||||
setDefaultSlug(
|
||||
key
|
||||
.replace(`draft-${site.data?.characterId}-local-`, "")
|
||||
.replace(`draft-${site.data?.characterId}-!local-`, "")
|
||||
.replace(`draft-${site.data?.characterId}-`, ""),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ export const PagesManager = ({ isPost }: { isPost: boolean }) => {
|
||||
const file = (await readFiles(e.target?.files))?.[0]
|
||||
if (file) {
|
||||
const id = nanoid()
|
||||
const key = `draft-${site.data?.characterId}-local-${id}`
|
||||
const key = `draft-${site.data?.characterId}-!local-${id}`
|
||||
setStorage(key, {
|
||||
date: +new Date(),
|
||||
values: {
|
||||
@@ -130,7 +130,7 @@ export const PagesManager = ({ isPost }: { isPost: boolean }) => {
|
||||
site.data?.characterId,
|
||||
])
|
||||
router.push(
|
||||
`/dashboard/${subdomain}/editor?id=local-${id}&type=${
|
||||
`/dashboard/${subdomain}/editor?id=!local-${id}&type=${
|
||||
isPost ? "post" : "page"
|
||||
}`,
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ export const getDefaultSlug = (title: string, id?: string) => {
|
||||
?.filter((word) => word)
|
||||
?.join("-")
|
||||
?.replace(/\s+/g, "-") ||
|
||||
id?.replace(`local-`, "") ||
|
||||
id?.replace(`!local-`, "")?.replace(`local-`, "") ||
|
||||
""
|
||||
generated = generated.replace(/[^a-zA-Z0-9\s-_]/g, "")
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ export async function getPage<TRender extends boolean = false>(input: {
|
||||
noteId?: number
|
||||
handle?: string // In order to be compatible with old drafts
|
||||
}) {
|
||||
const mustLocal = input.slug?.startsWith("local-") && !input.noteId
|
||||
const mustLocal = input.slug?.startsWith("!local-") && !input.noteId
|
||||
|
||||
let page: NoteEntity | null = null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user