Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 25862c4b1c | |||
| a61510f136 | |||
| 0d3ae8f03e | |||
| b58ef27f1e |
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{{> (include_partial "layouts/partials/head") }}
|
{{> (include_partial "layouts/partials/head") }}
|
||||||
|
|
||||||
<body>
|
<body class="{{#if iframeMode}}body--iframe{{/if}}">
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
{{> (include_block_template) }}
|
{{> (include_block_template) }}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{{> (include_partial "layouts/partials/head") }}
|
{{> (include_partial "layouts/partials/head") }}
|
||||||
|
|
||||||
<body>
|
<body class="{{#if iframeMode}}body--iframe{{/if}}">
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="preview">
|
<div class="preview">
|
||||||
<iframe id="preview_frame" src="{{ previewFrameUrl }}" class="breakpoint"></iframe>
|
<iframe id="preview_frame" src="{{ previewFrameUrl }}?iframe=true" class="breakpoint"></iframe>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/scripts/dist/index.min.js"></script>
|
<script src="/scripts/dist/index.min.js"></script>
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,5 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// Blocks Initialization.
|
||||||
|
function initBlock(blockName = '', selector = '', cb) {
|
||||||
|
document.querySelectorAll(selector).forEach((el) => cb(el));
|
||||||
|
}
|
||||||
|
|
||||||
// Scrollbars / Frame resizes notifications.
|
// Scrollbars / Frame resizes notifications.
|
||||||
(function () {
|
(function () {
|
||||||
let height;
|
let height;
|
||||||
|
|||||||
@@ -98,7 +98,12 @@ function DataOptions(props = {}) {
|
|||||||
|
|
||||||
async function changeDataOption(e) {
|
async function changeDataOption(e) {
|
||||||
const dataName = e.target.value;
|
const dataName = e.target.value;
|
||||||
props.rootAttributes.previewFrame.src = window.devTool.previewFrameUrl + '?data=' + dataName;
|
|
||||||
|
const previewFrameUrl = new URL(window.devTool.previewFrameUrl);
|
||||||
|
previewFrameUrl.searchParams.set('data', dataName);
|
||||||
|
previewFrameUrl.searchParams.set('iframe', 'true');
|
||||||
|
|
||||||
|
props.rootAttributes.previewFrame.src = previewFrameUrl.href;
|
||||||
|
|
||||||
const dataOption = await fetchDataOptions(dataName);
|
const dataOption = await fetchDataOptions(dataName);
|
||||||
updateState(Object.assign({}, dataOption, {dataName}));
|
updateState(Object.assign({}, dataOption, {dataName}));
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
{{> (include_partial "layouts/partials/head") }}
|
||||||
|
|
||||||
|
<body class="{{#if iframeMode}}body--iframe{{/if}}">
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<section class="fullscreen_layout"></section>
|
||||||
|
{{> (include_block_template) }}
|
||||||
|
<section class="fullscreen_layout"></section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
{{> (include_partial "layouts/partials/scripts") }}
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
.swiper {
|
||||||
|
&-slide {
|
||||||
|
width: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-wrapper {
|
||||||
|
height: initial;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,32 @@
|
|||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
overflow-y: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
min-height: 100%;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
main .swiper-slide {
|
||||||
|
width: initial;
|
||||||
|
}
|
||||||
|
main .swiper-wrapper {
|
||||||
|
height: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body--iframe {
|
||||||
|
overflow-y: hidden;
|
||||||
|
}
|
||||||
|
.body--iframe main {
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fullscreen_layout {
|
||||||
|
background-color: #9cc3ff;
|
||||||
|
min-height: 100%;
|
||||||
|
background-image: url("https://i.ibb.co/pjwL8D1/shapelined-JBKdviwe-XI-unsplash.jpg");
|
||||||
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*# sourceMappingURL=page--view.css.map */
|
/*# sourceMappingURL=page--view.css.map */
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"sourceRoot":"","sources":["page--view.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;;AAGF;EACE;EACA","file":"page--view.css"}
|
{"version":3,"sourceRoot":"","sources":["page--view.scss","_page--view-swiper.scss"],"names":[],"mappings":"AAAA;EACE;;;AAGF;EACE;EACA;EACA;EACA;;ACPA;EACE;;AAGF;EACE;;;ADSJ;EACE;;AAEA;EAGE;;;AAIJ;EACE;EACA;EACA;EACA","file":"page--view.css"}
|
||||||
@@ -1,18 +1,32 @@
|
|||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
overflow-y: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
min-height: 100%;
|
||||||
|
overflow-x: hidden;
|
||||||
|
|
||||||
|
// Fixes scrolling issues of swiperJS. Should be included in all projects.
|
||||||
|
@import "page--view-swiper";
|
||||||
|
}
|
||||||
|
|
||||||
|
// iFrame mode
|
||||||
|
.body--iframe {
|
||||||
|
overflow-y: hidden;
|
||||||
|
|
||||||
|
main {
|
||||||
|
// If you change to "overflow: initial", the margin-top/bottom of first/last element will be not included.
|
||||||
|
// Test on fresh block setup where heading has margin-top.
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fullscreen_layout {
|
||||||
|
background-color: #9cc3ff;
|
||||||
|
min-height: 100%;
|
||||||
|
background-image: url('https://i.ibb.co/pjwL8D1/shapelined-JBKdviwe-XI-unsplash.jpg');
|
||||||
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Container rules must be provided by the projectStyles (theme).
|
|
||||||
//.container {
|
|
||||||
// max-width: 1200px;
|
|
||||||
// margin-left: auto;
|
|
||||||
// margin-right: auto;
|
|
||||||
// padding-left: 15px;
|
|
||||||
// padding-right: 15px;
|
|
||||||
//}
|
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@axe-web/block-dev-tool",
|
"name": "@axe-web/block-dev-tool",
|
||||||
"version": "1.0.21",
|
"version": "1.0.22",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@axe-web/block-dev-tool",
|
"name": "@axe-web/block-dev-tool",
|
||||||
"version": "1.0.21",
|
"version": "1.0.22",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@braintree/sanitize-url": "^6.0.0",
|
"@braintree/sanitize-url": "^6.0.0",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@axe-web/block-dev-tool",
|
"name": "@axe-web/block-dev-tool",
|
||||||
"version": "1.0.21",
|
"version": "1.0.22",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "AXE-WEB",
|
"name": "AXE-WEB",
|
||||||
"email": "office@axe-web.com",
|
"email": "office@axe-web.com",
|
||||||
|
|||||||
@@ -2,18 +2,16 @@
|
|||||||
|
|
||||||
namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>;
|
namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>;
|
||||||
|
|
||||||
include_once __DIR__ . "/helpers/<%= blockClassModel %>_Defaults.php";
|
|
||||||
include_once __DIR__ . "/helpers/<%= blockClassModel %>_API.php";
|
|
||||||
|
|
||||||
class <%= blockClassModel %>_Component extends \Core\Component {
|
class <%= blockClassModel %>_Component extends \Core\Component {
|
||||||
|
|
||||||
public function get_content( $args = [] ): string {
|
public function get_content( $args = [] ): string {
|
||||||
$args = array_merge( Helpers\<%= blockClassModel %>_Defaults::default_args(), $args );
|
$default_args = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::default_args', [] ); // Not really practical.
|
||||||
$args = Helpers\<%= blockClassModel %>_API::prepare_args( $args );
|
|
||||||
|
|
||||||
$output = ( include( __DIR__ . '/templates/<%= blockFilename %>.template.php' ) )( array_merge( [], $args ), self::class );
|
$args = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::prepare_args', array_merge( $default_args, $args ) );
|
||||||
//return apply_filters( 'the_content', $output );
|
|
||||||
return $output;
|
$output = ( include( __DIR__ . '/templates/<%= blockFilename %>.template.php' ) )( $args, self::class );
|
||||||
|
|
||||||
|
return apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::content', $output );
|
||||||
}
|
}
|
||||||
|
|
||||||
<% if (!include_acf_block && !include_native_gutenberg_block) { %>function register_assets(): void {
|
<% if (!include_acf_block && !include_native_gutenberg_block) { %>function register_assets(): void {
|
||||||
@@ -37,21 +35,17 @@ class <%= blockClassModel %>_Component extends \Core\Component {
|
|||||||
|
|
||||||
<% } %><% if (include_acf_block) { %> function register_acf_block() {
|
<% } %><% if (include_acf_block) { %> function register_acf_block() {
|
||||||
$this->register_block( __DIR__ . "/<%= blockFilename %>.block.json", [
|
$this->register_block( __DIR__ . "/<%= blockFilename %>.block.json", [
|
||||||
'enqueue_assets' => function () {
|
'style_assets' => [
|
||||||
wp_enqueue_style( 'block-<%= blockFilename %>', plugins_url( 'templates/styles/<%= blockFilename %>.min.css', __FILE__ ), ['assets-style'], get_blocks_version() );<% if (include_script) { %>
|
[
|
||||||
wp_enqueue_script( 'block-<%= blockFilename %>', plugins_url( 'templates/scripts/<%= blockFilename %>.min.js', __FILE__ ), ['assets-script'], get_blocks_version(), true );<% } %>
|
'name' => '<%= blockFilename %>',
|
||||||
},
|
'url' => plugins_url( 'templates/styles/<%= blockFilename %>.min.css', __FILE__ ),
|
||||||
'default' => Helpers\<%= blockClassModel %>_Defaults::default_args(),
|
]
|
||||||
'supports' => [
|
|
||||||
//'jsx' => true,
|
|
||||||
'color' => [
|
|
||||||
'background' => true,
|
|
||||||
'text' => true,
|
|
||||||
],
|
|
||||||
'spacing' => [
|
|
||||||
'margin' => [ 'top', 'bottom' ],
|
|
||||||
'padding' => [ 'top', 'bottom' ]
|
|
||||||
],
|
],
|
||||||
|
'script_assets' => [
|
||||||
|
[
|
||||||
|
'name' => '<%= blockFilename %>',
|
||||||
|
'url' => plugins_url( 'templates/scripts/<%= blockFilename %>.min.js', __FILE__ ),
|
||||||
|
]
|
||||||
]
|
]
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,13 +67,13 @@ export async function buildWordPress(blockName, isBlock = false, isElementor = f
|
|||||||
json: await readJSONFile(path.join(projectPath, 'data', 'default.json'), "utf8"),
|
json: await readJSONFile(path.join(projectPath, 'data', 'default.json'), "utf8"),
|
||||||
});
|
});
|
||||||
|
|
||||||
await createFiles(Object.assign({}, data, {defaultData: phpDataObject}), [{
|
// await createFiles(Object.assign({}, data, {defaultData: phpDataObject}), [{
|
||||||
from: `templates/helpers/Template_Defaults.php`,
|
// from: `templates/helpers/Template_Defaults.php`,
|
||||||
to: `helpers/${data.blockClassModel}_Defaults.php`,
|
// to: `helpers/${data.blockClassModel}_Defaults.php`,
|
||||||
}], {
|
// }], {
|
||||||
pathDist: distPath,
|
// pathDist: distPath,
|
||||||
generatorsPath: path.join(__dirname),
|
// generatorsPath: path.join(__dirname),
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (isElementor) {
|
if (isElementor) {
|
||||||
await createFiles(data, [{
|
await createFiles(data, [{
|
||||||
@@ -94,13 +94,13 @@ export async function buildWordPress(blockName, isBlock = false, isElementor = f
|
|||||||
generatorsPath: path.join(__dirname)
|
generatorsPath: path.join(__dirname)
|
||||||
});
|
});
|
||||||
|
|
||||||
await createFiles(data, [{
|
// await createFiles(data, [{
|
||||||
from: `templates/helpers/Template_API.php`,
|
// from: `templates/helpers/Template_API.php`,
|
||||||
to: `helpers/${data.blockClassModel}_API.php`,
|
// to: `helpers/${data.blockClassModel}_API.php`,
|
||||||
}], {
|
// }], {
|
||||||
pathDist: distPath,
|
// pathDist: distPath,
|
||||||
generatorsPath: path.join(__dirname)
|
// generatorsPath: path.join(__dirname)
|
||||||
});
|
// });
|
||||||
} else {
|
} else {
|
||||||
await createFiles(data, [{
|
await createFiles(data, [{
|
||||||
from: `templates/Template_Basic_Component.php`,
|
from: `templates/Template_Basic_Component.php`,
|
||||||
|
|||||||
@@ -97,7 +97,11 @@ app.get('/view/:baseView', async (req, res) => {
|
|||||||
include_partial: (filesPath) => handlebarLayoutsPath(modulesPath, filesPath),
|
include_partial: (filesPath) => handlebarLayoutsPath(modulesPath, filesPath),
|
||||||
include_block_template: () => handlebarLayoutsPath(projectPath, 'src', `${blockName}.template`),
|
include_block_template: () => handlebarLayoutsPath(projectPath, 'src', `${blockName}.template`),
|
||||||
section_class: `${blockName}--${jsonFileName}`,
|
section_class: `${blockName}--${jsonFileName}`,
|
||||||
base_url: '/'
|
base_url: '/',
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!!req.query.iframe) {
|
||||||
|
data.iframeMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseView = req.params.baseView ?? 'container';
|
const baseView = req.params.baseView ?? 'container';
|
||||||
|
|||||||
Reference in New Issue
Block a user