File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ export default class SplitText {
8686 element . style . removeProperty ( 'width' ) ;
8787 this . attachBr ( element , this . words ) ;
8888 this . splitBr ( element ) ;
89- this . replaceWords ( element ) ;
89+ this . replaceWords ( element , ( byLines || byWords ) && ! byChars ) ;
9090 this . lines . push ( ...this . splitLines ( element ) ) ;
9191 const earlyReturn = this . checkBalance ( element , i ) ;
9292 if ( ! earlyReturn ) return ;
@@ -266,9 +266,12 @@ export default class SplitText {
266266 return found ;
267267 }
268268
269- replaceWords ( element ) {
269+ replaceWords ( element , notByChars ) {
270270 Array . from ( element . getElementsByClassName ( 'word' ) ) . forEach ( ( el , i ) => {
271271 el . replaceWith ( this . words [ i ] ) ;
272+ if ( el . __isCJK && notByChars ) {
273+ this . words [ i ] . innerHTML = this . words [ i ] . textContent ;
274+ }
272275 } ) ;
273276 }
274277
@@ -325,6 +328,7 @@ export default class SplitText {
325328
326329 // If it's CJK, split into individual characters
327330 if ( isCJKMode ) {
331+ splitEl . __isCJK = true ;
328332 this . chars . push ( ...this . splitElement ( splitEl , 'char' , '' , false ) ) ;
329333 }
330334 }
You can’t perform that action at this time.
0 commit comments