Skip to content

Commit

Permalink
Merge pull request #118 from micka-fdz/move-iframe-css
Browse files Browse the repository at this point in the history
  • Loading branch information
PrestaSafe authored Jul 20, 2023
2 parents 335bd83 + 87294da commit d9f6057
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 48 deletions.
2 changes: 1 addition & 1 deletion views/css/utility.css → _dev/public/iframe.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}
}

h1, h2, h3, h4, h5, h6 {
.ptb-title {
font-weight: normal;
margin: 0;
}
Expand Down
8 changes: 8 additions & 0 deletions _dev/src/scripts/iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ async loadIframe () {
emitter.emit('scrollInIframe', currentBlock.id_prettyblocks)
}

// we inject css in iframe
let cssLink = doc.createElement('link');
cssLink.rel = 'stylesheet';
cssLink.href = base_url + 'modules/prettyblocks/build/iframe.css';
cssLink.type = 'text/css';
cssLink.media = 'all';
doc.head.appendChild(cssLink);

this.loadContext(e)

}, false)
Expand Down
13 changes: 0 additions & 13 deletions prettyblocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class PrettyBlocks extends Module implements WidgetInterface
'displayLeftColumn',
'displayRightColumn',
'actionDispatcher',
'actionFrontControllerSetMedia',
'actionFrontControllerSetVariables',
];

Expand Down Expand Up @@ -168,18 +167,6 @@ public function uninstall()
&& $this->removeDb();
}

public function hookActionFrontControllerSetMedia()
{
$this->context->controller->registerStylesheet(
'prettyblocksutility',
'modules/' . $this->name . '/views/css/utility.css',
[
'media' => 'all',
'priority' => 100,
]
);
}

public function hookActionFrontControllerSetVariables()
{
return [
Expand Down
1 change: 1 addition & 0 deletions src/Controller/AdminThemeManagerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ public function indexAction()

return $this->render('@Modules/prettyblocks/views/templates/admin/index.html.twig', [
'css_back_custom' => $uri,
'base_url' => $link->getBaseLink(),
'favicon_url' => \Tools::getShopDomainSsl(true) . '/modules/' . $module->name . '/views/images/favicon.ico',
'module_name' => $module->displayName,
'shop_name' => $context->shop->name,
Expand Down
34 changes: 0 additions & 34 deletions views/css/index.php

This file was deleted.

2 changes: 2 additions & 0 deletions views/templates/admin/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
{% endif %}

<script>
var base_url = {{ base_url|json_encode|raw }}
var ajax_urls = {{ ajax_urls|json_encode|raw }}
var trans_app = {{ trans_app|json_encode|raw }}
var security_app = {{ security_app|json_encode|raw }}
window.base_url = base_url
window.ajax_urls = ajax_urls
window.trans_app = trans_app
window.security_app = security_app
Expand Down

0 comments on commit d9f6057

Please sign in to comment.