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

option to supply list view position function #88

Merged
merged 1 commit into from
Jun 21, 2014
Merged

option to supply list view position function #88

merged 1 commit into from
Jun 21, 2014

Conversation

jedireza
Copy link
Contributor

I had a use case where I needed to position the list myself instead of following the cursor. My textarea was pretty small (in a narrow column) and near the bottom edge of the window and I wanted the list to display in a specific position.

I'm hoping you'll see that this is a simple but useful change to consider.

Usage example:

$('textarea').textcomplete([
  { // emoji strategy
    match: /(^|\s):(\w*)$/,
    search: function (term, callback) {
      var regexp = new RegExp('^' + term);
      callback($.grep(emojies, function (emoji) {
        return regexp.test(emoji);
      }));
    },
    replace: function (value) {
      return '$1:' + value + ': ';
    }
  }
], {
  listPosition: function (position) {
    this.$el.css({
      top: 'auto',
      bottom: 50,
      left: 0
    });
    return this;
  }
});

And if you think there's a better way to implement this, I'm happy to update this PR. 👍

@yuku
Copy link
Owner

yuku commented Jun 21, 2014

Hi @jedireza
Thank you for sending the patch. And it looks gooood to me 😋

yuku added a commit that referenced this pull request Jun 21, 2014
option to supply list view position function
@yuku yuku merged commit 39007b5 into yuku:master Jun 21, 2014
@jedireza
Copy link
Contributor Author

Thanks @yuku-t. When do you plan on doing a release? I'd like to install via bower.

@yuku
Copy link
Owner

yuku commented Jun 24, 2014

Done!

@jedireza
Copy link
Contributor Author

😎 thanks

@yuku yuku added the DEPRECATED jquery-textcomplete Issues associated to jquery-textcomplete (was DEPRECATED) label Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DEPRECATED jquery-textcomplete Issues associated to jquery-textcomplete (was DEPRECATED) enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants