Skip to content

Commit

Permalink
fix (SplittedText): missing spaces after split by word, again
Browse files Browse the repository at this point in the history
  • Loading branch information
n-langle committed Apr 25, 2024
1 parent df8980b commit 52ef82f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
9 changes: 6 additions & 3 deletions build/OneLoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright 2022 OneLoop.js
* Author: Nicolas Langle
* Repository: https://github.com/n-langle/OneLoop.js
* Version: 5.1.1
* Version: 5.1.2
* SPDX-License-Identifier: MIT
*
* Credit for easing functions goes to : https://github.com/ai/easings.net/blob/master/src/easings/easingsFunctions.ts
Expand Down Expand Up @@ -1067,8 +1067,11 @@ function split(element, separator, wrapper, preserve) {
return traverseNode(
element,
text => {
return text.trim() !== '' ?
text.split(separator).map(wrapper).join(separator)
const trimmedText = text.trim();
const spaceAfter = text.charAt(text.length - 1) === ' ' ? ' ' : '';

return trimmedText !== '' ?
(separator === '' ? text : trimmedText).split(separator).map(wrapper).join(separator) + spaceAfter
:
text
},
Expand Down
Loading

0 comments on commit 52ef82f

Please sign in to comment.