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

fix: prevent double spaces in toPlainText when span follows non-span #93

Merged
merged 1 commit into from
Nov 2, 2024

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Nov 1, 2024

Bit of an edge case, but this was the intention all along, although a faulty regex prevented this from actually being applied:

When calling toPlainText() on a block that has a span that ends with a space, then is followed by a non-span, then followed by a span - it currently adds an additional space. It should instead only add one if there is no space between the two spans.

Copy link

@christianhg christianhg left a comment

Choose a reason for hiding this comment

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

Nice!

@rexxars rexxars added this pull request to the merge queue Nov 2, 2024
Merged via the queue into main with commit 43b963f Nov 2, 2024
7 checks passed
@rexxars rexxars deleted the fix/span-hug-double-space branch November 2, 2024 18:02
@ecoscript ecoscript bot mentioned this pull request Nov 2, 2024
theisel added a commit to theisel/astro-portabletext that referenced this pull request Nov 4, 2024
Prevent double spaces in `toPlainText` output (see portabletext/toolkit#93).
theisel added a commit to theisel/astro-portabletext that referenced this pull request Nov 4, 2024
Prevent double spaces in `toPlainText` output (see portabletext/toolkit#93).
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