diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 26ee060b16..6a683b2057 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -20,4 +20,5 @@ jobs: change:feature change:documentation change:chore + change:refactor add_comment: false diff --git a/packages/quill/src/blots/text.ts b/packages/quill/src/blots/text.ts index e00fd16ade..272fd11733 100644 --- a/packages/quill/src/blots/text.ts +++ b/packages/quill/src/blots/text.ts @@ -2,18 +2,17 @@ import { TextBlot } from 'parchment'; class Text extends TextBlot {} +// https://lodash.com/docs#escape +const entityMap: Record = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', +}; + function escapeText(text: string) { - return text.replace(/[&<>"']/g, (s) => { - // https://lodash.com/docs#escape - const entityMap: Record = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - }; - return entityMap[s]; - }); + return text.replace(/[&<>"']/g, (s) => entityMap[s]); } export { Text as default, escapeText };