Making WordPress.org

Changeset 10930


Ignore:
Timestamp:
04/27/2021 02:19:13 PM (4 years ago)
Author:
ryelle
Message:

Pattern Directory: Sync with git WordPress/pattern-directory@a1093822ab72572be6cdb87b28f9462f208286e9

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php

    r10924 r10930  
    1 <?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-data-controls', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-viewport'), 'version' => '47d0699f3951f1009351fbc4a9fef0da');
     1<?php return array('dependencies' => array('react', 'wp-components', 'wp-compose', 'wp-data', 'wp-data-controls', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-viewport'), 'version' => '51d417961bbb5e88ef5cc17bcdd3e65e');
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js

    r10924 r10930  
    1133811338      head = _ref.head,
    1133911339      headHTML = _ref.headHTML,
    11340       props = _babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2___default()(_ref, ["contentRef", "children", "head", "headHTML"]);
     11340      themeSlug = _ref.themeSlug,
     11341      props = _babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2___default()(_ref, ["contentRef", "children", "head", "headHTML", "themeSlug"]);
    1134111342
    1134211343  var _useState = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["useState"])(),
     
    1134411345      iframeDocument = _useState2[0],
    1134511346      setIframeDocument = _useState2[1];
     11347
     11348  headHTML += '<style>body{pointer-events:none;display: flex;align-items: center;justify-content: center;min-height: 100vh;} body > div {width: 100%}</style>';
     11349
     11350  if (themeSlug) {
     11351    headHTML += "<link rel=\"stylesheet\" href=\"https://wp-themes.com/wp-content/themes/".concat(themeSlug, "/style.css\" media=\"all\" />");
     11352  } else {
     11353    headHTML += '<link rel="stylesheet" href="https://wp-themes.com/wp-content/themes/twentytwentyone/style.css" media="all" />';
     11354  }
    1134611355
    1134711356  var setRef = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (node) {
     
    1159611605      }
    1159711606    }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("img", {
    11598       src: "/wp-content/themes/pattern-directory/images/copy-paste-demo.gif",
     11607      src: "".concat(wporgAssetUrl, "/images/copy-paste-demo.gif"),
    1159911608      alt: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('GIF of copy and pasting.', 'wporg-patterns')
    1160011609    }))
     
    1174811757/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
    1174911758/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
    11750 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
    11751 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__);
    11752 
    11753 
    11754 /**
    11755  * WordPress dependencies
     11759/* harmony import */ var _iframe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../iframe */ "./src/components/iframe/index.js");
     11760
     11761
     11762/**
     11763 * Internal dependencies
    1175611764 */
    1175711765
     
    1176511773    overflowY: 'auto'
    1176611774  };
    11767   var extraIframeStyles = // @todo - Should we keep the TT1 style? Load css from a local file?
    11768   '<link rel="stylesheet" id="twenty-twenty-one-style-css"  href="https://wp-themes.com/wp-content/themes/twentytwentyone/style.css?ver=1.2" media="all" />' + '<style>body{pointer-events:none;display: flex;align-items: center;justify-content: center;min-height: 100vh;} body > div {width: 100%}</style>';
    11769   return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__["__unstableIframe"], {
     11775  return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_iframe__WEBPACK_IMPORTED_MODULE_1__["default"], {
    1177011776    className: "pattern-preview__viewport-iframe",
    1177111777    style: style,
    11772     headHTML: window.__editorStyles.html + extraIframeStyles
     11778    headHTML: window.__editorStyles.html
    1177311779  }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
    1177411780    dangerouslySetInnerHTML: {
     
    1313813144/***/ }),
    1313913145
    13140 /***/ "@wordpress/block-editor":
    13141 /*!*************************************!*\
    13142   !*** external ["wp","blockEditor"] ***!
    13143   \*************************************/
    13144 /*! no static exports found */
    13145 /***/ (function(module, exports) {
    13146 
    13147 (function() { module.exports = window["wp"]["blockEditor"]; }());
    13148 
    13149 /***/ }),
    13150 
    1315113146/***/ "@wordpress/components":
    1315213147/*!************************************!*\
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/functions.php

    r10882 r10930  
    5959
    6060        wp_set_script_translations( 'wporg-pattern-script', 'wporg-patterns' );
     61
     62        wp_add_inline_script(
     63            'wporg-pattern-script',
     64            sprintf( 'var wporgAssetUrl = "%s";', esc_url( get_stylesheet_directory_uri() ) ),
     65            'before'
     66        );
    6167    }
    6268
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/package.json

    r10882 r10930  
    5555        "extends": "../../../../.eslintrc.js",
    5656        "globals": {
    57             "wporgBlockPattern": "readonly"
     57            "wporgAssetUrl": "readonly"
    5858        }
    5959    },
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/iframe/index.js

    r10882 r10930  
    9191}
    9292
    93 function Iframe( { contentRef, children, head, headHTML, ...props }, ref ) {
     93function Iframe( { contentRef, children, head, headHTML, themeSlug, ...props }, ref ) {
    9494    const [ iframeDocument, setIframeDocument ] = useState();
     95
     96    headHTML +=
     97        '<style>body{pointer-events:none;display: flex;align-items: center;justify-content: center;min-height: 100vh;} body > div {width: 100%}</style>';
     98
     99    if ( themeSlug ) {
     100        headHTML += `<link rel="stylesheet" href="https://wp-themes.com/wp-content/themes/${ themeSlug }/style.css" media="all" />`;
     101    } else {
     102        headHTML += '<link rel="stylesheet" href="https://wp-themes.com/wp-content/themes/twentytwentyone/style.css" media="all" />';
     103    }
    95104
    96105    const setRef = useCallback( ( node ) => {
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/pattern-preview-actions/copy-guide.js

    r10924 r10930  
    1010    <div style={ { height: '220px' } }>
    1111        <img
    12             src="/wp-content/themes/pattern-directory/images/copy-paste-demo.gif"
     12            src={ `${ wporgAssetUrl }/images/copy-paste-demo.gif` }
    1313            alt={ __( 'GIF of copy and pasting.', 'wporg-patterns' ) }
    1414        />
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/pattern-preview/canvas.js

    r10841 r10930  
    11/**
    2  * WordPress dependencies
     2 * Internal dependencies
    33 */
    4 import {
    5     /* eslint-disable-next-line @wordpress/no-unsafe-wp-apis -- Experimental is OK. */
    6     __unstableIframe as Iframe,
    7 } from '@wordpress/block-editor';
     4import Iframe from '../iframe';
    85
    96function Canvas( { html } ) {
     
    1411        overflowY: 'auto',
    1512    };
    16     const extraIframeStyles =
    17         // @todo - Should we keep the TT1 style? Load css from a local file?
    18         '<link rel="stylesheet" id="twenty-twenty-one-style-css"  href="https://wp-themes.com/wp-content/themes/twentytwentyone/style.css?ver=1.2" media="all" />' +
    19         '<style>body{pointer-events:none;display: flex;align-items: center;justify-content: center;min-height: 100vh;} body > div {width: 100%}</style>';
    2013
    2114    return (
     
    2417                className="pattern-preview__viewport-iframe"
    2518                style={ style }
    26                 headHTML={ window.__editorStyles.html + extraIframeStyles }
     19                headHTML={ window.__editorStyles.html }
    2720            >
    2821                <div
Note: See TracChangeset for help on using the changeset viewer.