Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

402 B
Raw Blame
import { Code } from 'lucide-react';

import { EditorCommand } from '@colanode/client/types';

export const CodeBlockCommand: EditorCommand = {
  key: 'code-block',
  name: 'Code',
  description: 'Insert a code block',
  keywords: ['code', 'codeblock'],
  icon: Code,
  disabled: false,
  handler: ({ editor, range }) => {
    editor.chain().focus().deleteRange(range).toggleCodeBlock().run();
  },
};