Skip to content

Commit

Permalink
refactor: extract for action executor
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Sep 23, 2024
1 parent 5bcc030 commit 4604b91
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions web/core/lib/editor/live-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ import { AiActionExecutor } from '@/editor/action/AiActionExecutor.ts';

const md = new MarkdownIt();

export const setupExtensions = (promptsManager: PromptsManager) => {
export const setupExtensions = (promptsManager: PromptsManager, actionExecutor: AiActionExecutor) => {
return [
// we define all commands here
CustomEditorCommands(new AiActionExecutor(), promptsManager,),
CustomEditorCommands(actionExecutor, promptsManager,),
AdviceExtension.configure({
HTMLAttributes: {
class: 'my-advice'
Expand Down Expand Up @@ -77,8 +77,9 @@ export const setupExtensions = (promptsManager: PromptsManager) => {
const LiveEditor = () => {
const { t } = useTranslation();

const actionExecutor = new AiActionExecutor();
const editor = useEditor({
extensions: setupExtensions(PromptsManager.getInstance()),
extensions: setupExtensions(PromptsManager.getInstance(), actionExecutor),
content: md.render(t('Editor Placeholder')),
editorProps: {
attributes: {
Expand Down

0 comments on commit 4604b91

Please sign in to comment.