diff --git a/HISTORY.md b/HISTORY.md index f512259b..4d3360de 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,10 +3,11 @@ ## in development: * **New Features:** - * support deleting and inserting individual variadic slots, script vars & ring params - * support dragging blocks, costumes and sounds out from result bubbles, and from speech balloons and variable watchers when in edit mode - * support exporting costumes and sounds from result bubbles, and from speech balloons and variable watchers when in edit mode - * support exporting text and numbers from result bubbles and speech balloons when in edit mode + * deleting and inserting individual variadic slots, script vars & ring params + * dragging blocks, costumes and sounds out from result bubbles, and from speech balloons and variable watchers when in edit mode + * exporting costumes and sounds from result bubbles, and from speech balloons and variable watchers when in edit mode + * exporting text and numbers from result bubbles and speech balloons when in edit mode + * exporting atomic lists from list watchers everywhere when in edit mode * **Notable Changes:** * **Notable Fixes:** * fixed layout for scrolling custom categories, thanks, Eckart, for the bug report! @@ -24,6 +25,7 @@ * objects: support exporting sounds and costumes from variable watchers in edit mode * blocks: support exporting numbers and text from result bubbles * objects: support exporting numbers and text from speech balloons when in edit mode +* lists: support exporting atomic lists from list watchers everywhere when in edit mode ### 2022-01-27 * blocks, gui: support dragging costumes and sounds out from result bubbles diff --git a/snap.html b/snap.html index 59af8172..ed565600 100755 --- a/snap.html +++ b/snap.html @@ -22,7 +22,7 @@ - + diff --git a/src/lists.js b/src/lists.js index 1e18b1d5..1e9f82c8 100644 --- a/src/lists.js +++ b/src/lists.js @@ -7,7 +7,7 @@ written by Jens Mönig and Brian Harvey jens@moenig.org, bh@cs.berkeley.edu - Copyright (C) 2021 by Jens Mönig and Brian Harvey + Copyright (C) 2022 by Jens Mönig and Brian Harvey This file is part of Snap!. @@ -65,7 +65,7 @@ ZERO, WHITE*/ // Global settings ///////////////////////////////////////////////////// -modules.lists = '2021-December-15'; +modules.lists = '2022-January-28'; var List; var ListWatcherMorph; @@ -1472,7 +1472,10 @@ ListWatcherMorph.prototype.expand = function (maxExtent) { // ListWatcherMorph context menu ListWatcherMorph.prototype.userMenu = function () { - if (!List.prototype.enableTables) { + var world = this.world(), + ide = detect(world.children, m => m instanceof IDE_Morph); + + if (!List.prototype.enableTables || ide.isAppMode) { return this.escalateEvent('userMenu'); } var menu = new MenuMorph(this); @@ -1481,8 +1484,6 @@ ListWatcherMorph.prototype.userMenu = function () { menu.addItem( 'blockify', () => { - var world = this.world(), - ide = detect(world.children, m => m instanceof IDE_Morph); this.list.blockify().pickUp(world); world.hand.grabOrigin = { origin: ide.palette, @@ -1490,6 +1491,24 @@ ListWatcherMorph.prototype.userMenu = function () { }; } ); + menu.addItem( + 'export', + () => { + if (this.list.canBeCSV()) { + ide.saveFileAs( + this.list.asCSV(), + 'text/csv;charset=utf-8', // RFC 4180 + localize('data') // name + ); + } else { + ide.saveFileAs( + this.list.asJSON(true), // guessObjects + 'text/json;charset=utf-8', + localize('data') // name + ); + } + } + ); } menu.addLine(); menu.addItem(