[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/script-modules/block-library/file/ -> view.js (source)

   1  import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity";
   2  /******/ // The require scope
   3  /******/ var __webpack_require__ = {};
   4  /******/ 
   5  /************************************************************************/
   6  /******/ /* webpack/runtime/define property getters */
   7  /******/ (() => {
   8  /******/     // define getter functions for harmony exports
   9  /******/     __webpack_require__.d = (exports, definition) => {
  10  /******/         for(var key in definition) {
  11  /******/             if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  12  /******/                 Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  13  /******/             }
  14  /******/         }
  15  /******/     };
  16  /******/ })();
  17  /******/ 
  18  /******/ /* webpack/runtime/hasOwnProperty shorthand */
  19  /******/ (() => {
  20  /******/     __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  21  /******/ })();
  22  /******/ 
  23  /************************************************************************/
  24  var __webpack_exports__ = {};
  25  
  26  ;// CONCATENATED MODULE: external "@wordpress/interactivity"
  27  var x = (y) => {
  28      var x = {}; __webpack_require__.d(x, y); return x
  29  } 
  30  var y = (x) => (() => (x))
  31  const interactivity_namespaceObject = x({ ["store"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.store) });
  32  ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/utils/index.js
  33  /**
  34   * Uses a combination of user agent matching and feature detection to determine whether
  35   * the current browser supports rendering PDFs inline.
  36   *
  37   * @return {boolean} Whether or not the browser supports inline PDFs.
  38   */
  39  const browserSupportsPdfs = () => {
  40    // Most mobile devices include "Mobi" in their UA.
  41    if (window.navigator.userAgent.indexOf('Mobi') > -1) {
  42      return false;
  43    }
  44  
  45    // Android tablets are the noteable exception.
  46    if (window.navigator.userAgent.indexOf('Android') > -1) {
  47      return false;
  48    }
  49  
  50    // iPad pretends to be a Mac.
  51    if (window.navigator.userAgent.indexOf('Macintosh') > -1 && window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2) {
  52      return false;
  53    }
  54  
  55    // IE only supports PDFs when there's an ActiveX object available for it.
  56    if (!!(window.ActiveXObject || 'ActiveXObject' in window) && !(createActiveXObject('AcroPDF.PDF') || createActiveXObject('PDF.PdfCtrl'))) {
  57      return false;
  58    }
  59    return true;
  60  };
  61  
  62  /**
  63   * Helper function for creating ActiveX objects, catching any errors that are thrown
  64   * when it's generated.
  65   *
  66   * @param {string} type The name of the ActiveX object to create.
  67   * @return {window.ActiveXObject|undefined} The generated ActiveXObject, or null if it failed.
  68   */
  69  const createActiveXObject = type => {
  70    let ax;
  71    try {
  72      ax = new window.ActiveXObject(type);
  73    } catch (e) {
  74      ax = undefined;
  75    }
  76    return ax;
  77  };
  78  
  79  ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/view.js
  80  /**
  81   * WordPress dependencies
  82   */
  83  
  84  /**
  85   * Internal dependencies
  86   */
  87  
  88  (0,interactivity_namespaceObject.store)('core/file', {
  89    state: {
  90      get hasPdfPreview() {
  91        return browserSupportsPdfs();
  92      }
  93    }
  94  }, {
  95    lock: true
  96  });
  97  


Generated : Sat Nov 23 08:20:01 2024 Cross-referenced by PHPXref