quill
Version:
Your powerful, rich text editor
20 lines (16 loc) • 382 B
JavaScript
import { TextBlot } from 'parchment';
class Text extends TextBlot {}
function escapeText(text) {
return text.replace(/[&<>"']/g, s => {
// https://lodash.com/docs#escape
const entityMap = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
};
return entityMap[s];
});
}
export { Text as default, escapeText };