[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-blogs/js/blocks/ -> recent-posts.js (source)

   1  // modules are defined as an array
   2  // [ module function, map of requires ]
   3  //
   4  // map of requires is short require name -> numeric require
   5  //
   6  // anything defined in a previous bundle is accessed via the
   7  // orig method which is the require for previous bundles
   8  parcelRequire = (function (modules, cache, entry, globalName) {
   9    // Save the require from previous bundle to this closure if any
  10    var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
  11    var nodeRequire = typeof require === 'function' && require;
  12  
  13    function newRequire(name, jumped) {
  14      if (!cache[name]) {
  15        if (!modules[name]) {
  16          // if we cannot find the module within our internal map or
  17          // cache jump to the current global require ie. the last bundle
  18          // that was added to the page.
  19          var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
  20          if (!jumped && currentRequire) {
  21            return currentRequire(name, true);
  22          }
  23  
  24          // If there are other bundles on this page the require from the
  25          // previous one is saved to 'previousRequire'. Repeat this as
  26          // many times as there are bundles until the module is found or
  27          // we exhaust the require chain.
  28          if (previousRequire) {
  29            return previousRequire(name, true);
  30          }
  31  
  32          // Try the node require function if it exists.
  33          if (nodeRequire && typeof name === 'string') {
  34            return nodeRequire(name);
  35          }
  36  
  37          var err = new Error('Cannot find module \'' + name + '\'');
  38          err.code = 'MODULE_NOT_FOUND';
  39          throw err;
  40        }
  41  
  42        localRequire.resolve = resolve;
  43        localRequire.cache = {};
  44  
  45        var module = cache[name] = new newRequire.Module(name);
  46  
  47        modules[name][0].call(module.exports, localRequire, module, module.exports, this);
  48      }
  49  
  50      return cache[name].exports;
  51  
  52      function localRequire(x){
  53        return newRequire(localRequire.resolve(x));
  54      }
  55  
  56      function resolve(x){
  57        return modules[name][1][x] || x;
  58      }
  59    }
  60  
  61    function Module(moduleName) {
  62      this.id = moduleName;
  63      this.bundle = newRequire;
  64      this.exports = {};
  65    }
  66  
  67    newRequire.isParcelRequire = true;
  68    newRequire.Module = Module;
  69    newRequire.modules = modules;
  70    newRequire.cache = cache;
  71    newRequire.parent = previousRequire;
  72    newRequire.register = function (id, exports) {
  73      modules[id] = [function (require, module) {
  74        module.exports = exports;
  75      }, {}];
  76    };
  77  
  78    var error;
  79    for (var i = 0; i < entry.length; i++) {
  80      try {
  81        newRequire(entry[i]);
  82      } catch (e) {
  83        // Save first error but execute all entries
  84        if (!error) {
  85          error = e;
  86        }
  87      }
  88    }
  89  
  90    if (entry.length) {
  91      // Expose entry point to Node, AMD or browser globals
  92      // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
  93      var mainExports = newRequire(entry[entry.length - 1]);
  94  
  95      // CommonJS
  96      if (typeof exports === "object" && typeof module !== "undefined") {
  97        module.exports = mainExports;
  98  
  99      // RequireJS
 100      } else if (typeof define === "function" && define.amd) {
 101       define(function () {
 102         return mainExports;
 103       });
 104  
 105      // <script>
 106      } else if (globalName) {
 107        this[globalName] = mainExports;
 108      }
 109    }
 110  
 111    // Override the current require with this new one
 112    parcelRequire = newRequire;
 113  
 114    if (error) {
 115      // throw error from earlier, _after updating parcelRequire_
 116      throw error;
 117    }
 118  
 119    return newRequire;
 120  })({"Pfcj":[function(require,module,exports) {
 121  "use strict";
 122  
 123  Object.defineProperty(exports, "__esModule", {
 124    value: true
 125  });
 126  exports.default = void 0;
 127  
 128  /**
 129   * WordPress dependencies.
 130   */
 131  const {
 132    blockEditor: {
 133      InspectorControls
 134    },
 135    components: {
 136      Disabled,
 137      PanelBody,
 138      RangeControl,
 139      TextControl,
 140      ToggleControl
 141    },
 142    element: {
 143      Fragment,
 144      createElement
 145    },
 146    i18n: {
 147      __
 148    },
 149    serverSideRender: ServerSideRender
 150  } = wp;
 151  
 152  const editRecentPostsBlock = ({
 153    attributes,
 154    setAttributes
 155  }) => {
 156    const {
 157      title,
 158      maxPosts,
 159      linkTitle
 160    } = attributes;
 161    return createElement(Fragment, null, createElement(InspectorControls, null, createElement(PanelBody, {
 162      title: __('Settings', 'buddypress'),
 163      initialOpen: true
 164    }, createElement(TextControl, {
 165      label: __('Title', 'buddypress'),
 166      value: title,
 167      onChange: text => {
 168        setAttributes({
 169          title: text
 170        });
 171      }
 172    }), createElement(RangeControl, {
 173      label: __('Max posts to show', 'buddypress'),
 174      value: maxPosts,
 175      onChange: value => setAttributes({
 176        maxPosts: value
 177      }),
 178      min: 1,
 179      max: 10,
 180      required: true
 181    }), createElement(ToggleControl, {
 182      label: __('Link block title to Blogs directory', 'buddypress'),
 183      checked: !!linkTitle,
 184      onChange: () => {
 185        setAttributes({
 186          linkTitle: !linkTitle
 187        });
 188      }
 189    }))), createElement(Disabled, null, createElement(ServerSideRender, {
 190      block: "bp/recent-posts",
 191      attributes: attributes
 192    })));
 193  };
 194  
 195  var _default = editRecentPostsBlock;
 196  exports.default = _default;
 197  },{}],"D8sC":[function(require,module,exports) {
 198  "use strict";
 199  
 200  Object.defineProperty(exports, "__esModule", {
 201    value: true
 202  });
 203  exports.default = void 0;
 204  
 205  /**
 206   * WordPress dependencies.
 207   */
 208  const {
 209    blocks: {
 210      createBlock
 211    }
 212  } = wp;
 213  /**
 214   * Transforms Legacy Widget to Recent Posts Block.
 215   *
 216   * @type {Object}
 217   */
 218  
 219  const transforms = {
 220    from: [{
 221      type: 'block',
 222      blocks: ['core/legacy-widget'],
 223      isMatch: ({
 224        idBase,
 225        instance
 226      }) => {
 227        if (!(instance !== null && instance !== void 0 && instance.raw)) {
 228          return false;
 229        }
 230  
 231        return idBase === 'bp_blogs_recent_posts_widget';
 232      },
 233      transform: ({
 234        instance
 235      }) => {
 236        return createBlock('bp/recent-posts', {
 237          title: instance.raw.title,
 238          maxPosts: instance.raw.max_posts,
 239          linkTitle: instance.raw.link_title
 240        });
 241      }
 242    }]
 243  };
 244  var _default = transforms;
 245  exports.default = _default;
 246  },{}],"PMBS":[function(require,module,exports) {
 247  "use strict";
 248  
 249  var _edit = _interopRequireDefault(require("./recent-posts/edit"));
 250  
 251  var _transforms = _interopRequireDefault(require("./recent-posts/transforms"));
 252  
 253  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 254  
 255  /**
 256   * WordPress dependencies.
 257   */
 258  const {
 259    blocks: {
 260      registerBlockType
 261    },
 262    i18n: {
 263      __
 264    }
 265  } = wp;
 266  /**
 267   * Internal dependencies.
 268   */
 269  
 270  registerBlockType('bp/recent-posts', {
 271    title: __('Recent Networkwide Posts', 'buddypress'),
 272    description: __('A list of recently published posts from across your network.', 'buddypress'),
 273    icon: {
 274      background: '#fff',
 275      foreground: '#d84800',
 276      src: 'wordpress'
 277    },
 278    category: 'buddypress',
 279    attributes: {
 280      title: {
 281        type: 'string',
 282        default: __('Recent Networkwide Posts', 'buddypress')
 283      },
 284      maxPosts: {
 285        type: 'number',
 286        default: 10
 287      },
 288      linkTitle: {
 289        type: 'boolean',
 290        default: false
 291      }
 292    },
 293    edit: _edit.default,
 294    transforms: _transforms.default
 295  });
 296  },{"./recent-posts/edit":"Pfcj","./recent-posts/transforms":"D8sC"}]},{},["PMBS"], null)


Generated: Wed Apr 26 01:01:24 2023 Cross-referenced by PHPXref 0.7.1