diff --git a/components/Blocks/TextBlock/index.tsx b/components/Blocks/TextBlock/index.tsx
index 4d80912f..256a252d 100644
--- a/components/Blocks/TextBlock/index.tsx
+++ b/components/Blocks/TextBlock/index.tsx
@@ -42,9 +42,7 @@ const HeadingStyle = {
3: "text-base font-bold text-secondary ",
} as { [level: number]: string };
-export function TextBlock(
- props: BlockProps & { className?: string; preview?: boolean },
-) {
+export function TextBlock(props: BlockProps & { preview?: boolean }) {
let isLocked = useEntity(props.entityID, "block/is-locked");
let initialized = useInitialPageLoad();
let first = props.previousBlock === null;
@@ -59,7 +57,6 @@ export function TextBlock(
@@ -115,7 +112,6 @@ export function IOSBS(props: BlockProps) {
export function RenderedTextBlock(props: {
entityID: string;
- className?: string;
first?: boolean;
pageType?: "canvas" | "doc";
type: BlockProps["type"];
@@ -136,18 +132,13 @@ export function RenderedTextBlock(props: {
if (permissions.write && (props.first || props.pageType === "canvas"))
content = (
- {headingLevel?.data.value === 1
- ? "Title"
- : headingLevel?.data.value === 2
- ? "Header"
- : headingLevel?.data.value === 3
- ? "Subheader"
- : "write something..."}
-
- or type "/" for commands
-
+
);
} else {
@@ -170,14 +161,14 @@ export function RenderedTextBlock(props: {
className={`
${alignmentClass}
${props.type === "heading" ? HeadingStyle[headingLevel?.data.value || 1] : ""}
- w-full whitespace-pre-wrap outline-none ${props.className} `}
+ w-full whitespace-pre-wrap outline-none`}
>
{content}
);
}
-export function BaseTextBlock(props: BlockProps & { className?: string }) {
+export function BaseTextBlock(props: BlockProps) {
let mountRef = useRef(null);
let actionTimeout = useRef(null);
let repRef = useRef>(null);
@@ -370,32 +361,21 @@ export function BaseTextBlock(props: BlockProps & { className?: string }) {
outline-none
${props.type === "heading" ? HeadingStyle[headingLevel?.data.value || 1] : ""}
- ${props.className}`}
+ `}
ref={mountRef}
/>
{editorState?.doc.textContent.length === 0 &&
props.previousBlock === null &&
props.nextBlock === null ? (
// if this is the only block on the page and is empty or is a canvas, show placeholder
-
- {props.type === "text"
- ? "write something..."
- : headingLevel?.data.value === 3
- ? "Subheader"
- : headingLevel?.data.value === 2
- ? "Header"
- : "Title"}
-
- or type "/" to add a block
-
-
+
) : editorState?.doc.textContent.length === 0 && focused ? (
// if not the only block on page but is the block is empty and selected, but NOT multiselected show add button
-
+
) : null}
{editorState?.doc.textContent.startsWith("/") && selected && (
@@ -410,6 +390,31 @@ export function BaseTextBlock(props: BlockProps & { className?: string }) {
);
}
+const PlaceholderText = (props: {
+ type: BlockProps["type"];
+ headingLevel?: number;
+ alignmentClass: string;
+}) => {
+ return (
+
+ {props.type === "text"
+ ? "write something..."
+ : props.headingLevel === 3
+ ? "Subheader"
+ : props.headingLevel === 2
+ ? "Header"
+ : "Title"}
+
+ or type "/" to add a block
+
+
+ );
+};
+
const BlockifyLink = (props: {
entityID: string;
editorState: EditorState | undefined;
@@ -468,7 +473,7 @@ const BlockifyLink = (props: {
} else return null;
};
-const CommandOptions = (props: BlockProps & { className?: string }) => {
+const CommandOptions = (props: BlockProps) => {
let rep = useReplicache();
let entity_set = useEntitySetContext();
return (
@@ -476,7 +481,6 @@ const CommandOptions = (props: BlockProps & { className?: string }) => {
className={`absolute top-0 right-0 w-fit flex gap-[6px] items-center font-bold rounded-md text-sm text-border ${props.pageType === "canvas" && "mr-[6px]"}`}
>
{
let command = blockCommands.find((f) => f.name === "Image");
if (!rep.rep) return;
@@ -495,7 +499,6 @@ const CommandOptions = (props: BlockProps & { className?: string }) => {
{
let command = blockCommands.find((f) => f.name === "New Page");
if (!rep.rep) return;
@@ -514,7 +517,6 @@ const CommandOptions = (props: BlockProps & { className?: string }) => {
{
e.preventDefault();
let editor = useEditorStates.getState().editorStates[props.entityID];