ENG-1615: Only add backlink when text is selected in "Create discourse node" command (Obsidian)#986
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
There was a problem hiding this comment.
This looks good in principle, but I thought of an edge case:
What if the existing selection already has [[square brackets]], because the user added them preemptively?
I think we should test for that. Feel free to push back and decide it's scope creep, but I'd like it on record as a decision either way.
ETA: I tested, and this gets rejected as having invalid characters. Good enough.
maparent
left a comment
There was a problem hiding this comment.
Approved on second thought.
https://www.loom.com/share/a3267f6e354d4b3e9c61ab32758d7bd9
Summary
createModifyNodeModalSubmitHandlernow takeseditoras optional — only passed when an active editor is availableeditor.replaceSelection) for linking to an existing node is now gated oneditor.somethingSelected()create-discourse-nodecommand switched fromeditorCallbacktocallback, resolving the case where the command is invoked from outside an active editor (editor becomesundefined)editorviacreateDiscourseNode— no change needed thereFixes: https://linear.app/discourse-graphs/issue/ENG-1615
Test plan
🤖 Generated with Claude Code