12345678910111213141516171819 |
- 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 };
|