Skip to content

Commit

Permalink
Merge pull request #2678 from rcbevans/fix-serializer-docx-validator
Browse files Browse the repository at this point in the history
FIX #2677 : CommonJS validator import in cleanDocXImageElements
  • Loading branch information
zbeyens authored Oct 5, 2023
2 parents d96e7cb + ab3bf86 commit b4ae597
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/great-files-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@udecode/plate-serializer-docx": patch
---

Fixes #2677: CommonJS validator import in cleanDocXImageElements
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { hexToBase64, traverseHtmlElements } from '@udecode/plate-common';
import isURL from 'validator/lib/isURL';
import validator from 'validator';

import { getRtfImagesMap } from './getRtfImagesMap';
import { getVShapeSpid } from './getVShapeSpid';
Expand Down Expand Up @@ -30,7 +30,7 @@ export const cleanDocxImageElements = (

const alt = element.getAttribute('alt');

if (typeof alt === 'string' && isURL(alt, { require_protocol: true })) {
if (typeof alt === 'string' && validator.isURL(alt, { require_protocol: true })) {
element.setAttribute('src', alt);
return true;
}
Expand Down

0 comments on commit b4ae597

Please sign in to comment.