diff --git a/components/Blocks/Block.tsx b/components/Blocks/Block.tsx
index 1f7ca9bb..f1de927f 100644
--- a/components/Blocks/Block.tsx
+++ b/components/Blocks/Block.tsx
@@ -33,6 +33,7 @@ import { HorizontalRule } from "./HorizontalRule";
import { deepEquals } from "src/utils/deepEquals";
import { isTextBlock } from "src/utils/isTextBlock";
import { focusPage } from "src/utils/focusPage";
+import { DeleteTiny } from "components/Icons/DeleteTiny";
export type Block = {
factID: string;
@@ -85,6 +86,20 @@ export const Block = memo(function Block(
let selected = useUIState(
(s) => !!s.selectedBlocks.find((b) => b.value === props.entityID),
);
+ let alignment = useEntity(props.value, "block/text-alignment")?.data.value;
+
+ let alignmentStyle =
+ props.type === "button" || props.type === "image"
+ ? "justify-center"
+ : "justify-start";
+
+ if (alignment)
+ alignmentStyle = {
+ left: "justify-start",
+ right: "justify-end",
+ center: "justify-center",
+ justify: "justify-start",
+ }[alignment];
let [areYouSure, setAreYouSure] = useState(false);
useEffect(() => {
@@ -120,6 +135,8 @@ export const Block = memo(function Block(
blockWrapper relative
flex flex-row gap-2
px-3 sm:px-4
+ z-1 w-full
+ ${alignmentStyle}
${
!props.nextBlock
? "pb-3 sm:pb-4"
@@ -258,26 +275,10 @@ export const BaseBlock = (
) => {
// BaseBlock renders the actual block content, delete states, controls spacing between block and list markers
let BlockTypeComponent = BlockTypeComponents[props.type];
- let alignment = useEntity(props.value, "block/text-alignment")?.data.value;
-
- let alignmentStyle =
- props.type === "button" || props.type === "image"
- ? "justify-center"
- : "justify-start";
-
- if (alignment)
- alignmentStyle = {
- left: "justify-start",
- right: "justify-end",
- center: "justify-center",
- justify: "justify-start",
- }[alignment];
if (!BlockTypeComponent) return
unknown block
;
return (
-
+ <>
{props.listData &&
}
{props.areYouSure ? (
)}
-
+ >
);
};
@@ -393,22 +394,41 @@ export const BlockLayout = (props: {
className?: string;
hasBackground?: "accent" | "page";
borderOnHover?: boolean;
+ hasAlignment?: boolean;
}) => {
+ // this is used to wrap non-text blocks in consistent selected styling, spacing, and top level options like delete
return (
-
+
- {props.children}
+ style={{
+ backgroundColor:
+ props.hasBackground === "accent"
+ ? "var(--accent-light)"
+ : props.hasBackground === "page"
+ ? "rgb(var(--bg-page))"
+ : "transparent",
+ }}
+ >
+ {props.children}
+
+ {props.isSelected &&
}
+
+ );
+};
+
+const DeleteBlock = () => {
+ return (
+
+
);
};
diff --git a/components/Blocks/CodeBlock.tsx b/components/Blocks/CodeBlock.tsx
index 83f98ed5..9a1cc86a 100644
--- a/components/Blocks/CodeBlock.tsx
+++ b/components/Blocks/CodeBlock.tsx
@@ -68,58 +68,6 @@ export function CodeBlock(props: BlockProps) {
}, []);
return (
- {permissions.write && (
-
-
- Theme:{" "}
-
-
-
-
- )}
-
)}
+ {permissions.write && (
+
+
+ Theme:{" "}
+
+
+
+
+ )}
);
}
diff --git a/components/Blocks/ImageBlock.tsx b/components/Blocks/ImageBlock.tsx
index ab225d03..b374de53 100644
--- a/components/Blocks/ImageBlock.tsx
+++ b/components/Blocks/ImageBlock.tsx
@@ -150,7 +150,11 @@ export function ImageBlock(props: BlockProps & { preview?: boolean }) {
`;
return (
-
+
{isLocalUpload || image.data.local ? (
![]()