Skip to content

Latest commit

Β 

History

History
231 lines (179 loc) Β· 6.72 KB

File metadata and controls

231 lines (179 loc) Β· 6.72 KB

Laverna Features Added to Notevo

This document summarizes the features from the original Laverna project that have been added to Notevo.

βœ… Completed Additions

1. Database Schema Enhancements

New Tables

  • tags - Separate tag entity for better management (Laverna feature)

    • Fields: id, user_id, name, color, created_at, updated_at
    • Unique constraint on (user_id, name)
  • user_settings - User preferences and configurations (Laverna configs feature)

    • Fields: theme, editor_mode, enable_mathjax, enable_syntax_highlighting, font_size, auto_save, keybindings_preset, language
    • One settings record per user

Enhanced Notes Table

  • Added pinned boolean field for pinning important notes

New Indexes

  • GIN index on notes.tags for fast tag searching
  • Indexes on tags.user_id and tags.name
  • Index on user_settings.user_id

Row Level Security

  • Full RLS policies for tags and user_settings tables
  • Auto-update triggers for all new tables

2. Type Definitions (src/lib/types.ts)

Added TypeScript interfaces:

  • Tag - Tag entity with color support
  • UserSettings - Complete user preferences including:
    • Theme selection (light/dark/system)
    • Editor modes (normal/preview/distraction_free)
    • MathJax toggle
    • Syntax highlighting toggle
    • Font size configuration
    • Auto-save preference
    • Keybindings preset (default/vim/emacs)
    • Language selection
  • ExportData - Structure for import/export operations

3. Import/Export System (src/lib/import-export.ts)

Full ZIP-based backup and restore functionality (Laverna feature):

Functions:

  • exportAllData() - Export all notes, notebooks, tags, and settings to ZIP
  • importFromZip() - Import data from ZIP backup file
  • exportNotes() - Export selected notes only
  • validateExportData() - Validate export structure

Features:

  • Exports notes as both JSON (metadata) and Markdown (content)
  • Includes manifest with version and export date
  • Error handling with detailed error messages
  • Compatible with Laverna's export format structure

4. Keyboard Shortcuts System (src/lib/keybindings.ts)

Customizable keyboard shortcuts (Laverna feature):

Presets:

  • Default - Standard shortcuts (Ctrl+N, Ctrl+S, etc.)
  • Vim - Vim-style keybindings
  • Emacs - Emacs-style keybindings

Supported Actions:

  • New note, Save note, Delete note
  • Toggle preview, Distraction-free mode
  • Search, Toggle sidebar
  • Formatting: Bold, Italic, Link, Quote
  • Lists: Unordered, Ordered
  • Headings: H1, H2, H3

Functions:

  • getKeybindingsForPreset() - Get keybindings by preset
  • eventMatchesKeybinding() - Check if event matches keybinding
  • formatKeybinding() - Format keybinding for display (e.g., "Ctrl+S")
  • registerGlobalKeybindings() - Register global keyboard handlers
  • getAvailableActions() - List all available actions

5. Markdown Extensions (src/lib/markdown-extensions.ts)

Enhanced markdown processing (Laverna features):

Task/Todo Lists:

  • toggleTaskItem() - Toggle checkbox state
  • parseTaskItems() - Extract all tasks from content
  • getTaskStats() - Get completion statistics

Code Blocks & Syntax Highlighting:

  • ensureCodeBlockLanguage() - Add default language to code blocks
  • extractCodeBlocks() - Extract all code blocks with languages

MathJax Support:

  • hasMathExpressions() - Detect LaTeX/math in content
  • extractMathExpressions() - Extract all math expressions

Editor Utilities:

  • insertFormatting() - Insert formatting at cursor
  • applyHeading() - Apply heading levels
  • countWords() - Word count (excluding code)
  • estimateReadingTime() - Reading time estimate

πŸ“‹ Migration Instructions

1. Run Database Migrations

Execute the updated migration file in your Supabase dashboard:

-- Run the contents of supabase/migrations/0001_init.sql

Or using Supabase CLI:

supabase db push

2. Install Dependencies

The import/export system requires additional packages:

npm install jszip file-saver
npm install -D @types/file-saver

3. Update Package.json

Add to dependencies:

{
  "dependencies": {
    "jszip": "^3.x",
    "file-saver": "^2.x"
  }
}

🎯 Next Steps for Implementation

Frontend Components Needed

  1. Settings Page (/dashboard/settings)

    • Tabbed interface for different settings categories
    • Theme selector
    • Editor mode selector
    • Keybindings preset selector
    • Language selector
    • Font size slider
  2. Import/Export UI

    • Export button in settings or sidebar
    • Import dialog with file picker
    • Progress indicator
    • Error/success messages
  3. Tag Management

    • Tag list view
    • Tag color picker
    • Tag filtering in notes list
    • Tag autocomplete in note editor
  4. Keyboard Shortcuts Help

    • Modal showing all shortcuts
    • Customizable keybindings UI
    • Preset selector
  5. Editor Toolbar Enhancements

    • Task list checkbox button
    • MathJax toggle
    • Syntax highlighting toggle
    • Heading level selector
  6. Distraction-Free Mode

    • Full-screen editor
    • Hide sidebar and other UI elements
    • Escape key to exit

Backend/Server Actions Needed

  1. Tags CRUD

    • Create, read, update, delete tags
    • Link tags to notes
    • Get tags by user
  2. User Settings CRUD

    • Get user settings
    • Update user settings
    • Initialize default settings on signup
  3. Import/Export Server Actions

    • Handle bulk note import
    • Handle bulk note export
    • Conflict resolution

πŸ“Š Feature Comparison

Feature Original Laverna Notevo (Before) Notevo (After)
Markdown Editor βœ… βœ… βœ…
Client-side Encryption βœ… βœ… βœ…
Tags (separate) βœ… ❌ βœ…
User Settings βœ… ❌ βœ…
Import/Export (ZIP) βœ… ❌ βœ…
Keyboard Shortcuts βœ… ❌ βœ…
Task Lists βœ… ❌ βœ… (utils)
MathJax βœ… ❌ βœ… (utils)
Syntax Highlighting βœ… ❌ βœ… (utils)
Distraction-Free βœ… ❌ ⏳ (ready)
Multiple Edit Modes βœ… ⚠️ Partial ⚠️ Partial
Dropbox Sync βœ… ❌ ❌ (N/A - Supabase)
RemoteStorage βœ… ❌ ❌ (N/A - Supabase)
Desktop App βœ… ❌ ❌ (future)
Mobile App βœ… ❌ ❌ (future)

βœ… = Implemented ⚠️ = Partially implemented ❌ = Not implemented ⏳ = Ready for implementation

πŸ“ Notes

  • Some Laverna features (Dropbox/RemoteStorage sync) are not needed due to Supabase backend
  • Desktop and mobile apps can be future enhancements
  • The modular architecture of Laverna was replaced with a more modern Next.js structure
  • All security features from the original review have been maintained and enhanced