Skip to content

Commit

Permalink
refactor: export for more utils
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Sep 23, 2024
1 parent 72c0ce1 commit 3143022
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { PluginKey } from '@tiptap/pm/state';
import { FacetType } from '@/editor/defs/custom-action.type';
import { PromptsManager } from '@/editor/prompts/prompts-manager';

export const createSlashExtension = (extensionName: string, promptsManager: PromptsManager = PromptsManager.getInstance()) => {
export const createSlashExtension = (promptsManager: PromptsManager = PromptsManager.getInstance()) => {
const extensionName = 'ai-slash';

return Node.create({
name: "slash-command",
addOptions() {
Expand Down
14 changes: 6 additions & 8 deletions web/core/lib/editor/live-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,26 @@ import { TableRow } from "@tiptap/extension-table-row";
import { TableCell } from "@tiptap/extension-table-cell";
import { TableHeader } from "@tiptap/extension-table-header";

import { useTranslation } from "react-i18next";
import MarkdownIt from 'markdown-it'
import { useTranslation } from "react-i18next";
import { useDebounce } from 'use-debounce';

import "./editor.css"

import { InlineCompletion } from "@/editor/extensions/inline-completion/inline-completion";
import { MenuBubble } from '@/editor/menu/menu-bubble'
import { createSlashExtension } from './extensions/slash-command/slash-extension'
import { createSlashExtension } from '@/editor/extensions/slash-command/slash-extension.ts'
import { createQuickBox } from '@/editor/extensions/quick-box/quick-box-extension'
import { AdviceExtension } from '@/editor/extensions/advice/advice-extension';

import { ToolbarMenu } from './menu/toolbar-menu'
import { CustomEditorCommands } from './action/custom-editor-commands'
import { Sidebar } from './components/sidebar'
import { ToolbarMenu } from '@/editor/menu/toolbar-menu.tsx'
import { CustomEditorCommands } from '@/editor/action/custom-editor-commands.ts'
import { Sidebar } from '@/editor/components/sidebar.tsx'
import { Advice } from "@/editor/extensions/advice/advice";
import { AdviceManager } from "@/editor/extensions/advice/advice-manager";
import { AdviceView } from "@/editor/extensions/advice/advice-view";
import { Settings } from "@/editor/components/settings";
import { PromptsManager } from '@/editor/prompts/prompts-manager.ts';


const md = new MarkdownIt()

export const setupExtensions = (promptsManager: PromptsManager = PromptsManager.getInstance()) => {
Expand Down Expand Up @@ -61,7 +59,7 @@ export const setupExtensions = (promptsManager: PromptsManager = PromptsManager.
keepAttributes: false,
},
}),
createSlashExtension('ai-slash', promptsManager),
createSlashExtension(promptsManager),
createQuickBox(),
CharacterCount.configure({}),
Color.configure({ types: [TextStyle.name, ListItem.name] }),
Expand Down
14 changes: 14 additions & 0 deletions web/core/lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,17 @@ export { default as LiveEditor } from '@/editor/live-editor';
export { setupExtensions } from '@/editor/live-editor';
export { ToolbarMenu } from '@/editor/menu/toolbar-menu';
export { PromptsManager } from '@/editor/prompts/prompts-manager.ts';
/// eslint-disable import/prefer-default-export
import { InlineCompletion } from '@/editor/extensions/inline-completion/inline-completion';
import { MenuBubble } from '@/editor/menu/menu-bubble';
import { createSlashExtension } from '@/editor/extensions/slash-command/slash-extension.ts';
import { createQuickBox } from '@/editor/extensions/quick-box/quick-box-extension';
import { AdviceExtension } from '@/editor/extensions/advice/advice-extension';
import { ToolbarMenu } from '@/editor/menu/toolbar-menu.tsx';
import { CustomEditorCommands } from '@/editor/action/custom-editor-commands.ts';
import { Sidebar } from '@/editor/components/sidebar.tsx';
import { Advice } from '@/editor/extensions/advice/advice';
import { AdviceManager } from '@/editor/extensions/advice/advice-manager';
import { AdviceView } from '@/editor/extensions/advice/advice-view';
import { Settings } from '@/editor/components/settings';
import { PromptsManager } from '@/editor/prompts/prompts-manager.ts';

0 comments on commit 3143022

Please sign in to comment.