Hi, I have written a plugin that works fine, but as I come to enhance some functionality Iv run into an inexplicable problem:
I use the following to get the selected text:
var theSelectedText = editor.getSelection().getNative();
This works exactly as expected and at one point I can add strings to it and re-insert, for example:
var ttCode = "Fred" + theSelectedText;
editor.insertHtml( ttCode );
However, I now wish to strip ALL spaces from the selected text, but no matter how I try to remove the spaces the plugin refuses to run when I try. For example either of the following lines prevent the plugin from working at all:
var theSelectedTextLess = theSelectedText.replace( / /g, "" );
var theSelectedTextLess = theSelectedText.split(' ').join('');
Any ideas how to remove ALL of the spaces from the selected text?
Cheers
Max
I use the following to get the selected text:
var theSelectedText = editor.getSelection().getNative();
This works exactly as expected and at one point I can add strings to it and re-insert, for example:
var ttCode = "Fred" + theSelectedText;
editor.insertHtml( ttCode );
However, I now wish to strip ALL spaces from the selected text, but no matter how I try to remove the spaces the plugin refuses to run when I try. For example either of the following lines prevent the plugin from working at all:
var theSelectedTextLess = theSelectedText.replace( / /g, "" );
var theSelectedTextLess = theSelectedText.split(' ').join('');
Any ideas how to remove ALL of the spaces from the selected text?
Cheers
Max