Rename EditorHandle -> EditorWrapper and organize editor_api.rs (#3925)

* Rename EditorHandle -> EditorWrapper and organize editor_api.rs

* pub -> pub(crate)
This commit is contained in:
Keavon Chambers
2026-03-21 03:27:57 -07:00
committed by GitHub
parent 9bcac1af2d
commit 087b4cd71f
34 changed files with 352 additions and 358 deletions
+5 -5
View File
@@ -1,17 +1,17 @@
import type { PortfolioStore } from "/src/stores/portfolio";
import type { SubscriptionsRouter } from "/src/subscriptions-router";
import { saveEditorPreferences, loadEditorPreferences, storeDocument, removeDocument, loadFirstDocument, loadRestDocuments, saveActiveDocument } from "/src/utility-functions/persistence";
import type { EditorHandle } from "/wasm/pkg/graphite_wasm";
import type { EditorWrapper } from "/wasm/pkg/graphite_wasm";
let subscriptionsRouter: SubscriptionsRouter | undefined = undefined;
let editorHandle: EditorHandle | undefined = undefined;
let editorWrapper: EditorWrapper | undefined = undefined;
let portfolioStore: PortfolioStore | undefined = undefined;
export function createPersistenceManager(subscriptions: SubscriptionsRouter, editor: EditorHandle, portfolio: PortfolioStore) {
export function createPersistenceManager(subscriptions: SubscriptionsRouter, editor: EditorWrapper, portfolio: PortfolioStore) {
destroyPersistenceManager();
subscriptionsRouter = subscriptions;
editorHandle = editor;
editorWrapper = editor;
portfolioStore = portfolio;
subscriptions.subscribeFrontendMessage("TriggerSavePreferences", async (data) => {
@@ -63,5 +63,5 @@ export function destroyPersistenceManager() {
// Self-accepting HMR: tear down the old instance and re-create with the new module's code
import.meta.hot?.accept((newModule) => {
if (subscriptionsRouter && editorHandle && portfolioStore) newModule?.createPersistenceManager(subscriptionsRouter, editorHandle, portfolioStore);
if (subscriptionsRouter && editorWrapper && portfolioStore) newModule?.createPersistenceManager(subscriptionsRouter, editorWrapper, portfolioStore);
});