Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

1.1 KB
Raw Blame
import { useMacroMentionLinkResolver } from '@components/app/split-layout/split-router/mention-links';
import { EditorConfigBuilder } from '@core/component/LexicalMarkdown/builder/MarkdownConfigBuilder';
import { MarkdownShell } from '@core/component/LexicalMarkdown/builder/MarkdownShell';
import { useRoutinePromptMentionUsers } from './routine-prompt-mention-users';

export function RoutinePromptEditor(props: {
  initialValue: string;
  disabled?: boolean;
  onChange: (markdown: string) => void;
}) {
  const editor = new EditorConfigBuilder()
    .withAppLinkResolver(useMacroMentionLinkResolver())
    .namespace('routine-prompt')
    .withHistory()
    .withLinks()
    .withMentions({ users: useRoutinePromptMentionUsers() })
    .onChange(props.onChange);

  return (
    <div class="min-h-28 **:[[contenteditable]]:text-sm **:[[contenteditable]]:outline-none cursor-default">
      <MarkdownShell
        config={editor}
        initialValue={props.initialValue}
        disabled={props.disabled}
        placeholder="What should this routine do? Type @ to add context…"
        portalScope="local"
        class="min-h-28"
      />
    </div>
  );
}