block-editor-plugin.js
24 lines
| 1 | ( function( wp ) { |
| 2 | if ( ! wp ) { |
| 3 | return; |
| 4 | } |
| 5 | |
| 6 | wp.plugins.registerPlugin( 'classic-editor-plugin', { |
| 7 | render: function() { |
| 8 | var createElement = wp.element.createElement; |
| 9 | var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem; |
| 10 | var url = wp.url.addQueryArgs( document.location.href, { 'classic-editor': '', 'classic-editor__forget': '' } ); |
| 11 | var linkText = lodash.get( window, [ 'classicEditorPluginL10n', 'linkText' ] ) || 'Switch to classic editor'; |
| 12 | |
| 13 | return createElement( |
| 14 | PluginMoreMenuItem, |
| 15 | { |
| 16 | icon: 'editor-kitchensink', |
| 17 | href: url, |
| 18 | }, |
| 19 | linkText |
| 20 | ); |
| 21 | }, |
| 22 | } ); |
| 23 | } )( window.wp ); |
| 24 |