Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

fix(highlight): don't remove whitespace-only nodes #827

Merged
merged 5 commits into from
Jul 31, 2020

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Jul 31, 2020

Vue by default removes nodes which are just whitespace: https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.common.dev.js#L2527

We need to prevent this, since sometimes between highlights, there is just a space, we need to make the value not "wrapped". We can't make the value always "block" (i don't know the correct name for this), since that would add spaces between "inline" highlights.

fixes #826

Vue by default removes nodes which are just whitespace: https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.common.dev.js#L2527

We need to prevent this, since sometimes between highlights, there is just a space, we need to make the value not "wrapped". We can't make the value always "block" (i don't know the correct name for this), since that would add spaces between "inline" highlights.

fixes #826
@Haroenv Haroenv requested a review from eunjae-lee July 31, 2020 11:43
@Haroenv Haroenv merged commit 1358b6a into master Jul 31, 2020
@Haroenv Haroenv deleted the fix/highlight-spaces branch July 31, 2020 12:24
Haroenv added a commit to algolia/instantsearch that referenced this pull request Dec 28, 2022
…ntsearch#827)

* fix(highlight): don't remove whitespace-only nodes

Vue by default removes nodes which are just whitespace: https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.common.dev.js#L2527

We need to prevent this, since sometimes between highlights, there is just a space, we need to make the value not "wrapped". We can't make the value always "block" (i don't know the correct name for this), since that would add spaces between "inline" highlights.

fixes algolia/vue-instantsearch#826

* Update src/components/Highlighter.vue

* less needless spaces

* use only two spaces, move to parseAlgoliaHit
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ais-highlight removes spaces
4 participants