From cbe78fb4282062a02e54814d43fbbdb1a7fa9927 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 2 Aug 2021 17:05:36 +0200 Subject: [PATCH] Support ES 6 default exports for form builder field JavaScript data handlers For legacy exports the value loaded by `require()` (`FormBuilderField`) will be whatever the module author returned within the module definition. ES 6 modules on the other hand will be passed as an object containing the exported values, with the default export residing in the `default` key. tslib's `__importDefault` will transform a legacy export into a ES 6 module, by putting the exported value into the `default` key of an freshly created object. This allows us to handle both legacy as well as ES 6 default exports identically by simply using the `default` value of the `FormBuilderField` variable. --- com.woltlab.wcf/templates/__formFieldDataHandler.tpl | 6 +++++- .../install/files/acp/templates/__formFieldDataHandler.tpl | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/com.woltlab.wcf/templates/__formFieldDataHandler.tpl b/com.woltlab.wcf/templates/__formFieldDataHandler.tpl index 13643bdb70..de8b13fd7f 100644 --- a/com.woltlab.wcf/templates/__formFieldDataHandler.tpl +++ b/com.woltlab.wcf/templates/__formFieldDataHandler.tpl @@ -1,15 +1,19 @@ {if $field->getDocument()->isAjax() && !$field->getJavaScriptDataHandlerModule()|empty} diff --git a/wcfsetup/install/files/acp/templates/__formFieldDataHandler.tpl b/wcfsetup/install/files/acp/templates/__formFieldDataHandler.tpl index 13643bdb70..de8b13fd7f 100644 --- a/wcfsetup/install/files/acp/templates/__formFieldDataHandler.tpl +++ b/wcfsetup/install/files/acp/templates/__formFieldDataHandler.tpl @@ -1,15 +1,19 @@ {if $field->getDocument()->isAjax() && !$field->getJavaScriptDataHandlerModule()|empty} -- 2.20.1