import { SourceCodeIcon } from '@zen/core/shared/icons';
import { newBlockId } from '../utils/ids.js';

const Code = {
  type: 'code',
  label: 'Bloc de code',
  icon: <SourceCodeIcon width={18} height={18} />,
  keywords: ['code', 'pre', 'snippet'],
  shortcut: '``` ',
  isText: true,
  disableShortcuts: true, // pas de markdown shortcut à l'intérieur
  textTag: 'pre',
  textClassName:
    'block w-full font-mono text-sm whitespace-pre-wrap break-words rounded-lg bg-neutral-100 dark:bg-neutral-800/80 px-4 py-3 text-neutral-900 dark:text-neutral-100',
  placeholder: 'Code…',
  create(init = {}) {
    return { id: newBlockId(), type: 'code', content: [], ...init };
  },
};

export default Code;
