Skip to content

Build Size Optimzation#17

Open
thatsjet wants to merge 1 commit intomainfrom
next
Open

Build Size Optimzation#17
thatsjet wants to merge 1 commit intomainfrom
next

Conversation

@thatsjet
Copy link
Owner

Replace MDEditor with lightweight native textarea editor

Summary

  • Remove the @uiw/react-md-editor third-party dependency and replace it with a native <textarea> and custom markdown formatting toolbar, significantly reducing bundle size and eliminating DOM hacking workarounds
  • Lazy-load LLM provider modules via dynamic import() in the provider registry to improve startup performance
  • Add file editor with line numbers, markdown toolbar, word wrap support, system prompt relocation, and keyboard shortcut fixes (from prior commits on this branch)

Changes

File Editor rewrite (src/renderer/components/FileEditor.tsx, src/renderer/styles/FileEditor.css)

  • Replaced @uiw/react-md-editor with a plain <textarea> and a custom toolbar with bold, italic, strikethrough, link, quote, code, code block, bullet list, numbered list, and checklist actions
  • Toolbar actions use document.execCommand('insertText') to preserve native undo/redo history
  • Tab key inserts 2-space indentation
  • Simplified scroll sync and line-height measurement — removed MutationObserver hacks that were needed to wait for MDEditor's internal DOM
  • Removed the keydown capture-phase workaround that prevented MDEditor from swallowing system shortcuts (Cmd+Q, Cmd+C, etc.)

Provider lazy loading (src/main/providers/registry.ts, src/main/main.ts)

  • getProvider() is now async with dynamic import() for Anthropic and OpenAI provider modules
  • Both call sites updated to await getProvider(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant