Skip to content

Commit

Permalink
update for CSP
Browse files Browse the repository at this point in the history
(cherry picked from commit d38e1bb3ca16eefe7d304154c7b247646bd85964)
  • Loading branch information
dunglv authored and JaJuMa committed Dec 31, 2024
1 parent dd9fa84 commit c3eeae5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion view/adminhtml/templates/quick_action.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ use Jajuma\PotQuickTranslation\Block\QuickAction;

$magewire = $block->getMagewire();
$status = $magewire->getCurrentStatusBackend();
$powerToysHelper = $this->helper(\Jajuma\PowerToys\Helper\Data::class);
$nonce = $powerToysHelper->getNonce();
?>

<div id="pot-quick-translation" wire:loading.class="loading">
<img src="<?= $block->getIcon(); ?>"/>
<div class="pot-quick-translation-status <?= $status ? 'is-translate-enable' : '' ?>"></div>
<a wire:click="backendExecute"><?= $block->getData('name') ?></a>
<script>
<script <?= $nonce ? 'nonce="' . $nonce . '"' : '' ?>>
window.addEventListener('finish-quick-translation', event => {
window.location.reload();
});
Expand Down
4 changes: 3 additions & 1 deletion view/frontend/templates/quick_action.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ use Jajuma\PotQuickTranslation\Block\QuickAction;

$magewire = $block->getMagewire();
$status = $magewire->getCurrentStatus();
$powerToysHelper = $this->helper(\Jajuma\PowerToys\Helper\Data::class);
$nonce = $powerToysHelper->getNonce();
?>

<div id="pot-quick-translation" wire:loading.class="loading">
<img src="<?= $block->getIcon(); ?>"/>
<div class="pot-quick-translation-status <?= $status ? 'is-translate-enable' : '' ?>"></div>
<a wire:click="execute"><?= $block->getData('name') ?></a>
<script>
<script <?= $nonce ? 'nonce="' . $nonce . '"' : '' ?>>
window.addEventListener('finish-quick-translation', event => {
let message = event.detail.message;
if (message !== undefined) {
Expand Down

0 comments on commit c3eeae5

Please sign in to comment.