diff --git a/packages/editor/src/core/helpers/common.ts b/packages/editor/src/core/helpers/common.ts index 36075caf2..974b111d0 100644 --- a/packages/editor/src/core/helpers/common.ts +++ b/packages/editor/src/core/helpers/common.ts @@ -38,11 +38,10 @@ export const findTableAncestor = (node: Node | null): HTMLTableElement | null => return node as HTMLTableElement; }; -export const getTrimmedHTML = (html: string) => { - html = html.replace(/^(

<\/p>)+/, ""); - html = html.replace(/(

<\/p>)+$/, ""); - return html; -}; +export const getTrimmedHTML = (html: string) => + html + .replace(/^(?:

<\/p>)+/g, "") // Remove from beginning + .replace(/(?:

<\/p>)+$/g, ""); // Remove from end export const isValidHttpUrl = (string: string): { isValid: boolean; url: string } => { // List of potentially dangerous protocols to block