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

Miss-aligned but only sometimes #21

Open
rkni9ht opened this issue Nov 7, 2017 · 2 comments
Open

Miss-aligned but only sometimes #21

rkni9ht opened this issue Nov 7, 2017 · 2 comments

Comments

@rkni9ht
Copy link

rkni9ht commented Nov 7, 2017

<script>
$(document).load(function () {
    $('.string-example').highlightWithinTextarea('update');
});
</script>
<script>
    $('.string-example').highlightWithinTextarea({
        highlight: ['patel']
    });
</script>

I have a webb app where the user searches and then the search words get highlighted in the textarea. on most content of the textarea it works but on this instance and others it seems to get missaligned. the code is the same on each the only thing that is different is the content of the textareas.

I noticed on a similar issue the answer was to run the update function that made it slightly better but still has the occasional case where it throws it out. And then as the user scrolls down the text area the highlight follows.

Is there a reason this is happening?

image
image

@qrnik
Copy link

qrnik commented Nov 17, 2017

This is due to to mismatch between your textarea CSS and highlight CSS. I still haven't solved this problem by myself, but Dalimil's pull request explains it better.

@lonekorean
Copy link
Owner

Could be misaligned CSS as @pwamej stated, but then it'd be weird that calling update would have an effect. Is there somewhereI can see this code in action (public page or maybe a codepen)?

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

No branches or pull requests

3 participants