From 8eab1ff75075c981b6f2e59a2798d290226727a3 Mon Sep 17 00:00:00 2001 From: Christian Paul Date: Fri, 6 Jan 2023 13:02:13 +0100 Subject: [PATCH] Improve webhook code editor performance (#601) * Improve webhook code editor performance * Add newsfile --- changelog.d/601.bugfix | 1 + web/components/roomConfig/GenericWebhookConfig.tsx | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 changelog.d/601.bugfix diff --git a/changelog.d/601.bugfix b/changelog.d/601.bugfix new file mode 100644 index 00000000..17bd0e0c --- /dev/null +++ b/changelog.d/601.bugfix @@ -0,0 +1 @@ +Improve webhook code editor performance. \ No newline at end of file diff --git a/web/components/roomConfig/GenericWebhookConfig.tsx b/web/components/roomConfig/GenericWebhookConfig.tsx index 745faa59..0e16d2eb 100644 --- a/web/components/roomConfig/GenericWebhookConfig.tsx +++ b/web/components/roomConfig/GenericWebhookConfig.tsx @@ -26,7 +26,7 @@ const EXAMPLE_SCRIPT = `if (data.counter === undefined) { }`; const DOCUMENTATION_LINK = "https://matrix-org.github.io/matrix-hookshot/latest/setup/webhooks.html#script-api"; - +const CODE_MIRROR_EXTENSIONS = [javascript({})]; const ConnectionConfiguration: FunctionComponent> = ({serviceConfig, existingConnection, onSave, onRemove}) => { const [transFn, setTransFn] = useState(existingConnection?.config.transformationFunction as string || EXAMPLE_SCRIPT); @@ -61,10 +61,8 @@ const ConnectionConfiguration: FunctionComponent { - setTransFn(value) - }} + extensions={CODE_MIRROR_EXTENSIONS} + onChange={setTransFn} />

See the documentation for help writing transformation functions