breadcrumbs-panel.ts 948 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { EditorView } from '@codemirror/view'
  2. const breadcrumbsTheme = EditorView.baseTheme({
  3. '.ol-cm-breadcrumbs-portal': {
  4. display: 'flex',
  5. pointerEvents: 'none !important',
  6. '& > *': {
  7. pointerEvents: 'all',
  8. },
  9. },
  10. '.ol-cm-breadcrumbs': {
  11. height: 'var(--breadcrumbs-height)',
  12. flex: 1,
  13. display: 'flex',
  14. alignItems: 'center',
  15. gap: 'var(--spacing-01)',
  16. fontSize: 'var(--font-size-01)',
  17. padding: 'var(--spacing-02)',
  18. overflow: 'auto',
  19. scrollbarWidth: 'thin',
  20. '& > *': {
  21. flexShrink: '0',
  22. },
  23. },
  24. '&light .ol-cm-breadcrumb-chevron': {
  25. color: 'var(--neutral-30)',
  26. },
  27. '&dark .ol-cm-breadcrumb-chevron': {
  28. color: 'var(--neutral-50)',
  29. },
  30. })
  31. /**
  32. * A panel which contains the editor breadcrumbs
  33. */
  34. export function breadcrumbPanel() {
  35. return [
  36. EditorView.editorAttributes.of({
  37. style: '--breadcrumbs-height: 28px;',
  38. }),
  39. breadcrumbsTheme,
  40. ]
  41. }