fritx / vue-at

At.js for Vue.
https://fritx.github.io/vue-at/
MIT License
529 stars 114 forks source link

Allow at prop to be regex #104

Closed dcress closed 4 years ago

dcress commented 4 years ago

First off, thanks for the amazing work on Vue-at! I just started working with it, but it's been great so far. I've had one little issue:

I'm using Vue-at in a slightly different way than its original intention, but it's pretty darn close. I'm working on a Chord Pro* text area input. At is being used for offering chord suggestions to the user when they hit "[". It works great for general usage, but when the user is typing a word and then types [ without a space (ex: "my examp[" ), the suggestion dropdown isn't triggered. I think one of three things would be helpful in this case:

  1. Any time the user types the designated at prop character, the suggestion box should show, regardless of the preceding character.
  2. The ability to set "preceedingSpaceRequired" (or something to that effect).
  3. The ability to pass regex to the at property instead of just string matching.

It's possible that one of these is already an option that I just haven't seen in the documentation. I'm open to all suggestions! Thanks in advance for your help and thanks again for your work on Vue-at!

* Chord Pro is a way to easily write Music Chords & Lyric Charts in a single line. The text input of that looks like this:

This is [G]my song ab[D7]out Chord[G]Pro

And we use that to generate/output a chart:

        G         D7       G
This is my song about ChordPro
dcress commented 4 years ago

I had an epiphany while working on something else that my issue was probably related to the avoidEmail prop -- I changed that to false and bingo! Thanks again for the great work here.

Closing this issue.

fritx commented 4 years ago

@dcress thanks for reporting your issue and solution :)

fritx commented 4 years ago

Btw, your use case is so cooool :+1: