Hi,
I made some changes on the wrap method.
I don't remember exactly what was the problem, but the original one wasn't doing what I was expecting. So I changed it, and this way it works pretty well.
- Code: Select all
WYMeditor.editor.prototype.wrap = function(left, right) {
// Do we have a selection?
if (this._iframe.contentWindow.getSelection().focusNode != null) {
// generate a unique stamp
var sStamp = this.uniqueStamp();
// Wrap selection with a link
this._exec(WYMeditor.CREATE_LINK, sStamp);
// Remove the link, replace with wraping content
$('a[href=' + sStamp + ']', this._doc.body)
.each(function() {
$(this)
.after(left + $(this).html() + right)
.remove();
});
}
};
I think the way I do it is not really very nice. But I couldn't find any nicer way to do it.
Nico