Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Framework: Use WordPress dependencies in favor of globals #2275

Merged
merged 1 commit into from
Aug 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blocks/api/test/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe( 'query', () => {
const html = '<blockquote><p>A delicious sundae dessert</p></blockquote>';
const match = parse( html, query.node() );

expect( wp.element.renderToString( match ) ).toBe( `<body>${ html }</body>` );
expect( renderToString( match ) ).toBe( `<body>${ html }</body>` );
} );
} );
} );
4 changes: 2 additions & 2 deletions blocks/library/embed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { includes } from 'lodash';
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
import { Component, renderToString } from '@wordpress/element';
import { Button, Placeholder, Spinner, SandBox } from '@wordpress/components';
// TODO: This is a circular dependency between editor and blocks. This must be
// updated, eventually to depend on published `@wordpress/url`
Expand Down Expand Up @@ -81,7 +81,7 @@ function getEmbedBlockSettings( { title, icon, category = 'embed', transforms }
// 100% width for the preview so it fits nicely into the document, some "thumbnails" are
// acually the full size photo.
const photoPreview = <p><img src={ photo.thumbnail_url } alt={ photo.title } width="100%" /></p>;
return wp.element.renderToString( photoPreview );
return renderToString( photoPreview );
}

doServerSideRender( event ) {
Expand Down
7 changes: 6 additions & 1 deletion blocks/library/table/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
Expand All @@ -11,7 +16,7 @@ import BlockAlignmentToolbar from '../../block-alignment-toolbar';
const { children } = hpq;

registerBlockType( 'core/table', {
title: wp.i18n.__( 'Table' ),
title: __( 'Table' ),
icon: 'editor-table',
category: 'formatting',

Expand Down
14 changes: 11 additions & 3 deletions blocks/library/table/table-block.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import Editable from '../../editable';
import BlockControls from '../../block-controls';
/**
* WordPress dependencies
*/
import { Component } from '@wordpress/element';
import { Toolbar, DropdownMenu } from '@wordpress/components';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import Editable from '../../editable';
import BlockControls from '../../block-controls';

function isTableSelected( editor ) {
return editor.dom.getParent(
editor.selection.getStart( true ),
Expand Down Expand Up @@ -64,7 +72,7 @@ const TABLE_CONTROLS = [
},
];

export default class TableBlock extends wp.element.Component {
export default class TableBlock extends Component {
constructor() {
super();
this.handleSetup = this.handleSetup.bind( this );
Expand Down
7 changes: 5 additions & 2 deletions components/sandbox/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { renderToString } from '@wordpress/element';
/**
* WordPress dependencies
*/
import { Component, renderToString } from '@wordpress/element';

export default class Sandbox extends wp.element.Component {
export default class Sandbox extends Component {

constructor() {
super( ...arguments );
Expand Down