@codingame/monaco-vscode-ipynb-default-extension 1.81.8-next.1 → 1.82.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const whenReady: () => Promise<void>
2
+ export { whenReady }
package/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import { registerExtension } from 'vscode/extensions';
2
2
 
3
- var manifest = {name:"ipynb",displayName:".ipynb Support",description:"Provides basic support for opening and reading Jupyter's .ipynb notebook files",publisher:"vscode",version:"1.0.0",license:"MIT",engines:{vscode:"^1.57.0"},enabledApiProposals:["documentPaste","diffContentOptions","dropMetadata"],activationEvents:["onNotebook:jupyter-notebook","onNotebookSerializer:interactive"],extensionKind:["workspace","ui"],main:undefined,browser:"./dist/browser/ipynbMain.js",capabilities:{virtualWorkspaces:true,untrustedWorkspaces:{supported:true}},contributes:{configuration:[{properties:{"ipynb.pasteImagesAsAttachments.enabled":{type:"boolean",scope:"resource",markdownDescription:"Enable/disable pasting of images into Markdown cells in ipynb notebook files. Pasted images are inserted as attachments to the cell.","default":true}}}],commands:[{command:"ipynb.newUntitledIpynb",title:"New Jupyter Notebook",shortTitle:"Jupyter Notebook",category:"Create"},{command:"ipynb.openIpynbInNotebookEditor",title:"Open IPYNB File In Notebook Editor"},{command:"ipynb.cleanInvalidImageAttachment",title:"Clean Invalid Image Attachment Reference"}],notebooks:[{type:"jupyter-notebook",displayName:"Jupyter Notebook",selector:[{filenamePattern:"*.ipynb"}],priority:"default"}],notebookRenderer:[{id:"vscode.markdown-it-cell-attachment-renderer",displayName:"Markdown-It ipynb Cell Attachment renderer",entrypoint:{"extends":"vscode.markdown-it-renderer",path:"./notebook-out/cellAttachmentRenderer.js"}}],menus:{"file/newFile":[{command:"ipynb.newUntitledIpynb",group:"notebook"}],commandPalette:[{command:"ipynb.newUntitledIpynb"},{command:"ipynb.openIpynbInNotebookEditor",when:"false"},{command:"ipynb.cleanInvalidImageAttachment",when:"false"}]}},scripts:{compile:"npx gulp compile-extension:ipynb && npm run build-notebook",watch:"npx gulp watch-extension:ipynb","build-notebook":"node ./esbuild"},dependencies:{"@enonic/fnv-plus":"^1.3.0","detect-indent":"^6.0.0",uuid:"^8.3.2"},devDependencies:{"@jupyterlab/nbformat":"^3.2.9","@types/markdown-it":"12.2.3","@types/uuid":"^8.3.1"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}};
3
+ var manifest = {name:"ipynb",displayName:".ipynb Support",description:"Provides basic support for opening and reading Jupyter's .ipynb notebook files",publisher:"vscode",version:"1.0.0",license:"MIT",engines:{vscode:"^1.57.0"},enabledApiProposals:["documentPaste","diffContentOptions","dropMetadata"],activationEvents:["onNotebook:jupyter-notebook","onNotebookSerializer:interactive"],extensionKind:["workspace","ui"],main:undefined,browser:"./dist/browser/ipynbMain.js",capabilities:{virtualWorkspaces:true,untrustedWorkspaces:{supported:true}},contributes:{configuration:[{properties:{"ipynb.pasteImagesAsAttachments.enabled":{type:"boolean",scope:"resource",markdownDescription:"Enable/disable pasting of images into Markdown cells in ipynb notebook files. Pasted images are inserted as attachments to the cell.","default":true}}}],commands:[{command:"ipynb.newUntitledIpynb",title:"New Jupyter Notebook",shortTitle:"Jupyter Notebook",category:"Create"},{command:"ipynb.openIpynbInNotebookEditor",title:"Open IPYNB File In Notebook Editor"},{command:"ipynb.cleanInvalidImageAttachment",title:"Clean Invalid Image Attachment Reference"},{command:"notebook.cellOutput.copy",title:"Copy Output"}],notebooks:[{type:"jupyter-notebook",displayName:"Jupyter Notebook",selector:[{filenamePattern:"*.ipynb"}],priority:"default"}],notebookRenderer:[{id:"vscode.markdown-it-cell-attachment-renderer",displayName:"Markdown-It ipynb Cell Attachment renderer",entrypoint:{"extends":"vscode.markdown-it-renderer",path:"./notebook-out/cellAttachmentRenderer.js"}}],menus:{"file/newFile":[{command:"ipynb.newUntitledIpynb",group:"notebook"}],commandPalette:[{command:"ipynb.newUntitledIpynb"},{command:"ipynb.openIpynbInNotebookEditor",when:"false"},{command:"ipynb.cleanInvalidImageAttachment",when:"false"}],"webview/context":[{command:"notebook.cellOutput.copy",when:"webviewId == 'notebook.output' && webviewSection == 'image'"}]}},scripts:{compile:"npx gulp compile-extension:ipynb && npm run build-notebook",watch:"npx gulp watch-extension:ipynb","build-notebook":"node ./esbuild"},dependencies:{"@enonic/fnv-plus":"^1.3.0","detect-indent":"^6.0.0",uuid:"^8.3.2"},devDependencies:{"@jupyterlab/nbformat":"^3.2.9","@types/markdown-it":"12.2.3","@types/uuid":"^8.3.1"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}};
4
4
 
