Skip to content

Commit

Permalink
Move editor blocks to top level blocks directory
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Apr 11, 2017
1 parent 376d25d commit 4fc3c41
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 30 deletions.
5 changes: 5 additions & 0 deletions blocks/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
/**
* Internal dependencies
*/
import './library';

export * from './api';
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const { html } = wp.blocks.query;
/**
* Internal dependencies
*/
import { registerBlock, query, setUnknownTypeHandler } from 'api';

wp.blocks.registerBlock( 'core/freeform', {
const { html } = query;

registerBlock( 'core/freeform', {
title: wp.i18n.__( 'Freeform' ),

icon: 'text',
Expand All @@ -27,4 +32,4 @@ wp.blocks.registerBlock( 'core/freeform', {
}
} );

wp.blocks.setUnknownTypeHandler( 'core/freeform' );
setUnknownTypeHandler( 'core/freeform' );
10 changes: 7 additions & 3 deletions editor/blocks/image/index.js → blocks/library/image/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
const { attr, html } = wp.blocks.query;
const Editable = wp.blocks.Editable;
/**
* Internal dependencies
*/
import { registerBlock, query, Editable } from 'api';

wp.blocks.registerBlock( 'core/image', {
const { attr, html } = query;

registerBlock( 'core/image', {
title: wp.i18n.__( 'Image' ),

icon: 'format-image',
Expand Down
File renamed without changes.
15 changes: 6 additions & 9 deletions editor/blocks/list/index.js → blocks/library/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@
* Internal dependencies
*/
import './style.scss';
import { registerBlock, query, Editable } from 'api';

const Editable = wp.blocks.Editable;
const { html, prop } = wp.blocks.query;
const { html, prop } = query;

wp.blocks.registerBlock( 'core/list', {
registerBlock( 'core/list', {
title: wp.i18n.__( 'List' ),
icon: 'editor-ul',
category: 'common',

attributes: {
listType: prop( 'ol,ul', 'nodeName' ),
items: wp.blocks.query.query(
'li',
{
value: html()
}
)
items: query.query( 'li', {
value: html()
} )
},

controls: [
Expand Down
File renamed without changes.
10 changes: 7 additions & 3 deletions editor/blocks/text/index.js → blocks/library/text/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
const { html, prop } = wp.blocks.query;
const Editable = wp.blocks.Editable;
/**
* Internal dependencies
*/
import { registerBlock, query, Editable } from 'api';

wp.blocks.registerBlock( 'core/text', {
const { html, prop } = query;

registerBlock( 'core/text', {
title: wp.i18n.__( 'Text' ),

icon: 'text',
Expand Down
1 change: 0 additions & 1 deletion editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Provider } from 'react-redux';
* Internal dependencies
*/
import './assets/stylesheets/main.scss';
import './blocks';
import Layout from './layout';
import { createReduxStore } from './state';

Expand Down
22 changes: 11 additions & 11 deletions languages/gutenberg.pot
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,38 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"X-Generator: babel-plugin-wp-i18n\n"

#: editor/blocks/freeform/index.js:4
#: blocks/library/freeform/index.js:9
msgid "Freeform"
msgstr ""

#: editor/blocks/image/index.js:26
#: blocks/library/image/index.js:30
msgid "Write caption…"
msgstr ""

#: editor/blocks/image/index.js:5
#: blocks/library/image/index.js:9
msgid "Image"
msgstr ""

#: editor/blocks/list/index.js:10
#: blocks/library/list/index.js:10
msgid "List"
msgstr ""

#: editor/blocks/list/index.js:27
#: editor/blocks/text/index.js:19
#: blocks/library/list/index.js:24
#: blocks/library/text/index.js:23
msgid "Align left"
msgstr ""

#: editor/blocks/list/index.js:35
#: editor/blocks/text/index.js:27
#: blocks/library/list/index.js:32
#: blocks/library/text/index.js:31
msgid "Align center"
msgstr ""

#: editor/blocks/list/index.js:43
#: editor/blocks/text/index.js:35
#: blocks/library/list/index.js:40
#: blocks/library/text/index.js:39
msgid "Align right"
msgstr ""

#: editor/blocks/list/index.js:51
#: blocks/library/list/index.js:48
msgid "Justify"
msgstr ""

Expand Down

0 comments on commit 4fc3c41

Please sign in to comment.