Skip to content

Commit

Permalink
Block Library: Use WHATWG URL in place of legacy url module
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Feb 7, 2020
1 parent 6512718 commit ba5bfe5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 6 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/block-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
"lodash": "^4.17.15",
"memize": "^1.0.5",
"moment": "^2.22.1",
"tinycolor2": "^1.4.1",
"url": "^0.11.0"
"tinycolor2": "^1.4.1"
},
"publishConfig": {
"access": "public"
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/embed/embed-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { getPhotoHtml } from './util';
/**
* External dependencies
*/
import { parse } from 'url';
import { includes } from 'lodash';
import classnames from 'classnames/dedupe';

Expand Down Expand Up @@ -69,7 +68,7 @@ class EmbedPreview extends Component {
const { interactive } = this.state;

const html = 'photo' === type ? getPhotoHtml( preview ) : preview.html;
const parsedHost = parse( url ).host.split( '.' );
const parsedHost = new URL( url ).host.split( '.' );
const parsedHostBaseUrl = parsedHost
.splice( parsedHost.length - 2, parsedHost.length - 1 )
.join( '.' );
Expand Down

0 comments on commit ba5bfe5

Please sign in to comment.