From 0d578ce83687e85e6c23e881a8a14dc5c28d234d Mon Sep 17 00:00:00 2001 From: Tropicalista Date: Fri, 29 Mar 2024 02:29:41 +0100 Subject: [PATCH] new version --- build/index.asset.php | 2 +- build/index.css | 17 +- build/index.css.map | 1 - build/index.js | 1377 +------------------------------------ build/index.js.map | 1 - build/style-index.css | 16 +- build/style-index.css.map | 1 - build/view.asset.php | 2 +- build/view.js | 88 +-- build/view.js.map | 1 - pdf-embed.php | 4 +- 11 files changed, 8 insertions(+), 1502 deletions(-) delete mode 100644 build/index.css.map delete mode 100644 build/index.js.map delete mode 100644 build/style-index.css.map delete mode 100644 build/view.js.map diff --git a/build/index.asset.php b/build/index.asset.php index 5be7e87..64fb263 100644 --- a/build/index.asset.php +++ b/build/index.asset.php @@ -1 +1 @@ - array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '8e3d30c935191d7f4ad9'); + array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => 'f0e213e4233229328089'); diff --git a/build/index.css b/build/index.css index b07d774..1831305 100644 --- a/build/index.css +++ b/build/index.css @@ -1,16 +1 @@ -/*!****************************************************************************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***! - \****************************************************************************************************************************************************************************************************************************************/ -/** - * The following styles get applied inside the editor only. - * - * Replace them with your own styles or remove the file completely. - */ -.wp-block-tropicalista-pdfembed { - display: flex; - flex-direction: column; - min-height: auto; - height: auto; -} - -/*# sourceMappingURL=index.css.map*/ \ No newline at end of file +.wp-block-tropicalista-pdfembed{display:flex;flex-direction:column;height:auto;min-height:auto} diff --git a/build/index.css.map b/build/index.css.map deleted file mode 100644 index 990a2b1..0000000 --- a/build/index.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACI;EACA;EACA;EACA;AAAJ,C","sources":["webpack://adobe-pdf/./src/editor.scss"],"sourcesContent":["/**\n * The following styles get applied inside the editor only.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.wp-block-tropicalista-pdfembed {\n display: flex;\n flex-direction: column;\n min-height: auto;\n height: auto;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/build/index.js b/build/index.js index 7d20d87..c7d6533 100644 --- a/build/index.js +++ b/build/index.js @@ -1,1376 +1 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ "./src/deprecated.js": -/*!***************************!*\ - !*** ./src/deprecated.js ***! - \***************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); - - -const blockAttributes = { - id: { - type: 'string', - source: 'attribute', - attribute: 'id' - }, - blockId: { - type: 'string' - }, - apiKey: { - type: 'string' - }, - width: { - type: 'number' - }, - height: { - type: 'string', - default: '500px' - }, - mediaUrl: { - type: 'string' - }, - fileName: { - type: 'string', - default: 'My PDF' - }, - embedMode: { - type: 'string', - default: '' - }, - showDownloadPDF: { - type: 'boolean', - default: true - }, - showPrintPDF: { - type: 'boolean', - default: true - }, - showFullScreen: { - type: 'boolean', - default: true - }, - showPageControls: { - type: 'boolean', - default: true - }, - dockPageControls: { - type: 'boolean', - default: true - }, - enableFormFilling: { - type: 'boolean', - default: true - }, - showAnnotationTools: { - type: 'boolean', - default: true - } -}; -const supports = { - html: false, - anchor: true -}; -const v1 = { - blockAttributes, - supports, - isEligible() { - return true; - }, - migrate(attributes) { - console.log(attributes); - return { - ...attributes, - 'data-apikey': attributes.apiKey, - 'data-mediaurl': attributes.mediaUrl, - 'data-defaultviewmode': 'FIT_PAGE' - }; - }, - save({ - attributes - }) { - const { - blockId, - mediaUrl, - embedMode, - height, - apiKey, - showPrintPDF, - showDownloadPDF, - showPageControls, - showFullScreen, - dockPageControls, - fileName, - showAnnotationTools, - enableFormFilling - } = attributes; - console.log(attributes); - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - id: blockId, - ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save(), - style: { - height - }, - "data-apiKey": apiKey, - "data-fileName": fileName, - "data-mediaUrl": mediaUrl, - "data-embedMode": embedMode, - "data-showDownloadPDF": showDownloadPDF, - "data-showPrintPDF": showPrintPDF, - "data-showPageControls": showPageControls, - "data-showFullScreen": showFullScreen, - "data-dockPageControls": dockPageControls, - "data-showAnnotationTools": showAnnotationTools, - "data-enableFormFilling": enableFormFilling - }); - } -}; -const v2 = { - /*attributes: { - id: { - type: 'string', - source: 'attribute', - selector: 'div.wp-block-tropicalista-pdfembed', - attribute: 'id', - }, - blockId: { - type: 'string', - }, - apiKey: { - type: 'string', - source: 'attribute', - selector: 'div.wp-block-tropicalista-pdfembed', - attribute: 'data-apikey', - }, - fileName: { - type: 'string', - source: 'attribute', - selector: 'div.wp-block-tropicalista-pdfembed', - attribute: 'data-filename', - }, - mediaUrl: { - type: 'string', - source: 'attribute', - selector: 'div.wp-block-tropicalista-pdfembed', - attribute: 'data-mediaurl', - }, - embedMode: { - type: 'string', - source: 'attribute', - selector: 'div.wp-block-tropicalista-pdfembed', - attribute: 'data-embedmode', - }, - showDownloadPDF: { - type: 'string', - source: 'attribute', - selector: 'div.wp-block-tropicalista-pdfembed', - attribute: 'data-showdownloadpdf', - default: true, - }, - dockPageControls: { - type: 'string', - source: 'attribute', - selector: 'div.wp-block-tropicalista-pdfembed', - attribute: 'data-dockpagecontrols', - default: false, - }, - showPrintPDF: { - type: 'string', - source: 'attribute', - selector: 'div.wp-block-tropicalista-pdfembed', - attribute: 'data-showprintpdf', - default: true, - }, - showFullScreen: { - type: 'string', - source: 'attribute', - selector: 'div.wp-block-tropicalista-pdfembed', - attribute: 'data-showfullscreen', - default: true, - }, - showPageControls: { - type: 'string', - source: 'attribute', - selector: 'div.wp-block-tropicalista-pdfembed', - attribute: 'data-showpagecontrols', - default: true, - }, - enableFormFilling: { - type: 'string', - source: 'attribute', - selector: 'div.wp-block-tropicalista-pdfembed', - attribute: 'data-enableformfilling', - default: true, - }, - showAnnotationTools: { - type: 'string', - source: 'attribute', - selector: 'div.wp-block-tropicalista-pdfembed', - attribute: 'data-showannotationtools', - default: true, - }, - },*/ - blockAttributes, - supports, - isEligible() { - return true; - }, - migrate(attributes) { - console.log(attributes); - return { - ...attributes - }; - }, - save({ - attributes - }) { - console.log(attributes); - const { - blockId, - mediaUrl, - embedMode, - height, - apiKey, - showPrintPDF, - showDownloadPDF, - showPageControls, - showFullScreen, - dockPageControls, - fileName, - showAnnotationTools, - enableFormFilling - } = attributes; - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - id: blockId, - ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save(), - style: { - height - }, - "data-apiKey": apiKey, - "data-fileName": fileName, - "data-mediaUrl": mediaUrl, - "data-embedMode": embedMode, - "data-showDownloadPDF": JSON.stringify(showDownloadPDF), - "data-showPrintPDF": JSON.stringify(showPrintPDF), - "data-showPageControls": JSON.stringify(showPageControls), - "data-showFullScreen": JSON.stringify(showFullScreen), - "data-dockPageControls": JSON.stringify(dockPageControls), - "data-showAnnotationTools": JSON.stringify(showAnnotationTools), - "data-enableFormFilling": JSON.stringify(enableFormFilling) - }); - } -}; -const deprecated = [v2, v1]; -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (deprecated); - -/***/ }), - -/***/ "./src/edit.js": -/*!*********************!*\ - !*** ./src/edit.js ***! - \*********************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (/* binding */ Edit) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); -/* harmony import */ var _key_input__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./key-input */ "./src/key-input.js"); -/* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./settings */ "./src/settings.js"); -/* harmony import */ var _viewer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./viewer */ "./src/viewer.js"); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_9__); - - - - - - - - - - -function Edit(props) { - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useBlockProps)(); - console.log(props); - const { - record, - hasResolved - } = (0,_wordpress_core_data__WEBPACK_IMPORTED_MODULE_9__.useEntityRecord)('root', 'site'); - if (!hasResolved) { - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Disabled, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Spinner, null)); - } - if (record.pdf_embed_api_key) { - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InspectorControls, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_settings__WEBPACK_IMPORTED_MODULE_7__["default"], { - ...props - })), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_viewer__WEBPACK_IMPORTED_MODULE_8__.Viewer, { - ...props - })); - } - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Placeholder, { - icon: 'pdf', - instructions: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Please insert a free api Key here or in the settings panel on the right.', 'pdf-embed'), - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('PDF Embed', 'pdf-embed') - }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Flex, { - expanded: true - }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.FlexItem, { - isBlock: true - }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_key_input__WEBPACK_IMPORTED_MODULE_6__["default"], { - ...props - }))))); -} - -/***/ }), - -/***/ "./src/filter.js": -/*!***********************!*\ - !*** ./src/filter.js ***! - \***********************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/hooks */ "@wordpress/hooks"); -/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose"); -/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_7__); - - - - - - - - -const supportedBlocks = ['core/button', 'generateblocks/button']; - -/** - * Create HOC to add spacing control to inspector controls of block. - */ -const withSpacingControl = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__.createHigherOrderComponent)(BlockEdit => { - return props => { - // Do nothing if it's another block than our defined ones. - if (!supportedBlocks.includes(props.name)) { - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(BlockEdit, { - ...props - }); - } - const { - attributes, - setAttributes - } = props; - const isPdfLink = () => { - if (!attributes.url) { - return false; - } - return 'pdf' === attributes.url.split(/[#?]/)[0].split('.').pop().trim(); - }; - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(BlockEdit, { - ...props - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__.BlockControls, null, isPdfLink() && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.ToolbarGroup, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.ToolbarButton, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Open pdf in lightbox', 'pdf-embed'), - icon: 'pdf', - onClick: () => { - setAttributes({ - embedPdf: !attributes.embedPdf - }); - }, - isPressed: attributes.embedPdf - })))); - }; -}, 'withSpacingControl'); -(0,_wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__.addFilter)('editor.BlockEdit', 'extend-block-example/with-spacing-control', withSpacingControl); -const enableToolbarButtonOnBlocks = ['core/button']; -function addAttributes(settings, name) { - // Do nothing if it's another block than our defined ones. - if (!enableToolbarButtonOnBlocks.includes(name)) { - return settings; - } - - //check if object exists for old Gutenberg version compatibility - if (typeof settings.attributes !== 'undefined') { - settings.attributes = Object.assign(settings.attributes, { - embedPdf: { - type: 'boolean', - default: false - } - }); - } - return settings; -} -function addClassName(props, blockType, attributes) { - // Do nothing if it's not one of our specified blocks. - if (!supportedBlocks.includes(blockType.name)) { - return props; - } - const { - embedPdf - } = attributes; - const { - className - } = props; - return Object.assign({}, props, { - className: classnames__WEBPACK_IMPORTED_MODULE_7___default()(className, { - embedPdf - }) - }); -} -(0,_wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__.addFilter)('blocks.registerBlockType', 'tropicalista/pdf-embed', addAttributes); -(0,_wordpress_hooks__WEBPACK_IMPORTED_MODULE_2__.addFilter)('blocks.getSaveContent.extraProps', 'tropicalista/pdf-embed', addClassName); - -/***/ }), - -/***/ "./src/index.js": -/*!**********************!*\ - !*** ./src/index.js ***! - \**********************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); -/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/block.json"); -/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./edit */ "./src/edit.js"); -/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./save */ "./src/save.js"); -/* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./filter */ "./src/filter.js"); -/* harmony import */ var _deprecated__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./deprecated */ "./src/deprecated.js"); -/** - * Registers a new block provided a unique name and an object defining its behavior. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ - - -/** - * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. - * All files containing `style` keyword are bundled together. The code used - * gets applied both to the front of your site and to the editor. - * - * @see https://www.npmjs.com/package/@wordpress/scripts#using-css - */ - - - -/** - * Internal dependencies - */ - - - - - -/** - * Every block starts by registering a new block type definition. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__, { - deprecated: _deprecated__WEBPACK_IMPORTED_MODULE_6__["default"], - /** - * @see ./edit.js - */ - edit: _edit__WEBPACK_IMPORTED_MODULE_3__["default"], - /** - * @see ./save.js - */ - save: _save__WEBPACK_IMPORTED_MODULE_4__["default"] -}); - -/***/ }), - -/***/ "./src/key-input.js": -/*!**************************!*\ - !*** ./src/key-input.js ***! - \**************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (/* binding */ KeyInput) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); -/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__); - - - - - - -function KeyInput({ - setAttributes -}) { - const [pdfKey] = (0,_wordpress_core_data__WEBPACK_IMPORTED_MODULE_3__.useEntityProp)('root', 'site', 'pdf_embed_api_key'); - const [siteUrl] = (0,_wordpress_core_data__WEBPACK_IMPORTED_MODULE_3__.useEntityProp)('root', 'site', 'url'); - const { - editEntityRecord, - saveEditedEntityRecord - } = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useDispatch)(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_3__.store); - const save = () => { - setAttributes({ - apiKey: pdfKey - }); - saveEditedEntityRecord('root', 'site', undefined, { - pdf_embed_api_key: pdfKey - }); - }; - const validate = () => { - const url = 'https://viewlicense.adobe.io/viewsdklicense/jwt'; - const data = { - client_id: pdfKey, - client_device_time: Date.now(), - domain: siteUrl - }; - const response = fetch(url, { - method: 'POST', - mode: 'cors', - redirect: 'follow', - headers: { - 'X-Key-Pair-Version': 'v1', - 'Content-Type': 'application/json', - 'x-api-key': pdfKey - }, - body: JSON.stringify(data) - }); - return response; - }; - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.__experimentalInputControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('API Key', 'pdf-embed'), - help: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.createInterpolateElement)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Get your free API key on Adobe Official site.', 'pdf-embed'), { - a: (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ExternalLink, { - href: "https://www.adobe.io/apis/documentcloud/dcsdk/pdf-embed.html", - target: "_blank", - rel: "noreferrer" - }) - }), - value: pdfKey, - onChange: val => { - editEntityRecord('root', 'site', undefined, { - pdf_embed_api_key: val - }); - }, - suffix: (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Button, { - onClick: () => save(), - isPrimary: true - }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Save')) - })); -} - -/***/ }), - -/***/ "./src/save.js": -/*!*********************!*\ - !*** ./src/save.js ***! - \*********************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (/* binding */ save) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); - - -function save({ - attributes, - className -}) { - const { - mediaUrl, - embedMode, - height, - apiKey, - showPrintPDF, - showDownloadPDF, - showPageControls, - showBookmarks, - showThumbnails, - showFullScreen, - defaultViewMode, - showZoomControl, - fileName, - showAnnotationTools, - enableFormFilling, - dockPageControls - } = attributes; - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ - className - }), - style: { - height - }, - "data-api-key": apiKey, - "data-file-name": fileName, - "data-media-url": mediaUrl, - "data-embed-mode": embedMode, - "data-dock-page-controls": dockPageControls || undefined, - "data-show-download-PDF": showDownloadPDF || undefined, - "data-show-print-PDF": showPrintPDF || undefined, - "data-show-page-controls": showPageControls || undefined, - "data-show-thumbnails": showThumbnails || undefined, - "data-show-bookmarks": showBookmarks || undefined, - "data-show-zoom-control": showZoomControl || undefined, - "data-show-full-screen": showFullScreen || undefined, - "data-default-view-mode": defaultViewMode || undefined, - "data-show-annotation-tools": showAnnotationTools || undefined, - "data-enable-form-filling": enableFormFilling || undefined - }); -} - -/***/ }), - -/***/ "./src/settings.js": -/*!*************************!*\ - !*** ./src/settings.js ***! - \*************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (/* binding */ Settings) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _key_input__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./key-input */ "./src/key-input.js"); -/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); - - - - - - - -function Settings(props) { - const { - attributes, - setAttributes - } = props; - const { - showDownloadPDF, - showPrintPDF, - showFullScreen, - showZoomControl, - embedMode, - height, - showAnnotationTools, - enableFormFilling, - defaultViewMode, - showBookmarks, - showThumbnails, - dockPageControls - } = attributes; - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelBody, { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Settings', 'pdf-embed'), - initialOpen: true - }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_key_input__WEBPACK_IMPORTED_MODULE_5__["default"], { - ...props - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("hr", null), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.SelectControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Embed mode', 'pdf-embed'), - value: embedMode || 'FULL_WINDOW', - options: [{ - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Full Window', 'pdf-embed'), - value: 'FULL_WINDOW' - }, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Sized Container', 'pdf-embed'), - value: 'SIZED_CONTAINER' - }, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Inline', 'pdf-embed'), - value: 'IN_LINE' - }], - onChange: val => setAttributes({ - embedMode: val - }) - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.SelectControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Default view mode', 'pdf-embed'), - value: defaultViewMode, - options: [{ - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Default', 'pdf-embed'), - value: 'FIT_PAGE' - }, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Fit Page', 'pdf-embed'), - value: 'FIT_PAGE' - }, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Fit Width', 'pdf-embed'), - value: 'FIT_WIDTH' - }, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Two Column Fit Page', 'pdf-embed'), - value: 'TWO_COLUMN_FIT_PAGE' - }, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Two Column', 'pdf-embed'), - value: 'TWO_COLUMN' - }], - onChange: val => setAttributes({ - defaultViewMode: val - }) - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Show Download PDF', 'pdf-embed'), - checked: showDownloadPDF, - onChange: val => setAttributes({ - showDownloadPDF: val - }) - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Show Print PDF', 'pdf-embed'), - checked: showPrintPDF, - onChange: val => setAttributes({ - showPrintPDF: val - }) - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Show FullScreen Mode', 'pdf-embed'), - checked: showFullScreen, - onChange: val => setAttributes({ - showFullScreen: val - }) - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Show Zoom Control', 'pdf-embed'), - checked: showZoomControl, - onChange: val => setAttributes({ - showZoomControl: val - }) - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Show Thumbnails', 'pdf-embed'), - checked: showThumbnails, - onChange: val => setAttributes({ - showThumbnails: val - }) - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Show Bookmarks', 'pdf-embed'), - checked: showBookmarks, - onChange: val => setAttributes({ - showBookmarks: val - }) - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Show Annotation Tools', 'pdf-embed'), - checked: showAnnotationTools, - onChange: val => setAttributes({ - showAnnotationTools: val - }) - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Dock Page Controls', 'pdf-embed'), - checked: dockPageControls, - onChange: val => setAttributes({ - dockPageControls: val - }) - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ToggleControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Enable Form Filling', 'pdf-embed'), - checked: enableFormFilling, - onChange: val => setAttributes({ - enableFormFilling: val - }) - }), 'IN_LINE' !== embedMode && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.BaseControl, { - help: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Set the height of PDF.', 'pdf-embed') - }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.HeightControl, { - label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Height', 'pdf-embed'), - beforeIcon: "image-flip-vertical", - value: height, - onChange: val => setAttributes({ - height: val - }) - })))); -} - -/***/ }), - -/***/ "./src/viewer.js": -/*!***********************!*\ - !*** ./src/viewer.js ***! - \***********************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ Viewer: () => (/* binding */ Viewer) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); -/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose"); -/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__); - -/** - * Retrieves the translation of text. - * - * @see https://developer.wordpress.org/block-editor/packages/packages-i18n/ - */ - - -/** - * React hook that is used to mark the block wrapper element. - * It provides all the necessary props like the class name. - * - * @see https://developer.wordpress.org/block-editor/packages/packages-block-editor/#useBlockProps - */ - - - - - -const Viewer = props => { - const { - attributes, - setAttributes, - isSelected, - clientId - } = props; - const { - mediaUrl, - height, - fileName - } = attributes; - const instanceId = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_5__.useInstanceId)(Viewer); - const [pdfKey] = (0,_wordpress_core_data__WEBPACK_IMPORTED_MODULE_3__.useEntityProp)('root', 'site', 'pdf_embed_api_key'); - const [interactive, setInteractive] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_6__.useState)(false); - const setupRef = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_5__.useRefEffect)(element => { - const { - ownerDocument - } = element; - const { - defaultView - } = ownerDocument; - element.ownerDocument.addEventListener('adobe_dc_view_sdk.ready', function () { - if (defaultView.AdobeDC) { - loadAdobeDc(defaultView); - } - }); - if (mediaUrl && defaultView.AdobeDC) { - if (pdfKey) loadAdobeDc(defaultView); - } - if (!defaultView.AdobeDC) { - const script = defaultView.document.createElement('script'); - script.src = 'https://acrobatservices.adobe.com/view-sdk/viewer.js'; - defaultView.document.head.appendChild(script); - } - }, [attributes]); - const loadAdobeDc = view => { - const adobeDCView = new view.AdobeDC.View({ - clientId: pdfKey, - divId: clientId - }); - adobeDCView.previewFile({ - content: { - location: { - url: mediaUrl - } - }, - metaData: { - fileName - } - }, attributes); - }; - const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)({ - id: instanceId - }); - const onSelectMedia = media => { - if (media.id) { - setAttributes({ - mediaUrl: media.url, - fileName: media.filename ? media.filename : media.title - }); - } - }; - const onSelectUrl = media => { - setAttributes({ - mediaUrl: media, - fileName: new URL(media).pathname.split('/').pop() - }); - }; - (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_6__.useEffect)(() => { - if (!isSelected) setInteractive(false); - }, [isSelected]); - if (mediaUrl) { - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.BlockControls, null, mediaUrl && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToolbarGroup, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.MediaReplaceFlow, { - mediaURL: mediaUrl, - allowedTypes: ['application/pdf'], - accept: ".pdf", - onSelect: media => onSelectMedia(media) - }))), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - id: clientId, - ref: setupRef, - style: { - height - }, - tabIndex: '-1' - }), !interactive && /* eslint-disable-next-line jsx-a11y/no-static-element-interactions */ - (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "block-library-embed__interactive-overlay", - onMouseUp: () => { - setInteractive(true); - } - })); - } - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - ...blockProps - }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.MediaPlaceholder, { - icon: "pdf", - labels: { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('PDF'), - instructions: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Upload a PDF file, pick one from your media library, or add one with a URL.', 'pdf-embed') - }, - className: "block-image", - onSelect: onSelectMedia, - onSelectURL: onSelectUrl, - accept: ".pdf", - allowedTypes: ['application/pdf'] - })); -}; - -/***/ }), - -/***/ "./node_modules/classnames/index.js": -/*!******************************************!*\ - !*** ./node_modules/classnames/index.js ***! - \******************************************/ -/***/ ((module, exports) => { - -var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - Copyright (c) 2018 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/ -/* global define */ - -(function () { - 'use strict'; - - var hasOwn = {}.hasOwnProperty; - var nativeCodeString = '[native code]'; - - function classNames() { - var classes = []; - - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - if (!arg) continue; - - var argType = typeof arg; - - if (argType === 'string' || argType === 'number') { - classes.push(arg); - } else if (Array.isArray(arg)) { - if (arg.length) { - var inner = classNames.apply(null, arg); - if (inner) { - classes.push(inner); - } - } - } else if (argType === 'object') { - if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) { - classes.push(arg.toString()); - continue; - } - - for (var key in arg) { - if (hasOwn.call(arg, key) && arg[key]) { - classes.push(key); - } - } - } - } - - return classes.join(' '); - } - - if ( true && module.exports) { - classNames.default = classNames; - module.exports = classNames; - } else if (true) { - // register as 'classnames', consistent with npm package name - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { - return classNames; - }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else {} -}()); - - -/***/ }), - -/***/ "./src/editor.scss": -/*!*************************!*\ - !*** ./src/editor.scss ***! - \*************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - - -/***/ }), - -/***/ "./src/style.scss": -/*!************************!*\ - !*** ./src/style.scss ***! - \************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - - -/***/ }), - -/***/ "react": -/*!************************!*\ - !*** external "React" ***! - \************************/ -/***/ ((module) => { - -"use strict"; -module.exports = window["React"]; - -/***/ }), - -/***/ "@wordpress/block-editor": -/*!*************************************!*\ - !*** external ["wp","blockEditor"] ***! - \*************************************/ -/***/ ((module) => { - -"use strict"; -module.exports = window["wp"]["blockEditor"]; - -/***/ }), - -/***/ "@wordpress/blocks": -/*!********************************!*\ - !*** external ["wp","blocks"] ***! - \********************************/ -/***/ ((module) => { - -"use strict"; -module.exports = window["wp"]["blocks"]; - -/***/ }), - -/***/ "@wordpress/components": -/*!************************************!*\ - !*** external ["wp","components"] ***! - \************************************/ -/***/ ((module) => { - -"use strict"; -module.exports = window["wp"]["components"]; - -/***/ }), - -/***/ "@wordpress/compose": -/*!*********************************!*\ - !*** external ["wp","compose"] ***! - \*********************************/ -/***/ ((module) => { - -"use strict"; -module.exports = window["wp"]["compose"]; - -/***/ }), - -/***/ "@wordpress/core-data": -/*!**********************************!*\ - !*** external ["wp","coreData"] ***! - \**********************************/ -/***/ ((module) => { - -"use strict"; -module.exports = window["wp"]["coreData"]; - -/***/ }), - -/***/ "@wordpress/data": -/*!******************************!*\ - !*** external ["wp","data"] ***! - \******************************/ -/***/ ((module) => { - -"use strict"; -module.exports = window["wp"]["data"]; - -/***/ }), - -/***/ "@wordpress/element": -/*!*********************************!*\ - !*** external ["wp","element"] ***! - \*********************************/ -/***/ ((module) => { - -"use strict"; -module.exports = window["wp"]["element"]; - -/***/ }), - -/***/ "@wordpress/hooks": -/*!*******************************!*\ - !*** external ["wp","hooks"] ***! - \*******************************/ -/***/ ((module) => { - -"use strict"; -module.exports = window["wp"]["hooks"]; - -/***/ }), - -/***/ "@wordpress/i18n": -/*!******************************!*\ - !*** external ["wp","i18n"] ***! - \******************************/ -/***/ ((module) => { - -"use strict"; -module.exports = window["wp"]["i18n"]; - -/***/ }), - -/***/ "./src/block.json": -/*!************************!*\ - !*** ./src/block.json ***! - \************************/ -/***/ ((module) => { - -"use strict"; -module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://json.schemastore.org/block.json","apiVersion":3,"name":"tropicalista/pdfembed","version":"0.3.9","title":"Embed Pdf","category":"embed","icon":"pdf","description":"PDF embedder with official Adobe Embed API.","supports":{"html":false,"anchor":true},"attributes":{"id":{"type":"string","source":"attribute","attribute":"id"},"blockId":{"type":"string"},"apiKey":{"type":"string","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-api-key","default":""},"width":{"type":"number"},"height":{"type":"string","default":"500px"},"mediaUrl":{"type":"string","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-media-url"},"fileName":{"type":"string","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-file-name"},"embedMode":{"type":"string","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-embed-mode"},"showDownloadPDF":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-download-pdf","default":true},"dockPageControls":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-dock-page-controls","default":false},"showPrintPDF":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-print-pdf","default":true},"showFullScreen":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-full-screen","default":true},"showPageControls":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-page-controls","default":true},"showZoomControl":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-zoom-control","default":true},"showThumbnails":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-thumbnails","default":true},"showBookmarks":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-bookmarks","default":true},"defaultViewMode":{"type":"string","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-default-view-mode","default":"FIT_PAGE"},"enableFormFilling":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-enable-form-filling","default":true},"showAnnotationTools":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-annotation-tools","default":true}},"textdomain":"pdf-embed","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":["file:./view.js","pdf-embed-api"],"render":"file:./render.php"}'); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = __webpack_modules__; -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/chunk loaded */ -/******/ (() => { -/******/ var deferred = []; -/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { -/******/ if(chunkIds) { -/******/ priority = priority || 0; -/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; -/******/ deferred[i] = [chunkIds, fn, priority]; -/******/ return; -/******/ } -/******/ var notFulfilled = Infinity; -/******/ for (var i = 0; i < deferred.length; i++) { -/******/ var [chunkIds, fn, priority] = deferred[i]; -/******/ var fulfilled = true; -/******/ for (var j = 0; j < chunkIds.length; j++) { -/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { -/******/ chunkIds.splice(j--, 1); -/******/ } else { -/******/ fulfilled = false; -/******/ if(priority < notFulfilled) notFulfilled = priority; -/******/ } -/******/ } -/******/ if(fulfilled) { -/******/ deferred.splice(i--, 1) -/******/ var r = fn(); -/******/ if (r !== undefined) result = r; -/******/ } -/******/ } -/******/ return result; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/jsonp chunk loading */ -/******/ (() => { -/******/ // no baseURI -/******/ -/******/ // object to store loaded and loading chunks -/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded -/******/ var installedChunks = { -/******/ "index": 0, -/******/ "./style-index": 0 -/******/ }; -/******/ -/******/ // no chunk on demand loading -/******/ -/******/ // no prefetching -/******/ -/******/ // no preloaded -/******/ -/******/ // no HMR -/******/ -/******/ // no HMR manifest -/******/ -/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); -/******/ -/******/ // install a JSONP callback for chunk loading -/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { -/******/ var [chunkIds, moreModules, runtime] = data; -/******/ // add "moreModules" to the modules object, -/******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0; -/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) var result = runtime(__webpack_require__); -/******/ } -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ for(;i < chunkIds.length; i++) { -/******/ chunkId = chunkIds[i]; -/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ installedChunks[chunkId][0](); -/******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ return __webpack_require__.O(result); -/******/ } -/******/ -/******/ var chunkLoadingGlobal = globalThis["webpackChunkadobe_pdf"] = globalThis["webpackChunkadobe_pdf"] || []; -/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); -/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ })(); -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module depends on other loaded chunks and execution need to be delayed -/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["./style-index"], () => (__webpack_require__("./src/index.js"))) -/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); -/******/ -/******/ })() -; -//# sourceMappingURL=index.js.map \ No newline at end of file +(()=>{var e,t={384:(e,t,o)=>{"use strict";const a=window.wp.blocks,l=JSON.parse('{"$schema":"https://json.schemastore.org/block.json","apiVersion":3,"name":"tropicalista/pdfembed","version":"0.3.9","title":"Embed Pdf","category":"embed","icon":"pdf","description":"PDF embedder with official Adobe Embed API.","supports":{"html":false,"anchor":true},"attributes":{"id":{"type":"string","source":"attribute","attribute":"id"},"blockId":{"type":"string"},"apiKey":{"type":"string","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-api-key","default":""},"width":{"type":"number"},"height":{"type":"string","default":"500px"},"mediaUrl":{"type":"string","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-media-url"},"fileName":{"type":"string","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-file-name"},"embedMode":{"type":"string","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-embed-mode"},"showDownloadPDF":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-download-pdf","default":true},"dockPageControls":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-dock-page-controls","default":false},"showPrintPDF":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-print-pdf","default":true},"showFullScreen":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-full-screen","default":true},"showPageControls":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-page-controls","default":true},"showZoomControl":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-zoom-control","default":true},"showThumbnails":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-thumbnails","default":true},"showBookmarks":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-bookmarks","default":true},"defaultViewMode":{"type":"string","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-default-view-mode","default":"FIT_PAGE"},"enableFormFilling":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-enable-form-filling","default":true},"showAnnotationTools":{"type":"boolean","source":"attribute","selector":"div.wp-block-tropicalista-pdfembed","attribute":"data-show-annotation-tools","default":true}},"textdomain":"pdf-embed","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":["file:./view.js","pdf-embed-api"],"render":"file:./render.php"}'),r=window.React,n=window.wp.i18n,i=window.wp.element,d=window.wp.components,s=window.wp.blockEditor,c=window.wp.coreData,p=window.wp.data;function b({setAttributes:e}){const[t]=(0,c.useEntityProp)("root","site","pdf_embed_api_key"),[o]=(0,c.useEntityProp)("root","site","url"),{editEntityRecord:a,saveEditedEntityRecord:l}=(0,p.useDispatch)(c.store);return(0,r.createElement)(i.Fragment,null,(0,r.createElement)(d.__experimentalInputControl,{label:(0,n.__)("API Key","pdf-embed"),help:(0,i.createInterpolateElement)((0,n.__)("Get your free API key on Adobe Official site.","pdf-embed"),{a:(0,r.createElement)(d.ExternalLink,{href:"https://www.adobe.io/apis/documentcloud/dcsdk/pdf-embed.html",target:"_blank",rel:"noreferrer"})}),value:t,onChange:e=>{a("root","site",void 0,{pdf_embed_api_key:e})},suffix:(0,r.createElement)(d.Button,{onClick:()=>(e({apiKey:t}),void l("root","site",void 0,{pdf_embed_api_key:t})),isPrimary:!0},(0,n.__)("Save"))}))}function u(e){const{attributes:t,setAttributes:o}=e,{showDownloadPDF:a,showPrintPDF:l,showFullScreen:c,showZoomControl:p,embedMode:u,height:m,showAnnotationTools:f,enableFormFilling:h,defaultViewMode:w,showBookmarks:g,showThumbnails:v,dockPageControls:y}=t;return(0,r.createElement)(i.Fragment,null,(0,r.createElement)(d.PanelBody,{title:(0,n.__)("Settings","pdf-embed"),initialOpen:!0},(0,r.createElement)(b,{...e}),(0,r.createElement)("hr",null),(0,r.createElement)(d.SelectControl,{label:(0,n.__)("Embed mode","pdf-embed"),value:u||"FULL_WINDOW",options:[{label:(0,n.__)("Full Window","pdf-embed"),value:"FULL_WINDOW"},{label:(0,n.__)("Sized Container","pdf-embed"),value:"SIZED_CONTAINER"},{label:(0,n.__)("Inline","pdf-embed"),value:"IN_LINE"}],onChange:e=>o({embedMode:e})}),(0,r.createElement)(d.SelectControl,{label:(0,n.__)("Default view mode","pdf-embed"),value:w,options:[{label:(0,n.__)("Default","pdf-embed"),value:"FIT_PAGE"},{label:(0,n.__)("Fit Page","pdf-embed"),value:"FIT_PAGE"},{label:(0,n.__)("Fit Width","pdf-embed"),value:"FIT_WIDTH"},{label:(0,n.__)("Two Column Fit Page","pdf-embed"),value:"TWO_COLUMN_FIT_PAGE"},{label:(0,n.__)("Two Column","pdf-embed"),value:"TWO_COLUMN"}],onChange:e=>o({defaultViewMode:e})}),(0,r.createElement)(d.ToggleControl,{label:(0,n.__)("Show Download PDF","pdf-embed"),checked:a,onChange:e=>o({showDownloadPDF:e})}),(0,r.createElement)(d.ToggleControl,{label:(0,n.__)("Show Print PDF","pdf-embed"),checked:l,onChange:e=>o({showPrintPDF:e})}),(0,r.createElement)(d.ToggleControl,{label:(0,n.__)("Show FullScreen Mode","pdf-embed"),checked:c,onChange:e=>o({showFullScreen:e})}),(0,r.createElement)(d.ToggleControl,{label:(0,n.__)("Show Zoom Control","pdf-embed"),checked:p,onChange:e=>o({showZoomControl:e})}),(0,r.createElement)(d.ToggleControl,{label:(0,n.__)("Show Thumbnails","pdf-embed"),checked:v,onChange:e=>o({showThumbnails:e})}),(0,r.createElement)(d.ToggleControl,{label:(0,n.__)("Show Bookmarks","pdf-embed"),checked:g,onChange:e=>o({showBookmarks:e})}),(0,r.createElement)(d.ToggleControl,{label:(0,n.__)("Show Annotation Tools","pdf-embed"),checked:f,onChange:e=>o({showAnnotationTools:e})}),(0,r.createElement)(d.ToggleControl,{label:(0,n.__)("Dock Page Controls","pdf-embed"),checked:y,onChange:e=>o({dockPageControls:e})}),(0,r.createElement)(d.ToggleControl,{label:(0,n.__)("Enable Form Filling","pdf-embed"),checked:h,onChange:e=>o({enableFormFilling:e})}),"IN_LINE"!==u&&(0,r.createElement)(d.BaseControl,{help:(0,n.__)("Set the height of PDF.","pdf-embed")},(0,r.createElement)(s.HeightControl,{label:(0,n.__)("Height","pdf-embed"),beforeIcon:"image-flip-vertical",value:m,onChange:e=>o({height:e})}))))}const m=window.wp.compose,f=e=>{const{attributes:t,setAttributes:o,isSelected:a,clientId:l}=e,{mediaUrl:p,height:b,fileName:u}=t,h=(0,m.useInstanceId)(f),[w]=(0,c.useEntityProp)("root","site","pdf_embed_api_key"),[g,v]=(0,i.useState)(!1),y=(0,m.useRefEffect)((e=>{const{ownerDocument:t}=e,{defaultView:o}=t;if(e.ownerDocument.addEventListener("adobe_dc_view_sdk.ready",(function(){o.AdobeDC&&_(o)})),p&&o.AdobeDC&&w&&_(o),!o.AdobeDC){const e=o.document.createElement("script");e.src="https://acrobatservices.adobe.com/view-sdk/viewer.js",o.document.head.appendChild(e)}}),[t]),_=e=>{new e.AdobeDC.View({clientId:w,divId:l}).previewFile({content:{location:{url:p}},metaData:{fileName:u}},t)},k=(0,s.useBlockProps)({id:h}),P=e=>{e.id&&o({mediaUrl:e.url,fileName:e.filename?e.filename:e.title})};return(0,i.useEffect)((()=>{a||v(!1)}),[a]),p?(0,r.createElement)("div",{...k},(0,r.createElement)(s.BlockControls,null,p&&(0,r.createElement)(d.ToolbarGroup,null,(0,r.createElement)(s.MediaReplaceFlow,{mediaURL:p,allowedTypes:["application/pdf"],accept:".pdf",onSelect:e=>P(e)}))),(0,r.createElement)("div",{id:l,ref:y,style:{height:b},tabIndex:"-1"}),!g&&(0,r.createElement)("div",{className:"block-library-embed__interactive-overlay",onMouseUp:()=>{v(!0)}})):(0,r.createElement)("div",{...k},(0,r.createElement)(s.MediaPlaceholder,{icon:"pdf",labels:{title:(0,n.__)("PDF"),instructions:(0,n.__)("Upload a PDF file, pick one from your media library, or add one with a URL.","pdf-embed")},className:"block-image",onSelect:P,onSelectURL:e=>{o({mediaUrl:e,fileName:new URL(e).pathname.split("/").pop()})},accept:".pdf",allowedTypes:["application/pdf"]}))},h=window.wp.hooks;var w=o(485),g=o.n(w);const v=["core/button","generateblocks/button"],y=(0,m.createHigherOrderComponent)((e=>t=>{if(!v.includes(t.name))return(0,r.createElement)(e,{...t});const{attributes:o,setAttributes:a}=t;return(0,r.createElement)(i.Fragment,null,(0,r.createElement)(e,{...t}),(0,r.createElement)(s.BlockControls,null,!!o.url&&"pdf"===o.url.split(/[#?]/)[0].split(".").pop().trim()&&(0,r.createElement)(d.ToolbarGroup,null,(0,r.createElement)(d.ToolbarButton,{label:(0,n.__)("Open pdf in lightbox","pdf-embed"),icon:"pdf",onClick:()=>{a({embedPdf:!o.embedPdf})},isPressed:o.embedPdf}))))}),"withSpacingControl");(0,h.addFilter)("editor.BlockEdit","extend-block-example/with-spacing-control",y);const _=["core/button"];(0,h.addFilter)("blocks.registerBlockType","tropicalista/pdf-embed",(function(e,t){return _.includes(t)?(void 0!==e.attributes&&(e.attributes=Object.assign(e.attributes,{embedPdf:{type:"boolean",default:!1}})),e):e})),(0,h.addFilter)("blocks.getSaveContent.extraProps","tropicalista/pdf-embed",(function(e,t,o){if(!v.includes(t.name))return e;const{embedPdf:a}=o,{className:l}=e;return Object.assign({},e,{className:g()(l,{embedPdf:a})})}));const k={id:{type:"string",source:"attribute",attribute:"id"},blockId:{type:"string"},apiKey:{type:"string"},width:{type:"number"},height:{type:"string",default:"500px"},mediaUrl:{type:"string"},fileName:{type:"string",default:"My PDF"},embedMode:{type:"string",default:""},showDownloadPDF:{type:"boolean",default:!0},showPrintPDF:{type:"boolean",default:!0},showFullScreen:{type:"boolean",default:!0},showPageControls:{type:"boolean",default:!0},dockPageControls:{type:"boolean",default:!0},enableFormFilling:{type:"boolean",default:!0},showAnnotationTools:{type:"boolean",default:!0}},P={html:!1,anchor:!0},E=[{blockAttributes:k,supports:P,isEligible:()=>!0,migrate:e=>(console.log(e),{...e}),save({attributes:e}){console.log(e);const{blockId:t,mediaUrl:o,embedMode:a,height:l,apiKey:n,showPrintPDF:i,showDownloadPDF:d,showPageControls:c,showFullScreen:p,dockPageControls:b,fileName:u,showAnnotationTools:m,enableFormFilling:f}=e;return(0,r.createElement)("div",{id:t,...s.useBlockProps.save(),style:{height:l},"data-apiKey":n,"data-fileName":u,"data-mediaUrl":o,"data-embedMode":a,"data-showDownloadPDF":JSON.stringify(d),"data-showPrintPDF":JSON.stringify(i),"data-showPageControls":JSON.stringify(c),"data-showFullScreen":JSON.stringify(p),"data-dockPageControls":JSON.stringify(b),"data-showAnnotationTools":JSON.stringify(m),"data-enableFormFilling":JSON.stringify(f)})}},{blockAttributes:k,supports:P,isEligible:()=>!0,migrate:e=>(console.log(e),{...e,"data-apikey":e.apiKey,"data-mediaurl":e.mediaUrl,"data-defaultviewmode":"FIT_PAGE"}),save({attributes:e}){const{blockId:t,mediaUrl:o,embedMode:a,height:l,apiKey:n,showPrintPDF:i,showDownloadPDF:d,showPageControls:c,showFullScreen:p,dockPageControls:b,fileName:u,showAnnotationTools:m,enableFormFilling:f}=e;return console.log(e),(0,r.createElement)("div",{id:t,...s.useBlockProps.save(),style:{height:l},"data-apiKey":n,"data-fileName":u,"data-mediaUrl":o,"data-embedMode":a,"data-showDownloadPDF":d,"data-showPrintPDF":i,"data-showPageControls":c,"data-showFullScreen":p,"data-dockPageControls":b,"data-showAnnotationTools":m,"data-enableFormFilling":f})}}];(0,a.registerBlockType)(l,{deprecated:E,edit:function(e){const t=(0,s.useBlockProps)();console.log(e);const{record:o,hasResolved:a}=(0,c.useEntityRecord)("root","site");return a?o.pdf_embed_api_key?(0,r.createElement)("div",{...t},(0,r.createElement)(s.InspectorControls,null,(0,r.createElement)(u,{...e})),(0,r.createElement)(f,{...e})):(0,r.createElement)("div",{...t},(0,r.createElement)(d.Placeholder,{icon:"pdf",instructions:(0,n.__)("Please insert a free api Key here or in the settings panel on the right.","pdf-embed"),label:(0,n.__)("PDF Embed","pdf-embed")},(0,r.createElement)(d.Flex,{expanded:!0},(0,r.createElement)(d.FlexItem,{isBlock:!0},(0,r.createElement)(b,{...e}))))):(0,r.createElement)(d.Disabled,null,(0,r.createElement)(d.Spinner,null))},save:function({attributes:e,className:t}){const{mediaUrl:o,embedMode:a,height:l,apiKey:n,showPrintPDF:i,showDownloadPDF:d,showPageControls:c,showBookmarks:p,showThumbnails:b,showFullScreen:u,defaultViewMode:m,showZoomControl:f,fileName:h,showAnnotationTools:w,enableFormFilling:g,dockPageControls:v}=e;return(0,r.createElement)("div",{...s.useBlockProps.save({className:t}),style:{height:l},"data-api-key":n,"data-file-name":h,"data-media-url":o,"data-embed-mode":a,"data-dock-page-controls":v||void 0,"data-show-download-PDF":d||void 0,"data-show-print-PDF":i||void 0,"data-show-page-controls":c||void 0,"data-show-thumbnails":b||void 0,"data-show-bookmarks":p||void 0,"data-show-zoom-control":f||void 0,"data-show-full-screen":u||void 0,"data-default-view-mode":m||void 0,"data-show-annotation-tools":w||void 0,"data-enable-form-filling":g||void 0})}})},485:(e,t)=>{var o;!function(){"use strict";var a={}.hasOwnProperty;function l(){for(var e=[],t=0;t{if(!o){var n=1/0;for(c=0;c=r)&&Object.keys(a.O).every((e=>a.O[e](o[d])))?o.splice(d--,1):(i=!1,r0&&e[c-1][2]>r;c--)e[c]=e[c-1];e[c]=[o,l,r]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var o in t)a.o(t,o)&&!a.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={57:0,350:0};a.O.j=t=>0===e[t];var t=(t,o)=>{var l,r,[n,i,d]=o,s=0;if(n.some((t=>0!==e[t]))){for(l in i)a.o(i,l)&&(a.m[l]=i[l]);if(d)var c=d(a)}for(t&&t(o);sa(384)));l=a.O(l)})(); \ No newline at end of file diff --git a/build/index.js.map b/build/index.js.map deleted file mode 100644 index cb0d9a3..0000000 --- a/build/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;AAAwD;AAExD,MAAMC,eAAe,GAAG;EACvBC,EAAE,EAAE;IACHC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE,WAAW;IACnBC,SAAS,EAAE;EACZ,CAAC;EACDC,OAAO,EAAE;IACRH,IAAI,EAAE;EACP,CAAC;EACDI,MAAM,EAAE;IACPJ,IAAI,EAAE;EACP,CAAC;EACDK,KAAK,EAAE;IACNL,IAAI,EAAE;EACP,CAAC;EACDM,MAAM,EAAE;IACPN,IAAI,EAAE,QAAQ;IACdO,OAAO,EAAE;EACV,CAAC;EACDC,QAAQ,EAAE;IACTR,IAAI,EAAE;EACP,CAAC;EACDS,QAAQ,EAAE;IACTT,IAAI,EAAE,QAAQ;IACdO,OAAO,EAAE;EACV,CAAC;EACDG,SAAS,EAAE;IACVV,IAAI,EAAE,QAAQ;IACdO,OAAO,EAAE;EACV,CAAC;EACDI,eAAe,EAAE;IAChBX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;MACC7B,EAAE,EAAGI,OAAS;MAAA,GACTN,kEAAa,CAAC8B,IAAI,CAAC,CAAC;MACzBE,KAAK,EAAG;QAAEvB;MAAO,CAAG;MACpB,eAAcF,MAAQ;MACtB,iBAAgBK,QAAU;MAC1B,iBAAgBD,QAAU;MAC1B,kBAAiBE,SAAW;MAC5B,wBAAuBC,eAAiB;MACxC,qBAAoBC,YAAc;MAClC,yBAAwBE,gBAAkB;MAC1C,uBAAsBD,cAAgB;MACtC,yBAAwBE,gBAAkB;MAC1C,4BAA2BE,mBAAqB;MAChD,0BAAyBD;IAAmB,CACvC,CAAC;EAET;AACD,CAAC;AAED,MAAMc,EAAE,GAAG;EACV;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACChC,eAAe;EACfoB,QAAQ;EACRI,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ,CAAC;EACDC,OAAOA,CAAEC,UAAU,EAAG;IACrBC,OAAO,CAACC,GAAG,CAAEF,UAAW,CAAC;IACzB,OAAO;MACN,GAAGA;IACJ,CAAC;EACF,CAAC;EACDG,IAAIA,CAAE;IAAEH;EAAW,CAAC,EAAG;IACtBC,OAAO,CAACC,GAAG,CAAEF,UAAW,CAAC;IACzB,MAAM;MACLrB,OAAO;MACPK,QAAQ;MACRE,SAAS;MACTJ,MAAM;MACNF,MAAM;MACNQ,YAAY;MACZD,eAAe;MACfG,gBAAgB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;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC3BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEjDA;UACA;UACA;UACA;UACA","sources":["webpack://adobe-pdf/./src/deprecated.js","webpack://adobe-pdf/./src/edit.js","webpack://adobe-pdf/./src/filter.js","webpack://adobe-pdf/./src/index.js","webpack://adobe-pdf/./src/key-input.js","webpack://adobe-pdf/./src/save.js","webpack://adobe-pdf/./src/settings.js","webpack://adobe-pdf/./src/viewer.js","webpack://adobe-pdf/./node_modules/classnames/index.js","webpack://adobe-pdf/./src/editor.scss?0339","webpack://adobe-pdf/./src/style.scss?75bd","webpack://adobe-pdf/external window \"React\"","webpack://adobe-pdf/external window [\"wp\",\"blockEditor\"]","webpack://adobe-pdf/external window [\"wp\",\"blocks\"]","webpack://adobe-pdf/external window [\"wp\",\"components\"]","webpack://adobe-pdf/external window [\"wp\",\"compose\"]","webpack://adobe-pdf/external window [\"wp\",\"coreData\"]","webpack://adobe-pdf/external window [\"wp\",\"data\"]","webpack://adobe-pdf/external window [\"wp\",\"element\"]","webpack://adobe-pdf/external window [\"wp\",\"hooks\"]","webpack://adobe-pdf/external window [\"wp\",\"i18n\"]","webpack://adobe-pdf/webpack/bootstrap","webpack://adobe-pdf/webpack/runtime/chunk loaded","webpack://adobe-pdf/webpack/runtime/compat get default export","webpack://adobe-pdf/webpack/runtime/define property getters","webpack://adobe-pdf/webpack/runtime/hasOwnProperty shorthand","webpack://adobe-pdf/webpack/runtime/make namespace object","webpack://adobe-pdf/webpack/runtime/jsonp chunk loading","webpack://adobe-pdf/webpack/before-startup","webpack://adobe-pdf/webpack/startup","webpack://adobe-pdf/webpack/after-startup"],"sourcesContent":["import { useBlockProps } from '@wordpress/block-editor';\n\nconst blockAttributes = {\n\tid: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tattribute: 'id',\n\t},\n\tblockId: {\n\t\ttype: 'string',\n\t},\n\tapiKey: {\n\t\ttype: 'string',\n\t},\n\twidth: {\n\t\ttype: 'number',\n\t},\n\theight: {\n\t\ttype: 'string',\n\t\tdefault: '500px',\n\t},\n\tmediaUrl: {\n\t\ttype: 'string',\n\t},\n\tfileName: {\n\t\ttype: 'string',\n\t\tdefault: 'My PDF',\n\t},\n\tembedMode: {\n\t\ttype: 'string',\n\t\tdefault: '',\n\t},\n\tshowDownloadPDF: {\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t},\n\tshowPrintPDF: {\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t},\n\tshowFullScreen: {\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t},\n\tshowPageControls: {\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t},\n\tdockPageControls: {\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t},\n\tenableFormFilling: {\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t},\n\tshowAnnotationTools: {\n\t\ttype: 'boolean',\n\t\tdefault: true,\n\t},\n};\n\nconst supports = { html: false, anchor: true };\n\nconst v1 = {\n\tblockAttributes,\n\tsupports,\n\tisEligible() {\n\t\treturn true;\n\t},\n\tmigrate( attributes ) {\n\t\tconsole.log( attributes );\n\t\treturn {\n\t\t\t...attributes,\n\t\t\t'data-apikey': attributes.apiKey,\n\t\t\t'data-mediaurl': attributes.mediaUrl,\n\t\t\t'data-defaultviewmode': 'FIT_PAGE',\n\t\t};\n\t},\n\tsave( { attributes } ) {\n\t\tconst {\n\t\t\tblockId,\n\t\t\tmediaUrl,\n\t\t\tembedMode,\n\t\t\theight,\n\t\t\tapiKey,\n\t\t\tshowPrintPDF,\n\t\t\tshowDownloadPDF,\n\t\t\tshowPageControls,\n\t\t\tshowFullScreen,\n\t\t\tdockPageControls,\n\t\t\tfileName,\n\t\t\tshowAnnotationTools,\n\t\t\tenableFormFilling,\n\t\t} = attributes;\n\t\tconsole.log( attributes );\n\n\t\treturn (\n\t\t\t\n\t\t);\n\t},\n};\n\nconst v2 = {\n\t/*attributes: {\n\t\tid: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'div.wp-block-tropicalista-pdfembed',\n\t\t\tattribute: 'id',\n\t\t},\n\t\tblockId: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tapiKey: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'div.wp-block-tropicalista-pdfembed',\n\t\t\tattribute: 'data-apikey',\n\t\t},\n\t\tfileName: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'div.wp-block-tropicalista-pdfembed',\n\t\t\tattribute: 'data-filename',\n\t\t},\n\t\tmediaUrl: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'div.wp-block-tropicalista-pdfembed',\n\t\t\tattribute: 'data-mediaurl',\n\t\t},\n\t\tembedMode: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'div.wp-block-tropicalista-pdfembed',\n\t\t\tattribute: 'data-embedmode',\n\t\t},\n\t\tshowDownloadPDF: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'div.wp-block-tropicalista-pdfembed',\n\t\t\tattribute: 'data-showdownloadpdf',\n\t\t\tdefault: true,\n\t\t},\n\t\tdockPageControls: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'div.wp-block-tropicalista-pdfembed',\n\t\t\tattribute: 'data-dockpagecontrols',\n\t\t\tdefault: false,\n\t\t},\n\t\tshowPrintPDF: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'div.wp-block-tropicalista-pdfembed',\n\t\t\tattribute: 'data-showprintpdf',\n\t\t\tdefault: true,\n\t\t},\n\t\tshowFullScreen: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'div.wp-block-tropicalista-pdfembed',\n\t\t\tattribute: 'data-showfullscreen',\n\t\t\tdefault: true,\n\t\t},\n\t\tshowPageControls: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'div.wp-block-tropicalista-pdfembed',\n\t\t\tattribute: 'data-showpagecontrols',\n\t\t\tdefault: true,\n\t\t},\n\t\tenableFormFilling: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'div.wp-block-tropicalista-pdfembed',\n\t\t\tattribute: 'data-enableformfilling',\n\t\t\tdefault: true,\n\t\t},\n\t\tshowAnnotationTools: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'div.wp-block-tropicalista-pdfembed',\n\t\t\tattribute: 'data-showannotationtools',\n\t\t\tdefault: true,\n\t\t},\n\t},*/\n\tblockAttributes,\n\tsupports,\n\tisEligible() {\n\t\treturn true;\n\t},\n\tmigrate( attributes ) {\n\t\tconsole.log( attributes );\n\t\treturn {\n\t\t\t...attributes,\n\t\t};\n\t},\n\tsave( { attributes } ) {\n\t\tconsole.log( attributes );\n\t\tconst {\n\t\t\tblockId,\n\t\t\tmediaUrl,\n\t\t\tembedMode,\n\t\t\theight,\n\t\t\tapiKey,\n\t\t\tshowPrintPDF,\n\t\t\tshowDownloadPDF,\n\t\t\tshowPageControls,\n\t\t\tshowFullScreen,\n\t\t\tdockPageControls,\n\t\t\tfileName,\n\t\t\tshowAnnotationTools,\n\t\t\tenableFormFilling,\n\t\t} = attributes;\n\n\t\treturn (\n\t\t\t\n\t\t);\n\t},\n};\n\nconst deprecated = [ v2, v1 ];\n\nexport default deprecated;\n","import { __ } from '@wordpress/i18n';\n\nimport { useEffect } from '@wordpress/element';\nimport {\n\tPlaceholder,\n\tDisabled,\n\tSpinner,\n\tFlex,\n\tFlexItem,\n} from '@wordpress/components';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport './editor.scss';\nimport KeyInput from './key-input';\nimport Settings from './settings';\nimport { Viewer } from './viewer';\nimport { useEntityRecord } from '@wordpress/core-data';\n\nexport default function Edit( props ) {\n\tconst blockProps = useBlockProps();\nconsole.log(props)\n\tconst { record, hasResolved } = useEntityRecord( 'root', 'site' );\n\n\tif ( ! hasResolved ) {\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t}\n\n\tif ( record.pdf_embed_api_key ) {\n\t\treturn (\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t);\n\t}\n\n\treturn (\n\t\t
\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
\n\t);\n}\n","import { __ } from '@wordpress/i18n';\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { Fragment } from '@wordpress/element';\nimport { BlockControls } from '@wordpress/block-editor';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport classnames from 'classnames';\n\nconst supportedBlocks = [ 'core/button', 'generateblocks/button' ];\n\n/**\n * Create HOC to add spacing control to inspector controls of block.\n */\nconst withSpacingControl = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn ( props ) => {\n\t\t// Do nothing if it's another block than our defined ones.\n\t\tif ( ! supportedBlocks.includes( props.name ) ) {\n\t\t\treturn ;\n\t\t}\n\n\t\tconst { attributes, setAttributes } = props;\n\n\t\tconst isPdfLink = () => {\n\t\t\tif ( ! attributes.url ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t'pdf' ===\n\t\t\t\tattributes.url.split( /[#?]/ )[ 0 ].split( '.' ).pop().trim()\n\t\t\t);\n\t\t};\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ isPdfLink() && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tembedPdf: ! attributes.embedPdf,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tisPressed={ attributes.embedPdf }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\n\t\t\t\t\t) }\n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n}, 'withSpacingControl' );\n\naddFilter(\n\t'editor.BlockEdit',\n\t'extend-block-example/with-spacing-control',\n\twithSpacingControl\n);\n\nconst enableToolbarButtonOnBlocks = [ 'core/button' ];\n\nfunction addAttributes( settings, name ) {\n\t// Do nothing if it's another block than our defined ones.\n\tif ( ! enableToolbarButtonOnBlocks.includes( name ) ) {\n\t\treturn settings;\n\t}\n\n\t//check if object exists for old Gutenberg version compatibility\n\tif ( typeof settings.attributes !== 'undefined' ) {\n\t\tsettings.attributes = Object.assign( settings.attributes, {\n\t\t\tembedPdf: {\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\nfunction addClassName( props, blockType, attributes ) {\n\t// Do nothing if it's not one of our specified blocks.\n\tif ( ! supportedBlocks.includes( blockType.name ) ) {\n\t\treturn props;\n\t}\n\n\tconst { embedPdf } = attributes;\n\tconst { className } = props;\n\n\treturn Object.assign( {}, props, {\n\t\tclassName: classnames( className, {\n\t\t\tembedPdf,\n\t\t} ),\n\t} );\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'tropicalista/pdf-embed',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'tropicalista/pdf-embed',\n\taddClassName\n);\n","/**\n * Registers a new block provided a unique name and an object defining its behavior.\n *\n * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/\n */\nimport { registerBlockType } from '@wordpress/blocks';\n\n/**\n * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.\n * All files containing `style` keyword are bundled together. The code used\n * gets applied both to the front of your site and to the editor.\n *\n * @see https://www.npmjs.com/package/@wordpress/scripts#using-css\n */\nimport './style.scss';\n\nimport metadata from './block.json';\n\n/**\n * Internal dependencies\n */\nimport Edit from './edit';\nimport save from './save';\nimport './filter';\nimport deprecated from './deprecated';\n\n/**\n * Every block starts by registering a new block type definition.\n *\n * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/\n */\nregisterBlockType( metadata, {\n\tdeprecated,\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n\n\t/**\n\t * @see ./save.js\n\t */\n\tsave,\n} );\n","import { __ } from '@wordpress/i18n';\n\nimport {\n\t__experimentalInputControl as InputControl,\n\tButton,\n\tExternalLink,\n} from '@wordpress/components';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tFragment,\n\tcreateInterpolateElement,\n\tuseEffect,\n} from '@wordpress/element';\n\nexport default function KeyInput( { setAttributes } ) {\n\tconst [ pdfKey ] = useEntityProp( 'root', 'site', 'pdf_embed_api_key' );\n\tconst [ siteUrl ] = useEntityProp( 'root', 'site', 'url' );\n\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\tconst save = () => {\n\t\tsetAttributes( { apiKey: pdfKey } );\n\t\tsaveEditedEntityRecord( 'root', 'site', undefined, {\n\t\t\tpdf_embed_api_key: pdfKey,\n\t\t} );\n\t};\n\n\tconst validate = () => {\n\t\tconst url = 'https://viewlicense.adobe.io/viewsdklicense/jwt';\n\n\t\tconst data = {\n\t\t\tclient_id: pdfKey,\n\t\t\tclient_device_time: Date.now(),\n\t\t\tdomain: siteUrl,\n\t\t};\n\n\t\tconst response = fetch( url, {\n\t\t\tmethod: 'POST',\n\t\t\tmode: 'cors',\n\t\t\tredirect: 'follow',\n\t\t\theaders: {\n\t\t\t\t'X-Key-Pair-Version': 'v1',\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t'x-api-key': pdfKey,\n\t\t\t},\n\t\t\tbody: JSON.stringify( data ),\n\t\t} );\n\n\t\treturn response;\n\t};\n\n\treturn (\n\t\t\n\t\t\tAdobe Official site.',\n\t\t\t\t\t\t'pdf-embed'\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t),\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tvalue={ pdfKey }\n\t\t\t\tonChange={ ( val ) => {\n\t\t\t\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\t\t\t\tpdf_embed_api_key: val,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tsuffix={\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t/>\n\t\t\n\t);\n}\n","import { useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes, className } ) {\n\tconst {\n\t\tmediaUrl,\n\t\tembedMode,\n\t\theight,\n\t\tapiKey,\n\t\tshowPrintPDF,\n\t\tshowDownloadPDF,\n\t\tshowPageControls,\n\t\tshowBookmarks,\n\t\tshowThumbnails,\n\t\tshowFullScreen,\n\t\tdefaultViewMode,\n\t\tshowZoomControl,\n\t\tfileName,\n\t\tshowAnnotationTools,\n\t\tenableFormFilling,\n\t\tdockPageControls,\n\t} = attributes;\n\n\treturn (\n\t\t\n\t);\n}\n","import { __ } from '@wordpress/i18n';\nimport {\n\tPanelBody,\n\tSelectControl,\n\tToggleControl,\n\tBaseControl,\n} from '@wordpress/components';\nimport { HeightControl } from '@wordpress/block-editor';\nimport { Fragment } from '@wordpress/element';\nimport ApiButton from './key-input';\n\nimport './editor.scss';\n\nexport default function Settings( props ) {\n\tconst { attributes, setAttributes } = props;\n\n\tconst {\n\t\tshowDownloadPDF,\n\t\tshowPrintPDF,\n\t\tshowFullScreen,\n\t\tshowZoomControl,\n\t\tembedMode,\n\t\theight,\n\t\tshowAnnotationTools,\n\t\tenableFormFilling,\n\t\tdefaultViewMode,\n\t\tshowBookmarks,\n\t\tshowThumbnails,\n\t\tdockPageControls,\n\t} = attributes;\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t setAttributes( { embedMode: val } ) }\n\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t\t\tsetAttributes( { defaultViewMode: val } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t\t\tsetAttributes( { showDownloadPDF: val } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t\t\tsetAttributes( { showPrintPDF: val } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t\t\tsetAttributes( { showFullScreen: val } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t\t\tsetAttributes( { showZoomControl: val } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t\t\tsetAttributes( { showThumbnails: val } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t\t\tsetAttributes( { showBookmarks: val } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t\t\tsetAttributes( { showAnnotationTools: val } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t\t\tsetAttributes( { dockPageControls: val } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t\t\tsetAttributes( { enableFormFilling: val } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\n\t\t\t\t{ 'IN_LINE' !== embedMode && (\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tsetAttributes( { height: val } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t\n\t\t
\n\t);\n}\n","/**\n * Retrieves the translation of text.\n *\n * @see https://developer.wordpress.org/block-editor/packages/packages-i18n/\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * React hook that is used to mark the block wrapper element.\n * It provides all the necessary props like the class name.\n *\n * @see https://developer.wordpress.org/block-editor/packages/packages-block-editor/#useBlockProps\n */\nimport {\n\tMediaPlaceholder,\n\tBlockControls,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { useEntityProp } from '@wordpress/core-data';\n\nimport { ToolbarGroup } from '@wordpress/components';\nimport { useRefEffect, useInstanceId } from '@wordpress/compose';\nimport { useEffect, useState } from '@wordpress/element';\n\nexport const Viewer = ( props ) => {\n\tconst { attributes, setAttributes, isSelected, clientId } = props;\n\tconst { mediaUrl, height, fileName } = attributes;\n\tconst instanceId = useInstanceId( Viewer );\n\tconst [ pdfKey ] = useEntityProp( 'root', 'site', 'pdf_embed_api_key' );\n\n\tconst [ interactive, setInteractive ] = useState( false );\n\n\tconst setupRef = useRefEffect(\n\t\t( element ) => {\n\t\t\tconst { ownerDocument } = element;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\telement.ownerDocument.addEventListener(\n\t\t\t\t'adobe_dc_view_sdk.ready',\n\t\t\t\tfunction () {\n\t\t\t\t\tif ( defaultView.AdobeDC ) {\n\t\t\t\t\t\tloadAdobeDc( defaultView );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\tif ( mediaUrl && defaultView.AdobeDC ) {\n\t\t\t\tif ( pdfKey ) loadAdobeDc( defaultView );\n\t\t\t}\n\n\t\t\tif ( ! defaultView.AdobeDC ) {\n\t\t\t\tconst script = defaultView.document.createElement( 'script' );\n\t\t\t\tscript.src =\n\t\t\t\t\t'https://acrobatservices.adobe.com/view-sdk/viewer.js';\n\n\t\t\t\tdefaultView.document.head.appendChild( script );\n\t\t\t}\n\t\t},\n\t\t[ attributes ]\n\t);\n\n\tconst loadAdobeDc = ( view ) => {\n\t\tconst adobeDCView = new view.AdobeDC.View( {\n\t\t\tclientId: pdfKey,\n\t\t\tdivId: clientId,\n\t\t} );\n\n\t\tadobeDCView.previewFile(\n\t\t\t{\n\t\t\t\tcontent: {\n\t\t\t\t\tlocation: {\n\t\t\t\t\t\turl: mediaUrl,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tmetaData: { fileName },\n\t\t\t},\n\t\t\tattributes\n\t\t);\n\t};\n\n\tconst blockProps = useBlockProps( { id: instanceId } );\n\n\tconst onSelectMedia = ( media ) => {\n\t\tif ( media.id ) {\n\t\t\tsetAttributes( {\n\t\t\t\tmediaUrl: media.url,\n\t\t\t\tfileName: media.filename ? media.filename : media.title,\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst onSelectUrl = ( media ) => {\n\t\tsetAttributes( {\n\t\t\tmediaUrl: media,\n\t\t\tfileName: new URL( media ).pathname.split( '/' ).pop(),\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) setInteractive( false );\n\t}, [ isSelected ] );\n\n\tif ( mediaUrl ) {\n\t\treturn (\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t{ mediaUrl && (\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t onSelectMedia( media ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\n\t\t\t\t\t) }\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t{ ! interactive && (\n\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */\n\t\t\t\t\t {\n\t\t\t\t\t\t\tsetInteractive( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\n\t\t);\n\t}\n\n\treturn (\n\t\t
\n\t\t\t\n\t\t
\n\t);\n};\n","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\tvar nativeCodeString = '[native code]';\n\n\tfunction classNames() {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tif (arg.length) {\n\t\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\t\tif (inner) {\n\t\t\t\t\t\tclasses.push(inner);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\t\t\tclasses.push(arg.toString());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"React\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"compose\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"hooks\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = globalThis[\"webpackChunkadobe_pdf\"] = globalThis[\"webpackChunkadobe_pdf\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], () => (__webpack_require__(\"./src/index.js\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["useBlockProps","blockAttributes","id","type","source","attribute","blockId","apiKey","width","height","default","mediaUrl","fileName","embedMode","showDownloadPDF","showPrintPDF","showFullScreen","showPageControls","dockPageControls","enableFormFilling","showAnnotationTools","supports","html","anchor","v1","isEligible","migrate","attributes","console","log","save","createElement","style","v2","JSON","stringify","deprecated","__","useEffect","Placeholder","Disabled","Spinner","Flex","FlexItem","InspectorControls","KeyInput","Settings","Viewer","useEntityRecord","Edit","props","blockProps","record","hasResolved","pdf_embed_api_key","icon","instructions","label","expanded","isBlock","addFilter","createHigherOrderComponent","Fragment","BlockControls","ToolbarButton","ToolbarGroup","classnames","supportedBlocks","withSpacingControl","BlockEdit","includes","name","setAttributes","isPdfLink","url","split","pop","trim","onClick","embedPdf","isPressed","enableToolbarButtonOnBlocks","addAttributes","settings","Object","assign","addClassName","blockType","className","registerBlockType","metadata","edit","__experimentalInputControl","InputControl","Button","ExternalLink","useEntityProp","store","coreStore","useDispatch","createInterpolateElement","pdfKey","siteUrl","editEntityRecord","saveEditedEntityRecord","undefined","validate","data","client_id","client_device_time","Date","now","domain","response","fetch","method","mode","redirect","headers","body","help","a","href","target","rel","value","onChange","val","suffix","isPrimary","showBookmarks","showThumbnails","defaultViewMode","showZoomControl","PanelBody","SelectControl","ToggleControl","BaseControl","HeightControl","ApiButton","title","initialOpen","options","checked","beforeIcon","MediaPlaceholder","MediaReplaceFlow","useRefEffect","useInstanceId","useState","isSelected","clientId","instanceId","interactive","setInteractive","setupRef","element","ownerDocument","defaultView","addEventListener","AdobeDC","loadAdobeDc","script","document","src","head","appendChild","view","adobeDCView","View","divId","previewFile","content","location","metaData","onSelectMedia","media","filename","onSelectUrl","URL","pathname","mediaURL","allowedTypes","accept","onSelect","ref","tabIndex","onMouseUp","labels","onSelectURL"],"sourceRoot":""} \ No newline at end of file diff --git a/build/style-index.css b/build/style-index.css index 085c683..c735fdd 100644 --- a/build/style-index.css +++ b/build/style-index.css @@ -1,15 +1 @@ -/*!***************************************************************************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***! - \***************************************************************************************************************************************************************************************************************************************/ -/** - * The following styles get applied both on the front of your site - * and in the editor. - * - * Replace them with your own styles or remove the file completely. - */ -.wp-block-tropicalista-pdfembed { - height: 500px; - min-height: 500px; -} - -/*# sourceMappingURL=style-index.css.map*/ \ No newline at end of file +.wp-block-tropicalista-pdfembed{height:500px;min-height:500px} diff --git a/build/style-index.css.map b/build/style-index.css.map deleted file mode 100644 index 8b26083..0000000 --- a/build/style-index.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAOA;EACI;EACA;AAAJ,C","sources":["webpack://adobe-pdf/./src/style.scss"],"sourcesContent":["/**\n * The following styles get applied both on the front of your site\n * and in the editor.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.wp-block-tropicalista-pdfembed {\n height: 500px;\n min-height: 500px;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/build/view.asset.php b/build/view.asset.php index 9370877..5c43977 100644 --- a/build/view.asset.php +++ b/build/view.asset.php @@ -1 +1 @@ - array(), 'version' => 'bc89ad4736b934a371e2'); + array(), 'version' => 'c6c45ce8d90c7df85524'); diff --git a/build/view.js b/build/view.js index a0f3ce4..f647198 100644 --- a/build/view.js +++ b/build/view.js @@ -1,87 +1 @@ -/******/ (() => { // webpackBootstrap -var __webpack_exports__ = {}; -/*!*********************!*\ - !*** ./src/view.js ***! - \*********************/ -const script = document.createElement('script'); -script.src = 'https://acrobatservices.adobe.com/view-sdk/viewer.js'; -document.head.appendChild(script); -document.addEventListener('adobe_dc_view_sdk.ready', function () { - const elms = document.querySelectorAll('.wp-block-tropicalista-pdfembed'); - const userLang = window.navigator.language || window.navigator.userLanguage; - for (let i = 0; i < elms.length; i++) { - const embedConfig = elms[i].dataset; - const adobeDCView = new window.AdobeDC.View({ - clientId: embedConfig.clientId, - divId: elms[i].id, - locale: userLang - }); - adobeDCView.previewFile({ - content: { - location: { - url: embedConfig.mediaUrl - } - }, - metaData: { - fileName: embedConfig.fileName - } - }, { - embedMode: embedConfig.embedMode || 'FULL_WINDOW', - dockPageControls: Boolean(embedConfig.dockPageControls), - showDownloadPDF: Boolean(embedConfig.showDownloadPdf), - showPrintPDF: Boolean(embedConfig.showPrintPdf), - showPageControls: Boolean(embedConfig.showPageControls), - showZoomControl: Boolean(embedConfig.showZoomControl), - showFullScreen: Boolean(embedConfig.showFullScreen), - showThumbnails: Boolean(embedConfig.showThumbnails), - showBookmarks: Boolean(embedConfig.showBookmarks), - defaultViewMode: embedConfig.defaultViewMode || 'FIT_PAGE', - showAnnotationTools: Boolean(embedConfig.showAnnotationTools), - enableFormFilling: Boolean(embedConfig.enableFormFilling) - }); - } - const buttons = document.querySelectorAll('.embedPdf>a, a.embedPdf'); - for (let i = 0; i < buttons.length; i++) { - buttons[i].onclick = function (e) { - const ext = e.target.href.split(/[#?]/)[0].split('.').pop().trim(); - if ('pdf' === ext) { - e.preventDefault(); - previewFile(e); - } - }; - } -}); - -/* Function to render the file using PDF Embed API. */ -function previewFile(e) { - if (!e.target.href) { - return; - } - - /* Initialize the AdobeDC View object */ - const adobeDCView = new AdobeDC.View({ - /* Pass your registered client id */ - clientId: pdf_embed.apiKey - }); - - /* Invoke the file preview API on Adobe DC View object */ - adobeDCView.previewFile({ - /* Pass information on how to access the file */ - content: { - /* Location of file where it is hosted */ - location: { - url: e.target.href - } - }, - /* Pass meta data of file */ - metaData: { - /* file name */ - fileName: new URL(e.target.href).pathname.split('/').pop() - } - }, { - embedMode: 'LIGHT_BOX' - }); -} -/******/ })() -; -//# sourceMappingURL=view.js.map \ No newline at end of file +(()=>{const e=document.createElement("script");function o(e){e.target.href&&new AdobeDC.View({clientId:pdf_embed.apiKey}).previewFile({content:{location:{url:e.target.href}},metaData:{fileName:new URL(e.target.href).pathname.split("/").pop()}},{embedMode:"LIGHT_BOX"})}e.src="https://acrobatservices.adobe.com/view-sdk/viewer.js",document.head.appendChild(e),document.addEventListener("adobe_dc_view_sdk.ready",(function(){const e=document.querySelectorAll(".wp-block-tropicalista-pdfembed"),n=window.navigator.language||window.navigator.userLanguage;for(let o=0;oa, a.embedPdf");for(let e=0;ea, a.embedPdf' );\n\tfor ( let i = 0; i < buttons.length; i++ ) {\n\t\tbuttons[ i ].onclick = function ( e ) {\n\t\t\tconst ext = e.target.href\n\t\t\t\t.split( /[#?]/ )[ 0 ]\n\t\t\t\t.split( '.' )\n\t\t\t\t.pop()\n\t\t\t\t.trim();\n\t\t\tif ( 'pdf' === ext ) {\n\t\t\t\te.preventDefault();\n\t\t\t\tpreviewFile( e );\n\t\t\t}\n\t\t};\n\t}\n} );\n\n/* Function to render the file using PDF Embed API. */\nfunction previewFile( e ) {\n\tif ( ! e.target.href ) {\n\t\treturn;\n\t}\n\n\t/* Initialize the AdobeDC View object */\n\tconst adobeDCView = new AdobeDC.View( {\n\t\t/* Pass your registered client id */\n\t\tclientId: pdf_embed.apiKey,\n\t} );\n\n\t/* Invoke the file preview API on Adobe DC View object */\n\tadobeDCView.previewFile(\n\t\t{\n\t\t\t/* Pass information on how to access the file */\n\t\t\tcontent: {\n\t\t\t\t/* Location of file where it is hosted */\n\t\t\t\tlocation: {\n\t\t\t\t\turl: e.target.href,\n\t\t\t\t},\n\t\t\t},\n\t\t\t/* Pass meta data of file */\n\t\t\tmetaData: {\n\t\t\t\t/* file name */\n\t\t\t\tfileName: new URL( e.target.href ).pathname.split( '/' ).pop(),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tembedMode: 'LIGHT_BOX',\n\t\t}\n\t);\n}\n"],"names":["script","document","createElement","src","head","appendChild","addEventListener","elms","querySelectorAll","userLang","window","navigator","language","userLanguage","i","length","embedConfig","dataset","adobeDCView","AdobeDC","View","clientId","divId","id","locale","previewFile","content","location","url","mediaUrl","metaData","fileName","embedMode","dockPageControls","Boolean","showDownloadPDF","showDownloadPdf","showPrintPDF","showPrintPdf","showPageControls","showZoomControl","showFullScreen","showThumbnails","showBookmarks","defaultViewMode","showAnnotationTools","enableFormFilling","buttons","onclick","e","ext","target","href","split","pop","trim","preventDefault","pdf_embed","apiKey","URL","pathname"],"sourceRoot":""} \ No newline at end of file diff --git a/pdf-embed.php b/pdf-embed.php index 9f1b165..4cb66b1 100644 --- a/pdf-embed.php +++ b/pdf-embed.php @@ -3,8 +3,8 @@ * Plugin Name: Pdf Embed * Plugin URI: https://formello.net/ * Description: PDF embedded with official Adobe API. - * Version: 0.3.9 - * Author: Formello + * Version: 0.4.0 + * Author: Tropicalista * Author URI: https://formello.net * License: GPL2 * License URI: https://www.gnu.org/licenses/gpl-2.0.html