Skip to content

Commit

Permalink
fix: isolate editor windows and sort manifest keys #6
Browse files Browse the repository at this point in the history
  • Loading branch information
ok-nick committed Sep 5, 2024
1 parent 8747ae2 commit c105e6b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/src/components/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default function Editor() {
{manifest && (
<JsonView
value={manifest}
objectSortKeys={true}
displayDataTypes={false}
displayObjectSize={false}
collapsed={3}
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/components/Inspect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,18 @@ export default function Inspect({
MenuItem.new({
text: "View JSON Manifest",
action: () => {
const webview = new WebviewWindow(`editor-${uuid()}`, {
const label = `editor-${uuid()}`;
const webview = new WebviewWindow(label, {
url: "#/editor",
// TODO: add file name/manifest label to title
title: "c2pa-preview editor",
parent: "main",
});

// TODO: are these events auto unlistened when the window is dropped?
webview
.listen("request-edit-info", () => {
console.log("RECEIVED");
source.origin
.arrayBuffer()
.then((buffer) => new Uint8Array(buffer))
Expand All @@ -56,7 +59,7 @@ export default function Inspect({
readonly: true,
manifest,
};
return webview.emit("edit-info", payload);
return webview.emitTo(label, "edit-info", payload);
})
.catch(onError);
})
Expand Down

0 comments on commit c105e6b

Please sign in to comment.