From bba40ca7069cee9eee2211a422be253ef1067d73 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Tue, 17 Jun 2025 16:16:06 +0100 Subject: [PATCH] adapt custom module sample --- playwright/sample-files/custom-component-module.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/playwright/sample-files/custom-component-module.js b/playwright/sample-files/custom-component-module.js index 563b4123c5..8d4d1b3c1f 100644 --- a/playwright/sample-files/custom-component-module.js +++ b/playwright/sample-files/custom-component-module.js @@ -6,26 +6,26 @@ Please see LICENSE files in the repository root for full details. */ export default class CustomComponentModule { - static moduleApiVersion = "^1.0.0"; + static moduleApiVersion = "^1.2.0"; constructor(api) { this.api = api; this.api.customComponents.registerMessageRenderer( - (evt) => evt.getContent().body === "Do not show edits", + (evt) => evt.content.body === "Do not show edits", (_props, originalComponent) => { return originalComponent(); }, { allowEditingEvent: false }, ); this.api.customComponents.registerMessageRenderer( - (evt) => evt.getContent().body === "Fall through here", + (evt) => evt.content.body === "Fall through here", (props) => { - const body = props.mxEvent.getContent().body; + const body = props.mxEvent.content.body; return `Fallthrough text for ${body}`; }, ); this.api.customComponents.registerMessageRenderer( (evt) => { - if (evt.getContent().body === "Crash the filter!") { + if (evt.content.body === "Crash the filter!") { throw new Error("Fail test!"); } return false; @@ -35,14 +35,14 @@ export default class CustomComponentModule { }, ); this.api.customComponents.registerMessageRenderer( - (evt) => evt.getContent().body === "Crash the renderer!", + (evt) => evt.content.body === "Crash the renderer!", () => { throw new Error("Fail test!"); }, ); // Order is specific here to avoid this overriding the other renderers this.api.customComponents.registerMessageRenderer("m.room.message", (props, originalComponent) => { - const body = props.mxEvent.getContent().body; + const body = props.mxEvent.content.body; if (body === "Do not replace me") { return originalComponent(); } else if (body === "Fall through here") {