1
- ( ( ) => { "use strict" ; const e = window . React , t = window . wp . i18n ; ( 0 , window . wp . plugins . registerPlugin ) ( "dlx-pattern-wrangler-preview-button" , { render :function ( ) { return ( 0 , e . useEffect ) ( ( function ( ) { var e = document . querySelector ( ".edit-post-header" ) ; if ( null !== e ) { var r = e . querySelector ( ".edit-post-header__settings" ) ; if ( null !== r ) { var n = document . createElement ( "a" ) ; n . className = "dlx-button-preview components-button has-icon" , n . ariaLabel = ( 0 , t . __ ) ( "Preview" , "dlx-pattern-wrangler" ) , n . href = dlxPatternWranglerPreview . previewUrl , n . target = "_blank" , n . rel = "noopener noreferrer" ; var a = document . createElement ( "svg" ) ; a . className = "dlx-pattern-wrangler-preview-icon" , a . innerHTML = '<svg width="16" height="16" style="display: inline-block; margin-right: 8px;"><use xlink:href="#dlx-pattern-wrangler-preview-icon" /></svg>' , n . prepend ( a ) , r . prepend ( n ) } } } ) , [ ] ) , React . createElement ( React . Fragment , null , React . createElement ( "svg" , { height :"0" , width :"0" , xmlns :"http://www.w3.org/2000/svg" , style :{ display :"none" } , "aria-hidden" :"true" } , React . createElement ( "symbol" , { id :"dlx-pattern-wrangler-preview-icon" , width :"16" , height :"16" , viewBox :"0 0 512 512" } , React . createElement ( "path" , { fill :"currentColor" , d :"M304 24c0 13.3 10.7 24 24 24h102.1L207 271c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l223-223V184c0 13.3 10.7 24 24 24s24-10.7 24-24V24c0-13.3-10.7-24-24-24H328c-13.3 0-24 10.7-24 24zM72 32C32.2 32 0 64.2 0 104v336c0 39.8 32.2 72 72 72h336c39.8 0 72-32.2 72-72V312c0-13.3-10.7-24-24-24s-24 10.7-24 24v128c0 13.3-10.7 24-24 24H72c-13.3 0-24-10.7-24-24V104c0-13.3 10.7-24 24-24h128c13.3 0 24-10.7 24-24s-10.7-24-24-24H72z" } ) ) ) ) } } ) } ) ( ) ;
2
- //# sourceMappingURL=dlx-pw-preview.js.map
1
+ /******/ ( ( ) => { // webpackBootstrap
2
+ /******/ "use strict" ;
3
+ /******/ var __webpack_modules__ = ( {
4
+
5
+ /***/ "react" :
6
+ /*!************************!*\
7
+ !*** external "React" ***!
8
+ \************************/
9
+ /***/ ( ( module ) => {
10
+
11
+ module . exports = window [ "React" ] ;
12
+
13
+ /***/ } ) ,
14
+
15
+ /***/ "@wordpress/i18n" :
16
+ /*!******************************!*\
17
+ !*** external ["wp","i18n"] ***!
18
+ \******************************/
19
+ /***/ ( ( module ) => {
20
+
21
+ module . exports = window [ "wp" ] [ "i18n" ] ;
22
+
23
+ /***/ } ) ,
24
+
25
+ /***/ "@wordpress/plugins" :
26
+ /*!*********************************!*\
27
+ !*** external ["wp","plugins"] ***!
28
+ \*********************************/
29
+ /***/ ( ( module ) => {
30
+
31
+ module . exports = window [ "wp" ] [ "plugins" ] ;
32
+
33
+ /***/ } )
34
+
35
+ /******/ } ) ;
36
+ /************************************************************************/
37
+ /******/ // The module cache
38
+ /******/ var __webpack_module_cache__ = { } ;
39
+ /******/
40
+ /******/ // The require function
41
+ /******/ function __webpack_require__ ( moduleId ) {
42
+ /******/ // Check if module is in cache
43
+ /******/ var cachedModule = __webpack_module_cache__ [ moduleId ] ;
44
+ /******/ if ( cachedModule !== undefined ) {
45
+ /******/ return cachedModule . exports ;
46
+ /******/ }
47
+ /******/ // Create a new module (and put it into the cache)
48
+ /******/ var module = __webpack_module_cache__ [ moduleId ] = {
49
+ /******/ // no module.id needed
50
+ /******/ // no module.loaded needed
51
+ /******/ exports : { }
52
+ /******/ } ;
53
+ /******/
54
+ /******/ // Execute the module function
55
+ /******/ __webpack_modules__ [ moduleId ] ( module , module . exports , __webpack_require__ ) ;
56
+ /******/
57
+ /******/ // Return the exports of the module
58
+ /******/ return module . exports ;
59
+ /******/ }
60
+ /******/
61
+ /************************************************************************/
62
+ /******/ /* webpack/runtime/compat get default export */
63
+ /******/ ( ( ) => {
64
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
65
+ /******/ __webpack_require__ . n = ( module ) => {
66
+ /******/ var getter = module && module . __esModule ?
67
+ /******/ ( ) => ( module [ 'default' ] ) :
68
+ /******/ ( ) => ( module ) ;
69
+ /******/ __webpack_require__ . d ( getter , { a : getter } ) ;
70
+ /******/ return getter ;
71
+ /******/ } ;
72
+ /******/ } ) ( ) ;
73
+ /******/
74
+ /******/ /* webpack/runtime/define property getters */
75
+ /******/ ( ( ) => {
76
+ /******/ // define getter functions for harmony exports
77
+ /******/ __webpack_require__ . d = ( exports , definition ) => {
78
+ /******/ for ( var key in definition ) {
79
+ /******/ if ( __webpack_require__ . o ( definition , key ) && ! __webpack_require__ . o ( exports , key ) ) {
80
+ /******/ Object . defineProperty ( exports , key , { enumerable : true , get : definition [ key ] } ) ;
81
+ /******/ }
82
+ /******/ }
83
+ /******/ } ;
84
+ /******/ } ) ( ) ;
85
+ /******/
86
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
87
+ /******/ ( ( ) => {
88
+ /******/ __webpack_require__ . o = ( obj , prop ) => ( Object . prototype . hasOwnProperty . call ( obj , prop ) )
89
+ /******/ } ) ( ) ;
90
+ /******/
91
+ /******/ /* webpack/runtime/make namespace object */
92
+ /******/ ( ( ) => {
93
+ /******/ // define __esModule on exports
94
+ /******/ __webpack_require__ . r = ( exports ) => {
95
+ /******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
96
+ /******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
97
+ /******/ }
98
+ /******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
99
+ /******/ } ;
100
+ /******/ } ) ( ) ;
101
+ /******/
102
+ /************************************************************************/
103
+ var __webpack_exports__ = { } ;
104
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
105
+ ( ( ) => {
106
+ /*!**************************************************!*\
107
+ !*** ./src/js/blocks/plugins/pattern-preview.js ***!
108
+ \**************************************************/
109
+ __webpack_require__ . r ( __webpack_exports__ ) ;
110
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__ ( /*! react */ "react" ) ;
111
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/ __webpack_require__ . n ( react__WEBPACK_IMPORTED_MODULE_0__ ) ;
112
+ /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__ ( /*! @wordpress/i18n */ "@wordpress/i18n" ) ;
113
+ /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__ . n ( _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ ) ;
114
+ /* harmony import */ var _wordpress_plugins__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__ ( /*! @wordpress/plugins */ "@wordpress/plugins" ) ;
115
+ /* harmony import */ var _wordpress_plugins__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/ __webpack_require__ . n ( _wordpress_plugins__WEBPACK_IMPORTED_MODULE_2__ ) ;
116
+
117
+
118
+
119
+
120
+ /**
121
+ * Render a Preview Button.
122
+ *
123
+ * @return {Object } The rendered component.
124
+ */
125
+ var PatternPreviewButton = function PatternPreviewButton ( ) {
126
+ ( 0 , react__WEBPACK_IMPORTED_MODULE_0__ . useEffect ) ( function ( ) {
127
+ var headerToolbar = document . querySelector ( '.edit-post-header' ) ;
128
+ if ( null === headerToolbar ) {
129
+ return ;
130
+ }
131
+
132
+ // Get the left toolbar and add to it.
133
+ var settingsToolbar = headerToolbar . querySelector ( '.edit-post-header__settings' ) ;
134
+ if ( null === settingsToolbar ) {
135
+ return ;
136
+ }
137
+
138
+ // Create the button.
139
+ var button = document . createElement ( 'a' ) ;
140
+ button . className = 'dlx-button-preview components-button has-icon' ;
141
+ button . ariaLabel = ( 0 , _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ . __ ) ( 'Preview' , 'dlx-pattern-wrangler' ) ;
142
+ button . href = dlxPatternWranglerPreview . previewUrl ;
143
+ button . target = '_blank' ;
144
+ button . rel = 'noopener noreferrer' ;
145
+
146
+ // Add icon.
147
+ var icon = document . createElement ( 'svg' ) ;
148
+ icon . className = 'dlx-pattern-wrangler-preview-icon' ;
149
+ icon . innerHTML = '<svg width="16" height="16" style="display: inline-block; margin-right: 8px;"><use xlink:href="#dlx-pattern-wrangler-preview-icon" /></svg>' ;
150
+ button . prepend ( icon ) ;
151
+ // Add the button to the toolbar as the first child.
152
+ settingsToolbar . prepend ( button ) ;
153
+ } , [ ] ) ;
154
+ return /*#__PURE__*/ React . createElement ( React . Fragment , null , /*#__PURE__*/ React . createElement ( "svg" , {
155
+ height : "0" ,
156
+ width : "0" ,
157
+ xmlns : "http://www.w3.org/2000/svg" ,
158
+ style : {
159
+ display : 'none'
160
+ } ,
161
+ "aria-hidden" : "true"
162
+ } , /*#__PURE__*/ React . createElement ( "symbol" , {
163
+ id : "dlx-pattern-wrangler-preview-icon" ,
164
+ width : "16" ,
165
+ height : "16" ,
166
+ viewBox : "0 0 512 512"
167
+ } , /*#__PURE__*/ React . createElement ( "path" , {
168
+ fill : "currentColor" ,
169
+ d : "M304 24c0 13.3 10.7 24 24 24h102.1L207 271c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l223-223V184c0 13.3 10.7 24 24 24s24-10.7 24-24V24c0-13.3-10.7-24-24-24H328c-13.3 0-24 10.7-24 24zM72 32C32.2 32 0 64.2 0 104v336c0 39.8 32.2 72 72 72h336c39.8 0 72-32.2 72-72V312c0-13.3-10.7-24-24-24s-24 10.7-24 24v128c0 13.3-10.7 24-24 24H72c-13.3 0-24-10.7-24-24V104c0-13.3 10.7-24 24-24h128c13.3 0 24-10.7 24-24s-10.7-24-24-24H72z"
170
+ } ) ) ) ) ;
171
+ } ;
172
+ ( 0 , _wordpress_plugins__WEBPACK_IMPORTED_MODULE_2__ . registerPlugin ) ( 'dlx-pattern-wrangler-preview-button' , {
173
+ render : PatternPreviewButton
174
+ } ) ;
175
+ } ) ( ) ;
176
+
177
+ /******/ } ) ( )
178
+ ;
0 commit comments