From abb5693ff1930aeff2867c62a630f727122bae38 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Mon, 27 Jul 2020 10:56:55 +0200 Subject: [PATCH] library browser: import selected library on pressing enter --- HISTORY.md | 1 + src/gui.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index ec4e7963..18b1ce28 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -5,6 +5,7 @@ ### 2020-07-27 * threads: fixed binding contexts to other receivers (variable scope for ASK / TELL) * gui: updated "About Snap!" dialog box +* gui: library browser: import selected library on pressing enter ### 2020-07-26 * objects: fixed sprite speech balloon display for sounds diff --git a/src/gui.js b/src/gui.js index ddd5b08f..94da631f 100644 --- a/src/gui.js +++ b/src/gui.js @@ -7766,6 +7766,7 @@ LibraryImportDialogMorph.prototype.init = function (ide, librariesData) { this.ide = ide; this.key = 'importLibrary'; + this.action = 'importLibrary'; this.librariesData = librariesData; // [{name: , fileName: , description:}] // I contain a cached version of the libaries I have displayed, @@ -7793,7 +7794,7 @@ LibraryImportDialogMorph.prototype.buildContents = function () { this.initializeLibraryDescription(); this.installLibrariesList(); - this.addButton('importLibrary', 'Import'); + this.addButton('ok', 'Import'); this.addButton('cancel', 'Cancel'); this.setExtent(new Point(460, 455)); @@ -7989,6 +7990,8 @@ LibraryImportDialogMorph.prototype.cachedLibrary = function (key) { }; LibraryImportDialogMorph.prototype.importLibrary = function () { + if (!this.listField.selected) {return; } + var blocks, ide = this.ide, selectedLibrary = this.listField.selected.fileName, @@ -8011,8 +8014,6 @@ LibraryImportDialogMorph.prototype.importLibrary = function () { } ); } - - this.destroy(); }; LibraryImportDialogMorph.prototype.displayBlocks = function (libraryKey) {