From 9c1549c1af22c92dfef7aa64eab398cd22fb3ddc Mon Sep 17 00:00:00 2001 From: Dan Ivanovich Date: Mon, 12 Aug 2024 15:58:27 -0400 Subject: [PATCH] Correct broken object assignment & script builder string construction --- frontend/src/resource/ResourceTreeNode.svelte | 2 +- frontend/src/views/Comment.svelte | 23 ++++++++++--------- ofrak_core/ofrak/gui/server.py | 5 ++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/frontend/src/resource/ResourceTreeNode.svelte b/frontend/src/resource/ResourceTreeNode.svelte index 08f0fd0d5..5325e62c8 100644 --- a/frontend/src/resource/ResourceTreeNode.svelte +++ b/frontend/src/resource/ResourceTreeNode.svelte @@ -249,7 +249,7 @@ {#each comment_strs as comment_text}
diff --git a/frontend/src/views/Comment.svelte b/frontend/src/views/Comment.svelte index cc5a72c7c..c7c4daf8d 100644 --- a/frontend/src/views/Comment.svelte +++ b/frontend/src/views/Comment.svelte @@ -20,17 +20,18 @@ import Hoverable from "../utils/Hoverable.svelte"; import Icon from "../utils/Icon.svelte"; export let comment, rootResource, selfId; - let text = comment[1]; - let addresses = text.matchAll("#[a-fA-F0-9]+[@0x[0-9a-fA-F]+]*", text); + let addresses = comment.comment_text.matchAll( + "#[a-fA-F0-9]+[@0x[0-9a-fA-F]+]*" + ); let text_elements = []; Array.from(addresses).forEach((location) => { - let text_split = text.split(location[0]); + let text_split = comment.comment_text.split(location[0]); text_elements.push(text_split[0]); text_elements.push(createAddressButton(location[0])); - text = text_split.slice(1).join(location[0]); + comment.comment_text = text_split.slice(1).join(location[0]); }); - text_elements.push(text); + text_elements.push(comment.comment_text); function createAddressButton(location) { let resource_id; @@ -53,11 +54,14 @@ return button; } - async function onDeleteClick(optional_range, comment_text) { + async function onDeleteClick(comment) { // Delete the selected comment. // As a side effect, the corresponding resource gets selected. $selected = selfId; - await rootResource.delete_comment(optional_range, comment_text); + await rootResource.delete_comment( + comment.comment_range, + comment.comment_text + ); $resourceNodeDataMap[$selected].commentsPromise = rootResource.get_comments(); } @@ -65,10 +69,7 @@
-