{
editor?.chain().focus().run();
}}
- className={`tiptap-editor-container relative ${editorClassNames}`}
+ className={`tiptap-editor-container cursor-text relative ${editorClassNames}`}
>
{editor &&
diff --git a/apps/app/components/tiptap/slash-command/index.tsx b/apps/app/components/tiptap/slash-command/index.tsx
index ab93945a9..94899d41c 100644
--- a/apps/app/components/tiptap/slash-command/index.tsx
+++ b/apps/app/components/tiptap/slash-command/index.tsx
@@ -1,11 +1,4 @@
-import React, {
- useState,
- useEffect,
- useCallback,
- ReactNode,
- useRef,
- useLayoutEffect,
-} from "react";
+import React, { useState, useEffect, useCallback, ReactNode, useRef, useLayoutEffect } from "react";
import { Editor, Range, Extension } from "@tiptap/core";
import Suggestion from "@tiptap/suggestion";
import { ReactRenderer } from "@tiptap/react";
@@ -42,15 +35,7 @@ const Command = Extension.create({
return {
suggestion: {
char: "/",
- command: ({
- editor,
- range,
- props,
- }: {
- editor: Editor;
- range: Range;
- props: any;
- }) => {
+ command: ({ editor, range, props }: { editor: Editor; range: Range; props: any }) => {
props.command({ editor, range });
},
},
@@ -74,12 +59,7 @@ const getSuggestionItems = ({ query }: { query: string }) =>
searchTerms: ["p", "paragraph"],
icon:
,
command: ({ editor, range }: CommandProps) => {
- editor
- .chain()
- .focus()
- .deleteRange(range)
- .toggleNode("paragraph", "paragraph")
- .run();
+ editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").run();
},
},
{
@@ -88,12 +68,7 @@ const getSuggestionItems = ({ query }: { query: string }) =>
searchTerms: ["title", "big", "large"],
icon:
,
command: ({ editor, range }: CommandProps) => {
- editor
- .chain()
- .focus()
- .deleteRange(range)
- .setNode("heading", { level: 1 })
- .run();
+ editor.chain().focus().deleteRange(range).setNode("heading", { level: 1 }).run();
},
},
{
@@ -102,12 +77,7 @@ const getSuggestionItems = ({ query }: { query: string }) =>
searchTerms: ["subtitle", "medium"],
icon:
,
command: ({ editor, range }: CommandProps) => {
- editor
- .chain()
- .focus()
- .deleteRange(range)
- .setNode("heading", { level: 2 })
- .run();
+ editor.chain().focus().deleteRange(range).setNode("heading", { level: 2 }).run();
},
},
{
@@ -116,12 +86,7 @@ const getSuggestionItems = ({ query }: { query: string }) =>
searchTerms: ["subtitle", "small"],
icon:
,
command: ({ editor, range }: CommandProps) => {
- editor
- .chain()
- .focus()
- .deleteRange(range)
- .setNode("heading", { level: 3 })
- .run();
+ editor.chain().focus().deleteRange(range).setNode("heading", { level: 3 }).run();
},
},
{
@@ -148,7 +113,7 @@ const getSuggestionItems = ({ query }: { query: string }) =>
searchTerms: ["line", "divider", "horizontal", "rule", "separate"],
icon:
,
command: ({ editor, range }: CommandProps) => {
- editor.chain().focus().deleteRange(range).setHorizontalRule().run()
+ editor.chain().focus().deleteRange(range).setHorizontalRule().run();
},
},
{
@@ -209,12 +174,11 @@ const getSuggestionItems = ({ query }: { query: string }) =>
return (
item.title.toLowerCase().includes(search) ||
item.description.toLowerCase().includes(search) ||
- (item.searchTerms &&
- item.searchTerms.some((term: string) => term.includes(search)))
+ (item.searchTerms && item.searchTerms.some((term: string) => term.includes(search)))
);
}
return true;
- });;
+ });
export const updateScrollView = (container: HTMLElement, item: HTMLElement) => {
const containerHeight = container.offsetHeight;
@@ -250,7 +214,7 @@ const CommandList = ({
command(item);
}
},
- [command, items],
+ [command, items]
);
useEffect(() => {
@@ -297,12 +261,13 @@ const CommandList = ({
- {items.map((item: CommandItemProps, index: number) =>
+ {items.map((item: CommandItemProps, index: number) => (
- )}
+ ))}
) : null;
};
@@ -320,6 +285,8 @@ const renderItems = () => {
let component: ReactRenderer | null = null;
let popup: any | null = null;
+ const container = document.querySelector("#tiptap-container") as HTMLElement;
+
return {
onStart: (props: { editor: Editor; clientRect: DOMRect }) => {
component = new ReactRenderer(CommandList, {
@@ -330,7 +297,7 @@ const renderItems = () => {
// @ts-ignore
popup = tippy("body", {
getReferenceClientRect: props.clientRect,
- appendTo: () => document.body,
+ appendTo: () => container,
content: component.element,
showOnCreate: true,
interactive: true,
diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/pages/[pageId].tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/pages/[pageId].tsx
index ed52f447a..0502e9e87 100644
--- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/pages/[pageId].tsx
+++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/pages/[pageId].tsx
@@ -629,17 +629,19 @@ const SinglePage: NextPage = () => {
ref={provided.innerRef}
{...provided.droppableProps}
>
- {pageBlocks.map((block, index) => (
-
- ))}
- {provided.placeholder}
+ <>
+ {pageBlocks.map((block, index) => (
+
+ ))}
+ {provided.placeholder}
+ >