YUI editor (RTE): How to wrap selection with a <span> and NOT lose formatting?
问题 Ok so I've got a problem I've been working on for the last week or so and have tried everything I know or could find. I am using YUI 2.x editor where users will be doing some heavy formatting. I have an external button on the page that needs to wrap the selected text in a <span> when the user clicks it, but it must do this without loosing any formatting. For some reason doing the following likes to erase all of the formatting in the selection: var sel = myEditor._getSelection(); var newEl = '