Skip to content

Commit

Permalink
enable custom blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
pogseal committed Sep 11, 2024
1 parent 44fed8e commit b1f09da
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 30 deletions.
32 changes: 16 additions & 16 deletions app/_custom/blocks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ export const CustomBlocks = ({ element, children, attributes }: any) => {

export const CustomBlocksAddConfig = (onSelect: any) => {
return {
label: "Custom",
items: [
{
label: "Sample Component",
icon: <Icon name="component" size={20} />,
description: "Sample component description",
onSelect: () => {
onSelect({
id: nanoid(),
stringField: "test",
type: BlockType.CustomComponent,
children: [{ text: "" }],
});
},
},
],
// label: "Custom",
// items: [
// {
// label: "Sample Component",
// icon: <Icon name="component" size={20} />,
// description: "Sample component description",
// onSelect: () => {
// onSelect({
// id: nanoid(),
// stringField: "test",
// type: BlockType.CustomComponent,
// children: [{ text: "" }],
// });
// },
// },
// ],
};
};
12 changes: 6 additions & 6 deletions app/routes/_editor+/core/components/BlockSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { Editor } from "slate";
import { Transforms } from "slate";
import { ReactEditor } from "slate-react";

// import { CustomBlocksAddConfig } from "~/_custom/blocks";
import { CustomBlocksAddConfig } from "~/_custom/blocks";
import { Icon } from "~/components/Icon";
import { Tooltip, TooltipContent, TooltipTrigger } from "~/components/Tooltip";
import { MobileTray } from "~/routes/_site+/_components/MobileTray";
Expand Down Expand Up @@ -394,11 +394,11 @@ export function BlockSelector({ element, editor, isSelectorOpen }: Props) {
},
];

//If custom site has blocks, add to select options
// const customBlocks = CustomBlocksAddConfig(onInsertBelow);
// if (customBlocks) {
// groups.push(customBlocks);
// }
// If custom site has blocks, add to select options
const customBlocks = CustomBlocksAddConfig(onInsertBelow);
if (customBlocks) {
groups.push(customBlocks);
}

const [isEditorTrayOpen, setEditorTray] = useState(false);

Expand Down
13 changes: 6 additions & 7 deletions app/routes/_editor+/core/components/EditorBlocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import urlSlug from "url-slug";

import { CustomBlocks } from "~/_custom/blocks";
import { Loading } from "~/components/Loading";
import { TableBody, TableHead, TableRow } from "~/components/Table";
import { TableHead } from "~/components/Table";

import { BlockEmbed } from "../../blocks+/embed";
import { BlockEventItem, BlockEvents } from "../../blocks+/events/_events";
Expand Down Expand Up @@ -99,16 +99,15 @@ export function EditorBlocks({
return (
<h3
id={id}
className="flex max-laptop:flex-col laptop:items-center dark:text-zinc-100 gap-1 tablet:gap-3 pb-1.5 mt-6 font-header text-xl scroll-mt-20"
className="dark:bg-dark350 border dark:border-zinc-700 bg-zinc-50 rounded-md py-1.5 px-3.5 mb-2 dark:text-zinc-100 mt-6
font-header text-base scroll-mt-20 shadow-sm shadow-zinc-50 dark:shadow-zinc-800/30 border-zinc-200/90 relative overflow-hidden"
{...attributes}
>
<div className="min-w-[10px] flex-none whitespace-pre-wrap">
{children}
</div>
<div
<span
contentEditable={false}
className="h-1 w-full rounded-full bg-zinc-100 dark:bg-dark400"
className="h-full w-1.5 select-none bg-zinc-200/40 dark:bg-dark450/80 absolute top-0 left-0"
/>
{children}
</h3>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function fetchListCore({

const LIST_QUERY = gql`
query {
listData: ${label}(limit:5000) {
listData: ${label}(limit:12000) {
totalDocs
docs {
id
Expand Down

0 comments on commit b1f09da

Please sign in to comment.