Skip to content

Commit

Permalink
Merge branch 'main' into export_table_icons
Browse files Browse the repository at this point in the history
  • Loading branch information
SagarTrimukhe authored Jul 21, 2024
2 parents e91a669 + b213e10 commit 8c5352e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ jobs:
change:feature
change:documentation
change:chore
change:refactor
add_comment: false
21 changes: 10 additions & 11 deletions packages/quill/src/blots/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@ import { TextBlot } from 'parchment';

class Text extends TextBlot {}

// https://lodash.com/docs#escape
const entityMap: Record<string, string> = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
};

function escapeText(text: string) {
return text.replace(/[&<>"']/g, (s) => {
// https://lodash.com/docs#escape
const entityMap: Record<string, string> = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
};
return entityMap[s];
});
return text.replace(/[&<>"']/g, (s) => entityMap[s]);
}

export { Text as default, escapeText };

0 comments on commit 8c5352e

Please sign in to comment.