first commit
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2,
|
||||
"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
|
||||
},
|
||||
"viewScript": "file:./view.min.js",
|
||||
"editorStyle": "wp-block-file-editor",
|
||||
"style": "wp-block-file"
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/**
|
||||
* Colors
|
||||
*/
|
||||
/**
|
||||
* Breakpoints & Media Queries
|
||||
*/
|
||||
/**
|
||||
* SCSS Variables.
|
||||
*
|
||||
* Please use variables from this sheet to ensure consistency across the UI.
|
||||
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
||||
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
||||
*/
|
||||
/**
|
||||
* Colors
|
||||
*/
|
||||
/**
|
||||
* Fonts & basic variables.
|
||||
*/
|
||||
/**
|
||||
* Grid System.
|
||||
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
||||
*/
|
||||
/**
|
||||
* Dimensions.
|
||||
*/
|
||||
/**
|
||||
* Shadows.
|
||||
*/
|
||||
/**
|
||||
* Editor widths.
|
||||
*/
|
||||
/**
|
||||
* Block & Editor UI.
|
||||
*/
|
||||
/**
|
||||
* Block paddings.
|
||||
*/
|
||||
/**
|
||||
* React Native specific.
|
||||
* These variables do not appear to be used anywhere else.
|
||||
*/
|
||||
/**
|
||||
* Converts a hex value into the rgb equivalent.
|
||||
*
|
||||
* @param {string} hex - the hexadecimal value to convert
|
||||
* @return {string} comma separated rgb values
|
||||
*/
|
||||
/**
|
||||
* Breakpoint mixins
|
||||
*/
|
||||
/**
|
||||
* Long content fade mixin
|
||||
*
|
||||
* Creates a fading overlay to signify that the content is longer
|
||||
* than the space allows.
|
||||
*/
|
||||
/**
|
||||
* Focus styles.
|
||||
*/
|
||||
/**
|
||||
* Applies editor left position to the selector passed as argument
|
||||
*/
|
||||
/**
|
||||
* Styles that are reused verbatim in a few places
|
||||
*/
|
||||
/**
|
||||
* Allows users to opt-out of animations via OS-level preferences.
|
||||
*/
|
||||
/**
|
||||
* Reset default styles for JavaScript UI based pages.
|
||||
* This is a WP-admin agnostic reset
|
||||
*/
|
||||
/**
|
||||
* Reset the WP Admin page styles for Gutenberg-like pages.
|
||||
*/
|
||||
.wp-block-file {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
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 {
|
||||
margin-bottom: 1em;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.wp-block-file .wp-block-file__preview-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
.wp-block-file .wp-block-file__content-wrapper {
|
||||
flex-grow: 1;
|
||||
}
|
||||
.wp-block-file a {
|
||||
min-width: 1em;
|
||||
}
|
||||
.wp-block-file .wp-block-file__button-richtext-wrapper {
|
||||
display: inline-block;
|
||||
margin-right: 0.75em;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
.wp-block-file{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;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{margin-bottom:1em;width:100%;height:100%}.wp-block-file .wp-block-file__preview-overlay{position:absolute;top:0;left:0;bottom:0;right:0}.wp-block-file .wp-block-file__content-wrapper{flex-grow:1}.wp-block-file a{min-width:1em}.wp-block-file .wp-block-file__button-richtext-wrapper{display:inline-block;margin-right:.75em}
|
||||
@@ -0,0 +1,111 @@
|
||||
/**
|
||||
* Colors
|
||||
*/
|
||||
/**
|
||||
* Breakpoints & Media Queries
|
||||
*/
|
||||
/**
|
||||
* SCSS Variables.
|
||||
*
|
||||
* Please use variables from this sheet to ensure consistency across the UI.
|
||||
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
||||
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
||||
*/
|
||||
/**
|
||||
* Colors
|
||||
*/
|
||||
/**
|
||||
* Fonts & basic variables.
|
||||
*/
|
||||
/**
|
||||
* Grid System.
|
||||
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
||||
*/
|
||||
/**
|
||||
* Dimensions.
|
||||
*/
|
||||
/**
|
||||
* Shadows.
|
||||
*/
|
||||
/**
|
||||
* Editor widths.
|
||||
*/
|
||||
/**
|
||||
* Block & Editor UI.
|
||||
*/
|
||||
/**
|
||||
* Block paddings.
|
||||
*/
|
||||
/**
|
||||
* React Native specific.
|
||||
* These variables do not appear to be used anywhere else.
|
||||
*/
|
||||
/**
|
||||
* Converts a hex value into the rgb equivalent.
|
||||
*
|
||||
* @param {string} hex - the hexadecimal value to convert
|
||||
* @return {string} comma separated rgb values
|
||||
*/
|
||||
/**
|
||||
* Breakpoint mixins
|
||||
*/
|
||||
/**
|
||||
* Long content fade mixin
|
||||
*
|
||||
* Creates a fading overlay to signify that the content is longer
|
||||
* than the space allows.
|
||||
*/
|
||||
/**
|
||||
* Focus styles.
|
||||
*/
|
||||
/**
|
||||
* Applies editor left position to the selector passed as argument
|
||||
*/
|
||||
/**
|
||||
* Styles that are reused verbatim in a few places
|
||||
*/
|
||||
/**
|
||||
* Allows users to opt-out of animations via OS-level preferences.
|
||||
*/
|
||||
/**
|
||||
* Reset default styles for JavaScript UI based pages.
|
||||
* This is a WP-admin agnostic reset
|
||||
*/
|
||||
/**
|
||||
* Reset the WP Admin page styles for Gutenberg-like pages.
|
||||
*/
|
||||
.wp-block-file {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
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 {
|
||||
margin-bottom: 1em;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.wp-block-file .wp-block-file__preview-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
.wp-block-file .wp-block-file__content-wrapper {
|
||||
flex-grow: 1;
|
||||
}
|
||||
.wp-block-file a {
|
||||
min-width: 1em;
|
||||
}
|
||||
.wp-block-file .wp-block-file__button-richtext-wrapper {
|
||||
display: inline-block;
|
||||
margin-left: 0.75em;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
.wp-block-file{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;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{margin-bottom:1em;width:100%;height:100%}.wp-block-file .wp-block-file__preview-overlay{position:absolute;top:0;right:0;bottom:0;left:0}.wp-block-file .wp-block-file__content-wrapper{flex-grow:1}.wp-block-file a{min-width:1em}.wp-block-file .wp-block-file__button-richtext-wrapper{display:inline-block;margin-left:.75em}
|
||||
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* Colors
|
||||
*/
|
||||
/**
|
||||
* Breakpoints & Media Queries
|
||||
*/
|
||||
/**
|
||||
* SCSS Variables.
|
||||
*
|
||||
* Please use variables from this sheet to ensure consistency across the UI.
|
||||
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
||||
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
||||
*/
|
||||
/**
|
||||
* Colors
|
||||
*/
|
||||
/**
|
||||
* Fonts & basic variables.
|
||||
*/
|
||||
/**
|
||||
* Grid System.
|
||||
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
||||
*/
|
||||
/**
|
||||
* Dimensions.
|
||||
*/
|
||||
/**
|
||||
* Shadows.
|
||||
*/
|
||||
/**
|
||||
* Editor widths.
|
||||
*/
|
||||
/**
|
||||
* Block & Editor UI.
|
||||
*/
|
||||
/**
|
||||
* Block paddings.
|
||||
*/
|
||||
/**
|
||||
* React Native specific.
|
||||
* These variables do not appear to be used anywhere else.
|
||||
*/
|
||||
/**
|
||||
* Converts a hex value into the rgb equivalent.
|
||||
*
|
||||
* @param {string} hex - the hexadecimal value to convert
|
||||
* @return {string} comma separated rgb values
|
||||
*/
|
||||
/**
|
||||
* Breakpoint mixins
|
||||
*/
|
||||
/**
|
||||
* Long content fade mixin
|
||||
*
|
||||
* Creates a fading overlay to signify that the content is longer
|
||||
* than the space allows.
|
||||
*/
|
||||
/**
|
||||
* Focus styles.
|
||||
*/
|
||||
/**
|
||||
* Applies editor left position to the selector passed as argument
|
||||
*/
|
||||
/**
|
||||
* Styles that are reused verbatim in a few places
|
||||
*/
|
||||
/**
|
||||
* Allows users to opt-out of animations via OS-level preferences.
|
||||
*/
|
||||
/**
|
||||
* Reset default styles for JavaScript UI based pages.
|
||||
* This is a WP-admin agnostic reset
|
||||
*/
|
||||
/**
|
||||
* Reset the WP Admin page styles for Gutenberg-like pages.
|
||||
*/
|
||||
.wp-block-file {
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
.wp-block-file:not(.wp-element-button) {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.wp-block-file.aligncenter {
|
||||
text-align: center;
|
||||
}
|
||||
.wp-block-file.alignright {
|
||||
text-align: right;
|
||||
}
|
||||
.wp-block-file * + .wp-block-file__button {
|
||||
margin-right: 0.75em;
|
||||
}
|
||||
|
||||
.wp-block-file__embed {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
:where(.wp-block-file__button) {
|
||||
border-radius: 2em;
|
||||
padding: 0.5em 1em;
|
||||
}
|
||||
:where(.wp-block-file__button):is(a):hover, :where(.wp-block-file__button):is(a):visited, :where(.wp-block-file__button):is(a):focus, :where(.wp-block-file__button):is(a):active {
|
||||
box-shadow: none;
|
||||
color: #fff;
|
||||
opacity: 0.85;
|
||||
text-decoration: none;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
.wp-block-file{margin-bottom:1.5em}.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}.wp-block-file__embed{margin-bottom:1em}:where(.wp-block-file__button){border-radius:2em;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}
|
||||
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* Colors
|
||||
*/
|
||||
/**
|
||||
* Breakpoints & Media Queries
|
||||
*/
|
||||
/**
|
||||
* SCSS Variables.
|
||||
*
|
||||
* Please use variables from this sheet to ensure consistency across the UI.
|
||||
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
||||
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
||||
*/
|
||||
/**
|
||||
* Colors
|
||||
*/
|
||||
/**
|
||||
* Fonts & basic variables.
|
||||
*/
|
||||
/**
|
||||
* Grid System.
|
||||
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
||||
*/
|
||||
/**
|
||||
* Dimensions.
|
||||
*/
|
||||
/**
|
||||
* Shadows.
|
||||
*/
|
||||
/**
|
||||
* Editor widths.
|
||||
*/
|
||||
/**
|
||||
* Block & Editor UI.
|
||||
*/
|
||||
/**
|
||||
* Block paddings.
|
||||
*/
|
||||
/**
|
||||
* React Native specific.
|
||||
* These variables do not appear to be used anywhere else.
|
||||
*/
|
||||
/**
|
||||
* Converts a hex value into the rgb equivalent.
|
||||
*
|
||||
* @param {string} hex - the hexadecimal value to convert
|
||||
* @return {string} comma separated rgb values
|
||||
*/
|
||||
/**
|
||||
* Breakpoint mixins
|
||||
*/
|
||||
/**
|
||||
* Long content fade mixin
|
||||
*
|
||||
* Creates a fading overlay to signify that the content is longer
|
||||
* than the space allows.
|
||||
*/
|
||||
/**
|
||||
* Focus styles.
|
||||
*/
|
||||
/**
|
||||
* Applies editor left position to the selector passed as argument
|
||||
*/
|
||||
/**
|
||||
* Styles that are reused verbatim in a few places
|
||||
*/
|
||||
/**
|
||||
* Allows users to opt-out of animations via OS-level preferences.
|
||||
*/
|
||||
/**
|
||||
* Reset default styles for JavaScript UI based pages.
|
||||
* This is a WP-admin agnostic reset
|
||||
*/
|
||||
/**
|
||||
* Reset the WP Admin page styles for Gutenberg-like pages.
|
||||
*/
|
||||
.wp-block-file {
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
.wp-block-file:not(.wp-element-button) {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.wp-block-file.aligncenter {
|
||||
text-align: center;
|
||||
}
|
||||
.wp-block-file.alignright {
|
||||
/*rtl:ignore*/
|
||||
text-align: right;
|
||||
}
|
||||
.wp-block-file * + .wp-block-file__button {
|
||||
margin-left: 0.75em;
|
||||
}
|
||||
|
||||
.wp-block-file__embed {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
:where(.wp-block-file__button) {
|
||||
border-radius: 2em;
|
||||
padding: 0.5em 1em;
|
||||
}
|
||||
:where(.wp-block-file__button):is(a):hover, :where(.wp-block-file__button):is(a):visited, :where(.wp-block-file__button):is(a):focus, :where(.wp-block-file__button):is(a):active {
|
||||
box-shadow: none;
|
||||
color: #fff;
|
||||
opacity: 0.85;
|
||||
text-decoration: none;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
.wp-block-file{margin-bottom:1.5em}.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}.wp-block-file__embed{margin-bottom:1em}:where(.wp-block-file__button){border-radius:2em;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}
|
||||
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '30e42a0eeaa76bba673e');
|
||||
@@ -0,0 +1,77 @@
|
||||
/******/ (function() { // webpackBootstrap
|
||||
/******/ "use strict";
|
||||
var __webpack_exports__ = {};
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/utils.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;
|
||||
};
|
||||
/**
|
||||
* Hides all .wp-block-file__embed elements on the document. This function is only intended
|
||||
* to be run on the front-end, it may have weird side effects running in the block editor.
|
||||
*/
|
||||
|
||||
|
||||
const hidePdfEmbedsOnUnsupportedBrowsers = () => {
|
||||
if (!browserSupportsPdfs()) {
|
||||
const embeds = document.getElementsByClassName('wp-block-file__embed');
|
||||
Array.from(embeds).forEach(embed => {
|
||||
embed.style.display = 'none';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/view.js
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
hidePdfEmbedsOnUnsupportedBrowsers();
|
||||
|
||||
/******/ })()
|
||||
;
|
||||
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '2a20786ca914ea00891f');
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(){"use strict";const n=n=>{let i;try{i=new window.ActiveXObject(n)}catch(n){i=void 0}return i};(()=>{if(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)&&!n("AcroPDF.PDF")&&!n("PDF.PdfCtrl")){const n=document.getElementsByClassName("wp-block-file__embed");Array.from(n).forEach((n=>{n.style.display="none"}))}})()}();
|
||||
Reference in New Issue
Block a user