Content editor

This commit is contained in:
Kuba Orlik 2025-03-02 00:18:23 +01:00
parent a83d651a52
commit 91a8bfdc58
2 changed files with 31 additions and 19 deletions

View 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 });

View File

@ -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;