Clean up markdown preview messaging (#176458)

- Add properties directly to message
- Add `ImageInfo` type
- Don't use state to pass around imageInfo
This commit is contained in:
Matt Bierner
2023-03-07 17:28:13 -08:00
committed by GitHub
parent 2fffa58906
commit 3ca5284e44
5 changed files with 33 additions and 35 deletions

View File

@@ -22,14 +22,14 @@ let documentResource = settings.settings.source;
const vscode = acquireVsCodeApi();
const originalState = vscode.getState();
const originalState = vscode.getState() ?? {} as any;
const state = {
...(typeof originalState === 'object' ? originalState : {}),
originalState,
...getData<any>('data-state')
};
if (originalState.resource !== state.resource) {
if (originalState?.resource !== state.resource) {
state.scrollProgress = undefined;
}

View File

@@ -25,7 +25,7 @@ export const createPosterForVsCode = (vscode: any, settingsManager: SettingsMana
vscode.postMessage({
type,
source: settingsManager.settings!.source,
body
...body
});
}
};