Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

happy new year, happy new versions #13

Merged
merged 3 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions wp-content/plugins/gutenberg/build/blob/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ createBlobURL: function() { return /* binding */ createBlobURL; },
/* harmony export */ downloadBlob: function() { return /* binding */ downloadBlob; },
/* harmony export */ getBlobByURL: function() { return /* binding */ getBlobByURL; },
/* harmony export */ getBlobTypeByURL: function() { return /* binding */ getBlobTypeByURL; },
/* harmony export */ isBlobURL: function() { return /* binding */ isBlobURL; },
Expand Down Expand Up @@ -112,6 +113,47 @@ function isBlobURL(url) {
return url.indexOf('blob:') === 0;
}

/**
* Downloads a file, e.g., a text or readable stream, in the browser.
* Appropriate for downloading smaller file sizes, e.g., < 5 MB.
*
* Example usage:
*
* ```js
* const fileContent = JSON.stringify(
* {
* "title": "My Post",
* },
* null,
* 2
* );
* const filename = 'file.json';
*
* downloadBlob( filename, fileContent, 'application/json' );
* ```
*
* @param {string} filename File name.
* @param {BlobPart} content File content (BufferSource | Blob | string).
* @param {string} contentType (Optional) File mime type. Default is `''`.
*/
function downloadBlob(filename, content, contentType = '') {
if (!filename || !content) {
return;
}
const file = new window.Blob([content], {
type: contentType
});
const url = window.URL.createObjectURL(file);
const anchorElement = document.createElement('a');
anchorElement.href = url;
anchorElement.download = filename;
anchorElement.style.display = 'none';
document.body.appendChild(anchorElement);
anchorElement.click();
document.body.removeChild(anchorElement);
window.URL.revokeObjectURL(url);
}

(window.wp = window.wp || {}).blob = __webpack_exports__;
/******/ })()
;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '84bd953bdd6902859500');
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '3729539b9aa02452b5c1');
2 changes: 1 addition & 1 deletion wp-content/plugins/gutenberg/build/blob/index.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wp-content/plugins/gutenberg/build/blob/index.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Loading