editor-script.js
28 lines
| 1 | var el = wp.element.createElement; |
| 2 | var __ = wp.i18n.__; |
| 3 | var registerPlugin = wp.plugins.registerPlugin; |
| 4 | var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo; |
| 5 | var buttonControl = wp.components.Button; |
| 6 | |
| 7 | function dpGutenButton({}) { |
| 8 | return el( |
| 9 | PluginPostStatusInfo, |
| 10 | { |
| 11 | className: 'dt-duplicate-post-status-info' |
| 12 | }, |
| 13 | el( |
| 14 | buttonControl, |
| 15 | { |
| 16 | isTertiary: true, |
| 17 | name: 'duplicate_page_link_guten', |
| 18 | isLink: true, |
| 19 | title: dt_params.dp_post_title, |
| 20 | href : dt_params.dp_duplicate_link+"&post="+dt_params.dp_post_id+"&nonce="+dt_params.dtnonce |
| 21 | }, dt_params.dp_post_text |
| 22 | ) |
| 23 | ); |
| 24 | } |
| 25 | |
| 26 | registerPlugin( 'dt-duplicate-post-status-info-plugin', { |
| 27 | render: dpGutenButton |
| 28 | } ); |