mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Mark that notebook metadata is readonly
(#158960)
Mark that metadata is `readonly`
Fixes #158955
We freeze the object here 0656d21d11/src/vs/workbench/api/common/extHostNotebookDocument.ts (L70)
This commit is contained in:
parent
b72671133b
commit
f00fde0f24
|
@ -124,7 +124,7 @@ function encodeBase64(buffer: Uint8Array, padded = true, urlSafe = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildMetadata(b64: string, cell: vscode.NotebookCell, filename: string, filetype: string, startingAttachments: any): { [key: string]: any } {
|
function buildMetadata(b64: string, cell: vscode.NotebookCell, filename: string, filetype: string, startingAttachments: any): { [key: string]: any } {
|
||||||
const outputMetadata: { [key: string]: any } = cell.metadata;
|
const outputMetadata = { ...cell.metadata };
|
||||||
const customField = cell.metadata.custom;
|
const customField = cell.metadata.custom;
|
||||||
if (!customField) {
|
if (!customField) {
|
||||||
return { 'custom': { 'attachments': { [filename]: { 'image/png': b64 } } } };
|
return { 'custom': { 'attachments': { [filename]: { 'image/png': b64 } } } };
|
||||||
|
|
2
src/vscode-dts/vscode.d.ts
vendored
2
src/vscode-dts/vscode.d.ts
vendored
|
@ -13025,7 +13025,7 @@ declare module 'vscode' {
|
||||||
/**
|
/**
|
||||||
* The metadata of this cell. Can be anything but must be JSON-stringifyable.
|
* The metadata of this cell. Can be anything but must be JSON-stringifyable.
|
||||||
*/
|
*/
|
||||||
readonly metadata: { [key: string]: any };
|
readonly metadata: { readonly [key: string]: any };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The outputs of this cell.
|
* The outputs of this cell.
|
||||||
|
|
Loading…
Reference in a new issue