summaryrefslogtreecommitdiffstats
path: root/wp-includes/blocks/file
diff options
context:
space:
mode:
Diffstat (limited to 'wp-includes/blocks/file')
-rw-r--r--wp-includes/blocks/file/block.json78
-rw-r--r--wp-includes/blocks/file/editor-rtl.css38
-rw-r--r--wp-includes/blocks/file/editor-rtl.min.css1
-rw-r--r--wp-includes/blocks/file/editor.css38
-rw-r--r--wp-includes/blocks/file/editor.min.css1
-rw-r--r--wp-includes/blocks/file/style-rtl.css35
-rw-r--r--wp-includes/blocks/file/style-rtl.min.css1
-rw-r--r--wp-includes/blocks/file/style.css35
-rw-r--r--wp-includes/blocks/file/style.min.css1
-rw-r--r--wp-includes/blocks/file/view.asset.php1
-rw-r--r--wp-includes/blocks/file/view.js82
-rw-r--r--wp-includes/blocks/file/view.min.asset.php1
-rw-r--r--wp-includes/blocks/file/view.min.js1
13 files changed, 313 insertions, 0 deletions
diff --git a/wp-includes/blocks/file/block.json b/wp-includes/blocks/file/block.json
new file mode 100644
index 0000000..0cc20b3
--- /dev/null
+++ b/wp-includes/blocks/file/block.json
@@ -0,0 +1,78 @@
+{
+ "$schema": "https://schemas.wp.org/trunk/block.json",
+ "apiVersion": 3,
+ "name": "core/file",
+ "title": "File",
+ "category": "media",
+ "description": "Add a link to a downloadable file.",
+ "keywords": [ "document", "pdf", "download" ],
+ "textdomain": "default",
+ "attributes": {
+ "id": {
+ "type": "number"
+ },
+ "href": {
+ "type": "string"
+ },
+ "fileId": {
+ "type": "string",
+ "source": "attribute",
+ "selector": "a:not([download])",
+ "attribute": "id"
+ },
+ "fileName": {
+ "type": "string",
+ "source": "html",
+ "selector": "a:not([download])"
+ },
+ "textLinkHref": {
+ "type": "string",
+ "source": "attribute",
+ "selector": "a:not([download])",
+ "attribute": "href"
+ },
+ "textLinkTarget": {
+ "type": "string",
+ "source": "attribute",
+ "selector": "a:not([download])",
+ "attribute": "target"
+ },
+ "showDownloadButton": {
+ "type": "boolean",
+ "default": true
+ },
+ "downloadButtonText": {
+ "type": "string",
+ "source": "html",
+ "selector": "a[download]"
+ },
+ "displayPreview": {
+ "type": "boolean"
+ },
+ "previewHeight": {
+ "type": "number",
+ "default": 600
+ }
+ },
+ "supports": {
+ "anchor": true,
+ "align": true,
+ "spacing": {
+ "margin": true,
+ "padding": true
+ },
+ "color": {
+ "gradients": true,
+ "link": true,
+ "text": false,
+ "__experimentalDefaultControls": {
+ "background": true,
+ "link": true
+ }
+ },
+ "interactivity": true
+ },
+ "viewScript": "file:./view.min.js",
+ "editorStyle": "wp-block-file-editor",
+ "style": "wp-block-file"
+}
diff --git a/wp-includes/blocks/file/editor-rtl.css b/wp-includes/blocks/file/editor-rtl.css
new file mode 100644
index 0000000..a606f31
--- /dev/null
+++ b/wp-includes/blocks/file/editor-rtl.css
@@ -0,0 +1,38 @@
+.wp-block-file{
+ align-items:center;
+ display:flex;
+ flex-wrap:wrap;
+ justify-content:space-between;
+ margin-bottom:0;
+}
+.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{
+ height:auto;
+}
+.wp-block-file .components-resizable-box__container{
+ margin-bottom:1em;
+}
+.wp-block-file .wp-block-file__preview{
+ height:100%;
+ margin-bottom:1em;
+ width:100%;
+}
+.wp-block-file .wp-block-file__preview-overlay{
+ bottom:0;
+ left:0;
+ position:absolute;
+ right:0;
+ top:0;
+}
+.wp-block-file .wp-block-file__content-wrapper{
+ flex-grow:1;
+}
+.wp-block-file a{
+ min-width:1em;
+}
+.wp-block-file a:not(.wp-block-file__button){
+ display:inline-block;
+}
+.wp-block-file .wp-block-file__button-richtext-wrapper{
+ display:inline-block;
+ margin-right:.75em;
+} \ No newline at end of file
diff --git a/wp-includes/blocks/file/editor-rtl.min.css b/wp-includes/blocks/file/editor-rtl.min.css
new file mode 100644
index 0000000..cd00681
--- /dev/null
+++ b/wp-includes/blocks/file/editor-rtl.min.css
@@ -0,0 +1 @@
+.wp-block-file{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:0}.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{height:auto}.wp-block-file .components-resizable-box__container{margin-bottom:1em}.wp-block-file .wp-block-file__preview{height:100%;margin-bottom:1em;width:100%}.wp-block-file .wp-block-file__preview-overlay{bottom:0;left:0;position:absolute;right:0;top:0}.wp-block-file .wp-block-file__content-wrapper{flex-grow:1}.wp-block-file a{min-width:1em}.wp-block-file a:not(.wp-block-file__button){display:inline-block}.wp-block-file .wp-block-file__button-richtext-wrapper{display:inline-block;margin-right:.75em} \ No newline at end of file
diff --git a/wp-includes/blocks/file/editor.css b/wp-includes/blocks/file/editor.css
new file mode 100644
index 0000000..94638c0
--- /dev/null
+++ b/wp-includes/blocks/file/editor.css
@@ -0,0 +1,38 @@
+.wp-block-file{
+ align-items:center;
+ display:flex;
+ flex-wrap:wrap;
+ justify-content:space-between;
+ margin-bottom:0;
+}
+.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{
+ height:auto;
+}
+.wp-block-file .components-resizable-box__container{
+ margin-bottom:1em;
+}
+.wp-block-file .wp-block-file__preview{
+ height:100%;
+ margin-bottom:1em;
+ width:100%;
+}
+.wp-block-file .wp-block-file__preview-overlay{
+ bottom:0;
+ left:0;
+ position:absolute;
+ right:0;
+ top:0;
+}
+.wp-block-file .wp-block-file__content-wrapper{
+ flex-grow:1;
+}
+.wp-block-file a{
+ min-width:1em;
+}
+.wp-block-file a:not(.wp-block-file__button){
+ display:inline-block;
+}
+.wp-block-file .wp-block-file__button-richtext-wrapper{
+ display:inline-block;
+ margin-left:.75em;
+} \ No newline at end of file
diff --git a/wp-includes/blocks/file/editor.min.css b/wp-includes/blocks/file/editor.min.css
new file mode 100644
index 0000000..df5ac14
--- /dev/null
+++ b/wp-includes/blocks/file/editor.min.css
@@ -0,0 +1 @@
+.wp-block-file{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:0}.wp-block[data-align=left]>.wp-block-file,.wp-block[data-align=right]>.wp-block-file{height:auto}.wp-block-file .components-resizable-box__container{margin-bottom:1em}.wp-block-file .wp-block-file__preview{height:100%;margin-bottom:1em;width:100%}.wp-block-file .wp-block-file__preview-overlay{bottom:0;left:0;position:absolute;right:0;top:0}.wp-block-file .wp-block-file__content-wrapper{flex-grow:1}.wp-block-file a{min-width:1em}.wp-block-file a:not(.wp-block-file__button){display:inline-block}.wp-block-file .wp-block-file__button-richtext-wrapper{display:inline-block;margin-left:.75em} \ No newline at end of file
diff --git a/wp-includes/blocks/file/style-rtl.css b/wp-includes/blocks/file/style-rtl.css
new file mode 100644
index 0000000..6b23129
--- /dev/null
+++ b/wp-includes/blocks/file/style-rtl.css
@@ -0,0 +1,35 @@
+.wp-block-file{
+ box-sizing:border-box;
+}
+.wp-block-file:not(.wp-element-button){
+ font-size:.8em;
+}
+.wp-block-file.aligncenter{
+ text-align:center;
+}
+.wp-block-file.alignright{
+ text-align:right;
+}
+.wp-block-file *+.wp-block-file__button{
+ margin-right:.75em;
+}
+
+:where(.wp-block-file){
+ margin-bottom:1.5em;
+}
+
+.wp-block-file__embed{
+ margin-bottom:1em;
+}
+
+:where(.wp-block-file__button){
+ border-radius:2em;
+ display:inline-block;
+ padding:.5em 1em;
+}
+:where(.wp-block-file__button):is(a):active,:where(.wp-block-file__button):is(a):focus,:where(.wp-block-file__button):is(a):hover,:where(.wp-block-file__button):is(a):visited{
+ box-shadow:none;
+ color:#fff;
+ opacity:.85;
+ text-decoration:none;
+} \ No newline at end of file
diff --git a/wp-includes/blocks/file/style-rtl.min.css b/wp-includes/blocks/file/style-rtl.min.css
new file mode 100644
index 0000000..c2b5651
--- /dev/null
+++ b/wp-includes/blocks/file/style-rtl.min.css
@@ -0,0 +1 @@
+.wp-block-file{box-sizing:border-box}.wp-block-file:not(.wp-element-button){font-size:.8em}.wp-block-file.aligncenter{text-align:center}.wp-block-file.alignright{text-align:right}.wp-block-file *+.wp-block-file__button{margin-right:.75em}:where(.wp-block-file){margin-bottom:1.5em}.wp-block-file__embed{margin-bottom:1em}:where(.wp-block-file__button){border-radius:2em;display:inline-block;padding:.5em 1em}:where(.wp-block-file__button):is(a):active,:where(.wp-block-file__button):is(a):focus,:where(.wp-block-file__button):is(a):hover,:where(.wp-block-file__button):is(a):visited{box-shadow:none;color:#fff;opacity:.85;text-decoration:none} \ No newline at end of file
diff --git a/wp-includes/blocks/file/style.css b/wp-includes/blocks/file/style.css
new file mode 100644
index 0000000..2a00211
--- /dev/null
+++ b/wp-includes/blocks/file/style.css
@@ -0,0 +1,35 @@
+.wp-block-file{
+ box-sizing:border-box;
+}
+.wp-block-file:not(.wp-element-button){
+ font-size:.8em;
+}
+.wp-block-file.aligncenter{
+ text-align:center;
+}
+.wp-block-file.alignright{
+ text-align:right;
+}
+.wp-block-file *+.wp-block-file__button{
+ margin-left:.75em;
+}
+
+:where(.wp-block-file){
+ margin-bottom:1.5em;
+}
+
+.wp-block-file__embed{
+ margin-bottom:1em;
+}
+
+:where(.wp-block-file__button){
+ border-radius:2em;
+ display:inline-block;
+ padding:.5em 1em;
+}
+:where(.wp-block-file__button):is(a):active,:where(.wp-block-file__button):is(a):focus,:where(.wp-block-file__button):is(a):hover,:where(.wp-block-file__button):is(a):visited{
+ box-shadow:none;
+ color:#fff;
+ opacity:.85;
+ text-decoration:none;
+} \ No newline at end of file
diff --git a/wp-includes/blocks/file/style.min.css b/wp-includes/blocks/file/style.min.css
new file mode 100644
index 0000000..aa2fe3d
--- /dev/null
+++ b/wp-includes/blocks/file/style.min.css
@@ -0,0 +1 @@
+.wp-block-file{box-sizing:border-box}.wp-block-file:not(.wp-element-button){font-size:.8em}.wp-block-file.aligncenter{text-align:center}.wp-block-file.alignright{text-align:right}.wp-block-file *+.wp-block-file__button{margin-left:.75em}:where(.wp-block-file){margin-bottom:1.5em}.wp-block-file__embed{margin-bottom:1em}:where(.wp-block-file__button){border-radius:2em;display:inline-block;padding:.5em 1em}:where(.wp-block-file__button):is(a):active,:where(.wp-block-file__button):is(a):focus,:where(.wp-block-file__button):is(a):hover,:where(.wp-block-file__button):is(a):visited{box-shadow:none;color:#fff;opacity:.85;text-decoration:none} \ No newline at end of file
diff --git a/wp-includes/blocks/file/view.asset.php b/wp-includes/blocks/file/view.asset.php
new file mode 100644
index 0000000..a9c9136
--- /dev/null
+++ b/wp-includes/blocks/file/view.asset.php
@@ -0,0 +1 @@
+<?php return array('dependencies' => array(), 'version' => '3fd0154de23a0ecc28af');
diff --git a/wp-includes/blocks/file/view.js b/wp-includes/blocks/file/view.js
new file mode 100644
index 0000000..9d66df5
--- /dev/null
+++ b/wp-includes/blocks/file/view.js
@@ -0,0 +1,82 @@
+"use strict";
+(self["__WordPressPrivateInteractivityAPI__"] = self["__WordPressPrivateInteractivityAPI__"] || []).push([[81],{
+
+/***/ 149:
+/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
+
+
+// EXTERNAL MODULE: ./node_modules/@wordpress/interactivity/src/index.js + 15 modules
+var src = __webpack_require__(754);
+;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/utils/index.js
+/**
+ * Uses a combination of user agent matching and feature detection to determine whether
+ * the current browser supports rendering PDFs inline.
+ *
+ * @return {boolean} Whether or not the browser supports inline PDFs.
+ */
+const browserSupportsPdfs = () => {
+ // Most mobile devices include "Mobi" in their UA.
+ if (window.navigator.userAgent.indexOf('Mobi') > -1) {
+ return false;
+ }
+
+ // Android tablets are the noteable exception.
+ if (window.navigator.userAgent.indexOf('Android') > -1) {
+ return false;
+ }
+
+ // iPad pretends to be a Mac.
+ if (window.navigator.userAgent.indexOf('Macintosh') > -1 && window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2) {
+ return false;
+ }
+
+ // IE only supports PDFs when there's an ActiveX object available for it.
+ if (!!(window.ActiveXObject || 'ActiveXObject' in window) && !(createActiveXObject('AcroPDF.PDF') || createActiveXObject('PDF.PdfCtrl'))) {
+ return false;
+ }
+ return true;
+};
+
+/**
+ * Helper function for creating ActiveX objects, catching any errors that are thrown
+ * when it's generated.
+ *
+ * @param {string} type The name of the ActiveX object to create.
+ * @return {window.ActiveXObject|undefined} The generated ActiveXObject, or null if it failed.
+ */
+const createActiveXObject = type => {
+ let ax;
+ try {
+ ax = new window.ActiveXObject(type);
+ } catch (e) {
+ ax = undefined;
+ }
+ return ax;
+};
+;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/view.js
+/**
+ * WordPress dependencies
+ */
+
+/**
+ * Internal dependencies
+ */
+
+(0,src/* store */.h)({
+ selectors: {
+ core: {
+ file: {
+ hasPdfPreview: browserSupportsPdfs
+ }
+ }
+ }
+});
+
+/***/ })
+
+},
+/******/ function(__webpack_require__) { // webpackRuntimeModules
+/******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
+/******/ var __webpack_exports__ = (__webpack_exec__(149));
+/******/ }
+]); \ No newline at end of file
diff --git a/wp-includes/blocks/file/view.min.asset.php b/wp-includes/blocks/file/view.min.asset.php
new file mode 100644
index 0000000..990e381
--- /dev/null
+++ b/wp-includes/blocks/file/view.min.asset.php
@@ -0,0 +1 @@
+<?php return array('dependencies' => array(), 'version' => '8a0237493a27c0d781aa');
diff --git a/wp-includes/blocks/file/view.min.js b/wp-includes/blocks/file/view.min.js
new file mode 100644
index 0000000..8015cb7
--- /dev/null
+++ b/wp-includes/blocks/file/view.min.js
@@ -0,0 +1 @@
+"use strict";(self.__WordPressPrivateInteractivityAPI__=self.__WordPressPrivateInteractivityAPI__||[]).push([[81],{149:function(i,t,e){var n=e(754);const o=i=>{let t;try{t=new window.ActiveXObject(i)}catch(i){t=void 0}return t};(0,n.h)({selectors:{core:{file:{hasPdfPreview:()=>!(window.navigator.userAgent.indexOf("Mobi")>-1)&&(!(window.navigator.userAgent.indexOf("Android")>-1)&&(!(window.navigator.userAgent.indexOf("Macintosh")>-1&&window.navigator.maxTouchPoints&&window.navigator.maxTouchPoints>2)&&!((window.ActiveXObject||"ActiveXObject"in window)&&!o("AcroPDF.PDF")&&!o("PDF.PdfCtrl"))))}}}})}},function(i){var t;t=149,i(i.s=t)}]); \ No newline at end of file