Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reference sorting #81

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

matiassingers
Copy link

@matiassingers matiassingers commented Jun 15, 2020

This is a super hacky proof-of-concept, but I wanted to get some feedback on the direction before investing too much time into it.

Features being added:

  • Reference Sorting
    • Alphabetically (asc/desc)
    • Daily notes (first/last)

TODOs

I've tried pointing out all the pending TODO items in code comments, but just capturing the major ones here as well:

  • Add settings for the different sorting modes
    • Toggle sorting for Linked References and/or Unlinked References
  • Refactor out DOM MutationObserver into a generic helper util
  • Figure out a better way to store class selectors for easier maintenance
  • Add logic for destroying HTML elements + eventListeners
  • Wrap everything in a Class
  • Fix sorting logic for daily notes (first/last)

Clean-up

  • Remove debug + console.logs
  • Squash commits

Example

reference-sorting-poc

(it was super fun getting back into a bit of JavaScript again, and using TypeScript for the first time)

@matiassingers matiassingers changed the title Re Add reference sorting Jun 15, 2020
@Stvad
Copy link
Member

Stvad commented Jun 15, 2020

would be nice to support queries too :)

TODO: figure out how to handle page navigations

TODO: allow buttons to act as asc/desc by reversing order and icon
TODO: find a better icon for Daily Notes first/last
…ally) (+1 squashed commit)

Squashed commits:
[fa3c3ef] TODO: add settings for toggling the various sorting modes (alphabetically)
TODO: fix sorting toggling + refactor
@Stvad
Copy link
Member

Stvad commented Jun 27, 2020

@matiassingers Just fyi @tntmarket has already created the abstraction to wait for selector on top of mutation observe (that's the same use-case you have if I understand correctly)

@tntmarket can you create a PR to push that part as it'd be useful here and in #83

@tntmarket
Copy link
Contributor

Opened up a PR here: #93

The helpers will be in src/ts/core/common/mutation-observer.ts

@Stvad
Copy link
Member

Stvad commented Jun 27, 2020

Thanks, merged!

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.

3 participants