Skip to content
Snippets Groups Projects
Commit 0c9e53c4 authored by Rich Lott / Artful Robot's avatar Rich Lott / Artful Robot
Browse files

Merge remote-tracking branch 'origin/master'

parents 89e74484 5403f59c
Branches
Tags
No related merge requests found
<?php
use CRM_Inlay_ExtensionUtil as E;
class CRM_Inlay_Page_Demo extends CRM_Core_Page {
......@@ -27,7 +28,7 @@ class CRM_Inlay_Page_Demo extends CRM_Core_Page {
$editUrl = str_replace('{id}', $inlay->getID(), $inlay->getInstanceEditURLTemplate());
$this->assign('editUrl', CRM_Utils_System::url($editUrl));
$cacheBuster = time();
$this->assign('scriptTag', "<script src=\"{$inlay->getBundleUrl()}?nocache=$cacheBuster\" data-inlay-id=\"{$inlay->getPublicID()}\" defer></script>");
$this->assign('scriptTag', "<script type=module src=\"{$inlay->getBundleUrl()}?nocache=$cacheBuster\" data-inlay-id=\"{$inlay->getPublicID()}\" ></script>");
parent::run();
}
......
<?php
namespace Civi\Api4\Action\Inlay;
/**
* Provides way to update the .js bundles for each inlay.
*/
use CRM_Inlay_ExtensionUtil as E;
use Civi\Api4\Generic\Result;
use Civi\Inlay\Config as InlayConfig;
use Civi\Api4\Generic\Traits\DAOActionTrait;
use Civi;
/**
* InlayType.get action
*
......@@ -92,11 +96,10 @@ class CreateBundle extends \Civi\Api4\Generic\AbstractQueryAction {
$libraryCode
CiviCRMInlay.app.bundleInfo($now, $publicID);
$externalScript
(function(){
var i = window.CiviCRMInlay;
((i) => {
i.inlays[$publicID] = $initData;
i.app.bootWhenReady();
})();
})(window.CiviCRMInlay);
JAVASCRIPT;
// Get public storage.
......@@ -147,5 +150,4 @@ class CreateBundle extends \Civi\Api4\Generic\AbstractQueryAction {
return (array) civicrm_api4($this->getEntityName(), 'get', $params);
}
}
......@@ -177,7 +177,7 @@
}
$scope.getScript = function(i) {
var mainScript = encodeToHTML(`<script src="${i.scriptUrl}" data-inlay-id="${i.public_id}" ></script>`);
var mainScript = encodeToHTML(`<script type=module src="${i.scriptUrl}" data-inlay-id="${i.public_id}" ></script>`);
var wpShortcode = encodeToHTML(`[inlay id="${i.public_id}"]`);
console.log({mainScript, wpShortcode});
......
# Change log
## 1.3.8
## 1.3.8 (unreleased)
- Changes to support better migration and validation of config between versions
- Changes to support better migration and validation of config between versions
of type implementations.
## 1.3.6
- Suggest `<script>` tags sourcing inlay bundles now specify `type=module`. This
should not hurt existing scripts but might be important to support ESM modules used within scripts.
## 1.3.6 (unreleased)
- Fix a PHP 8.1 warning in certain situations
- Adds concept of inlay instances being ON/OFF. Also "Broken". If an inlay is
......@@ -36,7 +39,7 @@
## 1.3.2
- Fix [issue #10](https://lab.civicrm.org/extensions/inlay/-/issues/10) - CORS errors if inlay used on same domain as CiviCRM.
- There’s now a simple preview page to be able to see how an inlay might look/work before placing it on another site. It’s a good idea to test on the site you’re actually wanting to use it on, but this will have its uses. Click the new *Preview* link from the inlays list. [Enhanement #8](https://lab.civicrm.org/extensions/inlay/-/issues/8)
- There’s now a simple preview page to be able to see how an inlay might look/work before placing it on another site. It’s a good idea to test on the site you’re actually wanting to use it on, but this will have its uses. Click the new _Preview_ link from the inlays list. [Enhanement #8](https://lab.civicrm.org/extensions/inlay/-/issues/8)
## 1.3.1
......@@ -44,7 +47,6 @@
- Allow inlays to boot up immediately if the page has already completed loading. This is not the usual case, but is the case when another script adds in an Inlay script.
- You can now see console debug messages by calling `localStorage.setItem('inlayDebug', 1)` To disable: `localStorage.removeItem('inlayDebug)` Other inlay scripts may wish to use `CiviCRMInlay.debug()` to pass debug messages, instead of console.log
## 1.3.0 Type hints
More type hints have been added to the `\Civi\Inlay\Type` class. Inlays whose method signatures do not match these will hit trouble - update your code and test! (Hence the minor version jump.)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment