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

Html render function #25

Merged
merged 5 commits into from
Mar 20, 2019

Conversation

scottsfarley93
Copy link
Collaborator

Exposes a render method that allows custom html to be displayed in the dropdown menu.

Copy link
Owner

@tristen tristen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet! Just left some initial comments.

@@ -22,76 +22,74 @@ var Suggestions = function(el, data, options) {

this.list.draw();

this.el.addEventListener('keyup', function(e) {
this.el.addEventListener('keyup', function (e) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the paren formatting throughout this pr?

var indexOfQuery = indexString.lastIndexOf(this.query);
while (indexOfQuery > -1) {
var endIndexOfQuery = indexOfQuery + this.query.length;
boldString = boldString.slice(0, indexOfQuery) + '<strong>' + boldString.slice(indexOfQuery, endIndexOfQuery) + '</strong>' + boldString.slice(endIndexOfQuery);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I'm following this. if this render method allows a user to template a list item, would wrapping <strong> be desired or expected?

Copy link
Collaborator Author

@scottsfarley93 scottsfarley93 Mar 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user provides a custom render method, then that will be used instead. If the user does not provide a custom render function, then this default function will be used. The default function follows the existing functionality of wrapping the matching text in <strong> tags.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh dear me 🙈 I see now the existing functionality in the diff. 👍

Copy link
Owner

@tristen tristen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the changes here LGTM. Running the demo locally, I'm seeing a method error on the string passed to fuzzy:

Screen Shot 2019-03-20 at 12 55 27 PM

@@ -66,8 +69,8 @@ Suggestions.prototype.handleKeyDown = function(e) {
case 13: // ENTER
case 9: // TAB
if (!this.list.isEmpty()) {
if (this.list.isVisible()) {
e.preventDefault();
if (this.list.isVisible()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: seeing some extra whitespace here and the line below

Copy link
Owner

@tristen tristen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💘

@scottsfarley93 scottsfarley93 merged commit 5794852 into tristen:gh-pages Mar 20, 2019
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.

2 participants