yogthos / memory-hole

Memory Hole is a support issue organizer application
MIT License
261 stars 25 forks source link

Cross link issues #45

Closed jhamrsky closed 6 years ago

jhamrsky commented 6 years ago

This PR implements "cross link feature" (#20). Feature itself might not be completely clone/copy of GitHub functionality, but is quite similar to it.

TL;TR: server part looks quite standard, most work was done for editor component.

User interface

Regarding the change for end user - cross link feature is implemented more like automatic link creation than GitHub "parse and render". Basically it means that once completition is done, full link to issue is filled into the editor. Such functionality does not require special rendering (and parsing) and utilizes fully existing markdown syntax.

Another difference to GitHub functionality is that autocomplete menu is shown upon request rather than based on the current context. That has two reasons : performance (all the time checking whether issues should be fetched), second because I tend to lean more to explicit functionality than to implicit one.

Server side changes

On server side, just new paths (issues-by-content) to REST server were added. These paths download data from issues based either on issue number, issue title or N first issues (on empty). Hints itself have their own defintion IssueHint and IssueHintResults.

Client side changes

Handling on client side is quite standard with following flow : editor requests issues based on the context (issue ID or title), gets data from DB and updates atom in client global atom DB. Changes in this atom value are used as signal for editor component to show hints from server. User selects something (or presses ESC) and ends the flow.

I've moved editor component into own file because original functionality got quite bigger (code related to hints). Hints functionality itself is implemented by CodeMirror's show-hint.js taken from their site.

yogthos commented 6 years ago

Wow, thanks for the pr, it looks really great! I also agree with the autocomplete approach for the same reasons you note.