- ✅ Markdown editor replaces textarea in task creation modal NLP field
- ✅ Ctrl+Enter saves the task - keyboard shortcut works!
- ✅ Live preview updates as you type
- ✅ Rich markdown editing with syntax highlighting
- ✅ Wikilinks work - can type
[[to create links - ✅ Proper cleanup on modal close
- ✅ Fallback to textarea if editor fails to initialize
- ✅ CSS styling - proper height constraints and visual design
- Build:
npm run build - Reload Obsidian
- Open task creation modal (with NLP enabled in settings)
- Type in the NLP field - you should see:
- Rich markdown formatting
- Wikilinks work with
[[ - Ctrl+Enter saves the task
- Preview updates below
- ❌
@context autocomplete - old system expects textarea - ❌
#tag autocomplete - old system expects textarea - ❌
+project autocomplete - old system expects textarea - ❌ Status trigger autocomplete - old system expects textarea
The current NLPSuggest class (lines 57-542 in TaskCreationModal.ts):
- Extends
AbstractInputSuggest<HTMLInputElement> - Directly accesses
textarea.selectionStart,textarea.value - Uses Obsidian's suggestion popup system
- Only works with standard HTML inputs/textareas
The markdown editor uses:
- CodeMirror's state/transaction system
- Different API for cursor position and text content
- Needs CodeMirror's autocomplete extensions
Simply don't initialize NLPSuggest for markdown editor:
// In createNaturalLanguageInput()
// Comment out or conditionally skip:
// this.nlpSuggest = new NLPSuggest(this.app, this.nlInput, this.plugin);Users still get rich markdown editing but lose @, #, + autocomplete.
Create new autocomplete system using @codemirror/autocomplete:
-
Create
NLPCodeMirrorAutocomplete.ts- Import
autocompletion,CompletionContextfrom@codemirror/autocomplete - Detect trigger characters (
@,#,+, status trigger) - Query cache manager for suggestions
- Return formatted completion options
- Import
-
Add to
EmbeddableMarkdownEditor- Accept autocomplete extension as optional parameter
- Include in
buildLocalExtensions()
-
Wire up in
TaskCreationModal- Create NLP autocomplete instance
- Pass to markdown editor constructor
Estimated effort: 4-6 hours for full implementation
src/editor/EmbeddableMarkdownEditor.ts(Phase 1 - POC)
src/modals/TaskCreationModal.ts- Added
EmbeddableMarkdownEditorimport - Replaced textarea with markdown editor in
createNaturalLanguageInput() - Added
getNLPInputValue()helper method - Added
onClose()cleanup
- Added
styles/task-modal.css- Added
.nl-markdown-editorstyling - Height: 80-200px with scrolling
- Focus state styling
- Added
Option 1: Ship Phase 1 as-is
- ✅ Rich markdown editing
- ✅ Ctrl+Enter shortcut
- ❌ No @ # + autocomplete
- Users can manually type @context #tag +[[project]]
Option 2: Complete Phase 2
- ✅ Everything from Phase 1
- ✅ @ # + autocomplete working
- ⏱️ Requires additional 4-6 hours of development
- 🐛 Higher risk of bugs (new autocomplete system)
Option 3: Hybrid - Add setting to toggle
- Let users choose between:
- Old textarea with autocomplete
- New markdown editor without autocomplete (yet)
- Ship Phase 1 now, Phase 2 later
- NLP markdown editor appears in task creation modal
- Can type markdown text with formatting
- Can create wikilinks with
[[ - Ctrl+Enter saves the task
- Preview updates in real-time
- Modal closes cleanly without errors
- Fallback textarea works if editor fails
- Focus is set to editor on modal open
- Autocomplete not functional (Phase 2 required)
- Plugin extensions not included - other plugins' CM extensions won't load
- Internal API dependency - may break in future Obsidian versions
- No read/write mode toggle - always editable
- Fevol - Original embeddable markdown editor implementation
- mgmeyers - Kanban plugin inspiration
DECISION NEEDED: Should we continue to Phase 2 (autocomplete), or test Phase 1 first?