5
- const { registerFileUrl } = registerExtension(manifest);
5
+ const { registerFileUrl, whenReady } = registerExtension(manifest);
6
6
  registerFileUrl('./dist/browser/ipynbMain.js', new URL('./ipynbMain.js', import.meta.url).toString(), 'text/javascript');
7
7
  registerFileUrl('dist/browser/ipynbMain.js.map', new URL('./ipynbMain.js.map', import.meta.url).toString(), 'application/json');
8
+
9
+ export { whenReady };
package/ipynbMain.js CHANGED
@@ -3660,6 +3660,7 @@ var MimeType;
3660
3660
  MimeType["png"] = "image/png";
3661
3661
  MimeType["tiff"] = "image/tiff";
3662
3662
  MimeType["webp"] = "image/webp";
3663
+ MimeType["plain"] = "text/plain";
3663
3664
  MimeType["uriList"] = "text/uri-list";
3664
3665
  })(MimeType || (MimeType = {}));
3665
3666
  const imageMimeTypes = new Set([
@@ -3689,7 +3690,6 @@ function getImageMimeType(uri) {
3689
3690
  class DropOrPasteEditProvider {
3690
3691
  constructor() {
3691
3692
  this.id = 'insertAttachment';
3692
- this.defaultPriority = 5;
3693
3693
  }
3694
3694
  async provideDocumentPasteEdits(document, _ranges, dataTransfer, token) {
3695
3695
  const enabled = vscode.workspace.getConfiguration('ipynb', document).get('pasteImagesAsAttachments.enabled', true);
@@ -3700,8 +3700,8 @@ class DropOrPasteEditProvider {
3700
3700
  if (!insert) {
3701
3701
  return;
3702
3702
  }
3703
- const pasteEdit = new vscode.DocumentPasteEdit(insert.insertText, this.id, vscode.l10n.t('Insert Image as Attachment'));
3704
- pasteEdit.priority = this.getPastePriority(dataTransfer);
3703
+ const pasteEdit = new vscode.DocumentPasteEdit(insert.insertText, vscode.l10n.t('Insert Image as Attachment'));
3704
+ pasteEdit.yieldTo = [{ mimeType: MimeType.plain }];
3705
3705
  pasteEdit.additionalEdit = insert.additionalEdit;
3706
3706
  return pasteEdit;
3707
3707
  }
@@ -3711,20 +3711,11 @@ class DropOrPasteEditProvider {
3711
3711
  return;
3712
3712
  }
3713
3713
  const dropEdit = new vscode.DocumentDropEdit(insert.insertText);
3714
- dropEdit.id = this.id;
3715
- dropEdit.priority = this.defaultPriority;
3714
+ dropEdit.yieldTo = [{ mimeType: MimeType.plain }];
3716
3715
  dropEdit.additionalEdit = insert.additionalEdit;
3717
3716
  dropEdit.label = vscode.l10n.t('Insert Image as Attachment');
3718
3717
  return dropEdit;
3719
3718
  }
3720
- getPastePriority(dataTransfer) {
3721
- if (dataTransfer.get('text/plain')) {
3722
- // Deprioritize in favor of normal text content
3723
- return -5;
3724
- }
3725
- // Otherwise boost priority so attachments are preferred
3726
- return this.defaultPriority;
3727
- }
3728
3719
  async createInsertImageAttachmentEdit(document, dataTransfer, token) {
3729
3720
  const imageData = await getDroppedImageData(dataTransfer, token);
3730
3721
  if (!imageData.length || token.isCancellationRequested) {
@@ -3891,11 +3882,13 @@ function buildAttachment(cell, attachments) {
3891
3882
  function notebookImagePasteSetup() {
3892
3883
  const provider = new DropOrPasteEditProvider();
3893
3884
  return vscode.Disposable.from(vscode.languages.registerDocumentPasteEditProvider(constants_1.JUPYTER_NOTEBOOK_MARKDOWN_SELECTOR, provider, {
3885
+ id: provider.id,
3894
3886
  pasteMimeTypes: [
3895
3887
  MimeType.png,
3896
3888
  MimeType.uriList,
3897
3889
  ],
3898
3890
  }), vscode.languages.registerDocumentDropEditProvider(constants_1.JUPYTER_NOTEBOOK_MARKDOWN_SELECTOR, provider, {
3891
+ id: provider.id,
3899
3892
  dropMimeTypes: [
3900
3893
  ...Object.values(imageExtToMime),
3901
3894
  MimeType.uriList,