redirect co.uk scripts to v0 (#1427)
* detect attempt at loading td script * don't try to import * bump pxt
This commit is contained in:
		@@ -786,6 +786,20 @@ namespace pxt.editor {
 | 
				
			|||||||
    initExtensionsAsync = function (opts: pxt.editor.ExtensionOptions): Promise<pxt.editor.ExtensionResult> {
 | 
					    initExtensionsAsync = function (opts: pxt.editor.ExtensionOptions): Promise<pxt.editor.ExtensionResult> {
 | 
				
			||||||
        pxt.debug('loading microbit target extensions...')
 | 
					        pxt.debug('loading microbit target extensions...')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function cantImportAsync(project: pxt.editor.IProjectView) {
 | 
				
			||||||
 | 
					            // this feature is support in v0 only
 | 
				
			||||||
 | 
					            return project.showModalDialogAsync({
 | 
				
			||||||
 | 
					                header: lf("Can't import microbit.co.uk scripts..."),
 | 
				
			||||||
 | 
					                body: lf("Importing microbit.co.uk programs is not supported in this editor anymore. Please open this script in the https://makecode.microbit.org/v0 editor."),
 | 
				
			||||||
 | 
					                buttons: [
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        label: lf("Go to the old editor"),
 | 
				
			||||||
 | 
					                        url: `https://makecode.microbit.org/v0`
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                ]
 | 
				
			||||||
 | 
					            }).then(() => project.openHome())
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!Math.imul)
 | 
					        if (!Math.imul)
 | 
				
			||||||
            Math.imul = function (a, b) {
 | 
					            Math.imul = function (a, b) {
 | 
				
			||||||
                const ah = (a >>> 16) & 0xffff;
 | 
					                const ah = (a >>> 16) & 0xffff;
 | 
				
			||||||
@@ -801,11 +815,17 @@ namespace pxt.editor {
 | 
				
			|||||||
            hexFileImporters: [{
 | 
					            hexFileImporters: [{
 | 
				
			||||||
                id: "blockly",
 | 
					                id: "blockly",
 | 
				
			||||||
                canImport: data => data.meta.cloudId == "microbit.co.uk" && data.meta.editor == "blockly",
 | 
					                canImport: data => data.meta.cloudId == "microbit.co.uk" && data.meta.editor == "blockly",
 | 
				
			||||||
                importAsync: (project, data) => project.createProjectAsync({
 | 
					                importAsync: (project, data) => {
 | 
				
			||||||
                    filesOverride: {
 | 
					                    pxt.tickEvent('import.legacyblocks.redirect');
 | 
				
			||||||
                        "main.blocks": data.source
 | 
					                    return cantImportAsync(project);
 | 
				
			||||||
                    }, name: data.meta.name
 | 
					                }
 | 
				
			||||||
                })
 | 
					            }, {
 | 
				
			||||||
 | 
					                id: "td",
 | 
				
			||||||
 | 
					                canImport: data => data.meta.cloudId == "microbit.co.uk" && data.meta.editor == "touchdevelop",
 | 
				
			||||||
 | 
					                importAsync: (project, data) => {
 | 
				
			||||||
 | 
					                    pxt.tickEvent('import.legacytd.redirect');
 | 
				
			||||||
 | 
					                    return cantImportAsync(project);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }]
 | 
					            }]
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,6 +43,6 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "pxt-common-packages": "0.24.2",
 | 
					    "pxt-common-packages": "0.24.2",
 | 
				
			||||||
    "pxt-core": "4.1.31"
 | 
					    "pxt-core": "4.1.32"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user