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.

678 B
Raw Blame
import {
  NODE_TRANSFORM,
  type NodeTransformType,
} from '@core/component/LexicalMarkdown/plugins';
import {
  FORMAT_TEXT_COMMAND,
  type LexicalEditor,
  type TextFormatType,
} from 'lexical';

export function applyInlineFormat(
  editor: LexicalEditor,
  format: TextFormatType
) {
  try {
    editor.focus();
    editor.dispatchCommand(FORMAT_TEXT_COMMAND, format);
  } catch {
    console.error('failed to apply formatting');
  }
}

export function applyNodeFormat(
  editor: LexicalEditor,
  format: NodeTransformType
) {
  try {
    editor.focus();
    editor.dispatchCommand(NODE_TRANSFORM, format);
  } catch {
    console.error('failed to apply formatting');
  }
}