diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/block-editor.js.map b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/block-editor.js.map
index da3f6cf04..38c0498b0 100644
--- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/block-editor.js.map
+++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/block-editor.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./js/src/blocks.js","webpack:///./js/src/components/video.js","webpack:///./node_modules/@babel/runtime/helpers/defineProperty.js","webpack:///./node_modules/@babel/runtime/helpers/objectSpread.js","webpack:///external {\"this\":[\"wp\",\"components\"]}","webpack:///external {\"this\":[\"wp\",\"element\"]}","webpack:///external {\"this\":[\"wp\",\"i18n\"]}"],"names":["$","window","jQuery","cloudinaryBlocks","Video","withSelect","wp","data","_init","CLD_VIDEO_PLAYER","hooks","addFilter","settings","name","video_autoplay_mode","attributes","autoplay","default","video_loop","loop","video_controls","controls","cldAddToggle","overwrite_transformations","type","transformations","TransformationsToggle","props","setAttributes","__","value","ImageInspectorControls","media","InspectorControls","editor","console","log","select","ownProps","id","getMedia","cldFilterBlocksEdit","BlockEdit","inspectorControls","cldfilterBlocksSave","element","blockType","children","cloneElement","classname","className","child","neChildren"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,E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BAAqB,mBAAO,CAAC,iFAAkB;;AAE/C;AACA,iBAAiB,sBAAsB;AACvC;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA,+B;;;;;;;;;;;ACrBA,aAAa,2CAA2C,EAAE,I;;;;;;;;;;;ACA1D,aAAa,wCAAwC,EAAE,I;;;;;;;;;;;ACAvD,aAAa,qCAAqC,EAAE,I","file":"block-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./js/src/blocks.js\");\n","/* global window */\n/**\n * Main JS.\n */\n\n// Components\nimport Video from './components/video';\n\n\n// jQuery, because reasons.\nconst $ = window.$ = window.jQuery;\n\n// Global Constants\nexport const cloudinaryBlocks = {\n\tVideo\n};\n\n","/* global window wp */\n\nimport { __ } from '@wordpress/i18n';\nimport { ToggleControl, PanelBody } from '@wordpress/components';\nimport { cloneElement } from '@wordpress/element';\n\nconst { withSelect } = wp.data;\n\nconst Video = {\n\t_init: function() {\n\t\tif ( typeof CLD_VIDEO_PLAYER === 'undefined' ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Gutenberg Video Settings\n\t\twp.hooks.addFilter(\n\t\t\t'blocks.registerBlockType',\n\t\t\t'Cloudinary/Media/Video',\n\t\t\tfunction( settings, name ) {\n\t\t\t\tif ( name === 'core/video' ) {\n\t\t\t\t\tif ( 'off' !== CLD_VIDEO_PLAYER.video_autoplay_mode ) {\n\t\t\t\t\t\tsettings.attributes.autoplay.default = true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( 'on' === CLD_VIDEO_PLAYER.video_loop ) {\n\t\t\t\t\t\tsettings.attributes.loop.default = true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( 'off' === CLD_VIDEO_PLAYER.video_controls ) {\n\t\t\t\t\t\tsettings.attributes.controls.default = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn settings;\n\t\t\t}\n\t\t);\n\t},\n};\n\nexport default Video;\n\n// Init.\nVideo._init();\n\nlet cldAddToggle = function( settings, name ) {\n\n\tif ( 'core/image' === name || 'core/video' === name ) {\n\t\tif ( !settings.attributes ) {\n\t\t\tsettings.attributes = {};\n\t\t}\n\n\t\tsettings.attributes.overwrite_transformations = {\n\t\t\ttype: 'boolean',\n\t\t};\n\n\t\tsettings.attributes.transformations = {\n\t\t\ttype: 'boolean',\n\t\t};\n\n\t}\n\n\treturn settings;\n};\n\nwp.hooks.addFilter( 'blocks.registerBlockType', 'cloudinary/addAttributes', cldAddToggle );\n\n/**\n * Get AMP Lightbox toggle control.\n *\n * @param {Object} props Props.\n *\n * @return {Component} Element.\n */\nconst TransformationsToggle = ( props ) => {\n\tconst { attributes: { overwrite_transformations, transformations }, setAttributes } = props;\n\t\n\tif ( ! transformations ) {\n\t\treturn null;\n \t}\n \n\treturn (\n\t\t\n\t\t\t {\n\t\t\t\t\tsetAttributes( { overwrite_transformations: value } );\n\t\t\t\t}}\n\t\t\t/>\n\t\t\n\t);\n};\n\nlet ImageInspectorControls = ( props ) => {\n\tconst { setAttributes, media } = props;\n\tconst { InspectorControls } = wp.editor;\n\t\n\tconsole.log(media);\n\n\tif ( media && media.transformations ) {\n\t\tsetAttributes( { transformations: true } );\n\t}\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nImageInspectorControls = withSelect( ( select, ownProps ) => ( {\n ...ownProps,\n media: ownProps.attributes.id ? select( 'core' ).getMedia( ownProps.attributes.id ) : null\n} ))( ImageInspectorControls );\n\nconst cldFilterBlocksEdit = ( BlockEdit ) => {\n\treturn ( props ) => {\n\t\tconst { name } = props;\n\t\tlet inspectorControls = null;\n\n\t\tif ( 'core/image' === name || 'core/video' === name ) {\n\t\t\tinspectorControls = ;\n\t\t}\n\t\t\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{inspectorControls}\n\t\t\t\t\n\t\t\t>\n\t\t);\n\t}\n};\n\nwp.hooks.addFilter( 'editor.BlockEdit', 'cloudinary/filterEdit', cldFilterBlocksEdit, 20 );\n\nconst cldfilterBlocksSave = ( element, blockType, attributes ) => {\n\tif ( 'core/image' === blockType.name && attributes.overwrite_transformations ) {\n\t\tlet children = cloneElement( element.props.children );\n\t\tlet classname = children.props.children[ 0 ].props.className ? children.props.children[ 0 ].props.className : '';\n\t\tlet child = cloneElement( children.props.children[ 0 ], { className: classname + ' cld-overwrite' } );\n\t\tlet neChildren = cloneElement( children, { children: [ child, false ] } );\n\t\treturn cloneElement( element, { children: neChildren } );\n\t}\n\n\tif ( 'core/video' === blockType.name && attributes.overwrite_transformations ) {\n\t\tlet children = cloneElement( element.props.children[ 0 ], { className: ' cld-overwrite' } );\n\t\treturn cloneElement( element, { children } );\n\t}\n\n\treturn element;\n};\n\nwp.hooks.addFilter( 'blocks.getSaveElement', 'cloudinary/filterSave', cldfilterBlocksSave );\n","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","var defineProperty = require(\"./defineProperty\");\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? Object(arguments[i]) : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nmodule.exports = _objectSpread;","(function() { module.exports = this[\"wp\"][\"components\"]; }());","(function() { module.exports = this[\"wp\"][\"element\"]; }());","(function() { module.exports = this[\"wp\"][\"i18n\"]; }());"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./js/src/blocks.js","webpack:///./js/src/components/video.js","webpack:///./node_modules/@babel/runtime/helpers/defineProperty.js","webpack:///./node_modules/@babel/runtime/helpers/objectSpread.js","webpack:///external {\"this\":[\"wp\",\"components\"]}","webpack:///external {\"this\":[\"wp\",\"data\"]}","webpack:///external {\"this\":[\"wp\",\"element\"]}","webpack:///external {\"this\":[\"wp\",\"i18n\"]}"],"names":["$","window","jQuery","cloudinaryBlocks","Video","_init","CLD_VIDEO_PLAYER","wp","hooks","addFilter","settings","name","video_autoplay_mode","attributes","autoplay","default","video_loop","loop","video_controls","controls","cldAddToggle","overwrite_transformations","type","transformations","TransformationsToggle","props","setAttributes","__","value","ImageInspectorControls","media","InspectorControls","editor","withSelect","select","ownProps","id","getMedia","cldFilterBlocksEdit","BlockEdit","shouldDisplayInspector","cldfilterBlocksSave","element","blockType","children","cloneElement","classname","className","child","neChildren"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QAC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KAAK;AACL;;AAEA;AACA;;AAEA,+B;;;;;;;;;;;ACrBA,aAAa,2CAA2C,EAAE,I;;;;;;;;;;;ACA1D,aAAa,qCAAqC,EAAE,I;;;;;;;;;;;ACApD,aAAa,wCAAwC,EAAE,I;;;;;;;;;;;ACAvD,aAAa,qCAAqC,EAAE,I","file":"block-editor.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./js/src/blocks.js\");\n","/* global window */\n/**\n * Main JS.\n */\n\n// Components\nimport Video from './components/video';\n\n\n// jQuery, because reasons.\nconst $ = window.$ = window.jQuery;\n\n// Global Constants\nexport const cloudinaryBlocks = {\n\tVideo\n};\n\n","/* global window wp */\n\nimport { __ } from '@wordpress/i18n';\nimport { withSelect } from '@wordpress/data';\nimport { cloneElement } from '@wordpress/element';\nimport { ToggleControl, PanelBody } from '@wordpress/components';\n\nconst Video = {\n\t_init: function() {\n\t\tif ( typeof CLD_VIDEO_PLAYER === 'undefined' ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Gutenberg Video Settings\n\t\twp.hooks.addFilter(\n\t\t\t'blocks.registerBlockType',\n\t\t\t'Cloudinary/Media/Video',\n\t\t\tfunction( settings, name ) {\n\t\t\t\tif ( name === 'core/video' ) {\n\t\t\t\t\tif ( 'off' !== CLD_VIDEO_PLAYER.video_autoplay_mode ) {\n\t\t\t\t\t\tsettings.attributes.autoplay.default = true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( 'on' === CLD_VIDEO_PLAYER.video_loop ) {\n\t\t\t\t\t\tsettings.attributes.loop.default = true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( 'off' === CLD_VIDEO_PLAYER.video_controls ) {\n\t\t\t\t\t\tsettings.attributes.controls.default = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn settings;\n\t\t\t}\n\t\t);\n\t},\n};\n\nexport default Video;\n\n// Init.\nVideo._init();\n\nlet cldAddToggle = function( settings, name ) {\n\n\tif ( 'core/image' === name || 'core/video' === name ) {\n\t\tif ( !settings.attributes ) {\n\t\t\tsettings.attributes = {};\n\t\t}\n\n\t\tsettings.attributes.overwrite_transformations = {\n\t\t\ttype: 'boolean',\n\t\t};\n\n\t\tsettings.attributes.transformations = {\n\t\t\ttype: 'boolean',\n\t\t};\n\n\t}\n\n\treturn settings;\n};\n\nwp.hooks.addFilter( 'blocks.registerBlockType', 'cloudinary/addAttributes', cldAddToggle );\n\n/**\n * Get AMP Lightbox toggle control.\n *\n * @param {Object} props Props.\n *\n * @return {Component} Element.\n */\nconst TransformationsToggle = ( props ) => {\n\tconst {attributes: {overwrite_transformations, transformations}, setAttributes} = props;\n\t\n\tif ( ! transformations ) {\n\t\treturn null;\n }\n \n\treturn (\n\t\t\n\t\t\t {\n\t\t\t\t\tsetAttributes( {overwrite_transformations: value} );\n\t\t\t\t}}\n\t\t\t/>\n\t\t\n\t);\n};\n\nlet ImageInspectorControls = ( props ) => {\n\tconst {setAttributes, media} = props;\n\tconst {InspectorControls} = wp.editor;\n\t\n\tif ( media && media.transformations ) {\n\t\tsetAttributes( {transformations: true} );\n\t}\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nImageInspectorControls = withSelect( ( select, ownProps ) => ( {\n\t...ownProps,\n\tmedia: ownProps.attributes.id ? select( 'core' ).getMedia( ownProps.attributes.id ) : null\n} ))( ImageInspectorControls );\n\nconst cldFilterBlocksEdit = ( BlockEdit ) => {\n\treturn ( props ) => {\n\t\tconst {name} = props;\n\t\tconst shouldDisplayInspector = 'core/image' === name || 'core/video' === name;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{shouldDisplayInspector ? : null}\n\t\t\t\t\n\t\t\t>\n\t\t);\n\t}\n};\n\nwp.hooks.addFilter( 'editor.BlockEdit', 'cloudinary/filterEdit', cldFilterBlocksEdit, 20 );\n\nconst cldfilterBlocksSave = ( element, blockType, attributes ) => {\n\tif ( 'core/image' === blockType.name && attributes.overwrite_transformations ) {\n\t\tlet children = cloneElement( element.props.children );\n\t\tlet classname = children.props.children[ 0 ].props.className ? children.props.children[ 0 ].props.className : '';\n\t\tlet child = cloneElement( children.props.children[ 0 ], {className: classname + ' cld-overwrite'} );\n\t\tlet neChildren = cloneElement( children, {children: [ child, false ]} );\n\t\treturn cloneElement( element, {children: neChildren} );\n\t}\n\n\tif ( 'core/video' === blockType.name && attributes.overwrite_transformations ) {\n\t\tlet children = cloneElement( element.props.children[ 0 ], {className: ' cld-overwrite'} );\n\t\treturn cloneElement( element, {children} );\n\t}\n\n\treturn element;\n};\n\nwp.hooks.addFilter( 'blocks.getSaveElement', 'cloudinary/filterSave', cldfilterBlocksSave );\n","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","var defineProperty = require(\"./defineProperty\");\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? Object(arguments[i]) : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nmodule.exports = _objectSpread;","(function() { module.exports = this[\"wp\"][\"components\"]; }());","(function() { module.exports = this[\"wp\"][\"data\"]; }());","(function() { module.exports = this[\"wp\"][\"element\"]; }());","(function() { module.exports = this[\"wp\"][\"i18n\"]; }());"],"sourceRoot":""}
\ No newline at end of file
diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/cloudinary.js b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/cloudinary.js
index 16122372d..b23ec088c 100644
--- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/cloudinary.js
+++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/cloudinary.js
@@ -1 +1 @@
-!function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=3)}([function(e,t){window,jQuery,jQuery(document).ready((function(e){e(document).on("tabs.init",(function(){var t=e(".settings-tab-trigger"),i=e(".settings-tab-section");e(this).on("click",".settings-tab-trigger",(function(n){var s=e(this),a=e(s.attr("href"));n.preventDefault(),t.removeClass("active"),i.removeClass("active"),s.addClass("active"),a.addClass("active"),e(document).trigger("settings.tabbed",s)})),e(".cld-field").not('[data-condition="false"]').each((function(){const t=e(this),i=t.data("condition");for(let n in i){const s=i[n],a=e("#field-"+n),o=t.closest("tr");a.on("change init",(function(){this.value===s||this.checked?o.show():o.hide()})),a.trigger("init")}})),e("#field-cloudinary_url").on("input change",(function(){let t=e(this),i=t.val();new RegExp(/^(cloudinary:\/\/){1}(\d)*[:]{1}[^:@]*[@]{1}[^@]*$/g).test(i)?(t.addClass("settings-valid-field"),t.removeClass("settings-invalid-field")):(t.removeClass("settings-valid-field"),t.addClass("settings-invalid-field"))})).trigger("change")})),e(".render-trigger[data-event]").each((function(){var t=e(this),i=t.data("event");t.trigger(i,this)}))}))},function(e,t){if(wp.media&&window.CLDN){wp.media.events.on("editor:image-edit",(function(e){e.metadata.cldoverwrite=null,e.image.className.split(" ").indexOf("cld-overwrite")>=0&&(e.metadata.cldoverwrite="true")})),wp.media.events.on("editor:image-update",(function(e){let t=e.image.className.split(" ");e.metadata.cldoverwrite&&-1===t.indexOf("cld-overwrite")?t.push("cld-overwrite"):!e.metadata.cldoverwrite&&t.indexOf("cld-overwrite")>=0&&delete t[t.indexOf("cld-overwrite")],e.image.className=t.join(" ")}));let e=null,t=wp.media.string.props;wp.media.string.props=function(i,n){return i.cldoverwrite&&(i.classes=["cld-overwrite"],e=!0),t(i,n)},wp.media.post=function(t,i){if("send-attachment-to-editor"===t){let t=wp.media.editor.get().state().get("selection").get(i.attachment);t.attributes.transformations&&(i.attachment.transformations=t.attributes.transformations),(i.html.indexOf("cld-overwrite")>-1||!0===e)&&(i.attachment.cldoverwrite=!0,e=null)}return wp.ajax.post(t,i)};wp.media.controller.Library;let i=wp.media.view.MediaFrame.Select,n=wp.media.view.MediaFrame.Post,s=wp.media.view.MediaFrame.ImageDetails,a=wp.media.view.MediaFrame.VideoDetails,o=wp.media.View.extend({tagName:"div",className:"cloudinary-widget",template:wp.template("cloudinary-dam"),active:!1,toolbar:null,frame:null,ready:function(){let e=this.controller,t=this.model.get("selection"),i=this.model.get("library"),n=wp.media.model.Attachment;if(CLDN.mloptions.multiple=e.options.multiple,this.cid!==this.active){if(CLDN.mloptions.inline_container="#cloudinary-dam-"+e.cid,1===t.length){var s=n.get(t.models[0].id);void 0!==s.attributes.public_id&&(CLDN.mloptions.asset={resource_id:s.attributes.public_id})}else CLDN.mloptions.asset=null;window.ml=cloudinary.openMediaLibrary(CLDN.mloptions,{insertHandler:function(s){for(let a=0;a=100&&void 0!==e.started?(this.submitButton.style.display=this.hide,this.stopButton.style.display=this.show):e.pending>0?(this.submitButton.style.display=this.show,this.stopButton.style.display=this.hide):e.processing>0?this.stopButton.style.display=this.show:this.stopButton.style.display=this.hide,e.percent<100?(this.barSyncCount.innerText=e.total,this.progressCount.innerText=e.done,this.progress.style.display=this.show):(this.completed.style.display=this.show,this.progress.style.display=this.hide)},_start:function(e){e.preventDefault(),a.stopButton.style.display=a.show,a.submitButton.style.display=a.hide,a.pushAttachments()},_reset:function(e){a.submitButton.style.display=a.hide,a.getStatus()},_init:function(e){"undefined"!=typeof cloudinaryApi&&((document.attachEvent?"complete"===document.readyState:"loading"!==document.readyState)?e():document.addEventListener("DOMContentLoaded",e))}};var o=a;a._init((function(){a._reset(),a.submitButton.addEventListener("click",a._start),a.stopButton.addEventListener("click",a.stopSync)}));var r=i(1),l=i.n(r);const d={sample:{image:document.getElementById("transformation-sample-image"),video:document.getElementById("transformation-sample-video")},preview:{image:document.getElementById("sample-image"),video:document.getElementById("sample-video")},fields:document.getElementsByClassName("cld-field"),button:{image:document.getElementById("refresh-image-preview"),video:document.getElementById("refresh-video-preview")},spinner:{image:document.getElementById("image-loader"),video:document.getElementById("video-loader")},activeItem:null,elements:{image:[],video:[]},_placeItem:function(e){null!==e&&(e.style.display="block",e.style.visibility="visible",e.style.position="absolute",e.style.top=e.parentElement.clientHeight/2-e.clientHeight/2+"px",e.style.left=e.parentElement.clientWidth/2-e.clientWidth/2+"px")},_setLoading:function(e){this.button[e].style.display="block",this._placeItem(this.button[e]),this.preview[e].style.opacity="0.1"},_build:function(e){this.sample[e].innerHTML="",this.elements[e]=[];for(let t of this.fields){if(e!==t.dataset.context)continue;let i=t.value.trim();if(i.length){if("select-one"===t.type){if("none"===i)continue;i=t.dataset.meta+"_"+i}else{let e=t.dataset.context;i=this._transformations(i,e,!0)}i&&this.elements[e].push(i)}}let t="";this.elements[e].length&&(t="/"+this.elements[e].join(",").replace(/ /g,"%20")),this.sample[e].textContent=t,this.sample[e].parentElement.href="https://res.cloudinary.com/demo/"+this.sample[e].parentElement.innerText.trim().replace("../","").replace(/ /g,"%20")},_clearLoading:function(e){this.spinner[e].style.visibility="hidden",this.activeItem=null,this.preview[e].style.opacity=1},_refresh:function(e,t){e&&e.preventDefault();let i=this,n=CLD_GLOBAL_TRANSFORMATIONS[t].preview_url+i.elements[t].join(",")+CLD_GLOBAL_TRANSFORMATIONS[t].file;if(this.button[t].style.display="none",this._placeItem(this.spinner[t]),"image"===t){let e=new Image;e.onload=function(){i.preview[t].src=this.src,i._clearLoading(t),e.remove()},e.onerror=function(){alert(CLD_GLOBAL_TRANSFORMATIONS[t].error),i._clearLoading(t)},e.src=n}else{let e=i._transformations(i.elements[t].join(","),t);samplePlayer.source({publicId:"dog",transformation:e}),i._clearLoading(t)}},_transformations:function(e,t,i=!1){let n=CLD_GLOBAL_TRANSFORMATIONS[t].valid_types,s=null,a=e.split("/"),o=[];for(let e=0;e"),n=jQuery(""),s=jQuery("");return i.addClass("cld-tax-order-list-item").attr("data-item",e),n.addClass("cld-tax-order-list-item-input").attr("type","hidden").attr("name","cld_tax_order[]").val(e),s.addClass("dashicons dashicons-menu cld-tax-order-list-item-handle"),i.append(s).append(t).append(n),i},_pushItem:function(e,t){let i=this._createItem(e,t);this.tags.append(i)},_sortable:function(){jQuery(".cld-tax-order-list").sortable({connectWith:".cld-tax-order",axis:"y",handle:".cld-tax-order-list-item-handle",placeholder:"cld-tax-order-list-item-placeholder",forcePlaceholderSize:!0,helper:"clone"})}};var p=u;if(void 0!==window.CLDN&&u._init(),wp.data&&wp.data.select("core/editor")){let e={};wp.data.subscribe((function(){let t=wp.data.select("core").getTaxonomies();if(t)for(let i in t){let n=wp.data.select("core/editor").getEditedPostAttribute(t[i].rest_base);e[t[i].slug]=n}}));let t=wp.element.createElement,i=function(i){class n extends i{makeItem(e){let t=this.makeElement(e);jQuery("#cld-tax-items").append(t)}findOrCreateTerm(e){let t=this;return(e=super.findOrCreateTerm(e)).then(e=>t.makeItem(e)),e}onChange(t){super.onChange(t);let i=this.pickItem(t);if(i)if(e[this.props.slug].indexOf(i.id)>=0)this.makeItem(i);else{let e=jQuery('[data-item="'+i.id+'"]');e.length&&e.remove()}}pickItem(e){if("object"==typeof e){if(e.target)for(let t in this.state.availableTerms)if(this.state.availableTerms[t].id===parseInt(e.target.value))return this.state.availableTerms[t]}else if("number"==typeof e){for(let t in this.state.availableTerms)if(this.state.availableTerms[t].id===e)return this.state.availableTerms[t]}else{let t;if(e.length>this.state.selectedTerms.length)for(let i in e)-1===this.state.selectedTerms.indexOf(e[i])&&(t=e[i]);else for(let i in this.state.selectedTerms)-1===e.indexOf(this.state.selectedTerms[i])&&(t=this.state.selectedTerms[i]);for(let e in this.state.availableTerms)if(this.state.availableTerms[e].name===t)return this.state.availableTerms[e]}}makeElement(e){let t=jQuery(""),i=jQuery(""),n=jQuery("");return t.addClass("cld-tax-order-list-item").attr("data-item",e.id),i.addClass("cld-tax-order-list-item-input").attr("type","hidden").attr("name","cld_tax_order[]").val(e.id),n.addClass("dashicons dashicons-menu cld-tax-order-list-item-handle"),t.append(n).append(e.name).append(i),t}}return function(e){return t(n,e)}};wp.hooks.addFilter("editor.PostTaxonomyType","cld",i)}const m={wpWrap:document.getElementById("wpwrap"),wpContent:document.getElementById("wpbody-content"),libraryWrap:document.getElementById("cloudinary-embed"),_init:function(){let e=this;"undefined"!=typeof CLD_ML&&(cloudinary.openMediaLibrary(CLD_ML.mloptions,{insertHandler:function(e){alert("Import is not yet implemented.")}}),window.addEventListener("resize",(function(t){e._resize()})),e._resize())},_resize:function(){let e=getComputedStyle(this.wpContent);this.libraryWrap.style.height=this.wpWrap.offsetHeight-parseInt(e.getPropertyValue("padding-bottom"))+"px"}};var h=m;m._init();i(2);i.d(t,"cloudinary",(function(){return f}));window.$=window.jQuery;const f={settings:s.a,sync:o,widget:l.a,Global_Transformations:c,Terms_Order:p,Media_Library:h}}]);
\ No newline at end of file
+!function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=3)}([function(e,t){window,jQuery,jQuery(document).ready((function(e){e(document).on("tabs.init",(function(){var t=e(".settings-tab-trigger"),i=e(".settings-tab-section");e(this).on("click",".settings-tab-trigger",(function(n){var s=e(this),a=e(s.attr("href"));n.preventDefault(),t.removeClass("active"),i.removeClass("active"),s.addClass("active"),a.addClass("active"),e(document).trigger("settings.tabbed",s)})),e(".cld-field").not('[data-condition="false"]').each((function(){const t=e(this),i=t.data("condition");for(let n in i){const s=i[n],a=e("#field-"+n),o=t.closest("tr");a.on("change init",(function(){this.value===s||this.checked?o.show():o.hide()})),a.trigger("init")}})),e("#field-cloudinary_url").on("input change",(function(){let t=e(this),i=t.val();new RegExp(/^(cloudinary:\/\/){1}(\d)*[:]{1}[^:@]*[@]{1}[^@]*$/g).test(i)?(t.addClass("settings-valid-field"),t.removeClass("settings-invalid-field")):(t.removeClass("settings-valid-field"),t.addClass("settings-invalid-field"))})).trigger("change")})),e(".render-trigger[data-event]").each((function(){var t=e(this),i=t.data("event");t.trigger(i,this)}))}))},function(e,t){if(wp.media&&window.CLDN){wp.media.events.on("editor:image-edit",(function(e){e.metadata.cldoverwrite=null,e.image.className.split(" ").indexOf("cld-overwrite")>=0&&(e.metadata.cldoverwrite="true")})),wp.media.events.on("editor:image-update",(function(e){let t=e.image.className.split(" ");e.metadata.cldoverwrite&&-1===t.indexOf("cld-overwrite")?t.push("cld-overwrite"):!e.metadata.cldoverwrite&&t.indexOf("cld-overwrite")>=0&&delete t[t.indexOf("cld-overwrite")],e.image.className=t.join(" ")}));let e=null,t=wp.media.string.props;wp.media.string.props=function(i,n){return i.cldoverwrite&&(i.classes=["cld-overwrite"],e=!0),t(i,n)},wp.media.post=function(t,i){if("send-attachment-to-editor"===t){let t=wp.media.editor.get().state().get("selection").get(i.attachment);t.attributes.transformations&&(i.attachment.transformations=t.attributes.transformations),(i.html.indexOf("cld-overwrite")>-1||!0===e)&&(i.attachment.cldoverwrite=!0,e=null)}return wp.ajax.post(t,i)};wp.media.controller.Library;let i=wp.media.view.MediaFrame.Select,n=wp.media.view.MediaFrame.Post,s=wp.media.view.MediaFrame.ImageDetails,a=wp.media.view.MediaFrame.VideoDetails,o=wp.media.View.extend({tagName:"div",className:"cloudinary-widget",template:wp.template("cloudinary-dam"),active:!1,toolbar:null,frame:null,ready:function(){let e=this.controller,t=this.model.get("selection"),i=this.model.get("library"),n=wp.media.model.Attachment;if(CLDN.mloptions.multiple=e.options.multiple,this.cid!==this.active){if(CLDN.mloptions.inline_container="#cloudinary-dam-"+e.cid,1===t.length){var s=n.get(t.models[0].id);void 0!==s.attributes.public_id&&(CLDN.mloptions.asset={resource_id:s.attributes.public_id})}else CLDN.mloptions.asset=null;window.ml=cloudinary.openMediaLibrary(CLDN.mloptions,{insertHandler:function(s){for(let a=0;a=100&&void 0!==e.started?(this.submitButton.style.display=this.hide,this.stopButton.style.display=this.show):e.pending>0?(this.submitButton.style.display=this.show,this.stopButton.style.display=this.hide):e.processing>0?this.stopButton.style.display=this.show:this.stopButton.style.display=this.hide,e.percent<100?(this.barSyncCount.innerText=e.total,this.progressCount.innerText=e.done,this.progress.style.display=this.show):(this.completed.style.display=this.show,this.progress.style.display=this.hide)},_start:function(e){e.preventDefault(),a.stopButton.style.display=a.show,a.submitButton.style.display=a.hide,a.pushAttachments()},_reset:function(e){a.submitButton.style.display=a.hide,a.getStatus()},_init:function(e){"undefined"!=typeof cloudinaryApi&&((document.attachEvent?"complete"===document.readyState:"loading"!==document.readyState)?e():document.addEventListener("DOMContentLoaded",e))}};var o=a;a._init((function(){a._reset(),a.submitButton.addEventListener("click",a._start),a.stopButton.addEventListener("click",a.stopSync)}));var r=i(1),l=i.n(r);const d={sample:{image:document.getElementById("transformation-sample-image"),video:document.getElementById("transformation-sample-video")},preview:{image:document.getElementById("sample-image"),video:document.getElementById("sample-video")},fields:document.getElementsByClassName("cld-field"),button:{image:document.getElementById("refresh-image-preview"),video:document.getElementById("refresh-video-preview")},spinner:{image:document.getElementById("image-loader"),video:document.getElementById("video-loader")},activeItem:null,elements:{image:[],video:[]},_placeItem:function(e){null!==e&&(e.style.display="block",e.style.visibility="visible",e.style.position="absolute",e.style.top=e.parentElement.clientHeight/2-e.clientHeight/2+"px",e.style.left=e.parentElement.clientWidth/2-e.clientWidth/2+"px")},_setLoading:function(e){this.button[e].style.display="block",this._placeItem(this.button[e]),this.preview[e].style.opacity="0.1"},_build:function(e){this.sample[e].innerHTML="",this.elements[e]=[];for(let t of this.fields){if(e!==t.dataset.context)continue;let i=t.value.trim();if(i.length){if("select-one"===t.type){if("none"===i)continue;i=t.dataset.meta+"_"+i}else{let e=t.dataset.context;i=this._transformations(i,e,!0)}i&&this.elements[e].push(i)}}let t="";this.elements[e].length&&(t="/"+this.elements[e].join(",").replace(/ /g,"%20")),this.sample[e].textContent=t,this.sample[e].parentElement.href="https://res.cloudinary.com/demo/"+this.sample[e].parentElement.innerText.trim().replace("../","").replace(/ /g,"%20")},_clearLoading:function(e){this.spinner[e].style.visibility="hidden",this.activeItem=null,this.preview[e].style.opacity=1},_refresh:function(e,t){e&&e.preventDefault();let i=this,n=CLD_GLOBAL_TRANSFORMATIONS[t].preview_url+i.elements[t].join(",")+CLD_GLOBAL_TRANSFORMATIONS[t].file;if(this.button[t].style.display="none",this._placeItem(this.spinner[t]),"image"===t){let e=new Image;e.onload=function(){i.preview[t].src=this.src,i._clearLoading(t),e.remove()},e.onerror=function(){alert(CLD_GLOBAL_TRANSFORMATIONS[t].error),i._clearLoading(t)},e.src=n}else{let e=i._transformations(i.elements[t].join(","),t);samplePlayer.source({publicId:"dog",transformation:e}),i._clearLoading(t)}},_transformations:function(e,t,i=!1){let n=CLD_GLOBAL_TRANSFORMATIONS[t].valid_types,s=null,a=e.split("/"),o=[];for(let e=0;e{const i=t.length?t[0].id+1:1;e.startId=null===e.startId?i:++e.startId;const n=a+":"+e.startId;jQuery('[data-item="'+n+'"]').length||e._pushItem(n,s[s.length-1])})}return this.processflushTags(t,i,n)},window.tagBox.processTags=window.tagBox.parseTags,window.tagBox.parseTags=function(t){const i=t.id,n=i.split("-check-num-")[1],s=i.split("-check-num-")[0],a=jQuery(t).closest(".tagsdiv").find(".the-tags"),o=window.tagBox.clean(a.val()).split(e.tagDelimiter)[n];(new wp.api.collections.Tags).fetch({data:{slug:o}}).done(i=>{const n=!!i.length&&jQuery('[data-item="'+s+":"+i[0].id+'"]');n.length?n.remove():(jQuery(`.cld-tax-order-list-item:contains(${o})`).remove(),--e.startId),this.processTags(t)})}),jQuery("body").on("change",".selectit input",(function(){const t=jQuery(this),i=t.val(),n=t.is(":checked"),s=t.parent().text().trim();!0===n?e._pushItem(`category:${i}`,s):e.tags.find(`[data-item="category:${i}"]`).remove()}))},_createItem:function(e,t){const i=jQuery(""),n=jQuery(""),s=jQuery("");return i.addClass("cld-tax-order-list-item").attr("data-item",e),s.addClass("cld-tax-order-list-item-input").attr("type","hidden").attr("name","cld_tax_order[]").val(e),n.addClass("dashicons dashicons-menu cld-tax-order-list-item-handle"),i.append(n).append(t).append(s),i},_pushItem:function(e,t){let i=this._createItem(e,t);this.tags.append(i)},_sortable:function(){jQuery(".cld-tax-order-list").sortable({connectWith:".cld-tax-order",axis:"y",handle:".cld-tax-order-list-item-handle",placeholder:"cld-tax-order-list-item-placeholder",forcePlaceholderSize:!0,helper:"clone"})}};if(void 0!==window.CLDN&&u._init(),wp.data&&wp.data.select("core/editor")){const e={};wp.data.subscribe((function(){let t=wp.data.select("core").getTaxonomies();if(t)for(let i in t){const n=wp.data.select("core/editor").getEditedPostAttribute(t[i].rest_base);e[t[i].slug]=n}}));const t=wp.element.createElement,i=i=>{class n extends i{constructor(e){super(e),this.currentItems=jQuery(".cld-tax-order-list-item").map((e,t)=>jQuery(t).data("item")).get()}makeItem(e){if(this.currentItems.includes(this.getId(e)))return;const t=this.makeElement(e);jQuery("#cld-tax-items").append(t)}removeItem(e){const t=jQuery(`[data-item="${this.getId(e)}"]`);t.length&&(t.remove(),this.currentItems=this.currentItems.filter(t=>t!==this.getId(e)))}findOrCreateTerm(e){return(e=super.findOrCreateTerm(e)).then(e=>this.makeItem(e)),e}onChange(t){super.onChange(t);const i=this.pickItem(t);i&&(e[this.props.slug].includes(i.id)?this.makeItem(i):this.removeItem(i))}pickItem(e){if("object"==typeof e){if(e.target){for(let t in this.state.availableTerms)if(this.state.availableTerms[t].id===parseInt(e.target.value))return this.state.availableTerms[t]}else if(Array.isArray(e)){let t=this.state.selectedTerms.filter(t=>!e.includes(t))[0];return void 0===t&&(t=e.filter(e=>!this.state.selectedTerms.includes(e))[0]),this.state.availableTerms.find(e=>e.name===t)}}else if("number"==typeof e){for(let t in this.state.availableTerms)if(this.state.availableTerms[t].id===e)return this.state.availableTerms[t]}else{let t;if(e.length>this.state.selectedTerms.length)for(let i in e)-1===this.state.selectedTerms.indexOf(e[i])&&(t=e[i]);else for(let i in this.state.selectedTerms)-1===e.indexOf(this.state.selectedTerms[i])&&(t=this.state.selectedTerms[i]);for(let e in this.state.availableTerms)if(this.state.availableTerms[e].name===t)return this.state.availableTerms[e]}}getId(e){return`${this.props.slug}:${e.id}`}makeElement(e){const t=jQuery(""),i=jQuery(""),n=jQuery("");return t.addClass("cld-tax-order-list-item").attr("data-item",this.getId(e)),n.addClass("cld-tax-order-list-item-input").attr("type","hidden").attr("name","cld_tax_order[]").val(this.getId(e)),i.addClass("dashicons dashicons-menu cld-tax-order-list-item-handle"),t.append(i).append(e.name).append(n),t}}return e=>t(n,e)};wp.hooks.addFilter("editor.PostTaxonomyType","cld",i)}const p={wpWrap:document.getElementById("wpwrap"),wpContent:document.getElementById("wpbody-content"),libraryWrap:document.getElementById("cloudinary-embed"),_init:function(){let e=this;"undefined"!=typeof CLD_ML&&(cloudinary.openMediaLibrary(CLD_ML.mloptions,{insertHandler:function(e){alert("Import is not yet implemented.")}}),window.addEventListener("resize",(function(t){e._resize()})),e._resize())},_resize:function(){let e=getComputedStyle(this.wpContent);this.libraryWrap.style.height=this.wpWrap.offsetHeight-parseInt(e.getPropertyValue("padding-bottom"))+"px"}};var m=p;p._init();i(2);i.d(t,"cloudinary",(function(){return h}));window.$=window.jQuery;const h={settings:s.a,sync:o,widget:l.a,Global_Transformations:c,Terms_Order:void 0,Media_Library:m}}]);
\ No newline at end of file
diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/src/components/terms_order.js b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/src/components/terms_order.js
index 582eaf25f..cef9ea6a8 100644
--- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/src/components/terms_order.js
+++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/js/src/components/terms_order.js
@@ -1,104 +1,117 @@
/* global window wp wpAjax */
-const Terms_Order = {
+export const Terms_Order = {
template: '',
tags: jQuery( '#cld-tax-items' ),
tagDelimiter: (window.tagsSuggestL10n && window.tagsSuggestL10n.tagDelimiter) || ',',
+ startId: null,
_init: function() {
-
// Check that we found the tax-items.
- if ( !this.tags.length ) {
+ if ( ! this.tags.length ) {
return;
}
- // Init sortables.
+
+ const self = this;
this._sortable();
- let self = this;
// Setup ajax overrides.
if ( typeof wpAjax !== 'undefined' ) {
wpAjax.procesParseAjaxResponse = wpAjax.parseAjaxResponse;
- wpAjax.parseAjaxResponse = function( response, settings_response, element ) {
- let new_response = wpAjax.procesParseAjaxResponse( response, settings_response, element );
- if ( !new_response.errors && new_response.responses[ 0 ] ) {
- if ( jQuery( '[data-taxonomy="' + new_response.responses[ 0 ].what + '"]' ).length ) {
- let data = jQuery( new_response.responses[ 0 ].data ),
- text = data.find( 'label' ).last().text().trim();
- self._pushItem( new_response.responses[ 0 ].what, text );
+ wpAjax.parseAjaxResponse = function( response, settingsResponse, element ) {
+ let newResponse = wpAjax.procesParseAjaxResponse( response, settingsResponse, element );
+ if ( !newResponse.errors && newResponse.responses[ 0 ] ) {
+ if ( jQuery( '[data-taxonomy="' + newResponse.responses[ 0 ].what + '"]' ).length ) {
+ const data = jQuery( newResponse.responses[ 0 ].data );
+ const text = data.find( 'label' ).last().text().trim();
+
+ self._pushItem( newResponse.responses[ 0 ].what, text );
}
}
- return new_response;
+
+ return newResponse;
};
}
if ( typeof window.tagBox !== 'undefined' ) {
window.tagBox.processflushTags = window.tagBox.flushTags;
window.tagBox.flushTags = function( el, a, f ) {
-
if ( typeof f === 'undefined' ) {
- var taxonomy = el.prop( 'id' ),
- text,
- list,
- newtag = $( 'input.newtag', el );
+ let text, list;
+ const taxonomy = el.prop( 'id' );
+ const newTag = jQuery( 'input.newtag', el );
a = a || false;
- text = a ? $( a ).text() : newtag.val();
+ text = a ? jQuery( a ).text() : newTag.val();
list = window.tagBox.clean( text ).split( self.tagDelimiter );
- for (var i in list) {
- var tag = taxonomy + ':' + list[ i ];
- if ( !jQuery( '[data-item="' + tag + '"]' ).length ) {
- self._pushItem( tag, list[ i ] );
- }
- }
+ new wp.api.collections.Tags()
+ .fetch( { data: { orderby: 'id', order: 'desc', per_page: 1 } } )
+ .done( tags => {
+ const nextTagId = tags.length ? tags[0].id + 1 : 1
+ self.startId = self.startId === null ? nextTagId : ++self.startId;
+ const tag = taxonomy + ':' + self.startId;
+
+ if ( ! jQuery( '[data-item="' + tag + '"]' ).length ) {
+ self._pushItem( tag, list[ list.length - 1 ] );
+ }
+ } );
}
+
return this.processflushTags( el, a, f );
};
window.tagBox.processTags = window.tagBox.parseTags;
+
window.tagBox.parseTags = function( el ) {
+ const id = el.id;
+ const num = id.split( '-check-num-' )[ 1 ];
+ const taxonomy = id.split( '-check-num-' )[ 0 ];
+ const taxBox = jQuery( el ).closest( '.tagsdiv' );
+ const tagsTextarea = taxBox.find( '.the-tags' );
+ const tagToRemove = window.tagBox.clean( tagsTextarea.val() ).split( self.tagDelimiter )[ num ];
+
+ new wp.api.collections.Tags()
+ .fetch( { data: { slug: tagToRemove } } )
+ .done( ( tag ) => {
+ const tagFromDatabase = tag.length ? jQuery( '[data-item="' + taxonomy + ':' + tag[0].id + '"]' ) : false;
+
+ if ( tagFromDatabase.length ) {
+ tagFromDatabase.remove();
+ } else {
+ jQuery( `.cld-tax-order-list-item:contains(${tagToRemove})` ).remove();
+ --self.startId;
+ }
- let id = el.id,
- num = id.split( '-check-num-' )[ 1 ],
- taxonomy = id.split( '-check-num-' )[ 0 ],
- taxbox = $( el ).closest( '.tagsdiv' ),
- thetags = taxbox.find( '.the-tags' ),
- current_tags = window.tagBox.clean( thetags.val() ).split( self.tagDelimiter ),
- remove_tag = current_tags[ num ],
- remove_sortable = jQuery( '[data-item="' + taxonomy + ':' + remove_tag + '"]' );
-
- remove_sortable.remove();
- this.processTags( el );
+ this.processTags( el );
+ } );
};
}
jQuery( 'body' ).on( 'change', '.selectit input', function() {
- let clicked = jQuery( this ),
- text = clicked.parent().text().trim(),
- id = clicked.val(),
- checked = clicked.is( ':checked' );
+ const clickedItem = jQuery( this );
+ const id = clickedItem.val();
+ const checked = clickedItem.is( ':checked' );
+ const text = clickedItem.parent().text().trim();
if ( true === checked ) {
-
- self._pushItem( id, text );
- }
- else {
- self.tags.find( '[data-item="' + id + '"]' ).remove();
+ self._pushItem( `category:${id}`, text );
+ } else {
+ self.tags.find( `[data-item="category:${id}"]` ).remove();
}
-
} );
-
},
_createItem: function( id, name ) {
- let li = jQuery( '' ),
- input = jQuery( '' ),
- icon = jQuery( '' );
+ const li = jQuery( '' );
+ const icon = jQuery( '' );
+ const input = jQuery( '' );
li.addClass( 'cld-tax-order-list-item' ).attr( 'data-item', id );
input.addClass( 'cld-tax-order-list-item-input' ).attr( 'type', 'hidden' ).attr( 'name', 'cld_tax_order[]' ).val( id );
icon.addClass( 'dashicons dashicons-menu cld-tax-order-list-item-handle' );
li.append( icon ).append( name ).append( input ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
+
return li;
},
_pushItem: function( id, text ) {
@@ -106,8 +119,8 @@ const Terms_Order = {
this.tags.append( item ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
},
_sortable: function() {
+ const items = jQuery( '.cld-tax-order-list' );
- let items = jQuery( '.cld-tax-order-list' );
items.sortable( {
connectWith: '.cld-tax-order',
axis: 'y',
@@ -119,60 +132,73 @@ const Terms_Order = {
}
};
-export default Terms_Order;
-
-// Init.
if ( typeof window.CLDN !== 'undefined' ) {
Terms_Order._init();
}
// Gutenberg.
if ( wp.data && wp.data.select( 'core/editor' ) ) {
- let order_set = {};
+ const orderSet = {};
wp.data.subscribe( function() {
-
let taxonomies = wp.data.select( 'core' ).getTaxonomies();
if ( taxonomies ) {
- for (let t in taxonomies) {
- let set = wp.data.select( 'core/editor' ).getEditedPostAttribute( taxonomies[ t ].rest_base );
- order_set[ taxonomies[ t ].slug ] = set;
+ for ( let t in taxonomies ) {
+ const set = wp.data.select( 'core/editor' ).getEditedPostAttribute( taxonomies[ t ].rest_base );
+ orderSet[ taxonomies[ t ].slug ] = set;
}
}
-
} );
- let el = wp.element.createElement;
-
- let CustomizeTaxonomySelector = function( OriginalComponent ) {
+ const el = wp.element.createElement;
+ const CustomizeTaxonomySelector = ( OriginalComponent ) => {
+ class CustomHandler extends OriginalComponent {
+ constructor( props ) {
+ super(props)
- class customHandler extends OriginalComponent {
+ this.currentItems = jQuery( '.cld-tax-order-list-item' )
+ .map( ( _, taxonomy ) => jQuery( taxonomy ).data( 'item' ) ).get();
+ }
makeItem( item ) {
- let row = this.makeElement( item );
- let box = jQuery( '#cld-tax-items' );
+ // Prevent duplicates in the tax order box
+ if (this.currentItems.includes( this.getId( item ) ) ) {
+ return;
+ }
+
+ const row = this.makeElement( item );
+ const box = jQuery( '#cld-tax-items' );
box.append( row ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
}
+ removeItem( item ) {
+ const elementWithId = jQuery( `[data-item="${this.getId( item )}"]` );
+
+ if ( elementWithId.length ) {
+ elementWithId.remove();
+
+ this.currentItems = this.currentItems.filter( ( taxIdentifier ) => {
+ return taxIdentifier !== this.getId( item );
+ } );
+ }
+ }
+
findOrCreateTerm( termName ) {
- let self = this;
termName = super.findOrCreateTerm( termName );
- termName.then( ( item ) => self.makeItem( item ) );
+ termName.then( ( item ) => this.makeItem( item ) );
+
return termName;
}
onChange( event ) {
super.onChange( event );
- let item = this.pickItem( event );
+ const item = this.pickItem( event );
+
if ( item ) {
- if ( order_set[ this.props.slug ].indexOf( item.id ) >= 0 ) {
+ if ( orderSet[ this.props.slug ].includes( item.id ) ) {
this.makeItem( item );
- }
- else {
- let element = jQuery( '[data-item="' + item.id + '"]' );
- if ( element.length ) {
- element.remove();
- }
+ } else {
+ this.removeItem( item );
}
}
}
@@ -185,17 +211,28 @@ if ( wp.data && wp.data.select( 'core/editor' ) ) {
return this.state.availableTerms[ p ];
}
}
+ // Tags that are already registered need to be selected separately
+ // as its expected that they return back with an "id" property.
+ } else if ( Array.isArray( event ) ) {
+ // Figure out the diff between the current state and the event and determine which tag is getting removed
+ let enteredTag = this.state.selectedTerms.filter( flatItem => !event.includes( flatItem ) )[0];
+
+ if ( typeof enteredTag === 'undefined' ) {
+ // If the above returns undefined, then we presume the user is adding, so reverse the logic to figure out the new item
+ enteredTag = event.filter( flatItem => !this.state.selectedTerms.includes( flatItem ) )[0];
+ }
+
+ return this.state.availableTerms.find( ( item ) => item.name === enteredTag );
}
- }
- else if ( typeof event === 'number' ) {
+ } else if ( typeof event === 'number' ) {
for (let p in this.state.availableTerms) {
if ( this.state.availableTerms[ p ].id === event ) {
return this.state.availableTerms[ p ];
}
}
- }
- else {
+ } else {
let text;
+
// add or remove.
if ( event.length > this.state.selectedTerms.length ) {
// Added.
@@ -204,8 +241,7 @@ if ( wp.data && wp.data.select( 'core/editor' ) ) {
text = event[ o ];
}
}
- }
- else {
+ } else {
// removed.
for (let o in this.state.selectedTerms) {
if ( event.indexOf( this.state.selectedTerms[ o ] ) === -1 ) {
@@ -219,33 +255,36 @@ if ( wp.data && wp.data.select( 'core/editor' ) ) {
return this.state.availableTerms[ p ];
}
}
-
}
+ }
+ getId( item ) {
+ return `${this.props.slug}:${item.id}`
}
makeElement( item ) {
- let li = jQuery( '' ),
- input = jQuery( '' ),
- icon = jQuery( '' );
+ const li = jQuery( '' );
+ const icon = jQuery( '' );
+ const input = jQuery( '' );
+
+ li
+ .addClass( 'cld-tax-order-list-item' )
+ .attr( 'data-item', this.getId( item ) );
+
+ input
+ .addClass( 'cld-tax-order-list-item-input' )
+ .attr( 'type', 'hidden' )
+ .attr( 'name', 'cld_tax_order[]' ).val( this.getId( item ) );
- li.addClass( 'cld-tax-order-list-item' ).attr( 'data-item', item.id );
- input.addClass( 'cld-tax-order-list-item-input' ).attr( 'type', 'hidden' ).attr( 'name', 'cld_tax_order[]' ).val( item.id );
icon.addClass( 'dashicons dashicons-menu cld-tax-order-list-item-handle' );
li.append( icon ).append( item.name ).append( input ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
+
return li;
}
}
- return function( props ) {
-
- return el(
- customHandler,
- props
- );
- };
-
+ return ( props ) => el( CustomHandler, props );
};
wp.hooks.addFilter(
diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-global-transformations.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-global-transformations.php
index 086554d0b..dbf0c5df1 100644
--- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-global-transformations.php
+++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/media/class-global-transformations.php
@@ -67,13 +67,15 @@ function ( $field ) {
return ! empty( $field['contextual'] );
}
);
- $video_fields = array_filter(
+
+ $video_fields = array_filter(
$settings['pages']['global_transformation']['tabs']['global_video_transformations']['fields'],
function ( $field ) {
return ! empty( $field['contextual'] );
}
);
- $this->fields = array_merge( $image_fields, $video_fields );
+
+ $this->fields = array_merge( $image_fields, $video_fields );
$this->setup_hooks();
}
@@ -306,18 +308,19 @@ public function get_terms( $post_id ) {
if ( ! empty( $items ) ) {
$items = array_map(
function ( $item ) {
- if ( ! is_numeric( $item ) ) {
- // Get the id.
- if ( false !== strpos( $item, ':' ) ) {
- $parts = explode( ':', $item );
- $term = get_term_by( 'slug', $parts[1], $parts[0] );
- } else {
- // Something went wrong, and value was not an int and didn't contain a tax:slug string.
- return null;
- }
+ // Get the id.
+ if ( false !== strpos( $item, ':' ) ) {
+ $parts = explode( ':', $item );
+ $term = get_term_by( 'id', $parts[1], $parts[0] );
+
+ if ( ! $term ) {
+ $term = get_term_by( 'term_taxonomy_id', $parts[1], $parts[0] );
+ }
} else {
- $term = get_term( $item );
+ // Something went wrong, and value was not an int and didn't contain a tax:slug string.
+ return null;
}
+
// Return if term is valid.
if ( $term instanceof \WP_Term ) {
return array(
@@ -330,20 +333,15 @@ function ( $item ) {
},
$items
);
- $terms = array_filter(
- $items
- );
+ $terms = array_filter( $items );
} else {
$taxonomies = get_object_taxonomies( get_post_type( $post_id ) );
$current_terms = wp_get_object_terms( $post_id, $taxonomies );
if ( ! empty( $current_terms ) ) {
$terms = array_map(
function ( $term ) {
+ $value = $term->taxonomy . ':' . $term->term_id;
- $value = $term->term_id;
- if ( false === is_taxonomy_hierarchical( $term->taxonomy ) ) {
- $value = $term->taxonomy . ':' . $term->name;
- }
$item = array(
'term' => $term,
'value' => $value,
@@ -386,12 +384,13 @@ public function make_term_sort_item( $id, $name ) {
* @return string
*/
private function init_taxonomy_manager( $post ) {
+ wp_enqueue_script( 'wp-api' );
+
$out = array();
$out[] = '';
$out[] = '
';
$out[] = '- ' . esc_html__( 'No terms added', 'cloudinary' ) . '
';
$terms = $this->get_terms( $post->ID );
- // Process Terms.
if ( ! empty( $terms ) ) {
foreach ( (array) $terms as $item ) {
$out[] = $this->make_term_sort_item( $item['value'], $item['term']->name );
@@ -412,7 +411,7 @@ private function init_taxonomy_manager( $post ) {
* @param int $post_id The post ID.
*/
public function save_taxonomy_ordering( $post_id ) {
- $args = array(
+ $args = array(
'cld_tax_order' => array(
'filter' => FILTER_SANITIZE_STRING,
'flags' => FILTER_REQUIRE_ARRAY,
@@ -421,7 +420,9 @@ public function save_taxonomy_ordering( $post_id ) {
'filter' => FILTER_SANITIZE_STRING,
),
);
+
$taxonomy_order = filter_input_array( INPUT_POST, $args );
+
if ( ! empty( $taxonomy_order['cld_tax_order'] ) ) {
update_post_meta( $post_id, self::META_ORDER_KEY . '_terms', $taxonomy_order['cld_tax_order'] );
} else {
@@ -452,6 +453,6 @@ function ( $taxonomy ) use ( $global ) {
// Add ordering metaboxes.
add_action( 'add_meta_boxes', array( $this, 'taxonomy_ordering' ), 10, 2 );
- add_action( 'save_post', array( $this, 'save_taxonomy_ordering' ), 10, 4 );
+ add_action( 'save_post', array( $this, 'save_taxonomy_ordering' ), 10, 1 );
}
}