/ 设置 10 秒超时 // 每日统计清 0 runtime_set('todaycomments', 0); runtime_set('todayarticles', 0); runtime_set('todayusers', 0); if ($forumlist) { $fidarr = array(); foreach ($forumlist as $fid => $forum) { $fidarr[] = $forum['fid']; } forum_update($fidarr, array('todayposts' => 0, 'todaythreads' => 0)); } // 清理临时附件 attach_gc(); // 当天24点 $today = strtotime(date('Ymd')) + 86400; runtime_set('cron_2_last_date', $today, TRUE); // 往前推8个小时,尽量保证在前一天 升级过来和采集的数据会很卡 // table_day_cron($time - 8 * 3600); cache_delete('cron_lock_2'); } } } ?>javascript - initial opentoggle PluginDocumentSettingPanel panel in document setting block editor gutenberg|Concepts Of Algorithm

javascript - initial opentoggle PluginDocumentSettingPanel panel in document setting block editor gutenberg

admin2025-03-19  11

i want make new panel inside document setting tab with React Script from this documentation

but the problem panel not toggle onload/initial i have try open with

dispatch('core/edit-post').toggleEditorPanelOpened('mycustom-panel')

but dont work,i see my custom panel not store in

select( 'core/edit-post' ).getPreference('panels')

so cant toggle it with toggleEditorPanelOpened

this my code to register PluginDocumentSettingPanel

const { registerPlugin } = wp.plugins;
const { PluginDocumentSettingPanel } = wp.editPost;

const PluginDocumentSettingPanelDemo = () => (
    <PluginDocumentSettingPanel
        name="mycustom-panel"
        title="Tips"
        className="mycustom-panel"
    >
        this is tips to write better content
    </PluginDocumentSettingPanel>
);
registerPlugin( 'plugin-document-setting-panel-mycustom', { render: PluginDocumentSettingPanelDemo, icon: null } );

i want make new panel inside document setting tab with React Script from this documentation

but the problem panel not toggle onload/initial i have try open with

dispatch('core/edit-post').toggleEditorPanelOpened('mycustom-panel')

but dont work,i see my custom panel not store in

select( 'core/edit-post' ).getPreference('panels')

so cant toggle it with toggleEditorPanelOpened

this my code to register PluginDocumentSettingPanel

const { registerPlugin } = wp.plugins;
const { PluginDocumentSettingPanel } = wp.editPost;

const PluginDocumentSettingPanelDemo = () => (
    <PluginDocumentSettingPanel
        name="mycustom-panel"
        title="Tips"
        className="mycustom-panel"
    >
        this is tips to write better content
    </PluginDocumentSettingPanel>
);
registerPlugin( 'plugin-document-setting-panel-mycustom', { render: PluginDocumentSettingPanelDemo, icon: null } );
Share Improve this question asked May 27, 2020 at 1:46 good112233good112233 435 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 4

This is a known issue in Gutenberg.

You can get this working by passing {plugin-slug}/{panel-name}

For your example, try:

dispatch('core/edit-post').toggleEditorPanelOpened('plugin-document-setting-panel-mycustom/mycustom-panel')

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1742389116a211151.html

最新回复(0)