Skip to content

Commit a4ad4f6

Browse files
committed
removing duplicated common code and update core blocks
1 parent 4600f32 commit a4ad4f6

92 files changed

Lines changed: 1461 additions & 4940 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/commons/src/APIConfig.js

Lines changed: 466 additions & 0 deletions
Large diffs are not rendered by default.

packages/commons/src/APIConfig.tsx

Lines changed: 0 additions & 491 deletions
This file was deleted.

plugins/wp-react-blocks-plugin/blocks/commons/APIutils.js renamed to packages/commons/src/APIutils.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export const getTranslatedOptions = (options) => {
77
if (labels && labels[currentLocale]) {
88
label = labels[currentLocale]
99
}
10-
if (!label){
11-
label=value
10+
if (!label) {
11+
label = value
1212
}
1313
return {...o, label, value}
1414
})
@@ -18,7 +18,7 @@ export const getTranslatedOptions = (options) => {
1818
}
1919

2020
export const getTranslation = (translatable) => {
21-
21+
2222
const currentLocale = (window._user_locale ? window._user_locale : '').toUpperCase()
2323
let {label, labels, value} = translatable
2424
if (labels && labels[currentLocale]) {
@@ -28,13 +28,13 @@ export const getTranslation = (translatable) => {
2828
}
2929

3030
export const isSupersetAPI = (app, apps) => {
31-
31+
3232
if (app == 'csv' || !apps) {
3333
return false
3434
}
3535
const appObj = apps.filter(a => a.value == app)[0]
36-
return appObj && appObj.settings && appObj.settings.metadata
37-
&& appObj.settings.metadata.superset == 'true';
36+
return appObj && appObj.settings && appObj.settings.metadata
37+
&& appObj.settings.metadata.superset == 'true';
3838
}
3939

4040
export default getTranslatedOptions

packages/commons/src/APIutils.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

plugins/wp-react-blocks-plugin/blocks/commons/index.js renamed to packages/commons/src/Blocks.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class ComponentWithSettings extends Component {
4444
this.unsubscribe = wp.data.subscribe(() => {
4545
const newPreviewMode = wp.data.select("core/editor").getDeviceType();
4646
if (newPreviewMode !== this.state.previewMode) {
47-
this.setState({previewMode: newPreviewMode });
47+
this.setState({previewMode: newPreviewMode});
4848
}
4949
});
5050
}
@@ -73,6 +73,7 @@ export class ComponentWithSettings extends Component {
7373
}
7474
}
7575
}
76+
7677
export class BlockEditWithFilters extends ComponentWithSettings {
7778

7879
constructor(props) {

0 commit comments

Comments
 (0)