feat: add emoji icon picker for notes stored in frontmatter

Every note can now have an optional emoji icon (frontmatter `icon` field).
The icon is displayed in the editor header, note list, search results,
and Quick Open. Includes command palette commands "Set Note Icon" and
"Remove Note Icon", plus full test coverage (Vitest + Playwright).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-03-17 22:42:55 +01:00
parent 0897cc5d95
commit ddbbebbb67
16 changed files with 779 additions and 3 deletions

View File

@@ -0,0 +1,39 @@
import { describe, it, expect } from 'vitest'
import { isEmoji } from '../emoji'
describe('isEmoji', () => {
it('returns true for common emoji', () => {
expect(isEmoji('🎯')).toBe(true)
expect(isEmoji('🔥')).toBe(true)
expect(isEmoji('🚀')).toBe(true)
expect(isEmoji('❤️')).toBe(true)
expect(isEmoji('✨')).toBe(true)
})
it('returns false for Phosphor icon names', () => {
expect(isEmoji('cooking-pot')).toBe(false)
expect(isEmoji('file-text')).toBe(false)
expect(isEmoji('rocket')).toBe(false)
expect(isEmoji('star')).toBe(false)
})
it('returns false for empty string', () => {
expect(isEmoji('')).toBe(false)
})
it('returns false for regular text', () => {
expect(isEmoji('hello')).toBe(false)
expect(isEmoji('ABC')).toBe(false)
expect(isEmoji('123')).toBe(false)
})
it('handles compound emoji (ZWJ sequences)', () => {
expect(isEmoji('👨‍💻')).toBe(true)
expect(isEmoji('🧑‍🔬')).toBe(true)
})
it('returns false for multi-emoji strings', () => {
expect(isEmoji('🔥🚀')).toBe(false)
expect(isEmoji('hi 🎯')).toBe(false)
})
})