Content editor
This commit is contained in:
parent
a83d651a52
commit
91a8bfdc58
30
src/back/routes/admin/pages/[id]/edit.jdd-editor.tsx
Normal file
30
src/back/routes/admin/pages/[id]/edit.jdd-editor.tsx
Normal file
@ -0,0 +1,30 @@
|
||||
import type { Context } from "koa";
|
||||
import type { FieldNames } from "sealious";
|
||||
import { TempstreamJSX } from "tempstream";
|
||||
import type Pages from "src/back/collections/pages.js";
|
||||
import { EditJDDField } from "@sealcode/jdd-editor";
|
||||
import html from "src/back/html.js";
|
||||
import { registry } from "src/back/jdd-components/registry.js";
|
||||
import { makeJDDContext } from "src/back/jdd-context.js";
|
||||
import { defaultHead } from "src/back/defaultHead.js";
|
||||
|
||||
export const actionName = "EditPateContent";
|
||||
|
||||
export default new (class JDDCreatePreviewPage extends EditJDDField<Pages> {
|
||||
getCollection(ctx: Context) {
|
||||
return ctx.$app.collections["pages"];
|
||||
}
|
||||
|
||||
getJDDFieldName(): FieldNames<Pages["fields"]> {
|
||||
return "content";
|
||||
}
|
||||
|
||||
async renderPreParameterButtons(ctx: Context) {
|
||||
const item = await this.getItem(ctx);
|
||||
return (
|
||||
<div>
|
||||
<h1>Edit pages: {item.id}</h1>{" "}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
})({ html, registry, makeJDDContext, defaultHead });
|
@ -25,16 +25,7 @@ import { imageRouter } from "src/back/image-router.js";
|
||||
export const actionName = "PagesCRUDList";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||
const filterFields = [
|
||||
{ field: "url", ...DefaultListFilters["text"] },
|
||||
{ field: "content", ...DefaultListFilters.fallback },
|
||||
{ field: "domain", ...DefaultListFilters["text"] },
|
||||
{ field: "title", ...DefaultListFilters["text"] },
|
||||
{ field: "heading", ...DefaultListFilters["text"] },
|
||||
{ field: "description", ...DefaultListFilters["text"] },
|
||||
{ field: "imageForMetadata", ...DefaultListFilters.fallback },
|
||||
{ field: "hideNavigation", ...DefaultListFilters["boolean"] },
|
||||
] as {
|
||||
const filterFields = [{ field: "title", ...DefaultListFilters["text"] }] as {
|
||||
field: keyof (typeof Pages)["fields"];
|
||||
render?: ListFilterRender;
|
||||
prepareValue?: (filter_value: unknown) => unknown; // set this function to change what filter value is passed to Sealious
|
||||
@ -43,11 +34,7 @@ const filterFields = [
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||
const displayFields = [
|
||||
{ field: "url", label: "url" },
|
||||
{ field: "content", label: "content" },
|
||||
{ field: "domain", label: "domain" },
|
||||
{ field: "title", label: "title" },
|
||||
{ field: "heading", label: "heading" },
|
||||
{ field: "description", label: "description" },
|
||||
{
|
||||
field: "imageForMetadata",
|
||||
label: "imageForMetadata",
|
||||
@ -59,11 +46,6 @@ const displayFields = [
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "hideNavigation",
|
||||
label: "hideNavigation",
|
||||
format: (v: boolean) => (v ? "YES" : "NO"),
|
||||
},
|
||||
] as {
|
||||
field: string;
|
||||
label: string;
|
||||
|
Loading…
x
Reference in New Issue
Block a user