Skip to content

Commit

Permalink
chore: updated table extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
aaryan610 committed Oct 18, 2024
1 parent 6ff940a commit 47b7853
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 22 deletions.
7 changes: 2 additions & 5 deletions packages/editor/src/core/extensions/core-without-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { IssueWidgetWithoutProps } from "./issue-embed/issue-embed-without-props
import { CustomMentionWithoutProps } from "./mentions/mentions-without-props";
import { CustomQuoteExtension } from "./quote";
import { CustomStarterKit } from "./starter-kit";
import { TableHeader, TableCell, TableRow, Table } from "./table";
import { CustomTableExtension } from "./table";
import { CustomTodoListExtension } from "./todo-list";

export const CoreEditorExtensionsWithoutProps: (Extension<any, any> | Node<any, any> | Mark<any, any>)[] = [
Expand All @@ -32,10 +32,7 @@ export const CoreEditorExtensionsWithoutProps: (Extension<any, any> | Node<any,
...CustomTodoListExtension(),
CustomCodeInlineExtension,
CustomCodeBlockExtensionWithoutProps,
Table,
TableHeader,
TableCell,
TableRow,
...CustomTableExtension,
CustomMentionWithoutProps(),
CustomColorExtension,
];
Expand Down
10 changes: 2 additions & 8 deletions packages/editor/src/core/extensions/extensions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ import {
CustomPlaceholderExtension,
CustomQuoteExtension,
CustomStarterKit,
CustomTableExtension,
CustomTodoListExtension,
CustomTypographyExtension,
DropHandlerExtension,
ImageExtension,
ListKeymap,
Table,
TableCell,
TableHeader,
TableRow,
} from "@/extensions";
// types
import { IMentionHighlight, IMentionSuggestion, TFileHandler } from "@/types";
Expand Down Expand Up @@ -72,10 +69,7 @@ export const CoreEditorExtensions = (args: TArguments): (Extension<any, any> | N
transformPastedText: true,
breaks: true,
}),
Table,
TableHeader,
TableCell,
TableRow,
...CustomTableExtension,
CustomMention({
mentionSuggestions: mentionConfig.mentionSuggestions,
mentionHighlights: mentionConfig.mentionHighlights,
Expand Down
10 changes: 2 additions & 8 deletions packages/editor/src/core/extensions/read-only-extensions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@ import {
ReadOnlyImageExtension,
CustomCodeBlockExtension,
CustomCodeInlineExtension,
TableHeader,
TableCell,
TableRow,
Table,
CustomMention,
HeadingListExtension,
CustomReadOnlyImageExtension,
CustomColorExtension,
CustomStarterKit,
CustomTodoListExtension,
CustomTableExtension,
} from "@/extensions";
// types
import { IMentionHighlight, TFileHandler } from "@/types";
Expand Down Expand Up @@ -67,10 +64,7 @@ export const CoreReadOnlyEditorExtensions = (
html: true,
transformCopiedText: true,
}),
Table,
TableHeader,
TableCell,
TableRow,
...CustomTableExtension,
CustomMention({
mentionHighlights: mentionConfig.mentionHighlights,
readOnly: true,
Expand Down
12 changes: 12 additions & 0 deletions packages/editor/src/core/extensions/table/extension.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Extension, Mark, Node } from "@tiptap/core";
import { Table } from "./table";
import { TableCell } from "./table-cell";
import { TableHeader } from "./table-header";
import { TableRow } from "./table-row";

export const CustomTableExtension: (Extension<any, any> | Node<any, any> | Mark<any, any>)[] = [
Table,
TableHeader,
TableCell,
TableRow,
];
1 change: 1 addition & 0 deletions packages/editor/src/core/extensions/table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from "./table";
export * from "./table-cell";
export * from "./table-header";
export * from "./table-row";
export * from "./extension";
3 changes: 2 additions & 1 deletion packages/editor/src/core/extensions/todo-list.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Extension, Mark, Node } from "@tiptap/core";
import TaskItem from "@tiptap/extension-task-item";
import TaskList from "@tiptap/extension-task-list";
// helpers
Expand All @@ -7,7 +8,7 @@ type Props = {
readOnly?: boolean;
};

export const CustomTodoListExtension = (props?: Props) => {
export const CustomTodoListExtension = (props?: Props): (Extension<any, any> | Node<any, any> | Mark<any, any>)[] => {
const { readOnly } = props;

return [
Expand Down

0 comments on commit 47b7853

Please sign in to comment.