Conversation
supportHey, I love your plugin 馃檪 But there is one problem If the last word is assigned a colour, it will end up as a widow without colour. This is because the plugin inserts inside the <span> like this: <span style="color: #00ff00;"> and breaks the CSS. Is there a way you can make it ignore those span tags? http://wordpress.org/plugins/widont-part-deux/
I鈥檒l take a look at this. It鈥檚 a pretty basic reffed, but I can probably extend it to insert the nbsp before any tag.
I think I found a solution 馃檪 $(document).ready(function($){ $('p').html(function(i, oldHtml) { var html = $(this).html(); var split = html.split(' '); if ( (split.length > 1) && (!$(this).find('img').length) ) { return oldHtml.replace('<span style="color: ', '<span style="color: ').replace(/(\d),\s/g, '$1,').replace('<span style="color: ', '<span style="color: '); } }); }); It inserts a non-breaking space in those tags before it attempts to insert a non-breaking space between the two latest words, it then avoids putting that inside the tag. Afterwards, the script removes the non-breaking spaces from the inside of the tag. 馃檪
Turns out this was an issue that affected all tags that contain attributes, not just this case. Version 1.3.1 has been released that should fix this across all tags.
I鈥檒l take a look at this. It鈥檚 a pretty basic reffed, but I can probably extend it to insert the nbsp before any tag.
I think I found a solution 馃檪 $(document).ready(function($){ $('p').html(function(i, oldHtml) { var html = $(this).html(); var split = html.split(' '); if ( (split.length > 1) && (!$(this).find('img').length) ) { return oldHtml.replace('<span style="color: ', '<span style="color: ').replace(/(\d),\s/g, '$1,').replace('<span style="color: ', '<span style="color: '); } }); }); It inserts a non-breaking space in those tags before it attempts to insert a non-breaking space between the two latest words, it then avoids putting that inside the tag. Afterwards, the script removes the non-breaking spaces from the inside of the tag. 馃檪
Turns out this was an issue that affected all tags that contain attributes, not just this case. Version 1.3.1 has been released that should fix this across all tags.