Skip to content

Commit

Permalink
Better approach to remove caret hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
tiff committed Nov 9, 2012
1 parent b0c281b commit e4b6964
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/dom/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,11 @@ wysihtml5.dom.parse = (function() {
}
}

var INVISIBLE_SPACE_REG_EXP = /\uFEFF/g;
function _handleText(oldNode) {
return oldNode.ownerDocument.createTextNode(oldNode.data);
// \uFEFF = wysihtml5.INVISIBLE_SPACE (used as a hack in certain rich text editing situations)
var data = oldNode.data.replace(INVISIBLE_SPACE_REG_EXP, "");
return oldNode.ownerDocument.createTextNode(data);
}


Expand Down
5 changes: 0 additions & 5 deletions src/views/composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@
value = this.parent.parse(value);
}

// Replace all "zero width no breaking space" chars
// which are used as hacks to enable some functionalities
// Also remove all CARET hacks that somehow got left
value = wysihtml5.lang.string(value).replace(wysihtml5.INVISIBLE_SPACE).by("");

return value;
},

Expand Down

0 comments on commit e4b6964

Please sign in to comment.