mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 20:28:12 +08:00
Split apart the frontend Editor type into SubscriptionsRouter and EditorHandle (#3923)
* Remove the unused Editor.raw/wasmMemory/wasmImport * Split out Editor.subscriptions * Replace editor.handle.* with editor.* (1 of 2) * Replace editor.handle.* with editor.* (2 of 2) * Replace Editor typedef with EditorHandle import * Pluralize subscription-router and rename subscriptionsRef->subscriptionsRouter and editorRef->editorHandle * Remove editor.ts * Update the readme * Fix demo art loading bug
This commit is contained in:
@@ -2,32 +2,33 @@
|
||||
import { getContext, onMount, onDestroy } from "svelte";
|
||||
|
||||
import type { Layout } from "@graphite/../wasm/pkg/graphite_wasm";
|
||||
import type { Editor } from "@graphite/editor";
|
||||
import type { SubscriptionsRouter } from "/src/subscriptions-router";
|
||||
import { patchLayout } from "@graphite/utility-functions/widgets";
|
||||
|
||||
import LayoutRow from "@graphite/components/layout/LayoutRow.svelte";
|
||||
import Separator from "@graphite/components/widgets/labels/Separator.svelte";
|
||||
import WidgetLayout from "@graphite/components/widgets/WidgetLayout.svelte";
|
||||
|
||||
const editor = getContext<Editor>("editor");
|
||||
const subscriptions = getContext<SubscriptionsRouter>("subscriptions");
|
||||
|
||||
let statusBarHintsLayout: Layout = [];
|
||||
let statusBarInfoLayout: Layout = [];
|
||||
|
||||
onMount(() => {
|
||||
editor.subscriptions.subscribeLayoutUpdate("StatusBarHints", (data) => {
|
||||
subscriptions.subscribeLayoutUpdate("StatusBarHints", (data) => {
|
||||
patchLayout(statusBarHintsLayout, data);
|
||||
statusBarHintsLayout = statusBarHintsLayout;
|
||||
});
|
||||
editor.subscriptions.subscribeLayoutUpdate("StatusBarInfo", (data) => {
|
||||
|
||||
subscriptions.subscribeLayoutUpdate("StatusBarInfo", (data) => {
|
||||
patchLayout(statusBarInfoLayout, data);
|
||||
statusBarInfoLayout = statusBarInfoLayout;
|
||||
});
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
editor.subscriptions.unsubscribeLayoutUpdate("StatusBarHints");
|
||||
editor.subscriptions.unsubscribeLayoutUpdate("StatusBarInfo");
|
||||
subscriptions.unsubscribeLayoutUpdate("StatusBarHints");
|
||||
subscriptions.unsubscribeLayoutUpdate("StatusBarInfo");
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user