Skip to content

Commit 52ef82f

Browse files
committed
fix (SplittedText): missing spaces after split by word, again
1 parent df8980b commit 52ef82f

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

build/OneLoop.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright 2022 OneLoop.js
44
* Author: Nicolas Langle
55
* Repository: https://github.com/n-langle/OneLoop.js
6-
* Version: 5.1.1
6+
* Version: 5.1.2
77
* SPDX-License-Identifier: MIT
88
*
99
* Credit for easing functions goes to : https://github.com/ai/easings.net/blob/master/src/easings/easingsFunctions.ts
@@ -1067,8 +1067,11 @@ function split(element, separator, wrapper, preserve) {
10671067
return traverseNode(
10681068
element,
10691069
text => {
1070-
return text.trim() !== '' ?
1071-
text.split(separator).map(wrapper).join(separator)
1070+
const trimmedText = text.trim();
1071+
const spaceAfter = text.charAt(text.length - 1) === ' ' ? ' ' : '';
1072+
1073+
return trimmedText !== '' ?
1074+
(separator === '' ? text : trimmedText).split(separator).map(wrapper).join(separator) + spaceAfter
10721075
:
10731076
text
10741077
},

0 commit comments

Comments
 (0)