Open seangoogoo opened 3 years ago
@tameemsafi this is a major issue for me as well. Can you please fix and publish an NPM update?
This is a copy of #89
I have noticed an issue with the ampersand character.
If I write this :
const mytypeWTtxt = new Typewriter('#myDiv', { string: 'business & Co', autostart: true });
TypewriterJS will correctly write the "&".
If I write this :
const mytypeWTtxt = new Typewriter('#myDiv', { string: '\<strong\>business & Co\</strong\>', autostart: true });
TypewriterJS will write "&" as the separated characters of the ampersand HTML entity. It only happen when the ampersand is nested inside an HTML tag. It also only happen with this particular character: not @ nor % nor none else.
To get around this issue, I used this stringSplitter hack :
const stringSplitter = string => {
const splitter = string.replace('&', '&');
return splitter.split('');
};
const mytypeWTtxt = new Typewriter('#myDiv', {
string: '\<strong\>business & Co\</strong\>',
autostart: true,
stringSplitter
});
Maybe there's a better way to write it. Hope you can give an eye on this issue.
Just found out that it's been answered at #140 and the solution is using Unicode representation of the character. (Also, check #89)
I have noticed an issue with the ampersand character.
If I write this :
const mytypeWTtxt = new Typewriter('#myDiv', { string: 'business & Co', autostart: true });
TypewriterJS will correctly write the "&".
If I write this :
const mytypeWTtxt = new Typewriter('#myDiv', { string: '<strong>business & Co</strong>', autostart: true });
TypewriterJS will write "&" as the separated characters of the ampersand HTML entity. It only happen when the ampersand is nested inside an HTML tag. It also only happen with this particular character: not @ nor % nor none else.
To get around this issue, I used this stringSplitter hack :
const stringSplitter = string => {
const splitter = string.replace('&', '&');
return splitter.split('');
};
const mytypeWTtxt = new Typewriter('#myDiv', {
string: '<strong>business & Co</strong>',
autostart: true,
stringSplitter
});
Maybe there's a better way to write it. Hope you can give an eye on this issue.