Skip to content

Issue with quotes #22

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

Open
bramdebouvere opened this issue Jul 3, 2016 · 3 comments · May be fixed by #94 or #95
Open

Issue with quotes #22

bramdebouvere opened this issue Jul 3, 2016 · 3 comments · May be fixed by #94 or #95

Comments

@bramdebouvere
Copy link

When you select a text that contains quotes, only the part before the quote is inserted in the textbox.
Example text:

This is "text" with quotes

After selecting the value, only the following text will be in the textbox

This is

This issue should be fixed in the renderItem function:

function (item, search)
{
  // escape special characters
  search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
  return '<div class="autocomplete-suggestion" data-val="' + item + '">' + item.replace(re, "<b>$1</b>") + '</div>';
}

Change this code:

'<div class="autocomplete-suggestion" data-val="' + item + '">'

To this code:

'<div class="autocomplete-suggestion" data-val="' + item.replace(/"/g, '&quot;') + '">'
@empresarrollo
Copy link

thanks for this!

@fembuelita
Copy link

Further change it from @bramdebouvere answer to:

'<div class="autocomplete-suggestion" data-val="' + item.replace(/"/g, '&quot;').replace(/'/g, '&apos;') + '">'

This will also account for single quotation marks.

@mattgorle
Copy link

mattgorle commented Apr 26, 2019

Thank you! This just saved a fairly big headache.

Is it worth turning this into a pull request? Is the project accepting pull requests?

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 a pull request may close this issue.

4 participants