Skip to content

Commit

Permalink
Update approach for using correct version of component
Browse files Browse the repository at this point in the history
  • Loading branch information
renatho committed Jul 31, 2024
1 parent a22f45e commit 569e754
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
import { __ } from '@wordpress/i18n';
import { useEntityProp } from '@wordpress/core-data';
import { PluginPrePublishPanel as DeprecatedPluginPrePublishPanel } from '@wordpress/edit-post';
import { PluginPrePublishPanel } from '@wordpress/editor';
import { PluginPrePublishPanel as NewPluginPrePublishPanel } from '@wordpress/editor';
import { ToggleControl } from '@wordpress/components';

/**
* Internal dependencies
*/
import SenseiIcon from '../../icons/logo-tree.svg';

if ( ! PluginPrePublishPanel ) {
PluginPrePublishPanel = DeprecatedPluginPrePublishPanel;
}
const PluginPrePublishPanel =
NewPluginPrePublishPanel || DeprecatedPluginPrePublishPanel;

/**
* Course pre-publish panel.
Expand Down
16 changes: 8 additions & 8 deletions assets/blocks/quiz/question-block/single-question.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ import {
PluginPostStatusInfo as DeprecatedPluginPostStatusInfo,
PluginPrePublishPanel as DeprecatedPluginPrePublishPanel,
} from '@wordpress/edit-post';
import { PluginPostStatusInfo, PluginPrePublishPanel } from '@wordpress/editor';
import {
PluginPostStatusInfo as NewPluginPostStatusInfo,
PluginPrePublishPanel as NewPluginPrePublishPanel,
} from '@wordpress/editor';

/**
* Internal dependencies
*/
import { Effect, usePostSavingEffect } from '../../../shared/helpers/blocks';

if ( ! PluginPostStatusInfo ) {
PluginPostStatusInfo = DeprecatedPluginPostStatusInfo;
}

if ( ! PluginPrePublishPanel ) {
PluginPrePublishPanel = DeprecatedPluginPrePublishPanel;
}
const PluginPostStatusInfo =
NewPluginPostStatusInfo || DeprecatedPluginPostStatusInfo;
const PluginPrePublishPanel =
NewPluginPrePublishPanel || DeprecatedPluginPrePublishPanel;

/**
* Additional controls for a question block in the single question editor.
Expand Down
16 changes: 8 additions & 8 deletions assets/blocks/quiz/quiz-block/quiz-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import {
PluginPostStatusInfo as DeprecatedPluginPostStatusInfo,
PluginPrePublishPanel as DeprecatedPluginPrePublishPanel,
} from '@wordpress/edit-post';
import { PluginPostStatusInfo, PluginPrePublishPanel } from '@wordpress/editor';
import {
PluginPostStatusInfo as NewPluginPostStatusInfo,
PluginPrePublishPanel as NewPluginPrePublishPanel,
} from '@wordpress/editor';
import { useCallback } from '@wordpress/element';
import { __, _n, sprintf } from '@wordpress/i18n';

Expand All @@ -17,13 +20,10 @@ import { __, _n, sprintf } from '@wordpress/i18n';
import { BLOCK_META_STORE } from '../../../shared/blocks/block-metadata';
import { Effect, usePostSavingEffect } from '../../../shared/helpers/blocks';

if ( ! PluginPostStatusInfo ) {
PluginPostStatusInfo = DeprecatedPluginPostStatusInfo;
}

if ( ! PluginPrePublishPanel ) {
PluginPrePublishPanel = DeprecatedPluginPrePublishPanel;
}
const PluginPostStatusInfo =
NewPluginPostStatusInfo || DeprecatedPluginPostStatusInfo;
const PluginPrePublishPanel =
NewPluginPrePublishPanel || DeprecatedPluginPrePublishPanel;

/**
* Notice about incomplete questions in the quiz.
Expand Down

0 comments on commit 569e754

Please sign in to comment.