fix(frontend): Attempt to resolve TypeError in RichTextInput.svelte

Fixes an issue where `ue.getWordAtDocPos is not a function` would be thrown in `MessageInput.svelte`.

The error was caused by a timing issue where the `getWordAtDocPos` method on the `RichTextInput` component was not available when called from an event handler within the same component.

This change refactors the code to pass the `getWordAtDocPos` function as a callback prop from `RichTextInput` to `MessageInput`, ensuring it's available when needed.
This commit is contained in:
silentoplayz
2025-08-03 22:36:08 -04:00
parent 7c29084a19
commit 7a80e60785
9 changed files with 29 additions and 21 deletions
+5 -5
View File
@@ -74,15 +74,15 @@ const readPngChunks = (data) => {
if (!isValidPng) throw new Error('Invalid PNG file');
let chunks = [];
const chunks = [];
let offset = 8; // Skip PNG signature
while (offset < data.length) {
let length =
const length =
(data[offset] << 24) | (data[offset + 1] << 16) | (data[offset + 2] << 8) | data[offset + 3];
let type = String.fromCharCode.apply(null, data.slice(offset + 4, offset + 8));
let chunkData = data.slice(offset + 8, offset + 8 + length);
let crc =
const type = String.fromCharCode.apply(null, data.slice(offset + 4, offset + 8));
const chunkData = data.slice(offset + 8, offset + 8 + length);
const crc =
(data[offset + 8 + length] << 24) |
(data[offset + 8 + length + 1] << 16) |
(data[offset + 8 + length + 2] << 8) |