mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 13:17:08 +00:00
Improve webhook code editor performance (#601)
* Improve webhook code editor performance * Add newsfile
This commit is contained in:
parent
8e8a1a6958
commit
8eab1ff750
1
changelog.d/601.bugfix
Normal file
1
changelog.d/601.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Improve webhook code editor performance.
|
@ -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<ConnectionConfigurationProps<ServiceConfig, GenericHookResponseItem, GenericHookConnectionState>> = ({serviceConfig, existingConnection, onSave, onRemove}) => {
|
||||
const [transFn, setTransFn] = useState<string>(existingConnection?.config.transformationFunction as string || EXAMPLE_SCRIPT);
|
||||
@ -61,10 +61,8 @@ const ConnectionConfiguration: FunctionComponent<ConnectionConfigurationProps<Se
|
||||
<InputField visible={transFnEnabled} noPadding={true}>
|
||||
<CodeMirror
|
||||
value={transFn}
|
||||
extensions={[javascript({ })]}
|
||||
onChange={(value) => {
|
||||
setTransFn(value)
|
||||
}}
|
||||
extensions={CODE_MIRROR_EXTENSIONS}
|
||||
onChange={setTransFn}
|
||||
/>
|
||||
<p> See the <a target="_blank" rel="noopener noreferrer" href={DOCUMENTATION_LINK}>documentation</a> for help writing transformation functions </p>
|
||||
</InputField>
|
||||
|
Loading…
x
Reference in New Issue
Block a user