mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-15 15:16:29 +01:00
56842f36aa
Props danielbachhuber, peterwilsoncc. Fixes #45269. See #42864. Built from https://develop.svn.wordpress.org/branches/5.0@43862 git-svn-id: http://core.svn.wordpress.org/branches/5.0@43691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
26 KiB
Plaintext
1 line
26 KiB
Plaintext
{"version":3,"sources":["webpack://wp.[name]/webpack/bootstrap","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/classCallCheck.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/createClass.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/inherits.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://wp.[name]//Users/pento/Projects/gutenberg/packages/list-reusable-blocks/src/components/import-dropdown/index.js","webpack://wp.[name]//Users/pento/Projects/gutenberg/packages/list-reusable-blocks/src/components/import-form/index.js","webpack://wp.[name]//Users/pento/Projects/gutenberg/packages/list-reusable-blocks/src/index.js","webpack://wp.[name]//Users/pento/Projects/gutenberg/packages/list-reusable-blocks/src/utils/export.js","webpack://wp.[name]//Users/pento/Projects/gutenberg/packages/list-reusable-blocks/src/utils/file.js","webpack://wp.[name]//Users/pento/Projects/gutenberg/packages/list-reusable-blocks/src/utils/import.js","webpack://wp.[name]/external {\"this\":[\"wp\",\"apiFetch\"]}","webpack://wp.[name]/external {\"this\":[\"wp\",\"components\"]}","webpack://wp.[name]/external {\"this\":[\"wp\",\"compose\"]}","webpack://wp.[name]/external {\"this\":[\"wp\",\"element\"]}","webpack://wp.[name]/external {\"this\":[\"wp\",\"i18n\"]}","webpack://wp.[name]/external \"lodash\""],"names":["ImportDropdown","onUpload","isOpen","onToggle","__","onClose","flow","ImportForm","arguments","state","isLoading","error","file","isStillMounted","onChangeFile","bind","onSubmit","event","setState","target","files","preventDefault","props","importReusableBlock","then","reusableBlock","catch","uiMessage","message","instanceId","inputId","_x","Component","withInstanceId","document","body","addEventListener","classList","contains","exportReusableBlock","dataset","id","button","querySelector","showNotice","notice","createElement","className","innerHTML","headerEnd","parentNode","insertBefore","container","render","apiFetch","path","postType","rest_base","post","title","raw","content","fileContent","JSON","stringify","__file","fileName","kebabCase","download","contentType","window","Blob","type","navigator","msSaveOrOpenBlob","a","href","URL","createObjectURL","style","display","appendChild","click","removeChild","readTextFile","reader","FileReader","Promise","resolve","onload","result","readAsText","parsedContent","parse","Error","isString","data","status","method"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;AClFA;AAAA;AAAe;AACf;AACA;AACA;;AAEA;AACA,C;;;;;;;;;;;;ACNA;AAAA;AAAA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA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require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./node_modules/@wordpress/list-reusable-blocks/build-module/index.js\");\n","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nexport default function _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}","/**\n * External dependencies\n */\nimport { flow } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ImportForm from '../import-form';\n\nfunction ImportDropdown( { onUpload } ) {\n\treturn (\n\t\t<Dropdown\n\t\t\tposition=\"bottom right\"\n\t\t\tcontentClassName=\"list-reusable-blocks-import-dropdown__content\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\tisPrimary\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Import from JSON' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<ImportForm onUpload={ flow( onClose, onUpload ) } />\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default ImportDropdown;\n","/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { withInstanceId } from '@wordpress/compose';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, Notice } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport importReusableBlock from '../../utils/import';\n\nclass ImportForm extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\tisLoading: false,\n\t\t\terror: null,\n\t\t\tfile: null,\n\t\t};\n\n\t\tthis.isStillMounted = true;\n\t\tthis.onChangeFile = this.onChangeFile.bind( this );\n\t\tthis.onSubmit = this.onSubmit.bind( this );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.isStillMounted = false;\n\t}\n\n\tonChangeFile( event ) {\n\t\tthis.setState( { file: event.target.files[ 0 ] } );\n\t}\n\n\tonSubmit( event ) {\n\t\tevent.preventDefault();\n\t\tconst { file } = this.state;\n\t\tconst { onUpload } = this.props;\n\t\tif ( ! file ) {\n\t\t\treturn;\n\t\t}\n\t\tthis.setState( { isLoading: true } );\n\t\timportReusableBlock( file )\n\t\t\t.then( ( reusableBlock ) => {\n\t\t\t\tif ( ! this.isStillMounted ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.setState( { isLoading: false } );\n\t\t\t\tonUpload( reusableBlock );\n\t\t\t} )\n\t\t\t.catch( ( error ) => {\n\t\t\t\tif ( ! this.isStillMounted ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet uiMessage;\n\t\t\t\tswitch ( error.message ) {\n\t\t\t\t\tcase 'Invalid JSON file':\n\t\t\t\t\t\tuiMessage = __( 'Invalid JSON file' );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'Invalid Reusable Block JSON file':\n\t\t\t\t\t\tuiMessage = __( 'Invalid Reusable Block JSON file' );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tuiMessage = __( 'Unknown error' );\n\t\t\t\t}\n\n\t\t\t\tthis.setState( { isLoading: false, error: uiMessage } );\n\t\t\t} );\n\t}\n\n\trender() {\n\t\tconst { instanceId } = this.props;\n\t\tconst { file, isLoading, error } = this.state;\n\t\tconst inputId = 'list-reusable-blocks-import-form-' + instanceId;\n\t\treturn (\n\t\t\t<form\n\t\t\t\tclassName=\"list-reusable-blocks-import-form\"\n\t\t\t\tonSubmit={ this.onSubmit }\n\t\t\t>\n\t\t\t\t{ error && (\n\t\t\t\t\t<Notice status=\"error\">\n\t\t\t\t\t\t{ error }\n\t\t\t\t\t</Notice>\n\t\t\t\t) }\n\t\t\t\t<label\n\t\t\t\t\thtmlFor={ inputId }\n\t\t\t\t\tclassName=\"list-reusable-blocks-import-form__label\"\n\t\t\t\t>\n\t\t\t\t\t{ __( 'File' ) }\n\t\t\t\t</label>\n\t\t\t\t<input\n\t\t\t\t\tid={ inputId }\n\t\t\t\t\ttype=\"file\"\n\t\t\t\t\tonChange={ this.onChangeFile }\n\t\t\t\t/>\n\t\t\t\t<Button\n\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\tisBusy={ isLoading }\n\t\t\t\t\tdisabled={ ! file || isLoading }\n\t\t\t\t\tisDefault\n\t\t\t\t\tclassName=\"list-reusable-blocks-import-form__button\"\n\t\t\t\t>\n\t\t\t\t\t{ _x( 'Import', 'button label' ) }\n\t\t\t\t</Button>\n\t\t\t</form>\n\t\t);\n\t}\n}\n\nexport default withInstanceId( ImportForm );\n","/**\n * WordPress dependencies\n */\nimport { render } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport exportReusableBlock from './utils/export';\nimport ImportDropdown from './components/import-dropdown';\n\n// Setup Export Links\ndocument.body.addEventListener( 'click', ( event ) => {\n\tif ( ! event.target.classList.contains( 'wp-list-reusable-blocks__export' ) ) {\n\t\treturn;\n\t}\n\tevent.preventDefault();\n\texportReusableBlock( event.target.dataset.id );\n} );\n\n// Setup Import Form\ndocument.addEventListener( 'DOMContentLoaded', () => {\n\tconst button = document.querySelector( '.page-title-action' );\n\tif ( ! button ) {\n\t\treturn;\n\t}\n\n\tconst showNotice = () => {\n\t\tconst notice = document.createElement( 'div' );\n\t\tnotice.className = 'notice notice-success is-dismissible';\n\t\tnotice.innerHTML = `<p>${ __( 'Reusable block imported successfully!' ) }</p>`;\n\n\t\tconst headerEnd = document.querySelector( '.wp-header-end' );\n\t\tif ( ! headerEnd ) {\n\t\t\treturn;\n\t\t}\n\t\theaderEnd.parentNode.insertBefore( notice, headerEnd );\n\t};\n\n\tconst container = document.createElement( 'div' );\n\tcontainer.className = 'list-reusable-blocks__container';\n\tbutton.parentNode.insertBefore( container, button );\n\trender( <ImportDropdown onUpload={ showNotice } />, container );\n} );\n","/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { download } from './file';\n\n/**\n * Export a reusable block as a JSON file.\n *\n * @param {number} id\n */\nasync function exportReusableBlock( id ) {\n\tconst postType = await apiFetch( { path: `/wp/v2/types/wp_block` } );\n\tconst post = await apiFetch( { path: `/wp/v2/${ postType.rest_base }/${ id }?context=edit` } );\n\tconst title = post.title.raw;\n\tconst content = post.content.raw;\n\tconst fileContent = JSON.stringify( {\n\t\t__file: 'wp_block',\n\t\ttitle,\n\t\tcontent,\n\t}, null, 2 );\n\tconst fileName = kebabCase( title ) + '.json';\n\n\tdownload( fileName, fileContent, 'application/json' );\n}\n\nexport default exportReusableBlock;\n","/**\n * Downloads a file.\n *\n * @param {string} fileName File Name.\n * @param {string} content File Content.\n * @param {string} contentType File mime type.\n */\nexport function download( fileName, content, contentType ) {\n\tconst file = new window.Blob( [ content ], { type: contentType } );\n\n\t// IE11 can't use the click to download technique\n\t// we use a specific IE11 technique instead.\n\tif ( window.navigator.msSaveOrOpenBlob ) {\n\t\twindow.navigator.msSaveOrOpenBlob( file, fileName );\n\t} else {\n\t\tconst a = document.createElement( 'a' );\n\t\ta.href = URL.createObjectURL( file );\n\t\ta.download = fileName;\n\n\t\ta.style.display = 'none';\n\t\tdocument.body.appendChild( a );\n\t\ta.click();\n\t\tdocument.body.removeChild( a );\n\t}\n}\n\n/**\n * Reads the textual content of the given file.\n *\n * @param {File} file File.\n * @return {Promise<string>} Content of the file.\n */\nexport function readTextFile( file ) {\n\tconst reader = new window.FileReader();\n\treturn new Promise( ( resolve ) => {\n\t\treader.onload = function() {\n\t\t\tresolve( reader.result );\n\t\t};\n\t\treader.readAsText( file );\n\t} );\n}\n","/**\n * External dependencies\n */\nimport { isString } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { readTextFile } from './file';\n\n/**\n * Import a reusable block from a JSON file.\n *\n * @param {File} file File.\n * @return {Promise} Promise returning the imported reusable block.\n */\nasync function importReusableBlock( file ) {\n\tconst fileContent = await readTextFile( file );\n\tlet parsedContent;\n\ttry {\n\t\tparsedContent = JSON.parse( fileContent );\n\t} catch ( e ) {\n\t\tthrow new Error( 'Invalid JSON file' );\n\t}\n\tif (\n\t\tparsedContent.__file !== 'wp_block' ||\n\t\t! parsedContent.title ||\n\t\t! parsedContent.content ||\n\t\t! isString( parsedContent.title ) ||\n\t\t! isString( parsedContent.content )\n\t) {\n\t\tthrow new Error( 'Invalid Reusable Block JSON file' );\n\t}\n\tconst postType = await apiFetch( { path: `/wp/v2/types/wp_block` } );\n\tconst reusableBlock = await apiFetch( {\n\t\tpath: `/wp/v2/${ postType.rest_base }`,\n\t\tdata: {\n\t\t\ttitle: parsedContent.title,\n\t\t\tcontent: parsedContent.content,\n\t\t\tstatus: 'publish',\n\t\t},\n\t\tmethod: 'POST',\n\t} );\n\n\treturn reusableBlock;\n}\n\nexport default importReusableBlock;\n","(function() { module.exports = this[\"wp\"][\"apiFetch\"]; }());","(function() { module.exports = this[\"wp\"][\"components\"]; }());","(function() { module.exports = this[\"wp\"][\"compose\"]; }());","(function() { module.exports = this[\"wp\"][\"element\"]; }());","(function() { module.exports = this[\"wp\"][\"i18n\"]; }());","(function() { module.exports = this[\"lodash\"]; }());"],"sourceRoot":""} |