@pulse-editor/react-api 0.1.1-beta.85 → 0.1.1-beta.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -5704,7 +5704,7 @@ function useActionEffect(params, deps, isExtReady = true) {
5704
5704
  returns: actionInfo.returns,
5705
5705
  });
5706
5706
  // Update receiver
5707
- imc?.updateReceiverHandlerMap(getReceiverHandlerMap(func));
5707
+ imc?.updateReceiverHandlerMap(getReceiverHandlerMap(func, beforeAction, afterAction));
5708
5708
  }
5709
5709
  if (isExtReady) {
5710
5710
  updateAction();
@@ -5737,8 +5737,23 @@ function useActionEffect(params, deps, isExtReady = true) {
5737
5737
  }
5738
5738
  return afterRes !== undefined ? afterRes : res;
5739
5739
  }
5740
- function getReceiverHandlerMap(actionHandlerFunc) {
5740
+ function getReceiverHandlerMap(actionHandlerFunc, beforeActionFunc, afterActionFunc) {
5741
5741
  const receiverHandlerMap = new Map([
5742
+ [
5743
+ IMCMessageTypeEnum.EditorRestoreActionCache,
5744
+ async (_senderWindow, message) => {
5745
+ const { name, input, output } = message.payload;
5746
+ if (params.actionName !== name) {
5747
+ throw new Error("Message ignored by receiver");
5748
+ }
5749
+ if (beforeActionFunc && input !== undefined) {
5750
+ await beforeActionFunc(input);
5751
+ }
5752
+ if (afterActionFunc && output !== undefined) {
5753
+ await afterActionFunc(output);
5754
+ }
5755
+ },
5756
+ ],
5742
5757
  [
5743
5758
  IMCMessageTypeEnum.EditorRunAppAction,
5744
5759
  async (_senderWindow, message) => {